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