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 7169596baf030d89d95db63bd78d55dc8072d22b
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Mon Dec 12 22:26:41 2022 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Mon Jan 16 05:33:56 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>
    (cherry picked from commit 7c10e3b120ba75a2db75342fdc68040a179404b8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145399
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index 411b32cfe805..fc727fc529f0 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -93,6 +93,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 bc87f280504f..206f4deda6b0 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -240,6 +240,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 9b70fa53c94f..2f5793b8073c 100644
--- a/sw/source/uibase/sidebar/ThemePanel.cxx
+++ b/sw/source/uibase/sidebar/ThemePanel.cxx
@@ -29,6 +29,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
 {
@@ -441,6 +446,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)
     {

Reply via email to