summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-01-06 00:08:17 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-01-13 14:37:44 +0000
commit79ad3e73907d15c4e234e2a32de8173273f5ac16 (patch)
tree6ed5b490e987826ced4febe96416e34865c47daa /oox
parentfed429e4f6f437997aa6a88e2d071f58aa00ee34 (diff)
oox: also allow tint and shade for fill color
This was an obsolete limitation that is not needed anymore. Change-Id: Ie9610516996fc16197f8611843ff621b8a83ebdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145084 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/qa/unit/drawingml.cxx21
-rw-r--r--oox/source/drawingml/fillproperties.cxx2
2 files changed, 13 insertions, 10 deletions
diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx
index 2faf2b28e909..f47853e3b5f7 100644
--- a/oox/qa/unit/drawingml.cxx
+++ b/oox/qa/unit/drawingml.cxx
@@ -444,8 +444,6 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint)
// Given a document with a table style, using theme color with tinting in the A2 cell:
loadFromURL(u"theme-tint.pptx");
- // Then make sure that we only import theming info to the doc model if the effects are limited
- // to lum mod / off that we can handle (i.e. no tint/shade):
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
uno::UNO_QUERY);
@@ -453,6 +451,7 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint)
uno::Reference<table::XCellRange> xTable;
CPPUNIT_ASSERT(xShape->getPropertyValue("Model") >>= xTable);
uno::Reference<beans::XPropertySet> xA1(xTable->getCellByPosition(0, 0), uno::UNO_QUERY);
+
// check theme color
{
uno::Reference<util::XThemeColor> xThemeColor;
@@ -460,8 +459,11 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint)
CPPUNIT_ASSERT(xThemeColor.is());
model::ThemeColor aThemeColor;
model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
- // This is OK, no problematic effects:
CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, aThemeColor.getType());
+ {
+ auto const& rTrans = aThemeColor.getTransformations();
+ CPPUNIT_ASSERT_EQUAL(size_t(0), rTrans.size());
+ }
}
{
@@ -471,12 +473,13 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint)
CPPUNIT_ASSERT(xThemeColor.is());
model::ThemeColor aThemeColor;
model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
- // Without the accompanying fix in place, this test would have failed with:
- // - Expected: -1
- // - Actual : 4
- // i.e. we remembered the theme index, without being able to remember the tint effect, leading
- // to a bad background color.
- CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Unknown, aThemeColor.getType());
+ CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, aThemeColor.getType());
+ {
+ auto const& rTrans = aThemeColor.getTransformations();
+ CPPUNIT_ASSERT_EQUAL(size_t(1), rTrans.size());
+ CPPUNIT_ASSERT_EQUAL(model::TransformationType::Tint, rTrans[0].meType);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), rTrans[0].mnValue);
+ }
}
}
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 99fbfa41e990..d193653d7189 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -455,7 +455,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
aThemeColor.setType(model::convertToThemeColorType(nPhClrTheme));
rPropMap.setProperty(PROP_FillColorThemeReference, model::theme::createXThemeColor(aThemeColor));
}
- else if (maFillColor.getTintOrShade() == 0)
+ else
{
aThemeColor.setType(model::convertToThemeColorType(maFillColor.getSchemeColorIndex()));
if (maFillColor.getLumMod() != 10000)