From cd5c8e5a99f56d5af53b69dcb925f3aed77a815d Mon Sep 17 00:00:00 2001 From: Sarper Akdemir Date: Tue, 7 Sep 2021 10:14:52 +0300 Subject: 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 --- svx/source/styles/ColorSets.cxx | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'svx/source/styles') 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 +#include + +#include +#include + +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::FromAny(const css::uno::Any& rVal) +{ + comphelper::SequenceAsHashMap aMap(rVal); + std::unique_ptr pTheme; + + auto it = aMap.find("Name"); + if (it != aMap.end()) + { + OUString aName; + it->second >>= aName; + pTheme = std::make_unique(aName); + } + + return pTheme; +} + } // end of namespace svx /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit