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@cib.de>
Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
This commit is contained in:
Matus Uzak
2016-02-22 15:54:35 +01:00
committed by Katarina Behrens
parent 01157183ea
commit 87d0df65a9
3 changed files with 29 additions and 2 deletions

View File

@@ -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() )
{

Binary file not shown.

View File

@@ -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();