diff options
-rw-r--r-- | include/oox/drawingml/theme.hxx | 1 | ||||
-rw-r--r-- | oox/source/ppt/presentationfragmenthandler.cxx | 7 | ||||
-rw-r--r-- | sd/qa/unit/data/pptx/ooxtheme.pptx | bin | 0 -> 44886 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 28 |
4 files changed, 35 insertions, 1 deletions
diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx index 9593b77eb5f9..bde25e748ba8 100644 --- a/include/oox/drawingml/theme.hxx +++ b/include/oox/drawingml/theme.hxx @@ -97,6 +97,7 @@ public: Shape& getTxDef() { return maTxDef; } const Shape& getTxDef() const { return maTxDef; } + const css::uno::Reference<css::xml::dom::XDocument>& getFragment() const { return mxFragment; } void setFragment( const css::uno::Reference< css::xml::dom::XDocument>& xRef ) { mxFragment=xRef; } private: diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 90e8013b741e..689e6e162cc5 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -179,7 +179,7 @@ void PresentationFragmentHandler::saveThemeToGrabBag(const oox::drawingml::Theme // get existing grab bag comphelper::SequenceAsHashMap aGrabBag(xDocProps->getPropertyValue(aGrabBagPropName)); - uno::Sequence<beans::PropertyValue> aTheme(1); + uno::Sequence<beans::PropertyValue> aTheme(2); comphelper::SequenceAsHashMap aThemesHashMap; // create current theme @@ -204,6 +204,11 @@ void PresentationFragmentHandler::saveThemeToGrabBag(const oox::drawingml::Theme const uno::Any& rCurrentTheme = makeAny(aCurrentTheme); aTheme[0].Value = rCurrentTheme; + // store DOM fragment for SmartArt re-generation + aTheme[1].Name = "OOXTheme"; + const uno::Any& rOOXTheme = makeAny(pThemePtr->getFragment()); + aTheme[1].Value = rOOXTheme; + aThemesHashMap << aTheme; // put the new items diff --git a/sd/qa/unit/data/pptx/ooxtheme.pptx b/sd/qa/unit/data/pptx/ooxtheme.pptx Binary files differnew file mode 100644 index 000000000000..f0f3f2575894 --- /dev/null +++ b/sd/qa/unit/data/pptx/ooxtheme.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 5d690c8a1491..566818755c5b 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -79,6 +79,7 @@ #include <com/sun/star/style/NumberingType.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/text/GraphicCrop.hpp> +#include <com/sun/star/xml/dom/XDocument.hpp> #include <stlpool.hxx> #include <comphelper/processfactory.hxx> @@ -199,6 +200,7 @@ public: void testTdf83247(); void testTdf47365(); void testTdf122899(); + void testOOXTheme(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -288,6 +290,7 @@ public: CPPUNIT_TEST(testTdf83247); CPPUNIT_TEST(testTdf47365); CPPUNIT_TEST(testTdf122899); + CPPUNIT_TEST(testOOXTheme); CPPUNIT_TEST_SUITE_END(); }; @@ -2743,6 +2746,31 @@ void SdImportTest::testTdf122899() xDocShRef->DoClose(); } +void SdImportTest::testOOXTheme() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/ooxtheme.pptx"), PPTX); + + uno::Reference<beans::XPropertySet> xPropSet(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW); + uno::Sequence<beans::PropertyValue> aGrabBag; + xPropSet->getPropertyValue("InteropGrabBag") >>= aGrabBag; + + bool bTheme = false; + for (int i = 0; i < aGrabBag.getLength(); i++) + { + if (aGrabBag[i].Name == "OOXTheme") + { + bTheme = true; + uno::Reference<xml::dom::XDocument> aThemeDom; + CPPUNIT_ASSERT(aGrabBag[i].Value >>= aThemeDom); // PropertyValue of proper type + CPPUNIT_ASSERT(aThemeDom.get()); // Reference not empty + } + } + CPPUNIT_ASSERT(bTheme); // Grab Bag has all the expected elements + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |