LibreOffice Module vcl (master)  1
winproc.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <sal/config.h>
21 
22 #include <o3tl/safeint.hxx>
23 #include <tools/debug.hxx>
24 #include <tools/time.hxx>
25 #include <sal/log.hxx>
26 
28 
29 #include <comphelper/lok.hxx>
30 #include <vcl/QueueInfo.hxx>
31 #include <vcl/timer.hxx>
32 #include <vcl/event.hxx>
33 #include <vcl/GestureEvent.hxx>
34 #include <vcl/settings.hxx>
35 #include <vcl/svapp.hxx>
36 #include <vcl/cursor.hxx>
37 #include <vcl/wrkwin.hxx>
38 #include <vcl/floatwin.hxx>
39 #include <vcl/toolkit/dialog.hxx>
40 #include <vcl/help.hxx>
41 #include <vcl/dockwin.hxx>
42 #include <vcl/menu.hxx>
43 #include <vcl/virdev.hxx>
44 #include <vcl/uitest/logger.hxx>
45 #include <vcl/ptrstyle.hxx>
46 
47 #include <svdata.hxx>
48 #include <salwtype.hxx>
49 #include <salframe.hxx>
50 #include <accmgr.hxx>
51 #include <print.h>
52 #include <window.h>
53 #include <helpwin.hxx>
54 #include <brdwin.hxx>
55 #include <dndlistenercontainer.hxx>
56 
57 #include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
58 #include <com/sun/star/awt/MouseEvent.hpp>
59 
60 #define IMPL_MIN_NEEDSYSWIN 49
61 
63 {
64  return rEvt.GetWindow()->CompatPreNotify( rEvt );
65 }
66 
67 static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePos,
68  sal_uInt16 nCode, MouseNotifyEvent nSVEvent,
69  bool bMouseLeave )
70 {
71  ImplSVData* pSVData = ImplGetSVData();
72 
73  if (pSVData->mpWinData->mpFirstFloat && !pSVData->mpWinData->mpCaptureWin
74  && !pSVData->mpWinData->mpFirstFloat->ImplIsFloatPopupModeWindow(pChild))
75  {
76  /*
77  * #93895# since floats are system windows, coordinates have
78  * to be converted to float relative for the hittest
79  */
80  bool bHitTestInsideRect = false;
81  FloatingWindow* pFloat = pSVData->mpWinData->mpFirstFloat->ImplFloatHitTest( pChild, rMousePos, bHitTestInsideRect );
82  FloatingWindow* pLastLevelFloat;
83  FloatWinPopupFlags nPopupFlags;
84  if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
85  {
86  if ( bMouseLeave )
87  return true;
88 
89  if ( !pFloat || bHitTestInsideRect )
90  {
91  if ( ImplGetSVHelpData().mpHelpWin && !ImplGetSVHelpData().mbKeyboardHelp )
92  ImplDestroyHelpWindow( true );
94  return true;
95  }
96  }
97  else
98  {
99  if ( nCode & MOUSE_LEFT )
100  {
101  if ( nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN )
102  {
103  if ( !pFloat )
104  {
105  pLastLevelFloat = pSVData->mpWinData->mpFirstFloat->ImplFindLastLevelFloat();
107  return true;
108  }
109  else if ( bHitTestInsideRect )
110  {
111  pFloat->ImplSetMouseDown();
112  return true;
113  }
114  }
115  else
116  {
117  if ( pFloat )
118  {
119  if ( bHitTestInsideRect )
120  {
121  if ( pFloat->ImplIsMouseDown() )
123  return true;
124  }
125  }
126  else
127  {
128  pLastLevelFloat = pSVData->mpWinData->mpFirstFloat->ImplFindLastLevelFloat();
129  nPopupFlags = pLastLevelFloat->GetPopupModeFlags();
130  if ( !(nPopupFlags & FloatWinPopupFlags::NoMouseUpClose) )
131  {
133  return true;
134  }
135  }
136  }
137  }
138  else
139  {
140  if ( !pFloat )
141  {
142  pLastLevelFloat = pSVData->mpWinData->mpFirstFloat->ImplFindLastLevelFloat();
143  nPopupFlags = pLastLevelFloat->GetPopupModeFlags();
144  if ( nPopupFlags & FloatWinPopupFlags::AllMouseButtonClose )
145  {
146  if ( (nPopupFlags & FloatWinPopupFlags::NoMouseUpClose) &&
147  (nSVEvent == MouseNotifyEvent::MOUSEBUTTONUP) )
148  return true;
150  return true;
151  }
152  else
153  return true;
154  }
155  }
156  }
157  }
158 
159  return false;
160 }
161 
162 static void ImplHandleMouseHelpRequest( vcl::Window* pChild, const Point& rMousePos )
163 {
164  ImplSVHelpData& aHelpData = ImplGetSVHelpData();
165  if ( aHelpData.mpHelpWin &&
166  ( aHelpData.mpHelpWin->IsWindowOrChild( pChild ) ||
167  pChild->IsWindowOrChild( aHelpData.mpHelpWin ) ))
168  return;
169 
171  if ( aHelpData.mbQuickHelp )
172  nHelpMode = HelpEventMode::QUICK;
173  if ( aHelpData.mbBalloonHelp )
174  nHelpMode |= HelpEventMode::BALLOON;
175  if ( !(bool(nHelpMode)) )
176  return;
177 
178  if ( pChild->IsInputEnabled() && !pChild->IsInModalMode() )
179  {
180  HelpEvent aHelpEvent( rMousePos, nHelpMode );
181  aHelpData.mbRequestingHelp = true;
182  pChild->RequestHelp( aHelpEvent );
183  aHelpData.mbRequestingHelp = false;
184  }
185  // #104172# do not kill keyboard activated tooltips
186  else if ( aHelpData.mpHelpWin && !aHelpData.mbKeyboardHelp)
187  {
188  ImplDestroyHelpWindow( true );
189  }
190 }
191 
192 static void ImplSetMousePointer( vcl::Window const * pChild )
193 {
194  if ( ImplGetSVHelpData().mbExtHelpMode )
196  else
197  pChild->ImplGetFrame()->SetPointer( pChild->ImplGetMousePointer() );
198 }
199 
200 static bool ImplCallCommand( const VclPtr<vcl::Window>& pChild, CommandEventId nEvt, void const * pData = nullptr,
201  bool bMouse = false, Point const * pPos = nullptr )
202 {
203  Point aPos;
204  if ( pPos )
205  aPos = *pPos;
206  else
207  {
208  if( bMouse )
209  aPos = pChild->GetPointerPosPixel();
210  else
211  {
212  // simulate mouseposition at center of window
213  Size aSize( pChild->GetOutputSizePixel() );
214  aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 );
215  }
216  }
217 
218  CommandEvent aCEvt( aPos, nEvt, bMouse, pData );
219  NotifyEvent aNCmdEvt( MouseNotifyEvent::COMMAND, pChild, &aCEvt );
220  bool bPreNotify = ImplCallPreNotify( aNCmdEvt );
221  if ( pChild->IsDisposed() )
222  return false;
223  if ( !bPreNotify )
224  {
225  pChild->ImplGetWindowImpl()->mbCommand = false;
226  pChild->Command( aCEvt );
227 
228  if( pChild->IsDisposed() )
229  return false;
230  pChild->ImplNotifyKeyMouseCommandEventListeners( aNCmdEvt );
231  if ( pChild->IsDisposed() )
232  return false;
233  if ( pChild->ImplGetWindowImpl()->mbCommand )
234  return true;
235  }
236 
237  return false;
238 }
239 
240 /* #i34277# delayed context menu activation;
241 * necessary if there already was a popup menu running.
242 */
243 
244 namespace {
245 
246 struct ContextMenuEvent
247 {
248  VclPtr<vcl::Window> pWindow;
249  Point aChildPos;
250 };
251 
252 }
253 
254 static void ContextMenuEventLink( void* pCEvent, void* )
255 {
256  ContextMenuEvent* pEv = static_cast<ContextMenuEvent*>(pCEvent);
257 
258  if( ! pEv->pWindow->IsDisposed() )
259  {
260  ImplCallCommand( pEv->pWindow, CommandEventId::ContextMenu, nullptr, true, &pEv->aChildPos );
261  }
262  delete pEv;
263 }
264 
265 bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent nSVEvent, bool bMouseLeave,
266  long nX, long nY, sal_uInt64 nMsgTime,
267  sal_uInt16 nCode, MouseEventModifiers nMode )
268 {
269  ImplSVHelpData& aHelpData = ImplGetSVHelpData();
270  ImplSVData* pSVData = ImplGetSVData();
271  Point aMousePos( nX, nY );
272  VclPtr<vcl::Window> pChild;
273  bool bRet(false);
274  sal_uInt16 nClicks(0);
275  ImplFrameData* pWinFrameData = xWindow->ImplGetFrameData();
276  sal_uInt16 nOldCode = pWinFrameData->mnMouseCode;
277 
278  // we need a mousemove event, before we get a mousebuttondown or a
279  // mousebuttonup event
280  if ( (nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN) || (nSVEvent == MouseNotifyEvent::MOUSEBUTTONUP) )
281  {
282  if ( (nSVEvent == MouseNotifyEvent::MOUSEBUTTONUP) && aHelpData.mbExtHelpMode )
284  if ( aHelpData.mpHelpWin )
285  {
286  if( xWindow->ImplGetWindow() == aHelpData.mpHelpWin )
287  {
288  ImplDestroyHelpWindow( false );
289  return true; // xWindow is dead now - avoid crash!
290  }
291  else
292  ImplDestroyHelpWindow( true );
293  }
294 
295  if ( (pWinFrameData->mnLastMouseX != nX) ||
296  (pWinFrameData->mnLastMouseY != nY) )
297  {
298  sal_uInt16 nMoveCode = nCode & ~(MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE);
299  ImplHandleMouseEvent(xWindow, MouseNotifyEvent::MOUSEMOVE, false, nX, nY, nMsgTime, nMoveCode, nMode);
300  }
301  }
302 
303  // update frame data
304  pWinFrameData->mnBeforeLastMouseX = pWinFrameData->mnLastMouseX;
305  pWinFrameData->mnBeforeLastMouseY = pWinFrameData->mnLastMouseY;
306  pWinFrameData->mnLastMouseX = nX;
307  pWinFrameData->mnLastMouseY = nY;
308  pWinFrameData->mnMouseCode = nCode;
310  pWinFrameData->mnMouseMode = nMode & ~nTmpMask;
311  if ( bMouseLeave )
312  {
313  pWinFrameData->mbMouseIn = false;
314  if ( ImplGetSVHelpData().mpHelpWin && !ImplGetSVHelpData().mbKeyboardHelp )
315  {
316  ImplDestroyHelpWindow( true );
317 
318  if ( xWindow->IsDisposed() )
319  return true; // xWindow is dead now - avoid crash! (#122045#)
320  }
321  }
322  else
323  pWinFrameData->mbMouseIn = true;
324 
325  DBG_ASSERT(!pSVData->mpWinData->mpTrackWin
326  || (pSVData->mpWinData->mpTrackWin == pSVData->mpWinData->mpCaptureWin),
327  "ImplHandleMouseEvent: TrackWin != CaptureWin");
328 
329  // AutoScrollMode
330  if (pSVData->mpWinData->mpAutoScrollWin && (nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN))
331  {
333  return true;
334  }
335 
336  // find mouse window
337  if (pSVData->mpWinData->mpCaptureWin)
338  {
339  pChild = pSVData->mpWinData->mpCaptureWin;
340 
341  SAL_WARN_IF( xWindow != pChild->ImplGetFrameWindow(), "vcl",
342  "ImplHandleMouseEvent: mouse event is not sent to capture window" );
343 
344  // java client cannot capture mouse correctly
345  if ( xWindow != pChild->ImplGetFrameWindow() )
346  return false;
347 
348  if ( bMouseLeave )
349  return false;
350  }
351  else
352  {
353  if ( bMouseLeave )
354  pChild = nullptr;
355  else
356  pChild = xWindow->ImplFindWindow( aMousePos );
357  }
358 
359  // test this because mouse events are buffered in the remote version
360  // and size may not be in sync
361  if ( !pChild && !bMouseLeave )
362  return false;
363 
364  // execute a few tests and catch the message or implement the status
365  if ( pChild )
366  {
367  if( pChild->ImplIsAntiparallel() )
368  {
369  // re-mirror frame pos at pChild
370  const OutputDevice *pChildWinOutDev = pChild->GetOutDev();
371  pChildWinOutDev->ReMirror( aMousePos );
372  }
373 
374  // no mouse messages to disabled windows
375  // #106845# if the window was disabled during capturing we have to pass the mouse events to release capturing
376  if (pSVData->mpWinData->mpCaptureWin.get() != pChild
377  && (!pChild->IsEnabled() || !pChild->IsInputEnabled() || pChild->IsInModalMode()))
378  {
379  ImplHandleMouseFloatMode( pChild, aMousePos, nCode, nSVEvent, bMouseLeave );
380  if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
381  {
382  ImplHandleMouseHelpRequest( pChild, aMousePos );
383  if( pWinFrameData->mpMouseMoveWin.get() != pChild )
385  }
386 
387  // Call the hook also, if Window is disabled
388  Point aChildPos = pChild->ImplFrameToOutput( aMousePos );
389  MouseEvent aMEvt( aChildPos, pWinFrameData->mnClickCount, nMode, nCode, nCode );
390  NotifyEvent aNEvt( nSVEvent, pChild, &aMEvt );
391 
392  if ( nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN )
393  return true;
394  else
395  {
396  // Set normal MousePointer for disabled windows
397  if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
398  ImplSetMousePointer( pChild );
399 
400  return false;
401  }
402  }
403 
404  // End ExtTextInput-Mode, if the user click in the same TopLevel Window
405  if (pSVData->mpWinData->mpExtTextInputWin
406  && ((nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN)
407  || (nSVEvent == MouseNotifyEvent::MOUSEBUTTONUP)))
409  }
410 
411  // determine mouse event data
412  if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
413  {
414  // check if MouseMove belongs to same window and if the
415  // status did not change
416  if ( pChild )
417  {
418  Point aChildMousePos = pChild->ImplFrameToOutput( aMousePos );
419  if ( !bMouseLeave &&
420  (pChild == pWinFrameData->mpMouseMoveWin) &&
421  (aChildMousePos.X() == pWinFrameData->mnLastMouseWinX) &&
422  (aChildMousePos.Y() == pWinFrameData->mnLastMouseWinY) &&
423  (nOldCode == pWinFrameData->mnMouseCode) )
424  {
425  // set mouse pointer anew, as it could have changed
426  // due to the mode switch
427  ImplSetMousePointer( pChild );
428  return false;
429  }
430 
431  pWinFrameData->mnLastMouseWinX = aChildMousePos.X();
432  pWinFrameData->mnLastMouseWinY = aChildMousePos.Y();
433  }
434 
435  // mouse click
436  nClicks = pWinFrameData->mnClickCount;
437 
438  // call Start-Drag handler if required
439  // Warning: should be called before Move, as otherwise during
440  // fast mouse movements the applications move to the selection state
441  vcl::Window* pMouseDownWin = pWinFrameData->mpMouseDownWin;
442  if ( pMouseDownWin )
443  {
444  // check for matching StartDrag mode. We only compare
445  // the status of the mouse buttons, such that e. g. Mod1 can
446  // change immediately to the copy mode
447  const MouseSettings& rMSettings = pMouseDownWin->GetSettings().GetMouseSettings();
448  if ( (nCode & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)) ==
450  {
451  if ( !pMouseDownWin->ImplGetFrameData()->mbStartDragCalled )
452  {
453  long nDragW = rMSettings.GetStartDragWidth();
454  long nDragH = rMSettings.GetStartDragHeight();
455  //long nMouseX = nX;
456  //long nMouseY = nY;
457  long nMouseX = aMousePos.X(); // #106074# use the possibly re-mirrored coordinates (RTL) ! nX,nY are unmodified !
458  long nMouseY = aMousePos.Y();
459  if ( (((nMouseX-nDragW) > pMouseDownWin->ImplGetFrameData()->mnFirstMouseX) ||
460  ((nMouseX+nDragW) < pMouseDownWin->ImplGetFrameData()->mnFirstMouseX)) ||
461  (((nMouseY-nDragH) > pMouseDownWin->ImplGetFrameData()->mnFirstMouseY) ||
462  ((nMouseY+nDragH) < pMouseDownWin->ImplGetFrameData()->mnFirstMouseY)) )
463  {
464  pMouseDownWin->ImplGetFrameData()->mbStartDragCalled = true;
465 
466  // Check if drag source provides its own recognizer
467  if( pMouseDownWin->ImplGetFrameData()->mbInternalDragGestureRecognizer )
468  {
469  // query DropTarget from child window
470  css::uno::Reference< css::datatransfer::dnd::XDragGestureRecognizer > xDragGestureRecognizer(
471  pMouseDownWin->ImplGetWindowImpl()->mxDNDListenerContainer,
472  css::uno::UNO_QUERY );
473 
474  if( xDragGestureRecognizer.is() )
475  {
476  // retrieve mouse position relative to mouse down window
477  Point relLoc = pMouseDownWin->ImplFrameToOutput( Point(
478  pMouseDownWin->ImplGetFrameData()->mnFirstMouseX,
479  pMouseDownWin->ImplGetFrameData()->mnFirstMouseY ) );
480 
481  // create a UNO mouse event out of the available data
482  css::awt::MouseEvent aMouseEvent( static_cast < css::uno::XInterface * > ( nullptr ),
483 #ifdef MACOSX
484  nCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3),
485 #else
486  nCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2),
487 #endif
488  nCode & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE),
489  nMouseX,
490  nMouseY,
491  nClicks,
492  false );
493 
494  SolarMutexReleaser aReleaser;
495 
496  // FIXME: where do I get Action from ?
497  css::uno::Reference< css::datatransfer::dnd::XDragSource > xDragSource = pMouseDownWin->GetDragSource();
498 
499  if( xDragSource.is() )
500  {
501  static_cast < DNDListenerContainer * > ( xDragGestureRecognizer.get() )->fireDragGestureEvent( 0,
502  relLoc.X(), relLoc.Y(), xDragSource, css::uno::makeAny( aMouseEvent ) );
503  }
504  }
505  }
506  }
507  }
508  }
509  else
510  pMouseDownWin->ImplGetFrameData()->mbStartDragCalled = true;
511  }
512 
513  // test for mouseleave and mouseenter
514  VclPtr<vcl::Window> pMouseMoveWin = pWinFrameData->mpMouseMoveWin;
515  if ( pChild != pMouseMoveWin )
516  {
517  if ( pMouseMoveWin )
518  {
519  Point aLeaveMousePos = pMouseMoveWin->ImplFrameToOutput( aMousePos );
520  MouseEvent aMLeaveEvt( aLeaveMousePos, nClicks, nMode | MouseEventModifiers::LEAVEWINDOW, nCode, nCode );
521  NotifyEvent aNLeaveEvt( MouseNotifyEvent::MOUSEMOVE, pMouseMoveWin, &aMLeaveEvt );
522  pWinFrameData->mbInMouseMove = true;
523  pMouseMoveWin->ImplGetWinData()->mbMouseOver = false;
524 
525  // A MouseLeave can destroy this window
526  if ( !ImplCallPreNotify( aNLeaveEvt ) )
527  {
528  pMouseMoveWin->MouseMove( aMLeaveEvt );
529  if( !pMouseMoveWin->IsDisposed() )
530  aNLeaveEvt.GetWindow()->ImplNotifyKeyMouseCommandEventListeners( aNLeaveEvt );
531  }
532 
533  pWinFrameData->mpMouseMoveWin = nullptr;
534  pWinFrameData->mbInMouseMove = false;
535 
536  if ( pChild && pChild->IsDisposed() )
537  pChild = nullptr;
538  if ( pMouseMoveWin->IsDisposed() )
539  return true;
540  }
541 
543  }
544  pWinFrameData->mpMouseMoveWin = pChild;
545  if( pChild )
546  pChild->ImplGetWinData()->mbMouseOver = true;
547 
548  // MouseLeave
549  if ( !pChild )
550  return false;
551  }
552  else
553  {
554  if (pChild)
555  {
556  // mouse click
557  if ( nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN )
558  {
559  const MouseSettings& rMSettings = pChild->GetSettings().GetMouseSettings();
560  sal_uInt64 nDblClkTime = rMSettings.GetDoubleClickTime();
561  long nDblClkW = rMSettings.GetDoubleClickWidth();
562  long nDblClkH = rMSettings.GetDoubleClickHeight();
563  //long nMouseX = nX;
564  //long nMouseY = nY;
565  long nMouseX = aMousePos.X(); // #106074# use the possibly re-mirrored coordinates (RTL) ! nX,nY are unmodified !
566  long nMouseY = aMousePos.Y();
567 
568  if ( (pChild == pChild->ImplGetFrameData()->mpMouseDownWin) &&
569  (nCode == pChild->ImplGetFrameData()->mnFirstMouseCode) &&
570  ((nMsgTime-pChild->ImplGetFrameData()->mnMouseDownTime) < nDblClkTime) &&
571  ((nMouseX-nDblClkW) <= pChild->ImplGetFrameData()->mnFirstMouseX) &&
572  ((nMouseX+nDblClkW) >= pChild->ImplGetFrameData()->mnFirstMouseX) &&
573  ((nMouseY-nDblClkH) <= pChild->ImplGetFrameData()->mnFirstMouseY) &&
574  ((nMouseY+nDblClkH) >= pChild->ImplGetFrameData()->mnFirstMouseY) )
575  {
576  pChild->ImplGetFrameData()->mnClickCount++;
577  pChild->ImplGetFrameData()->mbStartDragCalled = true;
578  }
579  else
580  {
581  pChild->ImplGetFrameData()->mpMouseDownWin = pChild;
582  pChild->ImplGetFrameData()->mnClickCount = 1;
583  pChild->ImplGetFrameData()->mnFirstMouseX = nMouseX;
584  pChild->ImplGetFrameData()->mnFirstMouseY = nMouseY;
585  pChild->ImplGetFrameData()->mnFirstMouseCode = nCode;
588  }
589  pChild->ImplGetFrameData()->mnMouseDownTime = nMsgTime;
590  }
591  nClicks = pChild->ImplGetFrameData()->mnClickCount;
592  }
593 
595  }
596 
597  SAL_WARN_IF( !pChild, "vcl", "ImplHandleMouseEvent: pChild == NULL" );
598 
599  if (!pChild)
600  return false;
601 
602  // create mouse event
603  Point aChildPos = pChild->ImplFrameToOutput( aMousePos );
604  MouseEvent aMEvt( aChildPos, nClicks, nMode, nCode, nCode );
605 
606 
607  // tracking window gets the mouse events
608  if (pSVData->mpWinData->mpTrackWin)
609  pChild = pSVData->mpWinData->mpTrackWin;
610 
611  // handle FloatingMode
612  if (!pSVData->mpWinData->mpTrackWin && pSVData->mpWinData->mpFirstFloat)
613  {
614  if ( ImplHandleMouseFloatMode( pChild, aMousePos, nCode, nSVEvent, bMouseLeave ) )
615  {
616  if ( !pChild->IsDisposed() )
617  {
618  pChild->ImplGetFrameData()->mbStartDragCalled = true;
619  }
620  return true;
621  }
622  }
623 
624  // call handler
625  bool bCallHelpRequest = true;
626  SAL_WARN_IF( !pChild, "vcl", "ImplHandleMouseEvent: pChild is NULL" );
627 
628  if (!pChild)
629  return false;
630 
631  NotifyEvent aNEvt( nSVEvent, pChild, &aMEvt );
632  if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
633  pChild->ImplGetFrameData()->mbInMouseMove = true;
634 
635  // bring window into foreground on mouseclick
636  if ( nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN )
637  {
638  if (!pSVData->mpWinData->mpFirstFloat
639  && // totop for floating windows in popup would change the focus and would close them immediately
640  !(pChild->ImplGetFrameWindow()->GetStyle()
641  & WB_OWNERDRAWDECORATION)) // ownerdrawdecorated windows must never grab focus
642  pChild->ToTop();
643  if ( pChild->IsDisposed() )
644  return true;
645  }
646 
647  if ( ImplCallPreNotify( aNEvt ) || pChild->IsDisposed() )
648  bRet = true;
649  else
650  {
651  bRet = false;
652  if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
653  {
654  if (pSVData->mpWinData->mpTrackWin)
655  {
656  TrackingEvent aTEvt( aMEvt );
657  pChild->Tracking( aTEvt );
658  if ( !pChild->IsDisposed() )
659  {
660  // When ScrollRepeat, we restart the timer
661  if (pSVData->mpWinData->mpTrackTimer
663  pSVData->mpWinData->mpTrackTimer->Start();
664  }
665  bCallHelpRequest = false;
666  bRet = true;
667  }
668  else
669  {
670  // Auto-ToTop
671  if (!pSVData->mpWinData->mpCaptureWin
672  && (pChild->GetSettings().GetMouseSettings().GetOptions()
674  pChild->ToTop( ToTopFlags::NoGrabFocus );
675 
676  if( pChild->IsDisposed() )
677  bCallHelpRequest = false;
678  else
679  {
680  // if the MouseMove handler changes the help window's visibility
681  // the HelpRequest handler should not be called anymore
682  vcl::Window* pOldHelpTextWin = ImplGetSVHelpData().mpHelpWin;
683  pChild->MouseMove( aMEvt );
684  if ( pOldHelpTextWin != ImplGetSVHelpData().mpHelpWin )
685  bCallHelpRequest = false;
686  }
687  }
688  }
689  else if ( nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN )
690  {
691  if ( pSVData->mpWinData->mpTrackWin )
692  bRet = true;
693  else
694  {
695  pChild->ImplGetWindowImpl()->mbMouseButtonDown = false;
696  pChild->MouseButtonDown( aMEvt );
697  }
698  }
699  else
700  {
701  if (pSVData->mpWinData->mpTrackWin)
702  {
703  pChild->EndTracking();
704  bRet = true;
705  }
706  else
707  {
708  pChild->ImplGetWindowImpl()->mbMouseButtonUp = false;
709  pChild->MouseButtonUp( aMEvt );
710  }
711  }
712 
713  assert(aNEvt.GetWindow() == pChild);
714 
715  if (!pChild->IsDisposed())
717  }
718 
719  if (pChild->IsDisposed())
720  return true;
721 
722  if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
723  pChild->ImplGetWindowImpl()->mpFrameData->mbInMouseMove = false;
724 
725  if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
726  {
727  if ( bCallHelpRequest && !ImplGetSVHelpData().mbKeyboardHelp )
728  ImplHandleMouseHelpRequest( pChild, pChild->OutputToScreenPixel( aMEvt.GetPosPixel() ) );
729  bRet = true;
730  }
731  else if ( !bRet )
732  {
733  if ( nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN )
734  {
735  if ( !pChild->ImplGetWindowImpl()->mbMouseButtonDown )
736  bRet = true;
737  }
738  else
739  {
740  if ( !pChild->ImplGetWindowImpl()->mbMouseButtonUp )
741  bRet = true;
742  }
743  }
744 
745  if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
746  {
747  // set new mouse pointer
748  if ( !bMouseLeave )
749  ImplSetMousePointer( pChild );
750  }
751  else if ( (nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN) || (nSVEvent == MouseNotifyEvent::MOUSEBUTTONUP) )
752  {
753  // Command-Events
754  if ( (nClicks == 1) && (nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN) &&
755  (nCode == MOUSE_MIDDLE) )
756  {
758  if ( nMiddleAction == MouseMiddleButtonAction::AutoScroll )
759  bRet = !ImplCallCommand( pChild, CommandEventId::StartAutoScroll, nullptr, true, &aChildPos );
760  else if ( nMiddleAction == MouseMiddleButtonAction::PasteSelection )
761  bRet = !ImplCallCommand( pChild, CommandEventId::PasteSelection, nullptr, true, &aChildPos );
762  }
763  else
764  {
765  // ContextMenu
766  if ( (nCode == MouseSettings::GetContextMenuCode()) &&
767  (nClicks == MouseSettings::GetContextMenuClicks()) )
768  {
769  bool bContextMenu = (nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN);
770  if ( bContextMenu )
771  {
772  if( pSVData->maAppData.mpActivePopupMenu )
773  {
774  /* #i34277# there already is a context menu open
775  * that was probably just closed with EndPopupMode.
776  * We need to give the eventual corresponding
777  * PopupMenu::Execute a chance to end properly.
778  * Therefore delay context menu command and
779  * issue only after popping one frame of the
780  * Yield stack.
781  */
782  ContextMenuEvent* pEv = new ContextMenuEvent;
783  pEv->pWindow = pChild;
784  pEv->aChildPos = aChildPos;
786  }
787  else
788  bRet = ! ImplCallCommand( pChild, CommandEventId::ContextMenu, nullptr, true, &aChildPos );
789  }
790  }
791  }
792  }
793 
794  return bRet;
795 }
796 
798 {
799  ImplSVData* pSVData = ImplGetSVData();
800 
801  // determine last input time
803 
804  // #127104# workaround for destroyed windows
805  if( pWindow->ImplGetWindowImpl() == nullptr )
806  return nullptr;
807 
808  // find window - is every time the window which has currently the
809  // focus or the last time the focus.
810 
811  // the first floating window always has the focus, try it, or any parent floating windows, first
812  vcl::Window* pChild = pSVData->mpWinData->mpFirstFloat;
813  while (pChild)
814  {
815  if (pChild->ImplGetWindowImpl()->mbFloatWin)
816  {
817  if (static_cast<FloatingWindow *>(pChild)->GrabsFocus())
818  break;
819  }
820  else if (pChild->ImplGetWindowImpl()->mbDockWin)
821  {
822  vcl::Window* pParent = pChild->GetWindow(GetWindowType::RealParent);
823  if (pParent && pParent->ImplGetWindowImpl()->mbFloatWin &&
824  static_cast<FloatingWindow *>(pParent)->GrabsFocus())
825  break;
826  }
827  pChild = pChild->GetParent();
828  }
829 
830  if (!pChild)
831  pChild = pWindow;
832 
833  pChild = pChild->ImplGetWindowImpl()->mpFrameData->mpFocusWin;
834 
835  // no child - then no input
836  if ( !pChild )
837  return nullptr;
838 
839  // We call also KeyInput if we haven't the focus, because on Unix
840  // system this is often the case when a Lookup Choice Window has
841  // the focus - because this windows send the KeyInput directly to
842  // the window without resetting the focus
843 
844  // no keyinput to disabled windows
845  if ( !pChild->IsEnabled() || !pChild->IsInputEnabled() || pChild->IsInModalMode() )
846  return nullptr;
847 
848  return pChild;
849 }
850 
851 static bool ImplHandleKey( vcl::Window* pWindow, MouseNotifyEvent nSVEvent,
852  sal_uInt16 nKeyCode, sal_uInt16 nCharCode, sal_uInt16 nRepeat, bool bForward )
853 {
854  ImplSVData* pSVData = ImplGetSVData();
855  vcl::KeyCode aKeyCode( nKeyCode, nKeyCode );
856  sal_uInt16 nEvCode = aKeyCode.GetCode();
857 
858  // allow application key listeners to remove the key event
859  // but make sure we're not forwarding external KeyEvents, (ie where bForward is false)
860  // because those are coming back from the listener itself and MUST be processed
861  if( bForward )
862  {
863  VclEventId nVCLEvent;
864  switch( nSVEvent )
865  {
867  nVCLEvent = VclEventId::WindowKeyInput;
868  break;
870  nVCLEvent = VclEventId::WindowKeyUp;
871  break;
872  default:
873  nVCLEvent = VclEventId::NONE;
874  break;
875  }
876  KeyEvent aKeyEvent(static_cast<sal_Unicode>(nCharCode), aKeyCode, nRepeat);
877  if (nVCLEvent != VclEventId::NONE && Application::HandleKey(nVCLEvent, pWindow, &aKeyEvent))
878  return true;
879  }
880 
881  // #i1820# use locale specific decimal separator
882  if( nEvCode == KEY_DECIMAL )
883  {
884  if( Application::GetSettings().GetMiscSettings().GetEnableLocalizedDecimalSep() )
885  {
886  OUString aSep( pWindow->GetSettings().GetLocaleDataWrapper().getNumDecimalSep() );
887  nCharCode = static_cast<sal_uInt16>(aSep[0]);
888  }
889  }
890 
891  bool bCtrlF6 = (aKeyCode.GetCode() == KEY_F6) && aKeyCode.IsMod1();
892 
893  // determine last input time
895 
896  // handle tracking window
897  if ( nSVEvent == MouseNotifyEvent::KEYINPUT )
898  {
899  if ( ImplGetSVHelpData().mbExtHelpMode )
900  {
902  if ( nEvCode == KEY_ESCAPE )
903  return true;
904  }
905  if ( ImplGetSVHelpData().mpHelpWin )
906  ImplDestroyHelpWindow( false );
907 
908  // AutoScrollMode
909  if (pSVData->mpWinData->mpAutoScrollWin)
910  {
912  if ( nEvCode == KEY_ESCAPE )
913  return true;
914  }
915 
916  if (pSVData->mpWinData->mpTrackWin)
917  {
918  sal_uInt16 nOrigCode = aKeyCode.GetCode();
919 
920  if ( nOrigCode == KEY_ESCAPE )
921  {
923  if (pSVData->mpWinData->mpFirstFloat)
924  {
925  FloatingWindow* pLastLevelFloat = pSVData->mpWinData->mpFirstFloat->ImplFindLastLevelFloat();
926  if ( !(pLastLevelFloat->GetPopupModeFlags() & FloatWinPopupFlags::NoKeyClose) )
927  {
928  sal_uInt16 nEscCode = aKeyCode.GetCode();
929 
930  if ( nEscCode == KEY_ESCAPE )
932  }
933  }
934  return true;
935  }
936  else if ( nOrigCode == KEY_RETURN )
937  {
939  return true;
940  }
941  else
942  return true;
943  }
944 
945  // handle FloatingMode
946  if (pSVData->mpWinData->mpFirstFloat)
947  {
948  FloatingWindow* pLastLevelFloat = pSVData->mpWinData->mpFirstFloat->ImplFindLastLevelFloat();
949  if ( !(pLastLevelFloat->GetPopupModeFlags() & FloatWinPopupFlags::NoKeyClose) )
950  {
951  sal_uInt16 nCode = aKeyCode.GetCode();
952 
953  if ( (nCode == KEY_ESCAPE) || bCtrlF6)
954  {
956  if( !bCtrlF6 )
957  return true;
958  }
959  }
960  }
961 
962  // test for accel
963  if ( pSVData->maAppData.mpAccelMgr )
964  {
965  if ( pSVData->maAppData.mpAccelMgr->IsAccelKey( aKeyCode ) )
966  return true;
967  }
968  }
969 
970  // find window
971  VclPtr<vcl::Window> pChild = ImplGetKeyInputWindow( pWindow );
972  if ( !pChild )
973  return false;
974 
975  // RTL: mirror cursor keys
976  const OutputDevice *pChildOutDev = pChild->GetOutDev();
977  if( (aKeyCode.GetCode() == KEY_LEFT || aKeyCode.GetCode() == KEY_RIGHT) &&
978  pChildOutDev->HasMirroredGraphics() && pChild->IsRTLEnabled() )
979  aKeyCode = vcl::KeyCode( aKeyCode.GetCode() == KEY_LEFT ? KEY_RIGHT : KEY_LEFT, aKeyCode.GetModifier() );
980 
981  KeyEvent aKeyEvt( static_cast<sal_Unicode>(nCharCode), aKeyCode, nRepeat );
982  NotifyEvent aNotifyEvt( nSVEvent, pChild, &aKeyEvt );
983  bool bKeyPreNotify = ImplCallPreNotify( aNotifyEvt );
984  bool bRet = true;
985 
986  if ( !bKeyPreNotify && !pChild->IsDisposed() )
987  {
988  if ( nSVEvent == MouseNotifyEvent::KEYINPUT )
989  {
990  UITestLogger::getInstance().logKeyInput(pChild, aKeyEvt);
991  pChild->ImplGetWindowImpl()->mbKeyInput = false;
992  pChild->KeyInput( aKeyEvt );
993  }
994  else
995  {
996  pChild->ImplGetWindowImpl()->mbKeyUp = false;
997  pChild->KeyUp( aKeyEvt );
998  }
999  if( !pChild->IsDisposed() )
1000  aNotifyEvt.GetWindow()->ImplNotifyKeyMouseCommandEventListeners( aNotifyEvt );
1001  }
1002 
1003  if ( pChild->IsDisposed() )
1004  return true;
1005 
1006  if ( nSVEvent == MouseNotifyEvent::KEYINPUT )
1007  {
1008  if ( !bKeyPreNotify && pChild->ImplGetWindowImpl()->mbKeyInput )
1009  {
1010  sal_uInt16 nCode = aKeyCode.GetCode();
1011 
1012  // #101999# is focus in or below toolbox
1013  bool bToolboxFocus=false;
1014  if( (nCode == KEY_F1) && aKeyCode.IsShift() )
1015  {
1016  vcl::Window *pWin = pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin;
1017  while( pWin )
1018  {
1019  if( pWin->ImplGetWindowImpl()->mbToolBox )
1020  {
1021  bToolboxFocus = true;
1022  break;
1023  }
1024  else
1025  pWin = pWin->GetParent();
1026  }
1027  }
1028 
1029  // ContextMenu
1030  if ( (nCode == KEY_CONTEXTMENU) || ((nCode == KEY_F10) && aKeyCode.IsShift() && !aKeyCode.IsMod1() && !aKeyCode.IsMod2() ) )
1031  bRet = !ImplCallCommand( pChild, CommandEventId::ContextMenu );
1032  else if ( ( (nCode == KEY_F2) && aKeyCode.IsShift() ) || ( (nCode == KEY_F1) && aKeyCode.IsMod1() ) ||
1033  // #101999# no active help when focus in toolbox, simulate BalloonHelp instead
1034  ( (nCode == KEY_F1) && aKeyCode.IsShift() && bToolboxFocus ) )
1035  {
1036  // TipHelp via Keyboard (Shift-F2 or Ctrl-F1)
1037  // simulate mouseposition at center of window
1038 
1039  Size aSize = pChild->GetOutputSize();
1040  Point aPos( aSize.getWidth()/2, aSize.getHeight()/2 );
1041  aPos = pChild->OutputToScreenPixel( aPos );
1042 
1043  HelpEvent aHelpEvent( aPos, HelpEventMode::BALLOON );
1044  aHelpEvent.SetKeyboardActivated( true );
1046  pChild->RequestHelp( aHelpEvent );
1048  }
1049  else if ( (nCode == KEY_F1) || (nCode == KEY_HELP) )
1050  {
1051  if ( !aKeyCode.GetModifier() )
1052  {
1054  {
1055  Point aMousePos = pChild->OutputToScreenPixel( pChild->GetPointerPosPixel() );
1056  HelpEvent aHelpEvent( aMousePos, HelpEventMode::CONTEXT );
1057  pChild->RequestHelp( aHelpEvent );
1058  }
1059  else
1060  bRet = false;
1061  }
1062  else if ( aKeyCode.IsShift() )
1063  {
1064  if ( ImplGetSVHelpData().mbExtHelp )
1066  else
1067  bRet = false;
1068  }
1069  }
1070  else
1071  bRet = false;
1072  }
1073  }
1074  else
1075  {
1076  if ( !bKeyPreNotify && pChild->ImplGetWindowImpl()->mbKeyUp )
1077  bRet = false;
1078  }
1079 
1080  // #105591# send keyinput to parent if we are a floating window and the key was not processed yet
1081  if( !bRet && pWindow->ImplGetWindowImpl() && pWindow->ImplGetWindowImpl()->mbFloatWin && pWindow->GetParent() && (pWindow->ImplGetWindowImpl()->mpFrame != pWindow->GetParent()->ImplGetWindowImpl()->mpFrame) )
1082  {
1083  pChild = pWindow->GetParent();
1084 
1085  // call handler
1086  NotifyEvent aNEvt( nSVEvent, pChild, &aKeyEvt );
1087  bool bPreNotify = ImplCallPreNotify( aNEvt );
1088  if ( pChild->IsDisposed() )
1089  return true;
1090 
1091  if ( !bPreNotify )
1092  {
1093  if ( nSVEvent == MouseNotifyEvent::KEYINPUT )
1094  {
1095  pChild->ImplGetWindowImpl()->mbKeyInput = false;
1096  pChild->KeyInput( aKeyEvt );
1097  }
1098  else
1099  {
1100  pChild->ImplGetWindowImpl()->mbKeyUp = false;
1101  pChild->KeyUp( aKeyEvt );
1102  }
1103 
1104  if( !pChild->IsDisposed() )
1106  if ( pChild->IsDisposed() )
1107  return true;
1108  }
1109 
1110  if( bPreNotify || !pChild->ImplGetWindowImpl()->mbKeyInput )
1111  bRet = true;
1112  }
1113 
1114  return bRet;
1115 }
1116 
1117 static bool ImplHandleExtTextInput( vcl::Window* pWindow,
1118  const OUString& rText,
1119  const ExtTextInputAttr* pTextAttr,
1120  sal_Int32 nCursorPos, sal_uInt16 nCursorFlags )
1121 {
1122  ImplSVData* pSVData = ImplGetSVData();
1123  vcl::Window* pChild = nullptr;
1124 
1125  int nTries = 200;
1126  while( nTries-- )
1127  {
1128  pChild = pSVData->mpWinData->mpExtTextInputWin;
1129  if ( !pChild )
1130  {
1131  pChild = ImplGetKeyInputWindow( pWindow );
1132  if ( !pChild )
1133  return false;
1134  }
1135  if( !pChild->ImplGetWindowImpl()->mpFrameData->mnFocusId )
1136  break;
1137 
1139  {
1140  SAL_WARN("vcl", "Failed to get ext text input context");
1141  break;
1142  }
1144  }
1145 
1146  // If it is the first ExtTextInput call, we inform the information
1147  // and allocate the data, which we must store in this mode
1148  ImplWinData* pWinData = pChild->ImplGetWinData();
1149  if ( !pChild->ImplGetWindowImpl()->mbExtTextInput )
1150  {
1151  pChild->ImplGetWindowImpl()->mbExtTextInput = true;
1152  pWinData->mpExtOldText = OUString();
1153  pWinData->mpExtOldAttrAry.reset();
1154  pSVData->mpWinData->mpExtTextInputWin = pChild;
1156  }
1157 
1158  // be aware of being recursively called in StartExtTextInput
1159  if ( !pChild->ImplGetWindowImpl()->mbExtTextInput )
1160  return false;
1161 
1162  // Test for changes
1163  bool bOnlyCursor = false;
1164  sal_Int32 nMinLen = std::min( pWinData->mpExtOldText->getLength(), rText.getLength() );
1165  sal_Int32 nDeltaStart = 0;
1166  while ( nDeltaStart < nMinLen )
1167  {
1168  if ( (*pWinData->mpExtOldText)[nDeltaStart] != rText[nDeltaStart] )
1169  break;
1170  nDeltaStart++;
1171  }
1172  if ( pWinData->mpExtOldAttrAry || pTextAttr )
1173  {
1174  if ( !pWinData->mpExtOldAttrAry || !pTextAttr )
1175  nDeltaStart = 0;
1176  else
1177  {
1178  sal_Int32 i = 0;
1179  while ( i < nDeltaStart )
1180  {
1181  if ( pWinData->mpExtOldAttrAry[i] != pTextAttr[i] )
1182  {
1183  nDeltaStart = i;
1184  break;
1185  }
1186  i++;
1187  }
1188  }
1189  }
1190  if ( (nDeltaStart >= nMinLen) &&
1191  (pWinData->mpExtOldText->getLength() == rText.getLength()) )
1192  bOnlyCursor = true;
1193 
1194  // Call Event and store the information
1195  CommandExtTextInputData aData( rText, pTextAttr,
1196  nCursorPos, nCursorFlags,
1197  bOnlyCursor );
1198  *pWinData->mpExtOldText = rText;
1199  pWinData->mpExtOldAttrAry.reset();
1200  if ( pTextAttr )
1201  {
1202  pWinData->mpExtOldAttrAry.reset( new ExtTextInputAttr[rText.getLength()] );
1203  memcpy( pWinData->mpExtOldAttrAry.get(), pTextAttr, rText.getLength()*sizeof( ExtTextInputAttr ) );
1204  }
1205  return !ImplCallCommand( pChild, CommandEventId::ExtTextInput, &aData );
1206 }
1207 
1209 {
1210  ImplSVData* pSVData = ImplGetSVData();
1211  vcl::Window* pChild = pSVData->mpWinData->mpExtTextInputWin;
1212  bool bRet = false;
1213 
1214  if ( pChild )
1215  {
1216  pChild->ImplGetWindowImpl()->mbExtTextInput = false;
1217  pSVData->mpWinData->mpExtTextInputWin = nullptr;
1218  ImplWinData* pWinData = pChild->ImplGetWinData();
1219  pWinData->mpExtOldText.reset();
1220  pWinData->mpExtOldAttrAry.reset();
1222  }
1223 
1224  return bRet;
1225 }
1226 
1228  tools::Rectangle& rRect, long& rInputWidth,
1229  bool * pVertical )
1230 {
1231  ImplSVData* pSVData = ImplGetSVData();
1232  vcl::Window* pChild = pSVData->mpWinData->mpExtTextInputWin;
1233 
1234  if ( !pChild )
1235  pChild = ImplGetKeyInputWindow( pWindow );
1236  else
1237  {
1238  // Test, if the Window is related to the frame
1239  if ( !pWindow->ImplIsWindowOrChild( pChild ) )
1240  pChild = ImplGetKeyInputWindow( pWindow );
1241  }
1242 
1243  if ( pChild )
1244  {
1245  const OutputDevice *pChildOutDev = pChild->GetOutDev();
1247  const tools::Rectangle* pRect = pChild->GetCursorRect();
1248  if ( pRect )
1249  rRect = pChildOutDev->ImplLogicToDevicePixel( *pRect );
1250  else
1251  {
1252  vcl::Cursor* pCursor = pChild->GetCursor();
1253  if ( pCursor )
1254  {
1255  Point aPos = pChildOutDev->ImplLogicToDevicePixel( pCursor->GetPos() );
1256  Size aSize = pChild->LogicToPixel( pCursor->GetSize() );
1257  if ( !aSize.Width() )
1258  aSize.setWidth( pChild->GetSettings().GetStyleSettings().GetCursorSize() );
1259  rRect = tools::Rectangle( aPos, aSize );
1260  }
1261  else
1262  rRect = tools::Rectangle( Point( pChild->GetOutOffXPixel(), pChild->GetOutOffYPixel() ), Size() );
1263  }
1264  rInputWidth = pChild->ImplLogicWidthToDevicePixel( pChild->GetCursorExtTextInputWidth() );
1265  if ( !rInputWidth )
1266  rInputWidth = rRect.GetWidth();
1267  }
1268  if (pVertical != nullptr)
1269  *pVertical
1270  = pChild != nullptr && pChild->GetInputContext().GetFont().IsVertical();
1271 }
1272 
1274 {
1275  vcl::Window* pChild = ImplGetKeyInputWindow( pWindow );
1277  return !ImplCallCommand( pChild, CommandEventId::InputContextChange, &aData );
1278 }
1279 
1280 static bool ImplCallWheelCommand( const VclPtr<vcl::Window>& pWindow, const Point& rPos,
1281  const CommandWheelData* pWheelData )
1282 {
1283  Point aCmdMousePos = pWindow->ImplFrameToOutput( rPos );
1284  CommandEvent aCEvt( aCmdMousePos, CommandEventId::Wheel, true, pWheelData );
1285  NotifyEvent aNCmdEvt( MouseNotifyEvent::COMMAND, pWindow, &aCEvt );
1286  bool bPreNotify = ImplCallPreNotify( aNCmdEvt );
1287  if ( pWindow->IsDisposed() )
1288  return false;
1289  if ( !bPreNotify )
1290  {
1291  pWindow->ImplGetWindowImpl()->mbCommand = false;
1292  pWindow->Command( aCEvt );
1293  if ( pWindow->IsDisposed() )
1294  return false;
1295  if ( pWindow->ImplGetWindowImpl()->mbCommand )
1296  return true;
1297  }
1298  return false;
1299 }
1300 
1301 static bool acceptableWheelScrollTarget(const vcl::Window *pMouseWindow)
1302 {
1303  return (pMouseWindow && !pMouseWindow->isDisposed() && pMouseWindow->IsInputEnabled() && !pMouseWindow->IsInModalMode());
1304 }
1305 
1306 //If the last event at the same absolute screen position was handled by a
1307 //different window then reuse that window if the event occurs within 1/2 a
1308 //second, i.e. so scrolling down something like the calc sidebar that contains
1309 //widgets that respond to wheel events will continue to send the event to the
1310 //scrolling widget in favour of the widget that happens to end up under the
1311 //mouse.
1313 {
1314  return (rEvt.mnX == rPrevEvt.mnX && rEvt.mnY == rPrevEvt.mnY && rEvt.mnTime-rPrevEvt.mnTime < 500/*ms*/);
1315 }
1316 
1317 namespace {
1318 
1319 class HandleGestureEventBase
1320 {
1321 protected:
1322  ImplSVData* m_pSVData;
1323  VclPtr<vcl::Window> m_pWindow;
1324  Point m_aMousePos;
1325 
1326 public:
1327  HandleGestureEventBase(vcl::Window *pWindow, const Point &rMousePos)
1328  : m_pSVData(ImplGetSVData())
1329  , m_pWindow(pWindow)
1330  , m_aMousePos(rMousePos)
1331  {
1332  }
1333  bool Setup();
1334  vcl::Window* FindTarget();
1335  vcl::Window* Dispatch(vcl::Window* pTarget);
1336  virtual bool CallCommand(vcl::Window *pWindow, const Point &rMousePos) = 0;
1337  virtual ~HandleGestureEventBase() {}
1338 };
1339 
1340 }
1341 
1342 bool HandleGestureEventBase::Setup()
1343 {
1344 
1345  if (m_pSVData->mpWinData->mpAutoScrollWin)
1346  m_pSVData->mpWinData->mpAutoScrollWin->EndAutoScroll();
1347  if (ImplGetSVHelpData().mpHelpWin)
1348  ImplDestroyHelpWindow( true );
1349  return !m_pWindow->IsDisposed();
1350 }
1351 
1352 vcl::Window* HandleGestureEventBase::FindTarget()
1353 {
1354  // first check any floating window ( eg. drop down listboxes)
1355  vcl::Window *pMouseWindow = nullptr;
1356 
1357  if (m_pSVData->mpWinData->mpFirstFloat && !m_pSVData->mpWinData->mpCaptureWin &&
1358  !m_pSVData->mpWinData->mpFirstFloat->ImplIsFloatPopupModeWindow( m_pWindow ) )
1359  {
1360  bool bHitTestInsideRect = false;
1361  pMouseWindow = m_pSVData->mpWinData->mpFirstFloat->ImplFloatHitTest( m_pWindow, m_aMousePos, bHitTestInsideRect );
1362  if (!pMouseWindow)
1363  pMouseWindow = m_pSVData->mpWinData->mpFirstFloat;
1364  }
1365  // then try the window directly beneath the mouse
1366  if( !pMouseWindow )
1367  {
1368  pMouseWindow = m_pWindow->ImplFindWindow( m_aMousePos );
1369  }
1370  else
1371  {
1372  // transform coordinates to float window frame coordinates
1373  pMouseWindow = pMouseWindow->ImplFindWindow(
1374  pMouseWindow->OutputToScreenPixel(
1375  pMouseWindow->AbsoluteScreenToOutputPixel(
1376  m_pWindow->OutputToAbsoluteScreenPixel(
1377  m_pWindow->ScreenToOutputPixel( m_aMousePos ) ) ) ) );
1378  }
1379 
1380  while (acceptableWheelScrollTarget(pMouseWindow))
1381  {
1382  if (pMouseWindow->IsEnabled())
1383  break;
1384  //try the parent if this one is disabled
1385  pMouseWindow = pMouseWindow->GetParent();
1386  }
1387 
1388  return pMouseWindow;
1389 }
1390 
1391 vcl::Window *HandleGestureEventBase::Dispatch(vcl::Window* pMouseWindow)
1392 {
1393  vcl::Window *pDispatchedTo = nullptr;
1394 
1395  if (acceptableWheelScrollTarget(pMouseWindow) && pMouseWindow->IsEnabled())
1396  {
1397  // transform coordinates to float window frame coordinates
1398  Point aRelMousePos( pMouseWindow->OutputToScreenPixel(
1399  pMouseWindow->AbsoluteScreenToOutputPixel(
1400  m_pWindow->OutputToAbsoluteScreenPixel(
1401  m_pWindow->ScreenToOutputPixel( m_aMousePos ) ) ) ) );
1402  bool bPropogate = CallCommand(pMouseWindow, aRelMousePos);
1403  if (!bPropogate)
1404  pDispatchedTo = pMouseWindow;
1405  }
1406 
1407  // if the command was not handled try the focus window
1408  if (!pDispatchedTo)
1409  {
1410  vcl::Window* pFocusWindow = m_pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin;
1411  if ( pFocusWindow && (pFocusWindow != pMouseWindow) &&
1412  (pFocusWindow == m_pSVData->mpWinData->mpFocusWin) )
1413  {
1414  // no wheel-messages to disabled windows
1415  if ( pFocusWindow->IsEnabled() && pFocusWindow->IsInputEnabled() && ! pFocusWindow->IsInModalMode() )
1416  {
1417  // transform coordinates to focus window frame coordinates
1418  Point aRelMousePos( pFocusWindow->OutputToScreenPixel(
1419  pFocusWindow->AbsoluteScreenToOutputPixel(
1420  m_pWindow->OutputToAbsoluteScreenPixel(
1421  m_pWindow->ScreenToOutputPixel( m_aMousePos ) ) ) ) );
1422  bool bPropogate = CallCommand(pFocusWindow, aRelMousePos);
1423  if (!bPropogate)
1424  pDispatchedTo = pMouseWindow;
1425  }
1426  }
1427  }
1428  return pDispatchedTo;
1429 }
1430 
1431 namespace {
1432 
1433 class HandleWheelEvent : public HandleGestureEventBase
1434 {
1435 private:
1436  CommandWheelData m_aWheelData;
1437 public:
1438  HandleWheelEvent(vcl::Window *pWindow, const SalWheelMouseEvent& rEvt)
1439  : HandleGestureEventBase(pWindow, Point(rEvt.mnX, rEvt.mnY))
1440  {
1441  CommandWheelMode nMode;
1442  sal_uInt16 nCode = rEvt.mnCode;
1443  bool bHorz = rEvt.mbHorz;
1444  bool bPixel = rEvt.mbDeltaIsPixel;
1445  if ( nCode & KEY_MOD1 )
1446  nMode = CommandWheelMode::ZOOM;
1447  else if ( nCode & KEY_MOD2 )
1449  else
1450  {
1451  nMode = CommandWheelMode::SCROLL;
1452  // #i85450# interpret shift-wheel as horizontal wheel action
1453  if( (nCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3)) == KEY_SHIFT )
1454  bHorz = true;
1455  }
1456 
1457  m_aWheelData = CommandWheelData(rEvt.mnDelta, rEvt.mnNotchDelta, rEvt.mnScrollLines, nMode, nCode, bHorz, bPixel);
1458 
1459  }
1460  virtual bool CallCommand(vcl::Window *pWindow, const Point &rMousePos) override
1461  {
1462  return ImplCallWheelCommand(pWindow, rMousePos, &m_aWheelData);
1463  }
1464  bool HandleEvent(const SalWheelMouseEvent& rEvt);
1465 };
1466 
1467 }
1468 
1469 bool HandleWheelEvent::HandleEvent(const SalWheelMouseEvent& rEvt)
1470 {
1471  if (!Setup())
1472  return false;
1473 
1474  VclPtr<vcl::Window> xMouseWindow = FindTarget();
1475 
1476  ImplSVData* pSVData = ImplGetSVData();
1477 
1478  // avoid the problem that scrolling via wheel to this point brings a widget
1479  // under the mouse that also accepts wheel commands, so stick with the old
1480  // widget if the time gap is very small
1483  {
1484  xMouseWindow = pSVData->mpWinData->mpLastWheelWindow;
1485  }
1486 
1487  pSVData->mpWinData->maLastWheelEvent = rEvt;
1488 
1489  pSVData->mpWinData->mpLastWheelWindow = Dispatch(xMouseWindow);
1490 
1491  return pSVData->mpWinData->mpLastWheelWindow;
1492 }
1493 
1494 namespace {
1495 
1496 class HandleGestureEvent : public HandleGestureEventBase
1497 {
1498 public:
1499  HandleGestureEvent(vcl::Window *pWindow, const Point &rMousePos)
1500  : HandleGestureEventBase(pWindow, rMousePos)
1501  {
1502  }
1503  bool HandleEvent();
1504 };
1505 
1506 }
1507 
1508 bool HandleGestureEvent::HandleEvent()
1509 {
1510  if (!Setup())
1511  return false;
1512 
1513  vcl::Window *pTarget = FindTarget();
1514 
1515  bool bHandled = Dispatch(pTarget) != nullptr;
1516  return bHandled;
1517 }
1518 
1519 static bool ImplHandleWheelEvent(vcl::Window* pWindow, const SalWheelMouseEvent& rEvt)
1520 {
1521  HandleWheelEvent aHandler(pWindow, rEvt);
1522  return aHandler.HandleEvent(rEvt);
1523 }
1524 
1525 namespace {
1526 
1527 class HandleSwipeEvent : public HandleGestureEvent
1528 {
1529 private:
1530  CommandSwipeData m_aSwipeData;
1531 public:
1532  HandleSwipeEvent(vcl::Window *pWindow, const SalSwipeEvent& rEvt)
1533  : HandleGestureEvent(pWindow, Point(rEvt.mnX, rEvt.mnY)),
1534  m_aSwipeData(rEvt.mnVelocityX)
1535  {
1536  }
1537  virtual bool CallCommand(vcl::Window *pWindow, const Point &/*rMousePos*/) override
1538  {
1539  return ImplCallCommand(pWindow, CommandEventId::Swipe, &m_aSwipeData);
1540  }
1541 };
1542 
1543 }
1544 
1545 static bool ImplHandleSwipe(vcl::Window *pWindow, const SalSwipeEvent& rEvt)
1546 {
1547  HandleSwipeEvent aHandler(pWindow, rEvt);
1548  return aHandler.HandleEvent();
1549 }
1550 
1551 namespace {
1552 
1553 class HandleLongPressEvent : public HandleGestureEvent
1554 {
1555 private:
1556  CommandLongPressData m_aLongPressData;
1557 public:
1558  HandleLongPressEvent(vcl::Window *pWindow, const SalLongPressEvent& rEvt)
1559  : HandleGestureEvent(pWindow, Point(rEvt.mnX, rEvt.mnY)),
1560  m_aLongPressData(rEvt.mnX, rEvt.mnY)
1561  {
1562  }
1563  virtual bool CallCommand(vcl::Window *pWindow, const Point &/*rMousePos*/) override
1564  {
1565  return ImplCallCommand(pWindow, CommandEventId::LongPress, &m_aLongPressData);
1566  }
1567 };
1568 
1569 }
1570 
1571 static bool ImplHandleLongPress(vcl::Window *pWindow, const SalLongPressEvent& rEvt)
1572 {
1573  HandleLongPressEvent aHandler(pWindow, rEvt);
1574  return aHandler.HandleEvent();
1575 }
1576 
1577 namespace {
1578 
1579 class HandleGeneralGestureEvent : public HandleGestureEvent
1580 {
1581 private:
1582  CommandGestureData m_aGestureData;
1583 
1584 public:
1585  HandleGeneralGestureEvent(vcl::Window* pWindow, const SalGestureEvent& rEvent)
1586  : HandleGestureEvent(pWindow, Point(rEvent.mnX, rEvent.mnY))
1587  , m_aGestureData(rEvent.mnX, rEvent.mnY, rEvent.meEventType, rEvent.mfOffset, rEvent.meOrientation)
1588  {
1589  }
1590 
1591  virtual bool CallCommand(vcl::Window* pWindow, const Point& /*rMousePos*/) override
1592  {
1593  return ImplCallCommand(pWindow, CommandEventId::Gesture, &m_aGestureData);
1594  }
1595 };
1596 
1597 }
1598 
1599 static bool ImplHandleGestureEvent(vcl::Window* pWindow, const SalGestureEvent& rEvent)
1600 {
1601  HandleGeneralGestureEvent aHandler(pWindow, rEvent);
1602  return aHandler.HandleEvent();
1603 }
1604 
1605 static void ImplHandlePaint( vcl::Window* pWindow, const tools::Rectangle& rBoundRect, bool bImmediateUpdate )
1606 {
1607  // system paint events must be checked for re-mirroring
1609 
1610  // trigger paint for all windows that live in the new paint region
1611  vcl::Region aRegion( rBoundRect );
1612  pWindow->ImplInvalidateOverlapFrameRegion( aRegion );
1613  if( bImmediateUpdate )
1614  {
1615  // #i87663# trigger possible pending resize notifications
1616  // (GetSizePixel does that for us)
1617  pWindow->GetSizePixel();
1618  // force drawing immediately
1619  pWindow->PaintImmediately();
1620  }
1621 }
1622 
1623 static void KillOwnPopups( vcl::Window const * pWindow )
1624 {
1625  ImplSVData* pSVData = ImplGetSVData();
1626  vcl::Window *pParent = pWindow->ImplGetWindowImpl()->mpFrameWindow;
1627  vcl::Window *pChild = pSVData->mpWinData->mpFirstFloat;
1628  if ( pChild && pParent->ImplIsWindowOrChild( pChild, true ) )
1629  {
1630  if (!(pSVData->mpWinData->mpFirstFloat->GetPopupModeFlags()
1634  }
1635 }
1636 
1637 void ImplHandleResize( vcl::Window* pWindow, long nNewWidth, long nNewHeight )
1638 {
1639  const bool bChanged = (nNewWidth != pWindow->GetOutputWidthPixel()) || (nNewHeight != pWindow->GetOutputHeightPixel());
1640  if (bChanged && pWindow->GetStyle() & (WB_MOVEABLE|WB_SIZEABLE))
1641  {
1642  KillOwnPopups( pWindow );
1643  if( pWindow->ImplGetWindow() != ImplGetSVHelpData().mpHelpWin )
1644  ImplDestroyHelpWindow( true );
1645  }
1646 
1647  if (
1648  (nNewWidth > 0 && nNewHeight > 0) ||
1650  )
1651  {
1652  if (bChanged)
1653  {
1654  pWindow->mnOutWidth = nNewWidth;
1655  pWindow->mnOutHeight = nNewHeight;
1656  pWindow->ImplGetWindowImpl()->mbWaitSystemResize = false;
1657  if ( pWindow->IsReallyVisible() )
1658  pWindow->ImplSetClipFlag();
1659  if ( pWindow->IsVisible() || pWindow->ImplGetWindow()->ImplGetWindowImpl()->mbAllResize ||
1660  ( pWindow->ImplGetWindowImpl()->mbFrame && pWindow->ImplGetWindowImpl()->mpClientWindow ) ) // propagate resize for system border windows
1661  {
1662  bool bStartTimer = true;
1663  // use resize buffering for user resizes
1664  // ownerdraw decorated windows and floating windows can be resized immediately (i.e. synchronously)
1665  if( pWindow->ImplGetWindowImpl()->mbFrame && (pWindow->GetStyle() & WB_SIZEABLE)
1666  && !(pWindow->GetStyle() & WB_OWNERDRAWDECORATION) // synchronous resize for ownerdraw decorated windows (toolbars)
1667  && !pWindow->ImplGetWindowImpl()->mbFloatWin ) // synchronous resize for floating windows, #i43799#
1668  {
1669  if( pWindow->ImplGetWindowImpl()->mpClientWindow )
1670  {
1671  // #i42750# presentation wants to be informed about resize
1672  // as early as possible
1673  WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pWindow->ImplGetWindowImpl()->mpClientWindow.get());
1674  if( ! pWorkWindow || pWorkWindow->IsPresentationMode() )
1675  bStartTimer = false;
1676  }
1677  else
1678  {
1679  WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pWindow);
1680  if( ! pWorkWindow || pWorkWindow->IsPresentationMode() )
1681  bStartTimer = false;
1682  }
1683  }
1684  else
1685  bStartTimer = false;
1686 
1687  if( bStartTimer )
1689  else
1690  pWindow->ImplCallResize(); // otherwise menus cannot be positioned
1691  }
1692  else
1693  pWindow->ImplGetWindowImpl()->mbCallResize = true;
1694 
1695  if (pWindow->SupportsDoubleBuffering() && pWindow->ImplGetWindowImpl()->mbFrame)
1696  {
1697  // Propagate resize for the frame's buffer.
1699  }
1700  }
1701  }
1702 
1703  pWindow->ImplGetWindowImpl()->mpFrameData->mbNeedSysWindow = (nNewWidth < IMPL_MIN_NEEDSYSWIN) ||
1704  (nNewHeight < IMPL_MIN_NEEDSYSWIN);
1705  bool bMinimized = (nNewWidth <= 0) || (nNewHeight <= 0);
1706  if( bMinimized != pWindow->ImplGetWindowImpl()->mpFrameData->mbMinimized )
1707  pWindow->ImplGetWindowImpl()->mpFrameWindow->ImplNotifyIconifiedState( bMinimized );
1708  pWindow->ImplGetWindowImpl()->mpFrameData->mbMinimized = bMinimized;
1709 }
1710 
1711 static void ImplHandleMove( vcl::Window* pWindow )
1712 {
1713  if( pWindow->ImplGetWindowImpl()->mbFrame && pWindow->ImplIsFloatingWindow() && pWindow->IsReallyVisible() )
1714  {
1715  static_cast<FloatingWindow*>(pWindow)->EndPopupMode( FloatWinPopupEndFlags::TearOff );
1716  pWindow->ImplCallMove();
1717  }
1718 
1719  if( pWindow->GetStyle() & (WB_MOVEABLE|WB_SIZEABLE) )
1720  {
1721  KillOwnPopups( pWindow );
1722  if( pWindow->ImplGetWindow() != ImplGetSVHelpData().mpHelpWin )
1723  ImplDestroyHelpWindow( true );
1724  }
1725 
1726  if ( pWindow->IsVisible() )
1727  pWindow->ImplCallMove();
1728  else
1729  pWindow->ImplGetWindowImpl()->mbCallMove = true; // make sure the framepos will be updated on the next Show()
1730 
1731  if ( pWindow->ImplGetWindowImpl()->mbFrame && pWindow->ImplGetWindowImpl()->mpClientWindow )
1732  pWindow->ImplGetWindowImpl()->mpClientWindow->ImplCallMove(); // notify client to update geometry
1733 
1734 }
1735 
1736 static void ImplHandleMoveResize( vcl::Window* pWindow, long nNewWidth, long nNewHeight )
1737 {
1738  ImplHandleMove( pWindow );
1739  ImplHandleResize( pWindow, nNewWidth, nNewHeight );
1740 }
1741 
1742 static void ImplActivateFloatingWindows( vcl::Window const * pWindow, bool bActive )
1743 {
1744  // First check all overlapping windows
1745  vcl::Window* pTempWindow = pWindow->ImplGetWindowImpl()->mpFirstOverlap;
1746  while ( pTempWindow )
1747  {
1748  if ( pTempWindow->GetActivateMode() == ActivateModeFlags::NONE )
1749  {
1750  if ( (pTempWindow->GetType() == WindowType::BORDERWINDOW) &&
1751  (pTempWindow->ImplGetWindow()->GetType() == WindowType::FLOATINGWINDOW) )
1752  static_cast<ImplBorderWindow*>(pTempWindow)->SetDisplayActive( bActive );
1753  }
1754 
1755  ImplActivateFloatingWindows( pTempWindow, bActive );
1756  pTempWindow = pTempWindow->ImplGetWindowImpl()->mpNext;
1757  }
1758 }
1759 
1760 IMPL_LINK_NOARG(vcl::Window, ImplAsyncFocusHdl, void*, void)
1761 {
1762  ImplGetWindowImpl()->mpFrameData->mnFocusId = nullptr;
1763 
1764  // If the status has been preserved, because we got back the focus
1765  // in the meantime, we do nothing
1766  bool bHasFocus = ImplGetWindowImpl()->mpFrameData->mbHasFocus || ImplGetWindowImpl()->mpFrameData->mbSysObjFocus;
1767 
1768  // next execute the delayed functions
1769  if ( bHasFocus )
1770  {
1771  // redraw all floating windows inactive
1772  if ( ImplGetWindowImpl()->mpFrameData->mbStartFocusState != bHasFocus )
1773  ImplActivateFloatingWindows( this, bHasFocus );
1774 
1775  if ( ImplGetWindowImpl()->mpFrameData->mpFocusWin )
1776  {
1777  bool bHandled = false;
1778  if ( ImplGetWindowImpl()->mpFrameData->mpFocusWin->IsInputEnabled() &&
1779  ! ImplGetWindowImpl()->mpFrameData->mpFocusWin->IsInModalMode() )
1780  {
1781  if ( ImplGetWindowImpl()->mpFrameData->mpFocusWin->IsEnabled() )
1782  {
1783  ImplGetWindowImpl()->mpFrameData->mpFocusWin->GrabFocus();
1784  bHandled = true;
1785  }
1786  else if( ImplGetWindowImpl()->mpFrameData->mpFocusWin->ImplHasDlgCtrl() )
1787  {
1788  // #109094# if the focus is restored to a disabled dialog control (was disabled meanwhile)
1789  // try to move it to the next control
1790  ImplGetWindowImpl()->mpFrameData->mpFocusWin->ImplDlgCtrlNextWindow();
1791  bHandled = true;
1792  }
1793  }
1794  if ( !bHandled )
1795  {
1796  ImplSVData* pSVData = ImplGetSVData();
1797  vcl::Window* pTopLevelWindow = ImplGetWindowImpl()->mpFrameData->mpFocusWin->ImplGetFirstOverlapWindow();
1798 
1799  if ((!pTopLevelWindow->IsInputEnabled() || pTopLevelWindow->IsInModalMode())
1800  && !pSVData->mpWinData->mpExecuteDialogs.empty())
1802  else
1803  pTopLevelWindow->GrabFocus();
1804  }
1805  }
1806  else
1807  GrabFocus();
1808  }
1809  else
1810  {
1811  vcl::Window* pFocusWin = ImplGetWindowImpl()->mpFrameData->mpFocusWin;
1812  if ( pFocusWin )
1813  {
1814  ImplSVData* pSVData = ImplGetSVData();
1815 
1816  if (pSVData->mpWinData->mpFocusWin == pFocusWin)
1817  {
1818  // transfer the FocusWindow
1819  vcl::Window* pOverlapWindow = pFocusWin->ImplGetFirstOverlapWindow();
1820  pOverlapWindow->ImplGetWindowImpl()->mpLastFocusWindow = pFocusWin;
1821  pSVData->mpWinData->mpFocusWin = nullptr;
1822 
1823  if ( pFocusWin->ImplGetWindowImpl()->mpCursor )
1824  pFocusWin->ImplGetWindowImpl()->mpCursor->ImplHide();
1825 
1826  // call the Deactivate
1827  vcl::Window* pOldOverlapWindow = pFocusWin->ImplGetFirstOverlapWindow();
1828  vcl::Window* pOldRealWindow = pOldOverlapWindow->ImplGetWindow();
1829 
1830  pOldOverlapWindow->ImplGetWindowImpl()->mbActive = false;
1831  pOldOverlapWindow->Deactivate();
1832  if ( pOldRealWindow != pOldOverlapWindow )
1833  {
1834  pOldRealWindow->ImplGetWindowImpl()->mbActive = false;
1835  pOldRealWindow->Deactivate();
1836  }
1837 
1838  // TrackingMode is ended in ImplHandleLoseFocus
1839 #ifdef _WIN32
1840  // To avoid problems with the Unix IME
1841  pFocusWin->EndExtTextInput();
1842 #endif
1843 
1844  NotifyEvent aNEvt(MouseNotifyEvent::LOSEFOCUS, pFocusWin);
1845  if (!ImplCallPreNotify(aNEvt))
1846  pFocusWin->CompatLoseFocus();
1847  pFocusWin->ImplCallDeactivateListeners(nullptr);
1848  }
1849  }
1850 
1851  // Redraw all floating window inactive
1852  if ( ImplGetWindowImpl()->mpFrameData->mbStartFocusState != bHasFocus )
1853  ImplActivateFloatingWindows( this, bHasFocus );
1854  }
1855 }
1856 
1857 static void ImplHandleGetFocus( vcl::Window* pWindow )
1858 {
1859  pWindow->ImplGetWindowImpl()->mpFrameData->mbHasFocus = true;
1860 
1861  // execute Focus-Events after a delay, such that SystemChildWindows
1862  // do not blink when they receive focus
1863  if ( !pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId )
1864  {
1866  pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId = Application::PostUserEvent( LINK( pWindow, vcl::Window, ImplAsyncFocusHdl ), nullptr, true);
1867  vcl::Window* pFocusWin = pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin;
1868  if ( pFocusWin && pFocusWin->ImplGetWindowImpl()->mpCursor )
1869  pFocusWin->ImplGetWindowImpl()->mpCursor->ImplShow();
1870  }
1871 }
1872 
1873 static void ImplHandleLoseFocus( vcl::Window* pWindow )
1874 {
1875  ImplSVData* pSVData = ImplGetSVData();
1876 
1877  // Abort the autoscroll if the frame loses focus
1878  if (pSVData->mpWinData->mpAutoScrollWin)
1880 
1881  // Abort tracking if the frame loses focus
1882  if (pSVData->mpWinData->mpTrackWin)
1883  {
1884  if (pSVData->mpWinData->mpTrackWin->ImplGetWindowImpl()->mpFrameWindow == pWindow)
1886  }
1887 
1888  pWindow->ImplGetWindowImpl()->mpFrameData->mbHasFocus = false;
1889 
1890  // execute Focus-Events after a delay, such that SystemChildWindows
1891  // do not flicker when they receive focus
1892  if ( !pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId )
1893  {
1895  pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId = Application::PostUserEvent( LINK( pWindow, vcl::Window, ImplAsyncFocusHdl ), nullptr, true );
1896  }
1897 
1898  vcl::Window* pFocusWin = pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin;
1899  if ( pFocusWin && pFocusWin->ImplGetWindowImpl()->mpCursor )
1900  pFocusWin->ImplGetWindowImpl()->mpCursor->ImplHide();
1901 
1902  // Make sure that no menu is visible when a toplevel window loses focus.
1903  VclPtr<FloatingWindow> pFirstFloat = pSVData->mpWinData->mpFirstFloat;
1904  if (pFirstFloat && !pWindow->GetParent())
1906 }
1907 
1908 namespace {
1909 
1910 struct DelayedCloseEvent
1911 {
1912  VclPtr<vcl::Window> pWindow;
1913 };
1914 
1915 }
1916 
1917 static void DelayedCloseEventLink( void* pCEvent, void* )
1918 {
1919  DelayedCloseEvent* pEv = static_cast<DelayedCloseEvent*>(pCEvent);
1920 
1921  if( ! pEv->pWindow->IsDisposed() )
1922  {
1923  // dispatch to correct window type
1924  if( pEv->pWindow->IsSystemWindow() )
1925  static_cast<SystemWindow*>(pEv->pWindow.get())->Close();
1926  else if( pEv->pWindow->IsDockingWindow() )
1927  static_cast<DockingWindow*>(pEv->pWindow.get())->Close();
1928  }
1929  delete pEv;
1930 }
1931 
1932 static void ImplHandleClose( const vcl::Window* pWindow )
1933 {
1934  ImplSVData* pSVData = ImplGetSVData();
1935 
1936  bool bWasPopup = false;
1937  if( pWindow->ImplIsFloatingWindow() &&
1938  static_cast<const FloatingWindow*>(pWindow)->ImplIsInPrivatePopupMode() )
1939  {
1940  bWasPopup = true;
1941  }
1942 
1943  // on Close stop all floating modes and end popups
1944  if (pSVData->mpWinData->mpFirstFloat)
1945  {
1946  FloatingWindow* pLastLevelFloat;
1947  pLastLevelFloat = pSVData->mpWinData->mpFirstFloat->ImplFindLastLevelFloat();
1949  }
1950  if ( ImplGetSVHelpData().mbExtHelpMode )
1951  Help::EndExtHelp();
1952  if ( ImplGetSVHelpData().mpHelpWin )
1953  ImplDestroyHelpWindow( false );
1954  // AutoScrollMode
1955  if (pSVData->mpWinData->mpAutoScrollWin)
1957 
1958  if (pSVData->mpWinData->mpTrackWin)
1960 
1961  if (bWasPopup)
1962  return;
1963 
1964  vcl::Window *pWin = pWindow->ImplGetWindow();
1965  SystemWindow* pSysWin = dynamic_cast<SystemWindow*>(pWin);
1966  if (pSysWin)
1967  {
1968  // See if the custom close handler is set.
1969  const Link<SystemWindow&,void>& rLink = pSysWin->GetCloseHdl();
1970  if (rLink.IsSet())
1971  {
1972  rLink.Call(*pSysWin);
1973  return;
1974  }
1975  }
1976 
1977  // check whether close is allowed
1978  if ( pWin->IsEnabled() && pWin->IsInputEnabled() && !pWin->IsInModalMode() )
1979  {
1980  DelayedCloseEvent* pEv = new DelayedCloseEvent;
1981  pEv->pWindow = pWin;
1983  }
1984 }
1985 
1986 static void ImplHandleUserEvent( ImplSVEvent* pSVEvent )
1987 {
1988  if ( pSVEvent )
1989  {
1990  if ( pSVEvent->mbCall )
1991  {
1992  pSVEvent->maLink.Call( pSVEvent->mpData );
1993  }
1994 
1995  delete pSVEvent;
1996  }
1997 }
1998 
2000 {
2002  if ( !pEvent->mnCode )
2004  if ( (pEvent->mnCode & MOUSE_LEFT) && !(pEvent->mnCode & KEY_MOD1) )
2006  if ( (pEvent->mnCode & MOUSE_LEFT) && (pEvent->mnCode & KEY_MOD1) )
2008  return nMode;
2009 }
2010 
2012 {
2014  if ( pEvent->mnButton == MOUSE_LEFT )
2016  if ( (pEvent->mnButton == MOUSE_LEFT) && !(pEvent->mnCode & (MOUSE_MIDDLE | MOUSE_RIGHT)) )
2017  nMode |= MouseEventModifiers::SELECT;
2018  if ( (pEvent->mnButton == MOUSE_LEFT) && (pEvent->mnCode & KEY_MOD1) &&
2019  !(pEvent->mnCode & (MOUSE_MIDDLE | MOUSE_RIGHT | KEY_SHIFT)) )
2021  if ( (pEvent->mnButton == MOUSE_LEFT) && (pEvent->mnCode & KEY_SHIFT) &&
2022  !(pEvent->mnCode & (MOUSE_MIDDLE | MOUSE_RIGHT | KEY_MOD1)) )
2024  return nMode;
2025 }
2026 
2027 static bool ImplHandleSalMouseLeave( vcl::Window* pWindow, SalMouseEvent const * pEvent )
2028 {
2029  return ImplHandleMouseEvent( pWindow, MouseNotifyEvent::MOUSEMOVE, true,
2030  pEvent->mnX, pEvent->mnY,
2031  pEvent->mnTime, pEvent->mnCode,
2032  ImplGetMouseMoveMode( pEvent ) );
2033 }
2034 
2035 static bool ImplHandleSalMouseMove( vcl::Window* pWindow, SalMouseEvent const * pEvent )
2036 {
2037  return ImplHandleMouseEvent( pWindow, MouseNotifyEvent::MOUSEMOVE, false,
2038  pEvent->mnX, pEvent->mnY,
2039  pEvent->mnTime, pEvent->mnCode,
2040  ImplGetMouseMoveMode( pEvent ) );
2041 }
2042 
2043 static bool ImplHandleSalMouseButtonDown( vcl::Window* pWindow, SalMouseEvent const * pEvent )
2044 {
2046  pEvent->mnX, pEvent->mnY,
2047  pEvent->mnTime,
2048 #ifdef MACOSX
2049  pEvent->mnButton | (pEvent->mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3)),
2050 #else
2051  pEvent->mnButton | (pEvent->mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)),
2052 #endif
2053  ImplGetMouseButtonMode( pEvent ) );
2054 }
2055 
2056 static bool ImplHandleSalMouseButtonUp( vcl::Window* pWindow, SalMouseEvent const * pEvent )
2057 {
2058  return ImplHandleMouseEvent( pWindow, MouseNotifyEvent::MOUSEBUTTONUP, false,
2059  pEvent->mnX, pEvent->mnY,
2060  pEvent->mnTime,
2061 #ifdef MACOSX
2062  pEvent->mnButton | (pEvent->mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3)),
2063 #else
2064  pEvent->mnButton | (pEvent->mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)),
2065 #endif
2066  ImplGetMouseButtonMode( pEvent ) );
2067 }
2068 
2069 static bool ImplHandleMenuEvent( vcl::Window const * pWindow, SalMenuEvent* pEvent, SalEvent nEvent )
2070 {
2071  // Find SystemWindow and its Menubar and let it dispatch the command
2072  bool bRet = false;
2073  vcl::Window *pWin = pWindow->ImplGetWindowImpl()->mpFirstChild;
2074  while ( pWin )
2075  {
2076  if ( pWin->ImplGetWindowImpl()->mbSysWin )
2077  break;
2078  pWin = pWin->ImplGetWindowImpl()->mpNext;
2079  }
2080  if( pWin )
2081  {
2082  MenuBar *pMenuBar = static_cast<SystemWindow*>(pWin)->GetMenuBar();
2083  if( pMenuBar )
2084  {
2085  switch( nEvent )
2086  {
2088  pMenuBar->HandleMenuActivateEvent( static_cast<Menu*>(pEvent->mpMenu) );
2089  bRet = true;
2090  break;
2092  pMenuBar->HandleMenuDeActivateEvent( static_cast<Menu*>(pEvent->mpMenu) );
2093  bRet = true;
2094  break;
2096  bRet = pMenuBar->HandleMenuHighlightEvent( static_cast<Menu*>(pEvent->mpMenu), pEvent->mnId );
2097  break;
2099  bRet = pMenuBar->HandleMenuButtonEvent( pEvent->mnId );
2100  break;
2101  case SalEvent::MenuCommand:
2102  bRet = pMenuBar->HandleMenuCommandEvent( static_cast<Menu*>(pEvent->mpMenu), pEvent->mnId );
2103  break;
2104  default:
2105  break;
2106  }
2107  }
2108  }
2109  return bRet;
2110 }
2111 
2112 static void ImplHandleSalKeyMod( vcl::Window* pWindow, SalKeyModEvent const * pEvent )
2113 {
2114  ImplSVData* pSVData = ImplGetSVData();
2115  vcl::Window* pTrackWin = pSVData->mpWinData->mpTrackWin;
2116  if ( pTrackWin )
2117  pWindow = pTrackWin;
2118 #ifdef MACOSX
2119  sal_uInt16 nOldCode = pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3);
2120 #else
2121  sal_uInt16 nOldCode = pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2);
2122 #endif
2123  sal_uInt16 nNewCode = pEvent->mnCode;
2124  if ( nOldCode != nNewCode )
2125  {
2126 #ifdef MACOSX
2127  nNewCode |= pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & ~(KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3);
2128 #else
2129  nNewCode |= pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & ~(KEY_SHIFT | KEY_MOD1 | KEY_MOD2);
2130 #endif
2131  pWindow->ImplGetWindowImpl()->mpFrameWindow->ImplCallMouseMove( nNewCode, true );
2132  }
2133 
2134  // #105224# send commandevent to allow special treatment of Ctrl-LeftShift/Ctrl-RightShift etc.
2135  // + auto-accelerator feature, tdf#92630
2136 
2137  // try to find a key input window...
2138  vcl::Window* pChild = ImplGetKeyInputWindow( pWindow );
2139  //...otherwise fail safe...
2140  if (!pChild)
2141  pChild = pWindow;
2142 
2143  CommandModKeyData data( pEvent->mnModKeyCode, pEvent->mbDown );
2145 }
2146 
2148 {
2149  // find window
2150  vcl::Window* pChild = ImplGetKeyInputWindow( pWindow );
2151  if ( !pChild )
2152  return;
2153 
2155 }
2156 
2157 static void ImplHandleSalSettings( SalEvent nEvent )
2158 {
2159  Application* pApp = GetpApp();
2160  if ( !pApp )
2161  return;
2162 
2163  if ( nEvent == SalEvent::SettingsChanged )
2164  {
2165  AllSettings aSettings = Application::GetSettings();
2166  Application::MergeSystemSettings( aSettings );
2167  pApp->OverrideSystemSettings( aSettings );
2168  Application::SetSettings( aSettings );
2169  }
2170  else
2171  {
2173  switch ( nEvent )
2174  {
2178  break;
2181  break;
2182  case SalEvent::FontChanged:
2185  break;
2186  default:
2188  break;
2189  }
2190 
2191  if ( nType != DataChangedEventType::NONE )
2192  {
2193  DataChangedEvent aDCEvt( nType );
2196  }
2197  }
2198 }
2199 
2201 {
2202  tools::Rectangle aCursorRect;
2203  ImplHandleExtTextInputPos( pWindow, aCursorRect, pEvt->mnExtWidth, &pEvt->mbVertical );
2204  if ( aCursorRect.IsEmpty() )
2205  {
2206  pEvt->mnX = -1;
2207  pEvt->mnY = -1;
2208  pEvt->mnWidth = -1;
2209  pEvt->mnHeight = -1;
2210  }
2211  else
2212  {
2213  pEvt->mnX = aCursorRect.Left();
2214  pEvt->mnY = aCursorRect.Top();
2215  pEvt->mnWidth = aCursorRect.GetWidth();
2216  pEvt->mnHeight = aCursorRect.GetHeight();
2217  }
2218 }
2219 
2220 static bool ImplHandleShowDialog( vcl::Window* pWindow, ShowDialogId nDialogId )
2221 {
2222  if( ! pWindow )
2223  return false;
2224 
2225  if( pWindow->GetType() == WindowType::BORDERWINDOW )
2226  {
2227  vcl::Window* pWrkWin = pWindow->GetWindow( GetWindowType::Client );
2228  if( pWrkWin )
2229  pWindow = pWrkWin;
2230  }
2231  CommandDialogData aCmdData( nDialogId );
2232  return ImplCallCommand( pWindow, CommandEventId::ShowDialog, &aCmdData );
2233 }
2234 
2236  OUString& rText,
2237  Selection &rSelRange )
2238 {
2239  vcl::Window* pChild = ImplGetKeyInputWindow( pWindow );
2240 
2241  if ( !pChild )
2242  {
2243  rText.clear();
2244  rSelRange.setMin( 0 );
2245  rSelRange.setMax( 0 );
2246  }
2247  else
2248  {
2249  rText = pChild->GetSurroundingText();
2250  Selection aSel = pChild->GetSurroundingTextSelection();
2251  rSelRange.setMin( aSel.Min() );
2252  rSelRange.setMax( aSel.Max() );
2253  }
2254 }
2255 
2258 {
2259  Selection aSelRange;
2260  ImplHandleSurroundingTextRequest( pWindow, pEvt->maText, aSelRange );
2261 
2262  aSelRange.Justify();
2263 
2264  if( aSelRange.Min() < 0 )
2265  pEvt->mnStart = 0;
2266  else if( aSelRange.Min() > pEvt->maText.getLength() )
2267  pEvt->mnStart = pEvt->maText.getLength();
2268  else
2269  pEvt->mnStart = aSelRange.Min();
2270 
2271  if( aSelRange.Max() < 0 )
2272  pEvt->mnStart = 0;
2273  else if( aSelRange.Max() > pEvt->maText.getLength() )
2274  pEvt->mnEnd = pEvt->maText.getLength();
2275  else
2276  pEvt->mnEnd = aSelRange.Max();
2277 }
2278 
2280  sal_uLong nStart,
2281  sal_uLong nEnd )
2282 {
2283  vcl::Window* pChild = ImplGetKeyInputWindow( pWindow );
2284  if( pChild )
2285  {
2286  CommandSelectionChangeData data( nStart, nEnd );
2288  }
2289 }
2290 
2292 {
2293  vcl::Window* pChild = ImplGetKeyInputWindow( pWindow );
2294  if( pChild )
2296 }
2297 
2300 {
2301  pEvt->mbValid = false;
2302  pEvt->mbVertical = false;
2303  pEvt->mnCursorBoundX = 0;
2304  pEvt->mnCursorBoundY = 0;
2305  pEvt->mnCursorBoundWidth = 0;
2306  pEvt->mnCursorBoundHeight = 0;
2307 
2308  ImplSVData* pSVData = ImplGetSVData();
2309  vcl::Window* pChild = pSVData->mpWinData->mpExtTextInputWin;
2310 
2311  if ( !pChild )
2312  pChild = ImplGetKeyInputWindow( pWindow );
2313  else
2314  {
2315  // Test, if the Window is related to the frame
2316  if ( !pWindow->ImplIsWindowOrChild( pChild ) )
2317  pChild = ImplGetKeyInputWindow( pWindow );
2318  }
2319 
2320  if( !pChild )
2321  return;
2322 
2324 
2325  ImplWinData* pWinData = pChild->ImplGetWinData();
2326  if ( !(pWinData->mpCompositionCharRects && pEvt->mnCharPos < o3tl::make_unsigned( pWinData->mnCompositionCharRects )) )
2327  return;
2328 
2329  const OutputDevice *pChildOutDev = pChild->GetOutDev();
2330  const tools::Rectangle& aRect = pWinData->mpCompositionCharRects[ pEvt->mnCharPos ];
2331  tools::Rectangle aDeviceRect = pChildOutDev->ImplLogicToDevicePixel( aRect );
2332  Point aAbsScreenPos = pChild->OutputToAbsoluteScreenPixel( pChild->ScreenToOutputPixel(aDeviceRect.TopLeft()) );
2333  pEvt->mnCursorBoundX = aAbsScreenPos.X();
2334  pEvt->mnCursorBoundY = aAbsScreenPos.Y();
2335  pEvt->mnCursorBoundWidth = aDeviceRect.GetWidth();
2336  pEvt->mnCursorBoundHeight = aDeviceRect.GetHeight();
2337  pEvt->mbVertical = pWinData->mbVertical;
2338  pEvt->mbValid = true;
2339 }
2340 
2341 bool ImplWindowFrameProc( vcl::Window* _pWindow, SalEvent nEvent, const void* pEvent )
2342 {
2344 
2345  // Ensure the window survives during this method.
2346  VclPtr<vcl::Window> pWindow( _pWindow );
2347 
2348  bool bRet = false;
2349 
2350  // #119709# for some unknown reason it is possible to receive events (in this case key events)
2351  // although the corresponding VCL window must have been destroyed already
2352  // at least ImplGetWindowImpl() was NULL in these cases, so check this here
2353  if( pWindow->ImplGetWindowImpl() == nullptr )
2354  return false;
2355 
2356  switch ( nEvent )
2357  {
2358  case SalEvent::MouseMove:
2359  bRet = ImplHandleSalMouseMove( pWindow, static_cast<SalMouseEvent const *>(pEvent) );
2360  break;
2362  {
2363  MouseEvent const * pMouseEvt = static_cast<MouseEvent const *>(pEvent);
2364  SalMouseEvent aSalMouseEvent;
2365 
2366  aSalMouseEvent.mnTime = tools::Time::GetSystemTicks();
2367  aSalMouseEvent.mnX = pMouseEvt->GetPosPixel().X();
2368  aSalMouseEvent.mnY = pMouseEvt->GetPosPixel().Y();
2369  aSalMouseEvent.mnButton = 0;
2370  aSalMouseEvent.mnCode = pMouseEvt->GetButtons() | pMouseEvt->GetModifier();
2371 
2372  bRet = ImplHandleSalMouseMove( pWindow, &aSalMouseEvent );
2373  }
2374  break;
2375  case SalEvent::MouseLeave:
2376  bRet = ImplHandleSalMouseLeave( pWindow, static_cast<SalMouseEvent const *>(pEvent) );
2377  break;
2379  bRet = ImplHandleSalMouseButtonDown( pWindow, static_cast<SalMouseEvent const *>(pEvent) );
2380  break;
2382  {
2383  MouseEvent const * pMouseEvt = static_cast<MouseEvent const *>(pEvent);
2384  SalMouseEvent aSalMouseEvent;
2385 
2386  aSalMouseEvent.mnTime = tools::Time::GetSystemTicks();
2387  aSalMouseEvent.mnX = pMouseEvt->GetPosPixel().X();
2388  aSalMouseEvent.mnY = pMouseEvt->GetPosPixel().Y();
2389  aSalMouseEvent.mnButton = pMouseEvt->GetButtons();
2390  aSalMouseEvent.mnCode = pMouseEvt->GetButtons() | pMouseEvt->GetModifier();
2391 
2392  bRet = ImplHandleSalMouseButtonDown( pWindow, &aSalMouseEvent );
2393  }
2394  break;
2396  bRet = ImplHandleSalMouseButtonUp( pWindow, static_cast<SalMouseEvent const *>(pEvent) );
2397  break;
2399  {
2400  MouseEvent const * pMouseEvt = static_cast<MouseEvent const *>(pEvent);
2401  SalMouseEvent aSalMouseEvent;
2402 
2403  aSalMouseEvent.mnTime = tools::Time::GetSystemTicks();
2404  aSalMouseEvent.mnX = pMouseEvt->GetPosPixel().X();
2405  aSalMouseEvent.mnY = pMouseEvt->GetPosPixel().Y();
2406  aSalMouseEvent.mnButton = pMouseEvt->GetButtons();
2407  aSalMouseEvent.mnCode = pMouseEvt->GetButtons() | pMouseEvt->GetModifier();
2408 
2409  bRet = ImplHandleSalMouseButtonUp( pWindow, &aSalMouseEvent );
2410  }
2411  break;
2413  bRet = false;
2414  break;
2415  case SalEvent::KeyInput:
2416  {
2417  SalKeyEvent const * pKeyEvt = static_cast<SalKeyEvent const *>(pEvent);
2418  bRet = ImplHandleKey( pWindow, MouseNotifyEvent::KEYINPUT,
2419  pKeyEvt->mnCode, pKeyEvt->mnCharCode, pKeyEvt->mnRepeat, true );
2420  }
2421  break;
2423  {
2424  KeyEvent const * pKeyEvt = static_cast<KeyEvent const *>(pEvent);
2425  bRet = ImplHandleKey( pWindow, MouseNotifyEvent::KEYINPUT,
2426  pKeyEvt->GetKeyCode().GetFullCode(), pKeyEvt->GetCharCode(), pKeyEvt->GetRepeat(), false );
2427  }
2428  break;
2429  case SalEvent::KeyUp:
2430  {
2431  SalKeyEvent const * pKeyEvt = static_cast<SalKeyEvent const *>(pEvent);
2432  bRet = ImplHandleKey( pWindow, MouseNotifyEvent::KEYUP,
2433  pKeyEvt->mnCode, pKeyEvt->mnCharCode, pKeyEvt->mnRepeat, true );
2434  }
2435  break;
2437  {
2438  KeyEvent const * pKeyEvt = static_cast<KeyEvent const *>(pEvent);
2439  bRet = ImplHandleKey( pWindow, MouseNotifyEvent::KEYUP,
2440  pKeyEvt->GetKeyCode().GetFullCode(), pKeyEvt->GetCharCode(), pKeyEvt->GetRepeat(), false );
2441  }
2442  break;
2444  ImplHandleSalKeyMod( pWindow, static_cast<SalKeyModEvent const *>(pEvent) );
2445  break;
2446 
2448  ImplHandleInputLanguageChange( pWindow );
2449  break;
2450 
2454  case SalEvent::MenuCommand:
2456  bRet = ImplHandleMenuEvent( pWindow, const_cast<SalMenuEvent *>(static_cast<SalMenuEvent const *>(pEvent)), nEvent );
2457  break;
2458 
2459  case SalEvent::WheelMouse:
2460  bRet = ImplHandleWheelEvent( pWindow, *static_cast<const SalWheelMouseEvent*>(pEvent));
2461  break;
2462 
2463  case SalEvent::Paint:
2464  {
2465  SalPaintEvent const * pPaintEvt = static_cast<SalPaintEvent const *>(pEvent);
2466 
2468  {
2469  SalFrame* pSalFrame = pWindow->ImplGetWindowImpl()->mpFrame;
2470  const_cast<SalPaintEvent *>(pPaintEvt)->mnBoundX = pSalFrame->maGeometry.nWidth-pPaintEvt->mnBoundWidth-pPaintEvt->mnBoundX;
2471  }
2472 
2473  tools::Rectangle aBoundRect( Point( pPaintEvt->mnBoundX, pPaintEvt->mnBoundY ),
2474  Size( pPaintEvt->mnBoundWidth, pPaintEvt->mnBoundHeight ) );
2475  ImplHandlePaint( pWindow, aBoundRect, pPaintEvt->mbImmediateUpdate );
2476  }
2477  break;
2478 
2479  case SalEvent::Move:
2480  ImplHandleMove( pWindow );
2481  break;
2482 
2483  case SalEvent::Resize:
2484  {
2485  long nNewWidth;
2486  long nNewHeight;
2487  pWindow->ImplGetWindowImpl()->mpFrame->GetClientSize( nNewWidth, nNewHeight );
2488  ImplHandleResize( pWindow, nNewWidth, nNewHeight );
2489  }
2490  break;
2491 
2492  case SalEvent::MoveResize:
2493  {
2495  ImplHandleMoveResize( pWindow, g.nWidth, g.nHeight );
2496  }
2497  break;
2498 
2499  case SalEvent::ClosePopups:
2500  {
2501  KillOwnPopups( pWindow );
2502  }
2503  break;
2504 
2505  case SalEvent::GetFocus:
2506  ImplHandleGetFocus( pWindow );
2507  break;
2508  case SalEvent::LoseFocus:
2509  ImplHandleLoseFocus( pWindow );
2510  break;
2511 
2512  case SalEvent::Close:
2513  ImplHandleClose( pWindow );
2514  break;
2515 
2516  case SalEvent::Shutdown:
2517  {
2518  static bool bInQueryExit = false;
2519  if( !bInQueryExit )
2520  {
2521  bInQueryExit = true;
2522  if ( GetpApp()->QueryExit() )
2523  {
2524  // end the message loop
2526  return false;
2527  }
2528  else
2529  {
2530  bInQueryExit = false;
2531  return true;
2532  }
2533  }
2534  return false;
2535  }
2536 
2540  case SalEvent::FontChanged:
2541  ImplHandleSalSettings( nEvent );
2542  break;
2543 
2544  case SalEvent::UserEvent:
2545  ImplHandleUserEvent( const_cast<ImplSVEvent *>(static_cast<ImplSVEvent const *>(pEvent)) );
2546  break;
2547 
2549  {
2550  SalExtTextInputEvent const * pEvt = static_cast<SalExtTextInputEvent const *>(pEvent);
2551  bRet = ImplHandleExtTextInput( pWindow,
2552  pEvt->maText, pEvt->mpTextAttr,
2553  pEvt->mnCursorPos, pEvt->mnCursorFlags );
2554  }
2555  break;
2557  bRet = ImplHandleEndExtTextInput();
2558  break;
2560  ImplHandleSalExtTextInputPos( pWindow, const_cast<SalExtTextInputPosEvent *>(static_cast<SalExtTextInputPosEvent const *>(pEvent)) );
2561  break;
2563  bRet = ImplHandleInputContextChange( pWindow );
2564  break;
2565  case SalEvent::ShowDialog:
2566  {
2567  ShowDialogId nLOKWindowId = static_cast<ShowDialogId>(reinterpret_cast<sal_IntPtr>(pEvent));
2568  bRet = ImplHandleShowDialog( pWindow, nLOKWindowId );
2569  }
2570  break;
2572  ImplHandleSalSurroundingTextRequest( pWindow, const_cast<SalSurroundingTextRequestEvent *>(static_cast<SalSurroundingTextRequestEvent const *>(pEvent)) );
2573  break;
2575  {
2577  = static_cast<SalSurroundingTextSelectionChangeEvent const *>(pEvent);
2579  pEvt->mnStart,
2580  pEvt->mnEnd );
2581  [[fallthrough]]; // TODO: Fallthrough really intended?
2582  }
2584  ImplHandleStartReconversion( pWindow );
2585  break;
2586 
2588  ImplHandleSalQueryCharPosition( pWindow, const_cast<SalQueryCharPositionEvent *>(static_cast<SalQueryCharPositionEvent const *>(pEvent)) );
2589  break;
2590 
2591  case SalEvent::Swipe:
2592  bRet = ImplHandleSwipe(pWindow, *static_cast<const SalSwipeEvent*>(pEvent));
2593  break;
2594 
2595  case SalEvent::LongPress:
2596  bRet = ImplHandleLongPress(pWindow, *static_cast<const SalLongPressEvent*>(pEvent));
2597  break;
2598 
2600  {
2601  auto const * pGestureEvent = static_cast<GestureEvent const *>(pEvent);
2602 
2603  SalGestureEvent aSalGestureEvent;
2604  aSalGestureEvent.mfOffset = pGestureEvent->mnOffset;
2605  aSalGestureEvent.mnX = pGestureEvent->mnX;
2606  aSalGestureEvent.mnY = pGestureEvent->mnY;
2607  aSalGestureEvent.meEventType = pGestureEvent->meEventType;
2608  aSalGestureEvent.meOrientation = pGestureEvent->meOrientation;
2609 
2610  bRet = ImplHandleGestureEvent(pWindow, aSalGestureEvent);
2611  }
2612  break;
2613  case SalEvent::Gesture:
2614  {
2615  auto const * aSalGestureEvent = static_cast<SalGestureEvent const *>(pEvent);
2616  bRet = ImplHandleGestureEvent(pWindow, *aSalGestureEvent);
2617  }
2618  break;
2619  default:
2620  SAL_WARN( "vcl.layout", "ImplWindowFrameProc(): unknown event (" << static_cast<int>(nEvent) << ")" );
2621  break;
2622  }
2623 
2624  return bRet;
2625 }
2626 
2627 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ImplSVHelpData & ImplGetSVHelpData()
Definition: svdata.cxx:472
bool mbNeedSysWindow
Definition: window.h:162
Point TopLeft() const
SAL_DLLPRIVATE vcl::Window * ImplFindWindow(const Point &rFramePos)
Definition: stacking.cxx:632
bool IsWindowOrChild(const vcl::Window *pWindow, bool bSystemWindow=false) const
Definition: stacking.cxx:1127
long Width() const
void EndExtTextInput()
Definition: window.cxx:2100
long mnFirstMouseX
Definition: window.h:148
bool IsInputEnabled() const
Definition: window2.cxx:1127
MouseEventModifiers mnMouseMode
Definition: window.h:157
bool HandleMenuButtonEvent(sal_uInt16 nEventId)
Definition: menu.cxx:2686
vcl::Window * ImplGetWindow() const
if this is a proxy return the client, otherwise itself
Definition: window2.cxx:835
long GetWidth() const
VclPtr< HelpTextWindow > mpHelpWin
Definition: svdata.hxx:299
unsigned long nWidth
Definition: salgeom.hxx:31
css::uno::Reference< css::datatransfer::dnd::XDragSource > GetDragSource()
Definition: mouse.cxx:719
Point GetPointerPosPixel()
Definition: mouse.cxx:550
ActivateModeFlags GetActivateMode() const
Definition: window2.cxx:1137
const LocaleDataWrapper & GetLocaleDataWrapper() const
std::optional< OUString > mpExtOldText
Definition: window.h:102
SAL_DLLPRIVATE void ImplCallResize()
Definition: event.cxx:515
long GetHeight() const
VclPtr< vcl::Window > mpFocusWin
Definition: svdata.hxx:247
#define IMPL_MIN_NEEDSYSWIN
Definition: winproc.cxx:60
void EndAutoScroll()
Definition: window2.cxx:332
SAL_DLLPRIVATE bool ImplIsFloatingWindow() const
Definition: window2.cxx:911
static void ImplHandleExtTextInputPos(vcl::Window *pWindow, tools::Rectangle &rRect, long &rInputWidth, bool *pVertical)
Definition: winproc.cxx:1227
constexpr sal_uInt16 KEY_MOD1
Definition: keycodes.hxx:31
bool ImplCallPreNotify(NotifyEvent &rEvt)
Definition: winproc.cxx:62
sal_uInt64 GetDoubleClickTime() const
bool mbMouseButtonUp
Definition: window.h:317
vcl::Cursor * mpCursor
Definition: window.h:256
const char aData[]
CommandEventId
virtual void MouseButtonDown(const MouseEvent &rMEvt)
Definition: mouse.cxx:414
static void NotifyAllWindows(DataChangedEvent &rDCEvt)
Notify all windows that the application has changed data.
Definition: svapp.cxx:733
static void ImplHandleClose(const vcl::Window *pWindow)
Definition: winproc.cxx:1932
static void ImplHandleInputLanguageChange(vcl::Window *pWindow)
Definition: winproc.cxx:2147
SalFrameGeometry GetGeometry() const
void CompatLoseFocus()
Definition: window.cxx:3823
long mnBeforeLastMouseY
Definition: window.h:147
std::unique_ptr< ContentProperties > pData
static bool ImplHandleExtTextInput(vcl::Window *pWindow, const OUString &rText, const ExtTextInputAttr *pTextAttr, sal_Int32 nCursorPos, sal_uInt16 nCursorFlags)
Definition: winproc.cxx:1117
const Link< SystemWindow &, void > & GetCloseHdl() const
Definition: syswin.cxx:1036
ImplSVAppData maAppData
Definition: svdata.hxx:392
SAL_DLLPRIVATE void ImplCallMouseMove(sal_uInt16 nMouseCode, bool bModChanged=false)
Definition: mouse.cxx:135
long GetDoubleClickWidth() const
Point AbsoluteScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2863
long GetOutOffXPixel() const
Definition: outdev.hxx:445
static bool StartExtHelp()
Definition: help.cxx:107
sal_uIntPtr sal_uLong
static void ImplHandleSalSurroundingTextRequest(vcl::Window *pWindow, SalSurroundingTextRequestEvent *pEvt)
Definition: winproc.cxx:2256
bool ImplWindowFrameProc(vcl::Window *_pWindow, SalEvent nEvent, const void *pEvent)
Definition: winproc.cxx:2341
const StyleSettings & GetStyleSettings() const
static bool ImplHandleSalMouseButtonUp(vcl::Window *pWindow, SalMouseEvent const *pEvent)
Definition: winproc.cxx:2056
static const AllSettings & GetSettings()
Gets the application's settings.
Definition: svapp.cxx:706
VclPtr< PopupMenu > mpActivePopupMenu
Definition: svdata.hxx:144
static void ImplHandleSalKeyMod(vcl::Window *pWindow, SalKeyModEvent const *pEvent)
Definition: winproc.cxx:2112
bool mbStartFocusState
Definition: window.h:164
SAL_DLLPRIVATE void ImplCallMove()
Definition: event.cxx:539
virtual Size GetSizePixel() const
Definition: window.cxx:2395
SAL_DLLPRIVATE vcl::Window * ImplGetFrameWindow() const
Definition: window2.cxx:901
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
Definition: window.hxx:563
static MouseEventModifiers ImplGetMouseButtonMode(SalMouseEvent const *pEvent)
Definition: winproc.cxx:2011
sal_uInt16 mnButton
Definition: salwtype.hxx:108
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
Post a user event to the default window.
Definition: svapp.cxx:998
sal_uInt16 GetCode() const
Definition: keycod.hxx:51
virtual void Deactivate()
Definition: window.cxx:1833
bool mbRequestingHelp
Definition: svdata.hxx:298
bool mbHasFocus
Definition: window.h:158
constexpr sal_uInt16 KEY_F6
Definition: keycodes.hxx:88
bool HandleMenuHighlightEvent(Menu *pMenu, sal_uInt16 nEventId) const
Definition: menu.cxx:2617
static bool ImplHandleInputContextChange(vcl::Window *pWindow)
Definition: winproc.cxx:1273
void PaintImmediately()
Definition: paint.cxx:1286
virtual void MouseButtonUp(const MouseEvent &rMEvt)
Definition: mouse.cxx:421
VclPtr< VirtualDevice > mpBuffer
Buffer for the double-buffering.
Definition: window.h:177
constexpr sal_uInt16 KEY_DECIMAL
Definition: keycodes.hxx:150
sal_uInt16 mnCode
Definition: salwtype.hxx:136
long mnBoundWidth
Definition: salwtype.hxx:144
MouseEventModifiers
Definition: event.hxx:76
bool mbMouseIn
Definition: window.h:160
bool mbMinimized
Definition: window.h:163
sal_uInt16 mnCode
Definition: salwtype.hxx:116
bool mbExtHelpMode
Definition: svdata.hxx:292
SAL_DLLPRIVATE ImplWinData * ImplGetWinData() const
Definition: window.cxx:1209
bool mbCommand
Definition: window.h:317
constexpr sal_uInt16 KEY_F1
Definition: keycodes.hxx:83
bool IsEmpty() const
static UITestLogger & getInstance()
Definition: logger.cxx:603
static bool ImplCallWheelCommand(const VclPtr< vcl::Window > &pWindow, const Point &rPos, const CommandWheelData *pWheelData)
Definition: winproc.cxx:1280
WinBits const WB_OWNERDRAWDECORATION
const Size & GetSize() const
Definition: cursor.hxx:85
vcl::Window * GetWindow() const
Definition: event.hxx:304
HelpEventMode
Definition: event.hxx:182
static void ImplCallEventListenersApplicationDataChanged(void *pData)
Send event to all VCL application event listeners.
Definition: svapp.cxx:752
GestureEventType meEventType
Definition: salwtype.hxx:268
bool IsVertical() const
Definition: font/font.cxx:687
static void ImplHandleMouseHelpRequest(vcl::Window *pChild, const Point &rMousePos)
Definition: winproc.cxx:162
sal_uInt16 GetButtons() const
Definition: event.hxx:144
bool mbInternalDragGestureRecognizer
Definition: window.h:176
SAL_DLLPRIVATE void ReMirror(Point &rPoint) const
Definition: outdev.cxx:604
static void Yield()
Process the next event.
Definition: svapp.cxx:508
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
bool mbSetKeyboardHelp
Definition: svdata.hxx:296
VclPtr< vcl::Window > mpMouseMoveWin
Definition: window.h:135
A helper class that calls Application::ReleaseSolarMutex() in its constructor and restores the mutex ...
Definition: svapp.hxx:1415
bool mbImmediateUpdate
Definition: salwtype.hxx:146
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
Definition: window2.cxx:272
virtual void Tracking(const TrackingEvent &rTEvt)
Definition: window.cxx:1926
static void ImplHandleSalExtTextInputPos(vcl::Window *pWindow, SalExtTextInputPosEvent *pEvt)
Definition: winproc.cxx:2200
MouseSettingsOptions GetOptions() const
sal_uInt16 mnMouseCode
Definition: window.h:156
constexpr sal_uInt16 KEY_F2
Definition: keycodes.hxx:84
virtual void Start() override
Activates the timer task.
Definition: idle.cxx:34
VclEventId
Definition: vclevent.hxx:37
bool mbKeyInput
Definition: window.h:317
bool mbFloatWin
Definition: window.h:317
static void ContextMenuEventLink(void *pCEvent, void *)
Definition: winproc.cxx:254
DataChangedEventType
Definition: event.hxx:336
static void Quit()
Quit the program.
Definition: svapp.cxx:518
sal_uInt16 GetModifier() const
Definition: keycod.hxx:54
FloatWinPopupFlags GetPopupModeFlags() const
Definition: floatwin.hxx:146
static MouseEventModifiers ImplGetMouseMoveMode(SalMouseEvent const *pEvent)
Definition: winproc.cxx:1999
long Top() const
Application * GetpApp()
Definition: svapp.cxx:151
AutoTimer * mpTrackTimer
Definition: svdata.hxx:254
static sal_uInt16 GetStartDragCode()
void setMax(long nMax)
sal_uInt16 nCode
long GetStartDragHeight() const
const tools::Rectangle * GetCursorRect() const
Definition: window.cxx:2127
bool mbSysWin
Definition: window.h:317
SAL_DLLPRIVATE PointerStyle ImplGetMousePointer() const
Definition: mouse.cxx:93
#define MOUSE_LEFT
Definition: event.hxx:99
virtual Selection GetSurroundingTextSelection() const
Definition: window.cxx:3770
const vcl::Font & GetFont() const
Definition: inputctx.hxx:55
CommandWheelMode
static bool ImplHandleKey(vcl::Window *pWindow, MouseNotifyEvent nSVEvent, sal_uInt16 nKeyCode, sal_uInt16 nCharCode, sal_uInt16 nRepeat, bool bForward)
Definition: winproc.cxx:851
constexpr sal_uInt16 KEY_CONTEXTMENU
Definition: keycodes.hxx:146
const Point & GetPos() const
Definition: cursor.hxx:82
bool ImplHandleMouseEvent(const VclPtr< vcl::Window > &xWindow, MouseNotifyEvent nSVEvent, bool bMouseLeave, long nX, long nY, sal_uInt64 nMsgTime, sal_uInt16 nCode, MouseEventModifiers nMode)
Definition: winproc.cxx:265
static void KillOwnPopups(vcl::Window const *pWindow)
Definition: winproc.cxx:1623
static bool ImplHandleSalMouseLeave(vcl::Window *pWindow, SalMouseEvent const *pEvent)
Definition: winproc.cxx:2027
bool CompatPreNotify(NotifyEvent &rNEvt)
Definition: window.cxx:3838
const InputContext & GetInputContext() const
Definition: window2.cxx:1062
bool mbFrame
Definition: window.h:317
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:76
const OUString & getNumDecimalSep() const
long Min() const
static void ImplHandleUserEvent(ImplSVEvent *pSVEvent)
Definition: winproc.cxx:1986
std::vector< VclPtr< Dialog > > mpExecuteDialogs
Stack of dialogs that are Execute()'d - the last one is the top most one.
Definition: svdata.hxx:251
void Justify()
virtual void SetPointer(PointerStyle ePointerStyle)=0
VclPtr< vcl::Window > mpCaptureWin
Definition: svdata.hxx:248
bool IsRTLEnabled() const
Definition: outdev.hxx:1366
bool mbCall
Definition: svdata.hxx:457
long mnLastMouseWinX
Definition: window.h:150
VclPtr< vcl::Window > mpLastFocusWindow
Definition: window.h:241
long GetCursorSize() const
#define DBG_ASSERT(sCon, aError)
int i
sal_uInt64 mnLastInputTime
Definition: svdata.hxx:146
virtual OUString GetSurroundingText() const
Definition: window.cxx:3765
void ToTop(ToTopFlags nFlags=ToTopFlags::NONE)
Definition: stacking.cxx:420
MouseMiddleButtonAction GetMiddleButtonAction() const
bool HandleMenuDeActivateEvent(Menu *pMenu) const
Definition: menu.cxx:2602
bool mbQuickHelp
Definition: svdata.hxx:295
bool mbExtHelp
Definition: svdata.hxx:291
bool IsAccelKey(const vcl::KeyCode &rKeyCode)
Definition: accmgr.cxx:91
SAL_DLLPRIVATE void ImplSetMouseDown()
Definition: floatwin.hxx:113
SAL_DLLPRIVATE void ImplHide()
Definition: cursor.cxx:291
bool IsPresentationMode() const
Definition: wrkwin.hxx:89
static void SetSettings(const AllSettings &rSettings)
Sets the application's settings and notifies all windows of the change.
Definition: svapp.cxx:612
std::unique_ptr< tools::Rectangle[]> mpCompositionCharRects
Definition: window.h:110
sal_Int32 mnCursorPos
Definition: salwtype.hxx:173
Link< void *, void > maLink
Definition: svdata.hxx:454
VclPtr< vcl::Window > mpLastWheelWindow
Definition: svdata.hxx:257
long mnBeforeLastMouseX
Definition: window.h:146
static void DelayedCloseEventLink(void *pCEvent, void *)
Definition: winproc.cxx:1917
bool SetOutputSizePixel(const Size &rNewSize, bool bErase=true)
Definition: virdev.cxx:395
long GetDoubleClickHeight() const
static bool ImplHandleSalMouseButtonDown(vcl::Window *pWindow, SalMouseEvent const *pEvent)
Definition: winproc.cxx:2043
SAL_DLLPRIVATE bool ImplIsAntiparallel() const
Definition: outdev.cxx:588
Size GetOutputSize() const
Definition: outdev.hxx:450
SAL_DLLPRIVATE void ImplNotifyKeyMouseCommandEventListeners(NotifyEvent &rNEvt)
Definition: event.cxx:380
long mnLastMouseX
Definition: window.h:144
static void ImplHandleSalSettings(SalEvent nEvent)
Definition: winproc.cxx:2157
static void ImplActivateFloatingWindows(vcl::Window const *pWindow, bool bActive)
Definition: winproc.cxx:1742
void logKeyInput(VclPtr< vcl::Window > const &xUIElement, const KeyEvent &rEvent)
Definition: logger.cxx:195
virtual bool HasMirroredGraphics() const
Definition: outdev.cxx:636
virtual void GetClientSize(long &rWidth, long &rHeight)=0
bool mbInMouseMove
Definition: window.h:159
static void ImplHandleSalQueryCharPosition(vcl::Window *pWindow, SalQueryCharPositionEvent *pEvt)
Definition: winproc.cxx:2298
bool HandleMenuActivateEvent(Menu *pMenu) const
Definition: menu.cxx:2586
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:302
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
SAL_DLLPRIVATE bool ImplIsMouseDown() const
Definition: floatwin.hxx:114
static bool GetLayoutRTL()
bool IsInModalMode() const
A window is in modal mode if one of its children or subchildren is a running modal window (a modal di...
Definition: window.cxx:3566
virtual void Start() override
Activates the timer task.
Definition: timer.cxx:83
SalFrameGeometry maGeometry
absolute, unmirrored values
Definition: salframe.hxx:127
SAL_DLLPRIVATE void ImplShow()
Definition: cursor.cxx:286
static bool ImplHandleMouseFloatMode(vcl::Window *pChild, const Point &rMousePos, sal_uInt16 nCode, MouseNotifyEvent nSVEvent, bool bMouseLeave)
Definition: winproc.cxx:67
static bool EndExtHelp()
Definition: help.cxx:125
vcl::Cursor * GetCursor() const
Definition: window2.cxx:1203
static bool HandleKey(VclEventId nEvent, vcl::Window *pWin, KeyEvent *pKeyEvent)
Handle keypress event.
Definition: svapp.cxx:791
bool mbDockWin
Definition: window.h:317
bool mbMouseOver
Definition: window.h:118
SAL_DLLPRIVATE FloatingWindow * ImplFindLastLevelFloat()
Definition: floatwin.cxx:571
const AllSettings & GetSettings() const
Definition: outdev.hxx:418
Size GetOutputSizePixel() const
Definition: outdev.hxx:441
constexpr sal_uInt16 KEY_HELP
Definition: keycodes.hxx:148
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:230
VclPtr< vcl::Window > mpClientWindow
Definition: window.h:231
static bool ImplHandleShowDialog(vcl::Window *pWindow, ShowDialogId nDialogId)
Definition: winproc.cxx:2220
SAL_DLLPRIVATE bool ImplIsFloatPopupModeWindow(const vcl::Window *pWindow)
Definition: floatwin.cxx:588
sal_uInt16 mnCharCode
Definition: salwtype.hxx:117
sal_uInt16 GetModifier() const
Definition: event.hxx:153
constexpr sal_uInt16 KEY_MOD2
Definition: keycodes.hxx:32
bool mbContextHelp
Definition: svdata.hxx:290
sal_uInt16 mnClickCount
Definition: window.h:154
Point ScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2810
FloatWinPopupFlags
Definition: floatwin.hxx:31
void GrabFocus()
Definition: window.cxx:2960
constexpr sal_uInt16 KEY_F10
Definition: keycodes.hxx:92
vcl::Window * GetParent() const
Definition: window2.cxx:1097
VclPtr< vcl::Window > mpTrackWin
Definition: svdata.hxx:253
VclPtr< vcl::Window > mpFirstOverlap
Definition: window.h:236
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
Definition: window.cxx:2853
bool mbVertical
Definition: window.h:108
static void ImplHandleLoseFocus(vcl::Window *pWindow)
Definition: winproc.cxx:1873
long GetCursorExtTextInputWidth() const
Definition: window.cxx:2134
SalFrame * mpFrame
Definition: window.h:226
SAL_DLLPRIVATE void ImplCallDeactivateListeners(vcl::Window *)
Definition: window.cxx:3364
constexpr sal_uInt16 KEY_RETURN
Definition: keycodes.hxx:119
exports com.sun.star.chart2. data
std::unique_ptr< ExtTextInputAttr[]> mpExtOldAttrAry
Definition: window.h:104
long GetOutputWidthPixel() const
Definition: outdev.hxx:443
SalEvent
Definition: salwtype.hxx:40
static void ImplHandleSurroundingTextRequest(vcl::Window *pWindow, OUString &rText, Selection &rSelRange)
Definition: winproc.cxx:2235
long mnBoundHeight
Definition: salwtype.hxx:145
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1039
constexpr sal_uInt16 KEY_RIGHT
Definition: keycodes.hxx:113
static void MergeSystemSettings(AllSettings &rSettings)
Set the settings object to the platform/desktop environment system settings.
Definition: svapp.cxx:593
VclPtr< vcl::Window > mpNext
Definition: window.h:239
Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:941
static bool acceptableWheelScrollTarget(const vcl::Window *pMouseWindow)
Definition: winproc.cxx:1301
static void ImplHandleGetFocus(vcl::Window *pWindow)
Definition: winproc.cxx:1857
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1799
bool mbToolBox
Definition: window.h:317
WinBits const WB_SIZEABLE
long GetStartDragWidth() const
static bool ImplHandleLongPress(vcl::Window *pWindow, const SalLongPressEvent &rEvt)
Definition: winproc.cxx:1571
SAL_DLLPRIVATE vcl::Window * ImplGetFirstOverlapWindow()
Definition: window2.cxx:880
bool mbMouseButtonDown
Definition: window.h:317
Idle maResizeIdle
Definition: window.h:130
bool mbWaitSystemResize
Definition: window.h:317
static sal_uInt16 GetContextMenuCode()
ShowDialogId
bool mbExtTextInput
Definition: window.h:317
SalFrame * ImplGetFrame() const
Definition: window2.cxx:848
SalWheelMouseEvent maLastWheelEvent
Definition: svdata.hxx:258
static bool ImplHandleSwipe(vcl::Window *pWindow, const SalSwipeEvent &rEvt)
Definition: winproc.cxx:1545
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:112
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:54
static void ImplHandlePaint(vcl::Window *pWindow, const tools::Rectangle &rBoundRect, bool bImmediateUpdate)
Definition: winproc.cxx:1605
bool mbCallMove
Definition: window.h:317
static bool shouldReusePreviousMouseWindow(const SalWheelMouseEvent &rPrevEvt, const SalWheelMouseEvent &rEvt)
Definition: winproc.cxx:1312
bool IsShift() const
Definition: keycod.hxx:56
VclPtr< vcl::Window > mpExtTextInputWin
Definition: svdata.hxx:252
void * mpData
Definition: svdata.hxx:453
bool mbBalloonHelp
Definition: svdata.hxx:294
long GetOutputHeightPixel() const
Definition: outdev.hxx:444
VclPtr< vcl::Window > mpMouseDownWin
Definition: window.h:136
IMPL_LINK_NOARG(vcl::Window, ImplAsyncFocusHdl, void *, void)
Definition: winproc.cxx:1760
#define SAL_WARN_IF(condition, area, stream)
bool mbActive
Definition: window.h:317
static void ImplHandleSurroundingTextSelectionChange(vcl::Window *pWindow, sal_uLong nStart, sal_uLong nEnd)
Definition: winproc.cxx:2279
static bool ImplHandleSalMouseMove(vcl::Window *pWindow, SalMouseEvent const *pEvent)
Definition: winproc.cxx:2035
constexpr sal_uInt16 KEY_ESCAPE
Definition: keycodes.hxx:120
SAL_DLLPRIVATE void ImplInvalidateOverlapFrameRegion(const vcl::Region &rRegion)
Definition: paint.cxx:745
bool mbAllResize
Definition: window.h:317
static bool ImplCallCommand(const VclPtr< vcl::Window > &pChild, CommandEventId nEvt, void const *pData=nullptr, bool bMouse=false, Point const *pPos=nullptr)
Definition: winproc.cxx:200
bool IsVisible() const
Definition: window2.cxx:1102
ImplSVEvent * mnFocusId
Definition: window.h:142
VclPtr< vcl::Window > mpAutoScrollWin
Definition: svdata.hxx:256
sal_uInt64 mnMouseDownTime
Definition: window.h:153
bool mbStartDragCalled
Definition: window.h:161
::OutputDevice const * GetOutDev() const
Definition: window.cxx:576
sal_Unicode GetCharCode() const
Definition: event.hxx:53
bool IsMod1() const
Definition: keycod.hxx:58
bool mbKeyUp
Definition: window.h:317
SAL_DLLPRIVATE void ImplNotifyIconifiedState(bool bIconified)
Definition: window.cxx:3605
SAL_DLLPRIVATE Point ImplFrameToOutput(const Point &rPos)
Definition: window2.cxx:942
PanningOrientation meOrientation
Definition: salwtype.hxx:269
static vcl::Window * ImplGetKeyInputWindow(vcl::Window *pWindow)
Definition: winproc.cxx:797
const MouseSettings & GetMouseSettings() const
QPRO_FUNC_TYPE nType
long GetOutOffYPixel() const
Definition: outdev.hxx:446
void ImplHandleResize(vcl::Window *pWindow, long nNewWidth, long nNewHeight)
Definition: winproc.cxx:1637
const Point & GetPosPixel() const
Definition: event.hxx:120
static SAL_DLLPRIVATE void ImplUpdateAllFontData(bool bNewFontLists)
virtual void OverrideSystemSettings(AllSettings &rSettings)
Sets user settings in settings object to override system settings.
Definition: svapp.cxx:589
static sal_uInt64 GetSystemTicks()
SAL_DLLPRIVATE long ImplLogicWidthToDevicePixel(long nWidth) const
Convert a logical width to a width in units of device pixels.
Definition: map.cxx:430
SAL_DLLPRIVATE bool ImplIsWindowOrChild(const vcl::Window *pWindow, bool bSystemWindow=false) const
Definition: stacking.cxx:703
long Left() const
VclPtr< vcl::Window > mpFirstChild
Definition: window.h:234
long mnCompositionCharRects
Definition: window.h:111
SAL_DLLPRIVATE bool ImplSetClipFlag(bool bSysObjOnlySmaller=false)
sal_uInt16 GetFullCode() const
Definition: keycod.hxx:48
virtual void KeyUp(const KeyEvent &rKEvt)
Definition: window.cxx:1816
VclPtr< FloatingWindow > mpFirstFloat
Definition: svdata.hxx:250
static void ImplHandleMove(vcl::Window *pWindow)
Definition: winproc.cxx:1711
sal_uInt16 mnId
Definition: salwtype.hxx:124
sal_uInt16 GetRepeat() const
Definition: event.hxx:55
bool IsDisposed() const
Definition: window.cxx:140
sal_uInt16 mnRepeat
Definition: salwtype.hxx:118
SAL_DLLPRIVATE FloatingWindow * ImplFloatHitTest(vcl::Window *pReference, const Point &rPos, bool &rbHitTestInsideRect)
Definition: floatwin.cxx:530
SAL_DLLPRIVATE tools::Rectangle ImplLogicToDevicePixel(const tools::Rectangle &rLogicRect) const
Convert a logical rectangle to a rectangle in physical device pixel units.
Definition: map.cxx:504
long mnFirstMouseY
Definition: window.h:149
static void ImplSetMousePointer(vcl::Window const *pChild)
Definition: winproc.cxx:192
WindowType GetType() const
Definition: window2.cxx:974
sal_uInt8 mnCursorFlags
Definition: salwtype.hxx:174
unsigned long nHeight
Definition: salgeom.hxx:31
void setMin(long nMin)
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
bool IsEnabled() const
Definition: window2.cxx:1122
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:408
static void ImplHandleMoveResize(vcl::Window *pWindow, long nNewWidth, long nNewHeight)
Definition: winproc.cxx:1736
#define SAL_WARN(area, stream)
ImplAccelManager * mpAccelMgr
Definition: svdata.hxx:138
ExtTextInputAttr
WinBits GetStyle() const
Definition: window2.cxx:953
#define DBG_TESTSOLARMUTEX()
static void ImplHandleStartReconversion(vcl::Window *pWindow)
Definition: winproc.cxx:2291
constexpr sal_uInt16 KEY_LEFT
Definition: keycodes.hxx:112
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2804
long Max() const
#define MOUSE_MIDDLE
Definition: event.hxx:100
ModKeyFlags mnModKeyCode
Definition: salwtype.hxx:137
WinBits const WB_MOVEABLE
long getHeight() const
bool mbCallResize
Definition: window.h:317
static bool ImplHandleEndExtTextInput()
Definition: winproc.cxx:1208
constexpr sal_uInt16 KEY_MOD3
Definition: keycodes.hxx:33
StartTrackingFlags mnTrackFlags
Definition: svdata.hxx:260
bool HandleMenuCommandEvent(Menu *pMenu, sal_uInt16 nEventId) const
Definition: menu.cxx:2642
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1917
constexpr sal_uInt16 KEY_SHIFT
Definition: keycodes.hxx:30
bool IsReallyVisible() const
Definition: window2.cxx:1107
static bool ImplHandleMenuEvent(vcl::Window const *pWindow, SalMenuEvent *pEvent, SalEvent nEvent)
Definition: winproc.cxx:2069
static sal_uInt16 GetContextMenuClicks()
ImplPaintFlags mnPaintFlags
Definition: window.h:298
VclPtr< vcl::Window > mpFocusWin
Definition: window.h:134
SAL_DLLPRIVATE ImplFrameData * ImplGetFrameData()
Definition: window2.cxx:843
css::uno::Reference< css::uno::XInterface > mxDNDListenerContainer
Definition: window.h:392
long mnLastMouseWinY
Definition: window.h:151
long getWidth() const
void * mpMenu
Definition: salwtype.hxx:125
ImplFrameData * mpFrameData
Definition: window.h:225
bool SupportsDoubleBuffering() const
Can the widget derived from this Window do the double-buffering via RenderContext properly...
Definition: window.cxx:3790
void setWidth(long nWidth)
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1863
#define MOUSE_RIGHT
Definition: event.hxx:101
void EndPopupMode(FloatWinPopupEndFlags nFlags=FloatWinPopupEndFlags::NONE)
Definition: floatwin.cxx:927
MouseNotifyEvent
Definition: event.hxx:277
static bool ImplHandleWheelEvent(vcl::Window *pWindow, const SalWheelMouseEvent &rEvt)
Definition: winproc.cxx:1519
const ExtTextInputAttr * mpTextAttr
Definition: salwtype.hxx:172
bool isDisposed() const
VclPtr< vcl::Window > mpFrameWindow
Definition: window.h:228
bool mbKeyboardHelp
Definition: svdata.hxx:297
static bool ImplHandleGestureEvent(vcl::Window *pWindow, const SalGestureEvent &rEvent)
Definition: winproc.cxx:1599
sal_uInt16 mnFirstMouseCode
Definition: window.h:155
void ImplDestroyHelpWindow(bool bUpdateHideTime)
Definition: help.cxx:552
MouseMiddleButtonAction
Definition: settings.hxx:75
ImplSVWinData * mpWinData
Definition: svdata.hxx:395
bool IsMod2() const
Definition: keycod.hxx:60
void SetKeyboardActivated(bool bKeyboard)
Definition: event.hxx:207
long mnLastMouseY
Definition: window.h:145