summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir@collabora.com>2021-09-13 09:47:11 +0300
committerMiklos Vajna <vmiklos@collabora.com>2021-11-18 17:17:43 +0100
commit6ce8066af743b172d36046a8dc8b17ebe010b6cf (patch)
treec27c1699e29f0a3a8340adbbf1c7704ebb54c866 /oox/source
parentf4d59ec73682f06fff9f718b3347726f1d53d263 (diff)
import pptx color schemes as color sets
initial import work for color sets. Themes (which we get the color schemes from) in MSO can be different for each master - will need to support that too. [ Miklos: actually added that per-master-page support. ] (cherry picked from commit 3b21d166f585dcdf8d576d166aeff3cfd4694aab, from the feature/themesupport2 branch) Change-Id: Ia06d2645018e6bfa70817bbddba2374641ae13dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125477 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/drawingml/theme.cxx15
-rw-r--r--oox/source/drawingml/themefragmenthandler.cxx6
-rw-r--r--oox/source/ppt/presentationfragmenthandler.cxx6
3 files changed, 26 insertions, 1 deletions
diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx
index 036779d21711..be9f199ff8f8 100644
--- a/oox/source/drawingml/theme.cxx
+++ b/oox/source/drawingml/theme.cxx
@@ -20,6 +20,12 @@
#include <oox/drawingml/theme.hxx>
#include <oox/token/tokens.hxx>
#include <drawingml/textcharacterproperties.hxx>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <comphelper/propertyvalue.hxx>
+
+using namespace com::sun::star;
namespace oox::drawingml {
@@ -97,6 +103,15 @@ const TextFont* Theme::resolveFont( const OUString& rName ) const
return nullptr;
}
+void Theme::addTheme(const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage) const
+{
+ beans::PropertyValues aValues = {
+ comphelper::makePropertyValue("Name", maThemeName),
+ };
+ uno::Reference<beans::XPropertySet> xPropertySet(xDrawPage, uno::UNO_QUERY);
+ xPropertySet->setPropertyValue("Theme", uno::makeAny(aValues));
+}
+
} // namespace oox::drawingml
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/themefragmenthandler.cxx b/oox/source/drawingml/themefragmenthandler.cxx
index 5c5d4a6ab07a..5ab0ee1e6b21 100644
--- a/oox/source/drawingml/themefragmenthandler.cxx
+++ b/oox/source/drawingml/themefragmenthandler.cxx
@@ -21,6 +21,7 @@
#include <drawingml/objectdefaultcontext.hxx>
#include <oox/drawingml/theme.hxx>
#include <oox/token/namespaces.hxx>
+#include <oox/helper/attributelist.hxx>
#include <drawingml/themeelementscontext.hxx>
using namespace ::oox::core;
@@ -37,7 +38,7 @@ ThemeFragmentHandler::~ThemeFragmentHandler()
{
}
-ContextHandlerRef ThemeFragmentHandler::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef ThemeFragmentHandler::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs)
{
// CT_OfficeStyleSheet
switch( getCurrentElement() )
@@ -46,7 +47,10 @@ ContextHandlerRef ThemeFragmentHandler::onCreateContext( sal_Int32 nElement, con
switch( nElement )
{
case A_TOKEN( theme ):
+ {
+ mrTheme.setThemeName(rAttribs.getString(XML_name).get());
return this;
+ }
}
break;
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index 5d5c3a594009..a088bf04636e 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -378,6 +378,12 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage
rFilter.importFragment( new LayoutFragmentHandler( rFilter, aLayoutFragmentPath, pMasterPersistPtr ) );
pMasterPersistPtr->createBackground( rFilter );
pMasterPersistPtr->createXShapes( rFilter );
+
+ oox::drawingml::ThemePtr pTheme = pMasterPersistPtr->getTheme();
+ if (pTheme)
+ {
+ pTheme->addTheme(pMasterPersistPtr->getPage());
+ }
}
}
}