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

Miklos Vajna vmiklos at collabora.co.uk
Thu Jul 31 02:04:25 PDT 2014


 sw/qa/extras/ooxmlexport/data/2-id.docx       |binary
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |    9 +++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx  |    2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 48f52a509aeed8c8a780bf07d3761a7699e8a36b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jul 31 10:50:44 2014 +0200

    DocxAttributeOutput::WriteSdtBlock: never write <w:id> twice
    
    Change-Id: Iab68a4e809a7924e753db5a85d9914308419b845

diff --git a/sw/qa/extras/ooxmlexport/data/2-id.docx b/sw/qa/extras/ooxmlexport/data/2-id.docx
new file mode 100644
index 0000000..6d05e68
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/2-id.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 76cb592..1e0b98d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -532,6 +532,15 @@ DECLARE_OOXMLEXPORT_TEST(testSdt2Run, "sdt-2-para.docx")
     }
 }
 
+DECLARE_OOXMLEXPORT_TEST(test2Id, "2-id.docx")
+{
+    if (xmlDocPtr pXmlDoc = parseExport())
+    {
+        // This was 2, but only one w:id is allowed.
+        assertXPath(pXmlDoc, "//w:sdtPr/w:id", 1);
+    }
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 9078f8b..c66a6ea 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -612,7 +612,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
 
             m_pSerializer->endElement( nSdtPrToken );
         }
-        else if( (nSdtPrToken > 0) && !(m_bRunTextIsOn && m_rExport.SdrExporter().IsParagraphHasDrawing()))
+        else if( (nSdtPrToken > 0) && nSdtPrToken != FSNS( XML_w, XML_id ) && !(m_bRunTextIsOn && m_rExport.SdrExporter().IsParagraphHasDrawing()))
             m_pSerializer->singleElement( nSdtPrToken, FSEND );
 
         if( nSdtPrToken == FSNS( XML_w, XML_id ) || ( bPara && m_bParagraphSdtHasId ) )


More information about the Libreoffice-commits mailing list