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

Miklos Vajna vmiklos at collabora.co.uk
Mon Jan 5 09:57:17 PST 2015


 include/svx/xfillit0.hxx            |    2 ++
 svx/source/xoutdev/xattr.cxx        |   14 ++++++++++++++
 sw/source/core/docnode/nodedump.cxx |   28 +++-------------------------
 3 files changed, 19 insertions(+), 25 deletions(-)

New commits:
commit 2eb4bd3c8ce8d4ac76680e5179364b12a656ae94
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jan 5 18:39:47 2015 +0100

    Factor out XFillStyleItem::dumpAsXml() from sw
    
    Change-Id: I04aed56c1e32f98f8920530e3ba313765baa1bba

diff --git a/include/svx/xfillit0.hxx b/include/svx/xfillit0.hxx
index 68a1015..4ed3af6 100644
--- a/include/svx/xfillit0.hxx
+++ b/include/svx/xfillit0.hxx
@@ -50,6 +50,8 @@ public:
                                     OUString &rText, const IntlWrapper * = 0 ) const SAL_OVERRIDE;
     virtual sal_uInt16          GetValueCount() const SAL_OVERRIDE;
     css::drawing::FillStyle GetValue() const { return (css::drawing::FillStyle) SfxEnumItem::GetValue(); }
+
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 #endif
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index ae7e240..fc1625e 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -54,6 +54,7 @@
 #include <vcl/gradient.hxx>
 
 #include <stdio.h>
+#include <libxml/xmlwriter.h>
 
 using namespace ::com::sun::star;
 
@@ -2189,6 +2190,19 @@ bool XFillStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8
     return true;
 }
 
+void XFillStyleItem::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("xFillStyleItem"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(GetValue()).getStr()));
+
+    OUString aPresentation;
+    GetPresentation(SFX_ITEM_PRESENTATION_NAMELESS, SFX_MAPUNIT_100TH_MM, SFX_MAPUNIT_100TH_MM, aPresentation);
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(aPresentation.toUtf8().getStr()));
+
+    xmlTextWriterEndElement(pWriter);
+}
+
 TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem);
 
 XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor) :
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 8ebd230..c887f2a 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -452,6 +452,9 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
             case RES_COL:
                 static_cast<const SwFmtCol*>(pItem)->dumpAsXml(writer);
                 break;
+            case XATTR_FILLSTYLE:
+                static_cast<const XFillStyleItem*>(pItem)->dumpAsXml(writer);
+                break;
             default: bDone = false; break;
         }
         if (bDone)
@@ -466,31 +469,6 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
         boost::optional<OString> oValue;
         switch (pItem->Which())
         {
-            case XATTR_FILLSTYLE:
-            {
-                pWhich = "fill style";
-                const XFillStyleItem* pFillStyleItem = static_cast<const XFillStyleItem*>(pItem);
-                switch (pFillStyleItem->GetValue())
-                {
-                default:
-                case drawing::FillStyle_NONE:
-                    oValue = "none";
-                    break;
-                case drawing::FillStyle_SOLID:
-                    oValue = "solid";
-                    break;
-                case drawing::FillStyle_GRADIENT:
-                    oValue = "gradient";
-                    break;
-                case drawing::FillStyle_HATCH:
-                    oValue = "hatch";
-                    break;
-                case drawing::FillStyle_BITMAP:
-                    oValue = "bitmap";
-                    break;
-                }
-                break;
-            }
             case XATTR_FILLCOLOR:
                 pWhich = "fill color";
                 break;


More information about the Libreoffice-commits mailing list