summaryrefslogtreecommitdiff
path: root/xmloff/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-02-25 19:12:23 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-04-26 08:37:52 +0900
commit20be2e563c10b79252742c7bae0f3a2c37ab2c78 (patch)
tree4f636f0ebac4121a3235bb4c31d2ad2ab89688a0 /xmloff/source
parent82080d9aee1fd84ad1be7934794fbf6e77f0a333 (diff)
use shared_ptr for model::Theme instead of unique_ptr
Also change other cases to use the shared_ptr so there is no need to do copies and replace some of docmodel/theme/Theme.hxximports with forward declarations. Change-Id: I4588cb25e05e5f3e535011fffb68a8075b05aecc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147691 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 4f347ebabad6355014889f0a81b107dc774590fe)
Diffstat (limited to 'xmloff/source')
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx9
-rw-r--r--xmloff/source/style/XMLThemeContext.cxx8
2 files changed, 10 insertions, 7 deletions
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 0e7fc6160867..07d021912980 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -74,6 +74,7 @@
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/util/Color.hpp>
#include <docmodel/uno/UnoTheme.hxx>
+#include <docmodel/theme/Theme.hxx>
#include <o3tl/enumrange.hxx>
using namespace ::com::sun::star;
@@ -2386,13 +2387,13 @@ void SdXMLExport::ExportThemeElement(const uno::Reference<drawing::XDrawPage>& x
if (!pUnoTheme)
return;
- auto const& rTheme = pUnoTheme->getTheme();
+ auto pTheme = pUnoTheme->getTheme();
- if (!rTheme.GetName().isEmpty())
- AddAttribute(XML_NAMESPACE_LO_EXT, XML_NAME, rTheme.GetName());
+ if (!pTheme->GetName().isEmpty())
+ AddAttribute(XML_NAMESPACE_LO_EXT, XML_NAME, pTheme->GetName());
SvXMLElementExport aTheme(*this, XML_NAMESPACE_LO_EXT, XML_THEME, true, true);
- auto* pColorSet = rTheme.GetColorSet();
+ auto* pColorSet = pTheme->GetColorSet();
if (!pColorSet->getName().isEmpty())
AddAttribute(XML_NAMESPACE_LO_EXT, XML_NAME, pColorSet->getName());
SvXMLElementExport aColorTable(*this, XML_NAMESPACE_LO_EXT, XML_COLOR_TABLE, true, true);
diff --git a/xmloff/source/style/XMLThemeContext.cxx b/xmloff/source/style/XMLThemeContext.cxx
index 8a9a5cdbc558..e35aed99c46f 100644
--- a/xmloff/source/style/XMLThemeContext.cxx
+++ b/xmloff/source/style/XMLThemeContext.cxx
@@ -26,6 +26,7 @@
#include <comphelper/sequence.hxx>
#include <docmodel/uno/UnoTheme.hxx>
+#include <docmodel/theme/Theme.hxx>
using namespace css;
using namespace xmloff::token;
@@ -35,6 +36,7 @@ XMLThemeContext::XMLThemeContext(SvXMLImport& rImport,
css::uno::Reference<css::drawing::XDrawPage> const& xPage)
: SvXMLImportContext(rImport)
, m_xPage(xPage)
+ , mpTheme(new model::Theme)
{
for (const auto& rAttribute : sax_fastparser::castToFastAttributeList(xAttrList))
{
@@ -43,7 +45,7 @@ XMLThemeContext::XMLThemeContext(SvXMLImport& rImport,
case XML_ELEMENT(LO_EXT, XML_NAME):
{
OUString aName = rAttribute.toString();
- maTheme.SetName(aName);
+ mpTheme->SetName(aName);
break;
}
}
@@ -53,7 +55,7 @@ XMLThemeContext::XMLThemeContext(SvXMLImport& rImport,
XMLThemeContext::~XMLThemeContext()
{
uno::Reference<beans::XPropertySet> xPropertySet(m_xPage, uno::UNO_QUERY);
- uno::Reference<util::XTheme> xTheme(new UnoTheme(maTheme));
+ auto xTheme = model::theme::createXTheme(mpTheme);
xPropertySet->setPropertyValue("Theme", uno::Any(xTheme));
}
@@ -62,7 +64,7 @@ uno::Reference<xml::sax::XFastContextHandler> SAL_CALL XMLThemeContext::createFa
{
if (nElement == XML_ELEMENT(LO_EXT, XML_COLOR_TABLE))
{
- return new XMLColorTableContext(GetImport(), xAttribs, maTheme);
+ return new XMLColorTableContext(GetImport(), xAttribs, *mpTheme);
}
return nullptr;