Kaydet (Commit) 150420cb authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX export: fix style's next element order

Change-Id: I03e91a448794efc2b91f3a6fb6c29dda3403ce9b
üst a4bdeeba
...@@ -94,6 +94,15 @@ DECLARE_OOXMLEXPORT_TEST(testZoom, "zoom.docx") ...@@ -94,6 +94,15 @@ DECLARE_OOXMLEXPORT_TEST(testZoom, "zoom.docx")
sal_Int16 nValue = 0; sal_Int16 nValue = 0;
xPropertySet->getPropertyValue("ZoomValue") >>= nValue; xPropertySet->getPropertyValue("ZoomValue") >>= nValue;
CPPUNIT_ASSERT_EQUAL(sal_Int16(42), 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") DECLARE_OOXMLEXPORT_TEST(defaultTabStopNotInStyles, "empty.odt")
......
...@@ -3977,6 +3977,13 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType, ...@@ -3977,6 +3977,13 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType,
FSEND ); 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()) if (!aLink.isEmpty())
m_pSerializer->singleElementNS(XML_w, XML_link, m_pSerializer->singleElementNS(XML_w, XML_link,
FSNS(XML_w, XML_val), OUStringToOString(aLink, RTL_TEXTENCODING_UTF8).getStr(), FSNS(XML_w, XML_val), OUStringToOString(aLink, RTL_TEXTENCODING_UTF8).getStr(),
...@@ -3999,13 +4006,6 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType, ...@@ -3999,13 +4006,6 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType,
FSNS(XML_w, XML_val), OUStringToOString(aRsid, RTL_TEXTENCODING_UTF8).getStr(), FSNS(XML_w, XML_val), OUStringToOString(aRsid, RTL_TEXTENCODING_UTF8).getStr(),
FSEND); 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 ) if ( bAutoUpdate )
m_pSerializer->singleElementNS( XML_w, XML_autoRedefine, FSEND ); m_pSerializer->singleElementNS( XML_w, XML_autoRedefine, FSEND );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment