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

Miklos Vajna vmiklos at collabora.co.uk
Fri Sep 13 00:21:47 PDT 2013


 sw/source/core/text/xmldump.cxx |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

New commits:
commit 91efe73bb00855edb75d57e964eaf1e89a5f5935
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Sep 13 09:13:27 2013 +0200

    SwFrm::dumpAsXml: dump cursor positions as well
    
    Change-Id: Icd832483228812cf3c8ddff3c0d56090f3b17856

diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index b38816a..fabdcd8 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -13,6 +13,8 @@
 #include "tabfrm.hxx"
 #include "txtfrm.hxx"
 #include "hffrm.hxx"
+#include "rootfrm.hxx"
+#include "editsh.hxx"
 #include "porlin.hxx"
 #include "porlay.hxx"
 #include "portxt.hxx"
@@ -287,6 +289,28 @@ void SwFrm::dumpAsXml( xmlTextWriterPtr writer )
 
         dumpAsXmlAttributes( writer );
 
+        if (IsRootFrm())
+        {
+            // Root frame has access to the edit shell, so dump the current selection ranges here.
+            SwRootFrm* const pRootFrm = static_cast<SwRootFrm* const>(this);
+            SwEditShell* pEditShell = pRootFrm->GetCurrShell()->GetDoc()->GetEditShell();
+            xmlTextWriterStartElement(writer, BAD_CAST("shellCrsr"));
+            SwPaM* pPaM = pEditShell->getShellCrsr(false);
+            do
+            {
+                xmlTextWriterStartElement(writer, BAD_CAST("swpam"));
+                xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("pointNodeIndex"), "%ld", pPaM->GetPoint()->nNode.GetIndex());
+                xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("pointContentIndex"), "%d", pPaM->GetPoint()->nContent.GetIndex());
+
+                xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("markNodeIndex"), "%ld", pPaM->GetMark()->nNode.GetIndex());
+                xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("markContentIndex"), "%d", pPaM->GetMark()->nContent.GetIndex());
+                xmlTextWriterEndElement(writer);
+                pPaM = static_cast<SwPaM*>(pPaM->GetNext());
+            }
+            while (pPaM && pPaM != pEditShell->getShellCrsr(false));
+            xmlTextWriterEndElement(writer);
+        }
+
         xmlTextWriterStartElement( writer, BAD_CAST( "infos" ) );
         dumpInfosAsXml( writer );
         xmlTextWriterEndElement( writer );


More information about the Libreoffice-commits mailing list