[Libreoffice-commits] core.git: sc/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sat Dec 19 22:05:46 UTC 2020
sc/source/ui/app/inputwin.cxx | 26 +++++++++++++-------------
sc/source/ui/inc/inputwin.hxx | 2 +-
2 files changed, 14 insertions(+), 14 deletions(-)
New commits:
commit 6c161bfe61679194d5f09d83c0bf8f780b508d1f
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Dec 18 21:08:27 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Dec 19 23:05:10 2020 +0100
weld autosum menu
Change-Id: Ie08e8ae6691e2f84eca69cd7e70a7e2c2c53f9a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107984
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
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 );
More information about the Libreoffice-commits
mailing list