LibreOffice Module vcl (master)  1
window.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 <rtl/strbuf.hxx>
21 #include <sal/log.hxx>
22 
23 #include <sal/types.h>
24 #include <vcl/salgtype.hxx>
25 #include <vcl/event.hxx>
26 #include <vcl/help.hxx>
27 #include <vcl/cursor.hxx>
28 #include <vcl/svapp.hxx>
29 #include <vcl/vclevent.hxx>
30 #include <vcl/window.hxx>
31 #include <vcl/syswin.hxx>
32 #include <vcl/dockwin.hxx>
33 #include <vcl/wall.hxx>
34 #include <vcl/fixed.hxx>
35 #include <vcl/taskpanelist.hxx>
36 #include <vcl/toolkit/unowrap.hxx>
37 #include <vcl/lazydelete.hxx>
38 #include <vcl/virdev.hxx>
39 #include <vcl/settings.hxx>
40 #include <vcl/sysdata.hxx>
41 #include <vcl/ptrstyle.hxx>
43 
44 #include <vcl/uitest/uiobject.hxx>
45 
46 #include <salframe.hxx>
47 #include <salobj.hxx>
48 #include <salinst.hxx>
49 #include <salgdi.hxx>
50 #include <svdata.hxx>
51 #include <window.h>
52 #include <toolbox.h>
53 #include <outdev.h>
54 #include <brdwin.hxx>
55 #include <helpwin.hxx>
56 
57 #include <com/sun/star/accessibility/AccessibleRelation.hpp>
58 #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
59 #include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp>
60 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
61 #include <com/sun/star/rendering/CanvasFactory.hpp>
62 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
63 #include <comphelper/lok.hxx>
65 #include <unotools/configmgr.hxx>
66 #include <osl/diagnose.h>
67 #include <tools/debug.hxx>
68 #include <boost/property_tree/ptree.hpp>
69 
70 #include <cassert>
71 #include <typeinfo>
72 
73 #ifdef _WIN32 // see #140456#
74 #include <win/salframe.h>
75 #endif
76 
77 
78 using namespace ::com::sun::star::uno;
79 using namespace ::com::sun::star::lang;
81 using namespace ::com::sun::star::datatransfer::dnd;
82 
83 namespace vcl {
84 
87  , mpWindowImpl(new WindowImpl( nType ))
88 {
89  // true: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active
91 }
92 
93 Window::Window( vcl::Window* pParent, WinBits nStyle )
95  , mpWindowImpl(new WindowImpl( WindowType::WINDOW ))
96 {
97  // true: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active
99 
100  ImplInit( pParent, nStyle, nullptr );
101 }
102 
103 #if OSL_DEBUG_LEVEL > 0
104 namespace
105 {
106  OString lcl_createWindowInfo(const vcl::Window* pWindow)
107  {
108  // skip border windows, they do not carry information that
109  // would help with diagnosing the problem
110  const vcl::Window* pTempWin( pWindow );
111  while ( pTempWin && pTempWin->GetType() == WindowType::BORDERWINDOW ) {
112  pTempWin = pTempWin->GetWindow( GetWindowType::FirstChild );
113  }
114  // check if pTempWin is not null, otherwise use the
115  // original address
116  if ( pTempWin ) {
117  pWindow = pTempWin;
118  }
119 
120  OStringBuffer aErrorString;
121  aErrorString.append(' ');
122  aErrorString.append(typeid( *pWindow ).name());
123  aErrorString.append("(");
124  aErrorString.append(
126  pWindow->GetText(),
127  RTL_TEXTENCODING_UTF8
128  )
129  );
130  aErrorString.append(")");
131  return aErrorString.makeStringAndClear();
132  }
133 }
134 #endif
135 
136 bool Window::IsDisposed() const
137 {
138  return !mpWindowImpl;
139 }
140 
142 {
143  assert( mpWindowImpl );
144  assert( !mpWindowImpl->mbInDispose ); // should only be called from disposeOnce()
145  assert( (!mpWindowImpl->mpParent ||
146  !mpWindowImpl->mpParent->IsDisposed()) &&
147  "vcl::Window child should have its parent disposed first" );
148 
149  // remove Key and Mouse events issued by Application::PostKey/MouseEvent
151 
152  // Dispose of the canvas implementation (which, currently, has an
153  // own wrapper window as a child to this one.
154  Reference< css::rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
155  if( xCanvas.is() )
156  {
157  Reference < XComponent > xCanvasComponent( xCanvas, UNO_QUERY );
158  if( xCanvasComponent.is() )
159  xCanvasComponent->dispose();
160  }
161 
162  mpWindowImpl->mbInDispose = true;
163 
165 
166  // do not send child events for frames that were registered as native frames
167  if( !ImplIsAccessibleNativeFrame() && mpWindowImpl->mbReallyVisible )
170 
171  // remove associated data structures from dockingmanager
172  ImplGetDockingManager()->RemoveWindow( this );
173 
174  // remove ownerdraw decorated windows from list in the top-most frame window
175  if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame )
176  {
177  ::std::vector< VclPtr<vcl::Window> >& rList = ImplGetOwnerDrawList();
178  auto p = ::std::find( rList.begin(), rList.end(), VclPtr<vcl::Window>(this) );
179  if( p != rList.end() )
180  rList.erase( p );
181  }
182 
183  // shutdown drag and drop
184  Reference < XComponent > xDnDComponent( mpWindowImpl->mxDNDListenerContainer, UNO_QUERY );
185 
186  if( xDnDComponent.is() )
187  xDnDComponent->dispose();
188 
189  if( mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData )
190  {
191  try
192  {
193  // deregister drop target listener
194  if( mpWindowImpl->mpFrameData->mxDropTargetListener.is() )
195  {
196  Reference< XDragGestureRecognizer > xDragGestureRecognizer(mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY);
197  if( xDragGestureRecognizer.is() )
198  {
199  xDragGestureRecognizer->removeDragGestureListener(
200  Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY));
201  }
202 
203  mpWindowImpl->mpFrameData->mxDropTarget->removeDropTargetListener( mpWindowImpl->mpFrameData->mxDropTargetListener );
204  mpWindowImpl->mpFrameData->mxDropTargetListener.clear();
205  }
206 
207  // shutdown drag and drop for this frame window
208  Reference< XComponent > xComponent( mpWindowImpl->mpFrameData->mxDropTarget, UNO_QUERY );
209 
210  // DNDEventDispatcher does not hold a reference of the DropTarget,
211  // so it's ok if it does not support XComponent
212  if( xComponent.is() )
213  xComponent->dispose();
214  }
215  catch (const Exception&)
216  {
217  // can be safely ignored here.
218  }
219  }
220 
221  UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper( false );
222  if ( pWrapper )
223  pWrapper->WindowDestroyed( this );
224 
225  // MT: Must be called after WindowDestroyed!
226  // Otherwise, if the accessible is a VCLXWindow, it will try to destroy this window again!
227  // But accessibility implementations from applications need this dispose.
228  if ( mpWindowImpl->mxAccessible.is() )
229  {
230  Reference< XComponent> xC( mpWindowImpl->mxAccessible, UNO_QUERY );
231  if ( xC.is() )
232  xC->dispose();
233  }
234 
235  ImplSVData* pSVData = ImplGetSVData();
236 
237  if ( ImplGetSVHelpData().mpHelpWin && (ImplGetSVHelpData().mpHelpWin->GetParent() == this) )
238  ImplDestroyHelpWindow( true );
239 
240  SAL_WARN_IF(pSVData->mpWinData->mpTrackWin.get() == this, "vcl.window",
241  "Window::~Window(): Window is in TrackingMode");
242  SAL_WARN_IF(IsMouseCaptured(), "vcl.window",
243  "Window::~Window(): Window has the mouse captured");
244 
245  // due to old compatibility
246  if (pSVData->mpWinData->mpTrackWin == this)
247  EndTracking();
248  if (IsMouseCaptured())
249  ReleaseMouse();
250 
251 #if OSL_DEBUG_LEVEL > 0
252  if ( true ) // always perform these tests in debug builds
253  {
254  OStringBuffer aErrorStr;
255  bool bError = false;
256  vcl::Window* pTempWin;
257 
258  if ( mpWindowImpl->mpFirstChild )
259  {
260  OStringBuffer aTempStr("Window (");
261  aTempStr.append(lcl_createWindowInfo(this));
262  aTempStr.append(") with live children destroyed: ");
263  pTempWin = mpWindowImpl->mpFirstChild;
264  while ( pTempWin )
265  {
266  aTempStr.append(lcl_createWindowInfo(pTempWin));
267  pTempWin = pTempWin->mpWindowImpl->mpNext;
268  }
269  OSL_FAIL( aTempStr.getStr() );
270  Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed!
271  }
272 
273  if (mpWindowImpl->mpFrameData != nullptr)
274  {
275  pTempWin = mpWindowImpl->mpFrameData->mpFirstOverlap;
276  while ( pTempWin )
277  {
278  if ( ImplIsRealParentPath( pTempWin ) )
279  {
280  bError = true;
281  aErrorStr.append(lcl_createWindowInfo(pTempWin));
282  }
283  pTempWin = pTempWin->mpWindowImpl->mpNextOverlap;
284  }
285  if ( bError )
286  {
287  OStringBuffer aTempStr;
288  aTempStr.append("Window (");
289  aTempStr.append(lcl_createWindowInfo(this));
290  aTempStr.append(") with live SystemWindows destroyed: ");
291  aTempStr.append(aErrorStr.toString());
292  OSL_FAIL(aTempStr.getStr());
293  // abort in debug builds, must be fixed!
294  Application::Abort(OStringToOUString(
295  aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));
296  }
297  }
298 
299  bError = false;
300  pTempWin = pSVData->maFrameData.mpFirstFrame;
301  while ( pTempWin )
302  {
303  if ( ImplIsRealParentPath( pTempWin ) )
304  {
305  bError = true;
306  aErrorStr.append(lcl_createWindowInfo(pTempWin));
307  }
308  pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame;
309  }
310  if ( bError )
311  {
312  OStringBuffer aTempStr( "Window (" );
313  aTempStr.append(lcl_createWindowInfo(this));
314  aTempStr.append(") with live SystemWindows destroyed: ");
315  aTempStr.append(aErrorStr.toString());
316  OSL_FAIL( aTempStr.getStr() );
317  Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed!
318  }
319 
320  if ( mpWindowImpl->mpFirstOverlap )
321  {
322  OStringBuffer aTempStr("Window (");
323  aTempStr.append(lcl_createWindowInfo(this));
324  aTempStr.append(") with live SystemWindows destroyed: ");
325  pTempWin = mpWindowImpl->mpFirstOverlap;
326  while ( pTempWin )
327  {
328  aTempStr.append(lcl_createWindowInfo(pTempWin));
329  pTempWin = pTempWin->mpWindowImpl->mpNext;
330  }
331  OSL_FAIL( aTempStr.getStr() );
332  Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed!
333  }
334 
335  vcl::Window* pMyParent = GetParent();
336  SystemWindow* pMySysWin = nullptr;
337 
338  while ( pMyParent )
339  {
340  if ( pMyParent->IsSystemWindow() )
341  {
342  pMySysWin = dynamic_cast<SystemWindow *>(pMyParent);
343  }
344  pMyParent = pMyParent->GetParent();
345  }
346  if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) )
347  {
348  OStringBuffer aTempStr("Window (");
349  aTempStr.append(lcl_createWindowInfo(this));
350  aTempStr.append(") still in TaskPanelList!");
351  OSL_FAIL( aTempStr.getStr() );
352  Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed!
353  }
354  }
355 #endif
356 
357  if( mpWindowImpl->mbIsInTaskPaneList )
358  {
359  vcl::Window* pMyParent = GetParent();
360  SystemWindow* pMySysWin = nullptr;
361 
362  while ( pMyParent )
363  {
364  if ( pMyParent->IsSystemWindow() )
365  {
366  pMySysWin = dynamic_cast<SystemWindow *>(pMyParent);
367  }
368  pMyParent = pMyParent->GetParent();
369  }
370  if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) )
371  {
372  pMySysWin->GetTaskPaneList()->RemoveWindow( this );
373  }
374  else
375  {
376  SAL_WARN( "vcl", "Window (" << GetText() << ") not found in TaskPanelList");
377  }
378  }
379 
380  // remove from size-group if necessary
382 
383  // clear mnemonic labels
384  std::vector<VclPtr<FixedText> > aMnemonicLabels(list_mnemonic_labels());
385  for (auto const& mnemonicLabel : aMnemonicLabels)
386  {
387  remove_mnemonic_label(mnemonicLabel);
388  }
389 
390  // hide window in order to trigger the Paint-Handling
391  Hide();
392 
393  // EndExtTextInputMode
394  if (pSVData->mpWinData->mpExtTextInputWin == this)
395  {
396  EndExtTextInput();
397  if (pSVData->mpWinData->mpExtTextInputWin == this)
398  pSVData->mpWinData->mpExtTextInputWin = nullptr;
399  }
400 
401  // check if the focus window is our child
402  bool bHasFocussedChild = false;
403  if (pSVData->mpWinData->mpFocusWin && ImplIsRealParentPath(pSVData->mpWinData->mpFocusWin))
404  {
405  // #122232#, this must not happen and is an application bug ! but we try some cleanup to hopefully avoid crashes, see below
406  bHasFocussedChild = true;
407 #if OSL_DEBUG_LEVEL > 0
408  OUString aTempStr = "Window (" + GetText() +
409  ") with focused child window destroyed ! THIS WILL LEAD TO CRASHES AND MUST BE FIXED !";
410  SAL_WARN( "vcl", aTempStr );
411  Application::Abort(aTempStr); // abort in debug build version, this must be fixed!
412 #endif
413  }
414 
415  // if we get focus pass focus to another window
416  vcl::Window* pOverlapWindow = ImplGetFirstOverlapWindow();
417  if (pSVData->mpWinData->mpFocusWin == this
418  || bHasFocussedChild) // #122232#, see above, try some cleanup
419  {
420  if ( mpWindowImpl->mbFrame )
421  {
422  pSVData->mpWinData->mpFocusWin = nullptr;
423  pOverlapWindow->mpWindowImpl->mpLastFocusWindow = nullptr;
424  }
425  else
426  {
427  vcl::Window* pParent = GetParent();
428  vcl::Window* pBorderWindow = mpWindowImpl->mpBorderWindow;
429  // when windows overlap, give focus to the parent
430  // of the next FrameWindow
431  if ( pBorderWindow )
432  {
433  if ( pBorderWindow->ImplIsOverlapWindow() )
434  pParent = pBorderWindow->mpWindowImpl->mpOverlapWindow;
435  }
436  else if ( ImplIsOverlapWindow() )
437  pParent = mpWindowImpl->mpOverlapWindow;
438 
439  if ( pParent && pParent->IsEnabled() && pParent->IsInputEnabled() && ! pParent->IsInModalMode() )
440  pParent->GrabFocus();
441  else
442  mpWindowImpl->mpFrameWindow->GrabFocus();
443 
444  // If the focus was set back to 'this' set it to nothing
445  if (pSVData->mpWinData->mpFocusWin == this)
446  {
447  pSVData->mpWinData->mpFocusWin = nullptr;
448  pOverlapWindow->mpWindowImpl->mpLastFocusWindow = nullptr;
449  }
450  }
451  }
452 
453  if ( pOverlapWindow != nullptr &&
454  pOverlapWindow->mpWindowImpl->mpLastFocusWindow == this )
455  pOverlapWindow->mpWindowImpl->mpLastFocusWindow = nullptr;
456 
457  // reset hint for DefModalDialogParent
458  if( pSVData->maFrameData.mpActiveApplicationFrame == this )
459  pSVData->maFrameData.mpActiveApplicationFrame = nullptr;
460 
461  // reset hint of what was the last wheeled window
462  if (pSVData->mpWinData->mpLastWheelWindow == this)
463  pSVData->mpWinData->mpLastWheelWindow = nullptr;
464 
465  // reset marked windows
466  if ( mpWindowImpl->mpFrameData != nullptr )
467  {
468  if ( mpWindowImpl->mpFrameData->mpFocusWin == this )
469  mpWindowImpl->mpFrameData->mpFocusWin = nullptr;
470  if ( mpWindowImpl->mpFrameData->mpMouseMoveWin == this )
471  mpWindowImpl->mpFrameData->mpMouseMoveWin = nullptr;
472  if ( mpWindowImpl->mpFrameData->mpMouseDownWin == this )
473  mpWindowImpl->mpFrameData->mpMouseDownWin = nullptr;
474  }
475 
476  // reset Deactivate-Window
477  if (pSVData->mpWinData->mpLastDeacWin == this)
478  pSVData->mpWinData->mpLastDeacWin = nullptr;
479 
480  if ( mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData )
481  {
482  if ( mpWindowImpl->mpFrameData->mnFocusId )
483  Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnFocusId );
484  mpWindowImpl->mpFrameData->mnFocusId = nullptr;
485  if ( mpWindowImpl->mpFrameData->mnMouseMoveId )
486  Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnMouseMoveId );
487  mpWindowImpl->mpFrameData->mnMouseMoveId = nullptr;
488  }
489 
490  // release SalGraphics
491  OutputDevice *pOutDev = GetOutDev();
492  pOutDev->ReleaseGraphics();
493 
494  // remove window from the lists
495  ImplRemoveWindow( true );
496 
497  // de-register as "top window child" at our parent, if necessary
498  if ( mpWindowImpl->mbFrame )
499  {
500  bool bIsTopWindow
501  = mpWindowImpl->mpWinData && (mpWindowImpl->mpWinData->mnIsTopWindow == 1);
502  if ( mpWindowImpl->mpRealParent && bIsTopWindow )
503  {
504  ImplWinData* pParentWinData = mpWindowImpl->mpRealParent->ImplGetWinData();
505 
506  auto myPos = ::std::find( pParentWinData->maTopWindowChildren.begin(),
507  pParentWinData->maTopWindowChildren.end(), VclPtr<vcl::Window>(this) );
508  SAL_WARN_IF( myPos == pParentWinData->maTopWindowChildren.end(), "vcl.window", "Window::~Window: inconsistency in top window chain!" );
509  if ( myPos != pParentWinData->maTopWindowChildren.end() )
510  pParentWinData->maTopWindowChildren.erase( myPos );
511  }
512  }
513 
514  delete mpWindowImpl->mpWinData;
515  mpWindowImpl->mpWinData = nullptr;
516 
517  // remove BorderWindow or Frame window data
518  mpWindowImpl->mpBorderWindow.disposeAndClear();
519  if ( mpWindowImpl->mbFrame )
520  {
521  if ( pSVData->maFrameData.mpFirstFrame == this )
522  pSVData->maFrameData.mpFirstFrame = mpWindowImpl->mpFrameData->mpNextFrame;
523  else
524  {
525  sal_Int32 nWindows = 0;
526  vcl::Window* pSysWin = pSVData->maFrameData.mpFirstFrame;
527  while ( pSysWin && pSysWin->mpWindowImpl->mpFrameData->mpNextFrame.get() != this )
528  {
529  pSysWin = pSysWin->mpWindowImpl->mpFrameData->mpNextFrame;
530  nWindows++;
531  }
532 
533  if ( pSysWin )
534  {
535  assert (mpWindowImpl->mpFrameData->mpNextFrame.get() != pSysWin);
536  pSysWin->mpWindowImpl->mpFrameData->mpNextFrame = mpWindowImpl->mpFrameData->mpNextFrame;
537  }
538  else // if it is not in the list, we can't remove it.
539  SAL_WARN("vcl.window", "Window " << this << " marked as frame window, "
540  "is missing from list of " << nWindows << " frames");
541  }
542  if (mpWindowImpl->mpFrame) // otherwise exception during init
543  {
544  mpWindowImpl->mpFrame->SetCallback( nullptr, nullptr );
545  pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame );
546  }
547  assert (mpWindowImpl->mpFrameData->mnFocusId == nullptr);
548  assert (mpWindowImpl->mpFrameData->mnMouseMoveId == nullptr);
549 
550  mpWindowImpl->mpFrameData->mpBuffer.disposeAndClear();
551  delete mpWindowImpl->mpFrameData;
552  mpWindowImpl->mpFrameData = nullptr;
553  }
554 
555  // should be the last statements
556  mpWindowImpl.reset();
557 
559 }
560 
562 {
563  disposeOnce();
564 }
565 
566 // We will eventually being removing the inheritance of OutputDevice
567 // from Window. It will be replaced with a transient relationship such
568 // that the OutputDevice is only live for the scope of the Paint method.
569 // In the meantime this can help move us towards a Window use an
570 // OutputDevice, not being one.
571 
573 {
574  return this;
575 }
576 
578 {
579  return this;
580 }
581 
583 {
584  return GetDisplayBackground().GetColor();
585 }
586 
587 } /* namespace vcl */
588 
590 {
591  maZoom = Fraction( 1, 1 );
592  maWinRegion = vcl::Region(true);
594  mpWinData = nullptr; // Extra Window Data, that we don't need for all windows
595  mpFrameData = nullptr; // Frame Data
596  mpFrame = nullptr; // Pointer to frame window
597  mpSysObj = nullptr;
598  mpFrameWindow = nullptr; // window to top level parent (same as frame window)
599  mpOverlapWindow = nullptr; // first overlap parent
600  mpBorderWindow = nullptr; // Border-Window
601  mpClientWindow = nullptr; // Client-Window of a FrameWindow
602  mpParent = nullptr; // parent (incl. BorderWindow)
603  mpRealParent = nullptr; // real parent (excl. BorderWindow)
604  mpFirstChild = nullptr; // first child window
605  mpLastChild = nullptr; // last child window
606  mpFirstOverlap = nullptr; // first overlap window (only set in overlap windows)
607  mpLastOverlap = nullptr; // last overlap window (only set in overlap windows)
608  mpPrev = nullptr; // prev window
609  mpNext = nullptr; // next window
610  mpNextOverlap = nullptr; // next overlap window of frame
611  mpLastFocusWindow = nullptr; // window for focus restore
612  mpDlgCtrlDownWindow = nullptr; // window for dialog control
615  mpCursor = nullptr; // cursor
617  mpVCLXWindow = nullptr;
618  mpAccessibleInfos = nullptr;
619  maControlForeground = COL_TRANSPARENT; // no foreground set
620  maControlBackground = COL_TRANSPARENT; // no background set
621  mnLeftBorder = 0; // left border
622  mnTopBorder = 0; // top border
623  mnRightBorder = 0; // right border
624  mnBottomBorder = 0; // bottom border
625  mnWidthRequest = -1; // width request
626  mnHeightRequest = -1; // height request
627  mnOptimalWidthCache = -1; // optimal width cache
628  mnOptimalHeightCache = -1; // optimal height cache
629  mnX = 0; // X-Position to Parent
630  mnY = 0; // Y-Position to Parent
631  mnAbsScreenX = 0; // absolute X-position on screen, used for RTL window positioning
632  mpChildClipRegion = nullptr; // Child-Clip-Region when ClipChildren
633  mpPaintRegion = nullptr; // Paint-ClipRegion
634  mnStyle = 0; // style (init in ImplInitWindow)
635  mnPrevStyle = 0; // prevstyle (set in SetStyle)
636  mnExtendedStyle = WindowExtendedStyle::NONE; // extended style (init in ImplInitWindow)
637  mnType = nType; // type
638  mnGetFocusFlags = GetFocusFlags::NONE; // Flags for GetFocus()-Call
639  mnWaitCount = 0; // Wait-Count (>1 == "wait" mouse pointer)
640  mnPaintFlags = ImplPaintFlags::NONE; // Flags for ImplCallPaint
641  mnParentClipMode = ParentClipMode::NONE; // Flags for Parent-ClipChildren-Mode
642  mnActivateMode = ActivateModeFlags::NONE; // Will be converted in System/Overlap-Windows
643  mnDlgCtrlFlags = DialogControlFlags::NONE; // DialogControl-Flags
644  meAlwaysInputMode = AlwaysInputNone; // neither AlwaysEnableInput nor AlwaysDisableInput called
648  mnPadding = 0;
649  mnGridHeight = 1;
650  mnGridLeftAttach = -1;
651  mnGridTopAttach = -1;
652  mnGridWidth = 1;
653  mnBorderWidth = 0;
654  mnMarginLeft = 0;
655  mnMarginRight = 0;
656  mnMarginTop = 0;
657  mnMarginBottom = 0;
658  mbFrame = false; // true: Window is a frame window
659  mbBorderWin = false; // true: Window is a border window
660  mbOverlapWin = false; // true: Window is an overlap window
661  mbSysWin = false; // true: SystemWindow is the base class
662  mbDialog = false; // true: Dialog is the base class
663  mbDockWin = false; // true: DockingWindow is the base class
664  mbFloatWin = false; // true: FloatingWindow is the base class
665  mbPushButton = false; // true: PushButton is the base class
666  mbToolBox = false; // true: ToolBox is the base class
667  mbMenuFloatingWindow = false; // true: MenuFloatingWindow is the base class
668  mbToolbarFloatingWindow = false; // true: ImplPopupFloatWin is the base class, used for subtoolbars
669  mbSplitter = false; // true: Splitter is the base class
670  mbVisible = false; // true: Show( true ) called
671  mbOverlapVisible = false; // true: Hide called for visible window from ImplHideAllOverlapWindow()
672  mbDisabled = false; // true: Enable( false ) called
673  mbInputDisabled = false; // true: EnableInput( false ) called
674  mbNoUpdate = false; // true: SetUpdateMode( false ) called
675  mbNoParentUpdate = false; // true: SetParentUpdateMode( false ) called
676  mbActive = false; // true: Window Active
677  mbReallyVisible = false; // true: this and all parents to an overlapped window are visible
678  mbReallyShown = false; // true: this and all parents to an overlapped window are shown
679  mbInInitShow = false; // true: we are in InitShow
680  mbChildPtrOverwrite = false; // true: PointerStyle overwrites Child-Pointer
681  mbNoPtrVisible = false; // true: ShowPointer( false ) called
682  mbPaintFrame = false; // true: Paint is visible, but not painted
683  mbInPaint = false; // true: Inside PaintHdl
684  mbMouseButtonDown = false; // true: BaseMouseButtonDown called
685  mbMouseButtonUp = false; // true: BaseMouseButtonUp called
686  mbKeyInput = false; // true: BaseKeyInput called
687  mbKeyUp = false; // true: BaseKeyUp called
688  mbCommand = false; // true: BaseCommand called
689  mbDefPos = true; // true: Position is not Set
690  mbDefSize = true; // true: Size is not Set
691  mbCallMove = true; // true: Move must be called by Show
692  mbCallResize = true; // true: Resize must be called by Show
693  mbWaitSystemResize = true; // true: Wait for System-Resize
694  mbInitWinClipRegion = true; // true: Calc Window Clip Region
695  mbInitChildRegion = false; // true: InitChildClipRegion
696  mbWinRegion = false; // true: Window Region
697  mbClipChildren = false; // true: Child-window should be clipped
698  mbClipSiblings = false; // true: Adjacent Child-window should be clipped
699  mbChildTransparent = false; // true: Child-windows are allowed to switch to transparent (incl. Parent-CLIPCHILDREN)
700  mbPaintTransparent = false; // true: Paints should be executed on the Parent
701  mbMouseTransparent = false; // true: Window is transparent for Mouse
702  mbDlgCtrlStart = false; // true: From here on own Dialog-Control
703  mbFocusVisible = false; // true: Focus Visible
704  mbUseNativeFocus = false;
705  mbNativeFocusVisible = false; // true: native Focus Visible
706  mbInShowFocus = false; // prevent recursion
707  mbInHideFocus = false; // prevent recursion
708  mbTrackVisible = false; // true: Tracking Visible
709  mbControlForeground = false; // true: Foreground-Property set
710  mbControlBackground = false; // true: Background-Property set
711  mbAlwaysOnTop = false; // true: always visible for all others windows
712  mbCompoundControl = false; // true: Composite Control => Listener...
713  mbCompoundControlHasFocus = false; // true: Composite Control has focus somewhere
714  mbPaintDisabled = false; // true: Paint should not be executed
715  mbAllResize = false; // true: Also sent ResizeEvents with 0,0
716  mbInDispose = false; // true: We're still in Window::dispose()
717  mbExtTextInput = false; // true: ExtTextInput-Mode is active
718  mbInFocusHdl = false; // true: Within GetFocus-Handler
719  mbCreatedWithToolkit = false;
720  mbSuppressAccessibilityEvents = false; // true: do not send any accessibility events
721  mbDrawSelectionBackground = false; // true: draws transparent window background to indicate (toolbox) selection
722  mbIsInTaskPaneList = false; // true: window was added to the taskpanelist in the topmost system window
723  mnNativeBackground = ControlPart::NONE; // initialize later, depends on type
724  mbCallHandlersDuringInputDisabled = false; // true: call event handlers even if input is disabled
725  mbHelpTextDynamic = false; // true: append help id in HELP_DEBUG case
726  mbFakeFocusSet = false; // true: pretend as if the window has focus.
727  mbHexpand = false;
728  mbVexpand = false;
729  mbExpand = false;
730  mbFill = true;
731  mbSecondary = false;
732  mbNonHomogeneous = false;
733  static bool bDoubleBuffer = getenv("VCL_DOUBLEBUFFERING_FORCE_ENABLE");
734  mbDoubleBufferingRequested = bDoubleBuffer; // when we are not sure, assume it cannot do double-buffering via RenderContext
735  mpLOKNotifier = nullptr;
736  mnLOKWindowId = 0;
737  mbLOKParentNotifier = false;
738 }
739 
741 {
742  mpChildClipRegion.reset();
743  mpAccessibleInfos.reset();
744 }
745 
747  mnCursorExtWidth(0),
748  mbVertical(false),
749  mnCompositionCharRects(0),
750  mnTrackFlags(ShowTrackFlags::NONE),
751  mnIsTopWindow(sal_uInt16(~0)), // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow())
752  mbMouseOver(false),
753  mbEnableNativeWidget(false)
754 {
755 }
756 
758 {
759  mpCompositionCharRects.reset();
760 }
761 
763 {
764  ImplSVData* pSVData = ImplGetSVData();
765  assert (pSVData->maFrameData.mpFirstFrame.get() != pWindow);
767  pSVData->maFrameData.mpFirstFrame = pWindow;
768  mpFirstOverlap = nullptr;
769  mpFocusWin = nullptr;
770  mpMouseMoveWin = nullptr;
771  mpMouseDownWin = nullptr;
774  mnFocusId = nullptr;
775  mnMouseMoveId = nullptr;
776  mnLastMouseX = -1;
777  mnLastMouseY = -1;
778  mnBeforeLastMouseX = -1;
779  mnBeforeLastMouseY = -1;
780  mnFirstMouseX = -1;
781  mnFirstMouseY = -1;
782  mnLastMouseWinX = -1;
783  mnLastMouseWinY = -1;
784  mnModalMode = 0;
785  mnMouseDownTime = 0;
786  mnClickCount = 0;
787  mnFirstMouseCode = 0;
788  mnMouseCode = 0;
790  mbHasFocus = false;
791  mbInMouseMove = false;
792  mbMouseIn = false;
793  mbStartDragCalled = false;
794  mbNeedSysWindow = false;
795  mbMinimized = false;
796  mbStartFocusState = false;
797  mbInSysObjFocusHdl = false;
798  mbInSysObjToTopHdl = false;
799  mbSysObjFocus = false;
801  maPaintIdle.SetInvokeHandler( LINK( pWindow, vcl::Window, ImplHandlePaintHdl ) );
802  maPaintIdle.SetDebugName( "vcl::Window maPaintIdle" );
804  maResizeIdle.SetInvokeHandler( LINK( pWindow, vcl::Window, ImplHandleResizeTimerHdl ) );
805  maResizeIdle.SetDebugName( "vcl::Window maResizeIdle" );
807  mbInBufferedPaint = false;
808  mnDPIX = 96;
809  mnDPIY = 96;
810  mnTouchPanPosition = -1;
811 }
812 
813 namespace vcl {
814 
816 {
818 
819  if ( mpGraphics )
820  return true;
821 
822  mbInitLineColor = true;
823  mbInitFillColor = true;
824  mbInitFont = true;
825  mbInitTextColor = true;
826  mbInitClipRegion = true;
827 
828  ImplSVData* pSVData = ImplGetSVData();
829 
830  mpGraphics = mpWindowImpl->mpFrame->AcquireGraphics();
831  // try harder if no wingraphics was available directly
832  if ( !mpGraphics )
833  {
834  // find another output device in the same frame
835  OutputDevice* pReleaseOutDev = pSVData->maGDIData.mpLastWinGraphics;
836  while ( pReleaseOutDev )
837  {
838  if ( static_cast<vcl::Window*>(pReleaseOutDev)->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame )
839  break;
840  pReleaseOutDev = pReleaseOutDev->mpPrevGraphics;
841  }
842 
843  if ( pReleaseOutDev )
844  {
845  // steal the wingraphics from the other outdev
846  mpGraphics = pReleaseOutDev->mpGraphics;
847  pReleaseOutDev->ReleaseGraphics( false );
848  }
849  else
850  {
851  // if needed retry after releasing least recently used wingraphics
852  while ( !mpGraphics )
853  {
854  if ( !pSVData->maGDIData.mpLastWinGraphics )
855  break;
857  mpGraphics = mpWindowImpl->mpFrame->AcquireGraphics();
858  }
859  }
860  }
861 
862  if ( mpGraphics )
863  {
864  // update global LRU list of wingraphics
866  pSVData->maGDIData.mpFirstWinGraphics = const_cast<vcl::Window*>(this);
867  if ( mpNextGraphics )
868  mpNextGraphics->mpPrevGraphics = const_cast<vcl::Window*>(this);
869  if ( !pSVData->maGDIData.mpLastWinGraphics )
870  pSVData->maGDIData.mpLastWinGraphics = const_cast<vcl::Window*>(this);
871 
874  }
875 
876  return mpGraphics != nullptr;
877 }
878 
879 void Window::ReleaseGraphics( bool bRelease )
880 {
882 
883  if ( !mpGraphics )
884  return;
885 
886  // release the fonts of the physically released graphics device
887  if( bRelease )
889 
890  ImplSVData* pSVData = ImplGetSVData();
891 
892  vcl::Window* pWindow = this;
893 
894  if ( bRelease )
895  pWindow->mpWindowImpl->mpFrame->ReleaseGraphics( mpGraphics );
896  // remove from global LRU list of window graphics
897  if ( mpPrevGraphics )
899  else
901  if ( mpNextGraphics )
903  else
905 
906  mpGraphics = nullptr;
907  mpPrevGraphics = nullptr;
908  mpNextGraphics = nullptr;
909 }
910 
911 static sal_Int32 CountDPIScaleFactor(sal_Int32 nDPI)
912 {
913 #ifndef MACOSX
914  // Setting of HiDPI is unfortunately all only a heuristic; and to add
915  // insult to an injury, the system is constantly lying to us about
916  // the DPI and whatnot
917  // eg. fdo#77059 - set the value from which we do consider the
918  // screen HiDPI to greater than 168
919  if (nDPI > 216) // 96 * 2 + 96 / 4
920  return 250;
921  else if (nDPI > 168) // 96 * 2 - 96 / 4
922  return 200;
923  else if (nDPI > 120) // 96 * 1.5 - 96 / 4
924  return 150;
925 #else
926  (void)nDPI;
927 #endif
928 
929  return 100;
930 }
931 
932 void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData )
933 {
934  SAL_WARN_IF( !mpWindowImpl->mbFrame && !pParent && GetType() != WindowType::FIXEDIMAGE, "vcl.window",
935  "Window::Window(): pParent == NULL" );
936 
937  ImplSVData* pSVData = ImplGetSVData();
938  vcl::Window* pRealParent = pParent;
939 
940  // inherit 3D look
941  if ( !mpWindowImpl->mbOverlapWin && pParent && (pParent->GetStyle() & WB_3DLOOK) )
942  nStyle |= WB_3DLOOK;
943 
944  // create border window if necessary
945  if ( !mpWindowImpl->mbFrame && !mpWindowImpl->mbBorderWin && !mpWindowImpl->mpBorderWindow
946  && (nStyle & (WB_BORDER | WB_SYSTEMCHILDWINDOW) ) )
947  {
948  BorderWindowStyle nBorderTypeStyle = BorderWindowStyle::NONE;
949  if( nStyle & WB_SYSTEMCHILDWINDOW )
950  {
951  // handle WB_SYSTEMCHILDWINDOW
952  // these should be analogous to a top level frame; meaning they
953  // should have a border window with style BorderWindowStyle::Frame
954  // which controls their size
955  nBorderTypeStyle |= BorderWindowStyle::Frame;
956  nStyle |= WB_BORDER;
957  }
958  VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL), nBorderTypeStyle );
959  static_cast<vcl::Window*>(pBorderWin)->mpWindowImpl->mpClientWindow = this;
960  pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
961  mpWindowImpl->mpBorderWindow = pBorderWin;
962  pParent = mpWindowImpl->mpBorderWindow;
963  }
964  else if( !mpWindowImpl->mbFrame && ! pParent )
965  {
966  mpWindowImpl->mbOverlapWin = true;
967  mpWindowImpl->mbFrame = true;
968  }
969 
970  // insert window in list
971  ImplInsertWindow( pParent );
972  mpWindowImpl->mnStyle = nStyle;
973 
974  if( pParent && ! mpWindowImpl->mbFrame )
976 
977  // test for frame creation
978  if ( mpWindowImpl->mbFrame )
979  {
980  // create frame
982 
983  if ( nStyle & WB_MOVEABLE )
984  nFrameStyle |= SalFrameStyleFlags::MOVEABLE;
985  if ( nStyle & WB_SIZEABLE )
986  nFrameStyle |= SalFrameStyleFlags::SIZEABLE;
987  if ( nStyle & WB_CLOSEABLE )
988  nFrameStyle |= SalFrameStyleFlags::CLOSEABLE;
989  if ( nStyle & WB_APP )
990  nFrameStyle |= SalFrameStyleFlags::DEFAULT;
991  // check for undecorated floating window
992  if( // 1. floating windows that are not moveable/sizeable (only closeable allowed)
993  ( !(nFrameStyle & ~SalFrameStyleFlags::CLOSEABLE) &&
994  ( mpWindowImpl->mbFloatWin || ((GetType() == WindowType::BORDERWINDOW) && static_cast<ImplBorderWindow*>(this)->mbFloatWindow) || (nStyle & WB_SYSTEMFLOATWIN) ) ) ||
995  // 2. borderwindows of floaters with ownerdraw decoration
996  ((GetType() == WindowType::BORDERWINDOW) && static_cast<ImplBorderWindow*>(this)->mbFloatWindow && (nStyle & WB_OWNERDRAWDECORATION) ) )
997  {
998  nFrameStyle = SalFrameStyleFlags::FLOAT;
999  if( nStyle & WB_OWNERDRAWDECORATION )
1001  }
1002  else if( mpWindowImpl->mbFloatWin )
1003  nFrameStyle |= SalFrameStyleFlags::TOOLWINDOW;
1004 
1005  if( nStyle & WB_INTROWIN )
1006  nFrameStyle |= SalFrameStyleFlags::INTRO;
1007  if( nStyle & WB_TOOLTIPWIN )
1008  nFrameStyle |= SalFrameStyleFlags::TOOLTIP;
1009 
1010  if( nStyle & WB_NOSHADOW )
1011  nFrameStyle |= SalFrameStyleFlags::NOSHADOW;
1012 
1013  if( nStyle & WB_SYSTEMCHILDWINDOW )
1014  nFrameStyle |= SalFrameStyleFlags::SYSTEMCHILD;
1015 
1016  switch (mpWindowImpl->mnType)
1017  {
1018  case WindowType::DIALOG:
1019  case WindowType::TABDIALOG:
1020  case WindowType::MODALDIALOG:
1021  case WindowType::MODELESSDIALOG:
1022  case WindowType::MESSBOX:
1023  case WindowType::INFOBOX:
1024  case WindowType::WARNINGBOX:
1025  case WindowType::ERRORBOX:
1026  case WindowType::QUERYBOX:
1027  nFrameStyle |= SalFrameStyleFlags::DIALOG;
1028  break;
1029  default:
1030  break;
1031  }
1032 
1033  SalFrame* pParentFrame = nullptr;
1034  if ( pParent )
1035  pParentFrame = pParent->mpWindowImpl->mpFrame;
1036  SalFrame* pFrame;
1037  if ( pSystemParentData )
1038  pFrame = pSVData->mpDefInst->CreateChildFrame( pSystemParentData, nFrameStyle | SalFrameStyleFlags::PLUG );
1039  else
1040  pFrame = pSVData->mpDefInst->CreateFrame( pParentFrame, nFrameStyle );
1041  if ( !pFrame )
1042  {
1043  // do not abort but throw an exception, may be the current thread terminates anyway (plugin-scenario)
1044  throw RuntimeException(
1045  "Could not create system window!",
1047  }
1048 
1049  pFrame->SetCallback( this, ImplWindowFrameProc );
1050 
1051  // set window frame data
1052  mpWindowImpl->mpFrameData = new ImplFrameData( this );
1053  mpWindowImpl->mpFrame = pFrame;
1054  mpWindowImpl->mpFrameWindow = this;
1055  mpWindowImpl->mpOverlapWindow = this;
1056 
1057  if (!(nStyle & WB_DEFAULTWIN) && mpWindowImpl->mbDoubleBufferingRequested)
1058  RequestDoubleBuffering(true);
1059 
1060  if ( pRealParent && IsTopWindow() )
1061  {
1062  ImplWinData* pParentWinData = pRealParent->ImplGetWinData();
1063  pParentWinData->maTopWindowChildren.emplace_back(this );
1064  }
1065  }
1066 
1067  // init data
1068  mpWindowImpl->mpRealParent = pRealParent;
1069 
1070  // #99318: make sure fontcache and list is available before call to SetSettings
1071  mxFontCollection = mpWindowImpl->mpFrameData->mxFontCollection;
1072  mxFontCache = mpWindowImpl->mpFrameData->mxFontCache;
1073 
1074  if ( mpWindowImpl->mbFrame )
1075  {
1076  if ( pParent )
1077  {
1078  mpWindowImpl->mpFrameData->mnDPIX = pParent->mpWindowImpl->mpFrameData->mnDPIX;
1079  mpWindowImpl->mpFrameData->mnDPIY = pParent->mpWindowImpl->mpFrameData->mnDPIY;
1080  }
1081  else
1082  {
1083  OutputDevice *pOutDev = GetOutDev();
1084  if ( pOutDev->AcquireGraphics() )
1085  {
1086  mpGraphics->GetResolution( mpWindowImpl->mpFrameData->mnDPIX, mpWindowImpl->mpFrameData->mnDPIY );
1087  }
1088  }
1089 
1090  // add ownerdraw decorated frame windows to list in the top-most frame window
1091  // so they can be hidden on lose focus
1092  if( nStyle & WB_OWNERDRAWDECORATION )
1093  ImplGetOwnerDrawList().emplace_back(this );
1094 
1095  // delay settings initialization until first "real" frame
1096  // this relies on the IntroWindow not needing any system settings
1097  if ( !pSVData->maAppData.mbSettingsInit &&
1098  ! (nStyle & (WB_INTROWIN|WB_DEFAULTWIN))
1099  )
1100  {
1101  // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings
1104  pSVData->maAppData.mbSettingsInit = true;
1105  }
1106 
1107  // If we create a Window with default size, query this
1108  // size directly, because we want resize all Controls to
1109  // the correct size before we display the window
1110  if ( nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_APP) )
1111  mpWindowImpl->mpFrame->GetClientSize( mnOutWidth, mnOutHeight );
1112  }
1113  else
1114  {
1115  if ( pParent )
1116  {
1117  if ( !ImplIsOverlapWindow() )
1118  {
1119  mpWindowImpl->mbDisabled = pParent->mpWindowImpl->mbDisabled;
1120  mpWindowImpl->mbInputDisabled = pParent->mpWindowImpl->mbInputDisabled;
1121  mpWindowImpl->meAlwaysInputMode = pParent->mpWindowImpl->meAlwaysInputMode;
1122  }
1123 
1125  OutputDevice::SetSettings( pParent->GetSettings() );
1126  }
1127 
1128  }
1129 
1130  // setup the scale factor for HiDPI displays
1131  mnDPIScalePercentage = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY);
1132  mnDPIX = mpWindowImpl->mpFrameData->mnDPIX;
1133  mnDPIY = mpWindowImpl->mpFrameData->mnDPIY;
1134 
1136  {
1137  const StyleSettings& rStyleSettings = mxSettings->GetStyleSettings();
1138  maFont = rStyleSettings.GetAppFont();
1139 
1140  if ( nStyle & WB_3DLOOK )
1141  {
1142  SetTextColor( rStyleSettings.GetButtonTextColor() );
1143  SetBackground( Wallpaper( rStyleSettings.GetFaceColor() ) );
1144  }
1145  else
1146  {
1147  SetTextColor( rStyleSettings.GetWindowTextColor() );
1148  SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
1149  }
1150  }
1151  else
1152  {
1154  }
1155 
1156  ImplPointToLogic(*this, maFont);
1157 
1158  (void)ImplUpdatePos();
1159 
1160  // calculate app font res (except for the Intro Window or the default window)
1161  if ( mpWindowImpl->mbFrame && !pSVData->maGDIData.mnAppFontX && ! (nStyle & (WB_INTROWIN|WB_DEFAULTWIN)) )
1162  ImplInitAppFontData( this );
1163 }
1164 
1166 {
1167  ImplSVData* pSVData = ImplGetSVData();
1168  long nTextHeight = pWindow->GetTextHeight();
1169  long nTextWidth = pWindow->approximate_char_width() * 8;
1170  long nSymHeight = nTextHeight*4;
1171  // Make the basis wider if the font is too narrow
1172  // such that the dialog looks symmetrical and does not become too narrow.
1173  // Add some extra space when the dialog has the same width,
1174  // as a little more space is better.
1175  if ( nSymHeight > nTextWidth )
1176  nTextWidth = nSymHeight;
1177  else if ( nSymHeight+5 > nTextWidth )
1178  nTextWidth = nSymHeight+5;
1179  pSVData->maGDIData.mnAppFontX = nTextWidth * 10 / 8;
1180  pSVData->maGDIData.mnAppFontY = nTextHeight * 10;
1181 
1182 #ifdef MACOSX
1183  // FIXME: this is currently only on macOS, check with other
1184  // platforms
1185  if( pSVData->maNWFData.mbNoFocusRects )
1186  {
1187  // try to find out whether there is a large correction
1188  // of control sizes, if yes, make app font scalings larger
1189  // so dialog positioning is not completely off
1190  ImplControlValue aControlValue;
1191  tools::Rectangle aCtrlRegion( Point(), Size( nTextWidth < 10 ? 10 : nTextWidth, nTextHeight < 10 ? 10 : nTextHeight ) );
1192  tools::Rectangle aBoundingRgn( aCtrlRegion );
1193  tools::Rectangle aContentRgn( aCtrlRegion );
1195  ControlState::ENABLED, aControlValue,
1196  aBoundingRgn, aContentRgn ) )
1197  {
1198  // comment: the magical +6 is for the extra border in bordered
1199  // (which is the standard) edit fields
1200  if( aContentRgn.GetHeight() - nTextHeight > (nTextHeight+4)/4 )
1201  pSVData->maGDIData.mnAppFontY = (aContentRgn.GetHeight()-4) * 10;
1202  }
1203  }
1204 #endif
1205 }
1206 
1208 {
1209  if (!mpWindowImpl->mpWinData)
1210  {
1211  static const char* pNoNWF = getenv( "SAL_NO_NWF" );
1212 
1213  const_cast<vcl::Window*>(this)->mpWindowImpl->mpWinData = new ImplWinData;
1214  mpWindowImpl->mpWinData->mbEnableNativeWidget = !(pNoNWF && *pNoNWF); // true: try to draw this control with native theme API
1215  }
1216 
1217  return mpWindowImpl->mpWinData;
1218 }
1219 
1220 
1221 void Window::CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate )
1222 {
1223  if (aPosAry.mnSrcWidth == 0 || aPosAry.mnSrcHeight == 0 || aPosAry.mnDestWidth == 0 || aPosAry.mnDestHeight == 0)
1224  return;
1225 
1226  if (bWindowInvalidate)
1227  {
1228  const tools::Rectangle aSrcRect(Point(aPosAry.mnSrcX, aPosAry.mnSrcY),
1229  Size(aPosAry.mnSrcWidth, aPosAry.mnSrcHeight));
1230 
1232  aPosAry.mnDestX-aPosAry.mnSrcX,
1233  aPosAry.mnDestY-aPosAry.mnSrcY,
1234  false);
1235 
1236  mpGraphics->CopyArea(aPosAry.mnDestX, aPosAry.mnDestY,
1237  aPosAry.mnSrcX, aPosAry.mnSrcY,
1238  aPosAry.mnSrcWidth, aPosAry.mnSrcHeight,
1239  this);
1240 
1241  return;
1242  }
1243 
1244  OutputDevice::CopyDeviceArea(aPosAry, bWindowInvalidate);
1245 }
1246 
1247 void Window::DrawOutDevDirectCheck(const OutputDevice* pSrcDev, SalGraphics*& pSrcGraphics)
1248 {
1249  if ( this == pSrcDev )
1250  pSrcGraphics = nullptr;
1251  else
1252  {
1253  if ( GetOutDevType() != pSrcDev->GetOutDevType() )
1254  {
1255  if ( !pSrcDev->mpGraphics )
1256  {
1257  if ( !pSrcDev->AcquireGraphics() )
1258  return;
1259  }
1260  pSrcGraphics = pSrcDev->mpGraphics;
1261  }
1262  else
1263  {
1264  if ( this->mpWindowImpl->mpFrameWindow == static_cast<const vcl::Window*>(pSrcDev)->mpWindowImpl->mpFrameWindow )
1265  pSrcGraphics = nullptr;
1266  else
1267  {
1268  if ( !pSrcDev->mpGraphics )
1269  {
1270  if ( !pSrcDev->AcquireGraphics() )
1271  return;
1272  }
1273  pSrcGraphics = pSrcDev->mpGraphics;
1274 
1275  if ( !mpGraphics && !AcquireGraphics() )
1276  return;
1277  SAL_WARN_IF( !mpGraphics || !pSrcDev->mpGraphics, "vcl.gdi",
1278  "OutputDevice::DrawOutDev(): We need more than one Graphics" );
1279  }
1280  }
1281  }
1282 }
1283 
1284 void Window::DrawOutDevDirectProcess( const OutputDevice* pSrcDev, SalTwoRect& rPosAry, SalGraphics* pSrcGraphics )
1285 {
1286  mpGraphics->CopyBits( rPosAry, pSrcGraphics, this, pSrcDev );
1287 }
1288 
1290 {
1291  if ( mpWindowImpl->mpFrameWindow->mpGraphics )
1292  {
1293  mpWindowImpl->mpFrameWindow->mbInitClipRegion = true;
1294  }
1295  else
1296  {
1297  OutputDevice* pFrameWinOutDev = mpWindowImpl->mpFrameWindow;
1298  if ( ! pFrameWinOutDev->AcquireGraphics() )
1299  {
1300  return nullptr;
1301  }
1302  }
1303  mpWindowImpl->mpFrameWindow->mpGraphics->ResetClipRegion();
1304  return mpWindowImpl->mpFrameWindow->mpGraphics;
1305 }
1306 
1308 {
1309  // #i43594# it is possible that INITSHOW was never send, because the visibility state changed between
1310  // ImplCallInitShow() and ImplSetReallyVisible() when called from Show()
1311  // mbReallyShown is a useful indicator
1312  if( !mpWindowImpl->mbReallyShown )
1313  ImplCallInitShow();
1314 
1315  bool bBecameReallyVisible = !mpWindowImpl->mbReallyVisible;
1316 
1317  mbDevOutput = true;
1318  mpWindowImpl->mbReallyVisible = true;
1319  mpWindowImpl->mbReallyShown = true;
1320 
1321  // the SHOW/HIDE events serve as indicators to send child creation/destroy events to the access bridge.
1322  // For this, the data member of the event must not be NULL.
1323  // Previously, we did this in Window::Show, but there some events got lost in certain situations. Now
1324  // we're doing it when the visibility really changes
1325  if( bBecameReallyVisible && ImplIsAccessibleCandidate() )
1327  // TODO. It's kind of a hack that we're re-using the VclEventId::WindowShow. Normally, we should
1328  // introduce another event which explicitly triggers the Accessibility implementations.
1329 
1330  vcl::Window* pWindow = mpWindowImpl->mpFirstOverlap;
1331  while ( pWindow )
1332  {
1333  if ( pWindow->mpWindowImpl->mbVisible )
1334  pWindow->ImplSetReallyVisible();
1335  pWindow = pWindow->mpWindowImpl->mpNext;
1336  }
1337 
1338  pWindow = mpWindowImpl->mpFirstChild;
1339  while ( pWindow )
1340  {
1341  if ( pWindow->mpWindowImpl->mbVisible )
1342  pWindow->ImplSetReallyVisible();
1343  pWindow = pWindow->mpWindowImpl->mpNext;
1344  }
1345 }
1346 
1348 {
1349  // recalculate AppFont-resolution and DPI-resolution
1350  if (mpWindowImpl->mbFrame)
1351  {
1352  mnDPIX = mpWindowImpl->mpFrameData->mnDPIX;
1353  mnDPIY = mpWindowImpl->mpFrameData->mnDPIY;
1354 
1355  // setup the scale factor for HiDPI displays
1356  mnDPIScalePercentage = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY);
1357  const StyleSettings& rStyleSettings = mxSettings->GetStyleSettings();
1358  SetPointFont(*this, rStyleSettings.GetAppFont());
1359  }
1360  else if ( mpWindowImpl->mpParent )
1361  {
1362  mnDPIX = mpWindowImpl->mpParent->mnDPIX;
1363  mnDPIY = mpWindowImpl->mpParent->mnDPIY;
1364  mnDPIScalePercentage = mpWindowImpl->mpParent->mnDPIScalePercentage;
1365  }
1366 
1367  // update the recalculated values for logical units
1368  // and also tools belonging to the values
1369  if (IsMapModeEnabled())
1370  {
1371  MapMode aMapMode = GetMapMode();
1372  SetMapMode();
1373  SetMapMode( aMapMode );
1374  }
1375 }
1376 
1377 void Window::ImplPointToLogic(vcl::RenderContext const & rRenderContext, vcl::Font& rFont) const
1378 {
1379  Size aSize = rFont.GetFontSize();
1380 
1381  if (aSize.Width())
1382  {
1383  aSize.setWidth( aSize.Width() * ( mpWindowImpl->mpFrameData->mnDPIX) );
1384  aSize.AdjustWidth(72 / 2 );
1385  aSize.setWidth( aSize.Width() / 72 );
1386  }
1387  aSize.setHeight( aSize.Height() * ( mpWindowImpl->mpFrameData->mnDPIY) );
1388  aSize.AdjustHeight(72/2 );
1389  aSize.setHeight( aSize.Height() / 72 );
1390 
1391  if (rRenderContext.IsMapModeEnabled())
1392  aSize = rRenderContext.PixelToLogic(aSize);
1393 
1394  rFont.SetFontSize(aSize);
1395 }
1396 
1397 void Window::ImplLogicToPoint(vcl::RenderContext const & rRenderContext, vcl::Font& rFont) const
1398 {
1399  Size aSize = rFont.GetFontSize();
1400 
1401  if (rRenderContext.IsMapModeEnabled())
1402  aSize = rRenderContext.LogicToPixel(aSize);
1403 
1404  if (aSize.Width())
1405  {
1406  aSize.setWidth( aSize.Width() * 72 );
1407  aSize.AdjustWidth(mpWindowImpl->mpFrameData->mnDPIX / 2 );
1408  aSize.setWidth( aSize.Width() / ( mpWindowImpl->mpFrameData->mnDPIX) );
1409  }
1410  aSize.setHeight( aSize.Height() * 72 );
1411  aSize.AdjustHeight(mpWindowImpl->mpFrameData->mnDPIY / 2 );
1412  aSize.setHeight( aSize.Height() / ( mpWindowImpl->mpFrameData->mnDPIY) );
1413 
1414  rFont.SetFontSize(aSize);
1415 }
1416 
1418 {
1419  bool bSysChild = false;
1420 
1421  if ( ImplIsOverlapWindow() )
1422  {
1423  mnOutOffX = mpWindowImpl->mnX;
1424  mnOutOffY = mpWindowImpl->mnY;
1425  }
1426  else
1427  {
1428  vcl::Window* pParent = ImplGetParent();
1429 
1430  mnOutOffX = mpWindowImpl->mnX + pParent->mnOutOffX;
1431  mnOutOffY = mpWindowImpl->mnY + pParent->mnOutOffY;
1432  }
1433 
1434  VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
1435  while ( pChild )
1436  {
1437  if ( pChild->ImplUpdatePos() )
1438  bSysChild = true;
1439  pChild = pChild->mpWindowImpl->mpNext;
1440  }
1441 
1442  if ( mpWindowImpl->mpSysObj )
1443  bSysChild = true;
1444 
1445  return bSysChild;
1446 }
1447 
1449 {
1450  if ( mpWindowImpl->mpSysObj )
1451  mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight );
1452 
1453  VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
1454  while ( pChild )
1455  {
1456  pChild->ImplUpdateSysObjPos();
1457  pChild = pChild->mpWindowImpl->mpNext;
1458  }
1459 }
1460 
1461 void Window::ImplPosSizeWindow( long nX, long nY,
1462  long nWidth, long nHeight, PosSizeFlags nFlags )
1463 {
1464  bool bNewPos = false;
1465  bool bNewSize = false;
1466  bool bCopyBits = false;
1467  long nOldOutOffX = mnOutOffX;
1468  long nOldOutOffY = mnOutOffY;
1469  long nOldOutWidth = mnOutWidth;
1470  long nOldOutHeight = mnOutHeight;
1471  std::unique_ptr<vcl::Region> pOverlapRegion;
1472  std::unique_ptr<vcl::Region> pOldRegion;
1473 
1474  if ( IsReallyVisible() )
1475  {
1476  tools::Rectangle aOldWinRect( Point( nOldOutOffX, nOldOutOffY ),
1477  Size( nOldOutWidth, nOldOutHeight ) );
1478  pOldRegion.reset( new vcl::Region( aOldWinRect ) );
1479  if ( mpWindowImpl->mbWinRegion )
1480  pOldRegion->Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
1481 
1482  if ( mnOutWidth && mnOutHeight && !mpWindowImpl->mbPaintTransparent &&
1483  !mpWindowImpl->mbInitWinClipRegion && !mpWindowImpl->maWinClipRegion.IsEmpty() &&
1484  !HasPaintEvent() )
1485  bCopyBits = true;
1486  }
1487 
1488  bool bnXRecycled = false; // avoid duplicate mirroring in RTL case
1489  if ( nFlags & PosSizeFlags::Width )
1490  {
1491  if(!( nFlags & PosSizeFlags::X ))
1492  {
1493  nX = mpWindowImpl->mnX;
1494  nFlags |= PosSizeFlags::X;
1495  bnXRecycled = true; // we're using a mnX which was already mirrored in RTL case
1496  }
1497 
1498  if ( nWidth < 0 )
1499  nWidth = 0;
1500  if ( nWidth != mnOutWidth )
1501  {
1502  mnOutWidth = nWidth;
1503  bNewSize = true;
1504  bCopyBits = false;
1505  }
1506  }
1507  if ( nFlags & PosSizeFlags::Height )
1508  {
1509  if ( nHeight < 0 )
1510  nHeight = 0;
1511  if ( nHeight != mnOutHeight )
1512  {
1513  mnOutHeight = nHeight;
1514  bNewSize = true;
1515  bCopyBits = false;
1516  }
1517  }
1518 
1519  if ( nFlags & PosSizeFlags::X )
1520  {
1521  long nOrgX = nX;
1522  Point aPtDev( Point( nX+mnOutOffX, 0 ) );
1523  OutputDevice *pOutDev = GetOutDev();
1524  if( pOutDev->HasMirroredGraphics() )
1525  {
1526  aPtDev.setX( mpGraphics->mirror2( aPtDev.X(), this ) );
1527 
1528  // #106948# always mirror our pos if our parent is not mirroring, even
1529  // if we are also not mirroring
1530  // RTL: check if parent is in different coordinates
1531  if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() )
1532  {
1533  nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX;
1534  }
1535  /* #i99166# An LTR window in RTL UI that gets sized only would be
1536  expected to not moved its upper left point
1537  */
1538  if( bnXRecycled )
1539  {
1540  if( ImplIsAntiparallel() )
1541  {
1542  aPtDev.setX( mpWindowImpl->mnAbsScreenX );
1543  nOrgX = mpWindowImpl->maPos.X();
1544  }
1545  }
1546  }
1547  else if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() )
1548  {
1549  // mirrored window in LTR UI
1550  nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX;
1551  }
1552 
1553  // check maPos as well, as it could have been changed for client windows (ImplCallMove())
1554  if ( mpWindowImpl->mnAbsScreenX != aPtDev.X() || nX != mpWindowImpl->mnX || nOrgX != mpWindowImpl->maPos.X() )
1555  {
1556  if ( bCopyBits && !pOverlapRegion )
1557  {
1558  pOverlapRegion.reset( new vcl::Region() );
1560  Size( mnOutWidth, mnOutHeight ) ),
1561  *pOverlapRegion, false, true );
1562  }
1563  mpWindowImpl->mnX = nX;
1564  mpWindowImpl->maPos.setX( nOrgX );
1565  mpWindowImpl->mnAbsScreenX = aPtDev.X();
1566  bNewPos = true;
1567  }
1568  }
1569  if ( nFlags & PosSizeFlags::Y )
1570  {
1571  // check maPos as well, as it could have been changed for client windows (ImplCallMove())
1572  if ( nY != mpWindowImpl->mnY || nY != mpWindowImpl->maPos.Y() )
1573  {
1574  if ( bCopyBits && !pOverlapRegion )
1575  {
1576  pOverlapRegion.reset( new vcl::Region() );
1578  Size( mnOutWidth, mnOutHeight ) ),
1579  *pOverlapRegion, false, true );
1580  }
1581  mpWindowImpl->mnY = nY;
1582  mpWindowImpl->maPos.setY( nY );
1583  bNewPos = true;
1584  }
1585  }
1586 
1587  if ( bNewPos || bNewSize )
1588  {
1589  bool bUpdateSysObjPos = false;
1590  if ( bNewPos )
1591  bUpdateSysObjPos = ImplUpdatePos();
1592 
1593  // the borderwindow always specifies the position for its client window
1594  if ( mpWindowImpl->mpBorderWindow )
1595  mpWindowImpl->maPos = mpWindowImpl->mpBorderWindow->mpWindowImpl->maPos;
1596 
1597  if ( mpWindowImpl->mpClientWindow )
1598  {
1599  mpWindowImpl->mpClientWindow->ImplPosSizeWindow( mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder,
1600  mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder,
1601  mnOutWidth-mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnRightBorder,
1602  mnOutHeight-mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnBottomBorder,
1603  PosSizeFlags::X | PosSizeFlags::Y |
1604  PosSizeFlags::Width | PosSizeFlags::Height );
1605  // If we have a client window, then this is the position
1606  // of the Application's floating windows
1607  mpWindowImpl->mpClientWindow->mpWindowImpl->maPos = mpWindowImpl->maPos;
1608  if ( bNewPos )
1609  {
1610  if ( mpWindowImpl->mpClientWindow->IsVisible() )
1611  {
1612  mpWindowImpl->mpClientWindow->ImplCallMove();
1613  }
1614  else
1615  {
1616  mpWindowImpl->mpClientWindow->mpWindowImpl->mbCallMove = true;
1617  }
1618  }
1619  }
1620 
1621  // Move()/Resize() will be called only for Show(), such that
1622  // at least one is called before Show()
1623  if ( IsVisible() )
1624  {
1625  if ( bNewPos )
1626  {
1627  ImplCallMove();
1628  }
1629  if ( bNewSize )
1630  {
1631  ImplCallResize();
1632  }
1633  }
1634  else
1635  {
1636  if ( bNewPos )
1637  mpWindowImpl->mbCallMove = true;
1638  if ( bNewSize )
1639  mpWindowImpl->mbCallResize = true;
1640  }
1641 
1642  bool bUpdateSysObjClip = false;
1643  if ( IsReallyVisible() )
1644  {
1645  if ( bNewPos || bNewSize )
1646  {
1647  // set Clip-Flag
1648  bUpdateSysObjClip = !ImplSetClipFlag( true );
1649  }
1650 
1651  // invalidate window content ?
1652  if ( bNewPos || (mnOutWidth > nOldOutWidth) || (mnOutHeight > nOldOutHeight) )
1653  {
1654  if ( bNewPos )
1655  {
1656  bool bInvalidate = false;
1657  bool bParentPaint = true;
1658  if ( !ImplIsOverlapWindow() )
1659  bParentPaint = mpWindowImpl->mpParent->IsPaintEnabled();
1660  if ( bCopyBits && bParentPaint && !HasPaintEvent() )
1661  {
1662  Point aPoint( mnOutOffX, mnOutOffY );
1663  vcl::Region aRegion( tools::Rectangle( aPoint,
1664  Size( mnOutWidth, mnOutHeight ) ) );
1665  if ( mpWindowImpl->mbWinRegion )
1666  aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
1667  ImplClipBoundaries( aRegion, false, true );
1668  if ( !pOverlapRegion->IsEmpty() )
1669  {
1670  pOverlapRegion->Move( mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY );
1671  aRegion.Exclude( *pOverlapRegion );
1672  }
1673  if ( !aRegion.IsEmpty() )
1674  {
1675  // adapt Paint areas
1676  ImplMoveAllInvalidateRegions( tools::Rectangle( Point( nOldOutOffX, nOldOutOffY ),
1677  Size( nOldOutWidth, nOldOutHeight ) ),
1678  mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY,
1679  true );
1680  SalGraphics* pGraphics = ImplGetFrameGraphics();
1681  if ( pGraphics )
1682  {
1683 
1684  OutputDevice *pOutDev = GetOutDev();
1685  const bool bSelectClipRegion = pOutDev->SelectClipRegion( aRegion, pGraphics );
1686  if ( bSelectClipRegion )
1687  {
1688  pGraphics->CopyArea( mnOutOffX, mnOutOffY,
1689  nOldOutOffX, nOldOutOffY,
1690  nOldOutWidth, nOldOutHeight,
1691  this );
1692  }
1693  else
1694  bInvalidate = true;
1695  }
1696  else
1697  bInvalidate = true;
1698  if ( !bInvalidate )
1699  {
1700  if ( !pOverlapRegion->IsEmpty() )
1701  ImplInvalidateFrameRegion( pOverlapRegion.get(), InvalidateFlags::Children );
1702  }
1703  }
1704  else
1705  bInvalidate = true;
1706  }
1707  else
1708  bInvalidate = true;
1709  if ( bInvalidate )
1711  }
1712  else
1713  {
1714  Point aPoint( mnOutOffX, mnOutOffY );
1715  vcl::Region aRegion( tools::Rectangle( aPoint,
1716  Size( mnOutWidth, mnOutHeight ) ) );
1717  aRegion.Exclude( *pOldRegion );
1718  if ( mpWindowImpl->mbWinRegion )
1719  aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
1720  ImplClipBoundaries( aRegion, false, true );
1721  if ( !aRegion.IsEmpty() )
1723  }
1724  }
1725 
1726  // invalidate Parent or Overlaps
1727  if ( bNewPos ||
1728  (mnOutWidth < nOldOutWidth) || (mnOutHeight < nOldOutHeight) )
1729  {
1730  vcl::Region aRegion( *pOldRegion );
1731  if ( !mpWindowImpl->mbPaintTransparent )
1732  ImplExcludeWindowRegion( aRegion );
1733  ImplClipBoundaries( aRegion, false, true );
1734  if ( !aRegion.IsEmpty() && !mpWindowImpl->mpBorderWindow )
1736  }
1737  }
1738 
1739  // adapt system objects
1740  if ( bUpdateSysObjClip )
1742  if ( bUpdateSysObjPos )
1744  if ( bNewSize && mpWindowImpl->mpSysObj )
1745  mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight );
1746  }
1747 }
1748 
1750 {
1751  ImplSVData* pSVData = ImplGetSVData();
1752  vcl::Window* pFocusWin = pSVData->mpWinData->mpFocusWin;
1753  if ( !pFocusWin || pFocusWin->IsDisposed() )
1754  return;
1755 
1756  // Is InputContext changed?
1757  const InputContext& rInputContext = pFocusWin->GetInputContext();
1758  if ( rInputContext == pFocusWin->mpWindowImpl->mpFrameData->maOldInputContext )
1759  return;
1760 
1761  pFocusWin->mpWindowImpl->mpFrameData->maOldInputContext = rInputContext;
1762 
1763  SalInputContext aNewContext;
1764  const vcl::Font& rFont = rInputContext.GetFont();
1765  const OUString& rFontName = rFont.GetFamilyName();
1767  aNewContext.mpFont = nullptr;
1768  if (!rFontName.isEmpty())
1769  {
1770  OutputDevice *pFocusWinOutDev = pFocusWin->GetOutDev();
1771  Size aSize = pFocusWinOutDev->ImplLogicToDevicePixel( rFont.GetFontSize() );
1772  if ( !aSize.Height() )
1773  {
1774  // only set default sizes if the font height in logical
1775  // coordinates equals 0
1776  if ( rFont.GetFontSize().Height() )
1777  aSize.setHeight( 1 );
1778  else
1779  aSize.setHeight( (12*pFocusWin->mnDPIY)/72 );
1780  }
1781  pFontInstance = pFocusWin->mxFontCache->GetFontInstance( pFocusWin->mxFontCollection.get(),
1782  rFont, aSize, static_cast<float>(aSize.Height()) );
1783  if ( pFontInstance )
1784  aNewContext.mpFont = pFontInstance;
1785  }
1786  aNewContext.mnOptions = rInputContext.GetOptions();
1787  pFocusWin->ImplGetFrame()->SetInputContext( &aNewContext );
1788 }
1789 
1791 {
1792  if (mpWindowImpl) // may be called after dispose
1793  {
1794  mpWindowImpl->maDumpAsPropertyTreeHdl = rLink;
1795  }
1796 }
1797 
1799 {
1801 }
1802 
1804 {
1805  Show(false);
1807 }
1808 
1810 {
1811  return mpWindowImpl->mpFrame->GetIndicatorState();
1812 }
1813 
1814 void Window::SimulateKeyPress( sal_uInt16 nKeyCode ) const
1815 {
1816  mpWindowImpl->mpFrame->SimulateKeyPress(nKeyCode);
1817 }
1818 
1819 void Window::KeyInput( const KeyEvent& rKEvt )
1820 {
1821  KeyCode cod = rKEvt.GetKeyCode ();
1822  bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel;
1823 
1824  // do not respond to accelerators unless Alt or Ctrl is held */
1825  if (cod.GetCode () >= 0x200 && cod.GetCode () <= 0x219)
1826  {
1827  if (autoacc && cod.GetModifier () != KEY_MOD2 && !(cod.GetModifier() & KEY_MOD1))
1828  return;
1829  }
1830 
1831  NotifyEvent aNEvt( MouseNotifyEvent::KEYINPUT, this, &rKEvt );
1832  if ( !CompatNotify( aNEvt ) )
1833  mpWindowImpl->mbKeyInput = true;
1834 }
1835 
1836 void Window::KeyUp( const KeyEvent& rKEvt )
1837 {
1838  NotifyEvent aNEvt( MouseNotifyEvent::KEYUP, this, &rKEvt );
1839  if ( !CompatNotify( aNEvt ) )
1840  mpWindowImpl->mbKeyUp = true;
1841 }
1842 
1843 void Window::Draw( OutputDevice*, const Point&, const Size&, DrawFlags )
1844 {
1845 }
1846 
1847 void Window::Move() {}
1848 
1850 
1852 
1854 
1856 {
1857  if ( HasFocus() && mpWindowImpl->mpLastFocusWindow && !(mpWindowImpl->mnDlgCtrlFlags & DialogControlFlags::WantFocus) )
1858  {
1859  VclPtr<vcl::Window> xWindow(this);
1860  mpWindowImpl->mpLastFocusWindow->GrabFocus();
1861  if( xWindow->IsDisposed() )
1862  return;
1863  }
1864 
1865  NotifyEvent aNEvt( MouseNotifyEvent::GETFOCUS, this );
1866  CompatNotify( aNEvt );
1867 }
1868 
1870 {
1872  CompatNotify( aNEvt );
1873 }
1874 
1876 {
1877  if (mpWindowImpl) // may be called after dispose
1878  {
1879  mpWindowImpl->maHelpRequestHdl = rLink;
1880  }
1881 }
1882 
1883 void Window::RequestHelp( const HelpEvent& rHEvt )
1884 {
1885  // if Balloon-Help is requested, show the balloon
1886  // with help text set
1887  if ( rHEvt.GetMode() & HelpEventMode::BALLOON )
1888  {
1889  OUString rStr = GetHelpText();
1890  if ( rStr.isEmpty() )
1891  rStr = GetQuickHelpText();
1892  if ( rStr.isEmpty() && ImplGetParent() && !ImplIsOverlapWindow() )
1893  ImplGetParent()->RequestHelp( rHEvt );
1894  else
1895  {
1896  Point aPos = GetPosPixel();
1897  if ( ImplGetParent() && !ImplIsOverlapWindow() )
1898  aPos = OutputToScreenPixel(Point(0, 0));
1899  tools::Rectangle aRect( aPos, GetSizePixel() );
1900 
1901  Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aRect, rStr );
1902  }
1903  }
1904  else if ( rHEvt.GetMode() & HelpEventMode::QUICK )
1905  {
1906  const OUString& rStr = GetQuickHelpText();
1907  if ( rStr.isEmpty() && ImplGetParent() && !ImplIsOverlapWindow() )
1908  ImplGetParent()->RequestHelp( rHEvt );
1909  else
1910  {
1911  Point aPos = GetPosPixel();
1912  if ( ImplGetParent() && !ImplIsOverlapWindow() )
1913  aPos = OutputToScreenPixel(Point(0, 0));
1914  tools::Rectangle aRect( aPos, GetSizePixel() );
1915  Help::ShowQuickHelp( this, aRect, rStr, QuickHelpFlags::CtrlText );
1916  }
1917  }
1918  else if (!mpWindowImpl->maHelpRequestHdl.IsSet() || mpWindowImpl->maHelpRequestHdl.Call(*this))
1919  {
1920  OUString aStrHelpId( OStringToOUString( GetHelpId(), RTL_TEXTENCODING_UTF8 ) );
1921  if ( aStrHelpId.isEmpty() && ImplGetParent() )
1922  ImplGetParent()->RequestHelp( rHEvt );
1923  else
1924  {
1925  Help* pHelp = Application::GetHelp();
1926  if ( pHelp )
1927  {
1928  if( !aStrHelpId.isEmpty() )
1929  pHelp->Start( aStrHelpId, this );
1930  else
1931  pHelp->Start( OOO_HELP_INDEX, this );
1932  }
1933  }
1934  }
1935 }
1936 
1937 void Window::Command( const CommandEvent& rCEvt )
1938 {
1939  CallEventListeners( VclEventId::WindowCommand, const_cast<CommandEvent *>(&rCEvt) );
1940 
1941  NotifyEvent aNEvt( MouseNotifyEvent::COMMAND, this, &rCEvt );
1942  if ( !CompatNotify( aNEvt ) )
1943  mpWindowImpl->mbCommand = true;
1944 }
1945 
1946 void Window::Tracking( const TrackingEvent& rTEvt )
1947 {
1948 
1949  ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this );
1950  if( pWrapper )
1951  pWrapper->Tracking( rTEvt );
1952 }
1953 
1955 {
1956  switch (eType)
1957  {
1958  //stuff that doesn't invalidate the layout
1968  break;
1969  //stuff that does invalidate the layout
1970  default:
1971  queue_resize(eType);
1972  break;
1973  }
1974 }
1975 
1977 {
1978  if ( mpWindowImpl && mpWindowImpl->mnStyle != nStyle )
1979  {
1980  mpWindowImpl->mnPrevStyle = mpWindowImpl->mnStyle;
1981  mpWindowImpl->mnStyle = nStyle;
1983  }
1984 }
1985 
1987 {
1988 
1989  if ( mpWindowImpl->mnExtendedStyle != nExtendedStyle )
1990  {
1991  vcl::Window* pWindow = ImplGetBorderWindow();
1992  if( ! pWindow )
1993  pWindow = this;
1994  if( pWindow->mpWindowImpl->mbFrame )
1995  {
1996  SalExtStyle nExt = 0;
1997  if( nExtendedStyle & WindowExtendedStyle::Document )
1999  if( nExtendedStyle & WindowExtendedStyle::DocModified )
2001 
2002  pWindow->ImplGetFrame()->SetExtendedFrameStyle( nExt );
2003  }
2004  mpWindowImpl->mnExtendedStyle = nExtendedStyle;
2005  }
2006 }
2007 
2009 {
2010 
2011  if ( mpWindowImpl->mpBorderWindow )
2012  {
2013  if( nBorderStyle == WindowBorderStyle::REMOVEBORDER &&
2014  ! mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame &&
2015  mpWindowImpl->mpBorderWindow->mpWindowImpl->mpParent
2016  )
2017  {
2018  // this is a little awkward: some controls (e.g. svtools ProgressBar)
2019  // cannot avoid getting constructed with WB_BORDER but want to disable
2020  // borders in case of NWF drawing. So they need a method to remove their border window
2021  VclPtr<vcl::Window> pBorderWin = mpWindowImpl->mpBorderWindow;
2022  // remove us as border window's client
2023  pBorderWin->mpWindowImpl->mpClientWindow = nullptr;
2024  mpWindowImpl->mpBorderWindow = nullptr;
2025  mpWindowImpl->mpRealParent = pBorderWin->mpWindowImpl->mpParent;
2026  // reparent us above the border window
2027  SetParent( pBorderWin->mpWindowImpl->mpParent );
2028  // set us to the position and size of our previous border
2029  Point aBorderPos( pBorderWin->GetPosPixel() );
2030  Size aBorderSize( pBorderWin->GetSizePixel() );
2031  setPosSizePixel( aBorderPos.X(), aBorderPos.Y(), aBorderSize.Width(), aBorderSize.Height() );
2032  // release border window
2033  pBorderWin.disposeAndClear();
2034 
2035  // set new style bits
2036  SetStyle( GetStyle() & (~WB_BORDER) );
2037  }
2038  else
2039  {
2040  if ( mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW )
2041  static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetBorderStyle( nBorderStyle );
2042  else
2043  mpWindowImpl->mpBorderWindow->SetBorderStyle( nBorderStyle );
2044  }
2045  }
2046 }
2047 
2049 {
2050 
2051  if ( mpWindowImpl->mpBorderWindow )
2052  {
2053  if ( mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW )
2054  return static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->GetBorderStyle();
2055  else
2056  return mpWindowImpl->mpBorderWindow->GetBorderStyle();
2057  }
2058 
2059  return WindowBorderStyle::NONE;
2060 }
2061 
2063 {
2064 
2065  if ( mpWindowImpl->mpBorderWindow )
2066  {
2067  if ( mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW )
2068  return static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->CalcTitleWidth();
2069  else
2070  return mpWindowImpl->mpBorderWindow->CalcTitleWidth();
2071  }
2072  else if ( mpWindowImpl->mbFrame && (mpWindowImpl->mnStyle & WB_MOVEABLE) )
2073  {
2074  // we guess the width for frame windows as we do not know the
2075  // border of external dialogs
2076  const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
2077  vcl::Font aFont = GetFont();
2078  const_cast<vcl::Window*>(this)->SetPointFont(*const_cast<Window*>(this), rStyleSettings.GetTitleFont());
2079  long nTitleWidth = GetTextWidth( GetText() );
2080  const_cast<vcl::Window*>(this)->SetFont( aFont );
2081  nTitleWidth += rStyleSettings.GetTitleHeight() * 3;
2082  nTitleWidth += StyleSettings::GetBorderSize() * 2;
2083  nTitleWidth += 10;
2084  return nTitleWidth;
2085  }
2086 
2087  return 0;
2088 }
2089 
2090 void Window::SetInputContext( const InputContext& rInputContext )
2091 {
2092 
2093  mpWindowImpl->maInputContext = rInputContext;
2094  if ( !mpWindowImpl->mbInFocusHdl && HasFocus() )
2096 }
2097 
2098 void Window::PostExtTextInputEvent(VclEventId nType, const OUString& rText)
2099 {
2100  switch (nType)
2101  {
2103  {
2104  std::unique_ptr<ExtTextInputAttr[]> pAttr(new ExtTextInputAttr[rText.getLength()]);
2105  for (int i = 0; i < rText.getLength(); ++i) {
2106  pAttr[i] = ExtTextInputAttr::Underline;
2107  }
2108  SalExtTextInputEvent aEvent { rText, pAttr.get(), rText.getLength(), EXTTEXTINPUT_CURSOR_OVERWRITE };
2110  }
2111  break;
2114  break;
2115  default:
2116  assert(false);
2117  }
2118 }
2119 
2121 {
2122  if ( mpWindowImpl->mbExtTextInput )
2124 }
2125 
2126 void Window::SetCursorRect( const tools::Rectangle* pRect, long nExtTextInputWidth )
2127 {
2128 
2129  ImplWinData* pWinData = ImplGetWinData();
2130  if ( pWinData->mpCursorRect )
2131  {
2132  if ( pRect )
2133  pWinData->mpCursorRect = *pRect;
2134  else
2135  pWinData->mpCursorRect.reset();
2136  }
2137  else
2138  {
2139  if ( pRect )
2140  pWinData->mpCursorRect = *pRect;
2141  }
2142 
2143  pWinData->mnCursorExtWidth = nExtTextInputWidth;
2144 
2145 }
2146 
2148 {
2149 
2150  ImplWinData* pWinData = ImplGetWinData();
2151  return pWinData->mpCursorRect ? &*pWinData->mpCursorRect : nullptr;
2152 }
2153 
2155 {
2156 
2157  ImplWinData* pWinData = ImplGetWinData();
2158  return pWinData->mnCursorExtWidth;
2159 }
2160 
2161 void Window::SetCompositionCharRect( const tools::Rectangle* pRect, long nCompositionLength, bool bVertical ) {
2162 
2163  ImplWinData* pWinData = ImplGetWinData();
2164  pWinData->mpCompositionCharRects.reset();
2165  pWinData->mbVertical = bVertical;
2166  pWinData->mnCompositionCharRects = nCompositionLength;
2167  if ( pRect && (nCompositionLength > 0) )
2168  {
2169  pWinData->mpCompositionCharRects.reset( new tools::Rectangle[nCompositionLength] );
2170  for (long i = 0; i < nCompositionLength; ++i)
2171  pWinData->mpCompositionCharRects[i] = pRect[i];
2172  }
2173 }
2174 
2175 void Window::CollectChildren(::std::vector<vcl::Window *>& rAllChildren )
2176 {
2177  rAllChildren.push_back( this );
2178 
2179  VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
2180  while ( pChild )
2181  {
2182  pChild->CollectChildren( rAllChildren );
2183  pChild = pChild->mpWindowImpl->mpNext;
2184  }
2185 }
2186 
2187 void Window::SetPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont)
2188 {
2189  vcl::Font aFont = rFont;
2190  ImplPointToLogic(rRenderContext, aFont);
2191  rRenderContext.SetFont(aFont);
2192 }
2193 
2195 {
2196  vcl::Font aFont = rRenderContext.GetFont();
2197  ImplLogicToPoint(rRenderContext, aFont);
2198  return aFont;
2199 }
2200 
2201 void Window::Show(bool bVisible, ShowFlags nFlags)
2202 {
2203  if ( IsDisposed() || mpWindowImpl->mbVisible == bVisible )
2204  return;
2205 
2206  VclPtr<vcl::Window> xWindow(this);
2207 
2208  bool bRealVisibilityChanged = false;
2209  mpWindowImpl->mbVisible = bVisible;
2210 
2211  if ( !bVisible )
2212  {
2214  if( xWindow->IsDisposed() )
2215  return;
2216 
2217  if ( mpWindowImpl->mpBorderWindow )
2218  {
2219  bool bOldUpdate = mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate;
2220  if ( mpWindowImpl->mbNoParentUpdate )
2221  mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = true;
2222  mpWindowImpl->mpBorderWindow->Show( false, nFlags );
2223  mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = bOldUpdate;
2224  }
2225  else if ( mpWindowImpl->mbFrame )
2226  {
2227  mpWindowImpl->mbSuppressAccessibilityEvents = true;
2228  mpWindowImpl->mpFrame->Show( false );
2229  }
2230 
2232 
2233  if ( mpWindowImpl->mbReallyVisible )
2234  {
2235  if ( mpWindowImpl->mbInitWinClipRegion )
2237 
2238  vcl::Region aInvRegion = mpWindowImpl->maWinClipRegion;
2239 
2240  if( xWindow->IsDisposed() )
2241  return;
2242 
2243  bRealVisibilityChanged = mpWindowImpl->mbReallyVisible;
2245  ImplSetClipFlag();
2246 
2247  if ( ImplIsOverlapWindow() && !mpWindowImpl->mbFrame )
2248  {
2249  // convert focus
2250  if ( !(nFlags & ShowFlags::NoFocusChange) && HasChildPathFocus() )
2251  {
2252  if ( mpWindowImpl->mpOverlapWindow->IsEnabled() &&
2253  mpWindowImpl->mpOverlapWindow->IsInputEnabled() &&
2254  ! mpWindowImpl->mpOverlapWindow->IsInModalMode()
2255  )
2256  mpWindowImpl->mpOverlapWindow->GrabFocus();
2257  }
2258  }
2259 
2260  if ( !mpWindowImpl->mbFrame )
2261  {
2262  if (mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mbEnableNativeWidget)
2263  {
2264  /*
2265  * #i48371# native theming: some themes draw outside the control
2266  * area we tell them to (bad thing, but we cannot do much about it ).
2267  * On hiding these controls they get invalidated with their window rectangle
2268  * which leads to the parts outside the control area being left and not
2269  * invalidated. Workaround: invalidate an area on the parent, too
2270  */
2271  const int workaround_border = 5;
2272  tools::Rectangle aBounds( aInvRegion.GetBoundRect() );
2273  aBounds.AdjustLeft( -workaround_border );
2274  aBounds.AdjustTop( -workaround_border );
2275  aBounds.AdjustRight(workaround_border );
2276  aBounds.AdjustBottom(workaround_border );
2277  aInvRegion = aBounds;
2278  }
2279  if ( !mpWindowImpl->mbNoParentUpdate )
2280  {
2281  if ( !aInvRegion.IsEmpty() )
2282  ImplInvalidateParentFrameRegion( aInvRegion );
2283  }
2285  }
2286  }
2287  }
2288  else
2289  {
2290  // inherit native widget flag for form controls
2291  // required here, because frames never show up in the child hierarchy - which should be fixed...
2292  // eg, the drop down of a combobox which is a system floating window
2293  if( mpWindowImpl->mbFrame && GetParent() && GetParent()->IsCompoundControl() &&
2295  !(GetStyle() & WB_TOOLTIPWIN) )
2296  {
2298  }
2299 
2300  if ( mpWindowImpl->mbCallMove )
2301  {
2302  ImplCallMove();
2303  }
2304  if ( mpWindowImpl->mbCallResize )
2305  {
2306  ImplCallResize();
2307  }
2308 
2310 
2311  vcl::Window* pTestParent;
2312  if ( ImplIsOverlapWindow() )
2313  pTestParent = mpWindowImpl->mpOverlapWindow;
2314  else
2315  pTestParent = ImplGetParent();
2316  if ( mpWindowImpl->mbFrame || pTestParent->mpWindowImpl->mbReallyVisible )
2317  {
2318  // if a window becomes visible, send all child windows a StateChange,
2319  // such that these can initialise themselves
2320  ImplCallInitShow();
2321 
2322  // If it is a SystemWindow it automatically pops up on top of
2323  // all other windows if needed.
2324  if ( ImplIsOverlapWindow() && !(nFlags & ShowFlags::NoActivate) )
2325  {
2327  ImplFocusToTop( ToTopFlags::NONE, false );
2328  }
2329 
2330  // adjust mpWindowImpl->mbReallyVisible
2331  bRealVisibilityChanged = !mpWindowImpl->mbReallyVisible;
2333 
2334  // assure clip rectangles will be recalculated
2335  ImplSetClipFlag();
2336 
2337  if ( !mpWindowImpl->mbFrame )
2338  {
2339  InvalidateFlags nInvalidateFlags = InvalidateFlags::Children;
2340  if( ! IsPaintTransparent() )
2341  nInvalidateFlags |= InvalidateFlags::NoTransparent;
2342  ImplInvalidate( nullptr, nInvalidateFlags );
2344  }
2345  }
2346 
2347  if ( mpWindowImpl->mpBorderWindow )
2348  mpWindowImpl->mpBorderWindow->Show( true, nFlags );
2349  else if ( mpWindowImpl->mbFrame )
2350  {
2351  // #106431#, hide SplashScreen
2352  ImplSVData* pSVData = ImplGetSVData();
2353  if ( !pSVData->mpIntroWindow )
2354  {
2355  // The right way would be just to call this (not even in the 'if')
2356  auto pApp = GetpApp();
2357  if ( pApp )
2358  pApp->InitFinished();
2359  }
2360  else if ( !ImplIsWindowOrChild( pSVData->mpIntroWindow ) )
2361  {
2362  // ... but the VCL splash is broken, and it needs this
2363  // (for ./soffice .uno:NewDoc)
2364  pSVData->mpIntroWindow->Hide();
2365  }
2366 
2367  //SAL_WARN_IF( mpWindowImpl->mbSuppressAccessibilityEvents, "vcl", "Window::Show() - Frame reactivated");
2368  mpWindowImpl->mbSuppressAccessibilityEvents = false;
2369 
2370  mpWindowImpl->mbPaintFrame = true;
2372  {
2373  bool bNoActivate(nFlags & (ShowFlags::NoActivate|ShowFlags::NoFocusChange));
2374  mpWindowImpl->mpFrame->Show( true, bNoActivate );
2375  }
2376  if( xWindow->IsDisposed() )
2377  return;
2378 
2379  // Query the correct size of the window, if we are waiting for
2380  // a system resize
2381  if ( mpWindowImpl->mbWaitSystemResize )
2382  {
2383  long nOutWidth;
2384  long nOutHeight;
2385  mpWindowImpl->mpFrame->GetClientSize( nOutWidth, nOutHeight );
2386  ImplHandleResize( this, nOutWidth, nOutHeight );
2387  }
2388 
2389  if (mpWindowImpl->mpFrameData->mpBuffer && mpWindowImpl->mpFrameData->mpBuffer->GetOutputSizePixel() != GetOutputSizePixel())
2390  // Make sure that the buffer size matches the window size, even if no resize was needed.
2391  mpWindowImpl->mpFrameData->mpBuffer->SetOutputSizePixel(GetOutputSizePixel());
2392  }
2393 
2394  if( xWindow->IsDisposed() )
2395  return;
2396 
2398  }
2399 
2400  if( xWindow->IsDisposed() )
2401  return;
2402 
2403  // the SHOW/HIDE events also serve as indicators to send child creation/destroy events to the access bridge
2404  // However, the access bridge only uses this event if the data member is not NULL (it's kind of a hack that
2405  // we re-use the SHOW/HIDE events this way, with this particular semantics).
2406  // Since #104887#, the notifications for the access bridge are done in Impl(Set|Reset)ReallyVisible. Here, we
2407  // now only notify with a NULL data pointer, for all other clients except the access bridge.
2408  if ( !bRealVisibilityChanged )
2410  if( xWindow->IsDisposed() )
2411  return;
2412 
2413 }
2414 
2416 {
2417  if (!mpWindowImpl)
2418  {
2419  SAL_WARN("vcl.layout", "WTF no windowimpl");
2420  return Size(0,0);
2421  }
2422 
2423  // #i43257# trigger pending resize handler to assure correct window sizes
2424  if( mpWindowImpl->mpFrameData->maResizeIdle.IsActive() )
2425  {
2426  VclPtr<vcl::Window> xWindow( const_cast<Window*>(this) );
2427  mpWindowImpl->mpFrameData->maResizeIdle.Stop();
2428  mpWindowImpl->mpFrameData->maResizeIdle.Invoke( nullptr );
2429  if( xWindow->IsDisposed() )
2430  return Size(0,0);
2431  }
2432 
2433  return Size( mnOutWidth+mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder,
2434  mnOutHeight+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder );
2435 }
2436 
2437 void Window::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
2438  sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
2439 {
2440  rLeftBorder = mpWindowImpl->mnLeftBorder;
2441  rTopBorder = mpWindowImpl->mnTopBorder;
2442  rRightBorder = mpWindowImpl->mnRightBorder;
2443  rBottomBorder = mpWindowImpl->mnBottomBorder;
2444 }
2445 
2446 void Window::Enable( bool bEnable, bool bChild )
2447 {
2448  if ( IsDisposed() )
2449  return;
2450 
2451  if ( !bEnable )
2452  {
2453  // the tracking mode will be stopped or the capture will be stolen
2454  // when a window is disabled,
2455  if ( IsTracking() )
2457  if ( IsMouseCaptured() )
2458  ReleaseMouse();
2459  // try to pass focus to the next control
2460  // if the window has focus and is contained in the dialog control
2461  // mpWindowImpl->mbDisabled should only be set after a call of ImplDlgCtrlNextWindow().
2462  // Otherwise ImplDlgCtrlNextWindow() should be used
2463  if ( HasFocus() )
2465  }
2466 
2467  if ( mpWindowImpl->mpBorderWindow )
2468  {
2469  mpWindowImpl->mpBorderWindow->Enable( bEnable, false );
2470  if ( (mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW) &&
2471  static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow )
2472  static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow->Enable( bEnable );
2473  }
2474 
2475  // #i56102# restore app focus win in case the
2476  // window was disabled when the frame focus changed
2477  ImplSVData* pSVData = ImplGetSVData();
2478  if (bEnable && pSVData->mpWinData->mpFocusWin == nullptr
2479  && mpWindowImpl->mpFrameData->mbHasFocus && mpWindowImpl->mpFrameData->mpFocusWin == this)
2480  pSVData->mpWinData->mpFocusWin = this;
2481 
2482  if ( mpWindowImpl->mbDisabled != !bEnable )
2483  {
2484  mpWindowImpl->mbDisabled = !bEnable;
2485  if ( mpWindowImpl->mpSysObj )
2486  mpWindowImpl->mpSysObj->Enable( bEnable && !mpWindowImpl->mbInputDisabled );
2488 
2490  }
2491 
2492  if ( bChild )
2493  {
2494  VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
2495  while ( pChild )
2496  {
2497  pChild->Enable( bEnable, bChild );
2498  pChild = pChild->mpWindowImpl->mpNext;
2499  }
2500  }
2501 
2502  if ( IsReallyVisible() )
2504 }
2505 
2507 {
2508  mpWindowImpl->mbCallHandlersDuringInputDisabled = bCall;
2509 
2510  VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
2511  while ( pChild )
2512  {
2513  pChild->SetCallHandlersOnInputDisabled( bCall );
2514  pChild = pChild->mpWindowImpl->mpNext;
2515  }
2516 }
2517 
2519 {
2520  return mpWindowImpl->mbCallHandlersDuringInputDisabled;
2521 }
2522 
2523 void Window::EnableInput( bool bEnable, bool bChild )
2524 {
2525  if (!mpWindowImpl)
2526  return;
2527 
2528  bool bNotify = (bEnable != mpWindowImpl->mbInputDisabled);
2529  if ( mpWindowImpl->mpBorderWindow )
2530  {
2531  mpWindowImpl->mpBorderWindow->EnableInput( bEnable, false );
2532  if ( (mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW) &&
2533  static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow )
2534  static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow->EnableInput( bEnable );
2535  }
2536 
2537  if ( (! bEnable && mpWindowImpl->meAlwaysInputMode != AlwaysInputEnabled) ||
2538  ( bEnable && mpWindowImpl->meAlwaysInputMode != AlwaysInputDisabled) )
2539  {
2540  // automatically stop the tracking mode or steal capture
2541  // if the window is disabled
2542  if ( !bEnable )
2543  {
2544  if ( IsTracking() )
2546  if ( IsMouseCaptured() )
2547  ReleaseMouse();
2548  }
2549 
2550  if ( mpWindowImpl->mbInputDisabled != !bEnable )
2551  {
2552  mpWindowImpl->mbInputDisabled = !bEnable;
2553  if ( mpWindowImpl->mpSysObj )
2554  mpWindowImpl->mpSysObj->Enable( !mpWindowImpl->mbDisabled && bEnable );
2555  }
2556  }
2557 
2558  // #i56102# restore app focus win in case the
2559  // window was disabled when the frame focus changed
2560  ImplSVData* pSVData = ImplGetSVData();
2561  if (bEnable && pSVData->mpWinData->mpFocusWin == nullptr
2562  && mpWindowImpl->mpFrameData->mbHasFocus && mpWindowImpl->mpFrameData->mpFocusWin == this)
2563  pSVData->mpWinData->mpFocusWin = this;
2564 
2565  if ( bChild )
2566  {
2567  VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
2568  while ( pChild )
2569  {
2570  pChild->EnableInput( bEnable, bChild );
2571  pChild = pChild->mpWindowImpl->mpNext;
2572  }
2573  }
2574 
2575  if ( IsReallyVisible() )
2577 
2578  // #104827# notify parent
2579  if ( bNotify && bEnable )
2580  {
2582  CompatNotify( aNEvt );
2583  }
2584 }
2585 
2586 void Window::EnableInput( bool bEnable, const vcl::Window* pExcludeWindow )
2587 {
2588  if (!mpWindowImpl)
2589  return;
2590 
2591  EnableInput( bEnable );
2592 
2593  // pExecuteWindow is the first Overlap-Frame --> if this
2594  // shouldn't be the case, then this must be changed in dialog.cxx
2595  if( pExcludeWindow )
2596  pExcludeWindow = pExcludeWindow->ImplGetFirstOverlapWindow();
2597  vcl::Window* pSysWin = mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrameData->mpFirstOverlap;
2598  while ( pSysWin )
2599  {
2600  // Is Window in the path from this window
2601  if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( pSysWin, true ) )
2602  {
2603  // Is Window not in the exclude window path or not the
2604  // exclude window, then change the status
2605  if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( pSysWin, true ) )
2606  pSysWin->EnableInput( bEnable );
2607  }
2608  pSysWin = pSysWin->mpWindowImpl->mpNextOverlap;
2609  }
2610 
2611  // enable/disable floating system windows as well
2613  while ( pFrameWin )
2614  {
2615  if( pFrameWin->ImplIsFloatingWindow() )
2616  {
2617  // Is Window in the path from this window
2618  if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( pFrameWin, true ) )
2619  {
2620  // Is Window not in the exclude window path or not the
2621  // exclude window, then change the status
2622  if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( pFrameWin, true ) )
2623  pFrameWin->EnableInput( bEnable );
2624  }
2625  }
2626  pFrameWin = pFrameWin->mpWindowImpl->mpFrameData->mpNextFrame;
2627  }
2628 
2629  // the same for ownerdraw floating windows
2630  if( mpWindowImpl->mbFrame )
2631  {
2632  ::std::vector< VclPtr<vcl::Window> >& rList = mpWindowImpl->mpFrameData->maOwnerDrawList;
2633  for (auto const& elem : rList)
2634  {
2635  // Is Window in the path from this window
2636  if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( elem, true ) )
2637  {
2638  // Is Window not in the exclude window path or not the
2639  // exclude window, then change the status
2640  if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( elem, true ) )
2641  elem->EnableInput( bEnable );
2642  }
2643  }
2644  }
2645 }
2646 
2647 void Window::AlwaysEnableInput( bool bAlways, bool bChild )
2648 {
2649 
2650  if ( mpWindowImpl->mpBorderWindow )
2651  mpWindowImpl->mpBorderWindow->AlwaysEnableInput( bAlways, false );
2652 
2653  if( bAlways && mpWindowImpl->meAlwaysInputMode != AlwaysInputEnabled )
2654  {
2655  mpWindowImpl->meAlwaysInputMode = AlwaysInputEnabled;
2656  EnableInput(true, false);
2657  }
2658  else if( ! bAlways && mpWindowImpl->meAlwaysInputMode == AlwaysInputEnabled )
2659  {
2660  mpWindowImpl->meAlwaysInputMode = AlwaysInputNone;
2661  }
2662 
2663  if ( bChild )
2664  {
2665  VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
2666  while ( pChild )
2667  {
2668  pChild->AlwaysEnableInput( bAlways, bChild );
2669  pChild = pChild->mpWindowImpl->mpNext;
2670  }
2671  }
2672 }
2673 
2674 void Window::AlwaysDisableInput( bool bAlways, bool bChild )
2675 {
2676 
2677  if ( mpWindowImpl->mpBorderWindow )
2678  mpWindowImpl->mpBorderWindow->AlwaysDisableInput( bAlways, false );
2679 
2680  if( bAlways && mpWindowImpl->meAlwaysInputMode != AlwaysInputDisabled )
2681  {
2682  mpWindowImpl->meAlwaysInputMode = AlwaysInputDisabled;
2683  EnableInput(false, false);
2684  }
2685  else if( ! bAlways && mpWindowImpl->meAlwaysInputMode == AlwaysInputDisabled )
2686  {
2687  mpWindowImpl->meAlwaysInputMode = AlwaysInputNone;
2688  }
2689 
2690  if ( bChild )
2691  {
2692  VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
2693  while ( pChild )
2694  {
2695  pChild->AlwaysDisableInput( bAlways, bChild );
2696  pChild = pChild->mpWindowImpl->mpNext;
2697  }
2698  }
2699 }
2700 
2702 {
2703 
2704  if ( mpWindowImpl->mpBorderWindow )
2705  mpWindowImpl->mpBorderWindow->SetActivateMode( nMode );
2706 
2707  if ( mpWindowImpl->mnActivateMode != nMode )
2708  {
2709  mpWindowImpl->mnActivateMode = nMode;
2710 
2711  // possibly trigger Deactivate/Activate
2712  if ( mpWindowImpl->mnActivateMode != ActivateModeFlags::NONE )
2713  {
2714  if ( (mpWindowImpl->mbActive || (GetType() == WindowType::BORDERWINDOW)) &&
2715  !HasChildPathFocus( true ) )
2716  {
2717  mpWindowImpl->mbActive = false;
2718  Deactivate();
2719  }
2720  }
2721  else
2722  {
2723  if ( !mpWindowImpl->mbActive || (GetType() == WindowType::BORDERWINDOW) )
2724  {
2725  mpWindowImpl->mbActive = true;
2726  Activate();
2727  }
2728  }
2729  }
2730 }
2731 
2732 void Window::setPosSizePixel( long nX, long nY,
2733  long nWidth, long nHeight, PosSizeFlags nFlags )
2734 {
2735  bool bHasValidSize = !mpWindowImpl->mbDefSize;
2736 
2737  if ( nFlags & PosSizeFlags::Pos )
2738  mpWindowImpl->mbDefPos = false;
2739  if ( nFlags & PosSizeFlags::Size )
2740  mpWindowImpl->mbDefSize = false;
2741 
2742  // The top BorderWindow is the window which is to be positioned
2743  VclPtr<vcl::Window> pWindow = this;
2744  while ( pWindow->mpWindowImpl->mpBorderWindow )
2745  pWindow = pWindow->mpWindowImpl->mpBorderWindow;
2746 
2747  if ( pWindow->mpWindowImpl->mbFrame )
2748  {
2749  // Note: if we're positioning a frame, the coordinates are interpreted
2750  // as being the top-left corner of the window's client area and NOT
2751  // as the position of the border ! (due to limitations of several UNIX window managers)
2752  long nOldWidth = pWindow->mnOutWidth;
2753 
2754  if ( !(nFlags & PosSizeFlags::Width) )
2755  nWidth = pWindow->mnOutWidth;
2756  if ( !(nFlags & PosSizeFlags::Height) )
2757  nHeight = pWindow->mnOutHeight;
2758 
2759  sal_uInt16 nSysFlags=0;
2760  VclPtr<vcl::Window> pParent = GetParent();
2761  VclPtr<vcl::Window> pWinParent = pWindow->GetParent();
2762 
2763  if( nFlags & PosSizeFlags::Width )
2764  nSysFlags |= SAL_FRAME_POSSIZE_WIDTH;
2765  if( nFlags & PosSizeFlags::Height )
2766  nSysFlags |= SAL_FRAME_POSSIZE_HEIGHT;
2767  if( nFlags & PosSizeFlags::X )
2768  {
2769  nSysFlags |= SAL_FRAME_POSSIZE_X;
2770  if( pWinParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
2771  {
2772  nX += pWinParent->mnOutOffX;
2773  }
2774  if( pParent && pParent->ImplIsAntiparallel() )
2775  {
2776  tools::Rectangle aRect( Point ( nX, nY ), Size( nWidth, nHeight ) );
2777  const OutputDevice *pParentOutDev = pParent->GetOutDev();
2778  pParentOutDev->ReMirror( aRect );
2779  nX = aRect.Left();
2780  }
2781  }
2782  if( !(nFlags & PosSizeFlags::X) && bHasValidSize && pWindow->mpWindowImpl->mpFrame->maGeometry.nWidth )
2783  {
2784  // RTL: make sure the old right aligned position is not changed
2785  // system windows will always grow to the right
2786  if ( pWinParent )
2787  {
2788  OutputDevice *pParentOutDev = pWinParent->GetOutDev();
2789  if( pParentOutDev->HasMirroredGraphics() )
2790  {
2791  const SalFrameGeometry& aSysGeometry = mpWindowImpl->mpFrame->GetUnmirroredGeometry();
2792  const SalFrameGeometry& aParentSysGeometry =
2793  pWinParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry();
2794  long myWidth = nOldWidth;
2795  if( !myWidth )
2796  myWidth = aSysGeometry.nWidth;
2797  if( !myWidth )
2798  myWidth = nWidth;
2799  nFlags |= PosSizeFlags::X;
2800  nSysFlags |= SAL_FRAME_POSSIZE_X;
2801  nX = aParentSysGeometry.nX - aSysGeometry.nLeftDecoration + aParentSysGeometry.nWidth
2802  - myWidth - 1 - aSysGeometry.nX;
2803  }
2804  }
2805  }
2806  if( nFlags & PosSizeFlags::Y )
2807  {
2808  nSysFlags |= SAL_FRAME_POSSIZE_Y;
2809  if( pWinParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
2810  {
2811  nY += pWinParent->mnOutOffY;
2812  }
2813  }
2814 
2816  {
2817  // check for min/max client size and adjust size accordingly
2818  // otherwise it may happen that the resize event is ignored, i.e. the old size remains
2819  // unchanged but ImplHandleResize() is called with the wrong size
2820  SystemWindow *pSystemWindow = dynamic_cast< SystemWindow* >( pWindow.get() );
2821  if( pSystemWindow )
2822  {
2823  Size aMinSize = pSystemWindow->GetMinOutputSizePixel();
2824  Size aMaxSize = pSystemWindow->GetMaxOutputSizePixel();
2825  if( nWidth < aMinSize.Width() )
2826  nWidth = aMinSize.Width();
2827  if( nHeight < aMinSize.Height() )
2828  nHeight = aMinSize.Height();
2829 
2830  if( nWidth > aMaxSize.Width() )
2831  nWidth = aMaxSize.Width();
2832  if( nHeight > aMaxSize.Height() )
2833  nHeight = aMaxSize.Height();
2834  }
2835  }
2836 
2837  pWindow->mpWindowImpl->mpFrame->SetPosSize( nX, nY, nWidth, nHeight, nSysFlags );
2838 
2839  // Adjust resize with the hack of different client size and frame geometries to fix
2840  // native menu bars. Eventually this should be replaced by proper mnTopBorder usage.
2841  pWindow->mpWindowImpl->mpFrame->GetClientSize(nWidth, nHeight);
2842 
2843  // Resize should be called directly. If we haven't
2844  // set the correct size, we get a second resize from
2845  // the system with the correct size. This can be happened
2846  // if the size is too small or too large.
2847  ImplHandleResize( pWindow, nWidth, nHeight );
2848  }
2849  else
2850  {
2851  pWindow->ImplPosSizeWindow( nX, nY, nWidth, nHeight, nFlags );
2852  if ( IsReallyVisible() )
2854  }
2855 }
2856 
2858 {
2859  return mpWindowImpl->maPos;
2860 }
2861 
2863 {
2864  tools::Rectangle rRect;
2865  mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrame->GetWorkArea( rRect );
2866  return rRect;
2867 }
2868 
2869 Point Window::OutputToScreenPixel( const Point& rPos ) const
2870 {
2871  // relative to top level parent
2872  return Point( rPos.X()+mnOutOffX, rPos.Y()+mnOutOffY );
2873 }
2874 
2875 Point Window::ScreenToOutputPixel( const Point& rPos ) const
2876 {
2877  // relative to top level parent
2878  return Point( rPos.X()-mnOutOffX, rPos.Y()-mnOutOffY );
2879 }
2880 
2882 {
2883  // revert mnOutOffX changes that were potentially made in ImplPosSizeWindow
2884  long offx = mnOutOffX;
2885  OutputDevice *pOutDev = GetOutDev();
2886  if( pOutDev->HasMirroredGraphics() )
2887  {
2888  if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() )
2889  {
2890  if ( !ImplIsOverlapWindow() )
2891  offx -= mpWindowImpl->mpParent->mnOutOffX;
2892 
2893  offx = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - offx;
2894 
2895  if ( !ImplIsOverlapWindow() )
2896  offx += mpWindowImpl->mpParent->mnOutOffX;
2897 
2898  }
2899  }
2900  return offx;
2901 }
2902 
2903 // normalized screen pixel are independent of mirroring
2905 {
2906  // relative to top level parent
2907  long offx = const_cast<vcl::Window*>(this)->ImplGetUnmirroredOutOffX();
2908  return Point( rPos.X()+offx, rPos.Y()+mnOutOffY );
2909 }
2910 
2912 {
2913  // relative to top level parent
2914  long offx = const_cast<vcl::Window*>(this)->ImplGetUnmirroredOutOffX();
2915  return Point( rPos.X()-offx, rPos.Y()-mnOutOffY );
2916 }
2917 
2918 Point Window::OutputToAbsoluteScreenPixel( const Point& rPos ) const
2919 {
2920  // relative to the screen
2921  Point p = OutputToScreenPixel( rPos );
2922  SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
2923  p.AdjustX(g.nX );
2924  p.AdjustY(g.nY );
2925  return p;
2926 }
2927 
2928 Point Window::AbsoluteScreenToOutputPixel( const Point& rPos ) const
2929 {
2930  // relative to the screen
2931  Point p = ScreenToOutputPixel( rPos );
2932  SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
2933  p.AdjustX( -(g.nX) );
2934  p.AdjustY( -(g.nY) );
2935  return p;
2936 }
2937 
2939 {
2940  // this method creates unmirrored screen coordinates to be compared with the desktop
2941  // and is used for positioning of RTL popup windows correctly on the screen
2942  SalFrameGeometry g = mpWindowImpl->mpFrame->GetUnmirroredGeometry();
2943 
2944  Point p1 = OutputToScreenPixel( rRect.TopRight() );
2945  p1.setX( g.nX+g.nWidth-p1.X() );
2946  p1.AdjustY(g.nY );
2947 
2948  Point p2 = OutputToScreenPixel( rRect.BottomLeft() );
2949  p2.setX( g.nX+g.nWidth-p2.X() );
2950  p2.AdjustY(g.nY );
2951 
2952  return tools::Rectangle( p1, p2 );
2953 }
2954 
2956 {
2957  // with decoration
2958  return ImplGetWindowExtentsRelative( pRelativeWindow, false );
2959 }
2960 
2962 {
2963  // without decoration
2964  return ImplGetWindowExtentsRelative( nullptr, true );
2965 }
2966 
2967 tools::Rectangle Window::ImplGetWindowExtentsRelative( vcl::Window *pRelativeWindow, bool bClientOnly ) const
2968 {
2969  SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
2970  // make sure we use the extent of our border window,
2971  // otherwise we miss a few pixels
2972  const vcl::Window *pWin = (!bClientOnly && mpWindowImpl->mpBorderWindow) ? mpWindowImpl->mpBorderWindow : this;
2973 
2974  Point aPos( pWin->OutputToScreenPixel( Point(0,0) ) );
2975  aPos.AdjustX(g.nX );
2976  aPos.AdjustY(g.nY );
2977  Size aSize ( pWin->GetSizePixel() );
2978  // #104088# do not add decoration to the workwindow to be compatible to java accessibility api
2979  if( !bClientOnly && (mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame && GetType() != WindowType::WORKWINDOW)) )
2980  {
2981  aPos.AdjustX( -sal_Int32(g.nLeftDecoration) );
2982  aPos.AdjustY( -sal_Int32(g.nTopDecoration) );
2984  aSize.AdjustHeight(g.nTopDecoration + g.nBottomDecoration );
2985  }
2986  if( pRelativeWindow )
2987  {
2988  // #106399# express coordinates relative to borderwindow
2989  vcl::Window *pRelWin = (!bClientOnly && pRelativeWindow->mpWindowImpl->mpBorderWindow) ? pRelativeWindow->mpWindowImpl->mpBorderWindow.get() : pRelativeWindow;
2990  aPos = pRelWin->AbsoluteScreenToOutputPixel( aPos );
2991  }
2992  return tools::Rectangle( aPos, aSize );
2993 }
2994 
2995 void Window::Scroll( long nHorzScroll, long nVertScroll, ScrollFlags nFlags )
2996 {
2997 
2999  Size( mnOutWidth, mnOutHeight ) ),
3000  nHorzScroll, nVertScroll, nFlags & ~ScrollFlags::Clip );
3001 }
3002 
3003 void Window::Scroll( long nHorzScroll, long nVertScroll,
3004  const tools::Rectangle& rRect, ScrollFlags nFlags )
3005 {
3006  OutputDevice *pOutDev = GetOutDev();
3007  tools::Rectangle aRect = pOutDev->ImplLogicToDevicePixel( rRect );
3009  if ( !aRect.IsEmpty() )
3010  ImplScroll( aRect, nHorzScroll, nVertScroll, nFlags );
3011 }
3012 
3014 {
3015  if (mpWindowImpl)
3016  {
3018  mpWindowImpl->mpFrame->Flush( aWinRect );
3019  }
3020 }
3021 
3022 void Window::SetUpdateMode( bool bUpdate )
3023 {
3024  if (mpWindowImpl)
3025  {
3026  mpWindowImpl->mbNoUpdate = !bUpdate;
3028  }
3029 }
3030 
3032 {
3034 }
3035 
3036 bool Window::HasFocus() const
3037 {
3038  return (this == ImplGetSVData()->mpWinData->mpFocusWin);
3039 }
3040 
3042 {
3044 }
3045 
3047 {
3048  if (mpWindowImpl && mpWindowImpl->mpFrameData)
3049  return mpWindowImpl->mpFrameData->mpFocusWin;
3050  else
3051  return VclPtr<vcl::Window>();
3052 }
3053 
3054 void Window::SetFakeFocus( bool bFocus )
3055 {
3056  ImplGetWindowImpl()->mbFakeFocusSet = bFocus;
3057 }
3058 
3059 bool Window::HasChildPathFocus( bool bSystemWindow ) const
3060 {
3061 
3062  vcl::Window* pFocusWin = ImplGetSVData()->mpWinData->mpFocusWin;
3063  if ( pFocusWin )
3064  return ImplIsWindowOrChild( pFocusWin, bSystemWindow );
3065  return false;
3066 }
3067 
3069 {
3070 
3071  if ( mpWindowImpl->mpCursor != pCursor )
3072  {
3073  if ( mpWindowImpl->mpCursor )
3074  mpWindowImpl->mpCursor->ImplHide();
3075  mpWindowImpl->mpCursor = pCursor;
3076  if ( pCursor )
3077  pCursor->ImplShow();
3078  }
3079 }
3080 
3081 void Window::SetText( const OUString& rStr )
3082 {
3083  if (!mpWindowImpl || rStr == mpWindowImpl->maText)
3084  return;
3085 
3086  OUString oldTitle( mpWindowImpl->maText );
3087  mpWindowImpl->maText = rStr;
3088 
3089  if ( mpWindowImpl->mpBorderWindow )
3090  mpWindowImpl->mpBorderWindow->SetText( rStr );
3091  else if ( mpWindowImpl->mbFrame )
3092  mpWindowImpl->mpFrame->SetTitle( rStr );
3093 
3095 
3096  // #107247# needed for accessibility
3097  // The VclEventId::WindowFrameTitleChanged is (mis)used to notify accessible name changes.
3098  // Therefore a window, which is labeled by this window, must also notify an accessible
3099  // name change.
3100  if ( IsReallyVisible() )
3101  {
3103  if ( pWindow && pWindow != this )
3105  }
3106 
3108 }
3109 
3110 OUString Window::GetText() const
3111 {
3112 
3113  return mpWindowImpl->maText;
3114 }
3115 
3116 OUString Window::GetDisplayText() const
3117 {
3118 
3119  return GetText();
3120 }
3121 
3123 {
3124  // FIXME: fix issue 52349, need to fix this really in
3125  // all NWF enabled controls
3126  const ToolBox* pTB = dynamic_cast<const ToolBox*>(this);
3127  if( pTB && IsNativeWidgetEnabled() )
3129 
3130  if( !IsBackground() )
3131  {
3132  if( mpWindowImpl->mpParent )
3133  return mpWindowImpl->mpParent->GetDisplayBackground();
3134  }
3135 
3136  const Wallpaper& rBack = GetBackground();
3137  if( ! rBack.IsBitmap() &&
3138  ! rBack.IsGradient() &&
3139  rBack.GetColor()== COL_TRANSPARENT &&
3140  mpWindowImpl->mpParent )
3141  return mpWindowImpl->mpParent->GetDisplayBackground();
3142  return rBack;
3143 }
3144 
3145 const OUString& Window::GetHelpText() const
3146 {
3147  OUString aStrHelpId( OStringToOUString( GetHelpId(), RTL_TEXTENCODING_UTF8 ) );
3148  bool bStrHelpId = !aStrHelpId.isEmpty();
3149 
3150  if ( !mpWindowImpl->maHelpText.getLength() && bStrHelpId )
3151  {
3152  if ( !IsDialog() && (mpWindowImpl->mnType != WindowType::TABPAGE) && (mpWindowImpl->mnType != WindowType::FLOATINGWINDOW) )
3153  {
3154  Help* pHelp = Application::GetHelp();
3155  if ( pHelp )
3156  {
3157  mpWindowImpl->maHelpText = pHelp->GetHelpText(aStrHelpId, this);
3158  mpWindowImpl->mbHelpTextDynamic = false;
3159  }
3160  }
3161  }
3162  else if( mpWindowImpl->mbHelpTextDynamic && bStrHelpId )
3163  {
3164  static const char* pEnv = getenv( "HELP_DEBUG" );
3165  if( pEnv && *pEnv )
3166  {
3167  OUString aTxt = mpWindowImpl->maHelpText + "\n------------------\n" + aStrHelpId;
3168  mpWindowImpl->maHelpText = aTxt;
3169  }
3170  mpWindowImpl->mbHelpTextDynamic = false;
3171  }
3172 
3173  //Fallback to Window::GetAccessibleDescription without reentry to GetHelpText()
3174  if (mpWindowImpl->maHelpText.isEmpty() && mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pAccessibleDescription)
3175  return *mpWindowImpl->mpAccessibleInfos->pAccessibleDescription;
3176  return mpWindowImpl->maHelpText;
3177 }
3178 
3179 void Window::SetWindowPeer( Reference< css::awt::XWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow )
3180 {
3181  if (!mpWindowImpl)
3182  return;
3183 
3184  // be safe against re-entrance: first clear the old ref, then assign the new one
3185  mpWindowImpl->mxWindowPeer.clear();
3186  mpWindowImpl->mxWindowPeer = xPeer;
3187 
3188  mpWindowImpl->mpVCLXWindow = pVCLXWindow;
3189 }
3190 
3191 Reference< css::awt::XWindowPeer > Window::GetComponentInterface( bool bCreate )
3192 {
3193  if ( !mpWindowImpl->mxWindowPeer.is() && bCreate )
3194  {
3195  UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper();
3196  if ( pWrapper )
3197  mpWindowImpl->mxWindowPeer = pWrapper->GetWindowInterface( this );
3198  }
3199  return mpWindowImpl->mxWindowPeer;
3200 }
3201 
3202 void Window::SetComponentInterface( Reference< css::awt::XWindowPeer > const & xIFace )
3203 {
3204  UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper();
3205  SAL_WARN_IF( !pWrapper, "vcl.window", "SetComponentInterface: No Wrapper!" );
3206  if ( pWrapper )
3207  pWrapper->SetWindowInterface( this, xIFace );
3208 }
3209 
3210 typedef std::map<vcl::LOKWindowId, VclPtr<vcl::Window>> LOKWindowsMap;
3211 
3212 namespace {
3213 
3214 LOKWindowsMap& GetLOKWindowsMap()
3215 {
3216  // Map to remember the LOKWindowId <-> Window binding.
3217  static LOKWindowsMap s_aLOKWindowsMap;
3218 
3219  return s_aLOKWindowsMap;
3220 }
3221 
3222 }
3223 
3224 void Window::SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier, bool bParent)
3225 {
3226  // don't allow setting this twice
3227  assert(mpWindowImpl->mpLOKNotifier == nullptr);
3228  assert(pNotifier);
3229  // never use this in the desktop case
3231 
3232  if (!bParent)
3233  {
3234  // Counter to be able to have unique id's for each window.
3235  static vcl::LOKWindowId sLastLOKWindowId = 1;
3236 
3237  // assign the LOK window id
3238  assert(mpWindowImpl->mnLOKWindowId == 0);
3239  mpWindowImpl->mnLOKWindowId = sLastLOKWindowId++;
3240  GetLOKWindowsMap().emplace(mpWindowImpl->mnLOKWindowId, this);
3241  }
3242  else
3243  mpWindowImpl->mbLOKParentNotifier = true;
3244 
3245  mpWindowImpl->mpLOKNotifier = pNotifier;
3246 }
3247 
3249 {
3250  const auto it = GetLOKWindowsMap().find(nWindowId);
3251  if (it != GetLOKWindowsMap().end())
3252  return it->second;
3253 
3254  return VclPtr<Window>();
3255 }
3256 
3258 {
3259  return GetLOKWindowsMap().empty();
3260 }
3261 
3263 {
3264  // unregister the LOK window binding
3265  if (mpWindowImpl->mnLOKWindowId > 0)
3266  GetLOKWindowsMap().erase(mpWindowImpl->mnLOKWindowId);
3267 
3268  mpWindowImpl->mpLOKNotifier = nullptr;
3269  mpWindowImpl->mnLOKWindowId = 0;
3270 }
3271 
3272 ILibreOfficeKitNotifier::~ILibreOfficeKitNotifier()
3273 {
3275  {
3276  return;
3277  }
3278 
3279  for (auto it = GetLOKWindowsMap().begin(); it != GetLOKWindowsMap().end();)
3280  {
3281  WindowImpl* pWindowImpl = it->second->ImplGetWindowImpl();
3282  if (pWindowImpl && pWindowImpl->mpLOKNotifier == this)
3283  {
3284  pWindowImpl->mpLOKNotifier = nullptr;
3285  pWindowImpl->mnLOKWindowId = 0;
3286  it = GetLOKWindowsMap().erase(it);
3287  continue;
3288  }
3289 
3290  ++it;
3291  }
3292 }
3293 
3294 const vcl::ILibreOfficeKitNotifier* Window::GetLOKNotifier() const
3295 {
3296  return mpWindowImpl->mpLOKNotifier;
3297 }
3298 
3300 {
3301  return mpWindowImpl->mnLOKWindowId;
3302 }
3303 
3305 {
3306  VclPtr<vcl::Window> pWindow(this);
3307 
3308  while (pWindow && !pWindow->GetLOKNotifier())
3309  pWindow = pWindow->GetParent();
3310 
3311  return pWindow;
3312 }
3313 
3314 namespace
3315 {
3316 
3317 const char* windowTypeName(WindowType nWindowType)
3318 {
3319  switch (nWindowType)
3320  {
3321  case WindowType::NONE: return "none";
3322  case WindowType::MESSBOX: return "messagebox";
3323  case WindowType::INFOBOX: return "infobox";
3324  case WindowType::WARNINGBOX: return "warningbox";
3325  case WindowType::ERRORBOX: return "errorbox";
3326  case WindowType::QUERYBOX: return "querybox";
3327  case WindowType::WINDOW: return "window";
3328  case WindowType::WORKWINDOW: return "workwindow";
3329  case WindowType::CONTAINER: return "container";
3330  case WindowType::FLOATINGWINDOW: return "floatingwindow";
3331  case WindowType::DIALOG: return "dialog";
3332  case WindowType::MODELESSDIALOG: return "modelessdialog";
3333  case WindowType::MODALDIALOG: return "modaldialog";
3334  case WindowType::CONTROL: return "control";
3335  case WindowType::PUSHBUTTON: return "pushbutton";
3336  case WindowType::OKBUTTON: return "okbutton";
3337  case WindowType::CANCELBUTTON: return "cancelbutton";
3338  case WindowType::HELPBUTTON: return "helpbutton";
3339  case WindowType::IMAGEBUTTON: return "imagebutton";
3340  case WindowType::MENUBUTTON: return "menubutton";
3341  case WindowType::MOREBUTTON: return "morebutton";
3342  case WindowType::SPINBUTTON: return "spinbutton";
3343  case WindowType::RADIOBUTTON: return "radiobutton";
3344  case WindowType::CHECKBOX: return "checkbox";
3345  case WindowType::TRISTATEBOX: return "tristatebox";
3346  case WindowType::EDIT: return "edit";
3347  case WindowType::MULTILINEEDIT: return "multilineedit";
3348  case WindowType::COMBOBOX: return "combobox";
3349  case WindowType::LISTBOX: return "listbox";
3350  case WindowType::MULTILISTBOX: return "multilistbox";
3351  case WindowType::FIXEDTEXT: return "fixedtext";
3352  case WindowType::FIXEDLINE: return "fixedline";
3353  case WindowType::FIXEDBITMAP: return "fixedbitmap";
3354  case WindowType::FIXEDIMAGE: return "fixedimage";
3355  case WindowType::GROUPBOX: return "groupbox";
3356  case WindowType::SCROLLBAR: return "scrollbar";
3357  case WindowType::SCROLLBARBOX: return "scrollbarbox";
3358  case WindowType::SPLITTER: return "splitter";
3359  case WindowType::SPLITWINDOW: return "splitwindow";
3360  case WindowType::SPINFIELD: return "spinfield";
3361  case WindowType::PATTERNFIELD: return "patternfield";
3362  case WindowType::NUMERICFIELD: return "numericfield";
3363  case WindowType::METRICFIELD: return "metricfield";
3364  case WindowType::CURRENCYFIELD: return "currencyfield";
3365  case WindowType::DATEFIELD: return "datefield";
3366  case WindowType::TIMEFIELD: return "timefield";
3367  case WindowType::PATTERNBOX: return "patternbox";
3368  case WindowType::NUMERICBOX: return "numericbox";
3369  case WindowType::METRICBOX: return "metricbox";
3370  case WindowType::CURRENCYBOX: return "currencybox";
3371  case WindowType::DATEBOX: return "datebox";
3372  case WindowType::TIMEBOX: return "timebox";
3373  case WindowType::LONGCURRENCYFIELD: return "longcurrencyfield";
3374  case WindowType::LONGCURRENCYBOX: return "longcurrencybox";
3375  case WindowType::SCROLLWINDOW: return "scrollwindow";
3376  case WindowType::TOOLBOX: return "toolbox";
3377  case WindowType::DOCKINGWINDOW: return "dockingwindow";
3378  case WindowType::STATUSBAR: return "statusbar";
3379  case WindowType::TABPAGE: return "tabpage";
3380  case WindowType::TABCONTROL: return "tabcontrol";
3381  case WindowType::TABDIALOG: return "tabdialog";
3382  case WindowType::BORDERWINDOW: return "borderwindow";
3383  case WindowType::BUTTONDIALOG: return "buttondialog";
3384  case WindowType::SYSTEMCHILDWINDOW: return "systemchildwindow";
3385  case WindowType::SLIDER: return "slider";
3386  case WindowType::MENUBARWINDOW: return "menubarwindow";
3387  case WindowType::TREELISTBOX: return "treelistbox";
3388  case WindowType::HELPTEXTWINDOW: return "helptextwindow";
3389  case WindowType::INTROWINDOW: return "introwindow";
3390  case WindowType::LISTBOXWINDOW: return "listboxwindow";
3391  case WindowType::DOCKINGAREA: return "dockingarea";
3392  case WindowType::RULER: return "ruler";
3393  case WindowType::CALCINPUTLINE: return "calcinputline";
3394  case WindowType::HEADERBAR: return "headerbar";
3395  case WindowType::VERTICALTABCONTROL: return "verticaltabcontrol";
3396 
3397  // nothing to do here, but for completeness
3398  case WindowType::TOOLKIT_FRAMEWINDOW: return "toolkit_framewindow";
3399  case WindowType::TOOLKIT_SYSTEMCHILDWINDOW: return "toolkit_systemchildwindow";
3400  }
3401 
3402  return "none";
3403 }
3404 
3405 }
3406 
3407 boost::property_tree::ptree Window::DumpAsPropertyTree()
3408 {
3409  boost::property_tree::ptree aTree;
3410  aTree.put("id", get_id()); // TODO could be missing - sort out
3411  aTree.put("type", windowTypeName(GetType()));
3412  aTree.put("text", GetText());
3413  aTree.put("enabled", IsEnabled());
3414 
3415  boost::property_tree::ptree aChildren;
3416  if (vcl::Window* pChild = mpWindowImpl->mpFirstChild)
3417  {
3418  while (pChild)
3419  {
3420  if (pChild->IsVisible()) {
3421  boost::property_tree::ptree aSubTree = pChild->DumpAsPropertyTree();
3422  int nLeft = pChild->get_grid_left_attach();
3423  int nTop = pChild->get_grid_top_attach();
3424  if (nLeft != -1 && nTop != -1)
3425  {
3426  OUString sLeft = OUString::number(nLeft);
3427  OUString sTop = OUString::number(nTop);
3428  aSubTree.put("left", sLeft);
3429  aSubTree.put("top", sTop);
3430  }
3431  aChildren.push_back(std::make_pair("", aSubTree));
3432  }
3433  pChild = pChild->mpWindowImpl->mpNext;
3434  }
3435  aTree.add_child("children", aChildren);
3436  }
3437 
3438  mpWindowImpl->maDumpAsPropertyTreeHdl.Call(aTree);
3439 
3440  return aTree;
3441 }
3442 
3444 {
3445  // no deactivation if the newly activated window is my child
3446  if ( !pNew || !ImplIsChild( pNew ) )
3447  {
3448  VclPtr<vcl::Window> xWindow(this);
3450  if( xWindow->IsDisposed() )
3451  return;
3452 
3453  // #100759#, avoid walking the wrong frame's hierarchy
3454  // eg, undocked docking windows (ImplDockFloatWin)
3455  if ( ImplGetParent() && mpWindowImpl->mpFrameWindow == ImplGetParent()->mpWindowImpl->mpFrameWindow )
3457  }
3458 }
3459 
3461 {
3462  // no activation if the old active window is my child
3463  if ( !pOld || !ImplIsChild( pOld ) )
3464  {
3465  VclPtr<vcl::Window> xWindow(this);
3467  if( xWindow->IsDisposed() )
3468  return;
3469 
3470  if ( ImplGetParent() )
3472  else if( (mpWindowImpl->mnStyle & WB_INTROWIN) == 0 )
3473  {
3474  // top level frame reached: store hint for DefModalDialogParent
3476  }
3477  }
3478 }
3479 
3480 void Window::SetClipboard(Reference<XClipboard> const & xClipboard)
3481 {
3482  if (mpWindowImpl->mpFrameData)
3483  mpWindowImpl->mpFrameData->mxClipboard = xClipboard;
3484 }
3485 
3486 Reference< XClipboard > Window::GetClipboard()
3487 {
3488  if (!mpWindowImpl->mpFrameData)
3489  return static_cast<XClipboard*>(nullptr);
3490  if (!mpWindowImpl->mpFrameData->mxClipboard.is())
3491  mpWindowImpl->mpFrameData->mxClipboard = GetSystemClipboard();
3492  return mpWindowImpl->mpFrameData->mxClipboard;
3493 }
3494 
3495 Reference< XClipboard > Window::GetPrimarySelection()
3496 {
3497  if (!mpWindowImpl->mpFrameData)
3498  return static_cast<XClipboard*>(nullptr);
3499  if (!mpWindowImpl->mpFrameData->mxSelection.is())
3500  mpWindowImpl->mpFrameData->mxSelection = GetSystemPrimarySelection();
3501  return mpWindowImpl->mpFrameData->mxSelection;
3502 }
3503 
3505 {
3506  assert(mpOutDevData);
3507  mpOutDevData->mpRecordLayout = pLayout;
3508  mpOutDevData->maRecordRect = rRect;
3509  Paint(*this, rRect);
3510  mpOutDevData->mpRecordLayout = nullptr;
3511 }
3512 
3514  sal_uInt16 highlight,
3515  bool bChecked,
3516  bool bDrawBorder
3517  )
3518 {
3519  if( rRect.IsEmpty() )
3520  return;
3521 
3522  const StyleSettings& rStyles = GetSettings().GetStyleSettings();
3523 
3524  // colors used for item highlighting
3525  Color aSelectionBorderCol( rStyles.GetHighlightColor() );
3526  Color aSelectionFillCol( aSelectionBorderCol );
3527 
3528  bool bDark = rStyles.GetFaceColor().IsDark();
3529  bool bBright = ( rStyles.GetFaceColor() == COL_WHITE );
3530 
3531  int c1 = aSelectionBorderCol.GetLuminance();
3532  int c2 = GetBackgroundColor().GetLuminance();
3533 
3534  if( !bDark && !bBright && abs( c2-c1 ) < 75 )
3535  {
3536  // contrast too low
3537  sal_uInt16 h,s,b;
3538  aSelectionFillCol.RGBtoHSB( h, s, b );
3539  if( b > 50 ) b -= 40;
3540  else b += 40;
3541  aSelectionFillCol = Color::HSBtoRGB( h, s, b );
3542  aSelectionBorderCol = aSelectionFillCol;
3543  }
3544 
3545  tools::Rectangle aRect( rRect );
3546  Color oldFillCol = GetFillColor();
3547  Color oldLineCol = GetLineColor();
3548 
3549  if( bDrawBorder )
3550  SetLineColor( bDark ? COL_WHITE : ( bBright ? COL_BLACK : aSelectionBorderCol ) );
3551  else
3552  SetLineColor();
3553 
3554  sal_uInt16 nPercent = 0;
3555  if( !highlight )
3556  {
3557  if( bDark )
3558  aSelectionFillCol = COL_BLACK;
3559  else
3560  nPercent = 80; // just checked (light)
3561  }
3562  else
3563  {
3564  if( bChecked && highlight == 2 )
3565  {
3566  if( bDark )
3567  aSelectionFillCol = COL_LIGHTGRAY;
3568  else if ( bBright )
3569  {
3570  aSelectionFillCol = COL_BLACK;
3572  nPercent = 0;
3573  }
3574  else
3575  nPercent = 20; // selected, pressed or checked ( very dark )
3576  }
3577  else if( bChecked || highlight == 1 )
3578  {
3579  if( bDark )
3580  aSelectionFillCol = COL_GRAY;
3581  else if ( bBright )
3582  {
3583  aSelectionFillCol = COL_BLACK;
3585  nPercent = 0;
3586  }
3587  else
3588  nPercent = 35; // selected, pressed or checked ( very dark )
3589  }
3590  else
3591  {
3592  if( bDark )
3593  aSelectionFillCol = COL_LIGHTGRAY;
3594  else if ( bBright )
3595  {
3596  aSelectionFillCol = COL_BLACK;
3598  if( highlight == 3 )
3599  nPercent = 80;
3600  else
3601  nPercent = 0;
3602  }
3603  else
3604  nPercent = 70; // selected ( dark )
3605  }
3606  }
3607 
3608  SetFillColor( aSelectionFillCol );
3609 
3610  if( bDark )
3611  {
3612  DrawRect( aRect );
3613  }
3614  else
3615  {
3616  tools::Polygon aPoly( aRect );
3617  tools::PolyPolygon aPolyPoly( aPoly );
3618  DrawTransparent( aPolyPoly, nPercent );
3619  }
3620 
3621  SetFillColor( oldFillCol );
3622  SetLineColor( oldLineCol );
3623 }
3624 
3626 {
3627  // check for scrollbars
3628  VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
3629  while( pChild )
3630  {
3631  if( pChild->GetType() == WindowType::SCROLLBAR )
3632  return true;
3633  else
3634  pChild = pChild->mpWindowImpl->mpNext;
3635  }
3636  return false;
3637 }
3638 
3639 void Window::ImplMirrorFramePos( Point &pt ) const
3640 {
3641  pt.setX( mpWindowImpl->mpFrame->maGeometry.nWidth-1-pt.X() );
3642 }
3643 
3644 // frame based modal counter (dialogs are not modal to the whole application anymore)
3646 {
3647  return (mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrameData->mnModalMode != 0);
3648 }
3649 
3651 {
3652  vcl::Window* pFrameWindow = mpWindowImpl->mpFrameWindow;
3653  vcl::Window* pParent = pFrameWindow;
3654  while( pFrameWindow )
3655  {
3656  pFrameWindow->mpWindowImpl->mpFrameData->mnModalMode++;
3657  while( pParent && pParent->mpWindowImpl->mpFrameWindow == pFrameWindow )
3658  {
3659  pParent = pParent->GetParent();
3660  }
3661  pFrameWindow = pParent ? pParent->mpWindowImpl->mpFrameWindow.get() : nullptr;
3662  }
3663 }
3665 {
3666  vcl::Window* pFrameWindow = mpWindowImpl->mpFrameWindow;
3667  vcl::Window* pParent = pFrameWindow;
3668  while( pFrameWindow )
3669  {
3670  pFrameWindow->mpWindowImpl->mpFrameData->mnModalMode--;
3671  while( pParent && pParent->mpWindowImpl->mpFrameWindow == pFrameWindow )
3672  {
3673  pParent = pParent->GetParent();
3674  }
3675  pFrameWindow = pParent ? pParent->mpWindowImpl->mpFrameWindow.get() : nullptr;
3676  }
3677 }
3678 
3679 void Window::ImplIsInTaskPaneList( bool mbIsInTaskList )
3680 {
3681  mpWindowImpl->mbIsInTaskPaneList = mbIsInTaskList;
3682 }
3683 
3684 void Window::ImplNotifyIconifiedState( bool bIconified )
3685 {
3686  mpWindowImpl->mpFrameWindow->CallEventListeners( bIconified ? VclEventId::WindowMinimize : VclEventId::WindowNormalize );
3687  // #109206# notify client window as well to have toolkit topwindow listeners notified
3688  if( mpWindowImpl->mpFrameWindow->mpWindowImpl->mpClientWindow && mpWindowImpl->mpFrameWindow != mpWindowImpl->mpFrameWindow->mpWindowImpl->mpClientWindow )
3689  mpWindowImpl->mpFrameWindow->mpWindowImpl->mpClientWindow->CallEventListeners( bIconified ? VclEventId::WindowMinimize : VclEventId::WindowNormalize );
3690 }
3691 
3693 {
3694  bool bRet = false;
3696  while( pFrameWin )
3697  {
3698  if( pFrameWin != mpWindowImpl->mpFrameWindow )
3699  {
3700  bool bDecorated = false;
3701  VclPtr< vcl::Window > pChildFrame = pFrameWin->ImplGetWindow();
3702  // #i15285# unfortunately WB_MOVEABLE is the same as WB_TABSTOP which can
3703  // be removed for ToolBoxes to influence the keyboard accessibility
3704  // thus WB_MOVEABLE is no indicator for decoration anymore
3705  // but FloatingWindows carry this information in their TitleType...
3706  // TODO: avoid duplicate WinBits !!!
3707  if( pChildFrame && pChildFrame->ImplIsFloatingWindow() )
3708  bDecorated = static_cast<FloatingWindow*>(pChildFrame.get())->GetTitleType() != FloatWinTitleType::NONE;
3709  if( bDecorated || (pFrameWin->mpWindowImpl->mnStyle & (WB_MOVEABLE | WB_SIZEABLE) ) )
3710  if( pChildFrame && pChildFrame->IsVisible() && pChildFrame->IsActive() )
3711  {
3712  if( ImplIsChild( pChildFrame, true ) )
3713  {
3714  bRet = true;
3715  break;
3716  }
3717  }
3718  }
3719  pFrameWin = pFrameWin->mpWindowImpl->mpFrameData->mpNextFrame;
3720  }
3721  return bRet;
3722 }
3723 
3725 {
3726  return mpWindowImpl->mpFrame->GetInputLanguage();
3727 }
3728 
3729 void Window::EnableNativeWidget( bool bEnable )
3730 {
3731  static const char* pNoNWF = getenv( "SAL_NO_NWF" );
3732  if( pNoNWF && *pNoNWF )
3733  bEnable = false;
3734 
3735  if( bEnable != ImplGetWinData()->mbEnableNativeWidget )
3736  {
3737  ImplGetWinData()->mbEnableNativeWidget = bEnable;
3738 
3739  // send datachanged event to allow for internal changes required for NWF
3740  // like clipmode, transparency, etc.
3742  CompatDataChanged( aDCEvt );
3743 
3744  // sometimes the borderwindow is queried, so keep it in sync
3745  if( mpWindowImpl->mpBorderWindow )
3746  mpWindowImpl->mpBorderWindow->ImplGetWinData()->mbEnableNativeWidget = bEnable;
3747  }
3748 
3749  // push down, useful for compound controls
3750  VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
3751  while( pChild )
3752  {
3753  pChild->EnableNativeWidget( bEnable );
3754  pChild = pChild->mpWindowImpl->mpNext;
3755  }
3756 }
3757 
3759 {
3761 }
3762 
3763 Reference< css::rendering::XCanvas > Window::ImplGetCanvas( bool bSpriteCanvas ) const
3764 {
3765  // try to retrieve hard reference from weak member
3766  Reference< css::rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
3767 
3768  // canvas still valid? Then we're done.
3769  if( xCanvas.is() )
3770  return xCanvas;
3771 
3772  Sequence< Any > aArg(5);
3773 
3774  // Feed any with operating system's window handle
3775 
3776  // common: first any is VCL pointer to window (for VCL canvas)
3777  aArg[ 0 ] <<= reinterpret_cast<sal_Int64>(this);
3778  aArg[ 1 ] <<= css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight );
3779  aArg[ 2 ] <<= mpWindowImpl->mbAlwaysOnTop;
3780  aArg[ 3 ] <<= Reference< css::awt::XWindow >(
3781  const_cast<vcl::Window*>(this)->GetComponentInterface(),
3782  UNO_QUERY );
3783  aArg[ 4 ] = GetSystemGfxDataAny();
3784 
3786 
3787  // Create canvas instance with window handle
3788 
3789  static vcl::DeleteUnoReferenceOnDeinit<XMultiComponentFactory> xStaticCanvasFactory(
3790  css::rendering::CanvasFactory::create( xContext ) );
3791  Reference<XMultiComponentFactory> xCanvasFactory(xStaticCanvasFactory.get());
3792 
3793  if(xCanvasFactory.is())
3794  {
3795 #ifdef _WIN32
3796  // see #140456# - if we're running on a multiscreen setup,
3797  // request special, multi-screen safe sprite canvas
3798  // implementation (not DX5 canvas, as it cannot cope with
3799  // surfaces spanning multiple displays). Note: canvas
3800  // (without sprite) stays the same)
3801  const sal_uInt32 nDisplay = static_cast< WinSalFrame* >( mpWindowImpl->mpFrame )->mnDisplay;
3802  if( nDisplay >= Application::GetScreenCount() )
3803  {
3804  xCanvas.set( xCanvasFactory->createInstanceWithArgumentsAndContext(
3805  bSpriteCanvas ?
3806  OUString( "com.sun.star.rendering.SpriteCanvas.MultiScreen" ) :
3807  OUString( "com.sun.star.rendering.Canvas.MultiScreen" ),
3808  aArg,
3809  xContext ),
3810  UNO_QUERY );
3811 
3812  }
3813  else
3814 #endif
3815  {
3816  xCanvas.set( xCanvasFactory->createInstanceWithArgumentsAndContext(
3817  bSpriteCanvas ?
3818  OUString( "com.sun.star.rendering.SpriteCanvas" ) :
3819  OUString( "com.sun.star.rendering.Canvas" ),
3820  aArg,
3821  xContext ),
3822  UNO_QUERY );
3823 
3824  }
3825  mpWindowImpl->mxCanvas = xCanvas;
3826  }
3827 
3828  // no factory??? Empty reference, then.
3829  return xCanvas;
3830 }
3831 
3832 Reference< css::rendering::XCanvas > Window::GetCanvas() const
3833 {
3834  return ImplGetCanvas( false );
3835 }
3836 
3837 Reference< css::rendering::XSpriteCanvas > Window::GetSpriteCanvas() const
3838 {
3839  Reference< css::rendering::XSpriteCanvas > xSpriteCanvas(
3840  ImplGetCanvas( true ), UNO_QUERY );
3841  return xSpriteCanvas;
3842 }
3843 
3845 {
3846  return OUString();
3847 }
3848 
3850 {
3851  return Selection( 0, 0 );
3852 }
3853 
3855 {
3856  return meRasterOp != RasterOp::OverPaint;
3857 }
3858 
3860 {
3861 }
3862 
3864 {
3865 
3866  return mpWindowImpl->mpFrame ? mpWindowImpl->mpFrame->GetSystemData() : nullptr;
3867 }
3868 
3870 {
3871  return mpWindowImpl->mpFrameData->mpBuffer;
3872 }
3873 
3875 {
3876  if (bRequest)
3877  {
3878  mpWindowImpl->mpFrameData->mpBuffer = VclPtrInstance<VirtualDevice>();
3879  // Make sure that the buffer size matches the frame size.
3880  mpWindowImpl->mpFrameData->mpBuffer->SetOutputSizePixel(mpWindowImpl->mpFrameWindow->GetOutputSizePixel());
3881  }
3882  else
3883  mpWindowImpl->mpFrameData->mpBuffer.reset();
3884 }
3885 
3886 /*
3887  * The rationale here is that we moved destructors to
3888  * dispose and this altered a lot of code paths, that
3889  * are better left unchanged for now.
3890  */
3891 #define COMPAT_BODY(method,args) \
3892  if (!mpWindowImpl || mpWindowImpl->mbInDispose) \
3893  Window::method args; \
3894  else \
3895  method args;
3896 
3898 {
3899  COMPAT_BODY(GetFocus,())
3900 }
3901 
3903 {
3905 }
3906 
3908 {
3909  COMPAT_BODY(StateChanged,(nStateChange))
3910 }
3911 
3913 {
3914  COMPAT_BODY(DataChanged,(rDCEvt))
3915 }
3916 
3918 {
3919  if (!mpWindowImpl || mpWindowImpl->mbInDispose)
3920  return Window::PreNotify( rNEvt );
3921  else
3922  return PreNotify( rNEvt );
3923 }
3924 
3926 {
3927  if (!mpWindowImpl || mpWindowImpl->mbInDispose)
3928  return Window::EventNotify( rNEvt );
3929  else
3930  return EventNotify( rNEvt );
3931 }
3932 
3933 void Window::set_id(const OUString& rID)
3934 {
3935  mpWindowImpl->maID = rID;
3936 }
3937 
3938 const OUString& Window::get_id() const
3939 {
3940  return mpWindowImpl->maID;
3941 }
3942 
3944 {
3945  return WindowUIObject::create;
3946 }
3947 
3948 } /* namespace vcl */
3949 
3950 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual Point GetPosPixel() const
Definition: window.cxx:2857
ImplSVHelpData & ImplGetSVHelpData()
Definition: svdata.cxx:471
virtual void SetText(const OUString &rStr)
Definition: window.cxx:3081
bool mbDlgCtrlStart
Definition: window.h:317
bool mbNeedSysWindow
Definition: window.h:161
long Width() const
void EndExtTextInput()
Definition: window.cxx:2120
long mnFirstMouseX
Definition: window.h:147
OutDevType GetOutDevType() const
Definition: outdev.hxx:522
#define SAL_FRAME_POSSIZE_HEIGHT
Definition: salframe.hxx:106
long mnOutOffX
Output offset for device output in pixel (pseudo window offset within window system's frames) ...
Definition: outdev.hxx:342
sal_Int32 mnDPIScalePercentage
For HiDPI displays, we want to draw elements for a percentage larger.
Definition: outdev.hxx:349
long mnSrcWidth
Definition: salgtype.hxx:52
bool IsInputEnabled() const
Definition: window2.cxx:1127
WinBits const WB_APP
bool mbAlwaysOnTop
Definition: window.h:317
virtual void Move()
Definition: window.cxx:1847
virtual const Wallpaper & GetDisplayBackground() const
Definition: window.cxx:3122
WinBits const WB_NOSHADOW
MouseEventModifiers mnMouseMode
Definition: window.h:156
Similar to DeleteOnDeinit, the DeleteUnoReferenceOnDeinit template class makes sure that a static UNO...
Definition: lazydelete.hxx:95
SAL_DLLPRIVATE float approximate_char_width() const
Definition: text.cxx:903
VclPtr< OutputDevice > mpNextGraphics
Next output device in list.
Definition: outdev.hxx:318
vcl::Window * ImplGetWindow() const
if this is a proxy return the client, otherwise itself
Definition: window2.cxx:835
void SetCompositionCharRect(const tools::Rectangle *pRect, long nCompositionLength, bool bVertical=false)
Definition: window.cxx:2161
unsigned long nWidth
Definition: salgeom.hxx:31
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
VclPtr< vcl::Window > GetFocusedWindow() const
Definition: window.cxx:3046
const Wallpaper & GetBackground() const
Definition: outdev.hxx:637
SAL_DLLPRIVATE SalGraphics * ImplGetFrameGraphics() const
Definition: window.cxx:1289
sal_Int32 mnPadding
Definition: window.h:307
#define SAL_FRAME_POSSIZE_Y
Definition: salframe.hxx:104
vcl::LOKWindowId GetLOKWindowId() const
Definition: window.cxx:3299
void remove_mnemonic_label(FixedText *pLabel)
Definition: window2.cxx:1959
void SimulateKeyPress(sal_uInt16 nKeyCode) const
Definition: window.cxx:1814
bool mbSplitter
Definition: window.h:317
void SetFontSize(const Size &)
Definition: font/font.cxx:117
bool mbHexpand
Definition: window.h:317
SAL_DLLPRIVATE bool ImplUpdatePos()
Definition: window.cxx:1417
SAL_DLLPRIVATE void ImplCallResize()
Definition: event.cxx:516
static VclPtr< vcl::Window > FindLOKWindow(vcl::LOKWindowId nWindowId)
Find an existing Window based on the LOKWindowId.
Definition: window.cxx:3248
long GetHeight() const
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
virtual FactoryFunction GetUITestFactory() const
Definition: window.cxx:3943
VclPtr< vcl::Window > mpFocusWin
Definition: svdata.hxx:248
#define OOO_HELP_INDEX
Definition: help.hxx:53
SAL_DLLPRIVATE bool ImplIsFloatingWindow() const
Definition: window2.cxx:911
sal_Int32 mnGridWidth
Definition: window.h:311
bool HasActiveChildFrame() const
Definition: window.cxx:3692
SAL_DLLPRIVATE void ImplIsInTaskPaneList(bool mbIsInTaskList)
Definition: window.cxx:3679
const OUString & GetFamilyName() const
Definition: font/font.cxx:670
constexpr sal_uInt16 KEY_MOD1
Definition: keycodes.hxx:31
bool mbVexpand
Definition: window.h:317
long mnSrcHeight
Definition: salgtype.hxx:53
bool mbInHideFocus
Definition: window.h:317
static long GetBorderSize()
virtual bool UsePolyPolygonForComplexGradient() override
Definition: window.cxx:3854
bool mbMouseButtonUp
Definition: window.h:317
tools::Rectangle & Intersection(const tools::Rectangle &rRect)
DialogControlFlags mnDlgCtrlFlags
Definition: window.h:302
VclPackType mePackType
Definition: window.h:306
bool mbDefPos
Definition: window.h:317
vcl::Cursor * mpCursor
Definition: window.h:255
long mnY
Definition: window.h:272
long AdjustWidth(long n)
Point OutputToNormalizedScreenPixel(const Point &rPos) const
Definition: window.cxx:2904
#define LANGUAGE_ENGLISH_US
long GetTitleHeight() const
void AlwaysDisableInput(bool bAlways, bool bChild=true)
Override EnableInput, counterpart to AlwaysEnableInput.
Definition: window.cxx:2674
bool GetNativeControlRegion(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion) const
Query the native control's actual drawing region (including adornment)
SAL_DLLPRIVATE::std::vector< VclPtr< vcl::Window > > & ImplGetOwnerDrawList()
Definition: window2.cxx:818
KeyIndicatorState GetIndicatorState() const
Query the states of keyboard indicators - Caps Lock, Num Lock and Scroll Lock.
Definition: window.cxx:1809
void CompatLoseFocus()
Definition: window.cxx:3902
void SetComponentInterface(css::uno::Reference< css::awt::XWindowPeer > const &xIFace)
Definition: window.cxx:3202
long mnBeforeLastMouseY
Definition: window.h:146
virtual void CopyDeviceArea(SalTwoRect &aPosAry, bool bWindowInvalidate) override
Definition: window.cxx:1221
InvalidateFlags
Definition: window.hxx:213
virtual SalFrame * CreateChildFrame(SystemParentData *pParent, SalFrameStyleFlags nStyle)=0
long Height() const
long mnOutOffY
Output offset for device output in pixel (pseudo window offset within window system's frames) ...
Definition: outdev.hxx:344
WindowExtendedStyle
Definition: window.hxx:444
#define SAL_FRAME_POSSIZE_WIDTH
Definition: salframe.hxx:105
void DecModalCount()
Definition: window.cxx:3664
css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard()
Definition: window.cxx:3486
WinBits const WB_NODIALOGCONTROL
Definition: help.hxx:60
static Help * GetHelp()
Gets the application's help.
Definition: svapp.cxx:1346
static SAL_DLLPRIVATE void ImplInitAppFontData(vcl::Window const *pWindow)
Definition: window.cxx:1165
Point BottomLeft() const
sal_Int32 mnOptimalHeightCache
Definition: window.h:270
vcl::Window * GetAccessibleParentWindow() const
bool IsBackground() const
Definition: outdev.hxx:640
sal_uInt16 mnWaitCount
Definition: window.h:297
Resize runs before repaint, so we won't paint twice.
SAL_DLLPRIVATE void ImplInitResolutionSettings()
Definition: window.cxx:1347
long AdjustLeft(long nHorzMoveDelta)
ImplSVAppData maAppData
Definition: svdata.hxx:393
Wallpaper maDisplayBackground
Definition: toolbox.h:141
SAL_DLLPRIVATE void ImplUpdateSysObjPos()
Definition: window.cxx:1448
SAL_DLLPRIVATE bool ImplIsAccessibleCandidate() const
Point AbsoluteScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2928
unsigned long nLeftDecoration
Definition: salgeom.hxx:33
int mnEventListenersIteratingCount
Definition: window.h:243
bool mbInitChildRegion
Definition: window.h:317
void SetCallback(vcl::Window *pWindow, SALFRAMEPROC pProc)
Definition: salvtables.cxx:90
bool mbInBufferedPaint
PaintHelper is in the process of painting into this buffer.
Definition: window.h:177
void disposeAndClear()
Definition: vclptr.hxx:200
bool ImplWindowFrameProc(vcl::Window *_pWindow, SalEvent nEvent, const void *pEvent)
Definition: winproc.cxx:2358
bool mbVisible
Definition: window.h:317
bool mbNonHomogeneous
Definition: window.h:317
const StyleSettings & GetStyleSettings() const
sal_uInt8 GetLuminance() const
const Color & GetFaceColor() const
bool mbStartFocusState
Definition: window.h:163
bool mbClipSiblings
Definition: window.h:317
const OUString & GetHelpText() const
Definition: window.cxx:3145
bool IsMapModeEnabled() const
Definition: outdev.hxx:1676
void Flush() override
Definition: window.cxx:3013
ActivateModeFlags mnActivateMode
Definition: window.h:301
css::uno::Reference< I > get()
Definition: lazydelete.hxx:103
SAL_DLLPRIVATE css::uno::Reference< css::rendering::XCanvas > ImplGetCanvas(bool bSpriteCanvas) const
Definition: window.cxx:3763
SAL_DLLPRIVATE void ImplGrabFocus(GetFocusFlags nFlags)
Definition: mouse.cxx:195
ImplSVNWFData maNWFData
Definition: svdata.hxx:399
SAL_DLLPRIVATE void ImplCallMove()
Definition: event.cxx:540
const OUString & GetQuickHelpText() const
Definition: window2.cxx:1232
SAL_DLLPRIVATE vcl::Window * ImplGetBorderWindow() const
Definition: window2.cxx:875
SAL_DLLPRIVATE void ImplCallInitShow()
Definition: event.cxx:491
sal_Int32 mnHeightRequest
Definition: window.h:268
std::unique_ptr< AllSettings > mpSettings
Definition: svdata.hxx:134
static sal_Int32 CountDPIScaleFactor(sal_Int32 nDPI)
Definition: window.cxx:911
SAL_DLLPRIVATE ImplToolBoxPrivateData * ImplGetToolBoxPrivateData() const
Definition: toolbox.hxx:250
const std::vector< VclPtr< FixedText > > & list_mnemonic_labels() const
Definition: window2.cxx:1969
std::unique_ptr< ImplAccessibleInfos > mpAccessibleInfos
Definition: window.h:285
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual Size GetSizePixel() const
Definition: window.cxx:2415
sal_Int32 mnTopBorder
Definition: window.h:264
bool CompatNotify(NotifyEvent &rNEvt)
Definition: window.cxx:3925
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
Definition: window.hxx:555
void CompatStateChanged(StateChangedType nStateChange)
Definition: window.cxx:3907
void CopyBits(const SalTwoRect &rPosAry, SalGraphics *pSrcGraphics, const OutputDevice *pOutDev, const OutputDevice *pSrcOutDev)
#define SAL_FRAME_POSSIZE_X
Definition: salframe.hxx:103
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier *pNotifier, bool bParent=false)
Interface to register for dialog / window tunneling.
Definition: window.cxx:3224
std::shared_ptr< PhysicalFontCollection > mxFontCollection
Definition: outdev.hxx:322
bool mbSuppressAccessibilityEvents
Definition: window.h:317
VclPtr< vcl::Window > mpNextFrame
Definition: window.h:131
unsigned long nRightDecoration
Definition: salgeom.hxx:33
bool mbReallyVisible
Definition: window.h:317
const Size & GetMaxOutputSizePixel() const
Definition: syswin.cxx:429
const MapMode & GetMapMode() const
Definition: outdev.hxx:1681
constexpr::Color COL_GRAY(0x80, 0x80, 0x80)
sal_Int32 mnDPIY
Definition: outdev.hxx:348
sal_uInt16 GetCode() const
Definition: keycod.hxx:53
SAL_DLLPRIVATE void ImplInsertWindow(vcl::Window *pParent)
Definition: stacking.cxx:58
virtual void Deactivate()
Definition: window.cxx:1853
long mnDestWidth
Definition: salgtype.hxx:56
SAL_DLLPRIVATE tools::Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel(const tools::Rectangle &rRect) const
Definition: window.cxx:2938
PosSizeFlags
Definition: window.hxx:141
void SetFakeFocus(bool bFocus)
Set this when you need to act as if the window has focus even if it doesn't.
Definition: window.cxx:3054
WindowType mnType
Definition: window.h:295
ImplWinData * mpWinData
Definition: window.h:223
tools::Rectangle GetDesktopRectPixel() const
Definition: window.cxx:2862
sal_Int32 mnDPIX
Definition: outdev.hxx:347
long mnSrcX
Definition: salgtype.hxx:50
sal_Int32 mnDPIY
Definition: window.h:140
ShowFlags
Definition: window.hxx:160
long mnCursorExtWidth
Definition: window.h:106
virtual void SetSettings(const AllSettings &rSettings)
Definition: outdev.cxx:213
bool mbCallHandlersDuringInputDisabled
Definition: window.h:317
bool mbHasFocus
Definition: window.h:157
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
SAL_DLLPRIVATE const LogicalFontInstance * GetFontInstance() const
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: window.cxx:141
tools::Rectangle GetBoundRect() const
Definition: region.cxx:1214
~ImplWinData()
Definition: window.cxx:757
void SetDumpAsPropertyTreeHdl(const Link< boost::property_tree::ptree &, void > &rLink)
Definition: window.cxx:1790
bool mbEnableRTL
Definition: outdev.hxx:394
long AdjustHeight(long n)
bool HasChildPathFocus(bool bSystemWindow=false) const
Definition: window.cxx:3059
#define EXTTEXTINPUT_CURSOR_OVERWRITE
void SetMapMode()
Definition: map.cxx:655
HelpEventMode GetMode() const
Definition: event.hxx:205
ImplSVGDIData maGDIData
Definition: svdata.hxx:394
bool IsTracking() const
Definition: window2.cxx:312
void Tracking(const TrackingEvent &rTEvt)
Definition: dockmgr.cxx:540
const Color & GetHighlightColor() const
void SetClipboard(css::uno::Reference< css::datatransfer::clipboard::XClipboard > const &xClipboard)
Sets a custom clipboard for the window's frame, instead of creating it on-demand using css::datatrans...
Definition: window.cxx:3480
Color GetBackgroundColor() const override
Definition: window.cxx:582
SAL_DLLPRIVATE void ImplInvalidateFrameRegion(const vcl::Region *pRegion, InvalidateFlags nFlags)
Definition: paint.cxx:682
bool mbMouseIn
Definition: window.h:159
std::shared_ptr< PhysicalFontCollection > mxFontCollection
Definition: window.h:137
bool mbMinimized
Definition: window.h:162
#define COMPAT_BODY(method, args)
Definition: window.cxx:3891
bool SelectClipRegion(const vcl::Region &, SalGraphics *pGraphics=nullptr)
SAL_DLLPRIVATE bool ImplIsOverlapWindow() const
Definition: window2.cxx:926
NONE
SAL_DLLPRIVATE ImplWinData * ImplGetWinData() const
Definition: window.cxx:1207
bool mbCommand
Definition: window.h:317
bool IsEmpty() const
bool mbSecondary
Definition: window.h:317
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
StateChangedType
Definition: window.hxx:311
#define SAL_FRAME_EXT_STYLE_DOCUMENT
Definition: salframe.hxx:99
unsigned long nBottomDecoration
Definition: salgeom.hxx:33
bool mbInSysObjFocusHdl
Definition: window.h:164
virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
Definition: window.cxx:2732
WinBits const WB_OWNERDRAWDECORATION
sal_Int64 WinBits
long mnDestY
Definition: salgtype.hxx:55
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
void SetBackground()
ScrollFlags
Definition: window.hxx:242
bool mbSettingsInit
Definition: svdata.hxx:154
const OUString & get_id() const
Get the ID of the window.
Definition: window.cxx:3938
virtual css::uno::Reference< css::awt::XWindowPeer > GetComponentInterface(bool bCreate=true)
Definition: window.cxx:3191
vcl::Region maWinClipRegion
Definition: window.h:288
WindowBorderStyle GetBorderStyle() const
Definition: window.cxx:2048
void Enable(bool bEnable=true, bool bChild=true)
Definition: window.cxx:2446
bool mbPaintTransparent
Definition: window.h:317
bool mbCompoundControl
Definition: window.h:317
SAL_DLLPRIVATE void ReMirror(Point &rPoint) const
Definition: outdev.cxx:613
bool mbInternalDragGestureRecognizer
Definition: window.h:175
VclPtr< vcl::Window > GetParentWithLOKNotifier()
Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set...
Definition: window.cxx:3304
VclPtr< vcl::Window > mpPrev
Definition: window.h:237
enumrange< T >::Iterator begin(enumrange< T >)
SAL_DLLPRIVATE void ImplInvalidate(const vcl::Region *rRegion, InvalidateFlags nFlags)
Definition: paint.cxx:773
void CompatGetFocus()
Definition: window.cxx:3897
VclPtr< OutputDevice > mpFirstWinGraphics
Definition: svdata.hxx:212
SAL_DLLPRIVATE void ImplInvalidateParentFrameRegion(vcl::Region &rRegion)
Definition: paint.cxx:762
const vcl::Font & GetFont() const
Definition: outdev.hxx:643
~WindowImpl()
Definition: window.cxx:740
bool mbFocusVisible
Definition: window.h:317
sal_Int32 mnMarginRight
Definition: window.h:314
VclPtr< vcl::Window > mpMouseMoveWin
Definition: window.h:134
tools::Rectangle GetClientWindowExtentsRelative() const
Definition: window.cxx:2961
css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetPrimarySelection()
Definition: window.cxx:3495
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
Definition: window2.cxx:272
virtual void Tracking(const TrackingEvent &rTEvt)
Definition: window.cxx:1946
static bool IsFuzzing()
SAL_DLLPRIVATE void ImplShowAllOverlaps()
Definition: stacking.cxx:390
void remove_from_all_size_groups()
Definition: window2.cxx:1937
virtual void EndExtTextInput(EndExtTextInputFlags nFlags)=0
SAL_DLLPRIVATE void ImplClipBoundaries(vcl::Region &rRegion, bool bThis, bool bOverlaps)
SAL_DLLPRIVATE void ImplPosSizeWindow(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags)
Definition: window.cxx:1461
void Hide()
Definition: window.hxx:936
sal_uInt16 mnMouseCode
Definition: window.h:155
AntialiasingFlags mnAntialiasing
Definition: outdev.hxx:373
SAL_DLLPRIVATE void ImplGrabFocusToDocument(GetFocusFlags nFlags)
Definition: mouse.cxx:393
SAL_DLLPRIVATE void ImplRemoveWindow(bool bRemoveFrameData)
Definition: stacking.cxx:112
VclPtr< vcl::Window > mpLastChild
Definition: window.h:234
VclEventId
Definition: vclevent.hxx:41
sal_Int32 mnWidthRequest
Definition: window.h:267
bool mbKeyInput
Definition: window.h:317
SAL_DLLPRIVATE void CollectChildren(::std::vector< vcl::Window * > &rAllChildren)
Add all children to rAllChildren recursively.
Definition: window.cxx:2175
::std::list< VclPtr< vcl::Window > > maTopWindowChildren
Definition: window.h:120
sal_uInt64 SalExtStyle
Definition: salframe.hxx:95
bool mbFloatWin
Definition: window.h:317
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1314
bool IsTopWindow() const
Definition: stacking.cxx:612
void SetBorderStyle(WindowBorderStyle nBorderStyle)
Definition: window.cxx:2008
bool mbInitWinClipRegion
Definition: window.h:317
sal_uInt16 GetModifier() const
Definition: keycod.hxx:56
virtual OUString GetText() const
Definition: window.cxx:3110
bool mbIsInTaskPaneList
Definition: window.h:317
WinBits const WB_SYSTEMFLOATWIN
Application * GetpApp()
Definition: svapp.cxx:149
bool mbFill
Definition: window.h:317
bool mbClipChildren
Definition: window.h:317
static Color HSBtoRGB(sal_uInt16 nHue, sal_uInt16 nSaturation, sal_uInt16 nBrightness)
void SetModalHierarchyHdl(const Link< bool, void > &rLink)
Definition: window.cxx:1798
virtual OUString GetDisplayText() const
Definition: window.cxx:3116
const tools::Rectangle * GetCursorRect() const
Definition: window.cxx:2147
if(nullptr==pCandidateA||nullptr==pCandidateB)
bool mbSysWin
Definition: window.h:317
void IncModalCount()
Definition: window.cxx:3650
virtual void CopyDeviceArea(SalTwoRect &aPosAry, bool bWindowInvalidate)
Definition: outdev.cxx:520
const Size & GetMinOutputSizePixel() const
Definition: syswin.hxx:153
virtual void DrawOutDevDirectProcess(const OutputDevice *pSrcDev, SalTwoRect &rPosAry, SalGraphics *pSrcGraphics) override
Definition: window.cxx:1284
bool mbAutoAccel
Definition: svdata.hxx:333
virtual Selection GetSurroundingTextSelection() const
Definition: window.cxx:3849
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:32
SAL_DLLPRIVATE void ImplFocusToTop(ToTopFlags nFlags, bool bReallyVisible)
Definition: stacking.cxx:363
std::unique_ptr< AllSettings > mxSettings
Definition: outdev.hxx:370
css::uno::Reference< css::lang::XComponent > xComponent
virtual void Draw(::OutputDevice *pDev, const Point &rPos, const Size &rSize, DrawFlags nFlags)
Definition: window.cxx:1843
WINDOW
const vcl::Font & GetFont() const
Definition: inputctx.hxx:55
bool mbReallyShown
Definition: window.h:317
void SetDebugName(const char *pDebugName)
Definition: task.hxx:81
const Point & GetMousePosPixel() const
Definition: event.hxx:204
bool mbDrawSelectionBackground
Definition: window.h:317
SalGraphics * mpGraphics
Graphics context to draw on.
Definition: outdev.hxx:316
#define SAL_FRAME_EXT_STYLE_DOCMODIFIED
Definition: salframe.hxx:100
WinBits const WB_INTROWIN
bool mbDisabled
Definition: window.h:317
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
Remove user event based on event ID.
Definition: svapp.cxx:1034
ParentClipMode mnParentClipMode
Definition: window.h:300
void EnableInput(bool bEnable=true, bool bChild=true)
Definition: window.cxx:2523
bool CompatPreNotify(NotifyEvent &rNEvt)
Definition: window.cxx:3917
void EnableNativeWidget(bool bEnable=true)
Definition: window.cxx:3729
const InputContext & GetInputContext() const
Definition: window2.cxx:1062
bool mbFrame
Definition: window.h:317
bool mbInDispose
Definition: window.h:317
WinBits const WB_DIALOGCONTROL
SAL_DLLPRIVATE void ImplPointToLogic(vcl::RenderContext const &rRenderContext, vcl::Font &rFont) const
Definition: window.cxx:1377
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:75
bool mbDefSize
Definition: window.h:317
bool IsEmpty() const
Definition: region.cxx:228
virtual boost::property_tree::ptree DumpAsPropertyTree()
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: window.cxx:3407
void SetLineColor()
const OString & GetHelpId() const
Definition: window2.cxx:828
virtual OUString GetHelpText(const OUString &aHelpURL, const vcl::Window *pWindow)
Definition: help.cxx:67
SAL_DLLPRIVATE tools::Rectangle ImplGetWindowExtentsRelative(vcl::Window *pRelativeWindow, bool bClientOnly) const
Definition: window.cxx:2967
VCLXWindow * mpVCLXWindow
Definition: window.h:286
virtual void SetInputContext(SalInputContext *pContext)=0
friend void ImplHandleResize(vcl::Window *pWindow, long nNewWidth, long nNewHeight)
Definition: winproc.cxx:1654
bool mbInSysObjToTopHdl
Definition: window.h:165
long mnX
Definition: window.h:271
AlwaysInputMode meAlwaysInputMode
Definition: window.h:303
virtual SalFrame * CreateFrame(SalFrame *pParent, SalFrameStyleFlags nStyle)=0
void SetActivateMode(ActivateModeFlags nMode)
Definition: window.cxx:2701
bool mbPaintDisabled
Definition: window.h:317
vcl::LOKWindowId mnLOKWindowId
ID of this specific window.
Definition: window.h:396
WindowExtendedStyle mnExtendedStyle
Definition: window.h:294
virtual bool PreNotify(NotifyEvent &rNEvt)
Definition: event.cxx:51
Window(WindowType nType)
Definition: window.cxx:85
long mnLastMouseWinX
Definition: window.h:149
virtual void GetResolution(sal_Int32 &rDPIX, sal_Int32 &rDPIY)=0
WinBits mnStyle
Definition: window.h:292
void SetInputContext(const InputContext &rInputContext)
Definition: window.cxx:2090
void SetWindowPeer(css::uno::Reference< css::awt::XWindowPeer > const &xPeer, VCLXWindow *pVCLXWindow)
Definition: window.cxx:3179
bool mbNativeFocusVisible
Definition: window.h:317
const vcl::ILibreOfficeKitNotifier * mpLOKNotifier
To emit the LOK callbacks eg. for dialog tunneling.
Definition: window.h:395
VclPtr< vcl::Window > mpLastFocusWindow
Definition: window.h:240
virtual bool EventNotify(NotifyEvent &rNEvt)
Definition: event.cxx:103
int i
virtual OUString GetSurroundingText() const
Definition: window.cxx:3844
virtual void SetExtendedFrameStyle(SalExtStyle nExtStyle)=0
bool mbChildPtrOverwrite
Definition: window.h:317
sal_Int32 mnOptimalWidthCache
Definition: window.h:269
DrawFlags
Definition: window.hxx:354
VclPtr< vcl::Window > mpIntroWindow
Definition: svdata.hxx:401
void SetCallHandlersOnInputDisabled(bool bCall)
usually event handlers (see AddEventListener and AddChildEventListener) are not called on disabled...
Definition: window.cxx:2506
bool IsSystemWindow() const
Definition: window2.cxx:997
bool IsDark() const
Color maControlForeground
Definition: window.h:261
virtual void dispose() override
Definition: outdev.cxx:141
void DrawSelectionBackground(const tools::Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder)
Definition: window.cxx:3513
bool IsNativeWidgetEnabled() const
Definition: window.cxx:3758
void SetCursorRect(const tools::Rectangle *pRect=nullptr, long nExtTextInputWidth=0)
Definition: window.cxx:2126
std::unique_ptr< tools::Rectangle[]> mpCompositionCharRects
Definition: window.h:109
ImplDockingWindowWrapper.
Definition: dockwin.hxx:71
VclAlign meValign
Definition: window.h:305
css::uno::Reference< css::rendering::XSpriteCanvas > GetSpriteCanvas() const
request XSpriteCanvas render interface for this window
Definition: window.cxx:3837
virtual bool AcquireGraphics() const =0
Acquire a graphics device that the output device uses to draw on.
VclPtr< vcl::Window > mpLastWheelWindow
Definition: svdata.hxx:258
long mnBeforeLastMouseX
Definition: window.h:145
void SetParent(vcl::Window *pNewParent)
Definition: stacking.cxx:842
bool mbInShowFocus
Definition: window.h:317
virtual void ApplySettings(vcl::RenderContext &rRenderContext)
Definition: window.cxx:3859
void DrawTransparent(const tools::PolyPolygon &rPolyPoly, sal_uInt16 nTransparencePercent)
bool mbInInitShow
Definition: window.h:317
const Color & GetColor() const
Definition: wall.cxx:204
KeyIndicatorState
Definition: keycodes.hxx:180
SAL_DLLPRIVATE bool ImplIsAntiparallel() const
Definition: outdev.cxx:597
sal_Int32 mnMarginTop
Definition: window.h:315
void SetUpdateMode(bool bUpdate)
Definition: window.cxx:3022
sal_Int32 mnTouchPanPosition
Definition: window.h:167
ShowTrackFlags
Definition: window.hxx:269
bool mbNoParentUpdate
Definition: window.h:317
long mnLastMouseX
Definition: window.h:143
virtual bool HasMirroredGraphics() const
Definition: outdev.cxx:645
bool mbInitLineColor
Definition: outdev.hxx:384
bool mbInMouseMove
Definition: window.h:158
virtual bool Start(const OUString &rHelpId, const vcl::Window *pWindow)
Definition: help.cxx:53
void SetFillColor()
virtual void DrawOutDevDirectCheck(const OutputDevice *pSrcDev, SalGraphics *&pSrcGraphics) override
Definition: window.cxx:1247
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
const Color & GetLineColor() const
Definition: outdev.hxx:624
SAL_DLLPRIVATE void ImplGenerateMouseMove()
Definition: mouse.cxx:157
ActivateModeFlags
Definition: window.hxx:187
vcl::Region maWinRegion
Definition: window.h:287
VclPtr< vcl::Window > mpFirstOverlap
Definition: window.h:132
bool IsDialog() const
Definition: window2.cxx:1002
void SetTextColor(const Color &rColor)
Definition: text.cxx:664
bool HasPaintEvent() const
Definition: paint.cxx:1257
static bool GetLayoutRTL()
rtl::Reference< LogicalFontInstance > mpFont
Definition: salwtype.hxx:243
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:511
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:3645
VclPtr< vcl::Window > mpLastOverlap
Definition: window.h:236
bool mbOverlapVisible
Definition: window.h:317
virtual void Resize()
Definition: window.cxx:1849
SAL_DLLPRIVATE vcl::Window * ImplGetParent() const
Definition: window2.cxx:865
Point NormalizedScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2911
SAL_DLLPRIVATE void ImplShow()
Definition: cursor.cxx:289
virtual void DestroyFrame(SalFrame *pFrame)=0
const Size & GetFontSize() const
Definition: font/font.cxx:673
InputContextFlags mnOptions
Definition: salwtype.hxx:244
void GrabFocusToDocument()
Definition: window.cxx:3041
void Intersect(const tools::Rectangle &rRegion)
Definition: region.cxx:584
vcl::Font maFont
Definition: outdev.hxx:364
bool mbHelpTextDynamic
Definition: window.h:317
SAL_DLLPRIVATE bool ImplIsRealParentPath(const vcl::Window *pWindow) const
Definition: stacking.cxx:680
WinBits const WB_TOOLTIPWIN
All repaint events should go in here.
bool mbWinRegion
Definition: window.h:317
void SetHelpHdl(const Link< vcl::Window &, bool > &rLink)
Definition: window.cxx:1875
SalObject * mpSysObj
Definition: window.h:226
bool IsMouseCaptured() const
Definition: mouse.cxx:470
PointerStyle maPointer
Definition: window.h:256
bool mbDockWin
Definition: window.h:317
bool mbSysObjFocus
Definition: window.h:166
RasterOp meRasterOp
Definition: outdev.hxx:368
void SetModalHierarchyHdl(const Link< bool, void > &rLink)
Definition: salframe.hxx:299
const AllSettings & GetSettings() const
Definition: outdev.hxx:420
Size GetOutputSizePixel() const
Definition: outdev.hxx:441
VclPtr< vcl::Window > mpDlgCtrlDownWindow
Definition: window.h:241
SAL_DLLPRIVATE long ImplGetUnmirroredOutOffX()
Definition: window.cxx:2881
bool mbInitTextColor
Definition: outdev.hxx:387
static unsigned int GetScreenCount()
Get the number of screens available for the display.
Definition: svapp.cxx:1204
css::uno::Any GetSystemGfxDataAny() const
Definition: outdev.cxx:269
VclPtr< vcl::Window > mpOverlapWindow
Definition: window.h:228
Reference< XClipboard > GetSystemClipboard()
Definition: transfer2.cxx:465
VclAlign meHalign
Definition: window.h:304
VclPtr< vcl::Window > mpClientWindow
Definition: window.h:230
VclPtr< vcl::Window > mpLastDeacWin
Definition: svdata.hxx:250
SAL_DLLPRIVATE void ImplSetReallyVisible()
Definition: window.cxx:1307
sal_uInt16 mnModalMode
Definition: window.h:151
void RequestDoubleBuffering(bool bRequest)
Enable/disable double-buffering of the frame window and all its children.
Definition: window.cxx:3874
virtual void LoseFocus()
Definition: window.cxx:1869
constexpr sal_uInt16 KEY_MOD2
Definition: keycodes.hxx:32
sal_uInt16 mnClickCount
Definition: window.h:153
Point ScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2875
bool mbInPaint
Definition: window.h:317
ControlPart mnNativeBackground
Definition: window.h:296
void GrabFocus()
Definition: window.cxx:3031
long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:890
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
Definition: help.cxx:180
vcl::Window * GetParent() const
Definition: window2.cxx:1097
VclPtr< vcl::Window > mpTrackWin
Definition: svdata.hxx:254
long mnAppFontX
Definition: svdata.hxx:227
SAL_DLLPRIVATE void ImplLogicToPoint(vcl::RenderContext const &rRenderContext, vcl::Font &rFont) const
Definition: window.cxx:1397
InputContextFlags GetOptions() const
Definition: inputctx.hxx:58
SAL_DLLPRIVATE void ImplCalcOverlapRegion(const tools::Rectangle &rSourceRect, vcl::Region &rRegion, bool bChildren, bool bSiblings)
unsigned long nTopDecoration
Definition: salgeom.hxx:33
VclPtr< vcl::Window > mpBorderWindow
Definition: window.h:229
VclPtr< vcl::Window > mpFirstOverlap
Definition: window.h:235
void SetParentToDefaultWindow()
Definition: window.cxx:1803
bool mbInFocusHdl
Definition: window.h:317
std::optional< tools::Rectangle > mpCursorRect
Definition: window.h:105
void SetStyle(WinBits nStyle)
Definition: window.cxx:1976
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
Definition: window.cxx:2918
bool mbVertical
Definition: window.h:107
enumrange< T >::Iterator end(enumrange< T >)
bool IsCompoundControl() const
Definition: window2.cxx:1193
css::uno::Reference< css::rendering::XCanvas > GetCanvas() const
request XCanvas render interface for this window
Definition: window.cxx:3832
ImplFrameData(vcl::Window *pWindow)
Definition: window.cxx:762
sal_Int32 mnDPIX
Definition: window.h:139
WindowImpl(const WindowImpl &)=delete
long GetCursorExtTextInputWidth() const
Definition: window.cxx:2154
SalFrame * mpFrame
Definition: window.h:225
sal_Int32 mnLeftBorder
Definition: window.h:263
SAL_DLLPRIVATE void ImplCallDeactivateListeners(vcl::Window *)
Definition: window.cxx:3443
virtual const SystemEnvData * GetSystemData() const
Definition: window.cxx:3863
WinBits const WB_SYSTEMCHILDWINDOW
void SetPointFont(vcl::RenderContext &rRenderContext, const vcl::Font &rFont)
Definition: window.cxx:2187
sal_uInt32 LOKWindowId
bool mbExpand
Definition: window.h:317
long mnSrcY
Definition: salgtype.hxx:51
bool mbControlBackground
Definition: window.h:317
VclPtr< vcl::Window > mpNext
Definition: window.h:238
Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1179
Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:934
void ReleaseMouse()
Definition: mouse.cxx:459
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1819
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:932
WinBits const WB_3DLOOK
bool mbToolBox
Definition: window.h:317
static bool IsLOKWindowsEmpty()
check if LOK Window container is empty
Definition: window.cxx:3257
bool mbUseNativeFocus
Definition: window.h:317
SAL_DLLPRIVATE void ImplDlgCtrlNextWindow()
Definition: dlgctrl.cxx:1001
virtual void SetXORMode(bool bSet, bool bInvertOnly)=0
WinBits const WB_SIZEABLE
bool mbDoubleBufferingRequested
Definition: window.h:317
SAL_DLLPRIVATE vcl::Window * ImplGetFirstOverlapWindow()
Definition: window2.cxx:880
bool mbMouseButtonDown
Definition: window.h:317
VclPtr< OutputDevice > mpPrevGraphics
Previous output device in list.
Definition: outdev.hxx:317
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Definition: window.cxx:2437
SAL_DLLPRIVATE void ImplUpdateSysObjClip()
void set_id(const OUString &rID)
Sets an ID.
Definition: window.cxx:3933
Idle maResizeIdle
Definition: window.h:129
long CalcTitleWidth() const
Definition: window.cxx:2062
bool mbWaitSystemResize
Definition: window.h:317
bool mbNoUpdate
Definition: window.h:317
A construction helper for a temporary VclPtr.
Definition: vclptr.hxx:275
bool mbExtTextInput
Definition: window.h:317
SalFrame * ImplGetFrame() const
Definition: window2.cxx:848
SAL_DLLPRIVATE void ImplHideAllOverlaps()
Definition: stacking.cxx:405
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:112
sal_Int32 mnGridLeftAttach
Definition: window.h:309
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:54
virtual void Scroll(long nHorzScroll, long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
Definition: window.cxx:2995
SAL_DLLPRIVATE bool ImplIsInTaskPaneList(vcl::Window *pWin)
Definition: syswin.cxx:1009
void Exclude(const tools::Rectangle &rRegion)
Definition: region.cxx:675
vcl::Window * GetAccessibleRelationLabelFor() const
void CopyArea(long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, const OutputDevice *pOutDev)
bool IsGradient() const
Definition: wall.cxx:283
SAL_DLLPRIVATE vcl::Region ImplPixelToDevicePixel(const vcl::Region &rRegion) const
Convert a region in pixel units to a region in device pixel units and coords.
Definition: map.cxx:637
bool mbCallMove
Definition: window.h:317
bool mbBorderWin
Definition: window.h:317
VclPtr< vcl::Window > mpExtTextInputWin
Definition: svdata.hxx:253
virtual void ReleaseGraphics(bool bRelease=true)=0
Release the graphics device, and remove it from the graphics device list.
void AlwaysEnableInput(bool bAlways, bool bChild=true)
Override EnableInput.
Definition: window.cxx:2647
std::shared_ptr< ImplFontCache > mxFontCache
Definition: window.h:138
static void Abort(const OUString &rErrorText)
Ends the program prematurely with an error message.
Definition: svapp.cxx:262
DockingManager * ImplGetDockingManager()
Definition: svdata.cxx:307
int mnChildEventListenersIteratingCount
Definition: window.h:246
WindowType
SAL_DLLPRIVATE void ImplStartToTop(ToTopFlags nFlags)
Definition: stacking.cxx:314
VclPtr< vcl::Window > mpMouseDownWin
Definition: window.h:135
SAL_DLLPRIVATE bool ImplIsAccessibleNativeFrame() const
static bool IsHeadlessModeEnabled()
Determines if headless mode is enabled.
Definition: svapp.cxx:1527
const vcl::Font & GetTitleFont() const
virtual void GetFocus()
Definition: window.cxx:1855
const Color & GetButtonTextColor() const
bool mbNoFocusRects
Definition: svdata.hxx:321
#define SAL_WARN_IF(condition, area, stream)
SAL_DLLPRIVATE void ImplMirrorFramePos(Point &pt) const
Definition: window.cxx:3639
bool mbActive
Definition: window.h:317
WinBits const WB_BORDER
bool mbEnableNativeWidget
Definition: window.h:118
SAL_DLLPRIVATE void ImplExcludeWindowRegion(vcl::Region &rRegion)
void RecordLayoutData(vcl::ControlLayoutData *pLayout, const tools::Rectangle &rRect)
Definition: window.cxx:3504
bool mbMouseTransparent
Definition: window.h:317
bool mbLOKParentNotifier
Definition: window.h:397
void SetCursor(vcl::Cursor *pCursor)
Definition: window.cxx:3068
long mnDestX
Definition: