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
This commit is contained in:
PriyankaGaikwad
2014-05-12 13:57:35 +05:30
committed by Miklos Vajna
parent eafecb57c9
commit 350b88c2b7
5 changed files with 24 additions and 2 deletions

Binary file not shown.

View File

@@ -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" ); 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 #endif
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();

View File

@@ -4210,8 +4210,9 @@ void DocxAttributeOutput::WritePostponedDMLDrawing()
it != m_postponedDMLDrawing->end(); it != m_postponedDMLDrawing->end();
++it ) ++it )
{ {
if ( IsAlternateContentChoiceOpen() ) // Avoid w:drawing within another w:drawing.
m_rExport.SdrExporter().writeDMLDrawing(it->object, (it->frame), m_anchorId++); if ( IsAlternateContentChoiceOpen() && !( m_rExport.SdrExporter().IsDrawingOpen()) )
m_rExport.SdrExporter().writeDMLDrawing(it->object, (it->frame), m_anchorId++);
else else
m_rExport.SdrExporter().writeDMLAndVMLDrawing(it->object, *(it->frame), *(it->point), m_anchorId++); m_rExport.SdrExporter().writeDMLAndVMLDrawing(it->object, *(it->frame), *(it->point), m_anchorId++);
} }

View File

@@ -142,6 +142,7 @@ struct DocxSdrExport::Impl
sax_fastparser::FastAttributeList* m_pTextboxAttrList; sax_fastparser::FastAttributeList* m_pTextboxAttrList;
OStringBuffer m_aTextFrameStyle; OStringBuffer m_aTextFrameStyle;
bool m_bFrameBtLr; bool m_bFrameBtLr;
bool m_bDrawingOpen;
bool m_bFlyFrameGraphic; bool m_bFlyFrameGraphic;
sax_fastparser::FastAttributeList* m_pFlyFillAttrList; sax_fastparser::FastAttributeList* m_pFlyFillAttrList;
sax_fastparser::FastAttributeList* m_pFlyWrapAttrList; sax_fastparser::FastAttributeList* m_pFlyWrapAttrList;
@@ -162,6 +163,7 @@ struct DocxSdrExport::Impl
m_pFlyAttrList(0), m_pFlyAttrList(0),
m_pTextboxAttrList(0), m_pTextboxAttrList(0),
m_bFrameBtLr(false), m_bFrameBtLr(false),
m_bDrawingOpen(false),
m_bFlyFrameGraphic(false), m_bFlyFrameGraphic(false),
m_pFlyFillAttrList(0), m_pFlyFillAttrList(0),
m_pFlyWrapAttrList(0), m_pFlyWrapAttrList(0),
@@ -239,6 +241,11 @@ bool DocxSdrExport::getFrameBtLr()
return m_pImpl->m_bFrameBtLr; return m_pImpl->m_bFrameBtLr;
} }
bool DocxSdrExport::IsDrawingOpen()
{
return m_pImpl->m_bDrawingOpen;
}
sax_fastparser::FastAttributeList*& DocxSdrExport::getFlyFillAttrList() sax_fastparser::FastAttributeList*& DocxSdrExport::getFlyFillAttrList()
{ {
return m_pImpl->m_pFlyFillAttrList; 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) void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rSize)
{ {
m_pImpl->m_bDrawingOpen = true;
m_pImpl->m_pSerializer->startElementNS(XML_w, XML_drawing, FSEND); m_pImpl->m_pSerializer->startElementNS(XML_w, XML_drawing, FSEND);
const SvxLRSpaceItem pLRSpaceItem = pFrmFmt->GetLRSpace(false); 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_wp, isAnchor ? XML_anchor : XML_inline);
m_pImpl->m_pSerializer->endElementNS(XML_w, XML_drawing); 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) void DocxSdrExport::writeVMLDrawing(const SdrObject* sdrObj, const SwFrmFmt& rFrmFmt,const Point& rNdTopLeft)

View File

@@ -63,6 +63,8 @@ public:
OStringBuffer& getTextFrameStyle(); OStringBuffer& getTextFrameStyle();
/// Same, as DocxAttributeOutput::m_bBtLr, but for textframe rotation. /// Same, as DocxAttributeOutput::m_bBtLr, but for textframe rotation.
bool getFrameBtLr(); bool getFrameBtLr();
bool IsDrawingOpen();
sax_fastparser::FastAttributeList*& getFlyFillAttrList(); sax_fastparser::FastAttributeList*& getFlyFillAttrList();
sax_fastparser::FastAttributeList* getFlyWrapAttrList(); sax_fastparser::FastAttributeList* getFlyWrapAttrList();
void setFlyWrapAttrList(sax_fastparser::FastAttributeList* pAttrList); void setFlyWrapAttrList(sax_fastparser::FastAttributeList* pAttrList);