sc/Library_sc.mk                |    1 +
 sc/Library_scui.mk              |    1 +
 sc/source/ui/docshell/docsh.cxx |   23 +++++++++++++++++++++++
 sc/source/ui/inc/docsh.hxx      |    1 +
 sc/ucalc_setup.mk               |    1 +
 5 files changed, 27 insertions(+)

New commits:
commit 600ad0a53e25beed8b418d477635d0c8513d5d07
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri May 5 23:09:32 2023 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Tue May 9 16:27:17 2023 +0200

    sc: add theme colors to the color picker
    
    Change-Id: Iae8f502a24187f4d41f60fbb727066f214d1cf70
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151449
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 82bab43389c1..141c01fc73b8 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -72,6 +72,7 @@ $(eval $(call gb_Library_use_libraries,sc,\
     dbtools \
     drawinglayercore \
     drawinglayer \
+    docmodel \
     editeng \
     for \
     forui \
diff --git a/sc/Library_scui.mk b/sc/Library_scui.mk
index 02c2bc8244d1..a4c7572734ae 100644
--- a/sc/Library_scui.mk
+++ b/sc/Library_scui.mk
@@ -50,6 +50,7 @@ $(eval $(call gb_Library_use_libraries,scui,\
        comphelper \
        cppu \
        cppuhelper \
+       docmodel \
        editeng \
        for \
        forui \
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index f5d10cfe67ab..3d8647dc8ea8 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -79,6 +79,9 @@
 #include <sot/formats.hxx>
 #include <svx/compatflags.hxx>
 #include <svx/dialogs.hrc>
+#include <svx/svdpagv.hxx>
+#include <svx/svdpage.hxx>
+#include <docmodel/theme/Theme.hxx>
 
 #include <formulacell.hxx>
 #include <global.hxx>
@@ -215,6 +218,26 @@ std::set<Color> ScDocShell::GetDocColors()
     return m_pDocument->GetDocColors();
 }
 
+std::vector<Color> ScDocShell::GetThemeColors()
+{
+    ScTabViewShell* pSh = GetBestViewShell();
+    if (!pSh)
+        return {};
+    ScTabView* pTabView = pSh->GetViewData().GetView();
+    if (!pTabView)
+        return {};
+    ScDrawView* pView = pTabView->GetScDrawView();
+    if (!pView)
+        return {};
+    SdrPage* pPage = pView->GetSdrPageView()->GetPage();
+    if (!pPage)
+        return {};
+    auto const& pTheme = pPage->getSdrPageProperties().GetTheme();
+    if (!pTheme)
+        return {};
+    return pTheme->GetColors();
+}
+
 void ScDocShell::DoEnterHandler()
 {
     ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index d92c93e73ff3..5c8484a2fd32 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -181,6 +181,7 @@ public:
                                bool bTemplate = false ) const override;
 
     virtual std::set<Color> GetDocColors() override;
+    virtual std::vector<Color> GetThemeColors() override;
 
     virtual bool    InitNew( const css::uno::Reference< css::embed::XStorage 
>& ) override;
     virtual bool    Load( SfxMedium& rMedium ) override;
diff --git a/sc/ucalc_setup.mk b/sc/ucalc_setup.mk
index 9a2323572611..63351a87aa28 100644
--- a/sc/ucalc_setup.mk
+++ b/sc/ucalc_setup.mk
@@ -47,6 +47,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_ucalc$(1), \
     dbtools \
     drawinglayer \
     drawinglayercore \
+    docmodel \
     editeng \
     for \
     forui \

Reply via email to