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

Mike Kaganski mike.kaganski at collabora.com
Mon Dec 12 10:05:48 UTC 2016


 sw/qa/extras/ooxmlexport/data/tdf99227.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx    |   13 +++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |    2 ++
 3 files changed, 15 insertions(+)

New commits:
commit dd747c0669f6e31462c39fe104d2f2c0acc4de0a
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Sun Dec 11 21:22:10 2016 +0300

    tdf#99227: use correct serializer when exporting drawing
    
    Failing to do that leads to write-past-end-of-document, drawing
    loss and SAXParseException if the drawing is part of a footnote.
    
    A unit test is included.
    
    Change-Id: Ie7d8263dc72dfef1e9827cc0579a5eaaf5819410
    Reviewed-on: https://gerrit.libreoffice.org/31871
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf99227.docx b/sw/qa/extras/ooxmlexport/data/tdf99227.docx
new file mode 100644
index 0000000..27ec4eb
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf99227.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 807e73e..606510f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -166,6 +166,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103651, "tdf103651.docx")
     CPPUNIT_ASSERT_EQUAL( sal_Int32( -1 ) , sContent.indexOf( sal_Unicode( 0xf04a ) ));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf99227, "tdf99227.docx")
+{
+    // A drawing anchored as character to a footnote caused write past end of document.xml at export to docx.
+    // After that, importing after export failed with
+    // SAXParseException: '[word/document.xml line 2]: Extra content at the end of the document', Stream 'word / document.xml',
+    // and before commit ebf767eeb2a169ba533e1b2ffccf16f41d95df35, the drawing was silently lost.
+    xmlDocPtr pXmlDoc = parseExport("word/footnotes.xml");
+    if (!pXmlDoc)
+        return;
+
+    assertXPath(pXmlDoc, "//w:footnote[3]/w:p/w:r[5]/w:drawing", 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 8686052..c3ebd97 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4269,6 +4269,8 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
         CharGrabBag(*pGrabBag);
     }
 
+    //  tdf#99227: to be sure that we write to the right stream
+    m_rExport.SdrExporter().setSerializer(m_pSerializer);
     m_rExport.SdrExporter().startDMLAnchorInline(pFrameFormat, rSize);
 
     // picture description (used for pic:cNvPr later too)


More information about the Libreoffice-commits mailing list