diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-05-11 17:51:49 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-05-17 11:14:57 +0200 |
commit | c25f8f0468a830cfd855389261a7b7250ef712b1 (patch) | |
tree | e47f75eaaf59a8c3502ac954c5da988912e8536b /editeng | |
parent | a13264fc7578cbd3267065f4992ded9f7558ec7a (diff) |
sc: change (char, background) style colors when changing the theme
This adds a Calc specific ThemeColorChanger, which changes the
character and background colors in styles. In addition add the
changes that make this possible - support in SvxBrushItem for
the ComplexColor, making sure that ComplexColor is properly passed
to other items (mainly from color picker),...
Change-Id: Id2e98c42bbe195a0f75cc8951ff69f6d7eea6be0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151667
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/items/frmitems.cxx | 36 | ||||
-rw-r--r-- | editeng/source/items/textitem.cxx | 5 |
2 files changed, 36 insertions, 5 deletions
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index ad0977fab753..63cbc018c1ab 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/frame/status/LeftRightMarginScale.hpp> #include <com/sun/star/drawing/ShadingPattern.hpp> #include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/util/XComplexColor.hpp> #include <osl/diagnose.h> #include <i18nutil/unicode.hxx> @@ -75,6 +76,7 @@ #include <sal/log.hxx> #include <vcl/GraphicLoader.hxx> #include <unotools/securityoptions.hxx> +#include <docmodel/uno/UnoComplexColor.hxx> #include <boost/property_tree/ptree.hpp> @@ -3857,6 +3859,18 @@ SvxBrushItem::SvxBrushItem(const Color& rColor, sal_uInt16 _nWhich) { } +SvxBrushItem::SvxBrushItem(Color const& rColor, model::ComplexColor const& rComplexColor, sal_uInt16 nWhich) + : SfxPoolItem(nWhich) + , aColor(rColor) + , maComplexColor(rComplexColor) + , aFilterColor(COL_TRANSPARENT) + , nShadingValue(ShadingPattern::CLEAR) + , nGraphicTransparency(0) + , eGraphicPos(GPOS_NONE) + , bLoadAgain(true) +{ +} + SvxBrushItem::SvxBrushItem(const Graphic& rGraphic, SvxGraphicPosition ePos, sal_uInt16 _nWhich) : SfxPoolItem(_nWhich) , aColor(COL_TRANSPARENT) @@ -3901,6 +3915,7 @@ SvxBrushItem::SvxBrushItem(OUString aLink, OUString aFilter, SvxBrushItem::SvxBrushItem(const SvxBrushItem& rItem) : SfxPoolItem(rItem) , aColor(rItem.aColor) + , maComplexColor(rItem.maComplexColor) , aFilterColor(rItem.aFilterColor) , nShadingValue(rItem.nShadingValue) , xGraphicObject(rItem.xGraphicObject ? new GraphicObject(*rItem.xGraphicObject) : nullptr) @@ -3915,6 +3930,7 @@ SvxBrushItem::SvxBrushItem(const SvxBrushItem& rItem) SvxBrushItem::SvxBrushItem(SvxBrushItem&& rItem) : SfxPoolItem(std::move(rItem)) , aColor(std::move(rItem.aColor)) + , maComplexColor(std::move(rItem.maComplexColor)) , aFilterColor(std::move(rItem.aFilterColor)) , nShadingValue(std::move(rItem.nShadingValue)) , xGraphicObject(std::move(rItem.xGraphicObject)) @@ -3974,6 +3990,15 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const case MID_BACK_COLOR_TRANSPARENCY: rVal <<= SvxBrushItem::TransparencyToPercent(255 - aColor.GetAlpha()); break; + + case MID_BACKGROUND_COMPLEX_COLOR: + { + auto xComplexColor = model::color::createXComplexColor(maComplexColor); + rVal <<= xComplexColor; + break; + } + break; + case MID_GRAPHIC_POSITION: rVal <<= static_cast<style::GraphicLocation>(static_cast<sal_Int16>(eGraphicPos)); break; @@ -4047,6 +4072,17 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } break; + case MID_BACKGROUND_COMPLEX_COLOR: + { + css::uno::Reference<css::util::XComplexColor> xComplexColor; + if (!(rVal >>= xComplexColor)) + return false; + + if (xComplexColor.is()) + maComplexColor = model::color::getFromXComplexColor(xComplexColor); + } + break; + case MID_GRAPHIC_POSITION: { style::GraphicLocation eLocation; diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 1112bcf1a548..bc9b8e573027 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1616,11 +1616,6 @@ void SvxColorItem::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterEndElement(pWriter); } -void SvxColorItem::SetValue( const Color& rNewCol ) -{ - mColor = rNewCol; -} - // class SvxKerningItem -------------------------------------------------- SvxKerningItem::SvxKerningItem( const short nKern, const sal_uInt16 nId ) : |