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