diff options
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/XMLThemeContext.hxx | 6 | ||||
-rw-r--r-- | xmloff/source/style/XMLThemeContext.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/style/xmlstyle.cxx | 22 |
3 files changed, 19 insertions, 15 deletions
diff --git a/xmloff/inc/XMLThemeContext.hxx b/xmloff/inc/XMLThemeContext.hxx index ce6f5ec9bbb6..f8ee08d5d4e8 100644 --- a/xmloff/inc/XMLThemeContext.hxx +++ b/xmloff/inc/XMLThemeContext.hxx @@ -10,7 +10,7 @@ #include <utility> #include <xmloff/xmlprcon.hxx> -#include <com/sun/star/drawing/XDrawPage.hpp> +#include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/util/Color.hpp> #include <com/sun/star/container/XNameContainer.hpp> @@ -24,13 +24,13 @@ class Theme; /// Imports the theme class XMLThemeContext : public SvXMLImportContext { - css::uno::Reference<css::drawing::XDrawPage> m_xPage; + css::uno::Reference<css::uno::XInterface> m_xObject; std::shared_ptr<model::Theme> mpTheme; public: XMLThemeContext(SvXMLImport& rImport, css::uno::Reference<css::xml::sax::XFastAttributeList> const& xAttrList, - css::uno::Reference<css::drawing::XDrawPage> const& xPage); + css::uno::Reference<css::uno::XInterface> const& xObject); ~XMLThemeContext(); css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext( diff --git a/xmloff/source/style/XMLThemeContext.cxx b/xmloff/source/style/XMLThemeContext.cxx index 1579af468003..5c210c7a48dc 100644 --- a/xmloff/source/style/XMLThemeContext.cxx +++ b/xmloff/source/style/XMLThemeContext.cxx @@ -33,9 +33,9 @@ using namespace xmloff::token; XMLThemeContext::XMLThemeContext(SvXMLImport& rImport, const uno::Reference<xml::sax::XFastAttributeList>& xAttrList, - css::uno::Reference<css::drawing::XDrawPage> const& xPage) + css::uno::Reference<css::uno::XInterface> const& xObject) : SvXMLImportContext(rImport) - , m_xPage(xPage) + , m_xObject(xObject) , mpTheme(new model::Theme) { for (const auto& rAttribute : sax_fastparser::castToFastAttributeList(xAttrList)) @@ -56,7 +56,7 @@ XMLThemeContext::~XMLThemeContext() { if (mpTheme && mpTheme->getColorSet()) { - uno::Reference<beans::XPropertySet> xPropertySet(m_xPage, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet(m_xObject, uno::UNO_QUERY); auto xTheme = model::theme::createXTheme(mpTheme); xPropertySet->setPropertyValue("Theme", uno::Any(xTheme)); } diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index d0dc368870a2..5158b43592cd 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -683,22 +683,26 @@ SvXMLStylesContext::~SvXMLStylesContext() css::uno::Reference< css::xml::sax::XFastContextHandler > SvXMLStylesContext::createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { - SvXMLStyleContext* pStyle = CreateStyleChildContext( nElement, xAttrList ); - if (pStyle) - { - if (!pStyle->IsTransient()) - mpImpl->AddStyle(pStyle); - return pStyle; - } - else if (nElement == XML_ELEMENT(LO_EXT, XML_THEME)) + if (nElement == XML_ELEMENT(LO_EXT, XML_THEME)) { + uno::Reference<uno::XInterface> xObject(GetImport().GetModel(), uno::UNO_QUERY); uno::Reference<drawing::XDrawPageSupplier> const xDrawPageSupplier(GetImport().GetModel(), uno::UNO_QUERY); if (xDrawPageSupplier.is()) { uno::Reference<drawing::XDrawPage> xPage = xDrawPageSupplier->getDrawPage(); if (xPage.is()) - return new XMLThemeContext(GetImport(), xAttrList, xPage); + xObject = xPage; } + + return new XMLThemeContext(GetImport(), xAttrList, xObject); + } + + SvXMLStyleContext* pStyle = CreateStyleChildContext( nElement, xAttrList ); + if (pStyle) + { + if (!pStyle->IsTransient()) + mpImpl->AddStyle(pStyle); + return pStyle; } return nullptr; |