[Libreoffice-commits] core.git: sw/qa sw/source

YogeshBharate yogesh.bharate at synerzip.com
Mon Mar 17 02:15:51 PDT 2014


 sw/qa/extras/ooxmlexport/data/nestedAlternateContent.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                  |    9 +++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx              |    3 +++
 3 files changed, 12 insertions(+)

New commits:
commit 6415f3e7ab6a7728d44dbb49c1486ac9ca649a17
Author: YogeshBharate <yogesh.bharate at synerzip.com>
Date:   Wed Mar 12 19:26:00 2014 +0530

    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

diff --git a/sw/qa/extras/ooxmlexport/data/nestedAlternateContent.docx b/sw/qa/extras/ooxmlexport/data/nestedAlternateContent.docx
new file mode 100644
index 0000000..5b6b03c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/nestedAlternateContent.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2a2f7c8..772156e 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 cfa3b47..1b3ec74 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 );
 }


More information about the Libreoffice-commits mailing list