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

Miklos Vajna vmiklos at collabora.co.uk
Wed Aug 13 04:13:33 PDT 2014


 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |    3 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |    7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 1cb2573cd3a7082e68aae03779f9bc08d9d13d8c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Aug 13 12:54:18 2014 +0200

    DOCX export: write qFormat for style names having an STI number
    
    Change-Id: I1f1bf0cf14bbd7b6253489f27753bdb2ec81fe35

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 6cd31bc..2d47c8c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -341,6 +341,9 @@ DECLARE_OOXMLEXPORT_TEST(testTable, "table.odt")
     int nInsideV = getXPathPosition(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblBorders", "insideV");
     CPPUNIT_ASSERT(nEnd < nInsideH);
     CPPUNIT_ASSERT(nInsideH < nInsideV);
+
+    // Make sure we write qFormat for well-known style names.
+    assertXPath(parseExport("word/styles.xml"), "//w:style[@w:styleId='Normal']/w:qFormat", 1);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTablePosition, "table-position.docx")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index e382c1b..30c0596 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5055,7 +5055,7 @@ oox::drawingml::DrawingML& DocxAttributeOutput::GetDrawingML()
 }
 
 void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType,
-        sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 /*nWwId*/, sal_uInt16 nId, bool bAutoUpdate )
+        sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwId, sal_uInt16 nId, bool bAutoUpdate )
 {
     bool bQFormat = false, bUnhideWhenUsed = false, bSemiHidden = false, bLocked = false, bDefault = false, bCustomStyle = false;
     OUString aLink, aRsid, aUiPriority;
@@ -5147,7 +5147,10 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType,
         m_pSerializer->singleElementNS(XML_w, XML_semiHidden, FSEND);
     if (bUnhideWhenUsed)
         m_pSerializer->singleElementNS(XML_w, XML_unhideWhenUsed, FSEND);
-    if (bQFormat)
+
+    // If the style has a dedicated STI number, then chances are high that Word
+    // will have qFormat enabled for it, so let's do the same.
+    if (bQFormat || nWwId != ww::stiUser)
         m_pSerializer->singleElementNS(XML_w, XML_qFormat, FSEND);
     if (bLocked)
         m_pSerializer->singleElementNS(XML_w, XML_locked, FSEND);


More information about the Libreoffice-commits mailing list