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

Miklos Vajna vmiklos at suse.cz
Fri Jul 26 08:33:23 PDT 2013


 sw/qa/extras/ooxmlimport/data/fdo66474.docx              |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                 |   11 +++++++++++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |   15 +++++++++++----
 3 files changed, 22 insertions(+), 4 deletions(-)

New commits:
commit 67163f5531c29ff1983661ba832bd205944b33f3
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Jul 26 16:50:07 2013 +0200

    fdo#66474 DOCX import: fix handling of mixed fixed/auto cell widths
    
    Instead of checking if any cells have fixed width, check if all calls
    have fixed with.  Regression from
    74c5ed19f430327988194cdcd6bdff09591a93fa.
    
    Change-Id: I58d3d16cbaa2c54a8a1ac309910336c72dcb39b7

diff --git a/sw/qa/extras/ooxmlimport/data/fdo66474.docx b/sw/qa/extras/ooxmlimport/data/fdo66474.docx
new file mode 100755
index 0000000..0252746
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo66474.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 34e41b5..0d10002 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -125,6 +125,7 @@ public:
     void testTableAutoColumnFixedSize();
     void testFdo46361();
     void testFdo65632();
+    void testFdo66474();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -215,6 +216,7 @@ void Test::run()
         {"table-auto-column-fixed-size.docx", &Test::testTableAutoColumnFixedSize},
         {"fdo46361.docx", &Test::testFdo46361},
         {"fdo65632.docx", &Test::testFdo65632},
+        {"fdo66474.docx", &Test::testFdo66474},
     };
     header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1516,6 +1518,15 @@ void Test::testFdo65632()
     CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty<OUString>(getRun(getParagraphOfText(1, xText), 1), "TextPortionType"));
 }
 
+void Test::testFdo66474()
+{
+    // The table wasn't relative (relative with was 0), so the table didn't
+    // 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_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 739d3e7..c5c9ce0 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -140,20 +140,24 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
                             the final sizing of the table, but then must use the contents of each cell to determine final column widths.
                             (See 17.18.87 of the ISO/IEC 29500-1:2011.)
                             */
-                            bool bFixed = false;
+                            bool bFixed = true;
                             sal_Int32 nRowFixedWidth = 0;
                             if (!m_aCellWidths.empty())
                             {
-                                // Step 1. Check whether any cell has fixed width in the given row of table.
+                                // Step 1. Check whether all cells have fixed widths in the given row of table.
                                 ::std::vector< IntVectorPtr >::iterator itr;
                                 for (itr = m_aCellWidths.begin(); itr != m_aCellWidths.end(); itr ++)
                                 {
                                     IntVectorPtr itrVal = (*itr);
                                     for (std::vector<sal_Int32>::const_iterator aValIter = itrVal->begin(); aValIter != itrVal->end(); ++aValIter)
                                     {
+                                        if (*aValIter == -1)
+                                        {
+                                            bFixed = false;
+                                            break;
+                                        }
                                         // Sum the width of cells to find the total width of given row
                                         nRowFixedWidth += (*aValIter);
-                                        bFixed = true;
                                     }
                                 }
                             }
@@ -368,7 +372,10 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
                     {
                         MeasureHandlerPtr pMeasureHandler(new MeasureHandler());
                         pProperties->resolve(*pMeasureHandler);
-                        getCurrentCellWidths()->push_back(pMeasureHandler->getMeasureValue());
+                        if (sal::static_int_cast<Id>(pMeasureHandler->getUnit()) == NS_ooxml::LN_Value_ST_TblWidth_auto)
+                            getCurrentCellWidths()->push_back(sal_Int32(-1));
+                        else
+                            getCurrentCellWidths()->push_back(pMeasureHandler->getMeasureValue());
                         if (getTableDepthDifference() > 0)
                             m_bPushCurrentWidth = true;
                     }


More information about the Libreoffice-commits mailing list