From bb4aaa4cfd6cf3fe0f43baae2622df1098047123 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sun, 2 Apr 2023 00:01:10 +0300 Subject: Pass special char dlg context menu pos as param, drop member The `maPosition` member was only used for the position of the context menu. It was set before calling `SvxShowCharSet::createContextMenu` and then only used in there. Pass the position directly as a parameter instead and drop the extra member. Change-Id: I7ba9ec60ffb993ca1269d86efeddbe0950ed7fbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149926 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- svx/source/dialog/charmap.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index 90bb03081af9..27fa8ccb2687 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -68,7 +68,6 @@ SvxShowCharSet::SvxShowCharSet(std::unique_ptr pScrolledWi , nX(0) , nY(0) , maFontSize(0, 0) - , maPosition(0,0) , mbRecalculateFont(true) , mbUpdateForeground(true) , mbUpdateBackground(true) @@ -141,11 +140,10 @@ bool SvxShowCharSet::MouseButtonDown(const MouseEvent& rMEvt) if (rMEvt.IsRight()) { Point aPosition (rMEvt.GetPosPixel()); - maPosition = aPosition; int nIndex = PixelToMapIndex( rMEvt.GetPosPixel() ); // Fire the focus event SelectIndex( nIndex, true); - createContextMenu(); + createContextMenu(aPosition); } return true; @@ -221,7 +219,7 @@ bool SvxShowCharSet::isFavChar(const OUString& sTitle, const OUString& rFont) return isFavCharTitleExists && isFavCharFontExists; } -void SvxShowCharSet::createContextMenu() +void SvxShowCharSet::createContextMenu(const Point& rPosition) { std::unique_ptr xBuilder(Application::CreateBuilder(GetDrawingArea(), "svx/ui/charsetmenu.ui")); std::unique_ptr xItemMenu(xBuilder->weld_menu("charsetmenu")); @@ -233,7 +231,7 @@ void SvxShowCharSet::createContextMenu() else xItemMenu->set_visible("remove", false); - ContextMenuSelect(xItemMenu->popup_at_rect(GetDrawingArea(), tools::Rectangle(maPosition, Size(1,1)))); + ContextMenuSelect(xItemMenu->popup_at_rect(GetDrawingArea(), tools::Rectangle(rPosition, Size(1,1)))); GrabFocus(); Invalidate(); } -- cgit