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