summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-01-01 23:25:38 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-01-17 00:19:53 +0000
commit4e8869bc504805c033df9266583ab88491dc41cb (patch)
tree67bf21a58ddf25054afeafb1d077863a12b49d16 /editeng
parent0a6a0d78c881c967d52d8fd976eef3c2c79cf609 (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> (cherry picked from commit 197e5f81213d14fdcbff40edf73385ecd4cd9815) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145553 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/items/textitem.cxx19
-rw-r--r--editeng/source/uno/unotext.cxx6
2 files changed, 25 insertions, 0 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 07c131e98307..0d1508788936 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -76,6 +76,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;
@@ -1434,6 +1435,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;
@@ -1508,6 +1515,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 f3be510b610d..d18f102303db 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1174,6 +1174,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;
}
}