summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-02-23 23:38:08 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-03-01 12:57:29 +0000
commit6e8c67580974484c790f52991de26298ce8e7e1c (patch)
tree0dc731c89810fa9c8d40de9c1b8cedc99a6dcf9c
parent855f7c08d1feab7669670bfbc4ed2b3b3225db16 (diff)
oox: import directly into docmodel's Theme and ColorSet
This changes the import to directly fill values of a model::Theme and model::ColorSet, without filling the oox structs first. The goal is to get rid of the oox in the long run, but for now it is necessary to keep reading into both, which is a duplication. The next step is to also fill the FontScheme and FormatScheme structures. Change-Id: I488ec096cbc184bc70d24510ac9091a488540422 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147571 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--include/oox/drawingml/themefragmenthandler.hxx17
-rw-r--r--oox/inc/drawingml/ThemeOverrideFragmentHandler.hxx16
-rw-r--r--oox/inc/drawingml/clrschemecontext.hxx8
-rw-r--r--oox/inc/drawingml/themeelementscontext.hxx7
-rw-r--r--oox/source/drawingml/ThemeOverrideFragmentHandler.cxx19
-rw-r--r--oox/source/drawingml/clrschemecontext.cxx45
-rw-r--r--oox/source/drawingml/diagram/diagramhelper.cxx4
-rw-r--r--oox/source/drawingml/shape.cxx4
-rw-r--r--oox/source/drawingml/themeelementscontext.cxx32
-rw-r--r--oox/source/drawingml/themefragmenthandler.cxx18
-rw-r--r--oox/source/ppt/presentationfragmenthandler.cxx4
-rw-r--r--oox/source/shape/ShapeContextHandler.cxx3
-rw-r--r--sc/Library_scfilt.mk1
-rw-r--r--sc/source/filter/oox/workbookfragment.cxx3
-rw-r--r--writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.cxx2
-rw-r--r--writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.hxx4
16 files changed, 115 insertions, 72 deletions
diff --git a/include/oox/drawingml/themefragmenthandler.hxx b/include/oox/drawingml/themefragmenthandler.hxx
index 918a3eb861b9..5c193544fe65 100644
--- a/include/oox/drawingml/themefragmenthandler.hxx
+++ b/include/oox/drawingml/themefragmenthandler.hxx
@@ -25,29 +25,28 @@
#include <oox/dllapi.h>
#include <rtl/ustring.hxx>
#include <sal/types.h>
+#include <docmodel/theme/Theme.hxx>
namespace oox { class AttributeList; }
namespace oox::core { class XmlFilterBase; }
-namespace oox::drawingml {
+namespace oox::drawingml
+{
class Theme;
-
class OOX_DLLPUBLIC ThemeFragmentHandler final : public ::oox::core::FragmentHandler2
{
public:
- explicit ThemeFragmentHandler(
- ::oox::core::XmlFilterBase& rFilter,
- const OUString& rFragmentPath,
- Theme& rTheme );
- virtual ~ThemeFragmentHandler() override;
+ explicit ThemeFragmentHandler(::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, Theme& rOoxTheme, model::Theme& rTheme);
+ virtual ~ThemeFragmentHandler() override;
- virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList& rAttribs) override;
void onStartElement(const AttributeList& rAttribs) override;
private:
- Theme& mrTheme;
+ Theme& mrOoxTheme;
+ model::Theme& mrTheme;
};
diff --git a/oox/inc/drawingml/ThemeOverrideFragmentHandler.hxx b/oox/inc/drawingml/ThemeOverrideFragmentHandler.hxx
index 1582ea819d95..a51c66c3eea0 100644
--- a/oox/inc/drawingml/ThemeOverrideFragmentHandler.hxx
+++ b/oox/inc/drawingml/ThemeOverrideFragmentHandler.hxx
@@ -11,24 +11,24 @@
#define INCLUDED_OOX_DRAWINGML_THEMEOVERRICEFRAGMENTHANDLER_HXX
#include <oox/core/fragmenthandler2.hxx>
+#include <oox/drawingml/theme.hxx>
-namespace oox::drawingml {
+namespace oox::drawingml
+{
class Theme;
class ThemeOverrideFragmentHandler final : public ::oox::core::FragmentHandler2
{
public:
- explicit ThemeOverrideFragmentHandler(
- ::oox::core::XmlFilterBase& rFilter,
- const OUString& rFragmentPath,
- Theme& rTheme );
- virtual ~ThemeOverrideFragmentHandler() override;
+ explicit ThemeOverrideFragmentHandler(::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, Theme& rOoxTheme, model::Theme& rTheme);
+ virtual ~ThemeOverrideFragmentHandler() override;
- virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList& rAttribs) override;
private:
- Theme& mrTheme;
+ Theme& mrOoxTheme;
+ model::Theme& mrTheme;
};
} // namespace oox::drawingml
diff --git a/oox/inc/drawingml/clrschemecontext.hxx b/oox/inc/drawingml/clrschemecontext.hxx
index 5e7cddfb8d03..b50c8e0c93d9 100644
--- a/oox/inc/drawingml/clrschemecontext.hxx
+++ b/oox/inc/drawingml/clrschemecontext.hxx
@@ -37,22 +37,24 @@ public:
class clrSchemeColorContext final : private Color, public ColorContext
{
public:
- clrSchemeColorContext( ::oox::core::ContextHandler2Helper const & rParent, ClrScheme& rClrScheme, sal_Int32 nColorToken );
+ clrSchemeColorContext(::oox::core::ContextHandler2Helper const & rParent, ClrScheme& rClrScheme, model::ColorSet& mrColorSet, sal_Int32 nColorToken);
virtual ~clrSchemeColorContext() override;
private:
ClrScheme& mrClrScheme;
+ model::ColorSet& mrColorSet;
sal_Int32 mnColorToken;
};
class clrSchemeContext final : public oox::core::ContextHandler2
{
public:
- clrSchemeContext( ::oox::core::ContextHandler2Helper const & rParent, ClrScheme& rClrScheme );
+ clrSchemeContext(::oox::core::ContextHandler2Helper const & rParent, ClrScheme& rClrScheme, model::ColorSet& rColorSet);
virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
private:
- ClrScheme& mrClrScheme;
+ ClrScheme& mrClrScheme;
+ model::ColorSet& mrColorSet;
};
}
diff --git a/oox/inc/drawingml/themeelementscontext.hxx b/oox/inc/drawingml/themeelementscontext.hxx
index 4c113762e10c..1dba96e6c0e2 100644
--- a/oox/inc/drawingml/themeelementscontext.hxx
+++ b/oox/inc/drawingml/themeelementscontext.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_OOX_DRAWINGML_THEMEELEMENTSCONTEXT_HXX
#include <oox/core/contexthandler2.hxx>
+#include <docmodel/theme/Theme.hxx>
namespace oox::drawingml
{
@@ -29,12 +30,14 @@ class Theme;
class ThemeElementsContext final : public oox::core::ContextHandler2
{
public:
- ThemeElementsContext(::oox::core::ContextHandler2Helper const& rParent, Theme& rTheme);
+ ThemeElementsContext(::oox::core::ContextHandler2Helper const& rParent, Theme& rOoxTheme,
+ model::Theme& rTheme);
virtual ::oox::core::ContextHandlerRef
onCreateContext(sal_Int32 nElement, const ::oox::AttributeList& rAttribs) override;
private:
- Theme& mrTheme;
+ Theme& mrOoxTheme;
+ model::Theme& mrTheme;
};
} // namespace oox::drawingml
diff --git a/oox/source/drawingml/ThemeOverrideFragmentHandler.cxx b/oox/source/drawingml/ThemeOverrideFragmentHandler.cxx
index 1be56980cff8..72f93a7e2581 100644
--- a/oox/source/drawingml/ThemeOverrideFragmentHandler.cxx
+++ b/oox/source/drawingml/ThemeOverrideFragmentHandler.cxx
@@ -8,17 +8,18 @@
*/
#include <drawingml/ThemeOverrideFragmentHandler.hxx>
-#include <oox/drawingml/theme.hxx>
#include <oox/token/namespaces.hxx>
#include <drawingml/themeelementscontext.hxx>
using namespace ::oox::core;
-namespace oox::drawingml {
+namespace oox::drawingml
+{
-ThemeOverrideFragmentHandler::ThemeOverrideFragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, Theme& rTheme ) :
- FragmentHandler2( rFilter, rFragmentPath ),
- mrTheme( rTheme )
+ThemeOverrideFragmentHandler::ThemeOverrideFragmentHandler(XmlFilterBase& rFilter, const OUString& rFragmentPath, Theme& rOoxTheme, model::Theme& rTheme)
+ : FragmentHandler2(rFilter, rFragmentPath)
+ , mrOoxTheme(rOoxTheme)
+ , mrTheme(rTheme)
{
}
@@ -26,16 +27,16 @@ ThemeOverrideFragmentHandler::~ThemeOverrideFragmentHandler()
{
}
-ContextHandlerRef ThemeOverrideFragmentHandler::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef ThemeOverrideFragmentHandler::onCreateContext(sal_Int32 nElement, const AttributeList& /*rAttribute*/)
{
// CT_OfficeStyleSheet
- switch( getCurrentElement() )
+ switch (getCurrentElement())
{
case XML_ROOT_CONTEXT:
- switch( nElement )
+ switch (nElement)
{
case A_TOKEN( themeOverride ): // CT_BaseStylesOverride
- return new ThemeElementsContext( *this, mrTheme );
+ return new ThemeElementsContext(*this, mrOoxTheme, mrTheme);
}
break;
}
diff --git a/oox/source/drawingml/clrschemecontext.cxx b/oox/source/drawingml/clrschemecontext.cxx
index e8850974c683..5e423f3a7e8a 100644
--- a/oox/source/drawingml/clrschemecontext.cxx
+++ b/oox/source/drawingml/clrschemecontext.cxx
@@ -57,21 +57,44 @@ clrMapContext::clrMapContext( ContextHandler2Helper const & rParent,
setClrMap( rAttributes, rClrMap, XML_folHlink );
}
-clrSchemeColorContext::clrSchemeColorContext( ContextHandler2Helper const & rParent, ClrScheme& rClrScheme, sal_Int32 nColorToken ) :
- ColorContext( rParent, *this ),
- mrClrScheme( rClrScheme ),
- mnColorToken( nColorToken )
+clrSchemeColorContext::clrSchemeColorContext(ContextHandler2Helper const & rParent, ClrScheme& rClrScheme, model::ColorSet& rColorSet, sal_Int32 nColorToken)
+ : ColorContext(rParent, *this)
+ , mrClrScheme(rClrScheme)
+ , mrColorSet(rColorSet)
+ , mnColorToken(nColorToken)
{
}
clrSchemeColorContext::~clrSchemeColorContext()
{
- mrClrScheme.setColor( mnColorToken, getColor( getFilter().getGraphicHelper() ) );
+ ::Color aColor = getColor(getFilter().getGraphicHelper());
+ mrClrScheme.setColor(mnColorToken, aColor);
+ switch (mnColorToken)
+ {
+ case XML_tx1:
+ case XML_dk1: mrColorSet.add(model::ThemeColorType::Dark1, aColor); break;
+ case XML_bg1:
+ case XML_lt1: mrColorSet.add(model::ThemeColorType::Light1, aColor); break;
+ case XML_tx2:
+ case XML_dk2: mrColorSet.add(model::ThemeColorType::Dark2, aColor); break;
+ case XML_bg2:
+ case XML_lt2: mrColorSet.add(model::ThemeColorType::Light2, aColor); break;
+ case XML_accent1: mrColorSet.add(model::ThemeColorType::Accent1, aColor); break;
+ case XML_accent2: mrColorSet.add(model::ThemeColorType::Accent2, aColor); break;
+ case XML_accent3: mrColorSet.add(model::ThemeColorType::Accent3, aColor); break;
+ case XML_accent4: mrColorSet.add(model::ThemeColorType::Accent4, aColor); break;
+ case XML_accent5: mrColorSet.add(model::ThemeColorType::Accent5, aColor); break;
+ case XML_accent6: mrColorSet.add(model::ThemeColorType::Accent6, aColor); break;
+ case XML_hlink: mrColorSet.add(model::ThemeColorType::Hyperlink, aColor); break;
+ case XML_folHlink: mrColorSet.add(model::ThemeColorType::FollowedHyperlink, aColor); break;
+ default: break;
+ }
}
-clrSchemeContext::clrSchemeContext( ContextHandler2Helper const & rParent, ClrScheme& rClrScheme ) :
- ContextHandler2( rParent ),
- mrClrScheme( rClrScheme )
+clrSchemeContext::clrSchemeContext(ContextHandler2Helper const & rParent, ClrScheme& rClrScheme, model::ColorSet& rColorSet)
+ : ContextHandler2(rParent)
+ , mrClrScheme(rClrScheme)
+ , mrColorSet(rColorSet)
{
}
@@ -81,9 +104,13 @@ ContextHandlerRef clrSchemeContext::onCreateContext(
switch( nElement )
{
case A_TOKEN( dk1 ):
+ case A_TOKEN( tx1 ):
case A_TOKEN( lt1 ):
+ case A_TOKEN( bg1 ):
case A_TOKEN( dk2 ):
+ case A_TOKEN( tx2 ):
case A_TOKEN( lt2 ):
+ case A_TOKEN( bg2 ):
case A_TOKEN( accent1 ):
case A_TOKEN( accent2 ):
case A_TOKEN( accent3 ):
@@ -92,7 +119,7 @@ ContextHandlerRef clrSchemeContext::onCreateContext(
case A_TOKEN( accent6 ):
case A_TOKEN( hlink ):
case A_TOKEN( folHlink ):
- return new clrSchemeColorContext( *this, mrClrScheme, getBaseToken( nElement ) );
+ return new clrSchemeColorContext(*this, mrClrScheme, mrColorSet, getBaseToken(nElement));
}
return nullptr;
}
diff --git a/oox/source/drawingml/diagram/diagramhelper.cxx b/oox/source/drawingml/diagram/diagramhelper.cxx
index e0e7202d3966..daf3047b6433 100644
--- a/oox/source/drawingml/diagram/diagramhelper.cxx
+++ b/oox/source/drawingml/diagram/diagramhelper.cxx
@@ -251,11 +251,11 @@ const std::shared_ptr< ::oox::drawingml::Theme >& AdvancedDiagramHelper::getOrCr
// reset local Theme ModelData *always* to get rid of former data that would
// else be added additionally
const_cast<AdvancedDiagramHelper*>(this)->mpThemePtr = std::make_shared<oox::drawingml::Theme>();
+ model::Theme aTheme;
// import Theme ModelData
rxFilter->importFragment(
- new ThemeFragmentHandler(
- *rxFilter, OUString(), *mpThemePtr ),
+ new ThemeFragmentHandler(*rxFilter, OUString(), *mpThemePtr, aTheme),
uno::Reference< css::xml::sax::XFastSAXSerializable >(
xThemeDocument,
uno::UNO_QUERY_THROW));
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index fac027376784..ccfd61410bd5 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -2170,9 +2170,9 @@ void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >&
rFilter.importFragment(aThemeOverrideFragmentPath), uno::UNO_QUERY_THROW);
pTheme = pPowerPointImport->getActualSlidePersist()->getTheme();
auto pThemeOverride = std::make_shared<Theme>(*pTheme);
+ model::Theme aTheme;
rFilter.importFragment(
- new ThemeOverrideFragmentHandler(rFilter, aThemeOverrideFragmentPath,
- *pThemeOverride),
+ new ThemeOverrideFragmentHandler(rFilter, aThemeOverrideFragmentPath, *pThemeOverride, aTheme),
xDoc);
pPowerPointImport->getActualSlidePersist()->setTheme(pThemeOverride);
}
diff --git a/oox/source/drawingml/themeelementscontext.cxx b/oox/source/drawingml/themeelementscontext.cxx
index cb62f4ef0a70..fdc691427040 100644
--- a/oox/source/drawingml/themeelementscontext.cxx
+++ b/oox/source/drawingml/themeelementscontext.cxx
@@ -213,45 +213,49 @@ void FontSchemeContext::onEndElement()
}
}
-ThemeElementsContext::ThemeElementsContext( ContextHandler2Helper const & rParent, Theme& rTheme ) :
- ContextHandler2( rParent ),
- mrTheme( rTheme )
+ThemeElementsContext::ThemeElementsContext(ContextHandler2Helper const & rParent, Theme& rOoxTheme, model::Theme& rTheme)
+ : ContextHandler2(rParent)
+ , mrOoxTheme(rOoxTheme)
+ , mrTheme(rTheme)
{
}
-ContextHandlerRef ThemeElementsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef ThemeElementsContext::onCreateContext(sal_Int32 nElement, const AttributeList& rAttribs)
{
// CT_BaseStyles
- switch( nElement )
+ switch (nElement)
{
case A_TOKEN( clrScheme ): // CT_ColorScheme
{
+ OUString aColorSchemeName = rAttribs.getStringDefaulted(XML_name);
+ mrTheme.SetColorSet(std::make_unique<model::ColorSet>(aColorSchemeName));
if (rAttribs.hasAttribute(XML_name))
- mrTheme.getClrScheme().SetName(rAttribs.getStringDefaulted(XML_name));
- return new clrSchemeContext(*this, mrTheme.getClrScheme());
+ mrOoxTheme.getClrScheme().SetName(rAttribs.getStringDefaulted(XML_name));
+ return new clrSchemeContext(*this, mrOoxTheme.getClrScheme(), *mrTheme.GetColorSet());
}
case A_TOKEN( fontScheme ): // CT_FontScheme
{
if (rAttribs.hasAttribute(XML_name))
- mrTheme.setFontSchemeName(rAttribs.getStringDefaulted(XML_name));
- return new FontSchemeContext(*this, mrTheme.getFontScheme(), mrTheme.getSupplementalFontMap());
+ mrOoxTheme.setFontSchemeName(rAttribs.getStringDefaulted(XML_name));
+
+ return new FontSchemeContext(*this, mrOoxTheme.getFontScheme(), mrOoxTheme.getSupplementalFontMap());
}
case A_TOKEN( fmtScheme ): // CT_StyleMatrix
{
if (rAttribs.hasAttribute(XML_name))
- mrTheme.setFormatSchemeName(rAttribs.getStringDefaulted(XML_name));
+ mrOoxTheme.setFormatSchemeName(rAttribs.getStringDefaulted(XML_name));
return this;
}
case A_TOKEN( fillStyleLst ): // CT_FillStyleList
- return new FillStyleListContext( *this, mrTheme.getFillStyleList() );
+ return new FillStyleListContext( *this, mrOoxTheme.getFillStyleList() );
case A_TOKEN( lnStyleLst ): // CT_LineStyleList
- return new LineStyleListContext( *this, mrTheme.getLineStyleList() );
+ return new LineStyleListContext( *this, mrOoxTheme.getLineStyleList() );
case A_TOKEN( effectStyleLst ): // CT_EffectStyleList
- return new EffectStyleListContext( *this, mrTheme.getEffectStyleList() );
+ return new EffectStyleListContext( *this, mrOoxTheme.getEffectStyleList() );
case A_TOKEN( bgFillStyleLst ): // CT_BackgroundFillStyleList
- return new FillStyleListContext( *this, mrTheme.getBgFillStyleList() );
+ return new FillStyleListContext( *this, mrOoxTheme.getBgFillStyleList() );
}
return nullptr;
}
diff --git a/oox/source/drawingml/themefragmenthandler.cxx b/oox/source/drawingml/themefragmenthandler.cxx
index db2d6677567d..baaec066219b 100644
--- a/oox/source/drawingml/themefragmenthandler.cxx
+++ b/oox/source/drawingml/themefragmenthandler.cxx
@@ -26,11 +26,13 @@
using namespace ::oox::core;
-namespace oox::drawingml {
+namespace oox::drawingml
+{
-ThemeFragmentHandler::ThemeFragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, Theme& rTheme ) :
- FragmentHandler2( rFilter, rFragmentPath ),
- mrTheme( rTheme )
+ThemeFragmentHandler::ThemeFragmentHandler(XmlFilterBase& rFilter, const OUString& rFragmentPath, Theme& rOoxTheme, model::Theme& rTheme)
+ : FragmentHandler2(rFilter, rFragmentPath)
+ , mrOoxTheme(rOoxTheme)
+ , mrTheme(rTheme)
{
}
@@ -43,12 +45,12 @@ ContextHandlerRef ThemeFragmentHandler::onCreateContext( sal_Int32 nElement, con
// CT_OfficeStyleSheet
if (getCurrentElement() == A_TOKEN(theme))
{
- switch(nElement)
+ switch (nElement)
{
case A_TOKEN( themeElements ): // CT_BaseStyles
- return new ThemeElementsContext( *this, mrTheme );
+ return new ThemeElementsContext(*this, mrOoxTheme, mrTheme);
case A_TOKEN( objectDefaults ): // CT_ObjectStyleDefaults
- return new objectDefaultContext( *this, mrTheme );
+ return new objectDefaultContext(*this, mrOoxTheme);
case A_TOKEN( extraClrSchemeLst ): // CT_ColorSchemeList
return nullptr;
case A_TOKEN( custClrLst ): // CustomColorList
@@ -69,7 +71,7 @@ void ThemeFragmentHandler::onStartElement(const AttributeList& rAttribs)
{
if (getCurrentElement() == A_TOKEN(theme))
{
- mrTheme.setThemeName(rAttribs.getStringDefaulted(XML_name));
+ mrOoxTheme.setThemeName(rAttribs.getStringDefaulted(XML_name));
}
}
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index c3bfc9cab9e2..b8906c735d16 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -351,9 +351,9 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage
Reference<xml::dom::XDocument> xDoc=
rFilter.importFragment(aThemeFragmentPath);
+ model::Theme aTheme;
rFilter.importFragment(
- new ThemeFragmentHandler(
- rFilter, aThemeFragmentPath, *pThemePtr ),
+ new ThemeFragmentHandler(rFilter, aThemeFragmentPath, *pThemePtr, aTheme),
Reference<xml::sax::XFastSAXSerializable>(
xDoc,
UNO_QUERY_THROW));
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index a0d10e12bbc9..b6d4bcab0345 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -280,8 +280,9 @@ void SAL_CALL ShapeContextHandler::startFastElement
if(!aThemeFragmentPath.isEmpty())
{
+ model::Theme aTheme;
uno::Reference<xml::sax::XFastSAXSerializable> xDoc(mxShapeFilterBase->importFragment(aThemeFragmentPath), uno::UNO_QUERY_THROW);
- mxShapeFilterBase->importFragment(new ThemeFragmentHandler(*mxShapeFilterBase, aThemeFragmentPath, *mpThemePtr ), xDoc);
+ mxShapeFilterBase->importFragment(new ThemeFragmentHandler(*mxShapeFilterBase, aThemeFragmentPath, *mpThemePtr, aTheme), xDoc);
mxShapeFilterBase->setCurrentTheme(mpThemePtr);
}
}
diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk
index 84b6e5fd5edd..5590a4ab7605 100644
--- a/sc/Library_scfilt.mk
+++ b/sc/Library_scfilt.mk
@@ -44,6 +44,7 @@ $(eval $(call gb_Library_use_libraries,scfilt,\
cppu \
cppuhelper \
drawinglayer \
+ docmodel \
editeng \
for \
msfilter \
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index 2702335ddbbf..03abe07d6575 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -349,8 +349,9 @@ void WorkbookFragment::finalizeImport()
// read the theme substream
OUString aThemeFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( u"theme" );
+ model::Theme aTheme;
if( !aThemeFragmentPath.isEmpty() )
- importOoxFragment( new ThemeFragmentHandler( getFilter(), aThemeFragmentPath, getTheme() ) );
+ importOoxFragment(new ThemeFragmentHandler(getFilter(), aThemeFragmentPath, getTheme(), aTheme));
xGlobalSegment->setPosition( 0.25 );
// read the styles substream (requires finalized theme buffer)
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.cxx
index a976453ba911..09432d1d4381 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.cxx
@@ -46,7 +46,7 @@ void OOXMLFastContextHandlerTheme::lcl_startFastElement(
getDocument()->setTheme(pThemePtr);
}
mpThemeFragmentHandler = new oox::drawingml::ThemeFragmentHandler(
- *xThemeFilterBase, aThemeFragmentPath, *pThemePtr);
+ *xThemeFilterBase, aThemeFragmentPath, *pThemePtr, maTheme);
}
if (mpThemeFragmentHandler.is())
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.hxx
index 2de6b75590f0..c0b11bcae084 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.hxx
@@ -9,7 +9,7 @@
#pragma once
-#include <set>
+#include <docmodel/theme/Theme.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
@@ -24,7 +24,9 @@ namespace writerfilter::ooxml
{
class OOXMLFastContextHandlerTheme : public OOXMLFastContextHandler
{
+private:
rtl::Reference<oox::drawingml::ThemeFragmentHandler> mpThemeFragmentHandler;
+ model::Theme maTheme;
public:
explicit OOXMLFastContextHandlerTheme(OOXMLFastContextHandler* pContext);