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

Miklos Vajna vmiklos at collabora.co.uk
Thu Feb 27 07:22:51 PST 2014


 sw/qa/extras/ooxmlexport/data/zoom.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |    9 +++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   14 +++++++-------
 3 files changed, 16 insertions(+), 7 deletions(-)

New commits:
commit 150420cbff39967e9376cab05b6af45b642edae8
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Feb 27 15:51:55 2014 +0100

    DOCX export: fix style's next element order
    
    Change-Id: I03e91a448794efc2b91f3a6fb6c29dda3403ce9b

diff --git a/sw/qa/extras/ooxmlexport/data/zoom.docx b/sw/qa/extras/ooxmlexport/data/zoom.docx
index 6c2cd46..a61069f 100644
Binary files a/sw/qa/extras/ooxmlexport/data/zoom.docx and b/sw/qa/extras/ooxmlexport/data/zoom.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 400745e..b90075d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -94,6 +94,15 @@ DECLARE_OOXMLEXPORT_TEST(testZoom, "zoom.docx")
     sal_Int16 nValue = 0;
     xPropertySet->getPropertyValue("ZoomValue") >>= nValue;
     CPPUNIT_ASSERT_EQUAL(sal_Int16(42), nValue);
+
+    // Validation test: order of elements were wrong.
+    xmlDocPtr pXmlDoc = parseExport("word/styles.xml");
+    if (!pXmlDoc)
+        return;
+    // Order was: rsid, next.
+    int nNext = getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "next");
+    int nRsid = getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "rsid");
+    CPPUNIT_ASSERT(nNext < nRsid);
 }
 
 DECLARE_OOXMLEXPORT_TEST(defaultTabStopNotInStyles, "empty.odt")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 09bfa06..4e48125 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3977,6 +3977,13 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType,
                 FSEND );
     }
 
+    if ( nNext != nId && eType != STYLE_TYPE_LIST)
+    {
+        m_pSerializer->singleElementNS( XML_w, XML_next,
+                FSNS( XML_w, XML_val ), m_rExport.pStyles->GetStyleId(nNext).getStr(),
+                FSEND );
+    }
+
     if (!aLink.isEmpty())
         m_pSerializer->singleElementNS(XML_w, XML_link,
                 FSNS(XML_w, XML_val), OUStringToOString(aLink, RTL_TEXTENCODING_UTF8).getStr(),
@@ -3999,13 +4006,6 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType,
                 FSNS(XML_w, XML_val), OUStringToOString(aRsid, RTL_TEXTENCODING_UTF8).getStr(),
                 FSEND);
 
-    if ( nNext != nId && eType != STYLE_TYPE_LIST)
-    {
-        m_pSerializer->singleElementNS( XML_w, XML_next,
-                FSNS( XML_w, XML_val ), m_rExport.pStyles->GetStyleId(nNext).getStr(),
-                FSEND );
-    }
-
     if ( bAutoUpdate )
         m_pSerializer->singleElementNS( XML_w, XML_autoRedefine, FSEND );
 }


More information about the Libreoffice-commits mailing list