Skip to content

Commit

Permalink
tdf#129961 oox: add PPTX import for table shadow as direct format
Browse files Browse the repository at this point in the history
PPTX export and ODP filter is still missing.

Change-Id: I451b334ada80d9d228b7d7f36b5f26473b575ef6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107529
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
  • Loading branch information
vmiklos committed Dec 10, 2020
1 parent e4f602d commit b273e82
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Binary file added oox/qa/unit/data/table-shadow.pptx
Binary file not shown.
19 changes: 19 additions & 0 deletions oox/qa/unit/drawingml.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,25 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testCameraRotationRevolution)
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(27000), nRotateAngle1);
}

CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTableShadow)
{
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "table-shadow.pptx";
load(aURL);
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
bool bShadow = false;
CPPUNIT_ASSERT(xShape->getPropertyValue("Shadow") >>= bShadow);

// Without the accompanying fix in place, this test would have failed, because shadow on a table
// was lost on import.
CPPUNIT_ASSERT(bShadow);
sal_Int32 nColor = 0;
CPPUNIT_ASSERT(xShape->getPropertyValue("ShadowColor") >>= nColor);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xff0000), nColor);
}

CPPUNIT_PLUGIN_IMPLEMENT();

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
5 changes: 5 additions & 0 deletions oox/source/drawingml/table/tablecontext.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <drawingml/table/tableproperties.hxx>
#include <drawingml/table/tablestylecontext.hxx>
#include <drawingml/table/tablerowcontext.hxx>
#include <drawingml/effectpropertiescontext.hxx>
#include <oox/token/namespaces.hxx>
#include <oox/token/tokens.hxx>

Expand Down Expand Up @@ -66,6 +67,10 @@ TableContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& r
rTableStyle = std::make_shared<TableStyle>();
return new TableStyleContext( *this, rAttribs, *rTableStyle );
}
case A_TOKEN( effectLst ): // CT_EffectList
{
return new EffectPropertiesContext(*this, mpShapePtr->getEffectProperties());
}
case A_TOKEN( tableStyleId ): // ST_Guid
return new oox::drawingml::GuidContext( *this, mrTableProperties.getStyleId() );

Expand Down

0 comments on commit b273e82

Please sign in to comment.