[Libreoffice-commits] core.git: include/oox oox/source sd/qa
Grzegorz Araminowicz (via logerrit)
logerrit at kemper.freedesktop.org
Tue Apr 30 07:14:36 UTC 2019
include/oox/drawingml/theme.hxx | 1
oox/source/ppt/presentationfragmenthandler.cxx | 7 +++++-
sd/qa/unit/data/pptx/ooxtheme.pptx |binary
sd/qa/unit/import-tests.cxx | 28 +++++++++++++++++++++++++
4 files changed, 35 insertions(+), 1 deletion(-)
New commits:
commit cd08835d1bd9274412c7326db32fb3752bc94fb3
Author: Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
AuthorDate: Mon Apr 29 14:44:20 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Apr 30 09:13:28 2019 +0200
PPTX import: store OOXTheme in InteropGrabBag for SmartArt re-generation
Change-Id: I343dc3a275ecbbb483e179d8cc2deebfb71b9c8f
Reviewed-on: https://gerrit.libreoffice.org/71530
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
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
new file mode 100644
index 000000000000..f0f3f2575894
Binary files /dev/null and b/sd/qa/unit/data/pptx/ooxtheme.pptx differ
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();
More information about the Libreoffice-commits
mailing list