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

Miklos Vajna vmiklos at collabora.co.uk
Wed Jan 21 00:35:57 PST 2015


 sw/inc/fmtpdsc.hxx                  |    1 +
 sw/source/core/docnode/nodedump.cxx |   11 +++--------
 sw/source/core/layout/atrfrm.cxx    |   14 ++++++++++++++
 3 files changed, 18 insertions(+), 8 deletions(-)

New commits:
commit 7fe28b2c7b9a1fd5718e1f5b6562cf93902d6be0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jan 21 09:34:41 2015 +0100

    Factor out SwFmtPageDesc::dumpAsXml() from docnode
    
    Change-Id: I813804ece7507fef84c43ba8fc290b151c8063ab

diff --git a/sw/inc/fmtpdsc.hxx b/sw/inc/fmtpdsc.hxx
index 6661b32..202f4be 100644
--- a/sw/inc/fmtpdsc.hxx
+++ b/sw/inc/fmtpdsc.hxx
@@ -81,6 +81,7 @@ public:
     void RegisterToEndNotInfo( SwEndNoteInfo& );
     void RegisterToPageDesc( SwPageDesc& );
     bool KnowsPageDesc() const;
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 inline const SwFmtPageDesc &SwAttrSet::GetPageDesc(bool bInP) const
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index b05809a..6717299 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -499,6 +499,9 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
             case RES_SHADOW:
                 static_cast<const SvxShadowItem*>(pItem)->dumpAsXml(writer);
                 break;
+            case RES_PAGEDESC:
+                static_cast<const SwFmtPageDesc*>(pItem)->dumpAsXml(writer);
+                break;
             default: bDone = false; break;
         }
         if (bDone)
@@ -513,14 +516,6 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
         boost::optional<OString> oValue;
         switch (pItem->Which())
         {
-            case RES_PAGEDESC:
-            {
-                pWhich = "page description";
-                const SwFmtPageDesc* pFmt = static_cast<const SwFmtPageDesc*>(pItem);
-                if (pFmt->GetPageDesc())
-                    oValue = "name: " + OUStringToOString(pFmt->GetPageDesc()->GetName(), RTL_TEXTENCODING_UTF8);
-                break;
-            }
             case RES_FRMATR_STYLE_NAME:
             {
                 pWhich = "frame style name";
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index b7c7d6e..5f1bf97 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -769,6 +769,20 @@ bool SwFmtPageDesc::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
     return bRet;
 }
 
+void SwFmtPageDesc::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("swFmtPageDesc"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
+    if (oNumOffset)
+        xmlTextWriterWriteAttribute(pWriter, BAD_CAST("oNumOffset"), BAD_CAST(OString::number(*oNumOffset).getStr()));
+    else
+        xmlTextWriterWriteAttribute(pWriter, BAD_CAST("oNumOffset"), BAD_CAST("none"));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("pPageDesc"), "%p", GetPageDesc());
+    if (const SwPageDesc* pPageDesc = GetPageDesc())
+        xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(pPageDesc->GetName().toUtf8().getStr()));
+    xmlTextWriterEndElement(pWriter);
+}
+
 //  class SwFmtCol
 //  Partially implemented inline in hxx
 


More information about the Libreoffice-commits mailing list