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

Miklos Vajna vmiklos at collabora.co.uk
Thu Dec 18 01:50:34 PST 2014


 editeng/source/items/textitem.cxx   |   10 ++++++++++
 include/editeng/fhgtitem.hxx        |    2 ++
 sw/source/core/docnode/nodedump.cxx |   12 ++++--------
 3 files changed, 16 insertions(+), 8 deletions(-)

New commits:
commit 2a6dc39ba96648a296fcad29a7a0a44f7e749e2a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Dec 18 10:49:35 2014 +0100

    Factor out SvxFontHeightItem::dumpAsXml() from sw
    
    Change-Id: I8dc3a0ed7bfce62b0d20c6bff143d77c0f26963f

diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 3ea6bb7..16870d9 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1128,6 +1128,16 @@ void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
     ePropUnit = eMetric;
 }
 
+void SvxFontHeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("svxFontHeightItem"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("height"), BAD_CAST(OString::number(nHeight).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("prop"), BAD_CAST(OString::number(nProp).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("propUnit"), BAD_CAST(OString::number(ePropUnit).getStr()));
+    xmlTextWriterEndElement(pWriter);
+}
+
 // class SvxFontWidthItem -----------------------------------------------
 
 SvxFontWidthItem::SvxFontWidthItem( const sal_uInt16 nSz, const sal_uInt16 nPrp, const sal_uInt16 nId ) :
diff --git a/include/editeng/fhgtitem.hxx b/include/editeng/fhgtitem.hxx
index e069f1b..7034dcf 100644
--- a/include/editeng/fhgtitem.hxx
+++ b/include/editeng/fhgtitem.hxx
@@ -91,6 +91,8 @@ public:
     sal_uInt16 GetProp() const { return nProp; }
 
     SfxMapUnit GetPropUnit() const { return ePropUnit;  }   // Percent, Twip, ...
+
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 #endif
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index a83799b..f6cd7f8 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -414,11 +414,15 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
                 static_cast<const SwNumRuleItem*>(pItem)->dumpAsXml(writer);
                 break;
             case RES_CHRATR_FONT:
+            case RES_CHRATR_CTL_FONT:
                 static_cast<const SvxFontItem*>(pItem)->dumpAsXml(writer);
                 break;
             case RES_CHRATR_BACKGROUND:
                 static_cast<const SvxBrushItem*>(pItem)->dumpAsXml(writer);
                 break;
+            case RES_CHRATR_FONTSIZE:
+                static_cast<const SvxFontHeightItem*>(pItem)->dumpAsXml(writer);
+                break;
             default: bDone = false; break;
         }
         if (bDone)
@@ -433,14 +437,6 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
         boost::optional<OString> oValue;
         switch (pItem->Which())
         {
-            case RES_CHRATR_CTL_FONT: pWhich = "character ctl font"; break;
-            case RES_CHRATR_FONTSIZE:
-            {
-                pWhich = "character font size";
-                const SvxFontHeightItem* pFontHeightItem = static_cast<const SvxFontHeightItem*>(pItem);
-                oValue = "nHeight: " + OString::number(pFontHeightItem->GetHeight()) + ", nProp: " + OString::number(pFontHeightItem->GetProp());
-                break;
-            }
             case RES_CNTNT:
             {
                 pWhich = "content";


More information about the Libreoffice-commits mailing list