include/svx/ColorSets.hxx | 2 ++ svx/source/styles/ColorSets.cxx | 5 +++++ sw/source/uibase/sidebar/ThemePanel.cxx | 15 +++++++++++++++ 3 files changed, 22 insertions(+)
New commits: commit 7c10e3b120ba75a2db75342fdc68040a179404b8 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Dec 12 22:26:41 2022 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu Jan 5 05:55:51 2023 +0000 sw: add the ColorSet from SdrPage into ColorSets in ThemePanel Change-Id: I7c4ef103b2be65a8adbad5d4f00304ee22be668f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143997 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx index 718b79b3e66c..3d345b20c1b3 100644 --- a/include/svx/ColorSets.hxx +++ b/include/svx/ColorSets.hxx @@ -99,6 +99,8 @@ public: } const ColorSet& getColorSet(std::u16string_view rName); + + void insert(ColorSet const& rColorSet); }; struct SVXCORE_DLLPUBLIC ThemeSupplementalFont diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx index bb8009fdc5be..5511253f3d03 100644 --- a/svx/source/styles/ColorSets.cxx +++ b/svx/source/styles/ColorSets.cxx @@ -238,6 +238,11 @@ const ColorSet& ColorSets::getColorSet(std::u16string_view rName) return maColorSets[0]; } +void ColorSets::insert(ColorSet const& rColorSet) +{ + maColorSets.push_back(rColorSet); +} + Theme::Theme(OUString const& rName) : maName(rName) { diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx index 14a58b236d91..ad0d74e2b678 100644 --- a/sw/source/uibase/sidebar/ThemePanel.cxx +++ b/sw/source/uibase/sidebar/ThemePanel.cxx @@ -30,6 +30,11 @@ #include <fmtcol.hxx> #include <format.hxx> #include <svx/ColorSets.hxx> +#include <doc.hxx> +#include <IDocumentDrawModelAccess.hxx> +#include <svx/svdpage.hxx> +#include <drawdoc.hxx> + namespace { @@ -442,6 +447,16 @@ ThemePanel::ThemePanel(weld::Widget* pParent) maColorSets.init(); + SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current()); + SwDoc* pDocument = pDocSh->GetDoc(); + if (pDocument) + { + SdrPage* pPage = pDocument->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); + svx::Theme* pTheme = pPage->getSdrPageProperties().GetTheme(); + if (pTheme) + maColorSets.insert(*pTheme->GetColorSet()); + } + const std::vector<svx::ColorSet>& aColorSets = maColorSets.getColorSets(); for (size_t i = 0; i < aColorSets.size(); ++i) {