From be03be7acd1a6bebb72f08f55cc20aba6d44f391 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 19 Nov 2019 11:11:49 +0100 Subject: editeng: add UNO API for semi-transparent text Keep the type internally as sal_uInt8, to be used as an alpha channel. Keep the type externally as sal_Int16, so it's consistent with the fill area transparency. Change-Id: I5138a6b73526f20a40f93df4cff4951e2b11bd6d Reviewed-on: https://gerrit.libreoffice.org/83179 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 6fafae4d109f5768621a11deb394b1b0c4dc5606) --- editeng/source/items/textitem.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'editeng') diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 313997fa246c..53c1baaa7223 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1449,7 +1449,8 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { case MID_COLOR_ALPHA: { - rVal <<= mColor.GetTransparency(); + auto fTransparency = static_cast(mColor.GetTransparency()) * 100 / 255; + rVal <<= static_cast(basegfx::fround(fTransparency)); break; } default: @@ -1472,7 +1473,8 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) bool bRet = rVal >>= nTransparency; if (bRet) { - mColor.SetTransparency(nTransparency); + auto fTransparency = static_cast(nTransparency) * 255 / 100; + mColor.SetTransparency(static_cast(basegfx::fround(fTransparency))); } return bRet; } -- cgit