diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-11-22 13:31:58 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-11-22 15:20:09 +0100 |
commit | 2eaf79131dab04acce1411fed1d8ac8ab5c51575 (patch) | |
tree | 4eb99b5c4fac381ece1457969aabaf41a08cdcb1 /oox/source | |
parent | 5c6c3c0b75a3584258b786c7e9bf8789d31847e8 (diff) |
PPTX: implement native handling of <a:clrScheme> children
This was already handled by converting them to raw colors at import
time. This commit imports the color scheme contents (the 12 colors) into
the doc model.
This is a dependency to export them back to PPTX and to be able to
update these colors on the UI by picking a different theme.
Change-Id: I177de4f15d5f0e628669998d1cda7db24220b2eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125651
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/drawingml/clrscheme.cxx | 18 | ||||
-rw-r--r-- | oox/source/drawingml/theme.cxx | 4 |
2 files changed, 22 insertions, 0 deletions
diff --git a/oox/source/drawingml/clrscheme.cxx b/oox/source/drawingml/clrscheme.cxx index 6b391d7877a8..19c0afd44900 100644 --- a/oox/source/drawingml/clrscheme.cxx +++ b/oox/source/drawingml/clrscheme.cxx @@ -19,9 +19,15 @@ #include <algorithm> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/util/Color.hpp> + #include <osl/diagnose.h> #include <oox/drawingml/clrscheme.hxx> #include <oox/token/tokens.hxx> +#include <comphelper/sequence.hxx> + +using namespace com::sun::star; namespace oox::drawingml { @@ -102,6 +108,18 @@ bool ClrScheme::getColorByIndex(size_t nIndex, ::Color& rColor) const return true; } +void ClrScheme::ToAny(css::uno::Any& rVal) const +{ + std::vector<util::Color> aRet; + + for (const auto& rIndexAndColor : maClrScheme) + { + aRet.push_back(static_cast<sal_Int32>(rIndexAndColor.second)); + } + + rVal <<= comphelper::containerToSequence(aRet); +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx index ba1761311154..56df9941169c 100644 --- a/oox/source/drawingml/theme.cxx +++ b/oox/source/drawingml/theme.cxx @@ -105,9 +105,13 @@ const TextFont* Theme::resolveFont( const OUString& rName ) const void Theme::addTheme(const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage) const { + beans::PropertyValue aColorScheme; + aColorScheme.Name = "ColorScheme"; + maClrScheme.ToAny(aColorScheme.Value); beans::PropertyValues aValues = { comphelper::makePropertyValue("Name", maThemeName), comphelper::makePropertyValue("ColorSchemeName", maClrScheme.GetName()), + aColorScheme, }; uno::Reference<beans::XPropertySet> xPropertySet(xDrawPage, uno::UNO_QUERY); xPropertySet->setPropertyValue("Theme", uno::makeAny(aValues)); |