sw/qa/extras/ooxmlexport/data/fdo78300.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 ++++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 5 +++-- sw/source/filter/ww8/docxsdrexport.cxx | 9 +++++++++ sw/source/filter/ww8/docxsdrexport.hxx | 2 ++ 5 files changed, 24 insertions(+), 2 deletions(-)
New commits: commit 350b88c2b7871eb34f945f2ada7b03717f661bdc Author: PriyankaGaikwad <priyanka.gaik...@synerzip.com> Date: Mon May 12 13:57:35 2014 +0530 fdo#78300 File Corrupt:drawing objects into a text box. Description : Docx file corrupt after roundtrip. LO insert <w:drawing> inside the <wps:txbx> under choice after RT, if the file created in MS word 2007 and contains Word Art inside the text box. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx sw/source/filter/ww8/docxsdrexport.cxx sw/source/filter/ww8/docxsdrexport.hxx Change-Id: I7421ed353cd7e9bae17b2447122090a4113f52b5 diff --git a/sw/qa/extras/ooxmlexport/data/fdo78300.docx b/sw/qa/extras/ooxmlexport/data/fdo78300.docx new file mode 100644 index 0000000..40da091 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo78300.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index df265ff..67bd0ca 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -3338,6 +3338,16 @@ DECLARE_OOXMLEXPORT_TEST(testfdo78599,"fdo78599.docx") assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink/w:r[6]/w:fldChar", "fldCharType", "end" ); } +DECLARE_OOXMLEXPORT_TEST(testfdo78300,"fdo78300.docx") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + assertXPath(pXmlDoc, + "/w:document/w:body/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing[1]/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p[1]/w:r[1]/w:drawing[1]", + 0); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 0c00952..aba33a4 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4210,8 +4210,9 @@ void DocxAttributeOutput::WritePostponedDMLDrawing() it != m_postponedDMLDrawing->end(); ++it ) { - if ( IsAlternateContentChoiceOpen() ) - m_rExport.SdrExporter().writeDMLDrawing(it->object, (it->frame), m_anchorId++); + // Avoid w:drawing within another w:drawing. + if ( IsAlternateContentChoiceOpen() && !( m_rExport.SdrExporter().IsDrawingOpen()) ) + m_rExport.SdrExporter().writeDMLDrawing(it->object, (it->frame), m_anchorId++); else m_rExport.SdrExporter().writeDMLAndVMLDrawing(it->object, *(it->frame), *(it->point), m_anchorId++); } diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 4f9aa33..dff5310 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -142,6 +142,7 @@ struct DocxSdrExport::Impl sax_fastparser::FastAttributeList* m_pTextboxAttrList; OStringBuffer m_aTextFrameStyle; bool m_bFrameBtLr; + bool m_bDrawingOpen; bool m_bFlyFrameGraphic; sax_fastparser::FastAttributeList* m_pFlyFillAttrList; sax_fastparser::FastAttributeList* m_pFlyWrapAttrList; @@ -162,6 +163,7 @@ struct DocxSdrExport::Impl m_pFlyAttrList(0), m_pTextboxAttrList(0), m_bFrameBtLr(false), + m_bDrawingOpen(false), m_bFlyFrameGraphic(false), m_pFlyFillAttrList(0), m_pFlyWrapAttrList(0), @@ -239,6 +241,11 @@ bool DocxSdrExport::getFrameBtLr() return m_pImpl->m_bFrameBtLr; } +bool DocxSdrExport::IsDrawingOpen() +{ + return m_pImpl->m_bDrawingOpen; +} + sax_fastparser::FastAttributeList*& DocxSdrExport::getFlyFillAttrList() { return m_pImpl->m_pFlyFillAttrList; @@ -266,6 +273,7 @@ void DocxSdrExport::setFlyWrapAttrList(sax_fastparser::FastAttributeList* pAttrL void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rSize) { + m_pImpl->m_bDrawingOpen = true; m_pImpl->m_pSerializer->startElementNS(XML_w, XML_drawing, FSEND); const SvxLRSpaceItem pLRSpaceItem = pFrmFmt->GetLRSpace(false); @@ -529,6 +537,7 @@ void DocxSdrExport::endDMLAnchorInline(const SwFrmFmt* pFrmFmt) m_pImpl->m_pSerializer->endElementNS(XML_wp, isAnchor ? XML_anchor : XML_inline); m_pImpl->m_pSerializer->endElementNS(XML_w, XML_drawing); + m_pImpl->m_bDrawingOpen = false; } void DocxSdrExport::writeVMLDrawing(const SdrObject* sdrObj, const SwFrmFmt& rFrmFmt,const Point& rNdTopLeft) diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx index 5b0a21d..f8ba56d 100644 --- a/sw/source/filter/ww8/docxsdrexport.hxx +++ b/sw/source/filter/ww8/docxsdrexport.hxx @@ -63,6 +63,8 @@ public: OStringBuffer& getTextFrameStyle(); /// Same, as DocxAttributeOutput::m_bBtLr, but for textframe rotation. bool getFrameBtLr(); + + bool IsDrawingOpen(); sax_fastparser::FastAttributeList*& getFlyFillAttrList(); sax_fastparser::FastAttributeList* getFlyWrapAttrList(); void setFlyWrapAttrList(sax_fastparser::FastAttributeList* pAttrList); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits