kplato

kptpart.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999, 2000 Torben Weis <weis@kde.org>
00003    Copyright (C) 2004, 2005 Dag Andersen <danders@get2net.dk>
00004    Copyright (C) 2006 Raphael Langerhorst <raphael.langerhorst@kdemail.net>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef KPLATO_PART_H
00023 #define KPLATO_PART_H
00024 
00025 #include "kpttask.h"
00026 #include "kptconfig.h"
00027 #include "kptwbsdefinition.h"
00028 #include "kptxmlloaderobject.h"
00029 
00030 #include <KoDocument.h>
00031 #include <KoTextZoomHandler.h>
00032 
00033 class KoView;
00034 class KoCommandHistory;
00035 class KCommand;
00036 
00037 namespace KPlato
00038 {
00039 
00040 class View;
00041 class Project;
00042 class ProjectDialog;
00043 class ResourceGroup;
00044 class Context;
00045 class GanttView;
00046 
00047 class Part : public KoDocument, public KoTextZoomHandler {
00048     Q_OBJECT
00049 
00050 public:
00051     Part(QWidget *parentWidget = 0, const char *widgetName = 0,
00052         QObject* parent = 0, const char* name = 0,
00053         bool singleViewMode = false);
00054     ~Part();
00055 
00056     virtual void paintContent(QPainter& painter, const QRect& rect,
00057                   bool transparent = FALSE,
00058                   double zoomX = 1.0, double zoomY = 1.0);
00059 
00060     virtual bool initDoc(InitDocFlags flags, QWidget* parentWidget=0);
00061 
00065     void editProject();
00066 
00067     Project &getProject() { return *m_project; }
00068     const Project &getProject() const { return *m_project; }
00069 
00070     // The load and save functions. Look in the file kplato.dtd for info
00071     virtual bool loadXML(QIODevice *, const QDomDocument &document);
00072     virtual QDomDocument saveXML();
00073 
00074     bool saveOasis(KoStore*, KoXmlWriter*) { return false; }
00075     bool loadOasis(const QDomDocument &, KoOasisStyles &, const QDomDocument&, KoStore *) { return false; }
00076 
00077     void addCommand(KCommand * cmd, bool execute=true);
00078     
00079     void setCommandType(int type);
00080     
00081     Config &config() { return m_config; }
00082     
00083     void generateWBS();
00084     WBSDefinition &wbsDefinition() { return m_wbsDefinition; }
00085     
00086     const XMLLoaderObject &xmlLoader() const { return m_xmlLoader; }
00087 protected:
00088     virtual KoView* createViewInstance(QWidget* parent, const char* name);
00089 
00090 protected slots:
00091     void slotDocumentRestored();
00092     void slotCommandExecuted();
00093     void slotCopyContextFromView();
00094     void slotViewDestroyed();
00095 
00096 private:
00097     Project *m_project;
00098     ProjectDialog *m_projectDialog;
00099     QWidget* m_parentWidget;
00100     View *m_view;
00101     
00106     GanttView* m_embeddedGanttView;
00107     Context* m_embeddedContext;
00108     bool m_embeddedContextInitialized;
00109     
00110     KoCommandHistory *m_commandHistory;
00111     bool m_update, m_calculate, m_baseline;
00112     
00113     Config m_config;
00114     Context *m_context;
00115     
00116     WBSDefinition m_wbsDefinition;
00117     
00118     XMLLoaderObject m_xmlLoader;
00119 };
00120 
00121 }  //KPlato namespace
00122 
00123 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys