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

Miklos Vajna vmiklos at collabora.co.uk
Thu Feb 13 10:25:49 CET 2014


 sw/qa/extras/ooxmlimport/data/Table_cell_auto_width_fdo69656.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                          |   12 +++++++---
 writerfilter/source/dmapper/DomainMapperTableManager.cxx          |   11 +++++++--
 3 files changed, 18 insertions(+), 5 deletions(-)

New commits:
commit 08ab57473236b0a34917d8c24c56f157e9ae5be6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Feb 13 10:20:54 2014 +0100

    CppunitTest_sw_ooxmlimport: make this actually test something again
    
    Change-Id: I05d8b0dafcdea68d57137873ea52d4ab28a9b12b

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index c9d578b..3b3a227 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1339,11 +1339,10 @@ DECLARE_OOXMLIMPORT_TEST(testFdo65632, "fdo65632.docx")
 
 DECLARE_OOXMLIMPORT_TEST(testFdo66474, "fdo66474.docx")
 {
-    // The table wasn't relative (relative with was 0), so the table didn't
-    // take the full available width, like it would have to.
+    // The table width was too small, so the text in the second cell was unreadable: this was 1397.
     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xTables->getByIndex(0), "RelativeWidth"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(10492), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
 }
 
 DECLARE_OOXMLIMPORT_TEST(testGroupshapeRotation, "groupshape-rotation.docx")
commit 4d34d43b29be2b14a02b001b35fcde2459fb1993
Author: sushil_shinde <sushil.shinde at synerzip.com>
Date:   Wed Jan 22 17:10:11 2014 +0530

    fdo#69656 table with auto-width and at least one column with auto-width.
    
      - In case of auto width of table and atleast one cell of table
        is auto width It was setting table width to 100% relative width.
      - hence it was causing rederening problem, table width was wrong
        while rendering.
      - Changed 100% hardcoded value, now setting total width of table
        as per grid values.
      - modified one UT since we no longer setting width of table to
        100% default in case of 'auto' width.
      - Added one UT to check proper table width while importing.
    
    Conflicts:
    	sw/qa/extras/ooxmlimport/ooxmlimport.cxx
    Reviewed on:
    	https://gerrit.libreoffice.org/7593
    
    Change-Id: Iae396c632eb1ef0c06efaa8c1965e4a68f12c6b1

diff --git a/sw/qa/extras/ooxmlimport/data/Table_cell_auto_width_fdo69656.docx b/sw/qa/extras/ooxmlimport/data/Table_cell_auto_width_fdo69656.docx
new file mode 100644
index 0000000..10b8f9d
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/Table_cell_auto_width_fdo69656.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index f9a0240..c9d578b 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1343,7 +1343,7 @@ DECLARE_OOXMLIMPORT_TEST(testFdo66474, "fdo66474.docx")
     // take the full available width, like it would have to.
     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xTables->getByIndex(0), "RelativeWidth"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xTables->getByIndex(0), "RelativeWidth"));
 }
 
 DECLARE_OOXMLIMPORT_TEST(testGroupshapeRotation, "groupshape-rotation.docx")
@@ -1842,6 +1842,13 @@ DECLARE_OOXMLIMPORT_TEST(testPictureWithSchemeColor, "picture-with-schemecolor.d
     CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(110), aDIB[136] );
     CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(49), aDIB[137] );
 }
+
+DECLARE_OOXMLIMPORT_TEST(testFdo69656, "Table_cell_auto_width_fdo69656.docx")
+{
+    uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(8154), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
+}
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 2b66761..29d28b4 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -169,7 +169,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
                             {
                                 // Set the width type of table with 'Auto' and set the width value to 100(%)
                                 pPropMap->setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE );
-                                pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, 100 );
+                                pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, 0 );
                             }
                         }
                         m_bTableSizeTypeInserted = true;
@@ -667,7 +667,14 @@ void DomainMapperTableManager::endOfRowAction()
         {
             propMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth );
         }
-
+        if (nTableWidthType == text::SizeType::VARIABLE )
+        {
+            if(nTableWidth > 100 || nTableWidth <= 0)
+            {
+                propMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth);
+                propMap->setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::FIX);
+            }
+        }
         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