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