summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-05-24 20:11:47 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-07-04 08:06:52 +0200
commit3776c15fdf63262721126539bdaa6fd5d4474b1c (patch)
tree3180619aeea91f12ab590a0075a89581f5d3b36e /sd/source
parentc45b788517c9db9f8f3c0294ef3f8fdaae890815 (diff)
tdf#149205 sd theme: fix PPTX export loosing dk1 and lt1 colors
Document theme of Impress documents were exported to PPTX only partially: dk1 and lt1 was hardcoded to the SYS_COLOR_SCHEMES define, while the rest was written from master-slide-specific svx::Theme. The benefit of this is that our theme is just a set of colors (<a:srgbClr> markup in OOXML), while dk1 and lt1 is more dynamic by default in PowerPoint (<a:sysClr> in OOXML). The downside is that this way a custom dk1 and lt1 color was lost on export. Fix the problem by switching to <a:srgbClr> markup even for dk1 and lt1: not using the <a:sysClr> markup doesn't seem to be a problem in practice, or at least much less problematic than rendering with bad colors. If there is a need, dedicated <a:sysClr> markup support can be still added later by extending svx::ColorSet::maColors to not only store a list of colors, but also some additional properties of those colors. (cherry picked from commit 4a54a24c207f3040390e2fefec41cbbf0edd5eca) Change-Id: I26df3fd8c891c217df0d36382f6599805198f4bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136747 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx26
1 files changed, 13 insertions, 13 deletions
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index f6e78d357ead..cabd5c390078 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2149,7 +2149,8 @@ bool PowerPointExport::WriteColorSets(const FSHelperPtr& pFS, svx::Theme* pTheme
{
static std::map<PredefinedClrSchemeId, sal_Int32> aPredefinedClrTokens =
{
- // dk1 and lt1 is intentionally missing.
+ { dk1, XML_dk1 },
+ { lt1, XML_lt1 },
{ dk2, XML_dk2 },
{ lt2, XML_lt2 },
{ accent1, XML_accent1 },
@@ -2173,14 +2174,11 @@ bool PowerPointExport::WriteColorSets(const FSHelperPtr& pFS, svx::Theme* pTheme
return false;
}
- for (int nId = PredefinedClrSchemeId::dk2; nId < PredefinedClrSchemeId::Count; nId++)
+ for (int nId = PredefinedClrSchemeId::dk1; nId < PredefinedClrSchemeId::Count; nId++)
{
- // dk1 and lt1 are not written here.
- int nIndex = nId + 2;
-
sal_Int32 nToken = aPredefinedClrTokens[static_cast<PredefinedClrSchemeId>(nId)];
pFS->startElementNS(XML_a, nToken);
- pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, I32SHEX(static_cast<sal_Int32>(pColorSet->getColor(nIndex))));
+ pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, I32SHEX(static_cast<sal_Int32>(pColorSet->getColor(nId))));
pFS->endElementNS(XML_a, nToken);
}
@@ -2272,15 +2270,17 @@ void PowerPointExport::WriteTheme(sal_Int32 nThemeNum, svx::Theme* pTheme)
}
pFS->startElementNS(XML_a, XML_clrScheme, XML_name, aColorSchemeName);
- pFS->write(SYS_COLOR_SCHEMES);
-
- if (!WriteColorSets(pFS, pTheme) && !WriteColorSchemes(pFS, sThemePath))
+ if (!WriteColorSets(pFS, pTheme))
{
- // if style is not defined, try to use first one
- if (!WriteColorSchemes(pFS, "ppt/theme/theme1.xml"))
+ pFS->write(SYS_COLOR_SCHEMES);
+ 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);
+ }
}
}