summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-12-10 13:57:58 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-12-11 17:34:33 +0100
commitb200bf2b33fd525b405c4d6dfb3eb4f6bf5f6c1f (patch)
treed1e22cc69afa5c36afe5aa589846b9ec13c5ff35 /oox
parent3d851b56d288f8e9fd547848ec93dc450937edcf (diff)
tdf#129961 oox: add PPTX import for table shadow as direct format
PPTX export and ODP filter is still missing. (cherry picked from commit b273e82aaa916b0f6198097dc32740faced73741) Change-Id: I451b334ada80d9d228b7d7f36b5f26473b575ef6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107595 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox')
-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 f17d1050fe85..b86e5ad2e665 100644
--- a/oox/qa/unit/drawingml.cxx
+++ b/oox/qa/unit/drawingml.cxx
@@ -299,6 +299,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 90191f615d4d..a48114a82402 100644
--- a/oox/source/drawingml/table/tablecontext.cxx
+++ b/oox/source/drawingml/table/tablecontext.cxx
@@ -23,6 +23,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>
@@ -65,6 +66,10 @@ TableContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& r
rTableStyle.reset( new 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() );