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

Miklos Vajna vmiklos at collabora.co.uk
Fri Dec 5 00:09:22 PST 2014


 editeng/source/items/textitem.cxx   |    9 +++++++++
 include/editeng/postitem.hxx        |    2 ++
 sw/source/core/docnode/nodedump.cxx |   20 +++++++++++++++++---
 3 files changed, 28 insertions(+), 3 deletions(-)

New commits:
commit 3434327a5f2559a6d24146b35236042fe8741038
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 5 09:07:36 2014 +0100

    Factor out SvxPostureItem::dumpAsXml() from sw
    
    Again, the motivation is that dumper for something in editeng should be
    in that module as well, before home-grown dumpers are invented and
    duplicated e.g. in all sw/sc/sd.
    
    Change-Id: Icfeed9549efbd80226ff04e9070766188cc8646e

diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index b4f5303..aa0e57c 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -93,6 +93,7 @@
 #include <editeng/charreliefitem.hxx>
 #include <editeng/itemtype.hxx>
 #include <editeng/eerdll.hxx>
+#include <libxml/xmlwriter.h>
 
 #define STORE_UNICODE_MAGIC_MARKER  0xFE331188
 
@@ -588,6 +589,14 @@ void SvxPostureItem::SetBoolValue( bool bVal )
     SetValue( (sal_uInt16)(bVal ? ITALIC_NORMAL : ITALIC_NONE) );
 }
 
+void SvxPostureItem::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("svxPostureItem"));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("whichId"), "%" SAL_PRIuUINT32, Which());
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(GetValueTextByPos(GetValue()).toUtf8().getStr()));
+    xmlTextWriterEndElement(pWriter);
+}
+
 // class SvxWeightItem ---------------------------------------------------
 
 SvxWeightItem::SvxWeightItem( const FontWeight eWght, const sal_uInt16 nId ) :
diff --git a/include/editeng/postitem.hxx b/include/editeng/postitem.hxx
index 00cbbf4..2651415 100644
--- a/include/editeng/postitem.hxx
+++ b/include/editeng/postitem.hxx
@@ -69,6 +69,8 @@ public:
                                 { return (FontItalic)GetValue(); }
     void                    SetPosture( FontItalic eNew )
                                 { SetValue( (sal_uInt16)eNew ); }
+
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 #endif // INCLUDED_EDITENG_POSTITEM_HXX
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 190f753..705e34a 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -45,6 +45,7 @@
 #include <editeng/fhgtitem.hxx>
 #include <editeng/editobj.hxx>
 #include <editeng/outlobj.hxx>
+#include <editeng/postitem.hxx>
 #include <svx/xdef.hxx>
 #include <svx/svdpage.hxx>
 #include <svx/svdmodel.hxx>
@@ -386,17 +387,30 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
     const SfxPoolItem* pItem = aIter.FirstItem();
     while (pItem)
     {
+        bool bDone = true;
+        switch (pItem->Which())
+        {
+            case RES_CHRATR_POSTURE:
+            case RES_CHRATR_CJK_POSTURE:
+            case RES_CHRATR_CTL_POSTURE:
+                static_cast<const SvxPostureItem*>(pItem)->dumpAsXml(writer);
+                break;
+            default: bDone = false; break;
+        }
+        if (bDone)
+        {
+            pItem = aIter.NextItem();
+            continue;
+        }
+
         writer.startElement("item");
         writer.writeFormatAttribute("whichId", TMP_FORMAT, pItem->Which());
         const char* pWhich = 0;
         boost::optional<OString> oValue;
         switch (pItem->Which())
         {
-            case RES_CHRATR_POSTURE: pWhich = "character posture"; break;
             case RES_CHRATR_WEIGHT: pWhich = "character weight"; break;
-            case RES_CHRATR_CJK_POSTURE: pWhich = "character cjk posture"; break;
             case RES_CHRATR_CJK_WEIGHT: pWhich = "character cjk weight"; break;
-            case RES_CHRATR_CTL_POSTURE: pWhich = "character ctl posture"; break;
             case RES_CHRATR_CTL_WEIGHT: pWhich = "character ctl weight"; break;
             case RES_CHRATR_RSID:
             {


More information about the Libreoffice-commits mailing list