diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-08-31 08:11:18 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-09-01 07:29:02 +0200 |
commit | 70663f464b24f223c4174681b9a469d9f554bcee (patch) | |
tree | 4edc9645201768665d48c7b54fb0b33e216f9261 /sd | |
parent | d88779fc86385dde1215fd28b78a69eacc6b4f97 (diff) |
sd: set the theme for all master pages
It can be annoying for the user to set the theme one by one for
each master page. The reason for this is that in MSO the master
slide (which contains the theme) has multiple layouts, which are
converted to master pages in LO. As LO doesn't group master pages
together the theme is defined on each master page, so it is needed
to change each master page one by one.
Change-Id: I94d75246ca012bbbb005ab376446c0941b8f57ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156361
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/ThemeColorChanger.cxx | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/sd/source/core/ThemeColorChanger.cxx b/sd/source/core/ThemeColorChanger.cxx index adfacb6a47ac..3a5c7804ae57 100644 --- a/sd/source/core/ThemeColorChanger.cxx +++ b/sd/source/core/ThemeColorChanger.cxx @@ -154,31 +154,35 @@ void ThemeColorChanger::apply(std::shared_ptr<model::ColorSet> const& pColorSet) { SdrPage* pCurrentPage = rModel.GetPage(nPage); - // Skip pages that are using a different master page - if (!pCurrentPage->TRG_HasMasterPage() - || &pCurrentPage->TRG_GetMasterPage() != mpMasterPage) - continue; - - for (size_t nObject = 0; nObject < pCurrentPage->GetObjCount(); ++nObject) + // TODO - for now change all the objects regardless to which master page it belongs to. + // Currently we don't have a concept of master slide with a group of layouts as in MSO, but we always only + // have master pages, which aren't grouped together. In MSO the theme is defined per master slide, so when + // changing a theme, all the layouts get the new theme, as layouts are synonomus to master pages in LibreOffise, + // this is not possible to do and we would need to change the theme for each master page separately, which + // is just annoying for the user. + + // if (!pCurrentPage->TRG_HasMasterPage() || &pCurrentPage->TRG_GetMasterPage() != mpMasterPage) + // continue; + + SdrObjListIter aIter(pCurrentPage, SdrIterMode::DeepWithGroups); + while (aIter.IsMore()) { - SdrObject* pObject = pCurrentPage->GetObj(nObject); - svx::theme::updateSdrObject(*pColorSet, pObject, pView, pUndoManager); - - // update child objects - SdrObjList* pList = pObject->GetSubList(); - if (pList) - { - SdrObjListIter aIter(pList, SdrIterMode::DeepWithGroups); - while (aIter.IsMore()) - { - svx::theme::updateSdrObject(*pColorSet, aIter.Next(), pView, pUndoManager); - } - } + svx::theme::updateSdrObject(*pColorSet, aIter.Next(), pView, pUndoManager); } } changeThemeColors(mpDocShell, mpMasterPage, pColorSet); + // See the TODO comment a couple of line above for the explanation - need to change the ThemeColors for all master + // pages for now, but the following code will need to be changed in the future when we have the concept similar to + // master slide and layouts + for (sal_uInt16 nPage = 0; nPage < rModel.GetPageCount(); ++nPage) + { + SdrPage* pCurrentPage = rModel.GetPage(nPage); + if (pCurrentPage->IsMasterPage() && pCurrentPage != mpMasterPage) + changeThemeColors(mpDocShell, pCurrentPage, pColorSet); + } + pUndoManager->LeaveListAction(); } |