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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jul 30 16:34:46 UTC 2018


 oox/source/shape/LockedCanvasContext.cxx |    2 +-
 oox/source/shape/WpgContext.cxx          |    2 +-
 sw/inc/fldbas.hxx                        |    1 +
 sw/inc/usrfld.hxx                        |    1 +
 sw/source/core/fields/fldbas.cxx         |   20 ++++++++++++++------
 sw/source/core/fields/usrfld.cxx         |    9 +++++++++
 6 files changed, 27 insertions(+), 8 deletions(-)

New commits:
commit 1ad14b32c651b23b2c37d83dbdea889607ea6680
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Mon Jul 30 17:22:24 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Mon Jul 30 18:34:24 2018 +0200

    sw doc model xml dump: dump float value of user fields
    
    Change-Id: Ie59070254eb293cbfdd688d97bf4bb6c06e77a79
    Reviewed-on: https://gerrit.libreoffice.org/58339
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins

diff --git a/oox/source/shape/LockedCanvasContext.cxx b/oox/source/shape/LockedCanvasContext.cxx
index 277a11fdd262..a460a9585425 100644
--- a/oox/source/shape/LockedCanvasContext.cxx
+++ b/oox/source/shape/LockedCanvasContext.cxx
@@ -7,9 +7,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include <sal/log.hxx>
 
 #include "LockedCanvasContext.hxx"
+#include <sal/log.hxx>
 #include <oox/drawingml/shape.hxx>
 #include <oox/drawingml/shapecontext.hxx>
 #include <oox/drawingml/shapegroupcontext.hxx>
diff --git a/oox/source/shape/WpgContext.cxx b/oox/source/shape/WpgContext.cxx
index 26a54c41d2ac..95264e53ce15 100644
--- a/oox/source/shape/WpgContext.cxx
+++ b/oox/source/shape/WpgContext.cxx
@@ -7,9 +7,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include <sal/log.hxx>
 
 #include "WpgContext.hxx"
+#include <sal/log.hxx>
 #include <drawingml/shapepropertiescontext.hxx>
 #include <oox/drawingml/shapegroupcontext.hxx>
 #include <oox/drawingml/graphicshapecontext.hxx>
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 46d1a01d70ad..4696f48fe88b 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -262,6 +262,7 @@ public:
     SwFieldIds              Which() const { return m_nWhich; }
 
     inline  void            UpdateFields() const;
+    virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 inline void SwFieldType::UpdateFields() const
diff --git a/sw/inc/usrfld.hxx b/sw/inc/usrfld.hxx
index fccf5b070538..e98258c624c3 100644
--- a/sw/inc/usrfld.hxx
+++ b/sw/inc/usrfld.hxx
@@ -60,6 +60,7 @@ public:
 
     virtual void        QueryValue( css::uno::Any& rVal, sal_uInt16 nMId ) const override;
     virtual void        PutValue( const css::uno::Any& rVal, sal_uInt16 nMId ) override;
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
 
 protected:
     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) override;
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index fcfc52f61932..01e43cdc992c 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -154,17 +154,24 @@ void SwFieldType::PutValue( const uno::Any& , sal_uInt16 )
 {
 }
 
+void SwFieldType::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    SwIterator<SwFormatField, SwFieldType> aIter(*this);
+    if (!aIter.First())
+        return;
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SwFieldType"));
+    for (const SwFormatField* pFormatField = aIter.First(); pFormatField;
+         pFormatField = aIter.Next())
+        pFormatField->dumpAsXml(pWriter);
+    xmlTextWriterEndElement(pWriter);
+}
+
 void SwFieldTypes::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
     xmlTextWriterStartElement(pWriter, BAD_CAST("SwFieldTypes"));
     sal_uInt16 nCount = size();
     for (sal_uInt16 nType = 0; nType < nCount; ++nType)
-    {
-        const SwFieldType *pCurType = (*this)[nType];
-        SwIterator<SwFormatField, SwFieldType> aIter(*pCurType);
-        for (const SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next())
-            pFormatField->dumpAsXml(pWriter);
-    }
+        (*this)[nType]->dumpAsXml(pWriter);
     xmlTextWriterEndElement(pWriter);
 }
 
@@ -777,6 +784,7 @@ void SwField::dumpAsXml(xmlTextWriterPtr pWriter) const
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s", BAD_CAST(typeid(*this).name()));
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nFormat"), BAD_CAST(OString::number(m_nFormat).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nLang"), BAD_CAST(OString::number(m_nLang.get()).getStr()));
 
     xmlTextWriterEndElement(pWriter);
 }
diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx
index c843d1a5e490..d81ba1c84ae8 100644
--- a/sw/source/core/fields/usrfld.cxx
+++ b/sw/source/core/fields/usrfld.cxx
@@ -339,4 +339,13 @@ void SwUserFieldType::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
     }
 }
 
+void SwUserFieldType::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SwUserFieldType"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nValue"), BAD_CAST(OString::number(nValue).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("aContent"), BAD_CAST(aContent.toUtf8().getStr()));
+    SwFieldType::dumpAsXml(pWriter);
+    xmlTextWriterEndElement(pWriter);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list