summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir@collabora.com>2021-09-07 10:14:52 +0300
committerMiklos Vajna <vmiklos@collabora.com>2021-11-18 09:00:59 +0100
commitcd5c8e5a99f56d5af53b69dcb925f3aed77a815d (patch)
tree0b748d6e476197055119f25443afe9adf570d358 /sd
parent75a49947c2eeb831a8e02192f1c4856eac62a743 (diff)
introduce XColorSetsManager interface
[ Miklos: rather go with a beans::PropertyValues-based interface to allow extending this incrementally, without an API change. This allows getting / setting a per-document theme via the UNO API, but the concept from the original commit is unchanged. ] (cherry picked from commit 3f1bca8b4f451fa30bf341116390738c456d651f, from the feature/themesupport2 branch) Change-Id: I24be34a5a7b68549b21a6cd55144901d4fe2c5f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125436 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/inc/unokywds.hxx1
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx25
2 files changed, 26 insertions, 0 deletions
diff --git a/sd/source/ui/inc/unokywds.hxx b/sd/source/ui/inc/unokywds.hxx
index 13a4cd4dd258..7b078c11410b 100644
--- a/sd/source/ui/inc/unokywds.hxx
+++ b/sd/source/ui/inc/unokywds.hxx
@@ -59,6 +59,7 @@ inline constexpr OUStringLiteral sUNO_Prop_BookmarkURL = u"BookmarkURL";
inline constexpr OUStringLiteral sUNO_Prop_RuntimeUID = u"RuntimeUID";
inline constexpr OUStringLiteral sUNO_Prop_HasValidSignatures = u"HasValidSignatures";
inline constexpr OUStringLiteral sUNO_Prop_InteropGrabBag = u"InteropGrabBag";
+inline constexpr OUStringLiteral sUNO_Prop_Theme = u"Theme";
// view settings
inline constexpr OUStringLiteral sUNO_View_ViewId = u"ViewId";
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index d4304815519f..e4b11eea33b5 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -125,6 +125,7 @@
#include <tools/diagnose_ex.h>
#include <tools/json_writer.hxx>
#include <tools/UnitConversion.hxx>
+#include <svx/ColorSets.hxx>
using namespace ::cppu;
using namespace ::com::sun::star;
@@ -197,6 +198,7 @@ const sal_uInt16 WID_MODEL_HASVALIDSIGNATURES = 11;
const sal_uInt16 WID_MODEL_DIALOGLIBS = 12;
const sal_uInt16 WID_MODEL_FONTS = 13;
const sal_uInt16 WID_MODEL_INTEROPGRABBAG = 14;
+const sal_uInt16 WID_MODEL_THEME = 15;
static const SvxItemPropertySet* ImplGetDrawModelPropertySet()
{
@@ -217,6 +219,7 @@ static const SvxItemPropertySet* ImplGetDrawModelPropertySet()
{ sUNO_Prop_HasValidSignatures, WID_MODEL_HASVALIDSIGNATURES, ::cppu::UnoType<sal_Bool>::get(), beans::PropertyAttribute::READONLY, 0},
{ u"Fonts", WID_MODEL_FONTS, cppu::UnoType<uno::Sequence<uno::Any>>::get(), beans::PropertyAttribute::READONLY, 0},
{ sUNO_Prop_InteropGrabBag, WID_MODEL_INTEROPGRABBAG, cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get(), 0, 0},
+ { sUNO_Prop_Theme, WID_MODEL_THEME, cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get(), 0, 0},
{ u"", 0, css::uno::Type(), 0, 0 }
};
static SvxItemPropertySet aDrawModelPropertySet_Impl( aDrawModelPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
@@ -1248,6 +1251,13 @@ void SAL_CALL SdXImpressDocument::setPropertyValue( const OUString& aPropertyNam
case WID_MODEL_INTEROPGRABBAG:
setGrabBagItem(aValue);
break;
+ case WID_MODEL_THEME:
+ {
+ SdrModel& rModel = getSdrModelFromUnoModel();
+ std::unique_ptr<svx::Theme> pTheme = svx::Theme::FromAny(aValue);
+ rModel.SetTheme(std::move(pTheme));
+ }
+ break;
default:
throw beans::UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this));
}
@@ -1368,6 +1378,21 @@ uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& Property
case WID_MODEL_INTEROPGRABBAG:
getGrabBagItem(aAny);
break;
+ case WID_MODEL_THEME:
+ {
+ SdrModel& rModel = getSdrModelFromUnoModel();
+ svx::Theme* pTheme = rModel.GetTheme();
+ if (pTheme)
+ {
+ pTheme->ToAny(aAny);
+ }
+ else
+ {
+ beans::PropertyValues aValues;
+ aAny <<= aValues;
+ }
+ break;
+ }
default:
throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
}