diff options
-rw-r--r-- | include/svx/ColorSets.hxx | 2 | ||||
-rw-r--r-- | svx/source/styles/ColorSets.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/ThemePanel.cxx | 15 |
3 files changed, 22 insertions, 0 deletions
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) { |