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

Miklos Vajna vmiklos at collabora.co.uk
Tue Dec 16 00:07:10 PST 2014


 editeng/source/items/textitem.cxx   |   12 ++++++++++++
 include/editeng/fontitem.hxx        |    1 +
 sw/source/core/docnode/nodedump.cxx |    4 +++-
 3 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit d54e21eaa2d4baf85484063476d0aa1769b50583
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Dec 16 09:06:05 2014 +0100

    Factor out SvxFontItem::dumpAsXml() from sw
    
    Change-Id: I8283ddd868639e6535e27798d91a7273d77f048c

diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 4d75b47..3ea6bb7 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -457,6 +457,18 @@ void SvxFontItem::EnableStoreUnicodeNames( bool bEnable )
     bEnableStoreUnicodeNames = bEnable;
 }
 
+void SvxFontItem::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("svxFontItem"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("familyName"), BAD_CAST(aFamilyName.toUtf8().getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("styleName"), BAD_CAST(aStyleName.toUtf8().getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("family"), BAD_CAST(OString::number(eFamily).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("pitch"), BAD_CAST(OString::number(ePitch).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("textEncoding"), BAD_CAST(OString::number(eTextEncoding).getStr()));
+    xmlTextWriterEndElement(pWriter);
+}
+
 // class SvxPostureItem --------------------------------------------------
 
 SvxPostureItem::SvxPostureItem( const FontItalic ePosture, const sal_uInt16 nId ) :
diff --git a/include/editeng/fontitem.hxx b/include/editeng/fontitem.hxx
index 3b9fbb2..6a2cb8a 100644
--- a/include/editeng/fontitem.hxx
+++ b/include/editeng/fontitem.hxx
@@ -87,6 +87,7 @@ public:
 
     static void EnableStoreUnicodeNames( bool bEnable );
 
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 EDITENG_DLLPUBLIC void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian,
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 877a41f..17540bc 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -413,6 +413,9 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
             case RES_PARATR_NUMRULE:
                 static_cast<const SwNumRuleItem*>(pItem)->dumpAsXml(writer);
                 break;
+            case RES_CHRATR_FONT:
+                static_cast<const SvxFontItem*>(pItem)->dumpAsXml(writer);
+                break;
             default: bDone = false; break;
         }
         if (bDone)
@@ -427,7 +430,6 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
         boost::optional<OString> oValue;
         switch (pItem->Which())
         {
-            case RES_CHRATR_FONT: pWhich = "character font"; oValue = OUStringToOString(static_cast<const SvxFontItem*>(pItem)->GetFamilyName(), RTL_TEXTENCODING_UTF8); break;
             case RES_CHRATR_BACKGROUND: pWhich = "character background"; break;
             case RES_CHRATR_CTL_FONT: pWhich = "character ctl font"; break;
             case RES_CHRATR_FONTSIZE:


More information about the Libreoffice-commits mailing list