diff options
author | Sarper Akdemir <sarper.akdemir@collabora.com> | 2021-09-07 10:14:52 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-11-18 09:00:59 +0100 |
commit | cd5c8e5a99f56d5af53b69dcb925f3aed77a815d (patch) | |
tree | 0b748d6e476197055119f25443afe9adf570d358 /svx/source/styles | |
parent | 75a49947c2eeb831a8e02192f1c4856eac62a743 (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 'svx/source/styles')
-rw-r--r-- | svx/source/styles/ColorSets.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
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: */ |