Kaydet (Commit) 9922931a authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX export: avoid inline shape inside shape text

Drawing objects inside text boxes are supported by Writer, but not by
Word. Such a document model is still created by the DOCX import for
floating tables.  Till we recognize floating tables on export, at least
make sure that inline shapes are delayed till the end of the floating
table to avoid invalid output.

That matches the behavior of handling anchored shapes inside shape text.

Change-Id: I2fc4e2df009e0d70c369c1fea30b657af0697039
üst 9f1920e7
......@@ -219,6 +219,18 @@ DECLARE_OOXMLEXPORT_TEST(testfdo83428, "fdo83428.docx")
CPPUNIT_ASSERT_EQUAL(OUString("Document"), getProperty<OUString>(xUDProps, "Testing"));
}
DECLARE_OOXMLEXPORT_TEST(testShapeInFloattable, "shape-in-floattable.docx")
{
if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
{
// No nested drawingML w:txbxContent.
assertXPath(pXmlDoc, "//mc:Choice//w:txbxContent//w:txbxContent", 0);
// Instead, make sure we have a separate shape and group shape:
assertXPath(pXmlDoc, "//mc:AlternateContent//mc:Choice[@Requires='wps']", 1);
assertXPath(pXmlDoc, "//mc:AlternateContent//mc:Choice[@Requires='wpg']", 1);
}
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -4887,8 +4887,6 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
}
else
{
uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pSdrObj)->getUnoShape(), uno::UNO_QUERY_THROW);
OUString sShapeType = xShape->getShapeType();
if ( m_postponedDMLDrawing == NULL )
{
bool bStartedParaSdt = m_bStartedParaSdt;
......@@ -4908,8 +4906,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
}
// IsAlternateContentChoiceOpen() : check is to ensure that only one object is getting added. Without this check, plus one obejct gets added
// m_bParagraphFrameOpen : Check if the frame is open.
// sShapeType : This check is to ensure that if the custom shape is within a text frame then only we should postpone it.
else if (IsAlternateContentChoiceOpen() && m_bParagraphFrameOpen && sShapeType == "com.sun.star.drawing.CustomShape")
else if (IsAlternateContentChoiceOpen() && m_bParagraphFrameOpen)
{
m_postponedCustomShape->push_back(PostponedDrawing(pSdrObj, &(rFrame.GetFrmFmt()), &rNdTopLeft));
}
......
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