diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-02-19 14:49:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-02-19 17:11:09 +0100 |
commit | 58a8289afb507603c6ec00594ffd7fffd859b6be (patch) | |
tree | 91edc8118745065d603da29a113992333ad9dd11 /sw/source/uibase/ribbar/inputwin.cxx | |
parent | 074e969a23be8bf2f5ef21d6997f7a0522c81369 (diff) |
weld inputwinmenu
Change-Id: I84995928412ed45b4b91939b8a0b48906bb3c13b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111223
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase/ribbar/inputwin.cxx')
-rw-r--r-- | sw/source/uibase/ribbar/inputwin.cxx | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx index fb1b082d6747..e4135fd7f6d4 100644 --- a/sw/source/uibase/ribbar/inputwin.cxx +++ b/sw/source/uibase/ribbar/inputwin.cxx @@ -30,6 +30,7 @@ #include <svx/ruler.hxx> #include <svl/stritem.hxx> #include <vcl/event.hxx> +#include <vcl/weldutils.hxx> #include <swtypes.hxx> #include <cmdid.h> @@ -288,15 +289,10 @@ void SwInputWindow::ShowWin() } } -IMPL_LINK( SwInputWindow, MenuHdl, Menu *, pMenu, bool ) +void SwInputWindow::MenuHdl(std::string_view command) { - OString aCommand = pMenu->GetCurItemIdent(); - if (!aCommand.isEmpty()) - { - aCommand += " "; - mxEdit->replace_selection(OStringToOUString(aCommand, RTL_TEXTENCODING_ASCII_US)); - } - return false; + if (!command.empty()) + mxEdit->replace_selection(OUString::fromUtf8(command) + " "); } IMPL_LINK_NOARG(SwInputWindow, DropdownClickHdl, ToolBox *, void) @@ -305,10 +301,11 @@ IMPL_LINK_NOARG(SwInputWindow, DropdownClickHdl, ToolBox *, void) EndSelection(); // reset back CurItemId ! if (nCurID == FN_FORMULA_CALC) { - VclBuilder aBuilder(nullptr, AllSettings::GetUIRootDir(), "modules/swriter/ui/inputwinmenu.ui", ""); - VclPtr<PopupMenu> aPopMenu(aBuilder.get_menu("menu")); - aPopMenu->SetSelectHdl(LINK(this, SwInputWindow, MenuHdl)); - aPopMenu->Execute(this, GetItemRect(FN_FORMULA_CALC), PopupMenuFlags::NoMouseUpClose); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/inputwinmenu.ui")); + std::unique_ptr<weld::Menu> xPopMenu(xBuilder->weld_menu("menu")); + tools::Rectangle aRect(GetItemRect(FN_FORMULA_CALC)); + weld::Window* pParent = weld::GetPopupParent(*this, aRect); + MenuHdl(xPopMenu->popup_at_rect(pParent, aRect)); } } |