diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-01-01 23:25:38 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-01-13 00:49:24 +0000 |
commit | 197e5f81213d14fdcbff40edf73385ecd4cd9815 (patch) | |
tree | 5bc1735ec61200a895b5edcf684d846245286ba5 /editeng | |
parent | c82fa434dab8744c548db166cd24ee82e8759e1f (diff) |
introduce {Char,Fill}ColorThemeReference which uses XThemeColor
Adds a unified UNO property for theme colors *ColorTheme
(CharColorTheme and FillColorTheme) which uses XThemeColor, that
replaces the properties *Theme, *TintOrShade, *LumOff, *LumMod.
The properties are still present for backwards compatibility and
to keep ODF support working in tests as that needs a bigger change.
Reactor the code and tests to accomodate for this change.
Change-Id: If7983decb4ba528b49fe7b5968aa9efc696a9efc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144783
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/items/textitem.cxx | 19 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 6 |
2 files changed, 25 insertions, 0 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index bf6017cdcf6d..5a53d6a8e14c 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -77,6 +77,7 @@ #include <editeng/charreliefitem.hxx> #include <editeng/itemtype.hxx> #include <editeng/eerdll.hxx> +#include <docmodel/uno/UnoThemeColor.hxx> #include <libxml/xmlwriter.h> using namespace ::com::sun::star; @@ -1435,6 +1436,12 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const rVal <<= nValue; break; } + case MID_COLOR_THEME_REFERENCE: + { + auto xThemeColor = model::theme::createXThemeColor(maThemeColor); + rVal <<= xThemeColor; + break; + } default: { rVal <<= mColor; @@ -1509,6 +1516,18 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) maThemeColor.addTransformation({model::TransformationType::LumOff, nLumOff}); } break; + case MID_COLOR_THEME_REFERENCE: + { + css::uno::Reference<css::util::XThemeColor> xThemeColor; + if (!(rVal >>= xThemeColor)) + return false; + + if (xThemeColor.is()) + { + model::theme::setFromXThemeColor(maThemeColor, xThemeColor); + } + } + break; default: { return rVal >>= mColor; diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index e5877a7d2e5a..82a399f00e26 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -1175,6 +1175,12 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const Sf } break; } + case MID_COLOR_THEME_REFERENCE: + if (pColor->GetThemeColor().getType() == model::ThemeColorType::Unknown) + { + eItemState = SfxItemState::DEFAULT; + } + break; } } |