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