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-20 07:13:24 +0000
commit8749a56d868f66fac2628720d7b40eeedddadc54 (patch)
treeff1368207a0fb26717d6b5ebc138d17966323122 /editeng
parent8402470ae0eb3a2040dab4121b9b0032618b7010 (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/+/145845 Tested-by: Tomaž Vajngerl <quikee@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 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;
}
}