summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYogeshBharate <yogesh.bharate@synerzip.com>2014-03-12 19:26:00 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-17 10:15:12 +0100
commit6415f3e7ab6a7728d44dbb49c1486ac9ca649a17 (patch)
treebd96c20b7f1740b36a5bdb33a3490190c9f1d031
parent881ca9d48fc67665559484901ce6a670dc331ab8 (diff)
fdo#75604: File Corruption - Issue related to the nested AlternateContent.
Problem Description: - If the document contains, text box & group shape having text, after roundtrip file get corrupted. - Due this the text box exported inside the another group shape. (i.e nested alternateContent which is not allowed in MS office 2010.) Implementation: - Use the variable which avoid the nested alternateContent. - This keeps the various text frame on same level in different run. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/8555 Change-Id: Ia18eb2b8cf17a451ebe344a811efae1328134215
-rw-r--r--sw/qa/extras/ooxmlexport/data/nestedAlternateContent.docxbin0 -> 19109 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx9
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx3
3 files changed, 12 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/nestedAlternateContent.docx b/sw/qa/extras/ooxmlexport/data/nestedAlternateContent.docx
new file mode 100644
index 000000000000..5b6b03c1acdd
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/nestedAlternateContent.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2a2f7c837315..772156ecb99b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2804,6 +2804,15 @@ DECLARE_OOXMLEXPORT_TEST(testFileWithInvalidImageLink, "FileWithInvalidImageLink
assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/pic:pic[1]/pic:blipFill[1]/a:blip[1]", "embed", "");
}
+DECLARE_OOXMLEXPORT_TEST(testNestedAlternateContent, "nestedAlternateContent.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ // We check alternateContent could not contains alternateContent (i.e. nested alternateContent)
+ assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wpg:wgp[1]/wps:wsp[2]/wps:txbx[1]/w:txbxContent[1]/w:p[1]/w:r[2]/mc:AlternateContent[1]",0);
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index cfa3b472911a..1b3ec7424912 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4069,7 +4069,10 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj)
aAttrIter.NextPos();
}
while( nAktPos < nEnd );
+ // Word can't handle nested text boxes, so write them on the same level.
+ ++m_nTextFrameLevel;
EndParagraph(ww8::WW8TableNodeInfoInner::Pointer_t());
+ --m_nTextFrameLevel;
}
m_pSerializer->endElementNS( XML_w, XML_txbxContent );
}