summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-09-13 17:29:27 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-09-13 22:19:36 +0200
commit1e531c31600a76e1d55e2f2e5abd351ff80bc4fd (patch)
tree88dd05ca3e40503ead4d14e395d5db42ece1a0b0 /svx
parenta7084f156a75ab363d2562b485b240bd350563fc (diff)
tdf#142415 mouse events not propogated to table control event handlers
handle this with explicit callbacks from the cell widget for those events Change-Id: Ie605ca4286afc0fbd321f339fb7963771a303df5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122050 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/fmcomp/gridcell.cxx68
-rw-r--r--svx/source/inc/gridcell.hxx4
2 files changed, 42 insertions, 30 deletions
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index f5eb27fbf2b8..c0cb0d1e376c 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -3103,6 +3103,9 @@ void FmXGridCell::init()
pEventWindow->AddEventListener( LINK( this, FmXGridCell, OnWindowEvent ) );
pEventWindow->SetFocusInHdl(LINK( this, FmXGridCell, OnFocusGained));
pEventWindow->SetFocusOutHdl(LINK( this, FmXGridCell, OnFocusLost));
+ pEventWindow->SetMousePressHdl(LINK( this, FmXGridCell, OnMousePress));
+ pEventWindow->SetMouseReleaseHdl(LINK( this, FmXGridCell, OnMouseRelease));
+ pEventWindow->SetMouseMoveHdl(LINK( this, FmXGridCell, OnMouseMove));
}
}
@@ -3376,45 +3379,50 @@ IMPL_LINK_NOARG(FmXGridCell, OnFocusLost, LinkParamNone*, void)
onFocusLost(aEvent);
}
-void FmXGridCell::onWindowEvent(const VclEventId _nEventId, const void* _pEventData)
+IMPL_LINK(FmXGridCell, OnMousePress, const MouseEvent&, rEventData, void)
{
- switch ( _nEventId )
- {
- case VclEventId::WindowMouseButtonDown:
- case VclEventId::WindowMouseButtonUp:
- {
- if ( !m_aMouseListeners.getLength() )
- break;
+ if (!m_aMouseListeners.getLength())
+ return;
+
+ awt::MouseEvent aEvent(VCLUnoHelper::createMouseEvent(rEventData, *this));
+ m_aMouseListeners.notifyEach(&awt::XMouseListener::mousePressed, aEvent);
+}
- const bool bButtonDown = ( _nEventId == VclEventId::WindowMouseButtonDown );
+IMPL_LINK(FmXGridCell, OnMouseRelease, const MouseEvent&, rEventData, void)
+{
+ if (!m_aMouseListeners.getLength())
+ return;
- awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *static_cast< const ::MouseEvent* >( _pEventData ), *this ) );
- m_aMouseListeners.notifyEach( bButtonDown ? &awt::XMouseListener::mousePressed : &awt::XMouseListener::mouseReleased, aEvent );
- }
- break;
- case VclEventId::WindowMouseMove:
+ awt::MouseEvent aEvent(VCLUnoHelper::createMouseEvent(rEventData, *this));
+ m_aMouseListeners.notifyEach(&awt::XMouseListener::mouseReleased, aEvent);
+}
+
+IMPL_LINK(FmXGridCell, OnMouseMove, const MouseEvent&, rMouseEvent, void)
+{
+ if ( rMouseEvent.IsEnterWindow() || rMouseEvent.IsLeaveWindow() )
{
- const MouseEvent& rMouseEvent = *static_cast< const ::MouseEvent* >( _pEventData );
- if ( rMouseEvent.IsEnterWindow() || rMouseEvent.IsLeaveWindow() )
+ if ( m_aMouseListeners.getLength() != 0 )
{
- if ( m_aMouseListeners.getLength() != 0 )
- {
- awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( rMouseEvent, *this ) );
- m_aMouseListeners.notifyEach( rMouseEvent.IsEnterWindow() ? &awt::XMouseListener::mouseEntered: &awt::XMouseListener::mouseExited, aEvent );
- }
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( rMouseEvent, *this ) );
+ m_aMouseListeners.notifyEach( rMouseEvent.IsEnterWindow() ? &awt::XMouseListener::mouseEntered: &awt::XMouseListener::mouseExited, aEvent );
}
- else if ( !rMouseEvent.IsEnterWindow() && !rMouseEvent.IsLeaveWindow() )
+ }
+ else if ( !rMouseEvent.IsEnterWindow() && !rMouseEvent.IsLeaveWindow() )
+ {
+ if ( m_aMouseMotionListeners.getLength() != 0 )
{
- if ( m_aMouseMotionListeners.getLength() != 0 )
- {
- awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( rMouseEvent, *this ) );
- aEvent.ClickCount = 0;
- const bool bSimpleMove = bool( rMouseEvent.GetMode() & MouseEventModifiers::SIMPLEMOVE );
- m_aMouseMotionListeners.notifyEach( bSimpleMove ? &awt::XMouseMotionListener::mouseMoved: &awt::XMouseMotionListener::mouseDragged, aEvent );
- }
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( rMouseEvent, *this ) );
+ aEvent.ClickCount = 0;
+ const bool bSimpleMove = bool( rMouseEvent.GetMode() & MouseEventModifiers::SIMPLEMOVE );
+ m_aMouseMotionListeners.notifyEach( bSimpleMove ? &awt::XMouseMotionListener::mouseMoved: &awt::XMouseMotionListener::mouseDragged, aEvent );
}
}
- break;
+}
+
+void FmXGridCell::onWindowEvent(const VclEventId _nEventId, const void* _pEventData)
+{
+ switch ( _nEventId )
+ {
case VclEventId::WindowKeyInput:
case VclEventId::WindowKeyUp:
{
diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx
index 306dc5764ca1..be5161d1a2b3 100644
--- a/svx/source/inc/gridcell.hxx
+++ b/svx/source/inc/gridcell.hxx
@@ -782,6 +782,10 @@ private:
svt::ControlBase* getEventWindow() const;
DECL_LINK(OnFocusGained, LinkParamNone*, void);
DECL_LINK(OnFocusLost, LinkParamNone*, void);
+ DECL_LINK(OnMousePress, const MouseEvent&, void);
+ DECL_LINK(OnMouseRelease, const MouseEvent&, void);
+ DECL_LINK(OnMouseMove, const MouseEvent&, void);
+
DECL_LINK( OnWindowEvent, VclWindowEvent&, void );
};