sc/sdi/tabvwsh.sdi | 1 + sc/source/ui/view/tabvwsh3.cxx | 34 +++++++++++++++++++++++++++++++++- sc/uiconfig/scalc/menubar/menubar.xml | 1 + 3 files changed, 35 insertions(+), 1 deletion(-)
New commits: commit 7f46e701f25e8eef1572e94d092170e0d793dc87 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri May 5 23:10:14 2023 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu May 11 18:09:14 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> diff --git a/sc/sdi/tabvwsh.sdi b/sc/sdi/tabvwsh.sdi index b10d42bdb7f3..e1da8b2f5d14 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 5c41a4e49b75..da061b14e57b 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,34 @@ 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 oColorSet = pDialog->getCurrentColorSet(); + if (oColorSet) + { + auto& rColorSet = (*oColorSet).get(); + svx::ThemeColorChanger aChanger(pPage); + aChanger.apply(rColorSet); + } + }); + } + 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 7b51b4b8d816..413e2e5ce11c 100644 --- a/sc/uiconfig/scalc/menubar/menubar.xml +++ b/sc/uiconfig/scalc/menubar/menubar.xml @@ -421,6 +421,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>