diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-11-18 18:40:13 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-05-08 09:35:17 +0200 |
commit | 570e650093928a795704777667e927bb12d4a567 (patch) | |
tree | e3f63fdb1193cdf864bc74a438e0235a8383400b /editeng | |
parent | fa77419c66544e050a612baf027a9f927c4fe0a4 (diff) |
editeng: add doc model for semi-transparent text
tools Color can handle the alpha just fine, but add a separate member ID
for transparency to be consistent with the existing border and fill
color API.
Change-Id: I8466da9fb40ab1d0c97b06a0594f89719ccc1959
Reviewed-on: https://gerrit.libreoffice.org/83116
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
(cherry picked from commit 543a0658f961f24db6804b90c5389aee15ba2ce4)
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/items/textitem.cxx | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index afd053da51e7..313997fa246c 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1442,15 +1442,45 @@ bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const return mColor == static_cast<const SvxColorItem&>( rAttr ).mColor; } -bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const +bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { - rVal <<= mColor; + nMemberId &= ~CONVERT_TWIPS; + switch (nMemberId) + { + case MID_COLOR_ALPHA: + { + rVal <<= mColor.GetTransparency(); + break; + } + default: + { + rVal <<= mColor; + break; + } + } return true; } -bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) +bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { - return (rVal >>= mColor); + nMemberId &= ~CONVERT_TWIPS; + switch(nMemberId) + { + case MID_COLOR_ALPHA: + { + sal_Int16 nTransparency = 0; + bool bRet = rVal >>= nTransparency; + if (bRet) + { + mColor.SetTransparency(nTransparency); + } + return bRet; + } + default: + { + return rVal >>= mColor; + } + } } SfxPoolItem* SvxColorItem::Clone( SfxItemPool * ) const |