summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2018-03-16 21:35:01 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-04-05 16:11:21 +0200
commitb8bb9a94266035b0d4579a7dbb3252a85fc896bc (patch)
treebfc4a0d6a6149a38bb862fb467edf3caf3f91c7b
parent944b882d3296b33f4b33b8ef3e33d020ed428732 (diff)
tdf#84205 If theme not found, use first
Not a complete fix, workaround. Change-Id: If4d765eaeae3419f4f1deb4e1cfbe0113a71da94 Reviewed-on: https://gerrit.libreoffice.org/51440 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/51582 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sd/qa/unit/data/pptx/tdf84205.pptxbin0 -> 45600 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx14
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx8
3 files changed, 20 insertions, 2 deletions
diff --git a/sd/qa/unit/data/pptx/tdf84205.pptx b/sd/qa/unit/data/pptx/tdf84205.pptx
new file mode 100644
index 000000000000..211cea6d0251
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf84205.pptx
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 4f6f86566530..bf06019ddb8f 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -123,6 +123,7 @@ public:
void testGroupsPosition();
void testGroupsRotatedPosition();
void testAccentColor();
+ void testThemeColors();
void testTdf114848();
void testTdf115005();
/// SmartArt animated elements
@@ -178,6 +179,7 @@ public:
CPPUNIT_TEST(testGroupsPosition);
CPPUNIT_TEST(testGroupsRotatedPosition);
CPPUNIT_TEST(testAccentColor);
+ CPPUNIT_TEST(testThemeColors);
CPPUNIT_TEST(testTdf114848);
CPPUNIT_TEST(testTdf115005);
CPPUNIT_TEST(testTdf104792);
@@ -1313,6 +1315,18 @@ void SdOOXMLExportTest2::testAccentColor()
assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val", "deb340");
}
+void SdOOXMLExportTest2::testThemeColors()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf84205.pptx"), PPTX);
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+ xDocShRef->DoClose();
+
+ xmlDocPtr pXmlDocTheme2 = parseExport(tempFile, "ppt/theme/theme2.xml");
+ assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val", "44546a");
+ assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:accent3/a:srgbClr", "val", "a5a5a5");
+}
+
void SdOOXMLExportTest2::testTdf114848()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf114848.pptx"), PPTX);
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 103d4779fb5f..bc1042d74712 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2669,8 +2669,12 @@ void PowerPointExport::WriteTheme(sal_Int32 nThemeNum)
if (!WriteColorSchemes(pFS, sThemePath))
{
- // color schemes are required - use default values
- WriteDefaultColorSchemes(pFS);
+ // if style is not defined, try to use first one
+ if (!WriteColorSchemes(pFS, "ppt/theme/theme1.xml"))
+ {
+ // color schemes are required - use default values
+ WriteDefaultColorSchemes(pFS);
+ }
}
pFS->endElementNS(XML_a, XML_clrScheme);