summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/styles/ColorSets.cxx62
-rw-r--r--svx/source/table/cell.cxx9
-rw-r--r--svx/source/unodraw/unoprov.cxx1
-rw-r--r--svx/source/unodraw/unoshap2.cxx1
-rw-r--r--svx/source/unodraw/unoshape.cxx9
-rw-r--r--svx/source/xoutdev/xattr.cxx15
6 files changed, 60 insertions, 37 deletions
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index 00ffdae3b031..b8a4fa08e157 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -26,6 +26,7 @@
#include <svx/svdpage.hxx>
#include <svx/svditer.hxx>
#include <editeng/unoprnms.hxx>
+#include <docmodel/uno/UnoThemeColor.hxx>
#include <o3tl/enumrange.hxx>
#include <utility>
@@ -37,57 +38,44 @@ namespace
void UpdateTextPortionColorSet(const uno::Reference<beans::XPropertySet>& xPortion,
const svx::ColorSet& rColorSet)
{
- sal_Int16 nCharColorTheme = -1;
- xPortion->getPropertyValue(UNO_NAME_EDIT_CHAR_COLOR_THEME) >>= nCharColorTheme;
- model::ThemeColorType eColorThemeType = model::convertToThemeColorType(nCharColorTheme);
+ if (!xPortion->getPropertySetInfo()->hasPropertyByName(UNO_NAME_EDIT_CHAR_COLOR_THEME_REFERENCE))
+ return;
- if (eColorThemeType == model::ThemeColorType::Unknown)
+ uno::Reference<util::XThemeColor> xThemeColor;
+ xPortion->getPropertyValue(UNO_NAME_EDIT_CHAR_COLOR_THEME_REFERENCE) >>= xThemeColor;
+ if (!xThemeColor.is())
return;
- Color aColor = rColorSet.getColor(eColorThemeType);
- sal_Int32 nCharColorLumMod{};
- xPortion->getPropertyValue(UNO_NAME_EDIT_CHAR_COLOR_LUM_MOD) >>= nCharColorLumMod;
- sal_Int32 nCharColorLumOff{};
- xPortion->getPropertyValue(UNO_NAME_EDIT_CHAR_COLOR_LUM_OFF) >>= nCharColorLumOff;
- if (nCharColorLumMod != 10000 || nCharColorLumOff != 0)
- {
- aColor.ApplyLumModOff(nCharColorLumMod, nCharColorLumOff);
- }
+ model::ThemeColor aThemeColor;
+ model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
- sal_Int32 nCharColorTintOrShade{};
- xPortion->getPropertyValue(UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE) >>= nCharColorTintOrShade;
- if (nCharColorTintOrShade != 0)
- {
- aColor.ApplyTintOrShade(nCharColorTintOrShade);
- }
+ if (aThemeColor.getType() == model::ThemeColorType::Unknown)
+ return;
+
+ Color aColor = rColorSet.getColor(aThemeColor.getType());
+ aColor = aThemeColor.applyTransformations(aColor);
- xPortion->setPropertyValue(UNO_NAME_EDIT_CHAR_COLOR,
- uno::Any(static_cast<sal_Int32>(aColor)));
+ xPortion->setPropertyValue(UNO_NAME_EDIT_CHAR_COLOR, uno::Any(static_cast<sal_Int32>(aColor)));
}
void UpdateFillColorSet(const uno::Reference<beans::XPropertySet>& xShape, const svx::ColorSet& rColorSet)
{
- if (!xShape->getPropertySetInfo()->hasPropertyByName(UNO_NAME_FILLCOLOR_THEME))
- {
+ if (!xShape->getPropertySetInfo()->hasPropertyByName(UNO_NAME_FILLCOLOR_THEME_REFERENCE))
return;
- }
- sal_Int16 nFillColorTheme = -1;
- xShape->getPropertyValue(UNO_NAME_FILLCOLOR_THEME) >>= nFillColorTheme;
- model::ThemeColorType eColorThemeType = model::convertToThemeColorType(nFillColorTheme);
- if (eColorThemeType == model::ThemeColorType::Unknown)
+ uno::Reference<util::XThemeColor> xThemeColor;
+ xShape->getPropertyValue(UNO_NAME_FILLCOLOR_THEME_REFERENCE) >>= xThemeColor;
+ if (!xThemeColor.is())
return;
- Color aColor = rColorSet.getColor(eColorThemeType);
- sal_Int32 nFillColorLumMod{};
- xShape->getPropertyValue(UNO_NAME_FILLCOLOR_LUM_MOD) >>= nFillColorLumMod;
- sal_Int32 nFillColorLumOff{};
- xShape->getPropertyValue(UNO_NAME_FILLCOLOR_LUM_OFF) >>= nFillColorLumOff;
- if (nFillColorLumMod != 10000 || nFillColorLumOff != 0)
- {
- aColor.ApplyLumModOff(nFillColorLumMod, nFillColorLumOff);
- }
+ model::ThemeColor aThemeColor;
+ model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+
+ if (aThemeColor.getType() == model::ThemeColorType::Unknown)
+ return;
+ Color aColor = rColorSet.getColor(aThemeColor.getType());
+ aColor = aThemeColor.applyTransformations(aColor);
xShape->setPropertyValue(UNO_NAME_FILLCOLOR, uno::Any(static_cast<sal_Int32>(aColor)));
}
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 4d200239c2e0..b8ca46ce9921 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -1487,6 +1487,15 @@ PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName )
eState = PropertyState_DEFAULT_VALUE;
}
}
+ else if (pMap->nMemberId == MID_COLOR_THEME_REFERENCE)
+ {
+ const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID);
+ if (pColor->GetThemeColor().getType() == model::ThemeColorType::Unknown)
+ {
+ eState = PropertyState_DEFAULT_VALUE;
+ }
+ }
+ break;
}
}
}
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 7eaa1053f9e5..139e9d3ac48e 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -566,6 +566,7 @@ static o3tl::span<SfxItemPropertyMapEntry const> ImplGetSvxControlShapePropertyM
{ UNO_NAME_EDIT_CHAR_COLOR, 0, cppu::UnoType<sal_Int32>::get(), 0, MID_COLOR_RGB },
{ UNO_NAME_EDIT_CHAR_COLOR_THEME, 0, cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_THEME_INDEX },
{ UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE, 0, cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_TINT_OR_SHADE },
+ { UNO_NAME_EDIT_CHAR_COLOR_THEME_REFERENCE, 0, cppu::UnoType<css::uno::XInterface>::get(), 0, MID_COLOR_THEME_REFERENCE },
{ u"CharBackColor", 0, cppu::UnoType<sal_Int32>::get(), 0, 0 },
{ u"CharBackTransparent", 0, cppu::UnoType<bool>::get(), 0, 0 },
{ u"CharRelief", 0, cppu::UnoType<sal_Int16>::get(), 0, 0 },
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index e2b11927e59a..e4ff92bc3bed 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -608,6 +608,7 @@ const SvxShapeControlPropertyMapping[] =
{ "CharCaseMap", "CharCaseMap" },
{ "CharColorTheme", "CharColorTheme" },
{ "CharColorTintOrShade", "CharColorTintOrShade" },
+ { UNO_NAME_EDIT_CHAR_COLOR_THEME_REFERENCE, "CharColorThemeReference" },
};
namespace
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 9692df8c130d..794df51242f1 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1990,6 +1990,15 @@ beans::PropertyState SvxShape::_getPropertyState( const OUString& PropertyName )
eState = beans::PropertyState_DEFAULT_VALUE;
}
}
+ else if (pMap->nMemberId == MID_COLOR_THEME_REFERENCE)
+ {
+ const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID);
+ if (pColor->GetThemeColor().getType() == model::ThemeColorType::Unknown)
+ {
+ eState = beans::PropertyState_DEFAULT_VALUE;
+ }
+ }
+ break;
break;
}
}
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 38a9431a47a6..4f402d02c48a 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -36,6 +36,7 @@
#include <o3tl/any.hxx>
#include <svl/itempool.hxx>
#include <editeng/memberids.h>
+#include <docmodel/uno/UnoThemeColor.hxx>
#include <tools/mapunit.hxx>
#include <tools/UnitConversion.hxx>
#include <osl/diagnose.h>
@@ -1948,6 +1949,12 @@ bool XFillColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) cons
rVal <<= nValue;
break;
}
+ case MID_COLOR_THEME_REFERENCE:
+ {
+ auto xThemeColor = model::theme::createXThemeColor(GetThemeColor());
+ rVal <<= xThemeColor;
+ break;
+ }
default:
{
rVal <<= GetColorValue().GetRGBColor();
@@ -1989,6 +1996,14 @@ bool XFillColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
GetThemeColor().addTransformation({model::TransformationType::LumOff, nLumOff});
}
break;
+ case MID_COLOR_THEME_REFERENCE:
+ {
+ css::uno::Reference<css::util::XThemeColor> xThemeColor;
+ if (!(rVal >>= xThemeColor))
+ return false;
+ model::theme::setFromXThemeColor(GetThemeColor(), xThemeColor);
+ }
+ break;
default:
{
Color nValue;