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

Pallavi Jadhav pallavi.jadhav at synerzip.com
Wed Jun 11 01:22:09 PDT 2014


 sw/qa/extras/ooxmlexport/data/fdo79540.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |   17 +++++++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |    8 +++++++-
 3 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 69ba8e94e33c142072920fe455899c04b4e035d1
Author: Pallavi Jadhav <pallavi.jadhav at synerzip.com>
Date:   Thu Jun 5 19:04:36 2014 +0530

    fdo#79540 : DOCX: Lo exports Drawing inside Drawing
    
    	Issue :
    	- In file there is a WordArt inside Table.
    	- In RT, LO exports <w:drawing> inside <w:drawing>.
    	- The xml sequence was :
      	  <mc:AltrnateContent>
                <mc:Choice>
                  <w:drawing>                // first start of drawing
                    <w:txbxContent>
                      <w:tbl>
                        <w:drawing>   // second start of drawing. MSO does not allow.
    
    	Implementation :
    	- In DocxAttributeOutput::OutputFlyFrame_Impl() under "case sw::Frame::eDrawing",
    	  if drawing is already open then Postpone the Inner Drawing.
    	- Added Export Unit Test case to check two separate drawings are
              now written in document.xml of RT.
    
    Change-Id: I01d06621576d60d26cd51489ee9718dd79eb9c72
    Reviewed-on: https://gerrit.libreoffice.org/9653
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/fdo79540.docx b/sw/qa/extras/ooxmlexport/data/fdo79540.docx
new file mode 100644
index 0000000..ce843d6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo79540.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 4b5de65..30f7480 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3510,6 +3510,23 @@ DECLARE_OOXMLEXPORT_TEST(testfdo76934, "fdo76934.docx")
     assertXPath ( pXmlDoc, "/w:styles[1]/w:style[36]/w:pPr[1]/w:spacing[1]", "beforeAutospacing", "1" );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testfdo79540, "fdo79540.docx")
+{
+    /* Issue was, <w:drawing> was getting written inside <w:drawing>.
+     * So Postone the writing of Inner Drawing tag.
+     * MS Office does not allow Nestimg of drawing tags.
+     */
+
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+
+    if (!pXmlDoc)
+        return;
+
+    // Ensure that two separate w:drawing tags are written after the code changes.
+    assertXPath ( pXmlDoc, "/w:document/w:body/w:p/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing",1);
+    assertXPath ( pXmlDoc, "/w:document/w:body/w:p/w:r[3]/mc:AlternateContent/mc:Choice/w:drawing",1);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx")
 {
     xmlDocPtr pXmlFootNotes = parseExport("word/footnotes.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 645688f..7e7c4a0 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4390,7 +4390,13 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
                         if ( m_postponedDMLDrawing == NULL )
                         {
                             if ( IsAlternateContentChoiceOpen() )
-                                m_rExport.SdrExporter().writeDMLDrawing( pSdrObj, &rFrame.GetFrmFmt(), m_anchorId++);
+                            {
+                                // Do not write w:drawing inside w:drawing. Instead Postpone the Inner Drawing.
+                                if( m_rExport.SdrExporter().IsDrawingOpen() )
+                                    m_postponedCustomShape->push_back(PostponedDrawing(pSdrObj, &(rFrame.GetFrmFmt()), &rNdTopLeft));
+                                else
+                                    m_rExport.SdrExporter().writeDMLDrawing( pSdrObj, &rFrame.GetFrmFmt(), m_anchorId++);
+                            }
                             else
                                 m_rExport.SdrExporter().writeDMLAndVMLDrawing( pSdrObj, rFrame.GetFrmFmt(), rNdTopLeft, m_anchorId++);
 


More information about the Libreoffice-commits mailing list