svx/source/svdraw/svdotextdecomposition.cxx | 14 +++++++++++++- svx/source/svdraw/svdpage.cxx | 18 +++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-)
New commits: commit c617e551c23f00b1b89de44cdb3f551ee69f3712 Author: Gökay Şatır <gokaysa...@collabora.com> AuthorDate: Tue Oct 22 12:00:59 2024 +0300 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu Oct 24 10:23:42 2024 +0200 In dark mode, configuration of master page is checked for auto color. This works for standart pages. But notes pages don't have a style property in their master pages. This commit, when libreofficeKit is active, uses corresponding standart page's master page properties for notes pages. Used only for background colors. Signed-off-by: Gökay Şatır <gokaysa...@collabora.com> Change-Id: Ib1115a4fbc87ecd94f9bb44b43268b9578734950 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175380 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 5a9abfe654b3..0df2384c6639 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -62,6 +62,7 @@ #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <sal/log.hxx> #include <osl/diagnose.h> +#include <comphelper/lok.hxx> using namespace com::sun::star; @@ -1050,7 +1051,18 @@ const SfxItemSet* SdrObject::getBackgroundFillSet() const { if (!pOwnerPage->IsMasterPage() && pOwnerPage->TRG_HasMasterPage()) { - pBackgroundFillSet = &pOwnerPage->TRG_GetMasterPage().getSdrPageProperties().GetItemSet(); + // See unomodel.cxx: "It is guaranteed, that after a standard page the corresponding notes page follows." + bool notesPage = pOwnerPage->GetPageNum() % 2 == 0; + + if (!comphelper::LibreOfficeKit::isActive() || !notesPage || !pOwnerPage->getSdrModelFromSdrPage().IsImpress()) + pBackgroundFillSet = &pOwnerPage->TRG_GetMasterPage().getSdrPageProperties().GetItemSet(); + else { + // See sdrmasterpagedescriptor.cxx: e.g. the Notes MasterPage has no StyleSheet set (and there maybe others). + if (pOwnerPage->getSdrModelFromSdrPage().GetPage(pOwnerPage->GetPageNum() - 1)) + pBackgroundFillSet = &pOwnerPage->getSdrModelFromSdrPage().GetPage(pOwnerPage->GetPageNum() - 1)->TRG_GetMasterPage().getSdrPageProperties().GetItemSet(); + else + pBackgroundFillSet = &pOwnerPage->TRG_GetMasterPage().getSdrPageProperties().GetItemSet(); + } } } } diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index eefed8094632..c2dd4f67364c 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1829,7 +1829,23 @@ Color SdrPage::GetPageBackgroundColor( SdrPageView const * pView, bool bScreenDi { if(drawing::FillStyle_NONE == pBackgroundFill->Get(XATTR_FILLSTYLE).GetValue()) { - pBackgroundFill = &TRG_GetMasterPage().getSdrPageProperties().GetItemSet(); + // See unomodel.cxx: "It is guaranteed, that after a standard page the corresponding notes page follows." + bool notesPage = GetPageNum() % 2 == 0; + + if (!comphelper::LibreOfficeKit::isActive() || !notesPage || !getSdrModelFromSdrPage().IsImpress()) + pBackgroundFill = &TRG_GetMasterPage().getSdrPageProperties().GetItemSet(); + else + { + /* + See sdrmasterpagedescriptor.cxx: e.g. the Notes MasterPage has no StyleSheet set (and there maybe others). + */ + + // This is a notes page. Try to get itemset from standart page's master. + if (getSdrModelFromSdrPage().GetPage(GetPageNum() - 1)) + pBackgroundFill = &getSdrModelFromSdrPage().GetPage(GetPageNum() - 1)->TRG_GetMasterPage().getSdrPageProperties().GetItemSet(); + else + pBackgroundFill = &TRG_GetMasterPage().getSdrPageProperties().GetItemSet(); + } } }