Kaydet (Commit) dd747c06 authored tarafından Mike Kaganski's avatar Mike Kaganski Kaydeden (comit) Miklos Vajna

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/31871Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 71b1e3ff
...@@ -166,6 +166,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103651, "tdf103651.docx") ...@@ -166,6 +166,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103651, "tdf103651.docx")
CPPUNIT_ASSERT_EQUAL( sal_Int32( -1 ) , sContent.indexOf( sal_Unicode( 0xf04a ) )); 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(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -4269,6 +4269,8 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size ...@@ -4269,6 +4269,8 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
CharGrabBag(*pGrabBag); 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); m_rExport.SdrExporter().startDMLAnchorInline(pFrameFormat, rSize);
// picture description (used for pic:cNvPr later too) // picture description (used for pic:cNvPr later too)
......
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