From d150b7a60d7be4b09a838ae4c038e78509f75126 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Sat, 26 Aug 2023 15:35:40 +0200 Subject: Change theme location to SdrModel and SdrPage (master page only) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- sd/qa/unit/ThemeTest.cxx | 2 +- sd/source/core/ThemeColorChanger.cxx | 4 ++-- sd/source/filter/eppt/pptx-epptooxml.cxx | 2 +- sd/source/ui/docshell/docshell.cxx | 4 ++-- sd/source/ui/unoidl/unopage.cxx | 8 ++++---- sd/source/ui/view/drviews2.cxx | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'sd') 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 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 const& pColorSet) { - auto pTheme = pMasterPage->getSdrPageProperties().GetTheme(); + auto pTheme = pMasterPage->getSdrPageProperties().getTheme(); if (!pTheme) { pTheme = std::make_shared("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 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(*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 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 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(GetFrameWeld(), pTheme.get()); auto* pDocShell = GetDocSh(); weld::DialogController::runAsync(pDialog, [pDialog, pMasterPage, pDocShell](sal_uInt32 nResult) -- cgit