summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-05-25 20:06:36 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-07-04 08:07:15 +0200
commitcdb9706daccf3135e4789ecd93b57c9e32047315 (patch)
tree273cb9d70034673b24d6cdd400260e6c7b1bf032
parent3776c15fdf63262721126539bdaa6fd5d4474b1c (diff)
sd theme: add UI (sidebar) for shape fill color effects
Which was perhaps the last missing piece of the "sd theme: shape fill color" story. (cherry picked from commit 645413a14a91a72bc06acf0fb4703ff7b9fffec9) Change-Id: Ice75d91412aa56afe0c9995086097d491ebf7299 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136748 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sd/qa/unit/uiimpress.cxx16
-rw-r--r--sd/source/ui/view/drviews2.cxx10
-rw-r--r--svx/sdi/svx.sdi2
3 files changed, 26 insertions, 2 deletions
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index fd4756388463..283753f339c8 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -925,10 +925,12 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testFillColorTheme)
uno::UNO_QUERY);
xController->select(uno::makeAny(xShape));
- // When setting the fill color of that shape, with theme metadata:
+ // When setting the fill color of that shape, with theme metadata & effects:
uno::Sequence<beans::PropertyValue> aColorArgs = {
comphelper::makePropertyValue("FillColor", static_cast<sal_Int32>(0xed7d31)), // orange
comphelper::makePropertyValue("ColorThemeIndex", static_cast<sal_Int16>(4)), // accent 1
+ comphelper::makePropertyValue("ColorLumMod", static_cast<sal_Int16>(4000)),
+ comphelper::makePropertyValue("ColorLumOff", static_cast<sal_Int16>(6000)),
};
dispatchCommand(mxComponent, ".uno:FillColor", aColorArgs);
Scheduler::ProcessEventsToIdle();
@@ -941,6 +943,18 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testFillColorTheme)
// - Actual : -1
// i.e. the theme index was lost during the dispatch of the command.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4), nFillColorTheme);
+
+ // Then also verify the effects:
+ sal_Int16 nFillColorLumMod = 10000;
+ xShape->getPropertyValue("FillColorLumMod") >>= nFillColorLumMod;
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 4000
+ // - Actual : 10000
+ // i.e. the theme index was set, but not the effects.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4000), nFillColorLumMod);
+ sal_Int16 nFillColorLumOff = 0;
+ xShape->getPropertyValue("FillColorLumOff") >>= nFillColorLumOff;
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(6000), nFillColorLumOff);
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index b7f0638adb15..9918368dda65 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -604,6 +604,16 @@ public:
auto pIntItem = static_cast<const SfxInt16Item*>(pItem);
aColorItem.GetThemeColor().SetThemeIndex(pIntItem->GetValue());
}
+ if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_MOD, false, &pItem) == SfxItemState::SET)
+ {
+ auto pIntItem = static_cast<const SfxInt16Item*>(pItem);
+ aColorItem.GetThemeColor().SetLumMod(pIntItem->GetValue());
+ }
+ if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_OFF, false, &pItem) == SfxItemState::SET)
+ {
+ auto pIntItem = static_cast<const SfxInt16Item*>(pItem);
+ aColorItem.GetThemeColor().SetLumOff(pIntItem->GetValue());
+ }
pArgs->Put(aColorItem);
}
}
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 4a258d860439..f415e2522bd0 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -2746,7 +2746,7 @@ XFillBitmapItem FillPageBitmap SID_ATTR_PAGE_BITMAP
]
XFillColorItem FillColor SID_ATTR_FILL_COLOR
-(SfxStringItem Color SID_ATTR_COLOR_STR, XFillColorItem FillColor SID_ATTR_FILL_COLOR, SfxInt16Item ColorThemeIndex SID_ATTR_COLOR_THEME_INDEX)
+(SfxStringItem Color SID_ATTR_COLOR_STR, XFillColorItem FillColor SID_ATTR_FILL_COLOR, SfxInt16Item ColorThemeIndex SID_ATTR_COLOR_THEME_INDEX, SfxInt16Item ColorLumMod SID_ATTR_COLOR_LUM_MOD, SfxInt16Item ColorLumOff SID_ATTR_COLOR_LUM_OFF)
[
AutoUpdate = TRUE,
FastCall = FALSE,