[Libreoffice-commits] core.git: 3 commits - oox/source sd/qa

Matúš Kukan matus.kukan at collabora.com
Tue Jul 15 05:30:12 PDT 2014


 oox/source/drawingml/table/tablecell.cxx       |    8 ++-
 oox/source/drawingml/table/tableproperties.cxx |    2 
 sd/qa/unit/data/pptx/bnc887225.pptx            |binary
 sd/qa/unit/import-tests.cxx                    |   51 +++++++++++++++++++++++++
 4 files changed, 58 insertions(+), 3 deletions(-)

New commits:
commit 3d76a540f64f1f55f35863f18eed4b315e0d1e64
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue Jul 15 14:01:01 2014 +0200

    Unit test for cell properties, where lastRow is used in table (bnc#887225)
    
    Change-Id: Ia11dadcbedf6acc035b2d86da39a115bdb298591

diff --git a/sd/qa/unit/data/pptx/bnc887225.pptx b/sd/qa/unit/data/pptx/bnc887225.pptx
new file mode 100755
index 0000000..e5c528f
Binary files /dev/null and b/sd/qa/unit/data/pptx/bnc887225.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 01aade4..e8e148f 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -29,6 +29,7 @@
 #include <svx/svdogrp.hxx>
 #include <svx/svdomedia.hxx>
 #include <svx/svdoole2.hxx>
+#include <svx/svdotable.hxx>
 #include <svx/xflclit.hxx>
 #include <animations/animationnodehelper.hxx>
 
@@ -69,6 +70,7 @@ public:
     void testN862510_2();
     void testN862510_4();
     void testBnc870237();
+    void testBnc887225();
 
     CPPUNIT_TEST_SUITE(SdFiltersTest);
     CPPUNIT_TEST(testDocumentLayout);
@@ -87,6 +89,7 @@ public:
     CPPUNIT_TEST(testN862510_2);
     CPPUNIT_TEST(testN862510_4);
     CPPUNIT_TEST(testBnc870237);
+    CPPUNIT_TEST(testBnc887225);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -550,6 +553,54 @@ void SdFiltersTest::testBnc870237()
     xDocShRef->DoClose();
 }
 
+void SdFiltersTest::testBnc887225()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bnc887225.pptx") );
+    // In the document, lastRow and lastCol table properties are used.
+    // Make sure styles are set properly for individual cells.
+
+    SdDrawDocument *pDoc = xDocShRef->GetDoc();
+    CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+    const SdrPage *pPage = pDoc->GetPage(1);
+    CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+
+    sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(2));
+    CPPUNIT_ASSERT( pTableObj );
+    uno::Reference< table::XCellRange > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW);
+    uno::Reference< beans::XPropertySet > xCell;
+    sal_Int32 nColor;
+
+    xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
+    xCell->getPropertyValue("FillColor") >>= nColor;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor);
+
+    xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW);
+    xCell->getPropertyValue("FillColor") >>= nColor;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor);
+
+    xCell.set(xTable->getCellByPosition(1, 1), uno::UNO_QUERY_THROW);
+    xCell->getPropertyValue("FillColor") >>= nColor;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(13754095), nColor);
+
+    xCell.set(xTable->getCellByPosition(1, 2), uno::UNO_QUERY_THROW);
+    xCell->getPropertyValue("FillColor") >>= nColor;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(15331319), nColor);
+
+    xCell.set(xTable->getCellByPosition(1, 4), uno::UNO_QUERY_THROW);
+    xCell->getPropertyValue("FillColor") >>= nColor;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor);
+
+    xCell.set(xTable->getCellByPosition(3, 2), uno::UNO_QUERY_THROW);
+    xCell->getPropertyValue("FillColor") >>= nColor;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor);
+
+    xCell.set(xTable->getCellByPosition(3, 4), uno::UNO_QUERY_THROW);
+    xCell->getPropertyValue("FillColor") >>= nColor;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor);
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 5d2f12a44d2af3e42e0c3a17ff556f5ada27b1b8
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue Jul 15 11:28:30 2014 +0200

    Do not prefer bandRow over firstCol/lastCol, nor the same with bandCol.
    
    Change-Id: I0c573d721212c870e9ecc99ba5e8494073e09aaf

diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index 6862594..e91f5b8 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -228,7 +228,9 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
     if ( rProperties.isBandRow() )
     {
         if ( ( !rProperties.isFirstRow() || ( nRow != 0 ) ) &&
-            ( !rProperties.isLastRow() || ( nRow != nMaxRow ) ) )
+            ( !rProperties.isLastRow() || ( nRow != nMaxRow ) ) &&
+            ( !rProperties.isFirstCol() || ( nColumn != 0 ) ) &&
+            ( !rProperties.isLastCol() || ( nColumn != nMaxColumn ) ) )
         {
             sal_Int32 nBand = nRow;
             if ( rProperties.isFirstRow() )
@@ -303,7 +305,9 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
     }
     if ( rProperties.isBandCol() )
     {
-        if ( ( !rProperties.isFirstCol() || ( nColumn != 0 ) ) &&
+        if ( ( !rProperties.isFirstRow() || ( nRow != 0 ) ) &&
+            ( !rProperties.isLastRow() || ( nRow != nMaxRow ) ) &&
+            ( !rProperties.isFirstCol() || ( nColumn != 0 ) ) &&
             ( !rProperties.isLastCol() || ( nColumn != nMaxColumn ) ) )
         {
             sal_Int32 nBand = nColumn;
commit 47645734c350f244b4a5642a709132ca1b7dc75d
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue Jul 15 10:58:51 2014 +0200

    bnc#887225: OOXML import: Correctly apply table style for lastRow.
    
    nMaxColumn and nMaxRow are indexes, so use size() - 1.
    
    Change-Id: I20055e55cf2464710fe553fb8067bad13a339084

diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx
index c7c6fff..80cc6d2 100644
--- a/oox/source/drawingml/table/tableproperties.cxx
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -288,7 +288,7 @@ void TableProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBa
 
                 Reference< XCellRange > xCellRange( xTable, UNO_QUERY_THROW );
                 rTableCell.pushToXCell( rFilterBase, pMasterTextListStyle, xCellRange->getCellByPosition( nColumn, nRow ), *this, rTableStyle,
-                    nColumn, aTableRowIter->getTableCells().size(), nRow, mvTableRows.size() );
+                    nColumn, aTableRowIter->getTableCells().size()-1, nRow, mvTableRows.size()-1 );
             }
         }
     }


More information about the Libreoffice-commits mailing list