[Libreoffice-commits] core.git: include/sfx2 sfx2/source sw/inc sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Jul 29 07:08:35 UTC 2016


 include/sfx2/viewsh.hxx             |    1 +
 sfx2/source/view/viewsh.cxx         |    8 ++++++++
 sw/inc/view.hxx                     |    2 ++
 sw/source/core/text/xmldump.cxx     |   12 +++++++++---
 sw/source/uibase/uiview/viewprt.cxx |   10 ++++++++++
 5 files changed, 30 insertions(+), 3 deletions(-)

New commits:
commit 73c8bc849c0024d5d81ab0370cffa6aa24b56d22
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jul 28 20:58:12 2016 +0200

    sw layout xml dump: mention SfxViewShell addresses
    
    Change-Id: I2e5c8102684494fd3d7c1c70971a09d0c940a124
    Reviewed-on: https://gerrit.libreoffice.org/27637
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 56888ca..a665913 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -333,6 +333,7 @@ public:
     bool isTiledSearching() const;
     /// See lok::Document::getPart().
     virtual int getPart() const;
+    virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 1bac0ac5..2108633 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -85,6 +85,7 @@
 #include <shellimpl.hxx>
 
 #include <vector>
+#include <libxml/xmlwriter.h>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -1501,6 +1502,13 @@ int SfxViewShell::getPart() const
     return 0;
 }
 
+void SfxViewShell::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("sfxViewShell"));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+    xmlTextWriterEndElement(pWriter);
+}
+
 bool SfxViewShell::KeyInput( const KeyEvent &rKeyEvent )
 
 /*  [Description]
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index c9cccd0..38f7c6c 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -645,6 +645,8 @@ public:
     static SvxSearchItem* GetSearchItem() { return m_pSrchItem; }
     /// See SfxViewShell::getPart().
     int getPart() const override;
+    /// See SfxViewShell::dumpAsXml().
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
 };
 
 inline long SwView::GetXScroll() const
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 8085036..e97ba35 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -22,6 +22,7 @@
 #include <anchoredobject.hxx>
 #include <libxml/xmlwriter.h>
 #include <SwPortionHandler.hxx>
+#include <view.hxx>
 #include <svx/svdobj.hxx>
 
 class XmlPortionDumper:public SwPortionHandler
@@ -293,9 +294,14 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const
         if (IsRootFrame())
         {
             const SwRootFrame* pRootFrame = static_cast<const SwRootFrame*>(this);
-            xmlTextWriterStartElement(writer, BAD_CAST("shells"));
-            for (SwViewShell& rViewShell : pRootFrame->GetCurrShell()->GetRingContainer())
-                rViewShell.dumpAsXml(writer);
+            xmlTextWriterStartElement(writer, BAD_CAST("sfxViewShells"));
+            SwView* pView = static_cast<SwView*>(SfxViewShell::GetFirst(true, checkSfxViewShell<SwView>));
+            while (pView)
+            {
+                if (pView->GetObjectShell() == pRootFrame->GetCurrShell()->GetSfxViewShell()->GetObjectShell())
+                    pView->dumpAsXml(writer);
+                pView = static_cast<SwView*>(SfxViewShell::GetNext(*pView, true, checkSfxViewShell<SwView>));
+            }
             xmlTextWriterEndElement(writer);
         }
 
diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx
index 852b510..1b727c8 100644
--- a/sw/source/uibase/uiview/viewprt.cxx
+++ b/sw/source/uibase/uiview/viewprt.cxx
@@ -19,6 +19,7 @@
 
 #include <com/sun/star/text/NotePrintMode.hpp>
 #include <cstdarg>
+#include <libxml/xmlwriter.h>
 #include <cmdid.h>
 #include <sfx2/request.hxx>
 #include <sfx2/progress.hxx>
@@ -258,6 +259,15 @@ int SwView::getPart() const
     return nPage - 1;
 }
 
+void SwView::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("swView"));
+    SfxViewShell::dumpAsXml(pWriter);
+    if (m_pWrtShell)
+        m_pWrtShell->dumpAsXml(pWriter);
+    xmlTextWriterEndElement(pWriter);
+}
+
 // Create page printer/additions for SwView and SwPagePreview
 
 VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent,


More information about the Libreoffice-commits mailing list