summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-11-19 11:11:49 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-11-22 17:59:18 +0100
commit0bff67bc9bcd7b91aca408dafa5581534ff0aafb (patch)
treedac4495cb34eb85ecb36d914af4e0b3ca1ff1eca
parent05244cbd7f22ae5cec2cfa82b0ffbc01411f3793 (diff)
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. (cherry picked from commit 6fafae4d109f5768621a11deb394b1b0c4dc5606) Conflicts: offapi/com/sun/star/style/CharacterProperties.idl Change-Id: I5138a6b73526f20a40f93df4cff4951e2b11bd6d
-rw-r--r--editeng/source/items/textitem.cxx6
-rw-r--r--include/editeng/unoprnms.hxx1
-rw-r--r--include/editeng/unotext.hxx1
-rw-r--r--offapi/com/sun/star/style/CharacterProperties.idl8
4 files changed, 14 insertions, 2 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 5fe860039ead..fc2cc3dac294 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1868,7 +1868,8 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
{
case MID_COLOR_ALPHA:
{
- rVal <<= mColor.GetTransparency();
+ auto fTransparency = static_cast<double>(mColor.GetTransparency()) * 100 / 255;
+ rVal <<= static_cast<sal_Int16>(basegfx::fround(fTransparency));
break;
}
default:
@@ -1891,7 +1892,8 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
bool bRet = rVal >>= nTransparency;
if (bRet)
{
- mColor.SetTransparency(nTransparency);
+ auto fTransparency = static_cast<double>(nTransparency) * 255 / 100;
+ mColor.SetTransparency(static_cast<sal_uInt8>(basegfx::fround(fTransparency)));
}
return bRet;
}
diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index ddd2a04593a8..896a121d69f1 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -310,6 +310,7 @@
#define UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX "CharLocaleComplex"
#define UNO_NAME_EDIT_CHAR_COLOR "CharColor"
+#define UNO_NAME_EDIT_CHAR_TRANSPARENCE "CharTransparence"
#define UNO_NAME_EDIT_CHAR_CROSSEDOUT "CharCrossedOut"
#define UNO_NAME_EDIT_CHAR_STRIKEOUT "CharStrikeout"
#define UNO_NAME_EDIT_CHAR_CASEMAP "CharCaseMap"
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
index 70be94f6965d..584a09c0b337 100644
--- a/include/editeng/unotext.hxx
+++ b/include/editeng/unotext.hxx
@@ -91,6 +91,7 @@ class SvxItemPropertySet;
{ OUString(UNO_NAME_EDIT_CHAR_WEIGHT), EE_CHAR_WEIGHT, cppu::UnoType<float>::get(), 0, MID_WEIGHT }, \
{ OUString(UNO_NAME_EDIT_CHAR_LOCALE), EE_CHAR_LANGUAGE, ::cppu::UnoType<css::lang::Locale>::get(),0, MID_LANG_LOCALE }, \
{ OUString(UNO_NAME_EDIT_CHAR_COLOR), EE_CHAR_COLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, \
+ { OUString(UNO_NAME_EDIT_CHAR_TRANSPARENCE),EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_ALPHA }, \
{ OUString("CharBackColor"), EE_CHAR_BKGCOLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, \
{ OUString("CharBackTransparent"), EE_CHAR_BKGCOLOR, ::cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT }, \
{ OUString(UNO_NAME_EDIT_CHAR_ESCAPEMENT), EE_CHAR_ESCAPEMENT, ::cppu::UnoType<sal_Int16>::get(), 0, MID_ESC }, \
diff --git a/offapi/com/sun/star/style/CharacterProperties.idl b/offapi/com/sun/star/style/CharacterProperties.idl
index 5d56f0febb7b..90901f757aa4 100644
--- a/offapi/com/sun/star/style/CharacterProperties.idl
+++ b/offapi/com/sun/star/style/CharacterProperties.idl
@@ -452,6 +452,14 @@ published service CharacterProperties
*/
[optional, property] sequence<com::sun::star::beans::PropertyValue> CharInteropGrabBag;
+ /** This is the transparency of the character text.
+
+ @since LibreOffice 6.5
+
+ <p>The value 100 means entirely transparent, while 0 means not transparent at all.</p>
+ */
+ [optional, property] short CharTransparence;
+
};
}; }; }; };