include/svx/charmap.hxx | 3 +-- svx/source/dialog/charmap.cxx | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-)
New commits: commit bb4aaa4cfd6cf3fe0f43baae2622df1098047123 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Sun Apr 2 00:01:10 2023 +0300 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Apr 3 17:01:31 2023 +0200 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 <m.wegh...@posteo.de> diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx index 5f0bfe6ffdee..972659ff9f87 100644 --- a/include/svx/charmap.hxx +++ b/include/svx/charmap.hxx @@ -66,7 +66,7 @@ public: void SelectCharacter( sal_UCS4 cNew ); virtual sal_UCS4 GetSelectCharacter() const; - void createContextMenu(); + void createContextMenu(const Point& rPosition); void SetDoubleClickHdl( const Link<SvxShowCharSet*,void>& rLink ) { aDoubleClkHdl = rLink; } void SetReturnKeyPressHdl( const Link<SvxShowCharSet*,void>& rLink ) { m_aReturnKeypressHdl = rLink; } @@ -139,7 +139,6 @@ protected: FontCharMapRef mxFontCharMap; Size maFontSize; - Point maPosition; bool mbRecalculateFont : 1; bool mbUpdateForeground : 1; 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<weld::ScrolledWindow> 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<weld::Builder> xBuilder(Application::CreateBuilder(GetDrawingArea(), "svx/ui/charsetmenu.ui")); std::unique_ptr<weld::Menu> 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(); }