diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-09-20 19:20:59 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-11-16 14:19:40 +0100 |
commit | 5006dfcbc370e80bd159a9e957254b0ce09a6cdd (patch) | |
tree | cf00f2f3b8eed3eb7bdba5ce9e00aee9949c3929 /editeng | |
parent | e73e45e0ff14f4b0fe443d95937cc5f5a166feb4 (diff) |
Theme color and tint/shade attribute for SvxColorItem
To support theme colors the SvxColorItem must be extended with
an optional attribute theme index to define the index to which
theme color current color belongs and an optional tint/shade
attribute define how much the color ha been additionally tinted
or shaded.
[ Miklos: left out the potentially breaking svx/sdi/svxitems.sdi
changes. ]
(cherry picked from commit ccdbf815e00dbe2ba21f7e86b6743df100b7401f,
from the feature/themesupport2 branch)
Change-Id: Ifb0481770be675181dafa94cd2778f374fcf3c7e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125296
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/items/textitem.cxx | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 75470ff20e4a..8ecfa67584aa 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1354,14 +1354,18 @@ bool SvxContourItem::GetPresentation // class SvxColorItem ---------------------------------------------------- SvxColorItem::SvxColorItem( const sal_uInt16 nId ) : - SfxPoolItem( nId ), - mColor( COL_BLACK ) + SfxPoolItem(nId), + mColor( COL_BLACK ), + maThemeIndex(-1), + maTintShade(0) { } SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) : SfxPoolItem( nId ), - mColor( rCol ) + mColor( rCol ), + maThemeIndex(-1), + maTintShade(0) { } @@ -1372,8 +1376,11 @@ SvxColorItem::~SvxColorItem() bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); + const SvxColorItem& rColorItem = static_cast<const SvxColorItem&>(rAttr); - return mColor == static_cast<const SvxColorItem&>( rAttr ).mColor; + return mColor == rColorItem.mColor && + maThemeIndex == rColorItem.maThemeIndex && + maTintShade == rColorItem.maTintShade; } bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const @@ -1392,6 +1399,16 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const rVal <<= mColor.GetAlpha() == 0; break; } + case MID_COLOR_THEME_INDEX: + { + rVal <<= maThemeIndex; + break; + } + case MID_COLOR_TINT_OR_SHADE: + { + rVal <<= maTintShade; + break; + } default: { rVal <<= mColor; @@ -1422,11 +1439,29 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) mColor.SetAlpha( Any2Bool( rVal ) ? 0 : 255 ); return true; } + case MID_COLOR_THEME_INDEX: + { + sal_Int16 nIndex = -1; + if (!(rVal >>= nIndex)) + return false; + maThemeIndex = nIndex; + } + break; + case MID_COLOR_TINT_OR_SHADE: + { + sal_Int16 nTintShade = -1; + if (!(rVal >>= nTintShade)) + return false; + maTintShade = nTintShade; + } + break; default: { return rVal >>= mColor; } + break; } + return true; } SvxColorItem* SvxColorItem::Clone( SfxItemPool * ) const |