diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-04-12 20:22:22 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-04-13 08:05:09 +0200 |
commit | c7970e3204f7e2d958d213c42a9f0db232578a62 (patch) | |
tree | 6770ea237710deda8b9b51ad1f672432d071ae3c /svx | |
parent | a98971ac975e19efa2336b608506eefa85ce2485 (diff) |
sd theme: add UNO API for shape fill color effects
XColorItem::maThemeColor already provided the document model for this.
Change-Id: Iefbd0aeaa37a813bb4c86386801e0116e8fae40d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132933
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/qa/unit/xoutdev.cxx | 14 | ||||
-rw-r--r-- | svx/source/xoutdev/xattr.cxx | 26 |
2 files changed, 40 insertions, 0 deletions
diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx index ed5b75189c3a..78af484555de 100644 --- a/svx/qa/unit/xoutdev.cxx +++ b/svx/qa/unit/xoutdev.cxx @@ -129,6 +129,12 @@ CPPUNIT_TEST_FIXTURE(XOutdevTest, testFillColorThemeUnoApi) sal_Int16 nExpected = 4; // Accent 1 xShape->setPropertyValue("FillColorTheme", uno::makeAny(nExpected)); + // 80% lighter + sal_Int16 nExpectedLumMod = 2000; + xShape->setPropertyValue("FillColorLumMod", uno::makeAny(nExpectedLumMod)); + sal_Int16 nExpectedLumOff = 8000; + xShape->setPropertyValue("FillColorLumOff", uno::makeAny(nExpectedLumOff)); + // Then make sure the value we read back is the expected one: sal_Int16 nActual = -1; xShape->getPropertyValue("FillColorTheme") >>= nActual; @@ -137,6 +143,14 @@ CPPUNIT_TEST_FIXTURE(XOutdevTest, testFillColorThemeUnoApi) // - Actual : -1 // i.e. setting the value was broken. CPPUNIT_ASSERT_EQUAL(nExpected, nActual); + xShape->getPropertyValue("FillColorLumMod") >>= nActual; + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 2000 + // - Actual : 8000 + // i.e. FillColorLumOff was set as FillColor, then getting FillColorLumMod returned FillColor. + CPPUNIT_ASSERT_EQUAL(nExpectedLumMod, nActual); + xShape->getPropertyValue("FillColorLumOff") >>= nActual; + CPPUNIT_ASSERT_EQUAL(nExpectedLumOff, nActual); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index d94d51a398a8..aceba42bbb61 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -1911,6 +1911,16 @@ bool XFillColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) cons rVal <<= GetThemeColor().GetThemeIndex(); break; } + case MID_COLOR_LUM_MOD: + { + rVal <<= GetThemeColor().GetLumMod(); + break; + } + case MID_COLOR_LUM_OFF: + { + rVal <<= GetThemeColor().GetLumOff(); + break; + } default: { rVal <<= GetColorValue().GetRGBColor(); @@ -1934,6 +1944,22 @@ bool XFillColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) GetThemeColor().SetThemeIndex(nIndex); break; } + case MID_COLOR_LUM_MOD: + { + sal_Int16 nLumMod = -1; + if (!(rVal >>= nLumMod)) + return false; + GetThemeColor().SetLumMod(nLumMod); + } + break; + case MID_COLOR_LUM_OFF: + { + sal_Int16 nLumOff = -1; + if (!(rVal >>= nLumOff)) + return false; + GetThemeColor().SetLumOff(nLumOff); + } + break; default: { Color nValue; |