svx/source/svdraw/svdotextdecomposition.cxx | 14 +++++++++++++- svx/source/svdraw/svdpage.cxx | 19 ++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-)
New commits: commit 9884f7aa793b4bacfd6780db498a2c40e7a134c1 Author: Gökay Şatır <gokaysa...@collabora.com> AuthorDate: Tue Oct 22 12:00:59 2024 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Jan 8 11:31:44 2025 +0100 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. Change-Id: Ib1115a4fbc87ecd94f9bb44b43268b9578734950 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179929 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index c9fd31f04148..be386f0be223 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; @@ -1104,7 +1105,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 c7cf128931cc..6ef5c8123cd7 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -57,6 +57,7 @@ #include <rtl/strbuf.hxx> #include <libxml/xmlwriter.h> #include <docmodel/theme/Theme.hxx> +#include <comphelper/lok.hxx> #include <com/sun/star/lang/IllegalArgumentException.hpp> @@ -1818,7 +1819,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(); + } } }