diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-12-18 21:08:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-12-19 23:05:10 +0100 |
commit | 6c161bfe61679194d5f09d83c0bf8f780b508d1f (patch) | |
tree | c5a77621358d397491ed38d58c44819af47f3cc6 | |
parent | 2344f7a25a2961434f7d7c65bfb93bbdaf913f9a (diff) |
weld autosum menu
Change-Id: Ie08e8ae6691e2f84eca69cd7e70a7e2c2c53f9a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107984
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 26 | ||||
-rw-r--r-- | sc/source/ui/inc/inputwin.hxx | 2 |
2 files changed, 14 insertions, 14 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 6776662ac5a5..aec31c9f8834 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -42,6 +42,7 @@ #include <vcl/settings.hxx> #include <svl/stritem.hxx> #include <vcl/svapp.hxx> +#include <vcl/weldutils.hxx> #include <unotools/charclass.hxx> #include <inputwin.hxx> @@ -986,38 +987,36 @@ void ScInputBarGroup::DecrementVerticalSize() } } -IMPL_LINK( ScInputWindow, MenuHdl, Menu *, pMenu, bool ) +void ScInputWindow::MenuHdl(std::string_view command) { - OString aCommand = pMenu->GetCurItemIdent(); - if (!aCommand.isEmpty()) + if (!command.empty()) { bool bSubTotal = false; bool bRangeFinder = false; OpCode eCode = ocSum; - if ( aCommand == "sum" ) + if ( command == "sum" ) { eCode = ocSum; } - else if ( aCommand == "average" ) + else if ( command == "average" ) { eCode = ocAverage; } - else if ( aCommand == "max" ) + else if ( command == "max" ) { eCode = ocMax; } - else if ( aCommand == "min" ) + else if ( command == "min" ) { eCode = ocMin; } - else if ( aCommand == "count" ) + else if ( command == "count" ) { eCode = ocCount; } AutoSum( bRangeFinder, bSubTotal, eCode ); } - return false; } IMPL_LINK_NOARG(ScInputWindow, DropdownClickHdl, ToolBox *, void) @@ -1026,10 +1025,11 @@ IMPL_LINK_NOARG(ScInputWindow, DropdownClickHdl, ToolBox *, void) EndSelection(); if (nCurID == SID_INPUT_SUM) { - VclBuilder aBuilder(nullptr, AllSettings::GetUIRootDir(), "modules/scalc/ui/autosum.ui", ""); - VclPtr<PopupMenu> aPopMenu(aBuilder.get_menu("menu")); - aPopMenu->SetSelectHdl(LINK(this, ScInputWindow, MenuHdl)); - aPopMenu->Execute(this, GetItemRect(SID_INPUT_SUM), PopupMenuFlags::NoMouseUpClose); + tools::Rectangle aRect(GetItemRect(SID_INPUT_SUM)); + weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, "modules/scalc/ui/autosum.ui")); + std::unique_ptr<weld::Menu> xPopMenu(xBuilder->weld_menu("menu")); + MenuHdl(xPopMenu->popup_at_rect(pPopupParent, aRect)); } } diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx index 32717bf17cba..e5556b030501 100644 --- a/sc/source/ui/inc/inputwin.hxx +++ b/sc/source/ui/inc/inputwin.hxx @@ -332,7 +332,7 @@ public: void NotifyLOKClient(); - DECL_LINK( MenuHdl, Menu *, bool ); + void MenuHdl(std::string_view command); DECL_LINK( DropdownClickHdl, ToolBox*, void ); void AutoSum( bool& bRangeFinder, bool& bSubTotal, OpCode eCode ); |