include/svx/svxids.hrc | 6 ++-- sd/qa/unit/uiimpress.cxx | 54 ++++++++++++++++++++++++++++------------- sd/source/ui/view/drtxtob1.cxx | 24 ------------------ sd/source/ui/view/drviews2.cxx | 29 ---------------------- svx/sdi/svx.sdi | 4 +-- 5 files changed, 42 insertions(+), 75 deletions(-)
New commits: commit 43fe1db03512bccd0c36b7037172378c8965fda0 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Aug 18 22:31:51 2023 +0200 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Aug 28 18:09:50 2023 +0200 svx: remove theme related parameters for Color and FillColor For SvxColorItem, XFillColorItem, XLineColorItem,... we set the ComplexColor via the JSON additional UNO Command argument, so we don't need the parameters to set the theme color and LumOff and LumMod color modifiers for the UNO Command. Actually this has broken the setting the colors in certain situations, so we must remove this. Change-Id: Ic28aa1e43559d3627703d93c7c1bd9310a149986 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155864 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit 6471181b66ebe634e9ffbdc2b55dbf1da17a3acf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156172 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Ashod Nakashian <a...@collabora.com> diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index 90aae09d2c69..2f18af269fd1 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -450,9 +450,9 @@ class XFillGradientItem; #define SID_ATTR_TEXTCOLUMNS_SPACING ( SID_SVX_START + 341 ) // FREE ( SID_SVX_START + 342 ) -#define SID_ATTR_COLOR_THEME_INDEX TypedWhichId<SfxInt16Item>( SID_SVX_START + 343 ) -#define SID_ATTR_COLOR_LUM_MOD TypedWhichId<SfxInt16Item>( SID_SVX_START + 344 ) -#define SID_ATTR_COLOR_LUM_OFF TypedWhichId<SfxInt16Item>( SID_SVX_START + 345 ) +// FREE ( SID_SVX_START + 343 ) +// FREE ( SID_SVX_START + 344 ) +// FREE ( SID_SVX_START + 345 ) #define SID_SB_CONNECTIONPOOLING ( SID_SVX_START + 348 ) #define SID_SB_DBREGISTEROPTIONS ( SID_SVX_START + 349 ) diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index fc75ec4727eb..7baaf08490e7 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -47,6 +47,7 @@ #include <comphelper/sequenceashashmap.hxx> #include <docmodel/uno/UnoTheme.hxx> #include <docmodel/theme/Theme.hxx> +#include <docmodel/color/ComplexColorJSON.hxx> #include <drawdoc.hxx> #include <DrawDocShell.hxx> @@ -1012,14 +1013,23 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testCharColorTheme) Scheduler::ProcessEventsToIdle(); // When picking a theme color on the sidebar: - uno::Sequence<beans::PropertyValue> aColorArgs = { - comphelper::makePropertyValue("Color", static_cast<sal_Int32>(0xdae3f3)), // 80% light blue - comphelper::makePropertyValue("ColorThemeIndex", static_cast<sal_Int16>(4)), // accent 1 - comphelper::makePropertyValue("ColorLumMod", static_cast<sal_Int16>(2000)), - comphelper::makePropertyValue("ColorLumOff", static_cast<sal_Int16>(8000)), - }; - dispatchCommand(mxComponent, ".uno:Color", aColorArgs); - Scheduler::ProcessEventsToIdle(); + { + model::ComplexColor aComplexColor; + aComplexColor.setThemeColor(model::ThemeColorType::Accent1); + aComplexColor.addTransformation({ model::TransformationType::LumMod, 2000 }); + aComplexColor.addTransformation({ model::TransformationType::LumOff, 8000 }); + + OUString aJSON + = OStringToOUString(model::color::convertToJSON(aComplexColor), RTL_TEXTENCODING_UTF8); + + // When setting the fill color of that shape, with theme metadata & effects: + uno::Sequence<beans::PropertyValue> aColorArgs = { + comphelper::makePropertyValue("Color.Color", sal_Int32(0xdae3f3)), // 80% light blue + comphelper::makePropertyValue("Color.ComplexColorJSON", uno::Any(aJSON)), + }; + dispatchCommand(mxComponent, ".uno:Color", aColorArgs); + Scheduler::ProcessEventsToIdle(); + } // Then make sure the theme "metadata" is set in the document model: pView->EndTextEditCurrentView(); @@ -1057,15 +1067,25 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testFillColorTheme) uno::UNO_QUERY); xController->select(uno::Any(xShape)); - // 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(); + // Change fill color + { + model::ComplexColor aComplexColor; + aComplexColor.setThemeColor(model::ThemeColorType::Accent1); + aComplexColor.addTransformation({ model::TransformationType::LumMod, 4000 }); + aComplexColor.addTransformation({ model::TransformationType::LumOff, 6000 }); + + OUString aJSON + = OStringToOUString(model::color::convertToJSON(aComplexColor), RTL_TEXTENCODING_UTF8); + + // When setting the fill color of that shape, with theme metadata & effects: + uno::Sequence<beans::PropertyValue> aColorArgs = { + comphelper::makePropertyValue("FillColor.Color", sal_Int32(0xed7d31)), // orange + comphelper::makePropertyValue("FillColor.ComplexColorJSON", + uno::Any(aJSON)), // accent 1 + }; + dispatchCommand(mxComponent, ".uno:FillColor", aColorArgs); + Scheduler::ProcessEventsToIdle(); + } // Then make sure the theme index is not lost when the sidebar sets it: { diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index bd250f3f5841..d0a6e7c938e5 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -812,30 +812,6 @@ void TextObjectBar::Execute( SfxRequest &rReq ) std::unique_ptr<SfxItemSet> pNewArgs = pArgs->Clone(); lcl_convertStringArguments(nSlot, pNewArgs); - - // Merge the color parameters to the color itself. - std::unique_ptr<SvxColorItem> pColorItem; - if (nSlot == SID_ATTR_CHAR_COLOR) - { - pColorItem = std::make_unique<SvxColorItem>(pNewArgs->Get(EE_CHAR_COLOR)); - model::ComplexColor aComplexColor; - - if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_THEME_INDEX, false)) - { - aComplexColor.setThemeColor(model::convertToThemeColorType(pIntItem->GetValue())); - } - if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_LUM_MOD, false)) - { - aComplexColor.addTransformation({model::TransformationType::LumMod, pIntItem->GetValue()}); - } - if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_LUM_OFF, false)) - { - aComplexColor.addTransformation({model::TransformationType::LumOff, pIntItem->GetValue()}); - } - pColorItem->setComplexColor(aComplexColor); - pNewArgs->Put(std::move(pColorItem)); - } - mpView->SetAttributes(*pNewArgs); // invalidate entire shell because of performance and diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 0f5b6b9256c5..e31294d536f0 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -600,35 +600,6 @@ public: pArgs->Put(aItem); } } - - if (nSlot == SID_ATTR_FILL_COLOR) - { - // Merge the color parameters to the color itself. - const XFillColorItem* pColorItem = static_cast<const XFillColorItem*>(pArgs->GetItem(SID_ATTR_FILL_COLOR)); - if (pColorItem) - { - XFillColorItem aColorItem(*pColorItem); - model::ComplexColor aComplexColor = aColorItem.getComplexColor(); - - if (pArgs->GetItemState(SID_ATTR_COLOR_THEME_INDEX, false, &pItem) == SfxItemState::SET) - { - auto pIntItem = static_cast<const SfxInt16Item*>(pItem); - aComplexColor.setThemeColor(model::convertToThemeColorType(pIntItem->GetValue())); - } - if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_MOD, false, &pItem) == SfxItemState::SET) - { - auto pIntItem = static_cast<const SfxInt16Item*>(pItem); - aComplexColor.addTransformation({model::TransformationType::LumMod, pIntItem->GetValue()}); - } - if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_OFF, false, &pItem) == SfxItemState::SET) - { - auto pIntItem = static_cast<const SfxInt16Item*>(pItem); - aComplexColor.addTransformation({model::TransformationType::LumOff, pIntItem->GetValue()}); - } - aColorItem.setComplexColor(aComplexColor); - pArgs->Put(aColorItem); - } - } } } diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 0b8ad75c00c5..2614660495e7 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -1506,7 +1506,7 @@ SfxVoidItem ClearOutline SID_OUTLINE_DELETEALL SvxColorItem Color SID_ATTR_CHAR_COLOR -(SfxStringItem Color SID_ATTR_COLOR_STR, SvxColorItem Color SID_ATTR_CHAR_COLOR, SfxInt16Item ColorThemeIndex SID_ATTR_COLOR_THEME_INDEX, SfxInt16Item ColorLumMod SID_ATTR_COLOR_LUM_MOD, SfxInt16Item ColorLumOff SID_ATTR_COLOR_LUM_OFF) +(SfxStringItem Color SID_ATTR_COLOR_STR, SvxColorItem Color SID_ATTR_CHAR_COLOR) [ AutoUpdate = TRUE, FastCall = FALSE, @@ -2798,7 +2798,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, SfxInt16Item ColorLumMod SID_ATTR_COLOR_LUM_MOD, SfxInt16Item ColorLumOff SID_ATTR_COLOR_LUM_OFF) +(SfxStringItem Color SID_ATTR_COLOR_STR, XFillColorItem FillColor SID_ATTR_FILL_COLOR) [ AutoUpdate = TRUE, FastCall = FALSE,