Kaydet (Commit) 350b88c2 authored tarafından PriyankaGaikwad's avatar PriyankaGaikwad Kaydeden (comit) Miklos Vajna

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
üst eafecb57
......@@ -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();
......
......@@ -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++);
}
......
......@@ -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)
......
......@@ -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);
......
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