summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-11-23 08:11:22 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-11-23 09:07:42 +0100
commited662bcc20804e8b8d5946904f1b577a825f09de (patch)
treed6726268de898b476ba2345819d83b37085a9800 /oox
parentcea0b1f894bfd29af5a4f9392d4fb45db9a1a938 (diff)
PPTX import: implement native handling of a color's luminance modulation
This was already handled in oox/ at import-time: this adds it to the doc model, including UNO API and PPTX import. This is a dependency PPTX export and UI. Change-Id: I5d875b53d715beb10c13ef616d06cf958d43f70f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125684 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'oox')
-rw-r--r--oox/qa/unit/data/theme.pptxbin32660 -> 33063 bytes
-rw-r--r--oox/qa/unit/drawingml.cxx7
-rw-r--r--oox/source/drawingml/color.cxx17
-rw-r--r--oox/source/drawingml/textcharacterproperties.cxx1
-rw-r--r--oox/source/token/properties.txt1
5 files changed, 26 insertions, 0 deletions
diff --git a/oox/qa/unit/data/theme.pptx b/oox/qa/unit/data/theme.pptx
index 6d9ffc00bbbb..5268e4041300 100644
--- a/oox/qa/unit/data/theme.pptx
+++ b/oox/qa/unit/data/theme.pptx
Binary files differ
diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx
index e45ee8d98dd1..f7b6e9b237a3 100644
--- a/oox/qa/unit/drawingml.cxx
+++ b/oox/qa/unit/drawingml.cxx
@@ -437,6 +437,13 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testPptxTheme)
// 4 is accent1, see oox::drawingml::Color::getSchemeColorIndex().
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4),
xPortion->getPropertyValue("CharColorTheme").get<sal_Int32>());
+ // 60000 in the file, just 100th vs 1000th percents.
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 6000
+ // - Actual : 10000
+ // i.e. we had the default 100% value, not the value from the file.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(6000),
+ xPortion->getPropertyValue("CharColorLumMod").get<sal_Int32>());
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 426197102160..35f19c42ed30 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -495,6 +495,23 @@ sal_Int16 Color::getTintOrShade()
}
return 0;
}
+
+sal_Int16 Color::getLumMod()
+{
+ for (const auto& rTransform : maTransforms)
+ {
+ if (rTransform.mnToken != XML_lumMod)
+ {
+ continue;
+ }
+
+ // From 1000th percent to 100th percent.
+ return rTransform.mnValue / 10;
+ }
+
+ return 10000;
+}
+
::Color Color::getColor( const GraphicHelper& rGraphicHelper, ::Color nPhClr ) const
{
const sal_Int32 nTempC1 = mnC1;
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index 93d642324782..e25c07a2bd70 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -131,6 +131,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
// set color theme index
rPropMap.setProperty(PROP_CharColorTheme, aColor.getSchemeColorIndex());
rPropMap.setProperty(PROP_CharColorTintOrShade, aColor.getTintOrShade());
+ rPropMap.setProperty(PROP_CharColorLumMod, aColor.getLumMod());
if (aColor.hasTransparency())
{
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 951a03e7eba0..e85d2bae19e6 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -56,6 +56,7 @@ CharColor
CharContoured
CharColorTheme
CharColorTintOrShade
+CharColorLumMod
CharEscapement
CharEscapementHeight
CharFontCharSet