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

Matus Uzak matus.uzak at gmail.com
Fri Mar 4 22:22:42 UTC 2016


 oox/source/drawingml/table/tableproperties.cxx |    5 ++--
 sd/qa/unit/data/pptx/tdf62255.pptx             |binary
 sd/qa/unit/import-tests.cxx                    |   26 +++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 87d0df65a93db4d720e25e8ef5da4068380b5c58
Author: Matus Uzak <matus.uzak at gmail.com>
Date:   Mon Feb 22 15:54:35 2016 +0100

    tdf#62255,tdf#92058: PPTX import: Incorrect inheritance of default table style
    
    The default table style defined in tableStyles.xml file can be used
    when a table is initially inserted into a document.  It must not be
    applied by default to any of the tables not referencing a table style
    explicitly from the tableStyleId element.
    
    Change-Id: I025cdfba352c87a32f9a1e297fbc8b9fc2c8c0a4
    Reviewed-on: https://gerrit.libreoffice.org/22619
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    Tested-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx
index d639c7c..048e420 100644
--- a/oox/source/drawingml/table/tableproperties.cxx
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -226,10 +226,11 @@ const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilt
     TableStyle* pTableStyle = nullptr;
     if ( mpTableStyle )
         pTableStyle = &*mpTableStyle;
-    else if ( rBase.getTableStyles() )
+    else if ( !getStyleId().isEmpty() && rBase.getTableStyles() )
     {
         const std::vector< TableStyle >& rTableStyles( rBase.getTableStyles()->getTableStyles() );
-        const OUString aStyleId( getStyleId().isEmpty() ? rBase.getTableStyles()->getDefaultStyleId() : getStyleId() );
+        const OUString aStyleId( getStyleId() );
+
         std::vector< TableStyle >::const_iterator aIter( rTableStyles.begin() );
         while( aIter != rTableStyles.end() )
         {
diff --git a/sd/qa/unit/data/pptx/tdf62255.pptx b/sd/qa/unit/data/pptx/tdf62255.pptx
new file mode 100644
index 0000000..fc06a9e
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf62255.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 8c53d6b..c7e4f00 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -108,6 +108,7 @@ public:
     void testRowHeight();
     void testTdf93830();
     void testTdf93097();
+    void testTdf62255();
 
     CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -150,6 +151,7 @@ public:
     CPPUNIT_TEST(testRowHeight);
     CPPUNIT_TEST(testTdf93830);
     CPPUNIT_TEST(testTdf93097);
+    CPPUNIT_TEST(testTdf62255);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -1166,6 +1168,30 @@ void SdImportTest::testTdf93097()
     xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf62255()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/tdf62255.pptx"), PPTX);
+    const SdrPage *pPage = GetPage( 1, xDocShRef );
+
+    sdr::table::SdrTableObj *pTableObj;
+    pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
+    CPPUNIT_ASSERT( pTableObj );
+
+    css::uno::Any aAny;
+    uno::Reference< table::XCellRange > xTable;
+    uno::Reference< beans::XPropertySet > xCell;
+    xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW);
+    xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
+    aAny = xCell->getPropertyValue("FillStyle");
+
+    if (aAny.hasValue())
+    {
+        drawing::FillStyle aFillStyle;
+        aAny >>= aFillStyle;
+        CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, aFillStyle);
+    }
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list