sc/sdi/tabvwsh.sdi                    |    1 +
 sc/source/ui/view/tabvwsh3.cxx        |   33 ++++++++++++++++++++++++++++++++-
 sc/uiconfig/scalc/menubar/menubar.xml |    1 +
 3 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 75339c04dabb1d347fc06b249e6a29c38c477e60
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri May 5 23:10:14 2023 +0900
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Aug 11 09:05:04 2023 +0200

    sc: add ThemeDialog to the main menu
    
    Change-Id: I677aac5fdc8f493dcd8190c12e4e44ba09d3eb9d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151450
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155510
    Tested-by: Miklos Vajna <vmik...@collabora.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sc/sdi/tabvwsh.sdi b/sc/sdi/tabvwsh.sdi
index 50049bad7abc..f001395dde9b 100644
--- a/sc/sdi/tabvwsh.sdi
+++ b/sc/sdi/tabvwsh.sdi
@@ -184,6 +184,7 @@ interface TableEditView
     SID_JUMPTOMARK      [ ExecMethod = Execute; StateMethod = NoState; ] // 
status(final|play)
 
     SID_PRINTPREVIEW    [ ExecMethod = Execute; StateMethod = GetState; ]
+    SID_THEME_DIALOG    [ ExecMethod = Execute; StateMethod = GetState; ]
 
 
     // search/replace
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index ec19d4c1d4a6..8e0695a29d20 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -59,6 +59,11 @@
 
 #include <basegfx/utils/zoomtools.hxx>
 
+#include <svx/svdpagv.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/dialog/ThemeDialog.hxx>
+#include <svx/theme/ThemeColorChanger.hxx>
+
 namespace
 {
     void collectUIInformation(const OUString& aZoom)
@@ -1335,7 +1340,33 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
             SelectionChanged();
         }
         break;
-
+        case SID_THEME_DIALOG:
+        {
+            MakeDrawLayer();
+            ScTabView* pTabView = GetViewData().GetView();
+            ScDrawView* pView = pTabView->GetScDrawView();
+            SdrPage* pPage = pView->GetSdrPageView()->GetPage();
+            auto const& pTheme = pPage->getSdrPageProperties().GetTheme();
+            if (pTheme)
+            {
+                ScViewData& rViewData = GetViewData();
+                vcl::Window* pWin = rViewData.GetActiveWin();
+                auto pDialog = std::make_shared<svx::ThemeDialog>(pWin ? 
pWin->GetFrameWeld() : nullptr, pTheme.get());
+                weld::DialogController::runAsync(pDialog, [pDialog, 
pPage](sal_uInt32 nResult) {
+                    if (RET_OK != nResult)
+                        return;
+
+                    auto pColorSet = pDialog->getCurrentColorSet();
+                    if (pColorSet)
+                    {
+                        svx::ThemeColorChanger aChanger(pPage);
+                        aChanger.apply(pColorSet);
+                    }
+                });
+            }
+            rReq.Done();
+        }
+        break;
         case SID_OPT_LOCALE_CHANGED :
             {   // locale changed, SYSTEM number formats changed => repaint 
cell contents
                 PaintGrid();
diff --git a/sc/uiconfig/scalc/menubar/menubar.xml 
b/sc/uiconfig/scalc/menubar/menubar.xml
index 8c732452103d..121249b5fba6 100644
--- a/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/sc/uiconfig/scalc/menubar/menubar.xml
@@ -422,6 +422,7 @@
       <menu:menuitem menu:id=".uno:ConditionalFormatMenu"/>
       <menu:menuitem menu:id=".uno:AutoFormat"/>
       <menu:menuitem menu:id=".uno:ChooseDesign"/>
+      <menu:menuitem menu:id=".uno:ThemeDialog"/>
       <menu:menuseparator/>
       <menu:menu menu:id=".uno:FormatImageMenu">
         <menu:menupopup>

Reply via email to