uml.h
00001 /*************************************************************************** 00002 * * 00003 * This program is free software; you can redistribute it and/or modify * 00004 * it under the terms of the GNU General Public License as published by * 00005 * the Free Software Foundation; either version 2 of the License, or * 00006 * (at your option) any later version. * 00007 * * 00008 * copyright (C) 2002-2006 * 00009 * Umbrello UML Modeller Authors <uml-devel@uml.sf.net> * 00010 ***************************************************************************/ 00011 00012 #ifndef UML_H 00013 #define UML_H 00014 00015 #ifdef HAVE_CONFIG_H 00016 #include <config.h> 00017 #endif 00018 00019 #include "umlnamespace.h" 00020 00021 #include <qmap.h> 00022 #include <qdict.h> 00023 00024 #include <kdockwidget.h> 00025 #include <kdeversion.h> 00026 #include <kurl.h> 00027 00028 // forward declaration of the UML classes 00029 class AlignToolBar; 00030 class CodeDocument; 00031 class CodeGenerator; 00032 class CodeGenerationPolicy; 00033 class CodeGenPolicyExt; 00034 class DocWindow; 00035 class UMLClassifier; 00036 class UMLDoc; 00037 class UMLListView; 00038 class UMLView; 00039 class WorkToolBar; 00040 class SettingsDlg; 00041 class UMLViewImageExporterAll; 00042 class RefactoringAssistant; 00043 class KPlayerPopupSliderAction; 00044 class XhtmlGenerator; 00045 00046 // KDE forward declarations 00047 class KActionMenu; 00048 class KRecentFilesAction; 00049 class KStatusBarLabel; 00050 class KToggleAction; 00051 class KDockWidget; 00052 class KTabWidget; 00053 class KToolBarButton; 00054 class KPopupMenu; 00055 00056 // Qt forward declarations 00057 class QWidgetStack; 00058 class QMenuData; 00059 class QClipboard; 00060 class QToolButton; 00061 class QCustomEvent; 00062 00078 class UMLApp : public KDockMainWindow { 00079 Q_OBJECT 00080 public: 00084 UMLApp(QWidget* parent=0, const char* name=0); 00085 00089 ~UMLApp(); 00090 00091 static UMLApp* app(); 00092 00096 void openDocumentFile(const KURL& url=KURL()); 00097 00101 void newDocument(); 00102 00108 UMLDoc *getDocument() const; 00109 00115 UMLListView* getListView(); 00116 00122 WorkToolBar* getWorkToolBar(); 00123 00130 void setModified(bool _m); 00131 00138 void enablePrint(bool enable); 00139 00146 void enableUndo(bool enable); 00147 00154 void enableRedo(bool enable); 00155 00161 DocWindow * getDocWindow() { 00162 return m_pDocWindow; 00163 } 00164 00170 bool getUndoEnabled(); 00171 00177 bool getRedoEnabled(); 00178 00184 bool getPasteState(); 00185 00191 bool getCutCopyState(); 00192 00198 CodeGenerator* getGenerator(); 00199 00209 void setGenerator(CodeGenerator* gen, bool giveWarning = true); 00210 00216 CodeGenerator* createGenerator(); 00217 00225 CodeGenerator *setGenerator(Uml::Programming_Language pl); 00226 00232 void refactor(UMLClassifier* classifier); 00233 00239 void viewCodeDocument(UMLClassifier* classifier); 00240 00246 void setDiagramMenuItemsState(bool bState); 00247 00252 QWidget* getMainViewWidget(); 00253 00260 void setCurrentView(UMLView* view); 00261 00268 UMLView* getCurrentView(); 00269 00276 void setImageMimeType(QString const & mimeType){m_imageMimeType=mimeType;}; 00277 00284 QString const & getImageMimeType()const{return m_imageMimeType;}; 00285 00295 bool editCutCopy( bool bFromView ); 00296 00300 KTabWidget *tabWidget(); 00301 00307 QString getStatusBarMsg(); 00308 00312 CodeGenerationPolicy *getCommonPolicy(); 00313 00317 void setPolicyExt(CodeGenPolicyExt *policy); 00318 00322 CodeGenPolicyExt *getPolicyExt(); 00323 00324 protected: 00325 virtual void keyPressEvent(QKeyEvent* e); 00326 virtual void keyReleaseEvent(QKeyEvent* e); 00327 00333 virtual void customEvent(QCustomEvent* e); 00334 00338 void handleCursorKeyReleaseEvent(QKeyEvent* e); 00339 00345 void saveOptions(); 00346 00351 void readOptions(); 00352 00356 void initActions(); 00357 00362 void initStatusBar(); 00363 00368 void initView(); 00369 00381 virtual bool queryClose(); 00382 00395 virtual bool queryExit(); 00396 00404 virtual void saveProperties(KConfig *_cfg); 00405 00413 virtual void readProperties(KConfig *_cfg); 00414 00415 CodeGenerationPolicy * m_commoncodegenpolicy; 00416 00423 void updateLangSelectMenu(Uml::Programming_Language activeLanguage); 00424 00425 protected slots: 00426 00430 void tipOfTheDay(); 00431 00432 public slots: 00433 00437 void initGenerator(); 00438 00442 void generationWizard(); 00443 00448 void slotFileNew(); 00449 00453 void slotFileOpen(); 00454 00458 void slotFileOpenRecent(const KURL& url); 00459 00463 void slotFileSave(); 00464 00468 bool slotFileSaveAs(); 00469 00474 void slotFileClose(); 00475 00479 void slotFilePrint(); 00480 00488 void slotFileQuit(); 00489 00496 void slotFileExportDocbook(); 00497 00504 void slotFileExportXhtml(); 00505 00510 void slotEditCut(); 00511 00515 void slotEditCopy(); 00516 00520 void slotEditPaste(); 00521 00526 void slotViewToolBar(); 00527 00532 void slotViewStatusBar(); 00533 00537 void slotAutolayout(); 00538 00544 void slotStatusMsg(const QString &text); 00545 00549 void slotClassDiagram(); 00550 00554 void slotSequenceDiagram(); 00555 00559 void slotCollaborationDiagram(); 00560 00564 void slotUseCaseDiagram(); 00565 00569 void slotStateDiagram(); 00570 00574 void slotActivityDiagram(); 00575 00579 void slotComponentDiagram(); 00580 00584 void slotDeploymentDiagram(); 00588 void slotEntityRelationshipDiagram(); 00589 00593 void slotClipDataChanged(); 00594 00598 void slotCopyChanged(); 00599 00603 void slotPrefs(); 00604 00608 void slotApplyPrefs(); 00609 00614 void slotUpdateViews(); 00615 00619 void generateAllCode(); 00620 00627 void setActiveLanguage(int menuID); 00628 00634 void setActiveLanguage( const QString &activeLanguage ); 00635 00639 Uml::Programming_Language getActiveLanguage(); 00640 00644 bool activeLanguageIsCaseSensitive(); 00645 00649 QString activeLanguageScopeSeparator(); 00650 00656 Uml::Programming_Language getDefaultLanguage(); 00657 00661 void slotCurrentViewClearDiagram(); 00662 00666 void slotCurrentViewToggleSnapToGrid(); 00667 00671 void slotCurrentViewToggleShowGrid(); 00672 00676 void slotCurrentViewExportImage(); 00677 00681 void slotAllViewsExportImage(); 00682 00686 void slotCurrentViewProperties(); 00687 00691 void slotImportClasses(); 00692 00696 void slotClassWizard(); 00697 00701 void slotAddDefaultDatatypes(); 00702 00706 void slotCurrentViewChanged(); 00707 00711 void slotSnapToGridToggled(bool gridOn); 00712 00716 void slotShowGridToggled(bool gridOn); 00717 00721 void slotSelectAll(); 00722 00726 void slotDeleteSelectedWidget(); 00727 00731 void slotDeleteDiagram(); 00732 00738 void setZoom(int zoom); 00739 00746 void slotZoomSliderMoved(int value); 00747 00751 void slotZoom100(); 00752 00756 void setupZoomMenu(); 00757 00762 void slotEditUndo(); 00763 00768 void slotEditRedo(); 00769 00776 QPopupMenu* findMenu(QMenuData* menu, const QString &name); 00777 00781 void slotTabChanged(QWidget* view); 00782 00786 void slotChangeTabLeft(); 00787 00791 void slotChangeTabRight(); 00792 00796 void slotMoveTabLeft(); 00797 00801 void slotMoveTabRight(); 00802 00803 KConfig *getConfig() { return m_config; } 00804 00809 void slotXhtmlDocGenerationFinished(); 00810 00811 private: 00812 static UMLApp* s_instance; 00813 00817 QPopupMenu *m_langSelect; 00818 00822 QPopupMenu *m_zoomSelect; 00823 00827 Uml::Programming_Language m_activeLanguage; 00828 00832 CodeGenerator *m_codegen; 00833 00838 CodeGenPolicyExt *m_policyext; 00839 00843 static bool canDecode(const QMimeSource* mimeSource); 00844 00850 void readOptionState(); 00851 00855 void initClip(); 00856 00863 void initSavedCodeGenerators(); 00864 00868 KConfig* m_config; 00869 00876 UMLView* m_view; 00877 00883 UMLDoc* m_doc; 00884 00888 UMLListView* m_listView; 00889 00893 KDockWidget* m_mainDock; 00894 00898 KDockWidget* m_listDock; 00899 00903 KDockWidget* m_documentationDock; 00904 00908 DocWindow* m_pDocWindow; 00909 00911 RefactoringAssistant* m_refactoringAssist; 00912 00913 //KAction pointers to enable/disable actions 00914 KAction* fileNew; 00915 KAction* fileOpen; 00916 KRecentFilesAction* fileOpenRecent; 00917 KAction* fileSave; 00918 KAction* fileSaveAs; 00919 KAction* fileClose; 00920 KAction* filePrint; 00921 KAction* fileQuit; 00922 KAction* fileExportDocbook; 00923 KAction* fileExportXhtml; 00924 00925 KAction* editCut; 00926 KAction* editCopy; 00927 KAction* editPaste; 00928 KAction* editUndo; 00929 KAction* editRedo; 00930 KAction* selectAll; 00931 KAction* preferences; 00932 00933 KActionMenu* newDiagram; 00934 KAction* classDiagram; 00935 KAction* sequenceDiagram; 00936 KAction* collaborationDiagram; 00937 KAction* useCaseDiagram; 00938 KAction* stateDiagram; 00939 KAction* activityDiagram; 00940 KAction* componentDiagram; 00941 KAction* deploymentDiagram; 00942 KAction* entityRelationshipDiagram; 00943 KAction* viewClearDiagram; 00944 00945 KToggleAction* viewSnapToGrid; 00946 KToggleAction* viewShowGrid; 00947 KAction* viewExportImage; 00948 KAction* viewExportImageAll; 00949 KAction* viewProperties; 00950 00951 KAction* zoom100Action; 00952 KPlayerPopupSliderAction* zoomAction; 00953 00954 KAction* genAll; 00955 KAction* genWizard; 00956 KAction* importClasses; 00957 KAction* classWizard; 00958 KAction* deleteSelectedWidget; 00959 KAction* deleteDiagram; 00960 #ifdef HAVE_DOT 00961 KAction* autolayout; 00962 #endif 00963 00964 KAction* changeTabLeft; 00965 KAction* changeTabRight; 00966 KAction* moveTabLeft; 00967 KAction* moveTabRight; 00968 KToolBarButton* m_newSessionButton; 00969 KPopupMenu* m_diagramMenu; 00970 QToolButton* m_closeDiagramButton; 00971 KToggleAction* viewToolBar; 00972 KToggleAction* viewStatusBar; 00973 WorkToolBar* toolsbar; 00974 QTimer* m_clipTimer; 00975 QTimer* m_copyTimer; 00976 AlignToolBar* m_alignToolBar; 00977 00978 KStatusBarLabel* m_statusLabel; 00979 00983 bool m_loading; 00984 00989 QWidgetStack* m_viewStack; 00990 00995 KTabWidget* m_tabWidget; 00996 01000 QString m_imageMimeType; 01001 01005 SettingsDlg* m_dlg; 01006 01010 UMLViewImageExporterAll* m_imageExporterAll; 01011 01016 XhtmlGenerator* m_xhtmlGenerator; 01017 01018 signals: 01019 01023 void sigCutSuccessful(); 01024 }; 01025 01026 #endif // UML_H
