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

umeshkadam umesh.kadam at synerzip.com
Fri Jan 10 06:52:51 PST 2014


 sw/qa/extras/ooxmlexport/data/fdo71834.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |    8 ++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   34 +++++++++++++++++++++++----
 sw/source/filter/ww8/docxattributeoutput.hxx |    7 +++++
 4 files changed, 45 insertions(+), 4 deletions(-)

New commits:
commit 89a3acbdb590c3552a3184137ba0aad7f97f1549
Author: umeshkadam <umesh.kadam at synerzip.com>
Date:   Fri Jan 10 16:46:58 2014 +0530

    fdo#71834: Fix for floating table
    
        Issue :
            - When we have overlapping tables the first table gets
              exported as a table and the second table gets exported
              as a DML/VML shape.
            - While exporting, the system starts with the table row &
              the cell, within which it starts exporting the overlapped
              table, while doing so the previous table attributes were
                      being referred since the variable was shared.
    
        Implementation:
            - Save and reset the table related attributes before
              calling the WriteDMLTextFrame & writeVMLTextFrame
              functions.
            - Restore the table attributes for further processing after
              having written the shape.
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    Reviewed on:
    	https://gerrit.libreoffice.org/7364
    
    Change-Id: I0052a08c74ffbbebd3eb91a7075a43a4c225b670

diff --git a/sw/qa/extras/ooxmlexport/data/fdo71834.docx b/sw/qa/extras/ooxmlexport/data/fdo71834.docx
new file mode 100644
index 0000000..62262d9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo71834.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ecad7b0..26dc77a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2296,6 +2296,14 @@ DECLARE_OOXMLEXPORT_TEST(testSmartArtAnchoredInline, "fdo73227.docx")
     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing[2]/wp:anchor/wp:docPr","name","Picture");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFDO71834, "fdo71834.docx")
+{
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[4]/w:tr[2]/w:tc[1]/w:tcPr[1]/w:tcW[1]","type", "dxa");
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1606038..26a7507 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -368,6 +368,23 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
         m_pSerializer->startElementNS(XML_mc, XML_Choice,
                 XML_Requires, "wps",
                 FSEND);
+        /** FDO#71834 :
+           We should probably be renaming the function
+           switchHeaderFooter to something like SaveRetrieveTableReference.
+           Save the table reference attributes before calling WriteDMLTextFrame,
+           otherwise the StartParagraph function will use the previous existing
+           table reference attributes since the variable is being shared.
+        */
+        switchHeaderFooter(true,1);
+        /** Save the table info's before writing the shape
+            as there might be a new table that might get
+            spawned from within the VML & DML block and alter
+            the contents.
+        */
+        ww8::WW8TableInfo::Pointer_t pOldTableInfo = m_rExport.mpTableInfo;
+        //Reset the table infos after saving.
+        m_rExport.mpTableInfo = ww8::WW8TableInfo::Pointer_t(new ww8::WW8TableInfo());
+
         WriteDMLTextFrame(pParentFrame);
         m_pSerializer->endElementNS(XML_mc, XML_Choice);
 
@@ -375,9 +392,17 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
         // in case the text frame had table(s) and we try to export the
         // same table second time.
         m_rExport.mpTableInfo = ww8::WW8TableInfo::Pointer_t(new ww8::WW8TableInfo());
+        //reset the tableReference.
+        switchHeaderFooter(false,0);
 
         m_pSerializer->startElementNS(XML_mc, XML_Fallback, FSEND);
         m_rExport.SdrExporter().writeVMLTextFrame(pParentFrame);
+        /* FDO#71834 :Restore the data here after having written the Shape
+           for further processing.
+        */
+        switchHeaderFooter(false,-1);
+        m_rExport.mpTableInfo = pOldTableInfo;
+
         m_pSerializer->endElementNS(XML_mc, XML_Fallback);
         m_pSerializer->endElementNS(XML_mc, XML_AlternateContent);
 
@@ -563,6 +588,9 @@ void DocxAttributeOutput::EndParagraphProperties( const boost::shared_ptr<SfxIte
 
     WriteCollectedParagraphProperties();
 
+    // Merge the marks for the ordered elements
+    m_pSerializer->mergeTopMarks( );
+
     // Write 'Paragraph Mark' properties
     if ( pRedlineParagraphMarkerDeleted || pRedlineParagraphMarkerInserted || pParagraphMarkerProperties)
     {
@@ -617,9 +645,6 @@ void DocxAttributeOutput::EndParagraphProperties( const boost::shared_ptr<SfxIte
         m_pSerializer->endElementNS( XML_w, XML_rPr );
     }
 
-    // Merge the marks for the ordered elements
-    m_pSerializer->mergeTopMarks( );
-
     m_pSerializer->endElementNS( XML_w, XML_pPr );
 
     if ( m_nColBreakStatus == COLBRK_WRITE )
@@ -2146,7 +2171,7 @@ void DocxAttributeOutput::switchHeaderFooter(bool isHeaderFooter, sal_Int32 inde
     }
     else if( index == -1)
     {
-        m_tableReference = m_oldTableReference;
+        *m_tableReference = *m_oldTableReference;
     }
     else
     {
@@ -2154,6 +2179,7 @@ void DocxAttributeOutput::switchHeaderFooter(bool isHeaderFooter, sal_Int32 inde
         m_tableReference->m_nTableDepth = 0;
     }
 }
+
 void DocxAttributeOutput::StartTable( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
 {
     m_pSerializer->startElementNS( XML_w, XML_tbl, FSEND );
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 53c0ce0..3375895 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -116,6 +116,13 @@ struct TableReference
         m_nTableDepth(0)
     {
     }
+
+    TableReference operator= (const TableReference& rhs)
+    {
+        m_bTableCellOpen = rhs.m_bTableCellOpen ;
+        m_nTableDepth    = rhs.m_nTableDepth ;
+        return *this ;
+    }
 };
 
 /// The class that has handlers for various resource types when exporting as DOCX.


More information about the Libreoffice-commits mailing list