sw/source/uibase/inc/inputwin.hxx | 2 +- sw/source/uibase/ribbar/inputwin.cxx | 21 +++++++++------------ 2 files changed, 10 insertions(+), 13 deletions(-)
New commits: commit 58a8289afb507603c6ec00594ffd7fffd859b6be Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Feb 19 14:49:40 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Feb 19 17:11:09 2021 +0100 weld inputwinmenu Change-Id: I84995928412ed45b4b91939b8a0b48906bb3c13b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111223 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/uibase/inc/inputwin.hxx b/sw/source/uibase/inc/inputwin.hxx index 5536f9634c6d..7b74c148bb86 100644 --- a/sw/source/uibase/inc/inputwin.hxx +++ b/sw/source/uibase/inc/inputwin.hxx @@ -172,7 +172,7 @@ friend class InputEdit; virtual void Resize() override; virtual void Click() override; - DECL_LINK( MenuHdl, Menu *, bool ); + void MenuHdl(std::string_view command); DECL_LINK( DropdownClickHdl, ToolBox*, void ); void ApplyFormula(); void CancelFormula(); 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)); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits