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

Vinaya Mandke vinaya.mandke at synerzip.com
Mon Jan 27 01:57:58 PST 2014


 sw/qa/extras/ooxmlexport/data/fdo73556.docx              |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                 |   21 +++++++++++++++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |   14 ++++++++++
 3 files changed, 35 insertions(+)

New commits:
commit c035c3dc527c0756b51865124b96c507c44743ed
Author: Vinaya Mandke <vinaya.mandke at synerzip.com>
Date:   Mon Jan 20 16:59:56 2014 +0530

    fdo#73556 Docx was exported with incorrect column width
    
    The file contains a table with 3 columns. The girdcols
    are as follows: {1210, 1331, 1210}, whereas the
    individual cells have {1210, 400, 1210}.
    The table column separators were taken from the grid while
    the table width was calculated as 2820 from cells
    instead of 3751 from the grid.
    Hence the table width reduced after export to DOCX
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    Reviewed on:
    	https://gerrit.libreoffice.org/7540
    
    Change-Id: I2c590ad6b5ec9fe3e8559971ca8cfa69c5343f47

diff --git a/sw/qa/extras/ooxmlexport/data/fdo73556.docx b/sw/qa/extras/ooxmlexport/data/fdo73556.docx
new file mode 100644
index 0000000..5035407
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo73556.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 7c8fa7ea..90a6b9c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2603,6 +2603,27 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69616, "fdo69616.docx")
     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Fallback/w:pict/v:group", "coordorigin").match("696,725"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFdo73556,"fdo73556.docx")
+{
+    /*
+    *  The file contains a table with 3 columns
+    *  the girdcols are as follows: {1210, 1331, 1210}
+    *  whereas the individual cells have {1210, 400, 1210}
+    *  The table column separators were taken from the Grid, while
+    *  the table width was calculated as 2820 from cells instead
+    *  of 3751 from the Grid.
+    */
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol", 3);
+    sal_Int32 tableWidth = 0;
+    tableWidth += getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[1]", "w").toInt32();
+    tableWidth += getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32();
+    tableWidth += getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[3]", "w").toInt32();
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3751), tableWidth);
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 6969fe3..2b66761 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -654,6 +654,20 @@ void DomainMapperTableManager::endOfRowAction()
 
     if( pTableGrid->size() == ( m_nGridBefore + nGrids + m_nGridAfter ) && m_nCell.back( ) > 0 )
     {
+        /*
+         * If table width property set earlier is smaller than the current table width,
+         * then replace the TABLE_WIDTH property, set earlier.
+         */
+        TablePropertyMapPtr propMap = m_aTmpTableProperties.back();
+        sal_Int32 nTableWidth;
+        sal_Int32 nTableWidthType;
+        propMap->getValue( TablePropertyMap::TABLE_WIDTH, nTableWidth );
+        propMap->getValue( TablePropertyMap::TABLE_WIDTH_TYPE, nTableWidthType );
+        if ((nTableWidthType == text::SizeType::FIX) && (nTableWidth < m_nTableWidth))
+        {
+            propMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth );
+        }
+
         uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell.back( ) - 1 );
         text::TableColumnSeparator* pSeparators = aSeparators.getArray();
         sal_Int16 nLastRelPos = 0;


More information about the Libreoffice-commits mailing list