summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-08-26 15:35:40 +0200
committerTomaž Vajngerl <quikee@gmail.com>2023-08-27 12:15:14 +0200
commitd150b7a60d7be4b09a838ae4c038e78509f75126 (patch)
tree61aaf42cd7f8698415beed1bf51a71c0b6f5865d /sd
parent8496f805da8ea9f2585b7485b448dda52557db9a (diff)
Change theme location to SdrModel and SdrPage (master page only)
In Writer and Calc we only have one theme per document, so the theme can be stored inside the SdrModel. For Imporess/Draw the theme is defined per master page, so it needs to be stored on the master page. This changes the implementation to reflect that. In addition refactor all the usages in writer and calc to get and set the theme to SdrModel, when needed and rename the methods on the SdrPageProperties from {Get,Set}Theme to {get,set}Theme. Change-Id: I0cc3b332c029c28d15f8cda748c578c2a54a5c61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156128 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/ThemeTest.cxx2
-rw-r--r--sd/source/core/ThemeColorChanger.cxx4
-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/unoidl/unopage.cxx8
-rw-r--r--sd/source/ui/view/drviews2.cxx2
6 files changed, 11 insertions, 11 deletions
diff --git a/sd/qa/unit/ThemeTest.cxx b/sd/qa/unit/ThemeTest.cxx
index 1b4f24249b9b..3a12ce69ca35 100644
--- a/sd/qa/unit/ThemeTest.cxx
+++ b/sd/qa/unit/ThemeTest.cxx
@@ -133,7 +133,7 @@ CPPUNIT_TEST_FIXTURE(ThemeTest, testThemeChange)
css::uno::Reference<css::drawing::XDrawPage> xDrawPageMaster(xMasterPage, uno::UNO_QUERY);
CPPUNIT_ASSERT(xDrawPageMaster.is());
auto* pMasterPage = GetSdrPageFromXDrawPage(xDrawPageMaster);
- auto pTheme = pMasterPage->getSdrPageProperties().GetTheme();
+ auto pTheme = pMasterPage->getSdrPageProperties().getTheme();
sd::ThemeColorChanger aChanger(pMasterPage, pDocShell);
aChanger.apply(pTheme->getColorSet());
diff --git a/sd/source/core/ThemeColorChanger.cxx b/sd/source/core/ThemeColorChanger.cxx
index a506762708f1..020bc1455f6c 100644
--- a/sd/source/core/ThemeColorChanger.cxx
+++ b/sd/source/core/ThemeColorChanger.cxx
@@ -41,11 +41,11 @@ namespace
{
void changeTheTheme(SdrPage* pMasterPage, std::shared_ptr<model::ColorSet> const& pColorSet)
{
- auto pTheme = pMasterPage->getSdrPageProperties().GetTheme();
+ auto pTheme = pMasterPage->getSdrPageProperties().getTheme();
if (!pTheme)
{
pTheme = std::make_shared<model::Theme>("Office");
- pMasterPage->getSdrPageProperties().SetTheme(pTheme);
+ pMasterPage->getSdrPageProperties().setTheme(pTheme);
}
pTheme->setColorSet(pColorSet);
}
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 8c0e7f740437..9a77780614d4 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1519,7 +1519,7 @@ void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 nPageNum, Reference< XPro
model::Theme* pTheme = nullptr;
if (pMasterPage)
{
- pTheme = pMasterPage->getSdrPageProperties().GetTheme().get();
+ 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 40c2fbc97a8e..705e293974b2 100644
--- a/sd/source/ui/docshell/docshell.cxx
+++ b/sd/source/ui/docshell/docshell.cxx
@@ -491,9 +491,9 @@ std::shared_ptr<model::ColorSet> DrawDocShell::GetThemeColors()
return {};
SdPage* pPage = pViewShell->getCurrentPage();
- auto pTheme = pPage->getSdrPageProperties().GetTheme();
+ auto pTheme = pPage->getSdrPageProperties().getTheme();
if (!pPage->IsMasterPage())
- pTheme = pPage->TRG_GetMasterPage().getSdrPageProperties().GetTheme();
+ pTheme = pPage->TRG_GetMasterPage().getSdrPageProperties().getTheme();
if (!pTheme)
return {};
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index ee95c853d37c..17080d0532b2 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -985,7 +985,7 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName
if (aValue >>= xTheme)
{
auto& rUnoTheme = dynamic_cast<UnoTheme&>(*xTheme);
- pPage->getSdrPageProperties().SetTheme(rUnoTheme.getTheme());
+ pPage->getSdrPageProperties().setTheme(rUnoTheme.getTheme());
}
break;
}
@@ -994,7 +994,7 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName
{
SdrPage* pPage = GetPage();
std::shared_ptr<model::Theme> pTheme = model::Theme::FromAny(aValue);
- pPage->getSdrPageProperties().SetTheme(pTheme);
+ pPage->getSdrPageProperties().setTheme(pTheme);
break;
}
@@ -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 pTheme = pPage->getSdrPageProperties().getTheme();
if (pTheme)
xTheme = model::theme::createXTheme(pTheme);
aAny <<= xTheme;
@@ -1326,7 +1326,7 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
case WID_PAGE_THEME_UNO_REPRESENTATION:
{
SdrPage* pPage = GetPage();
- auto pTheme = pPage->getSdrPageProperties().GetTheme();
+ auto pTheme = pPage->getSdrPageProperties().getTheme();
if (pTheme)
pTheme->ToAny(aAny);
else
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 2fea8a46f879..4dc14204b53d 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -3551,7 +3551,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
case SID_THEME_DIALOG:
{
SdrPage* pMasterPage = &GetActualPage()->TRG_GetMasterPage();
- auto pTheme = pMasterPage->getSdrPageProperties().GetTheme();
+ auto pTheme = pMasterPage->getSdrPageProperties().getTheme();
auto pDialog = std::make_shared<svx::ThemeDialog>(GetFrameWeld(), pTheme.get());
auto* pDocShell = GetDocSh();
weld::DialogController::runAsync(pDialog, [pDialog, pMasterPage, pDocShell](sal_uInt32 nResult)