summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-11-24 08:22:47 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-11-24 09:33:30 +0100
commita557a1c4ac0b73668452f80169870bdfb204aeb6 (patch)
tree5e7b2b4aa3a9d531b6bbbdff17643878f37f6707 /oox
parentecfce0ff23d9f1ed5a51b29b14a7043dce87b300 (diff)
PPTX import: implement native handling of a color's luminance offset
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, and also the last transform which is easy to generate from the PowerPoint UI and we didn't import to the doc model. Change-Id: Ica4e738d8dc8e0409160ceab941a82f2475ddc68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125749 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'oox')
-rw-r--r--oox/qa/unit/drawingml.cxx8
-rw-r--r--oox/source/drawingml/color.cxx16
-rw-r--r--oox/source/drawingml/textcharacterproperties.cxx1
-rw-r--r--oox/source/token/properties.txt1
4 files changed, 26 insertions, 0 deletions
diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx
index f7b6e9b237a3..0d6f367f02c7 100644
--- a/oox/qa/unit/drawingml.cxx
+++ b/oox/qa/unit/drawingml.cxx
@@ -444,6 +444,14 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testPptxTheme)
// 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>());
+
+ // 40000 in the file, just 100th vs 1000th percents.
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 4000
+ // - Actual : 0
+ // i.e. we had the default 0% value, not the value from the file.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4000),
+ xPortion->getPropertyValue("CharColorLumOff").get<sal_Int32>());
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 35f19c42ed30..ee854a761fa2 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -512,6 +512,22 @@ sal_Int16 Color::getLumMod()
return 10000;
}
+sal_Int16 Color::getLumOff()
+{
+ for (const auto& rTransform : maTransforms)
+ {
+ if (rTransform.mnToken != XML_lumOff)
+ {
+ continue;
+ }
+
+ // From 1000th percent to 100th percent.
+ return rTransform.mnValue / 10;
+ }
+
+ return 0;
+}
+
::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 e25c07a2bd70..7ffeaeba8da2 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -132,6 +132,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
rPropMap.setProperty(PROP_CharColorTheme, aColor.getSchemeColorIndex());
rPropMap.setProperty(PROP_CharColorTintOrShade, aColor.getTintOrShade());
rPropMap.setProperty(PROP_CharColorLumMod, aColor.getLumMod());
+ rPropMap.setProperty(PROP_CharColorLumOff, aColor.getLumOff());
if (aColor.hasTransparency())
{
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index e85d2bae19e6..5d261469ca42 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -57,6 +57,7 @@ CharContoured
CharColorTheme
CharColorTintOrShade
CharColorLumMod
+CharColorLumOff
CharEscapement
CharEscapementHeight
CharFontCharSet