[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - editeng/source include/editeng
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Fri Feb 21 14:58:02 UTC 2020
editeng/source/items/textitem.cxx | 38 ++++++++++++++++++++++++++++++++++----
include/editeng/memberids.h | 4 ++++
2 files changed, 38 insertions(+), 4 deletions(-)
New commits:
commit 2ed7751d0f6793aa11a6c1be4c18b92af8d696bd
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Nov 18 18:40:13 2019 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Feb 21 15:57:29 2020 +0100
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.
(cherry picked from commit 543a0658f961f24db6804b90c5389aee15ba2ce4)
Change-Id: I8466da9fb40ab1d0c97b06a0594f89719ccc1959
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89177
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index b3912754cbe4..d3e7be9cb737 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1702,15 +1702,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
diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h
index 6c1e2d303041..83945b508a85 100644
--- a/include/editeng/memberids.h
+++ b/include/editeng/memberids.h
@@ -177,6 +177,10 @@
// SvxShadowItem
#define MID_SHADOW_TRANSPARENCE 1
+// SvxColorItem
+#define MID_COLOR_RGB 0
+#define MID_COLOR_ALPHA 1
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list