diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-11-19 11:11:49 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-02-21 15:57:49 +0100 |
commit | 8964b7f1fe416a0d4eca92f45cd084b77d39e83d (patch) | |
tree | a8538aba9ee2a015fc870097f115e2345a9ca1b1 | |
parent | 2ed7751d0f6793aa11a6c1be4c18b92af8d696bd (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.
Change-Id: I5138a6b73526f20a40f93df4cff4951e2b11bd6d
Reviewed-on: https://gerrit.libreoffice.org/83179
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
(cherry picked from commit 6fafae4d109f5768621a11deb394b1b0c4dc5606)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89178
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
-rw-r--r-- | editeng/source/items/textitem.cxx | 6 | ||||
-rw-r--r-- | include/editeng/unoprnms.hxx | 1 | ||||
-rw-r--r-- | include/editeng/unotext.hxx | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/style/CharacterProperties.idl | 8 |
4 files changed, 14 insertions, 2 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index d3e7be9cb737..caad0f9f0a47 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1709,7 +1709,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: @@ -1732,7 +1733,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 67ccc1975329..502d379c51ec 100644 --- a/include/editeng/unoprnms.hxx +++ b/include/editeng/unoprnms.hxx @@ -319,6 +319,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 0b4a2bf445f9..af3e2be84f1e 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 010dab9acb53..f213bf0c4f12 100644 --- a/offapi/com/sun/star/style/CharacterProperties.idl +++ b/offapi/com/sun/star/style/CharacterProperties.idl @@ -460,6 +460,14 @@ published service CharacterProperties */ [optional, property] short RubyPosition; + /** 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; + }; }; }; }; }; |