00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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 KCommandHistory;
00035 class KCommand;
00036
00037 namespace KPlato
00038 {
00039
00040 class View;
00041 class Project;
00042 class MainProjectDialog;
00043 class ResourceGroup;
00044 class Context;
00045 class GanttView;
00046
00047 class Part : public KoDocument, public KoTextZoomHandler
00048 {
00049 Q_OBJECT
00050
00051 public:
00052 Part( QWidget *parentWidget = 0,
00053 QObject* parent = 0,
00054 bool singleViewMode = false );
00055 ~Part();
00056
00057 virtual void paintContent( QPainter& painter, const QRect& rect,
00058 bool transparent = FALSE,
00059 double zoomX = 1.0, double zoomY = 1.0 );
00060
00064 void editProject();
00065
00066 Project &getProject() { return * m_project; }
00067 const Project &getProject() const { return * m_project; }
00068
00069
00070 virtual bool loadXML( QIODevice *, const QDomDocument &document );
00071 virtual QDomDocument saveXML();
00072
00073 bool saveOasis( KoStore*, KoXmlWriter* ) { return false; }
00074 bool loadOasis( const QDomDocument &, KoOasisStyles &, const QDomDocument&, KoStore * ) { return false; }
00075
00076 void addCommand( KCommand * cmd, bool execute = true );
00077
00078 void setCommandType( int type );
00079
00080 Config &config() { return m_config; }
00081
00082 void generateWBS();
00083 WBSDefinition &wbsDefinition() { return m_wbsDefinition; }
00084
00085 const XMLLoaderObject &xmlLoader() const { return m_xmlLoader; }
00086 protected:
00087 virtual KoView* createViewInstance( QWidget* parent );
00088
00089 protected slots:
00090 void slotDocumentRestored();
00091 void slotCommandExecuted( KCommand * );
00092 void slotCopyContextFromView();
00093 void slotViewDestroyed();
00094
00095 private:
00096 Project *m_project;
00097 MainProjectDialog *m_projectDialog;
00098 QWidget* m_parentWidget;
00099 View *m_view;
00100
00105 GanttView* m_embeddedGanttView;
00106 Context* m_embeddedContext;
00107 bool m_embeddedContextInitialized;
00108
00109 KCommandHistory *m_commandHistory;
00110 bool m_update, m_calculate;
00111
00112 Config m_config;
00113 Context *m_context;
00114
00115 WBSDefinition m_wbsDefinition;
00116
00117 XMLLoaderObject m_xmlLoader;
00118 };
00119
00120 }
00121
00122 #endif