diff options
-rw-r--r-- | include/svx/ColorSets.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/inc/unokywds.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 25 | ||||
-rw-r--r-- | svx/source/styles/ColorSets.cxx | 32 |
4 files changed, 62 insertions, 0 deletions
diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx index eee992da94b5..e6c9f1b4e7ee 100644 --- a/include/svx/ColorSets.hxx +++ b/include/svx/ColorSets.hxx @@ -85,6 +85,10 @@ public: const OUString& GetName() const; void dumpAsXml(xmlTextWriterPtr pWriter) const; + + void ToAny(css::uno::Any& rVal) const; + + static std::unique_ptr<Theme> FromAny(const css::uno::Any& rVal); }; } // end of namespace svx 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)); } diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx index 91a44f1782ea..8ab3d939ef5a 100644 --- a/svx/source/styles/ColorSets.cxx +++ b/svx/source/styles/ColorSets.cxx @@ -14,6 +14,13 @@ #include <libxml/xmlwriter.h> +#include <com/sun/star/beans/PropertyValues.hpp> + +#include <comphelper/propertyvalue.hxx> +#include <comphelper/sequenceashashmap.hxx> + +using namespace com::sun::star; + namespace svx { @@ -155,6 +162,31 @@ void Theme::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterEndElement(pWriter); } +void Theme::ToAny(css::uno::Any& rVal) const +{ + beans::PropertyValues aValues = { + comphelper::makePropertyValue("Name", maName) + }; + + rVal <<= aValues; +} + +std::unique_ptr<Theme> Theme::FromAny(const css::uno::Any& rVal) +{ + comphelper::SequenceAsHashMap aMap(rVal); + std::unique_ptr<Theme> pTheme; + + auto it = aMap.find("Name"); + if (it != aMap.end()) + { + OUString aName; + it->second >>= aName; + pTheme = std::make_unique<Theme>(aName); + } + + return pTheme; +} + } // end of namespace svx /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |