[Uml-devel] branches/KDE/3.5/kdesdk/umbrello

Gaël de Chalendar kleag at free.fr
Sun Aug 20 15:56:05 UTC 2006


SVN commit 574994 by kleag:

After receiving an authorization from kde-i18n, I backported doc generators for umbrello from trunk to 3.5 branch, thus adding two new menu entries.

 M  +23 -0     configure.in.in  
 M  +2 -2      umbrello/Makefile.am  
 A             umbrello/docgenerators (directory)  
 A             umbrello/docgenerators/Makefile.am  
 A             umbrello/docgenerators/common.ent  
 A             umbrello/docgenerators/docbook2xhtml.xsl  
 A             umbrello/docgenerators/docbookgenerator.cpp   [License: GPL (v2+)]
 A             umbrello/docgenerators/docbookgenerator.h   [License: GPL (v2+) GENERATED FILE]
 A             umbrello/docgenerators/main.cpp   [License: GPL (v2+)]
 A             umbrello/docgenerators/xhtmlgenerator.cpp   [License: GPL (v2+)]
 A             umbrello/docgenerators/xhtmlgenerator.h   [License: GPL (v2+) GENERATED FILE]
 A             umbrello/docgenerators/xmi.css  
 A             umbrello/docgenerators/xmi2docbook.sh  
 A             umbrello/docgenerators/xmi2docbook.xsl  
 M  +3 -0      umbrello/main.cpp  
 M  +6 -0      umbrello/umbrelloui.rc  
 M  +35 -1     umbrello/uml.cpp  
 M  +31 -0     umbrello/uml.h  


--- branches/KDE/3.5/kdesdk/umbrello/configure.in.in #574993:574994
@@ -41,3 +41,26 @@
 dnl #endif
 dnl ])
 
+
+AC_LANG_SAVE
+AC_LANG_C
+
+AC_CHECK_HEADER(libxml2/libxml/xmlmemory.h,
+  [have_libxml2=yes],
+  [have_libxml2=no])
+
+if test "$have_libxml2" = "no"; then
+  DO_NOT_COMPILE="$DO_NOT_COMPILE umbrello"
+fi
+
+AC_CHECK_HEADER(libxslt/xslt.h,
+  [have_libxslt=yes],
+  [have_libxslt=no])
+
+if test "$have_libxslt" = "no"; then
+  DO_NOT_COMPILE="$DO_NOT_COMPILE umbrello"
+fi
+
+AC_LANG_RESTORE
+
+
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/Makefile.am #574993:574994
@@ -113,11 +113,11 @@
 worktoolbar.cpp
 
 #umbrello_LDADD   = ./refactoring/librefactoring.la ./codeimport/libcodeimport.la ./codeimport/kdevcppparser/libkdevcppparser.la ./clipboard/libclipboard.la ./dialogs/libdialogs.la ./codegenerators/libcodegenerator.la $(AUTOLAYOUT_LIBS) $(LIB_KDEPRINT) $(LIB_KIO)
-umbrello_LDADD = ./refactoring/librefactoring.la ./codeimport/libcodeimport.la ./codeimport/kdevcppparser/libkdevcppparser.la ./clipboard/libclipboard.la ./dialogs/libdialogs.la ./codegenerators/libcodegenerator.la $(LIB_KDEPRINT) $(LIB_KIO)
+umbrello_LDADD = ./refactoring/librefactoring.la ./codeimport/libcodeimport.la ./codeimport/kdevcppparser/libkdevcppparser.la ./clipboard/libclipboard.la ./dialogs/libdialogs.la ./codegenerators/libcodegenerator.la ./docgenerators/libdocgenerators.la $(LIB_KDEPRINT) $(LIB_KIO) -lxslt -lxml2
 
 ## See section "dnl Not GPL compatible" in ../configure.in.in
 # SUBDIRS = $(AUTOLAYOUT_DIR) codeimport dialogs clipboard pics codegenerators headings refactoring
-SUBDIRS = codeimport dialogs clipboard pics codegenerators headings refactoring
+SUBDIRS = codeimport dialogs docgenerators clipboard pics codegenerators headings refactoring
 
 KDE_ICON=AUTO
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/main.cpp #574993:574994
@@ -32,6 +32,9 @@
     I18N_NOOP("Umbrello UML Modeller");
 // INSERT A DESCRIPTION FOR YOUR APPLICATION HERE
 
+/**
+ * @todo Add options to use the documentation generators from command line.
+ */
 static KCmdLineOptions options[] =
     {
         { "+[File]", I18N_NOOP("File to open"), 0 },
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umbrelloui.rc #574993:574994
@@ -1,6 +1,12 @@
 <!DOCTYPE kpartgui>
 <kpartgui name="umbrello" version="11">
 <MenuBar>
+  <Menu name="file"><text>&File</text>
+      <Menu name="file_export"><text>&Export</text>
+          <Action name="file_export_docbook"/>
+          <Action name="file_export_xhtml"/>
+      </Menu>
+  </Menu>
   <Menu name="edit"><text>&Edit</text>
     <Action name="delete_selected"/>
   </Menu>
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.cpp #574993:574994
@@ -78,6 +78,9 @@
 
 #include "cmdlineexportallviewsevent.h"
 
+#include "docgenerators/docbookgenerator.h"
+#include "docgenerators/xhtmlgenerator.h"
+
 UMLApp::UMLApp(QWidget* , const char* name):KDockMainWindow(0, name) {
     s_instance = this;
     m_pDocWindow = 0;
@@ -91,6 +94,7 @@
     m_codegen = 0;
     m_policyext = 0;
     m_commoncodegenpolicy = 0;
+    m_xhtmlGenerator = 0;
     m_activeLanguage = Uml::pl_Reserved;
     ///////////////////////////////////////////////////////////////////
     // call inits to invoke all other construction parts
@@ -179,7 +183,13 @@
     viewStatusBar = KStdAction::showStatusbar(this, SLOT(slotViewStatusBar()), actionCollection());
 #endif
     selectAll = KStdAction::selectAll(this,  SLOT( slotSelectAll() ), actionCollection());
-
+    fileExportDocbook = new KAction(i18n("&Export model to DocBook"), 0, 
+                                    this, SLOT( slotFileExportDocbook() ), 
+                                    actionCollection(), "file_export_docbook");
+    fileExportXhtml = new KAction(i18n("&Export model to XHTML"), 0, 
+                                    this, SLOT( slotFileExportXhtml() ),
+                                    actionCollection(), "file_export_xhtml");
+    
     classWizard = new KAction(i18n("&New Class Wizard..."),0,this,SLOT(slotClassWizard()),
                               actionCollection(),"class_wizard");
     new KAction(i18n("&Add Default Datatypes for Active Language"), 0, this,
@@ -203,6 +213,8 @@
     fileClose->setToolTip(i18n("Closes the document"));
     filePrint ->setToolTip(i18n("Prints out the document"));
     fileQuit->setToolTip(i18n("Quits the application"));
+    fileExportDocbook->setToolTip(i18n("Exports the model to the docbook format"));
+    fileExportXhtml->setToolTip(i18n("Exports the model to the XHTML format"));
     editCut->setToolTip(i18n("Cuts the selected section and puts it to the clipboard"));
     editCopy->setToolTip(i18n("Copies the selected section to the clipboard"));
     editPaste->setToolTip(i18n("Pastes the contents of the clipboard"));
@@ -807,6 +819,22 @@
     slotStatusMsg(i18n("Ready."));
 }
 
+void UMLApp::slotFileExportDocbook()
+{
+  DocbookGenerator().generateDocbookForProject();
+}
+    
+void UMLApp::slotFileExportXhtml()
+{
+  if (m_xhtmlGenerator != 0)
+  {
+    return;
+  }
+  m_xhtmlGenerator = new XhtmlGenerator();
+  m_xhtmlGenerator->generateXhtmlForProject();
+  connect(m_xhtmlGenerator,SIGNAL(finished()),this,SLOT(slotXhtmlDocGenerationFinished()));
+}
+    
 void UMLApp::slotEditUndo() {
     m_doc->loadUndoData();
     slotStatusMsg(i18n("Ready."));
@@ -1656,6 +1684,12 @@
 #endif
 }
 
+void UMLApp::slotXhtmlDocGenerationFinished()
+{
+  delete m_xhtmlGenerator;
+  m_xhtmlGenerator = 0;
+}
+
 KTabWidget* UMLApp::tabWidget() {
     return m_tabWidget;
 }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.h #574993:574994
@@ -42,6 +42,7 @@
 class UMLViewImageExporterAll;
 class RefactoringAssistant;
 class KPlayerPopupSliderAction;
+class XhtmlGenerator;
 
 // KDE forward declarations
 class KActionMenu;
@@ -488,7 +489,23 @@
      */
     void slotFileQuit();
     
+     /**
+      * Exports the current model to docbook in a subdir of the 
+      * current model directory named from the model name.
+      * @todo Let the user chose the destination directory and 
+      * name, using network transparency.
+      */
+    void slotFileExportDocbook();
+    
     /**
+     * Exports the current model to XHTML in a subdir of the 
+     * current model directory named from the model name.
+     * @todo Let the user chose the destination directory and 
+     * name, using network transparency.
+     */
+    void slotFileExportXhtml();
+    
+    /**
      * Put the marked text/object into the clipboard and remove
      * it from the document.
      */
@@ -789,6 +806,12 @@
 
     KConfig *getConfig() { return m_config; }
 
+    /**
+     * This slot deletes the current XHTML documentation generator as soon as
+     * this one signals that it has finished.
+     */
+    void slotXhtmlDocGenerationFinished();
+
 private:
     static UMLApp* s_instance;
 
@@ -900,6 +923,8 @@
     KAction* fileClose;
     KAction* filePrint;
     KAction* fileQuit;
+    KAction* fileExportDocbook;
+    KAction* fileExportXhtml;
 
     KAction* editCut;
     KAction* editCopy;
@@ -995,6 +1020,12 @@
      */
     UMLViewImageExporterAll* m_imageExporterAll;
 
+    /**
+     * The running XHTML documentation generator. null when no generation is
+     * running
+     */
+    XhtmlGenerator* m_xhtmlGenerator;
+
 signals:
 
     /**




More information about the umbrello-devel mailing list