summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-12-10 13:57:58 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-12-10 15:27:09 +0100
commitb273e82aaa916b0f6198097dc32740faced73741 (patch)
tree882435720d87f7dece69a93b43d7f0f7987ce194
parente4f602d4ffb4c4981fb7fd666f8908f94a4aecf1 (diff)
tdf#129961 oox: add PPTX import for table shadow as direct format
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
-rw-r--r--oox/qa/unit/data/table-shadow.pptxbin0 -> 16837 bytes
-rw-r--r--oox/qa/unit/drawingml.cxx19
-rw-r--r--oox/source/drawingml/table/tablecontext.cxx5
3 files changed, 24 insertions, 0 deletions
diff --git a/oox/qa/unit/data/table-shadow.pptx b/oox/qa/unit/data/table-shadow.pptx
new file mode 100644
index 000000000000..3247404cbc48
--- /dev/null
+++ b/oox/qa/unit/data/table-shadow.pptx
Binary files differ
diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx
index 0dd0f0991154..d666b3d332a7 100644
--- a/oox/qa/unit/drawingml.cxx
+++ b/oox/qa/unit/drawingml.cxx
@@ -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: */
diff --git a/oox/source/drawingml/table/tablecontext.cxx b/oox/source/drawingml/table/tablecontext.cxx
index bbfc94845369..84e80dccd710 100644
--- a/oox/source/drawingml/table/tablecontext.cxx
+++ b/oox/source/drawingml/table/tablecontext.cxx
@@ -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>
@@ -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() );