oox/qa/unit/drawingml.cxx | 21 ++++++++++++--------- oox/source/drawingml/fillproperties.cxx | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-)
New commits: commit 79ad3e73907d15c4e234e2a32de8173273f5ac16 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Jan 6 00:08:17 2023 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Fri Jan 13 14:37:44 2023 +0000 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 <qui...@gmail.com> 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)