summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-02-07 16:13:27 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-03-01 00:29:23 +0000
commit4a7a89b97b0b6464f8375926d98044634d06b4ee (patch)
tree669bc858797ac675acebd6ee526dd5ef9213df9e /sd
parent1309e6332d7ff2bd1f9b6bf87385b8b570e59158 (diff)
create a default theme when SdrPage and SdrModel are created
For a document it is expected that it always has a theme available so we need to create a theme with some default attributes set (a default color scheme for now) when we create a SdrModel and SdrPage (only for Writer currently). This also changes some ColorSets, SdrPage, SdrModel methods, to use better return types (cost& instead of raw pointers and vice versa depending on the use case). Change-Id: I874247784b845109e42567e3f45647dda46ccf3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146816 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx2
-rw-r--r--sd/source/ui/docshell/docshell.cxx4
-rw-r--r--sd/source/ui/func/fuconstr.cxx2
-rw-r--r--sd/source/ui/func/fupage.cxx2
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx4
-rw-r--r--sd/source/ui/unoidl/unopage.cxx4
6 files changed, 9 insertions, 9 deletions
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 16208f48fb79..1ae7da9cc786 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1511,7 +1511,7 @@ void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 nPageNum, Reference< XPro
model::Theme* pTheme = nullptr;
if (pMasterPage)
{
- pTheme = pMasterPage->getSdrPageProperties().GetTheme();
+ pTheme = pMasterPage->getSdrPageProperties().GetTheme().get();
}
// write theme per master
diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx
index a8ec35e21cb7..3aacb189f826 100644
--- a/sd/source/ui/docshell/docshell.cxx
+++ b/sd/source/ui/docshell/docshell.cxx
@@ -492,10 +492,10 @@ std::vector<Color> DrawDocShell::GetThemeColors()
}
SdPage* pPage = pViewShell->getCurrentPage();
- model::Theme* pTheme = pPage->getSdrPageProperties().GetTheme();
+ model::Theme* pTheme = pPage->getSdrPageProperties().GetTheme().get();
if (!pPage->IsMasterPage())
{
- pTheme = pPage->TRG_GetMasterPage().getSdrPageProperties().GetTheme();
+ pTheme = pPage->TRG_GetMasterPage().getSdrPageProperties().GetTheme().get();
}
if (!pTheme)
diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx
index ea8443d9183b..eee7094a78f8 100644
--- a/sd/source/ui/func/fuconstr.cxx
+++ b/sd/source/ui/func/fuconstr.cxx
@@ -379,7 +379,7 @@ void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj,
pThemePage = &pThemePage->TRG_GetMasterPage();
}
- model::Theme* pTheme = pThemePage->getSdrPageProperties().GetTheme();
+ auto const& pTheme = pThemePage->getSdrPageProperties().GetTheme();
if (pTheme)
{
// We construct an object on a page where the master page has a theme. Take the
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index 7e353bba1c91..7416916f01e7 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -265,7 +265,7 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest&
if (mpDoc->GetDocumentType() == DocumentType::Impress && mpPage->IsMasterPage())
{
// A master slide may have a theme.
- model::Theme* pTheme = mpPage->getSdrPageProperties().GetTheme();
+ auto const& pTheme = mpPage->getSdrPageProperties().GetTheme();
if (pTheme)
{
uno::Any aTheme;
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index b5c9e64a61bc..230633d66ad1 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1283,7 +1283,7 @@ void SAL_CALL SdXImpressDocument::setPropertyValue( const OUString& aPropertyNam
{
SdrModel& rModel = getSdrModelFromUnoModel();
std::unique_ptr<model::Theme> pTheme = model::Theme::FromAny(aValue);
- rModel.SetTheme(std::move(pTheme));
+ rModel.setTheme(std::move(pTheme));
}
break;
default:
@@ -1409,7 +1409,7 @@ uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& Property
case WID_MODEL_THEME:
{
SdrModel& rModel = getSdrModelFromUnoModel();
- model::Theme* pTheme = rModel.GetTheme();
+ auto const& pTheme = rModel.getTheme();
if (pTheme)
{
pTheme->ToAny(aAny);
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 7b467158651d..b9201adea71d 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -1316,7 +1316,7 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
{
SdrPage* pPage = GetPage();
css::uno::Reference<css::util::XTheme> xTheme;
- auto* pTheme = pPage->getSdrPageProperties().GetTheme();
+ auto const& pTheme = pPage->getSdrPageProperties().GetTheme();
if (pTheme)
xTheme = new UnoTheme(*pTheme);
aAny <<= xTheme;
@@ -1326,7 +1326,7 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
case WID_PAGE_THEME_UNO_REPRESENTATION:
{
SdrPage* pPage = GetPage();
- model::Theme* pTheme = pPage->getSdrPageProperties().GetTheme();
+ auto const& pTheme = pPage->getSdrPageProperties().GetTheme();
if (pTheme)
{
pTheme->ToAny(aAny);