summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-04-22 23:28:58 +0300
committerMichael Weghorn <m.weghorn@posteo.de>2023-04-23 06:19:58 +0200
commitda4c97968080707c91a15f53d07e6d062977b19a (patch)
treea56ee032ee999113570b0b41122ef135cab6dbc2
parentdeb1a14adb115710b5e40dd305dc5da4a4e3b065 (diff)
sfx2: Pass SvxCharView context menu pos as param
... and drop the `maPosition` member that was used for that purpose only. Change-Id: If449a12e6e8e37c28d7b2b139e20c4c307d41eb8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150814 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--include/sfx2/charwin.hxx3
-rw-r--r--sfx2/source/control/charwin.cxx9
2 files changed, 4 insertions, 8 deletions
diff --git a/include/sfx2/charwin.hxx b/include/sfx2/charwin.hxx
index bc482af2514f..405af4bd53ad 100644
--- a/include/sfx2/charwin.hxx
+++ b/include/sfx2/charwin.hxx
@@ -30,7 +30,6 @@ class SFX2_DLLPUBLIC SvxCharView final : public weld::CustomWidgetController
private:
VclPtr<VirtualDevice> mxVirDev;
tools::Long mnY;
- Point maPosition;
vcl::Font maFont;
bool maHasInsert;
OUString m_sText;
@@ -56,7 +55,7 @@ public:
void SetHasInsert( bool bInsert );
void InsertCharToDoc();
- void createContextMenu();
+ void createContextMenu(const Point& rPosition);
Size get_preferred_size() const { return GetDrawingArea()->get_preferred_size(); }
diff --git a/sfx2/source/control/charwin.cxx b/sfx2/source/control/charwin.cxx
index f0c687082c9a..f80bd30b684d 100644
--- a/sfx2/source/control/charwin.cxx
+++ b/sfx2/source/control/charwin.cxx
@@ -33,7 +33,6 @@ using namespace com::sun::star;
SvxCharView::SvxCharView(const VclPtr<VirtualDevice>& rVirDev)
: mxVirDev(rVirDev)
, mnY(0)
- , maPosition(0, 0)
, maHasInsert(true)
{
}
@@ -70,11 +69,9 @@ bool SvxCharView::MouseButtonDown(const MouseEvent& rMEvt)
if (rMEvt.IsRight())
{
- Point aPosition(rMEvt.GetPosPixel());
- maPosition = aPosition;
GrabFocus();
Invalidate();
- createContextMenu();
+ createContextMenu(rMEvt.GetPosPixel());
}
return true;
@@ -107,14 +104,14 @@ void SvxCharView::InsertCharToDoc()
comphelper::dispatchCommand(".uno:InsertSymbol", aArgs);
}
-void SvxCharView::createContextMenu()
+void SvxCharView::createContextMenu(const Point& rPosition)
{
weld::DrawingArea* pDrawingArea = GetDrawingArea();
std::unique_ptr<weld::Builder> xBuilder(
Application::CreateBuilder(pDrawingArea, "sfx/ui/charviewmenu.ui"));
std::unique_ptr<weld::Menu> xItemMenu(xBuilder->weld_menu("charviewmenu"));
ContextMenuSelect(
- xItemMenu->popup_at_rect(pDrawingArea, tools::Rectangle(maPosition, Size(1, 1))));
+ xItemMenu->popup_at_rect(pDrawingArea, tools::Rectangle(rPosition, Size(1, 1))));
Invalidate();
}