[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - sw/qa writerfilter/source

Miklos Vajna vmiklos at suse.cz
Mon Aug 5 05:32:38 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 df10efed1f8c9864b18bf41ce7b9cc29bbf19760
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.
    
    Conflicts:
    	sw/qa/extras/ooxmlimport/ooxmlimport.cxx
    
    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 bc33ac9..2b87f4d 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -127,6 +127,7 @@ public:
     void testN820509();
     void testN820788();
     void testTableAutoColumnFixedSize();
+    void testFdo66474();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -203,6 +204,7 @@ void Test::run()
         {"n820509.docx", &Test::testN820509},
         {"n820788.docx", &Test::testN820788},
         {"table-auto-column-fixed-size.docx", &Test::testTableAutoColumnFixedSize},
+        {"fdo66474.docx", &Test::testFdo66474},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -1271,6 +1273,15 @@ void Test::testTableAutoColumnFixedSize()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(3996)), getProperty<sal_Int32>(xTextTable, "Width"));
 }
 
+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 e28c171..527793e 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -135,20 +135,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;
                                     }
                                 }
                             }
@@ -351,7 +355,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