diff options
author | PriyankaGaikwad <priyanka.gaikwad@synerzip.com> | 2014-05-12 13:57:35 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-05-15 09:33:46 +0200 |
commit | 350b88c2b7871eb34f945f2ada7b03717f661bdc (patch) | |
tree | b3f2ddf84f3f5f3943649eff89c3ed9c73b358eb /sw | |
parent | eafecb57c91e943f22285d4d579df2932e5c1555 (diff) |
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
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo78300.docx | bin | 0 -> 14358 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.hxx | 2 |
5 files changed, 24 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo78300.docx b/sw/qa/extras/ooxmlexport/data/fdo78300.docx Binary files differnew file mode 100644 index 000000000000..40da0913d4a5 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo78300.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index df265ff31bce..67bd0caee1a3 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 0c009526d615..aba33a41e64a 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 4f9aa336abf2..dff531036cb4 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 5b0a21d91b9f..f8ba56d9a636 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); |