[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - include/svx sd/inc sd/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Feb 16 09:23:04 PST 2015


 include/svx/svdmodel.hxx       |    2 +-
 sd/inc/drawdoc.hxx             |    2 ++
 sd/source/core/drawdoc.cxx     |   20 ++++++++++++++++++++
 sd/source/ui/view/sdwindow.cxx |    6 ++++++
 4 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 78f341b1f29d3d02aa0bf727067ee047d603a84c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Feb 16 15:16:57 2015 +0100

    sd: add SdDrawDocument::dumpAsXml()
    
    SdDrawDocument inherits from SdrModel which already has an XML dumper,
    so just add an sd method that can create the XML writer and then we get
    the rest for free.
    
    Change-Id: Iac9bfb779e111f9887f171db6f5bd5151dd7e447

diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index b3fa3c4..ddcd369 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -663,7 +663,7 @@ public:
         also during the runtime of the Undo() and Redo() methods. */
     bool IsUndoEnabled() const;
 
-    void dumpAsXml(struct _xmlTextWriter* pWriter) const;
+    virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index 524dcba..17d19fd 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -591,6 +591,8 @@ public:
     SAL_DLLPRIVATE bool IsUsingEmbededFonts() { return mbUseEmbedFonts; }
     SAL_DLLPRIVATE void SetIsUsingEmbededFonts( bool bUse ) { mbUseEmbedFonts = bUse; }
 
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const SAL_OVERRIDE;
+
 private:
     /** This member stores the printer independent layout mode.  Please
         refer to <member>SetPrinterIndependentLayout()</member> for its
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index d80b5fb..6948639 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <libxml/xmlwriter.h>
+
 #include "PageListWatcher.hxx"
 #include <com/sun/star/text/WritingMode.hpp>
 #include <com/sun/star/document/PrinterIndependentLayout.hpp>
@@ -1047,4 +1049,22 @@ void SdDrawDocument::InitObjectVector()
         }
     }
 }
+
+void SdDrawDocument::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    bool bOwns = false;
+    if (!pWriter)
+    {
+        pWriter = xmlNewTextWriterFilename("model.xml", 0);
+        xmlTextWriterStartDocument(pWriter, NULL, NULL, NULL);
+        bOwns = true;
+    }
+    FmFormModel::dumpAsXml(pWriter);
+    if (bOwns)
+    {
+        xmlTextWriterEndDocument(pWriter);
+        xmlFreeTextWriter(pWriter);
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 5f5061b..880c82d 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -213,6 +213,12 @@ void Window::Paint(const Rectangle& rRect)
 
 void Window::KeyInput(const KeyEvent& rKEvt)
 {
+    if (getenv("SD_DEBUG") && rKEvt.GetKeyCode().GetCode() == KEY_F12 && mpViewShell)
+    {
+        mpViewShell->GetDoc()->dumpAsXml(0);
+        return;
+    }
+
     if (!(mpViewShell && mpViewShell->KeyInput(rKEvt, this)))
     {
         if (mpViewShell && rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE)


More information about the Libreoffice-commits mailing list