[Libreoffice-commits] .: 4 commits - sw/CppunitTest_sw_subsequent_ooxmlexport.mk sw/CppunitTest_sw_subsequent_ooxmltok.mk sw/CppunitTest_sw_subsequent_rtfexport.mk sw/CppunitTest_sw_subsequent_rtftok.mk sw/CppunitTest_sw_subsequent_ww8export.mk sw/qa sw/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Thu Jun 21 08:16:38 PDT 2012


 sw/CppunitTest_sw_subsequent_ooxmlexport.mk |   11 +++++
 sw/CppunitTest_sw_subsequent_ooxmltok.mk    |   11 +++++
 sw/CppunitTest_sw_subsequent_rtfexport.mk   |   11 +++++
 sw/CppunitTest_sw_subsequent_rtftok.mk      |   11 +++++
 sw/CppunitTest_sw_subsequent_ww8export.mk   |   10 ++++
 sw/qa/extras/ooxmltok/data/n758883.docx     |binary
 sw/qa/extras/ooxmltok/ooxmltok.cxx          |   15 +++++++
 sw/qa/extras/swmodeltestbase.hxx            |   59 ++++++++++++++++++++++++++++
 sw/qa/extras/ww8tok/ww8tok.cxx              |   34 ----------------
 sw/source/core/access/accportions.cxx       |    2 
 sw/source/core/access/accportions.hxx       |    2 
 sw/source/core/inc/SwPortionHandler.hxx     |    3 -
 sw/source/core/text/porfld.cxx              |    5 +-
 sw/source/core/text/xmldump.cxx             |    8 +++
 14 files changed, 144 insertions(+), 38 deletions(-)

New commits:
commit 8616f227c722affcedff7632ba97644d04427c94
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Jun 21 17:03:23 2012 +0200

    kill copy&paste by introducing SwModelTestBase::parseDump()
    
    Change-Id: I7cc3e05e48fc9850fbe04c6511f5e9f18a680ec7

diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index a34dd39..59e3aab 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -45,14 +45,6 @@
 
 #include <vcl/svapp.hxx>
 
-#include <unotxdoc.hxx>
-#include <docsh.hxx>
-#include <doc.hxx>
-#include <rootfrm.hxx>
-
-#include <libxml/xmlwriter.h>
-#include <libxml/xpath.h>
-
 using rtl::OString;
 using rtl::OUString;
 using rtl::OUStringBuffer;
@@ -568,34 +560,10 @@ void Test::testN758883()
      * to the numbering. This is easier to test using a layout dump.
      */
 
-    // create xml writer
-    xmlBufferPtr pXmlBuffer = xmlBufferCreate();
-    xmlTextWriterPtr pXmlWriter = xmlNewTextWriterMemory(pXmlBuffer, 0);
-    xmlTextWriterStartDocument(pXmlWriter, NULL, NULL, NULL);
-
-    // create dump
     load("n758883.docx");
-    SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
-    SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc();
-    SwRootFrm* pLayout = pDoc->GetCurrentLayout();
-    pLayout->dumpAsXml(pXmlWriter);
-
-    // delete xml writer
-    xmlTextWriterEndDocument(pXmlWriter);
-    xmlFreeTextWriter(pXmlWriter);
-
-    // parse the dump
-    xmlDocPtr pXmlDoc = xmlParseMemory((const char*)xmlBufferContent(pXmlBuffer), xmlBufferLength(pXmlBuffer));;
-    xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc);
-    xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST("/root/page/body/txt/Special"), pXmlXpathCtx);
-    xmlNodeSetPtr pXmlNodes = pXmlXpathObj->nodesetval;
-    xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
-    OUString aHeight = OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST("nHeight")));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(220), aHeight.toInt32()); // It was 280
 
-    // delete dump
-    xmlFreeDoc(pXmlDoc);
-    xmlBufferFree(pXmlBuffer);
+    OUString aHeight = parseDump("/root/page/body/txt/Special", "nHeight");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(220), aHeight.toInt32()); // It was 280
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/sw/qa/extras/swmodeltestbase.hxx b/sw/qa/extras/swmodeltestbase.hxx
index 0ddd226..669e559 100644
--- a/sw/qa/extras/swmodeltestbase.hxx
+++ b/sw/qa/extras/swmodeltestbase.hxx
@@ -32,12 +32,31 @@
 #include <unotest/macros_test.hxx>
 #include <rtl/ustrbuf.hxx>
 
+#include <unotxdoc.hxx>
+#include <docsh.hxx>
+#include <doc.hxx>
+#include <rootfrm.hxx>
+
+#include <libxml/xmlwriter.h>
+#include <libxml/xpath.h>
+
 using namespace com::sun::star;
 
 /// Base class for filter tests loading or roundtriping a document, then asserting the document model.
 class SwModelTestBase : public test::BootstrapFixture, public unotest::MacrosTest
 {
 public:
+    SwModelTestBase()
+        : mpXmlBuffer(0)
+    {
+    }
+
+    ~SwModelTestBase()
+    {
+        if (mpXmlBuffer)
+            xmlBufferFree(mpXmlBuffer);
+    }
+
     virtual void setUp()
     {
         test::BootstrapFixture::setUp();
@@ -54,6 +73,26 @@ public:
         test::BootstrapFixture::tearDown();
     }
 
+private:
+    void dumpLayout()
+    {
+        // create the xml writer
+        mpXmlBuffer = xmlBufferCreate();
+        xmlTextWriterPtr pXmlWriter = xmlNewTextWriterMemory(mpXmlBuffer, 0);
+        xmlTextWriterStartDocument(pXmlWriter, NULL, NULL, NULL);
+
+        // create the dump
+        SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+        SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc();
+        SwRootFrm* pLayout = pDoc->GetCurrentLayout();
+        pLayout->dumpAsXml(pXmlWriter);
+
+        // delete xml writer
+        xmlTextWriterEndDocument(pXmlWriter);
+        xmlFreeTextWriter(pXmlWriter);
+    }
+
+
 protected:
     /// Get the length of the whole document.
     int getLength()
@@ -84,7 +123,27 @@ protected:
         return xStyleFamily;
     }
 
+    /// Extract a value from the layout dump using an XPath expression and an attribute name.
+    rtl::OUString parseDump(rtl::OString aXPath, rtl::OString aAttribute)
+    {
+        if (!mpXmlBuffer)
+            dumpLayout();
+
+        xmlDocPtr pXmlDoc = xmlParseMemory((const char*)xmlBufferContent(mpXmlBuffer), xmlBufferLength(mpXmlBuffer));;
+
+        xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc);
+        xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(aXPath.getStr()), pXmlXpathCtx);
+        xmlNodeSetPtr pXmlNodes = pXmlXpathObj->nodesetval;
+        xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
+        rtl::OUString aRet = rtl::OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST(aAttribute.getStr())));
+
+        xmlFreeDoc(pXmlDoc);
+
+        return aRet;
+    }
+
     uno::Reference<lang::XComponent> mxComponent;
+    xmlBufferPtr mpXmlBuffer;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ww8tok/ww8tok.cxx b/sw/qa/extras/ww8tok/ww8tok.cxx
index a63ff14..53f9030 100644
--- a/sw/qa/extras/ww8tok/ww8tok.cxx
+++ b/sw/qa/extras/ww8tok/ww8tok.cxx
@@ -36,14 +36,6 @@
 
 #include <vcl/svapp.hxx>
 
-#include <unotxdoc.hxx>
-#include <docsh.hxx>
-#include <doc.hxx>
-#include <rootfrm.hxx>
-
-#include <libxml/xmlwriter.h>
-#include <libxml/xpath.h>
-
 using rtl::OString;
 using rtl::OUString;
 using rtl::OUStringBuffer;
@@ -225,34 +217,10 @@ void Test::testN757905()
     // paragraph height. When in Word-compat mode, we should take the max of
     // the two, not just the height of the fly.
 
-    // create xml writer
-    xmlBufferPtr pXmlBuffer = xmlBufferCreate();
-    xmlTextWriterPtr pXmlWriter = xmlNewTextWriterMemory(pXmlBuffer, 0);
-    xmlTextWriterStartDocument(pXmlWriter, NULL, NULL, NULL);
-
-    // create dump
     load("n757905.doc");
-    SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
-    SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc();
-    SwRootFrm* pLayout = pDoc->GetCurrentLayout();
-    pLayout->dumpAsXml(pXmlWriter);
 
-    // delete xml writer
-    xmlTextWriterEndDocument(pXmlWriter);
-    xmlFreeTextWriter(pXmlWriter);
-
-    // parse the dump
-    xmlDocPtr pXmlDoc = xmlParseMemory((const char*)xmlBufferContent(pXmlBuffer), xmlBufferLength(pXmlBuffer));;
-    xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc);
-    xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST("/root/page/body/txt/infos/bounds"), pXmlXpathCtx);
-    xmlNodeSetPtr pXmlNodes = pXmlXpathObj->nodesetval;
-    xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
-    OUString aHeight = OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST("height")));
+    OUString aHeight = parseDump("/root/page/body/txt/infos/bounds", "height");
     CPPUNIT_ASSERT(sal_Int32(31) < aHeight.toInt32());
-
-    // delete dump
-    xmlFreeDoc(pXmlDoc);
-    xmlBufferFree(pXmlBuffer);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
commit 4cc2c691a93ec1ada687ad49ba2dd9665d52a3a3
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Jun 21 17:10:17 2012 +0200

    sw/qa/extras: link to libxml2 in all tests
    
    Change-Id: I6355b17042a42d44c7086f54b3efc6ba4d0c5d55

diff --git a/sw/CppunitTest_sw_subsequent_ooxmlexport.mk b/sw/CppunitTest_sw_subsequent_ooxmlexport.mk
index be81973..531e0b5 100644
--- a/sw/CppunitTest_sw_subsequent_ooxmlexport.mk
+++ b/sw/CppunitTest_sw_subsequent_ooxmlexport.mk
@@ -37,6 +37,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_ooxmlexport, \
 $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_ooxmlexport, \
     cppu \
     sal \
+    sw \
     test \
 	tl \
     unotest \
@@ -45,6 +46,16 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_ooxmlexport, \
     $(gb_STDLIBS) \
 ))
 
+$(eval $(call gb_CppunitTest_use_externals,sw_subsequent_ooxmlexport,\
+    libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_subsequent_ooxmlexport,\
+    -I$(SRCDIR)/sw/inc \
+    -I$(SRCDIR)/sw/source/core/inc \
+    $$(INCLUDE) \
+))
+
 $(eval $(call gb_CppunitTest_use_api,sw_subsequent_ooxmlexport,\
     offapi \
     udkapi \
diff --git a/sw/CppunitTest_sw_subsequent_rtfexport.mk b/sw/CppunitTest_sw_subsequent_rtfexport.mk
index 3943f7e..e55af88 100644
--- a/sw/CppunitTest_sw_subsequent_rtfexport.mk
+++ b/sw/CppunitTest_sw_subsequent_rtfexport.mk
@@ -37,6 +37,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_rtfexport, \
 $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_rtfexport, \
     cppu \
     sal \
+	sw \
     test \
     unotest \
 	utl \
@@ -44,6 +45,16 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_rtfexport, \
     $(gb_STDLIBS) \
 ))
 
+$(eval $(call gb_CppunitTest_use_externals,sw_subsequent_rtfexport,\
+    libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_subsequent_rtfexport,\
+    -I$(SRCDIR)/sw/inc \
+    -I$(SRCDIR)/sw/source/core/inc \
+    $$(INCLUDE) \
+))
+
 $(eval $(call gb_CppunitTest_use_api,sw_subsequent_rtfexport,\
     offapi \
     udkapi \
diff --git a/sw/CppunitTest_sw_subsequent_rtftok.mk b/sw/CppunitTest_sw_subsequent_rtftok.mk
index 1c9da96..2207756 100644
--- a/sw/CppunitTest_sw_subsequent_rtftok.mk
+++ b/sw/CppunitTest_sw_subsequent_rtftok.mk
@@ -37,6 +37,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_rtftok, \
 $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_rtftok, \
     cppu \
     sal \
+	sw \
     test \
     unotest \
     vcl \
@@ -44,6 +45,16 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_rtftok, \
     $(gb_STDLIBS) \
 ))
 
+$(eval $(call gb_CppunitTest_use_externals,sw_subsequent_rtftok,\
+    libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_subsequent_rtftok,\
+    -I$(SRCDIR)/sw/inc \
+    -I$(SRCDIR)/sw/source/core/inc \
+    $$(INCLUDE) \
+))
+
 $(eval $(call gb_CppunitTest_use_api,sw_subsequent_rtftok,\
     offapi \
     udkapi \
diff --git a/sw/CppunitTest_sw_subsequent_ww8export.mk b/sw/CppunitTest_sw_subsequent_ww8export.mk
index 57a1faf..d46fdfb 100644
--- a/sw/CppunitTest_sw_subsequent_ww8export.mk
+++ b/sw/CppunitTest_sw_subsequent_ww8export.mk
@@ -56,6 +56,16 @@ $(eval $(call gb_CppunitTest_set_include,sw_subsequent_ww8export,\
     $$(INCLUDE) \
 ))
 
+$(eval $(call gb_CppunitTest_use_externals,sw_subsequent_ww8export,\
+    libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_subsequent_ww8export,\
+    -I$(SRCDIR)/sw/inc \
+    -I$(SRCDIR)/sw/source/core/inc \
+    $$(INCLUDE) \
+))
+
 $(eval $(call gb_CppunitTest_use_api,sw_subsequent_ww8export,\
     offapi \
     udkapi \
commit 6713b8d3ecd14293ecc6ba1f37a7a77f8a1cdea0
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Jun 21 16:43:10 2012 +0200

    n#758883 testcase
    
    Change-Id: Ibcaf427849ef69f379e0d6e77f586d77e4d0c92f

diff --git a/sw/CppunitTest_sw_subsequent_ooxmltok.mk b/sw/CppunitTest_sw_subsequent_ooxmltok.mk
index 92a4cc4..4348603 100644
--- a/sw/CppunitTest_sw_subsequent_ooxmltok.mk
+++ b/sw/CppunitTest_sw_subsequent_ooxmltok.mk
@@ -39,10 +39,21 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_ooxmltok, \
     sal \
     test \
     unotest \
+    sw \
     vcl \
     $(gb_STDLIBS) \
 ))
 
+$(eval $(call gb_CppunitTest_use_externals,sw_subsequent_ooxmltok,\
+    libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_subsequent_ooxmltok,\
+    -I$(SRCDIR)/sw/inc \
+    -I$(SRCDIR)/sw/source/core/inc \
+    $$(INCLUDE) \
+))
+
 $(eval $(call gb_CppunitTest_use_api,sw_subsequent_ooxmltok,\
     offapi \
     udkapi \
diff --git a/sw/qa/extras/ooxmltok/data/n758883.docx b/sw/qa/extras/ooxmltok/data/n758883.docx
new file mode 100644
index 0000000..fed398f
Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/n758883.docx differ
diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index 792b1db..a34dd39 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -45,6 +45,14 @@
 
 #include <vcl/svapp.hxx>
 
+#include <unotxdoc.hxx>
+#include <docsh.hxx>
+#include <doc.hxx>
+#include <rootfrm.hxx>
+
+#include <libxml/xmlwriter.h>
+#include <libxml/xpath.h>
+
 using rtl::OString;
 using rtl::OUString;
 using rtl::OUStringBuffer;
@@ -69,6 +77,7 @@ public:
     void testSmartart();
     void testN764745();
     void testN766477();
+    void testN758883();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -89,6 +98,7 @@ public:
     CPPUNIT_TEST(testSmartart);
     CPPUNIT_TEST(testN764745);
     CPPUNIT_TEST(testN766477);
+    CPPUNIT_TEST(testN758883);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -551,6 +561,43 @@ void Test::testN766477()
     CPPUNIT_ASSERT_EQUAL(OUString("Checkbox_Checked"), aElementNames[0]);
 }
 
+void Test::testN758883()
+{
+    /*
+     * The problem was that direct formatting of the paragraph was not applied
+     * to the numbering. This is easier to test using a layout dump.
+     */
+
+    // create xml writer
+    xmlBufferPtr pXmlBuffer = xmlBufferCreate();
+    xmlTextWriterPtr pXmlWriter = xmlNewTextWriterMemory(pXmlBuffer, 0);
+    xmlTextWriterStartDocument(pXmlWriter, NULL, NULL, NULL);
+
+    // create dump
+    load("n758883.docx");
+    SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+    SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc();
+    SwRootFrm* pLayout = pDoc->GetCurrentLayout();
+    pLayout->dumpAsXml(pXmlWriter);
+
+    // delete xml writer
+    xmlTextWriterEndDocument(pXmlWriter);
+    xmlFreeTextWriter(pXmlWriter);
+
+    // parse the dump
+    xmlDocPtr pXmlDoc = xmlParseMemory((const char*)xmlBufferContent(pXmlBuffer), xmlBufferLength(pXmlBuffer));;
+    xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc);
+    xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST("/root/page/body/txt/Special"), pXmlXpathCtx);
+    xmlNodeSetPtr pXmlNodes = pXmlXpathObj->nodesetval;
+    xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
+    OUString aHeight = OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST("nHeight")));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(220), aHeight.toInt32()); // It was 280
+
+    // delete dump
+    xmlFreeDoc(pXmlDoc);
+    xmlBufferFree(pXmlBuffer);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit a208d96584009de2b902534e62f03de8124160a9
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Jun 21 16:25:15 2012 +0200

    sw: include the height of SwNumberPortions in layout dump
    
    Change-Id: I7c7d78c212683e47f726fc91d59c9c495b78641e

diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
index 17ed51e..03ee5a1 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -142,7 +142,7 @@ void SwAccessiblePortionData::Text(sal_uInt16 nLength, sal_uInt16 nType)
 }
 
 void SwAccessiblePortionData::Special(
-    sal_uInt16 nLength, const String& rText, sal_uInt16 nType)
+    sal_uInt16 nLength, const String& rText, sal_uInt16 nType, sal_Int32 /*nHeight*/)
 {
     OSL_ENSURE( nModelPosition >= 0, "illegal position" );
     OSL_ENSURE( (nModelPosition + nLength) <= pTxtNode->GetTxt().Len(),
diff --git a/sw/source/core/access/accportions.hxx b/sw/source/core/access/accportions.hxx
index 9389b1a..4b7f19a 100644
--- a/sw/source/core/access/accportions.hxx
+++ b/sw/source/core/access/accportions.hxx
@@ -95,7 +95,7 @@ public:
 
     // SwPortionHandler methods
     virtual void Text(sal_uInt16 nLength, sal_uInt16 nType);
-    virtual void Special(sal_uInt16 nLength, const String& rText, sal_uInt16 nType);
+    virtual void Special(sal_uInt16 nLength, const String& rText, sal_uInt16 nType, sal_Int32 nHeight = 0);
     virtual void LineBreak();
     virtual void Skip(sal_uInt16 nLength);
     virtual void Finish();
diff --git a/sw/source/core/inc/SwPortionHandler.hxx b/sw/source/core/inc/SwPortionHandler.hxx
index 7c1084e..5f81b9a 100644
--- a/sw/source/core/inc/SwPortionHandler.hxx
+++ b/sw/source/core/inc/SwPortionHandler.hxx
@@ -66,7 +66,8 @@ public:
     virtual void Special(
         sal_uInt16 nLength,      /// length of this portion in the model string
         const String& rText, /// text which is painted on-screen
-        sal_uInt16 nType         /// type of this portion
+        sal_uInt16 nType,         /// type of this portion
+        sal_Int32 nHeight = 0     /// font height of the painted text
         ) = 0;
 
     /** line break. This method is called whenever a line break in the
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 62cdbe9..fbb5eb7 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -471,7 +471,10 @@ sal_Bool SwFldPortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) c
 
 void SwFldPortion::HandlePortion( SwPortionHandler& rPH ) const
 {
-    rPH.Special( GetLen(), aExpand, GetWhichPor() );
+    sal_Int32 nH = 0;
+    if (pFnt)
+        nH = pFnt->GetSize(pFnt->GetActual()).Height();
+    rPH.Special( GetLen(), aExpand, GetWhichPor(), nH );
 }
 
 /*************************************************************************
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 7df0ec8..c9578a3 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -153,10 +153,13 @@ class XmlPortionDumper:public SwPortionHandler
                 text which is painted on-screen
         @param nType
                 type of this portion
+        @param nHeight
+                font size of the painted text
       */
     virtual void Special( sal_uInt16 nLength,
                           const String & rText,
-                          sal_uInt16 nType )
+                          sal_uInt16 nType,
+                          sal_Int32 nHeight = 0 )
     {
         xmlTextWriterStartElement( writer, BAD_CAST( "Special" ) );
         xmlTextWriterWriteFormatAttribute( writer,
@@ -171,6 +174,9 @@ class XmlPortionDumper:public SwPortionHandler
         xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "rText" ),
                                            "%s", sText8.getStr(  ) );
 
+        if (nHeight > 0)
+            xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("nHeight"), "%i", (int)nHeight);
+
         xmlTextWriterEndElement( writer );
         ofs += nLength;
     }


More information about the Libreoffice-commits mailing list