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 aSize = rRenderContext.PixelToLogic(aSize);
1392
1393 rFont.SetFontSize(aSize);
1394}
1395
1396void Window::ImplLogicToPoint(vcl::RenderContext const & rRenderContext, vcl::Font& rFont) const
1397{
1398 Size aSize = rFont.GetFontSize();
1399 aSize = rRenderContext.LogicToPixel(aSize);
1400
1401 if (aSize.Width())
1402 {
1403 aSize.setWidth( aSize.Width() * 72 );
1404 aSize.AdjustWidth(mpWindowImpl->mpFrameData->mnDPIX / 2 );
1405 aSize.setWidth( aSize.Width() / ( mpWindowImpl->mpFrameData->mnDPIX) );
1406 }
1407 aSize.setHeight( aSize.Height() * 72 );
1408 aSize.AdjustHeight(mpWindowImpl->mpFrameData->mnDPIY / 2 );
1409 aSize.setHeight( aSize.Height() / ( mpWindowImpl->mpFrameData->mnDPIY) );
1410
1411 rFont.SetFontSize(aSize);
1412}
1413
1415{
1416 bool bSysChild = false;
1417
1418 if ( ImplIsOverlapWindow() )
1419 {
1422 }
1423 else
1424 {
1425 vcl::Window* pParent = ImplGetParent();
1426
1427 GetOutDev()->mnOutOffX = mpWindowImpl->mnX + pParent->GetOutDev()->mnOutOffX;
1428 GetOutDev()->mnOutOffY = mpWindowImpl->mnY + pParent->GetOutDev()->mnOutOffY;
1429 }
1430
1431 VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
1432 while ( pChild )
1433 {
1434 if ( pChild->ImplUpdatePos() )
1435 bSysChild = true;
1436 pChild = pChild->mpWindowImpl->mpNext;
1437 }
1438
1439 if ( mpWindowImpl->mpSysObj )
1440 bSysChild = true;
1441
1442 return bSysChild;
1443}
1444
1446{
1447 if ( mpWindowImpl->mpSysObj )
1448 mpWindowImpl->mpSysObj->SetPosSize( GetOutDev()->mnOutOffX, GetOutDev()->mnOutOffY, GetOutDev()->mnOutWidth, GetOutDev()->mnOutHeight );
1449
1450 VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
1451 while ( pChild )
1452 {
1453 pChild->ImplUpdateSysObjPos();
1454 pChild = pChild->mpWindowImpl->mpNext;
1455 }
1456}
1457
1459 tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags )
1460{
1461 bool bNewPos = false;
1462 bool bNewSize = false;
1463 bool bCopyBits = false;
1464 tools::Long nOldOutOffX = GetOutDev()->mnOutOffX;
1465 tools::Long nOldOutOffY = GetOutDev()->mnOutOffY;
1466 tools::Long nOldOutWidth = GetOutDev()->mnOutWidth;
1467 tools::Long nOldOutHeight = GetOutDev()->mnOutHeight;
1468 std::unique_ptr<vcl::Region> pOverlapRegion;
1469 std::unique_ptr<vcl::Region> pOldRegion;
1470
1471 if ( IsReallyVisible() )
1472 {
1473 tools::Rectangle aOldWinRect( Point( nOldOutOffX, nOldOutOffY ),
1474 Size( nOldOutWidth, nOldOutHeight ) );
1475 pOldRegion.reset( new vcl::Region( aOldWinRect ) );
1476 if ( mpWindowImpl->mbWinRegion )
1477 pOldRegion->Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
1478
1479 if ( GetOutDev()->mnOutWidth && GetOutDev()->mnOutHeight && !mpWindowImpl->mbPaintTransparent &&
1480 !mpWindowImpl->mbInitWinClipRegion && !mpWindowImpl->maWinClipRegion.IsEmpty() &&
1481 !HasPaintEvent() )
1482 bCopyBits = true;
1483 }
1484
1485 bool bnXRecycled = false; // avoid duplicate mirroring in RTL case
1486 if ( nFlags & PosSizeFlags::Width )
1487 {
1488 if(!( nFlags & PosSizeFlags::X ))
1489 {
1490 nX = mpWindowImpl->mnX;
1491 nFlags |= PosSizeFlags::X;
1492 bnXRecycled = true; // we're using a mnX which was already mirrored in RTL case
1493 }
1494
1495 if ( nWidth < 0 )
1496 nWidth = 0;
1497 if ( nWidth != GetOutDev()->mnOutWidth )
1498 {
1499 GetOutDev()->mnOutWidth = nWidth;
1500 bNewSize = true;
1501 bCopyBits = false;
1502 }
1503 }
1504 if ( nFlags & PosSizeFlags::Height )
1505 {
1506 if ( nHeight < 0 )
1507 nHeight = 0;
1508 if ( nHeight != GetOutDev()->mnOutHeight )
1509 {
1510 GetOutDev()->mnOutHeight = nHeight;
1511 bNewSize = true;
1512 bCopyBits = false;
1513 }
1514 }
1515
1516 if ( nFlags & PosSizeFlags::X )
1517 {
1518 tools::Long nOrgX = nX;
1519 Point aPtDev( nX+GetOutDev()->mnOutOffX, 0 );
1520 OutputDevice *pOutDev = GetOutDev();
1521 if( pOutDev->HasMirroredGraphics() )
1522 {
1523 aPtDev.setX( GetOutDev()->mpGraphics->mirror2( aPtDev.X(), *GetOutDev() ) );
1524
1525 // #106948# always mirror our pos if our parent is not mirroring, even
1526 // if we are also not mirroring
1527 // RTL: check if parent is in different coordinates
1528 if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->GetOutDev()->ImplIsAntiparallel() )
1529 {
1530 nX = mpWindowImpl->mpParent->GetOutDev()->mnOutWidth - GetOutDev()->mnOutWidth - nX;
1531 }
1532 /* #i99166# An LTR window in RTL UI that gets sized only would be
1533 expected to not moved its upper left point
1534 */
1535 if( bnXRecycled )
1536 {
1537 if( GetOutDev()->ImplIsAntiparallel() )
1538 {
1539 aPtDev.setX( mpWindowImpl->mnAbsScreenX );
1540 nOrgX = mpWindowImpl->maPos.X();
1541 }
1542 }
1543 }
1544 else if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->GetOutDev()->ImplIsAntiparallel() )
1545 {
1546 // mirrored window in LTR UI
1547 nX = mpWindowImpl->mpParent->GetOutDev()->mnOutWidth - GetOutDev()->mnOutWidth - nX;
1548 }
1549
1550 // check maPos as well, as it could have been changed for client windows (ImplCallMove())
1551 if ( mpWindowImpl->mnAbsScreenX != aPtDev.X() || nX != mpWindowImpl->mnX || nOrgX != mpWindowImpl->maPos.X() )
1552 {
1553 if ( bCopyBits && !pOverlapRegion )
1554 {
1555 pOverlapRegion.reset( new vcl::Region() );
1557 *pOverlapRegion, false, true );
1558 }
1559 mpWindowImpl->mnX = nX;
1560 mpWindowImpl->maPos.setX( nOrgX );
1561 mpWindowImpl->mnAbsScreenX = aPtDev.X();
1562 bNewPos = true;
1563 }
1564 }
1565 if ( nFlags & PosSizeFlags::Y )
1566 {
1567 // check maPos as well, as it could have been changed for client windows (ImplCallMove())
1568 if ( nY != mpWindowImpl->mnY || nY != mpWindowImpl->maPos.Y() )
1569 {
1570 if ( bCopyBits && !pOverlapRegion )
1571 {
1572 pOverlapRegion.reset( new vcl::Region() );
1574 *pOverlapRegion, false, true );
1575 }
1576 mpWindowImpl->mnY = nY;
1577 mpWindowImpl->maPos.setY( nY );
1578 bNewPos = true;
1579 }
1580 }
1581
1582 if ( !(bNewPos || bNewSize) )
1583 return;
1584
1585 bool bUpdateSysObjPos = false;
1586 if ( bNewPos )
1587 bUpdateSysObjPos = ImplUpdatePos();
1588
1589 // the borderwindow always specifies the position for its client window
1590 if ( mpWindowImpl->mpBorderWindow )
1591 mpWindowImpl->maPos = mpWindowImpl->mpBorderWindow->mpWindowImpl->maPos;
1592
1593 if ( mpWindowImpl->mpClientWindow )
1594 {
1595 mpWindowImpl->mpClientWindow->ImplPosSizeWindow( mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder,
1596 mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder,
1597 GetOutDev()->mnOutWidth - mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnRightBorder,
1598 GetOutDev()->mnOutHeight - mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnBottomBorder,
1601 // If we have a client window, then this is the position
1602 // of the Application's floating windows
1603 mpWindowImpl->mpClientWindow->mpWindowImpl->maPos = mpWindowImpl->maPos;
1604 if ( bNewPos )
1605 {
1606 if ( mpWindowImpl->mpClientWindow->IsVisible() )
1607 {
1608 mpWindowImpl->mpClientWindow->ImplCallMove();
1609 }
1610 else
1611 {
1612 mpWindowImpl->mpClientWindow->mpWindowImpl->mbCallMove = true;
1613 }
1614 }
1615 }
1616
1617 // Move()/Resize() will be called only for Show(), such that
1618 // at least one is called before Show()
1619 if ( IsVisible() )
1620 {
1621 if ( bNewPos )
1622 {
1623 ImplCallMove();
1624 }
1625 if ( bNewSize )
1626 {
1628 }
1629 }
1630 else
1631 {
1632 if ( bNewPos )
1633 mpWindowImpl->mbCallMove = true;
1634 if ( bNewSize )
1635 mpWindowImpl->mbCallResize = true;
1636 }
1637
1638 bool bUpdateSysObjClip = false;
1639 if ( IsReallyVisible() )
1640 {
1641 if ( bNewPos || bNewSize )
1642 {
1643 // set Clip-Flag
1644 bUpdateSysObjClip = !ImplSetClipFlag( true );
1645 }
1646
1647 // invalidate window content ?
1648 if ( bNewPos || (GetOutDev()->mnOutWidth > nOldOutWidth) || (GetOutDev()->mnOutHeight > nOldOutHeight) )
1649 {
1650 if ( bNewPos )
1651 {
1652 bool bInvalidate = false;
1653 bool bParentPaint = true;
1654 if ( !ImplIsOverlapWindow() )
1655 bParentPaint = mpWindowImpl->mpParent->IsPaintEnabled();
1656 if ( bCopyBits && bParentPaint && !HasPaintEvent() )
1657 {
1658 vcl::Region aRegion( GetOutputRectPixel() );
1659 if ( mpWindowImpl->mbWinRegion )
1660 aRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
1661 ImplClipBoundaries( aRegion, false, true );
1662 if ( !pOverlapRegion->IsEmpty() )
1663 {
1664 pOverlapRegion->Move( GetOutDev()->mnOutOffX - nOldOutOffX, GetOutDev()->mnOutOffY - nOldOutOffY );
1665 aRegion.Exclude( *pOverlapRegion );
1666 }
1667 if ( !aRegion.IsEmpty() )
1668 {
1669 // adapt Paint areas
1670 ImplMoveAllInvalidateRegions( tools::Rectangle( Point( nOldOutOffX, nOldOutOffY ),
1671 Size( nOldOutWidth, nOldOutHeight ) ),
1672 GetOutDev()->mnOutOffX - nOldOutOffX, GetOutDev()->mnOutOffY - nOldOutOffY,
1673 true );
1674 SalGraphics* pGraphics = ImplGetFrameGraphics();
1675 if ( pGraphics )
1676 {
1677
1678 OutputDevice *pOutDev = GetOutDev();
1679 const bool bSelectClipRegion = pOutDev->SelectClipRegion( aRegion, pGraphics );
1680 if ( bSelectClipRegion )
1681 {
1682 pGraphics->CopyArea( GetOutDev()->mnOutOffX, GetOutDev()->mnOutOffY,
1683 nOldOutOffX, nOldOutOffY,
1684 nOldOutWidth, nOldOutHeight,
1685 *GetOutDev() );
1686 }
1687 else
1688 bInvalidate = true;
1689 }
1690 else
1691 bInvalidate = true;
1692 if ( !bInvalidate )
1693 {
1694 if ( !pOverlapRegion->IsEmpty() )
1696 }
1697 }
1698 else
1699 bInvalidate = true;
1700 }
1701 else
1702 bInvalidate = true;
1703 if ( bInvalidate )
1705 }
1706 else
1707 {
1708 vcl::Region aRegion( GetOutputRectPixel() );
1709 aRegion.Exclude( *pOldRegion );
1710 if ( mpWindowImpl->mbWinRegion )
1711 aRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
1712 ImplClipBoundaries( aRegion, false, true );
1713 if ( !aRegion.IsEmpty() )
1715 }
1716 }
1717
1718 // invalidate Parent or Overlaps
1719 if ( bNewPos ||
1720 (GetOutDev()->mnOutWidth < nOldOutWidth) || (GetOutDev()->mnOutHeight < nOldOutHeight) )
1721 {
1722 vcl::Region aRegion( *pOldRegion );
1723 if ( !mpWindowImpl->mbPaintTransparent )
1724 ImplExcludeWindowRegion( aRegion );
1725 ImplClipBoundaries( aRegion, false, true );
1726 if ( !aRegion.IsEmpty() && !mpWindowImpl->mpBorderWindow )
1728 }
1729 }
1730
1731 // adapt system objects
1732 if ( bUpdateSysObjClip )
1734 if ( bUpdateSysObjPos )
1736 if ( bNewSize && mpWindowImpl->mpSysObj )
1737 mpWindowImpl->mpSysObj->SetPosSize( GetOutDev()->mnOutOffX, GetOutDev()->mnOutOffY, GetOutDev()->mnOutWidth, GetOutDev()->mnOutHeight );
1738}
1739
1741{
1742 ImplSVData* pSVData = ImplGetSVData();
1743 vcl::Window* pFocusWin = pSVData->mpWinData->mpFocusWin;
1744 if ( !pFocusWin || !pFocusWin->mpWindowImpl || pFocusWin->isDisposed() )
1745 return;
1746
1747 // Is InputContext changed?
1748 const InputContext& rInputContext = pFocusWin->GetInputContext();
1749 if ( rInputContext == pFocusWin->mpWindowImpl->mpFrameData->maOldInputContext )
1750 return;
1751
1752 pFocusWin->mpWindowImpl->mpFrameData->maOldInputContext = rInputContext;
1753
1754 SalInputContext aNewContext;
1755 const vcl::Font& rFont = rInputContext.GetFont();
1756 const OUString& rFontName = rFont.GetFamilyName();
1758 aNewContext.mpFont = nullptr;
1759 if (!rFontName.isEmpty())
1760 {
1761 OutputDevice *pFocusWinOutDev = pFocusWin->GetOutDev();
1762 Size aSize = pFocusWinOutDev->ImplLogicToDevicePixel( rFont.GetFontSize() );
1763 if ( !aSize.Height() )
1764 {
1765 // only set default sizes if the font height in logical
1766 // coordinates equals 0
1767 if ( rFont.GetFontSize().Height() )
1768 aSize.setHeight( 1 );
1769 else
1770 aSize.setHeight( (12*pFocusWin->GetOutDev()->mnDPIY)/72 );
1771 }
1772 pFontInstance = pFocusWin->GetOutDev()->mxFontCache->GetFontInstance(
1773 pFocusWin->GetOutDev()->mxFontCollection.get(),
1774 rFont, aSize, static_cast<float>(aSize.Height()) );
1775 if ( pFontInstance )
1776 aNewContext.mpFont = pFontInstance;
1777 }
1778 aNewContext.mnOptions = rInputContext.GetOptions();
1779 pFocusWin->ImplGetFrame()->SetInputContext( &aNewContext );
1780}
1781
1783{
1784 if (mpWindowImpl) // may be called after dispose
1785 {
1786 mpWindowImpl->maDumpAsPropertyTreeHdl = rLink;
1787 }
1788}
1789
1791{
1793}
1794
1796{
1797 return mpWindowImpl->mpFrame->GetIndicatorState();
1798}
1799
1800void Window::SimulateKeyPress( sal_uInt16 nKeyCode ) const
1801{
1802 mpWindowImpl->mpFrame->SimulateKeyPress(nKeyCode);
1803}
1804
1805void Window::KeyInput( const KeyEvent& rKEvt )
1806{
1807 KeyCode cod = rKEvt.GetKeyCode ();
1808 bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel;
1809
1810 // do not respond to accelerators unless Alt or Ctrl is held
1811 if (cod.GetCode () >= 0x200 && cod.GetCode () <= 0x219)
1812 {
1813 if (autoacc && cod.GetModifier () != KEY_MOD2 && !(cod.GetModifier() & KEY_MOD1))
1814 return;
1815 }
1816
1817 NotifyEvent aNEvt( NotifyEventType::KEYINPUT, this, &rKEvt );
1818 if ( !CompatNotify( aNEvt ) )
1819 mpWindowImpl->mbKeyInput = true;
1820}
1821
1822void Window::KeyUp( const KeyEvent& rKEvt )
1823{
1824 NotifyEvent aNEvt( NotifyEventType::KEYUP, this, &rKEvt );
1825 if ( !CompatNotify( aNEvt ) )
1826 mpWindowImpl->mbKeyUp = true;
1827}
1828
1830{
1831}
1832
1834
1836
1838
1840
1842{
1843 if ( HasFocus() && mpWindowImpl->mpLastFocusWindow && !(mpWindowImpl->mnDlgCtrlFlags & DialogControlFlags::WantFocus) )
1844 {
1845 VclPtr<vcl::Window> xWindow(this);
1846 mpWindowImpl->mpLastFocusWindow->GrabFocus();
1847 if( xWindow->isDisposed() )
1848 return;
1849 }
1850
1852 CompatNotify( aNEvt );
1853}
1854
1856{
1858 CompatNotify( aNEvt );
1859}
1860
1862{
1863 if (mpWindowImpl) // may be called after dispose
1864 {
1865 mpWindowImpl->maHelpRequestHdl = rLink;
1866 }
1867}
1868
1869void Window::RequestHelp( const HelpEvent& rHEvt )
1870{
1871 // if Balloon-Help is requested, show the balloon
1872 // with help text set
1873 if ( rHEvt.GetMode() & HelpEventMode::BALLOON )
1874 {
1875 OUString rStr = GetHelpText();
1876 if ( rStr.isEmpty() )
1877 rStr = GetQuickHelpText();
1878 if ( rStr.isEmpty() && ImplGetParent() && !ImplIsOverlapWindow() )
1879 ImplGetParent()->RequestHelp( rHEvt );
1880 else
1881 {
1882 Point aPos = GetPosPixel();
1883 if ( ImplGetParent() && !ImplIsOverlapWindow() )
1884 aPos = OutputToScreenPixel(Point(0, 0));
1885 tools::Rectangle aRect( aPos, GetSizePixel() );
1886
1887 Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aRect, rStr );
1888 }
1889 }
1890 else if ( rHEvt.GetMode() & HelpEventMode::QUICK )
1891 {
1892 const OUString& rStr = GetQuickHelpText();
1893 if ( rStr.isEmpty() && ImplGetParent() && !ImplIsOverlapWindow() )
1894 ImplGetParent()->RequestHelp( rHEvt );
1895 else
1896 {
1897 Point aPos = GetPosPixel();
1898 if ( ImplGetParent() && !ImplIsOverlapWindow() )
1899 aPos = OutputToScreenPixel(Point(0, 0));
1900 tools::Rectangle aRect( aPos, GetSizePixel() );
1901 Help::ShowQuickHelp( this, aRect, rStr, QuickHelpFlags::CtrlText );
1902 }
1903 }
1904 else if (!mpWindowImpl->maHelpRequestHdl.IsSet() || mpWindowImpl->maHelpRequestHdl.Call(*this))
1905 {
1906 OUString aStrHelpId( GetHelpId() );
1907 if ( aStrHelpId.isEmpty() && ImplGetParent() )
1908 ImplGetParent()->RequestHelp( rHEvt );
1909 else
1910 {
1911 Help* pHelp = Application::GetHelp();
1912 if ( pHelp )
1913 {
1914 if( !aStrHelpId.isEmpty() )
1915 pHelp->Start( aStrHelpId, this );
1916 else
1917 pHelp->Start( OOO_HELP_INDEX, this );
1918 }
1919 }
1920 }
1921}
1922
1923void Window::Command( const CommandEvent& rCEvt )
1924{
1926
1927 NotifyEvent aNEvt( NotifyEventType::COMMAND, this, &rCEvt );
1928 if ( !CompatNotify( aNEvt ) )
1929 mpWindowImpl->mbCommand = true;
1930}
1931
1933{
1934
1936 if( pWrapper )
1937 pWrapper->Tracking( rTEvt );
1938}
1939
1941{
1942 switch (eType)
1943 {
1944 //stuff that doesn't invalidate the layout
1954 break;
1955 //stuff that does invalidate the layout
1956 default:
1958 break;
1959 }
1960}
1961
1963{
1964 if ( mpWindowImpl && mpWindowImpl->mnStyle != nStyle )
1965 {
1966 mpWindowImpl->mnPrevStyle = mpWindowImpl->mnStyle;
1967 mpWindowImpl->mnStyle = nStyle;
1969 }
1970}
1971
1973{
1974
1975 if ( mpWindowImpl->mnExtendedStyle == nExtendedStyle )
1976 return;
1977
1978 vcl::Window* pWindow = ImplGetBorderWindow();
1979 if( ! pWindow )
1980 pWindow = this;
1981 if( pWindow->mpWindowImpl->mbFrame )
1982 {
1983 SalExtStyle nExt = 0;
1984 if( nExtendedStyle & WindowExtendedStyle::Document )
1986 if( nExtendedStyle & WindowExtendedStyle::DocModified )
1988
1989 pWindow->ImplGetFrame()->SetExtendedFrameStyle( nExt );
1990 }
1991 mpWindowImpl->mnExtendedStyle = nExtendedStyle;
1992}
1993
1995{
1996
1997 if ( !mpWindowImpl->mpBorderWindow )
1998 return;
1999
2000 if( nBorderStyle == WindowBorderStyle::REMOVEBORDER &&
2001 ! mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame &&
2002 mpWindowImpl->mpBorderWindow->mpWindowImpl->mpParent
2003 )
2004 {
2005 // this is a little awkward: some controls (e.g. svtools ProgressBar)
2006 // cannot avoid getting constructed with WB_BORDER but want to disable
2007 // borders in case of NWF drawing. So they need a method to remove their border window
2008 VclPtr<vcl::Window> pBorderWin = mpWindowImpl->mpBorderWindow;
2009 // remove us as border window's client
2010 pBorderWin->mpWindowImpl->mpClientWindow = nullptr;
2011 mpWindowImpl->mpBorderWindow = nullptr;
2012 mpWindowImpl->mpRealParent = pBorderWin->mpWindowImpl->mpParent;
2013 // reparent us above the border window
2014 SetParent( pBorderWin->mpWindowImpl->mpParent );
2015 // set us to the position and size of our previous border
2016 Point aBorderPos( pBorderWin->GetPosPixel() );
2017 Size aBorderSize( pBorderWin->GetSizePixel() );
2018 setPosSizePixel( aBorderPos.X(), aBorderPos.Y(), aBorderSize.Width(), aBorderSize.Height() );
2019 // release border window
2020 pBorderWin.disposeAndClear();
2021
2022 // set new style bits
2023 SetStyle( GetStyle() & (~WB_BORDER) );
2024 }
2025 else
2026 {
2027 if ( mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW )
2028 static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetBorderStyle( nBorderStyle );
2029 else
2030 mpWindowImpl->mpBorderWindow->SetBorderStyle( nBorderStyle );
2031 }
2032}
2033
2035{
2036
2037 if ( mpWindowImpl->mpBorderWindow )
2038 {
2039 if ( mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW )
2040 return static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->GetBorderStyle();
2041 else
2042 return mpWindowImpl->mpBorderWindow->GetBorderStyle();
2043 }
2044
2046}
2047
2049{
2050
2051 if ( mpWindowImpl->mpBorderWindow )
2052 {
2053 if ( mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW )
2054 return static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->CalcTitleWidth();
2055 else
2056 return mpWindowImpl->mpBorderWindow->CalcTitleWidth();
2057 }
2058 else if ( mpWindowImpl->mbFrame && (mpWindowImpl->mnStyle & WB_MOVEABLE) )
2059 {
2060 // we guess the width for frame windows as we do not know the
2061 // border of external dialogs
2062 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
2063 vcl::Font aFont = GetFont();
2064 const_cast<vcl::Window*>(this)->SetPointFont(const_cast<::OutputDevice&>(*GetOutDev()), rStyleSettings.GetTitleFont());
2065 tools::Long nTitleWidth = GetTextWidth( GetText() );
2066 const_cast<vcl::Window*>(this)->SetFont( aFont );
2067 nTitleWidth += rStyleSettings.GetTitleHeight() * 3;
2068 nTitleWidth += StyleSettings::GetBorderSize() * 2;
2069 nTitleWidth += 10;
2070 return nTitleWidth;
2071 }
2072
2073 return 0;
2074}
2075
2076void Window::SetInputContext( const InputContext& rInputContext )
2077{
2078
2079 mpWindowImpl->maInputContext = rInputContext;
2080 if ( !mpWindowImpl->mbInFocusHdl && HasFocus() )
2082}
2083
2084void Window::PostExtTextInputEvent(VclEventId nType, const OUString& rText)
2085{
2086 switch (nType)
2087 {
2089 {
2090 std::unique_ptr<ExtTextInputAttr[]> pAttr(new ExtTextInputAttr[rText.getLength()]);
2091 for (int i = 0; i < rText.getLength(); ++i) {
2093 }
2094 SalExtTextInputEvent aEvent { rText, pAttr.get(), rText.getLength(), EXTTEXTINPUT_CURSOR_OVERWRITE };
2096 }
2097 break;
2100 break;
2101 default:
2102 assert(false);
2103 }
2104}
2105
2107{
2108 if ( mpWindowImpl->mbExtTextInput )
2110}
2111
2112void Window::SetCursorRect( const tools::Rectangle* pRect, tools::Long nExtTextInputWidth )
2113{
2114
2115 ImplWinData* pWinData = ImplGetWinData();
2116 if ( pWinData->mpCursorRect )
2117 {
2118 if ( pRect )
2119 pWinData->mpCursorRect = *pRect;
2120 else
2121 pWinData->mpCursorRect.reset();
2122 }
2123 else
2124 {
2125 if ( pRect )
2126 pWinData->mpCursorRect = *pRect;
2127 }
2128
2129 pWinData->mnCursorExtWidth = nExtTextInputWidth;
2130
2131}
2132
2134{
2135
2136 ImplWinData* pWinData = ImplGetWinData();
2137 return pWinData->mpCursorRect ? &*pWinData->mpCursorRect : nullptr;
2138}
2139
2141{
2142
2143 ImplWinData* pWinData = ImplGetWinData();
2144 return pWinData->mnCursorExtWidth;
2145}
2146
2147void Window::SetCompositionCharRect( const tools::Rectangle* pRect, tools::Long nCompositionLength, bool bVertical ) {
2148
2149 ImplWinData* pWinData = ImplGetWinData();
2150 pWinData->mpCompositionCharRects.reset();
2151 pWinData->mbVertical = bVertical;
2152 pWinData->mnCompositionCharRects = nCompositionLength;
2153 if ( pRect && (nCompositionLength > 0) )
2154 {
2155 pWinData->mpCompositionCharRects.reset( new tools::Rectangle[nCompositionLength] );
2156 for (tools::Long i = 0; i < nCompositionLength; ++i)
2157 pWinData->mpCompositionCharRects[i] = pRect[i];
2158 }
2159}
2160
2161void Window::CollectChildren(::std::vector<vcl::Window *>& rAllChildren )
2162{
2163 rAllChildren.push_back( this );
2164
2165 VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
2166 while ( pChild )
2167 {
2168 pChild->CollectChildren( rAllChildren );
2169 pChild = pChild->mpWindowImpl->mpNext;
2170 }
2171}
2172
2173void Window::SetPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont)
2174{
2175 vcl::Font aFont = rFont;
2176 ImplPointToLogic(rRenderContext, aFont);
2177 rRenderContext.SetFont(aFont);
2178}
2179
2181{
2182 vcl::Font aFont = rRenderContext.GetFont();
2183 ImplLogicToPoint(rRenderContext, aFont);
2184 return aFont;
2185}
2186
2187void Window::Show(bool bVisible, ShowFlags nFlags)
2188{
2189 if ( !mpWindowImpl || mpWindowImpl->mbVisible == bVisible )
2190 return;
2191
2192 VclPtr<vcl::Window> xWindow(this);
2193
2194 bool bRealVisibilityChanged = false;
2195 mpWindowImpl->mbVisible = bVisible;
2196
2197 if ( !bVisible )
2198 {
2200 if( !xWindow->mpWindowImpl )
2201 return;
2202
2203 if ( mpWindowImpl->mpBorderWindow )
2204 {
2205 bool bOldUpdate = mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate;
2206 if ( mpWindowImpl->mbNoParentUpdate )
2207 mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = true;
2208 mpWindowImpl->mpBorderWindow->Show( false, nFlags );
2209 mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = bOldUpdate;
2210 }
2211 else if ( mpWindowImpl->mbFrame )
2212 {
2213 mpWindowImpl->mbSuppressAccessibilityEvents = true;
2214 mpWindowImpl->mpFrame->Show( false );
2215 }
2216
2218
2219 if ( mpWindowImpl->mbReallyVisible )
2220 {
2221 if ( mpWindowImpl->mbInitWinClipRegion )
2223
2224 vcl::Region aInvRegion = mpWindowImpl->maWinClipRegion;
2225
2226 if( !xWindow->mpWindowImpl )
2227 return;
2228
2229 bRealVisibilityChanged = mpWindowImpl->mbReallyVisible;
2232
2233 if ( ImplIsOverlapWindow() && !mpWindowImpl->mbFrame )
2234 {
2235 // convert focus
2236 if ( !(nFlags & ShowFlags::NoFocusChange) && HasChildPathFocus() )
2237 {
2238 if ( mpWindowImpl->mpOverlapWindow->IsEnabled() &&
2239 mpWindowImpl->mpOverlapWindow->IsInputEnabled() &&
2240 ! mpWindowImpl->mpOverlapWindow->IsInModalMode()
2241 )
2242 mpWindowImpl->mpOverlapWindow->GrabFocus();
2243 }
2244 }
2245
2246 if ( !mpWindowImpl->mbFrame )
2247 {
2248 if (mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mbEnableNativeWidget)
2249 {
2250 /*
2251 * #i48371# native theming: some themes draw outside the control
2252 * area we tell them to (bad thing, but we cannot do much about it ).
2253 * On hiding these controls they get invalidated with their window rectangle
2254 * which leads to the parts outside the control area being left and not
2255 * invalidated. Workaround: invalidate an area on the parent, too
2256 */
2257 const int workaround_border = 5;
2258 tools::Rectangle aBounds( aInvRegion.GetBoundRect() );
2259 aBounds.AdjustLeft( -workaround_border );
2260 aBounds.AdjustTop( -workaround_border );
2261 aBounds.AdjustRight(workaround_border );
2262 aBounds.AdjustBottom(workaround_border );
2263 aInvRegion = aBounds;
2264 }
2265 if ( !mpWindowImpl->mbNoParentUpdate )
2266 {
2267 if ( !aInvRegion.IsEmpty() )
2268 ImplInvalidateParentFrameRegion( aInvRegion );
2269 }
2271 }
2272 }
2273 }
2274 else
2275 {
2276 // inherit native widget flag for form controls
2277 // required here, because frames never show up in the child hierarchy - which should be fixed...
2278 // eg, the drop down of a combobox which is a system floating window
2279 if( mpWindowImpl->mbFrame && GetParent() && !GetParent()->isDisposed() &&
2282 !(GetStyle() & WB_TOOLTIPWIN) )
2283 {
2285 }
2286
2287 if ( mpWindowImpl->mbCallMove )
2288 {
2289 ImplCallMove();
2290 }
2291 if ( mpWindowImpl->mbCallResize )
2292 {
2294 }
2295
2297
2298 vcl::Window* pTestParent;
2299 if ( ImplIsOverlapWindow() )
2300 pTestParent = mpWindowImpl->mpOverlapWindow;
2301 else
2302 pTestParent = ImplGetParent();
2303 if ( mpWindowImpl->mbFrame || pTestParent->mpWindowImpl->mbReallyVisible )
2304 {
2305 // if a window becomes visible, send all child windows a StateChange,
2306 // such that these can initialise themselves
2308
2309 // If it is a SystemWindow it automatically pops up on top of
2310 // all other windows if needed.
2311 if ( ImplIsOverlapWindow() && !(nFlags & ShowFlags::NoActivate) )
2312 {
2315 }
2316
2317 // adjust mpWindowImpl->mbReallyVisible
2318 bRealVisibilityChanged = !mpWindowImpl->mbReallyVisible;
2320
2321 // assure clip rectangles will be recalculated
2323
2324 if ( !mpWindowImpl->mbFrame )
2325 {
2326 InvalidateFlags nInvalidateFlags = InvalidateFlags::Children;
2327 if( ! IsPaintTransparent() )
2328 nInvalidateFlags |= InvalidateFlags::NoTransparent;
2329 ImplInvalidate( nullptr, nInvalidateFlags );
2331 }
2332 }
2333
2334 if ( mpWindowImpl->mpBorderWindow )
2335 mpWindowImpl->mpBorderWindow->Show( true, nFlags );
2336 else if ( mpWindowImpl->mbFrame )
2337 {
2338 // #106431#, hide SplashScreen
2339 ImplSVData* pSVData = ImplGetSVData();
2340 if ( !pSVData->mpIntroWindow )
2341 {
2342 // The right way would be just to call this (not even in the 'if')
2343 auto pApp = GetpApp();
2344 if ( pApp )
2345 pApp->InitFinished();
2346 }
2347 else if ( !ImplIsWindowOrChild( pSVData->mpIntroWindow ) )
2348 {
2349 // ... but the VCL splash is broken, and it needs this
2350 // (for ./soffice .uno:NewDoc)
2351 pSVData->mpIntroWindow->Hide();
2352 }
2353
2354 //SAL_WARN_IF( mpWindowImpl->mbSuppressAccessibilityEvents, "vcl", "Window::Show() - Frame reactivated");
2355 mpWindowImpl->mbSuppressAccessibilityEvents = false;
2356
2357 mpWindowImpl->mbPaintFrame = true;
2359 {
2360 bool bNoActivate(nFlags & (ShowFlags::NoActivate|ShowFlags::NoFocusChange));
2361 mpWindowImpl->mpFrame->Show( true, bNoActivate );
2362 }
2363 if( !xWindow->mpWindowImpl )
2364 return;
2365
2366 // Query the correct size of the window, if we are waiting for
2367 // a system resize
2368 if ( mpWindowImpl->mbWaitSystemResize )
2369 {
2370 tools::Long nOutWidth;
2371 tools::Long nOutHeight;
2372 mpWindowImpl->mpFrame->GetClientSize( nOutWidth, nOutHeight );
2373 ImplHandleResize( this, nOutWidth, nOutHeight );
2374 }
2375
2376 if (mpWindowImpl->mpFrameData->mpBuffer && mpWindowImpl->mpFrameData->mpBuffer->GetOutputSizePixel() != GetOutputSizePixel())
2377 // Make sure that the buffer size matches the window size, even if no resize was needed.
2378 mpWindowImpl->mpFrameData->mpBuffer->SetOutputSizePixel(GetOutputSizePixel());
2379 }
2380
2381 if( !xWindow->mpWindowImpl )
2382 return;
2383
2385 }
2386
2387 if( !xWindow->mpWindowImpl )
2388 return;
2389
2390 // the SHOW/HIDE events also serve as indicators to send child creation/destroy events to the access bridge
2391 // However, the access bridge only uses this event if the data member is not NULL (it's kind of a hack that
2392 // we re-use the SHOW/HIDE events this way, with this particular semantics).
2393 // Since #104887#, the notifications for the access bridge are done in Impl(Set|Reset)ReallyVisible. Here, we
2394 // now only notify with a NULL data pointer, for all other clients except the access bridge.
2395 if ( !bRealVisibilityChanged )
2397 if( xWindow->isDisposed() )
2398 return;
2399
2400}
2401
2403{
2404 if (!mpWindowImpl)
2405 {
2406 SAL_WARN("vcl.layout", "WTF no windowimpl");
2407 return Size(0,0);
2408 }
2409
2410 // #i43257# trigger pending resize handler to assure correct window sizes
2411 if( mpWindowImpl->mpFrameData->maResizeIdle.IsActive() )
2412 {
2413 VclPtr<vcl::Window> xWindow( const_cast<Window*>(this) );
2414 mpWindowImpl->mpFrameData->maResizeIdle.Stop();
2415 mpWindowImpl->mpFrameData->maResizeIdle.Invoke( nullptr );
2416 if( xWindow->isDisposed() )
2417 return Size(0,0);
2418 }
2419
2420 return Size( GetOutDev()->mnOutWidth + mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder,
2421 GetOutDev()->mnOutHeight + mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder );
2422}
2423
2424void Window::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
2425 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
2426{
2427 rLeftBorder = mpWindowImpl->mnLeftBorder;
2428 rTopBorder = mpWindowImpl->mnTopBorder;
2429 rRightBorder = mpWindowImpl->mnRightBorder;
2430 rBottomBorder = mpWindowImpl->mnBottomBorder;
2431}
2432
2433void Window::Enable( bool bEnable, bool bChild )
2434{
2435 if ( isDisposed() )
2436 return;
2437
2438 if ( !bEnable )
2439 {
2440 // the tracking mode will be stopped or the capture will be stolen
2441 // when a window is disabled,
2442 if ( IsTracking() )
2444 if ( IsMouseCaptured() )
2445 ReleaseMouse();
2446 // try to pass focus to the next control
2447 // if the window has focus and is contained in the dialog control
2448 // mpWindowImpl->mbDisabled should only be set after a call of ImplDlgCtrlNextWindow().
2449 // Otherwise ImplDlgCtrlNextWindow() should be used
2450 if ( HasFocus() )
2452 }
2453
2454 if ( mpWindowImpl->mpBorderWindow )
2455 {
2456 mpWindowImpl->mpBorderWindow->Enable( bEnable, false );
2457 if ( (mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW) &&
2458 static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow )
2459 static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow->Enable( bEnable );
2460 }
2461
2462 // #i56102# restore app focus win in case the
2463 // window was disabled when the frame focus changed
2464 ImplSVData* pSVData = ImplGetSVData();
2465 if (bEnable && pSVData->mpWinData->mpFocusWin == nullptr
2466 && mpWindowImpl->mpFrameData->mbHasFocus && mpWindowImpl->mpFrameData->mpFocusWin == this)
2467 pSVData->mpWinData->mpFocusWin = this;
2468
2469 if ( mpWindowImpl->mbDisabled != !bEnable )
2470 {
2471 mpWindowImpl->mbDisabled = !bEnable;
2472 if ( mpWindowImpl->mpSysObj )
2473 mpWindowImpl->mpSysObj->Enable( bEnable && !mpWindowImpl->mbInputDisabled );
2475
2477 }
2478
2479 if ( bChild )
2480 {
2481 VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
2482 while ( pChild )
2483 {
2484 pChild->Enable( bEnable, bChild );
2485 pChild = pChild->mpWindowImpl->mpNext;
2486 }
2487 }
2488
2489 if ( IsReallyVisible() )
2491}
2492
2493void Window::EnableInput( bool bEnable, bool bChild )
2494{
2495 if (!mpWindowImpl)
2496 return;
2497
2498 if ( mpWindowImpl->mpBorderWindow )
2499 {
2500 mpWindowImpl->mpBorderWindow->EnableInput( bEnable, false );
2501 if ( (mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW) &&
2502 static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow )
2503 static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow->EnableInput( bEnable );
2504 }
2505
2506 if ( (!bEnable && mpWindowImpl->meAlwaysInputMode != AlwaysInputEnabled) || bEnable )
2507 {
2508 // automatically stop the tracking mode or steal capture
2509 // if the window is disabled
2510 if ( !bEnable )
2511 {
2512 if ( IsTracking() )
2514 if ( IsMouseCaptured() )
2515 ReleaseMouse();
2516 }
2517
2518 if ( mpWindowImpl->mbInputDisabled != !bEnable )
2519 {
2520 mpWindowImpl->mbInputDisabled = !bEnable;
2521 if ( mpWindowImpl->mpSysObj )
2522 mpWindowImpl->mpSysObj->Enable( !mpWindowImpl->mbDisabled && bEnable );
2523 }
2524 }
2525
2526 // #i56102# restore app focus win in case the
2527 // window was disabled when the frame focus changed
2528 ImplSVData* pSVData = ImplGetSVData();
2529 if (bEnable && pSVData->mpWinData->mpFocusWin == nullptr
2530 && mpWindowImpl->mpFrameData->mbHasFocus && mpWindowImpl->mpFrameData->mpFocusWin == this)
2531 pSVData->mpWinData->mpFocusWin = this;
2532
2533 if ( bChild )
2534 {
2535 VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
2536 while ( pChild )
2537 {
2538 pChild->EnableInput( bEnable, bChild );
2539 pChild = pChild->mpWindowImpl->mpNext;
2540 }
2541 }
2542
2543 if ( IsReallyVisible() )
2545}
2546
2547void Window::EnableInput( bool bEnable, const vcl::Window* pExcludeWindow )
2548{
2549 if (!mpWindowImpl)
2550 return;
2551
2552 EnableInput( bEnable );
2553
2554 // pExecuteWindow is the first Overlap-Frame --> if this
2555 // shouldn't be the case, then this must be changed in dialog.cxx
2556 if( pExcludeWindow )
2557 pExcludeWindow = pExcludeWindow->ImplGetFirstOverlapWindow();
2558 vcl::Window* pSysWin = mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrameData->mpFirstOverlap;
2559 while ( pSysWin )
2560 {
2561 // Is Window in the path from this window
2562 if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( pSysWin, true ) )
2563 {
2564 // Is Window not in the exclude window path or not the
2565 // exclude window, then change the status
2566 if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( pSysWin, true ) )
2567 pSysWin->EnableInput( bEnable );
2568 }
2569 pSysWin = pSysWin->mpWindowImpl->mpNextOverlap;
2570 }
2571
2572 // enable/disable floating system windows as well
2574 while ( pFrameWin )
2575 {
2576 if( pFrameWin->ImplIsFloatingWindow() )
2577 {
2578 // Is Window in the path from this window
2579 if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( pFrameWin, true ) )
2580 {
2581 // Is Window not in the exclude window path or not the
2582 // exclude window, then change the status
2583 if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( pFrameWin, true ) )
2584 pFrameWin->EnableInput( bEnable );
2585 }
2586 }
2587 pFrameWin = pFrameWin->mpWindowImpl->mpFrameData->mpNextFrame;
2588 }
2589
2590 // the same for ownerdraw floating windows
2591 if( !mpWindowImpl->mbFrame )
2592 return;
2593
2594 ::std::vector< VclPtr<vcl::Window> >& rList = mpWindowImpl->mpFrameData->maOwnerDrawList;
2595 for (auto const& elem : rList)
2596 {
2597 // Is Window in the path from this window
2598 if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( elem, true ) )
2599 {
2600 // Is Window not in the exclude window path or not the
2601 // exclude window, then change the status
2602 if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( elem, true ) )
2603 elem->EnableInput( bEnable );
2604 }
2605 }
2606}
2607
2608void Window::AlwaysEnableInput( bool bAlways, bool bChild )
2609{
2610
2611 if ( mpWindowImpl->mpBorderWindow )
2612 mpWindowImpl->mpBorderWindow->AlwaysEnableInput( bAlways, false );
2613
2614 if( bAlways && mpWindowImpl->meAlwaysInputMode != AlwaysInputEnabled )
2615 {
2616 mpWindowImpl->meAlwaysInputMode = AlwaysInputEnabled;
2617 EnableInput(true, false);
2618 }
2619 else if( ! bAlways && mpWindowImpl->meAlwaysInputMode == AlwaysInputEnabled )
2620 {
2621 mpWindowImpl->meAlwaysInputMode = AlwaysInputNone;
2622 }
2623
2624 if ( bChild )
2625 {
2626 VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
2627 while ( pChild )
2628 {
2629 pChild->AlwaysEnableInput( bAlways, bChild );
2630 pChild = pChild->mpWindowImpl->mpNext;
2631 }
2632 }
2633}
2634
2636{
2637
2638 if ( mpWindowImpl->mpBorderWindow )
2639 mpWindowImpl->mpBorderWindow->SetActivateMode( nMode );
2640
2641 if ( mpWindowImpl->mnActivateMode == nMode )
2642 return;
2643
2644 mpWindowImpl->mnActivateMode = nMode;
2645
2646 // possibly trigger Deactivate/Activate
2647 if ( mpWindowImpl->mnActivateMode != ActivateModeFlags::NONE )
2648 {
2649 if ( (mpWindowImpl->mbActive || (GetType() == WindowType::BORDERWINDOW)) &&
2650 !HasChildPathFocus( true ) )
2651 {
2652 mpWindowImpl->mbActive = false;
2653 Deactivate();
2654 }
2655 }
2656 else
2657 {
2658 if ( !mpWindowImpl->mbActive || (GetType() == WindowType::BORDERWINDOW) )
2659 {
2660 mpWindowImpl->mbActive = true;
2661 Activate();
2662 }
2663 }
2664}
2665
2667 tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags )
2668{
2669 bool bHasValidSize = !mpWindowImpl->mbDefSize;
2670
2671 if ( nFlags & PosSizeFlags::Pos )
2672 mpWindowImpl->mbDefPos = false;
2673 if ( nFlags & PosSizeFlags::Size )
2674 mpWindowImpl->mbDefSize = false;
2675
2676 // The top BorderWindow is the window which is to be positioned
2677 VclPtr<vcl::Window> pWindow = this;
2678 while ( pWindow->mpWindowImpl->mpBorderWindow )
2679 pWindow = pWindow->mpWindowImpl->mpBorderWindow;
2680
2681 if ( pWindow->mpWindowImpl->mbFrame )
2682 {
2683 // Note: if we're positioning a frame, the coordinates are interpreted
2684 // as being the top-left corner of the window's client area and NOT
2685 // as the position of the border ! (due to limitations of several UNIX window managers)
2686 tools::Long nOldWidth = pWindow->GetOutDev()->mnOutWidth;
2687
2688 if ( !(nFlags & PosSizeFlags::Width) )
2689 nWidth = pWindow->GetOutDev()->mnOutWidth;
2690 if ( !(nFlags & PosSizeFlags::Height) )
2691 nHeight = pWindow->GetOutDev()->mnOutHeight;
2692
2693 sal_uInt16 nSysFlags=0;
2694 VclPtr<vcl::Window> pParent = GetParent();
2695 VclPtr<vcl::Window> pWinParent = pWindow->GetParent();
2696
2697 if( nFlags & PosSizeFlags::Width )
2698 nSysFlags |= SAL_FRAME_POSSIZE_WIDTH;
2699 if( nFlags & PosSizeFlags::Height )
2700 nSysFlags |= SAL_FRAME_POSSIZE_HEIGHT;
2701 if( nFlags & PosSizeFlags::X )
2702 {
2703 nSysFlags |= SAL_FRAME_POSSIZE_X;
2704 if( pWinParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
2705 {
2706 nX += pWinParent->GetOutDev()->mnOutOffX;
2707 }
2708 if( pParent && pParent->GetOutDev()->ImplIsAntiparallel() )
2709 {
2710 tools::Rectangle aRect( Point ( nX, nY ), Size( nWidth, nHeight ) );
2711 const OutputDevice *pParentOutDev = pParent->GetOutDev();
2713 pParentOutDev->ReMirror( aRect );
2714 nX = aRect.Left();
2715 }
2716 }
2718 !(nFlags & PosSizeFlags::X) && bHasValidSize &&
2719 pWindow->mpWindowImpl->mpFrame->maGeometry.width() )
2720 {
2721 // RTL: make sure the old right aligned position is not changed
2722 // system windows will always grow to the right
2723 if ( pWinParent )
2724 {
2725 OutputDevice *pParentOutDev = pWinParent->GetOutDev();
2726 if( pParentOutDev->HasMirroredGraphics() )
2727 {
2728 const SalFrameGeometry& aSysGeometry = mpWindowImpl->mpFrame->GetUnmirroredGeometry();
2729 const SalFrameGeometry& aParentSysGeometry =
2730 pWinParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry();
2731 tools::Long myWidth = nOldWidth;
2732 if( !myWidth )
2733 myWidth = aSysGeometry.width();
2734 if( !myWidth )
2735 myWidth = nWidth;
2736 nFlags |= PosSizeFlags::X;
2737 nSysFlags |= SAL_FRAME_POSSIZE_X;
2738 nX = aParentSysGeometry.x() - aSysGeometry.leftDecoration() + aParentSysGeometry.width()
2739 - myWidth - 1 - aSysGeometry.x();
2740 }
2741 }
2742 }
2743 if( nFlags & PosSizeFlags::Y )
2744 {
2745 nSysFlags |= SAL_FRAME_POSSIZE_Y;
2746 if( pWinParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
2747 {
2748 nY += pWinParent->GetOutDev()->mnOutOffY;
2749 }
2750 }
2751
2753 {
2754 // check for min/max client size and adjust size accordingly
2755 // otherwise it may happen that the resize event is ignored, i.e. the old size remains
2756 // unchanged but ImplHandleResize() is called with the wrong size
2757 SystemWindow *pSystemWindow = dynamic_cast< SystemWindow* >( pWindow.get() );
2758 if( pSystemWindow )
2759 {
2760 Size aMinSize = pSystemWindow->GetMinOutputSizePixel();
2761 Size aMaxSize = pSystemWindow->GetMaxOutputSizePixel();
2762 if( nWidth < aMinSize.Width() )
2763 nWidth = aMinSize.Width();
2764 if( nHeight < aMinSize.Height() )
2765 nHeight = aMinSize.Height();
2766
2767 if( nWidth > aMaxSize.Width() )
2768 nWidth = aMaxSize.Width();
2769 if( nHeight > aMaxSize.Height() )
2770 nHeight = aMaxSize.Height();
2771 }
2772 }
2773
2774 pWindow->mpWindowImpl->mpFrame->SetPosSize( nX, nY, nWidth, nHeight, nSysFlags );
2775
2776 // Adjust resize with the hack of different client size and frame geometries to fix
2777 // native menu bars. Eventually this should be replaced by proper mnTopBorder usage.
2778 pWindow->mpWindowImpl->mpFrame->GetClientSize(nWidth, nHeight);
2779
2780 // Resize should be called directly. If we haven't
2781 // set the correct size, we get a second resize from
2782 // the system with the correct size. This can be happened
2783 // if the size is too small or too large.
2784 ImplHandleResize( pWindow, nWidth, nHeight );
2785 }
2786 else
2787 {
2788 pWindow->ImplPosSizeWindow( nX, nY, nWidth, nHeight, nFlags );
2789 if ( IsReallyVisible() )
2791 }
2792}
2793
2795{
2796 return mpWindowImpl->maPos;
2797}
2798
2800{
2801 tools::Rectangle rRect;
2802 mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrame->GetWorkArea( rRect );
2803 return rRect;
2804}
2805
2807{
2808 // relative to top level parent
2809 return Point( rPos.X() + GetOutDev()->mnOutOffX, rPos.Y() + GetOutDev()->mnOutOffY );
2810}
2811
2813{
2814 // relative to top level parent
2815 return Point( rPos.X() - GetOutDev()->mnOutOffX, rPos.Y() - GetOutDev()->mnOutOffY );
2816}
2817
2819{
2820 // revert mnOutOffX changes that were potentially made in ImplPosSizeWindow
2822 const OutputDevice *pOutDev = GetOutDev();
2823 if( pOutDev->HasMirroredGraphics() )
2824 {
2825 if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->GetOutDev()->ImplIsAntiparallel() )
2826 {
2827 if ( !ImplIsOverlapWindow() )
2828 offx -= mpWindowImpl->mpParent->GetOutDev()->mnOutOffX;
2829
2830 offx = mpWindowImpl->mpParent->GetOutDev()->mnOutWidth - GetOutDev()->mnOutWidth - offx;
2831
2832 if ( !ImplIsOverlapWindow() )
2833 offx += mpWindowImpl->mpParent->GetOutDev()->mnOutOffX;
2834
2835 }
2836 }
2837 return offx;
2838}
2839
2840// normalized screen pixel are independent of mirroring
2842{
2843 // relative to top level parent
2845 return Point( rPos.X()+offx, rPos.Y() + GetOutDev()->mnOutOffY );
2846}
2847
2849{
2850 // relative to top level parent
2852 return Point( rPos.X()-offx, rPos.Y() - GetOutDev()->mnOutOffY );
2853}
2854
2856{
2857 // relative to the screen
2858 Point p = OutputToScreenPixel( rPos );
2859 SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
2860 p.AdjustX(g.x() );
2861 p.AdjustY(g.y() );
2862 return p;
2863}
2864
2866{
2867 // relative to the screen
2868 Point p = ScreenToOutputPixel( rPos );
2869 SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
2870 p.AdjustX( -(g.x()) );
2871 p.AdjustY( -(g.y()) );
2872 return p;
2873}
2874
2876{
2877 // this method creates unmirrored screen coordinates to be compared with the desktop
2878 // and is used for positioning of RTL popup windows correctly on the screen
2879 SalFrameGeometry g = mpWindowImpl->mpFrame->GetUnmirroredGeometry();
2880
2881 Point p1 = rRect.TopRight();
2882 p1 = OutputToScreenPixel(p1);
2883 p1.setX( g.x()+g.width()-p1.X() );
2884 p1.AdjustY(g.y() );
2885
2886 Point p2 = rRect.BottomLeft();
2887 p2 = OutputToScreenPixel(p2);
2888 p2.setX( g.x()+g.width()-p2.X() );
2889 p2.AdjustY(g.y() );
2890
2891 return tools::Rectangle( p1, p2 );
2892}
2893
2895{
2896 // undo ImplOutputToUnmirroredAbsoluteScreenPixel
2897 SalFrameGeometry g = mpWindowImpl->mpFrame->GetUnmirroredGeometry();
2898
2899 Point p1 = rRect.TopRight();
2900 p1.AdjustY(-g.y() );
2901 p1.setX( g.x()+g.width()-p1.X() );
2902 p1 = ScreenToOutputPixel(p1);
2903
2904 Point p2 = rRect.BottomLeft();
2905 p2.AdjustY(-g.y());
2906 p2.setX( g.x()+g.width()-p2.X() );
2907 p2 = ScreenToOutputPixel(p2);
2908
2909 return tools::Rectangle( p1, p2 );
2910}
2911
2912
2913// with decoration
2915{
2917 // #106399# express coordinates relative to borderwindow
2918 const vcl::Window *pRelWin = rRelativeWindow.mpWindowImpl->mpBorderWindow ? rRelativeWindow.mpWindowImpl->mpBorderWindow.get() : &rRelativeWindow;
2919 aRect.SetPos( pRelWin->AbsoluteScreenToOutputPixel( aRect.GetPos() ) );
2920 return aRect;
2921}
2922
2923// with decoration
2925{
2926 // make sure we use the extent of our border window,
2927 // otherwise we miss a few pixels
2928 const vcl::Window *pWin = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow : this;
2929
2930 Point aPos( pWin->OutputToAbsoluteScreenPixel( Point(0,0) ) );
2931 Size aSize ( pWin->GetSizePixel() );
2932 // #104088# do not add decoration to the workwindow to be compatible to java accessibility api
2933 if( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame && GetType() != WindowType::WORKWINDOW) )
2934 {
2935 SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
2936 aPos.AdjustX( -sal_Int32(g.leftDecoration()) );
2937 aPos.AdjustY( -sal_Int32(g.topDecoration()) );
2938 aSize.AdjustWidth(g.leftDecoration() + g.rightDecoration() );
2940 }
2941 return tools::Rectangle( aPos, aSize );
2942}
2943
2944void Window::Scroll( tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags )
2945{
2946
2948 nHorzScroll, nVertScroll, nFlags & ~ScrollFlags::Clip );
2949}
2950
2951void Window::Scroll( tools::Long nHorzScroll, tools::Long nVertScroll,
2952 const tools::Rectangle& rRect, ScrollFlags nFlags )
2953{
2954 OutputDevice *pOutDev = GetOutDev();
2955 tools::Rectangle aRect = pOutDev->ImplLogicToDevicePixel( rRect );
2957 if ( !aRect.IsEmpty() )
2958 ImplScroll( aRect, nHorzScroll, nVertScroll, nFlags );
2959}
2960
2962{
2964 mxOwnerWindow->mpWindowImpl->mpFrame->Flush( GetOutputRectPixel() );
2965}
2966
2967void Window::SetUpdateMode( bool bUpdate )
2968{
2969 if (mpWindowImpl)
2970 {
2971 mpWindowImpl->mbNoUpdate = !bUpdate;
2973 }
2974}
2975
2977{
2979}
2980
2982{
2983 return (this == ImplGetSVData()->mpWinData->mpFocusWin);
2984}
2985
2987{
2989}
2990
2992{
2993 if (mpWindowImpl && mpWindowImpl->mpFrameData)
2994 return mpWindowImpl->mpFrameData->mpFocusWin;
2995 else
2996 return VclPtr<vcl::Window>();
2997}
2998
2999void Window::SetFakeFocus( bool bFocus )
3000{
3002}
3003
3004bool Window::HasChildPathFocus( bool bSystemWindow ) const
3005{
3006
3008 if ( pFocusWin )
3009 return ImplIsWindowOrChild( pFocusWin, bSystemWindow );
3010 return false;
3011}
3012
3014{
3015
3016 if ( mpWindowImpl->mpCursor != pCursor )
3017 {
3018 if ( mpWindowImpl->mpCursor )
3019 mpWindowImpl->mpCursor->ImplHide();
3020 mpWindowImpl->mpCursor = pCursor;
3021 if ( pCursor )
3022 pCursor->ImplShow();
3023 }
3024}
3025
3026void Window::SetText( const OUString& rStr )
3027{
3028 if (!mpWindowImpl || rStr == mpWindowImpl->maText)
3029 return;
3030
3031 OUString oldTitle( mpWindowImpl->maText );
3032 mpWindowImpl->maText = rStr;
3033
3034 if ( mpWindowImpl->mpBorderWindow )
3035 mpWindowImpl->mpBorderWindow->SetText( rStr );
3036 else if ( mpWindowImpl->mbFrame )
3037 mpWindowImpl->mpFrame->SetTitle( rStr );
3038
3040
3041 // #107247# needed for accessibility
3042 // The VclEventId::WindowFrameTitleChanged is (mis)used to notify accessible name changes.
3043 // Therefore a window, which is labeled by this window, must also notify an accessible
3044 // name change.
3045 if ( IsReallyVisible() )
3046 {
3048 if ( pWindow && pWindow != this )
3050 }
3051
3053}
3054
3055OUString Window::GetText() const
3056{
3057
3058 return mpWindowImpl->maText;
3059}
3060
3062{
3063
3064 return GetText();
3065}
3066
3068{
3069 // FIXME: fix issue 52349, need to fix this really in
3070 // all NWF enabled controls
3071 const ToolBox* pTB = dynamic_cast<const ToolBox*>(this);
3072 if( pTB && IsNativeWidgetEnabled() )
3074
3075 if( !IsBackground() )
3076 {
3077 if( mpWindowImpl->mpParent )
3078 return mpWindowImpl->mpParent->GetDisplayBackground();
3079 }
3080
3081 const Wallpaper& rBack = GetBackground();
3082 if( ! rBack.IsBitmap() &&
3083 ! rBack.IsGradient() &&
3084 rBack.GetColor()== COL_TRANSPARENT &&
3085 mpWindowImpl->mpParent )
3086 return mpWindowImpl->mpParent->GetDisplayBackground();
3087 return rBack;
3088}
3089
3090const OUString& Window::GetHelpText() const
3091{
3092 OUString aStrHelpId( GetHelpId() );
3093 bool bStrHelpId = !aStrHelpId.isEmpty();
3094
3095 if ( !mpWindowImpl->maHelpText.getLength() && bStrHelpId )
3096 {
3097 if ( !IsDialog() && (mpWindowImpl->mnType != WindowType::TABPAGE) && (mpWindowImpl->mnType != WindowType::FLOATINGWINDOW) )
3098 {
3099 Help* pHelp = Application::GetHelp();
3100 if ( pHelp )
3101 {
3102 mpWindowImpl->maHelpText = pHelp->GetHelpText(aStrHelpId, this);
3103 mpWindowImpl->mbHelpTextDynamic = false;
3104 }
3105 }
3106 }
3107 else if( mpWindowImpl->mbHelpTextDynamic && bStrHelpId )
3108 {
3109 static const char* pEnv = getenv( "HELP_DEBUG" );
3110 if( pEnv && *pEnv )
3111 {
3112 OUString aTxt = mpWindowImpl->maHelpText + "\n------------------\n" + aStrHelpId;
3113 mpWindowImpl->maHelpText = aTxt;
3114 }
3115 mpWindowImpl->mbHelpTextDynamic = false;
3116 }
3117
3118 //Fallback to Window::GetAccessibleDescription without reentry to GetHelpText()
3119 if (mpWindowImpl->maHelpText.isEmpty() && mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pAccessibleDescription)
3120 return *mpWindowImpl->mpAccessibleInfos->pAccessibleDescription;
3121 return mpWindowImpl->maHelpText;
3122}
3123
3124void Window::SetWindowPeer( Reference< css::awt::XVclWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow )
3125{
3126 if (!mpWindowImpl || mpWindowImpl->mbInDispose)
3127 return;
3128
3129 // be safe against re-entrance: first clear the old ref, then assign the new one
3130 if (mpWindowImpl->mxWindowPeer)
3131 {
3132 // first, disconnect the peer from ourself, otherwise disposing it, will dispose us
3134 SAL_WARN_IF( !pWrapper, "vcl.window", "SetComponentInterface: No Wrapper!" );
3135 if ( pWrapper )
3136 pWrapper->SetWindowInterface( nullptr, mpWindowImpl->mxWindowPeer );
3137 mpWindowImpl->mxWindowPeer->dispose();
3138 mpWindowImpl->mxWindowPeer.clear();
3139 }
3140 mpWindowImpl->mxWindowPeer = xPeer;
3141
3142 mpWindowImpl->mpVCLXWindow = pVCLXWindow;
3143}
3144
3145Reference< css::awt::XVclWindowPeer > Window::GetComponentInterface( bool bCreate )
3146{
3147 if ( !mpWindowImpl->mxWindowPeer.is() && bCreate )
3148 {
3150 if ( pWrapper )
3151 mpWindowImpl->mxWindowPeer = pWrapper->GetWindowInterface( this );
3152 }
3153 return mpWindowImpl->mxWindowPeer;
3154}
3155
3156void Window::SetComponentInterface( Reference< css::awt::XVclWindowPeer > const & xIFace )
3157{
3159 SAL_WARN_IF( !pWrapper, "vcl.window", "SetComponentInterface: No Wrapper!" );
3160 if ( pWrapper )
3161 pWrapper->SetWindowInterface( this, xIFace );
3162}
3163
3164typedef std::map<vcl::LOKWindowId, VclPtr<vcl::Window>> LOKWindowsMap;
3165
3166namespace {
3167
3168LOKWindowsMap& GetLOKWindowsMap()
3169{
3170 // Map to remember the LOKWindowId <-> Window binding.
3171 static LOKWindowsMap s_aLOKWindowsMap;
3172
3173 return s_aLOKWindowsMap;
3174}
3175
3176}
3177
3178void Window::SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier, bool bParent)
3179{
3180 // don't allow setting this twice
3181 assert(mpWindowImpl->mpLOKNotifier == nullptr);
3182 assert(pNotifier);
3183 // never use this in the desktop case
3185
3186 if (!bParent)
3187 {
3188 // Counter to be able to have unique id's for each window.
3189 static vcl::LOKWindowId sLastLOKWindowId = 1;
3190
3191 // assign the LOK window id
3192 assert(mpWindowImpl->mnLOKWindowId == 0);
3193 mpWindowImpl->mnLOKWindowId = sLastLOKWindowId++;
3194 GetLOKWindowsMap().emplace(mpWindowImpl->mnLOKWindowId, this);
3195 }
3196
3197 mpWindowImpl->mpLOKNotifier = pNotifier;
3198}
3199
3201{
3202 const auto it = GetLOKWindowsMap().find(nWindowId);
3203 if (it != GetLOKWindowsMap().end())
3204 return it->second;
3205
3206 return VclPtr<Window>();
3207}
3208
3210{
3211 return GetLOKWindowsMap().empty();
3212}
3213
3215{
3216 // unregister the LOK window binding
3217 if (mpWindowImpl->mnLOKWindowId > 0)
3218 GetLOKWindowsMap().erase(mpWindowImpl->mnLOKWindowId);
3219
3220 mpWindowImpl->mpLOKNotifier = nullptr;
3221 mpWindowImpl->mnLOKWindowId = 0;
3222}
3223
3225{
3227 {
3228 return;
3229 }
3230
3231 for (auto it = GetLOKWindowsMap().begin(); it != GetLOKWindowsMap().end();)
3232 {
3233 WindowImpl* pWindowImpl = it->second->ImplGetWindowImpl();
3234 if (pWindowImpl && pWindowImpl->mpLOKNotifier == this)
3235 {
3236 pWindowImpl->mpLOKNotifier = nullptr;
3237 pWindowImpl->mnLOKWindowId = 0;
3238 it = GetLOKWindowsMap().erase(it);
3239 continue;
3240 }
3241
3242 ++it;
3243 }
3244}
3245
3247{
3248 return mpWindowImpl ? mpWindowImpl->mpLOKNotifier : nullptr;
3249}
3250
3252{
3253 return mpWindowImpl ? mpWindowImpl->mnLOKWindowId : 0;
3254}
3255
3257{
3258 VclPtr<vcl::Window> pWindow(this);
3259
3260 while (pWindow && !pWindow->GetLOKNotifier())
3261 pWindow = pWindow->GetParent();
3262
3263 return pWindow;
3264}
3265
3266namespace
3267{
3268
3269std::string_view windowTypeName(WindowType nWindowType)
3270{
3271 switch (nWindowType)
3272 {
3273 case WindowType::NONE: return "none";
3274 case WindowType::MESSBOX: return "messagebox";
3275 case WindowType::INFOBOX: return "infobox";
3276 case WindowType::WARNINGBOX: return "warningbox";
3277 case WindowType::ERRORBOX: return "errorbox";
3278 case WindowType::QUERYBOX: return "querybox";
3279 case WindowType::WINDOW: return "window";
3280 case WindowType::WORKWINDOW: return "workwindow";
3281 case WindowType::CONTAINER: return "container";
3282 case WindowType::FLOATINGWINDOW: return "floatingwindow";
3283 case WindowType::DIALOG: return "dialog";
3284 case WindowType::MODELESSDIALOG: return "modelessdialog";
3285 case WindowType::CONTROL: return "control";
3286 case WindowType::PUSHBUTTON: return "pushbutton";
3287 case WindowType::OKBUTTON: return "okbutton";
3288 case WindowType::CANCELBUTTON: return "cancelbutton";
3289 case WindowType::HELPBUTTON: return "helpbutton";
3290 case WindowType::IMAGEBUTTON: return "imagebutton";
3291 case WindowType::MENUBUTTON: return "menubutton";
3292 case WindowType::MOREBUTTON: return "morebutton";
3293 case WindowType::SPINBUTTON: return "spinbutton";
3294 case WindowType::RADIOBUTTON: return "radiobutton";
3295 case WindowType::CHECKBOX: return "checkbox";
3296 case WindowType::TRISTATEBOX: return "tristatebox";
3297 case WindowType::EDIT: return "edit";
3298 case WindowType::MULTILINEEDIT: return "multilineedit";
3299 case WindowType::COMBOBOX: return "combobox";
3300 case WindowType::LISTBOX: return "listbox";
3301 case WindowType::MULTILISTBOX: return "multilistbox";
3302 case WindowType::FIXEDTEXT: return "fixedtext";
3303 case WindowType::FIXEDLINE: return "fixedline";
3304 case WindowType::FIXEDBITMAP: return "fixedbitmap";
3305 case WindowType::FIXEDIMAGE: return "fixedimage";
3306 case WindowType::GROUPBOX: return "groupbox";
3307 case WindowType::SCROLLBAR: return "scrollbar";
3308 case WindowType::SCROLLBARBOX: return "scrollbarbox";
3309 case WindowType::SPLITTER: return "splitter";
3310 case WindowType::SPLITWINDOW: return "splitwindow";
3311 case WindowType::SPINFIELD: return "spinfield";
3312 case WindowType::PATTERNFIELD: return "patternfield";
3313 case WindowType::METRICFIELD: return "metricfield";
3314 case WindowType::FORMATTEDFIELD: return "formattedfield";
3315 case WindowType::CURRENCYFIELD: return "currencyfield";
3316 case WindowType::DATEFIELD: return "datefield";
3317 case WindowType::TIMEFIELD: return "timefield";
3318 case WindowType::PATTERNBOX: return "patternbox";
3319 case WindowType::NUMERICBOX: return "numericbox";
3320 case WindowType::METRICBOX: return "metricbox";
3321 case WindowType::CURRENCYBOX: return "currencybox";
3322 case WindowType::DATEBOX: return "datebox";
3323 case WindowType::TIMEBOX: return "timebox";
3324 case WindowType::LONGCURRENCYBOX: return "longcurrencybox";
3325 case WindowType::SCROLLWINDOW: return "scrollwindow";
3326 case WindowType::TOOLBOX: return "toolbox";
3327 case WindowType::DOCKINGWINDOW: return "dockingwindow";
3328 case WindowType::STATUSBAR: return "statusbar";
3329 case WindowType::TABPAGE: return "tabpage";
3330 case WindowType::TABCONTROL: return "tabcontrol";
3331 case WindowType::TABDIALOG: return "tabdialog";
3332 case WindowType::BORDERWINDOW: return "borderwindow";
3333 case WindowType::BUTTONDIALOG: return "buttondialog";
3334 case WindowType::SYSTEMCHILDWINDOW: return "systemchildwindow";
3335 case WindowType::SLIDER: return "slider";
3336 case WindowType::MENUBARWINDOW: return "menubarwindow";
3337 case WindowType::TREELISTBOX: return "treelistbox";
3338 case WindowType::HELPTEXTWINDOW: return "helptextwindow";
3339 case WindowType::INTROWINDOW: return "introwindow";
3340 case WindowType::LISTBOXWINDOW: return "listboxwindow";
3341 case WindowType::DOCKINGAREA: return "dockingarea";
3342 case WindowType::RULER: return "ruler";
3343 case WindowType::HEADERBAR: return "headerbar";
3344 case WindowType::VERTICALTABCONTROL: return "verticaltabcontrol";
3345
3346 // nothing to do here, but for completeness
3347 case WindowType::TOOLKIT_FRAMEWINDOW: return "toolkit_framewindow";
3348 case WindowType::TOOLKIT_SYSTEMCHILDWINDOW: return "toolkit_systemchildwindow";
3349 }
3350
3351 return "none";
3352}
3353
3354}
3355
3357{
3358 if (!mpWindowImpl)
3359 return;
3360
3361 rJsonWriter.put("id", get_id()); // TODO could be missing - sort out
3362 rJsonWriter.put("type", windowTypeName(GetType()));
3363 rJsonWriter.put("text", GetText());
3364 rJsonWriter.put("enabled", IsEnabled());
3365 if (!IsVisible())
3366 rJsonWriter.put("visible", false);
3367
3368 if (vcl::Window* pChild = mpWindowImpl->mpFirstChild)
3369 {
3370 auto childrenNode = rJsonWriter.startArray("children");
3371 while (pChild)
3372 {
3373 {
3374 auto childNode = rJsonWriter.startStruct();
3375 pChild->DumpAsPropertyTree(rJsonWriter);
3376 sal_Int32 nLeft = pChild->get_grid_left_attach();
3377 sal_Int32 nTop = pChild->get_grid_top_attach();
3378 if (nLeft != -1 && nTop != -1)
3379 {
3380 rJsonWriter.put("left", nLeft);
3381 rJsonWriter.put("top", nTop);
3382 }
3383
3384 sal_Int32 nWidth = pChild->get_grid_width();
3385 if (nWidth > 1)
3386 rJsonWriter.put("width", nWidth);
3387 }
3388 pChild = pChild->mpWindowImpl->mpNext;
3389 }
3390 }
3391
3393 if (pAccLabelFor)
3394 rJsonWriter.put("labelFor", pAccLabelFor->get_id());
3395
3396 vcl::Window* pAccLabelledBy = GetAccessibleRelationLabeledBy();
3397 if (pAccLabelledBy)
3398 rJsonWriter.put("labelledBy", pAccLabelledBy->get_id());
3399
3400 mpWindowImpl->maDumpAsPropertyTreeHdl.Call(rJsonWriter);
3401}
3402
3404{
3405 // no deactivation if the newly activated window is my child
3406 if ( !pNew || !ImplIsChild( pNew ) )
3407 {
3408 VclPtr<vcl::Window> xWindow(this);
3410 if( !xWindow->mpWindowImpl )
3411 return;
3412
3413 // #100759#, avoid walking the wrong frame's hierarchy
3414 // eg, undocked docking windows (ImplDockFloatWin)
3416 mpWindowImpl->mpFrameWindow == ImplGetParent()->mpWindowImpl->mpFrameWindow )
3418 }
3419}
3420
3422{
3423 // no activation if the old active window is my child
3424 if ( pOld && ImplIsChild( pOld ))
3425 return;
3426
3427 VclPtr<vcl::Window> xWindow(this);
3429 if( !xWindow->mpWindowImpl )
3430 return;
3431
3432 if ( ImplGetParent() )
3434 else if( (mpWindowImpl->mnStyle & WB_INTROWIN) == 0 )
3435 {
3436 // top level frame reached: store hint for DefModalDialogParent
3438 }
3439}
3440
3441void Window::SetClipboard(Reference<XClipboard> const & xClipboard)
3442{
3443 if (mpWindowImpl->mpFrameData)
3444 mpWindowImpl->mpFrameData->mxClipboard = xClipboard;
3445}
3446
3447Reference< XClipboard > Window::GetClipboard()
3448{
3449 if (!mpWindowImpl->mpFrameData)
3450 return static_cast<XClipboard*>(nullptr);
3451 if (!mpWindowImpl->mpFrameData->mxClipboard.is())
3452 mpWindowImpl->mpFrameData->mxClipboard = GetSystemClipboard();
3453 return mpWindowImpl->mpFrameData->mxClipboard;
3454}
3455
3457{
3458 assert(GetOutDev()->mpOutDevData);
3459 GetOutDev()->mpOutDevData->mpRecordLayout = pLayout;
3460 GetOutDev()->mpOutDevData->maRecordRect = rRect;
3461 Paint(*GetOutDev(), rRect);
3462 GetOutDev()->mpOutDevData->mpRecordLayout = nullptr;
3463}
3464
3466 sal_uInt16 highlight,
3467 bool bChecked,
3468 bool bDrawBorder
3469 )
3470{
3471 if( rRect.IsEmpty() )
3472 return;
3473
3474 const StyleSettings& rStyles = GetSettings().GetStyleSettings();
3475
3476 // colors used for item highlighting
3477 Color aSelectionBorderCol( rStyles.GetHighlightColor() );
3478 Color aSelectionFillCol( aSelectionBorderCol );
3479
3480 bool bDark = rStyles.GetFaceColor().IsDark();
3481 bool bBright = ( rStyles.GetFaceColor() == COL_WHITE );
3482
3483 int c1 = aSelectionBorderCol.GetLuminance();
3484 int c2 = GetBackgroundColor().GetLuminance();
3485
3486 if( !bDark && !bBright && abs( c2-c1 ) < 75 )
3487 {
3488 // contrast too low
3489 sal_uInt16 h,s,b;
3490 aSelectionFillCol.RGBtoHSB( h, s, b );
3491 if( b > 50 ) b -= 40;
3492 else b += 40;
3493 aSelectionFillCol = Color::HSBtoRGB( h, s, b );
3494 aSelectionBorderCol = aSelectionFillCol;
3495 }
3496
3497 tools::Rectangle aRect( rRect );
3498 Color oldFillCol = GetOutDev()->GetFillColor();
3499 Color oldLineCol = GetOutDev()->GetLineColor();
3500
3501 if( bDrawBorder )
3502 GetOutDev()->SetLineColor( bDark ? COL_WHITE : ( bBright ? COL_BLACK : aSelectionBorderCol ) );
3503 else
3505
3506 sal_uInt16 nPercent = 0;
3507 if( !highlight )
3508 {
3509 if( bDark )
3510 aSelectionFillCol = COL_BLACK;
3511 else
3512 nPercent = 80; // just checked (light)
3513 }
3514 else
3515 {
3516 if( bChecked && highlight == 2 )
3517 {
3518 if( bDark )
3519 aSelectionFillCol = COL_LIGHTGRAY;
3520 else if ( bBright )
3521 {
3522 aSelectionFillCol = COL_BLACK;
3524 nPercent = 0;
3525 }
3526 else
3527 nPercent = 20; // selected, pressed or checked ( very dark )
3528 }
3529 else if( bChecked || highlight == 1 )
3530 {
3531 if( bDark )
3532 aSelectionFillCol = COL_GRAY;
3533 else if ( bBright )
3534 {
3535 aSelectionFillCol = COL_BLACK;
3537 nPercent = 0;
3538 }
3539 else
3540 nPercent = 35; // selected, pressed or checked ( very dark )
3541 }
3542 else
3543 {
3544 if( bDark )
3545 aSelectionFillCol = COL_LIGHTGRAY;
3546 else if ( bBright )
3547 {
3548 aSelectionFillCol = COL_BLACK;
3550 if( highlight == 3 )
3551 nPercent = 80;
3552 else
3553 nPercent = 0;
3554 }
3555 else
3556 nPercent = 70; // selected ( dark )
3557 }
3558 }
3559
3560 GetOutDev()->SetFillColor( aSelectionFillCol );
3561
3562 if( bDark )
3563 {
3564 GetOutDev()->DrawRect( aRect );
3565 }
3566 else
3567 {
3568 tools::Polygon aPoly( aRect );
3569 tools::PolyPolygon aPolyPoly( aPoly );
3570 GetOutDev()->DrawTransparent( aPolyPoly, nPercent );
3571 }
3572
3573 GetOutDev()->SetFillColor( oldFillCol );
3574 GetOutDev()->SetLineColor( oldLineCol );
3575}
3576
3578{
3579 // check for scrollbars
3580 VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
3581 while( pChild )
3582 {
3583 if( pChild->GetType() == WindowType::SCROLLBAR )
3584 return true;
3585 else
3586 pChild = pChild->mpWindowImpl->mpNext;
3587 }
3588 return false;
3589}
3590
3592{
3593 pt.setX( mpWindowImpl->mpFrame->maGeometry.width()-1-pt.X() );
3594}
3595
3596// frame based modal counter (dialogs are not modal to the whole application anymore)
3598{
3599 return (mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrameData->mnModalMode != 0);
3600}
3601
3603{
3604 vcl::Window* pFrameWindow = mpWindowImpl->mpFrameWindow;
3605 vcl::Window* pParent = pFrameWindow;
3606 while( pFrameWindow )
3607 {
3608 pFrameWindow->mpWindowImpl->mpFrameData->mnModalMode++;
3609 while( pParent && pParent->mpWindowImpl->mpFrameWindow == pFrameWindow )
3610 {
3611 pParent = pParent->GetParent();
3612 }
3613 pFrameWindow = pParent ? pParent->mpWindowImpl->mpFrameWindow.get() : nullptr;
3614 }
3615}
3617{
3618 vcl::Window* pFrameWindow = mpWindowImpl->mpFrameWindow;
3619 vcl::Window* pParent = pFrameWindow;
3620 while( pFrameWindow )
3621 {
3622 pFrameWindow->mpWindowImpl->mpFrameData->mnModalMode--;
3623 while( pParent && pParent->mpWindowImpl->mpFrameWindow == pFrameWindow )
3624 {
3625 pParent = pParent->GetParent();
3626 }
3627 pFrameWindow = pParent ? pParent->mpWindowImpl->mpFrameWindow.get() : nullptr;
3628 }
3629}
3630
3631void Window::ImplIsInTaskPaneList( bool mbIsInTaskList )
3632{
3633 mpWindowImpl->mbIsInTaskPaneList = mbIsInTaskList;
3634}
3635
3637{
3638 mpWindowImpl->mpFrameWindow->CallEventListeners( bIconified ? VclEventId::WindowMinimize : VclEventId::WindowNormalize );
3639 // #109206# notify client window as well to have toolkit topwindow listeners notified
3640 if( mpWindowImpl->mpFrameWindow->mpWindowImpl->mpClientWindow && mpWindowImpl->mpFrameWindow != mpWindowImpl->mpFrameWindow->mpWindowImpl->mpClientWindow )
3641 mpWindowImpl->mpFrameWindow->mpWindowImpl->mpClientWindow->CallEventListeners( bIconified ? VclEventId::WindowMinimize : VclEventId::WindowNormalize );
3642}
3643
3645{
3646 bool bRet = false;
3648 while( pFrameWin )
3649 {
3650 if( pFrameWin != mpWindowImpl->mpFrameWindow )
3651 {
3652 bool bDecorated = false;
3653 VclPtr< vcl::Window > pChildFrame = pFrameWin->ImplGetWindow();
3654 // #i15285# unfortunately WB_MOVEABLE is the same as WB_TABSTOP which can
3655 // be removed for ToolBoxes to influence the keyboard accessibility
3656 // thus WB_MOVEABLE is no indicator for decoration anymore
3657 // but FloatingWindows carry this information in their TitleType...
3658 // TODO: avoid duplicate WinBits !!!
3659 if( pChildFrame && pChildFrame->ImplIsFloatingWindow() )
3660 bDecorated = static_cast<FloatingWindow*>(pChildFrame.get())->GetTitleType() != FloatWinTitleType::NONE;
3661 if( bDecorated || (pFrameWin->mpWindowImpl->mnStyle & (WB_MOVEABLE | WB_SIZEABLE) ) )
3662 if( pChildFrame && pChildFrame->IsVisible() && pChildFrame->IsActive() )
3663 {
3664 if( ImplIsChild( pChildFrame, true ) )
3665 {
3666 bRet = true;
3667 break;
3668 }
3669 }
3670 }
3671 pFrameWin = pFrameWin->mpWindowImpl->mpFrameData->mpNextFrame;
3672 }
3673 return bRet;
3674}
3675
3677{
3678 return mpWindowImpl->mpFrame->GetInputLanguage();
3679}
3680
3681void Window::EnableNativeWidget( bool bEnable )
3682{
3683 static const char* pNoNWF = getenv( "SAL_NO_NWF" );
3684 if( pNoNWF && *pNoNWF )
3685 bEnable = false;
3686
3687 if( bEnable != ImplGetWinData()->mbEnableNativeWidget )
3688 {
3690
3691 // send datachanged event to allow for internal changes required for NWF
3692 // like clipmode, transparency, etc.
3694 CompatDataChanged( aDCEvt );
3695
3696 // sometimes the borderwindow is queried, so keep it in sync
3697 if( mpWindowImpl->mpBorderWindow )
3698 mpWindowImpl->mpBorderWindow->ImplGetWinData()->mbEnableNativeWidget = bEnable;
3699 }
3700
3701 // push down, useful for compound controls
3702 VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
3703 while( pChild )
3704 {
3705 pChild->EnableNativeWidget( bEnable );
3706 pChild = pChild->mpWindowImpl->mpNext;
3707 }
3708}
3709
3711{
3713}
3714
3715Reference< css::rendering::XCanvas > WindowOutputDevice::ImplGetCanvas( bool bSpriteCanvas ) const
3716{
3717 // Feed any with operating system's window handle
3718
3719 // common: first any is VCL pointer to window (for VCL canvas)
3720 Sequence< Any > aArg{
3721 Any(reinterpret_cast<sal_Int64>(this)),
3722 Any(css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight )),
3723 Any(mxOwnerWindow->mpWindowImpl->mbAlwaysOnTop),
3724 Any(Reference< css::awt::XWindow >(
3726 UNO_QUERY )),
3728 };
3729
3730 Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
3731
3732 // Create canvas instance with window handle
3733
3735 css::rendering::CanvasFactory::create( xContext ) );
3736 Reference<XMultiComponentFactory> xCanvasFactory(xStaticCanvasFactory.get());
3737 Reference< css::rendering::XCanvas > xCanvas;
3738
3739 if(xCanvasFactory.is())
3740 {
3741#ifdef _WIN32
3742 // see #140456# - if we're running on a multiscreen setup,
3743 // request special, multi-screen safe sprite canvas
3744 // implementation (not DX5 canvas, as it cannot cope with
3745 // surfaces spanning multiple displays). Note: canvas
3746 // (without sprite) stays the same)
3747 const sal_uInt32 nDisplay = static_cast< WinSalFrame* >( mxOwnerWindow->mpWindowImpl->mpFrame )->mnDisplay;
3748 if( nDisplay >= Application::GetScreenCount() )
3749 {
3750 xCanvas.set( xCanvasFactory->createInstanceWithArgumentsAndContext(
3751 bSpriteCanvas ?
3752 OUString( "com.sun.star.rendering.SpriteCanvas.MultiScreen" ) :
3753 OUString( "com.sun.star.rendering.Canvas.MultiScreen" ),
3754 aArg,
3755 xContext ),
3756 UNO_QUERY );
3757
3758 }
3759 else
3760#endif
3761 {
3762 xCanvas.set( xCanvasFactory->createInstanceWithArgumentsAndContext(
3763 bSpriteCanvas ?
3764 OUString( "com.sun.star.rendering.SpriteCanvas" ) :
3765 OUString( "com.sun.star.rendering.Canvas" ),
3766 aArg,
3767 xContext ),
3768 UNO_QUERY );
3769
3770 }
3771 }
3772
3773 // no factory??? Empty reference, then.
3774 return xCanvas;
3775}
3776
3778{
3779 return OUString();
3780}
3781
3783{
3784 return Selection( 0, 0 );
3785}
3786
3787namespace
3788{
3789 using namespace com::sun::star;
3790
3791 uno::Reference<accessibility::XAccessibleEditableText> lcl_GetxText(vcl::Window *pFocusWin)
3792 {
3793 uno::Reference<accessibility::XAccessibleEditableText> xText;
3794 try
3795 {
3796 uno::Reference< accessibility::XAccessible > xAccessible( pFocusWin->GetAccessible() );
3797 if (xAccessible.is())
3798 xText = FindFocusedEditableText(xAccessible->getAccessibleContext());
3799 }
3800 catch(const uno::Exception&)
3801 {
3802 TOOLS_WARN_EXCEPTION( "vcl.gtk3", "Exception in getting input method surrounding text");
3803 }
3804 return xText;
3805 }
3806}
3807
3808// this is a rubbish implementation using a11y, ideally all subclasses implementing
3809// GetSurroundingText/GetSurroundingTextSelection should implement this and then this
3810// should be removed in favor of a stub that returns false
3812{
3813 uno::Reference<accessibility::XAccessibleEditableText> xText = lcl_GetxText(this);
3814 if (xText.is())
3815 {
3816 sal_Int32 nPosition = xText->getCaretPosition();
3817 // #i111768# range checking
3818 sal_Int32 nDeletePos = rSelection.Min();
3819 sal_Int32 nDeleteEnd = rSelection.Max();
3820 if (nDeletePos < 0)
3821 nDeletePos = 0;
3822 if (nDeleteEnd < 0)
3823 nDeleteEnd = 0;
3824 if (nDeleteEnd > xText->getCharacterCount())
3825 nDeleteEnd = xText->getCharacterCount();
3826
3827 xText->deleteText(nDeletePos, nDeleteEnd);
3828 //tdf91641 adjust cursor if deleted chars shift it forward (normal case)
3829 if (nDeletePos < nPosition)
3830 {
3831 if (nDeleteEnd <= nPosition)
3832 nPosition = nPosition - (nDeleteEnd - nDeletePos);
3833 else
3834 nPosition = nDeletePos;
3835
3836 if (xText->getCharacterCount() >= nPosition)
3837 xText->setCaretPosition( nPosition );
3838 }
3839 return true;
3840 }
3841
3842 return false;
3843}
3844
3846{
3848}
3849
3851{
3852}
3853
3855{
3856
3857 return mpWindowImpl->mpFrame ? mpWindowImpl->mpFrame->GetSystemData() : nullptr;
3858}
3859
3861{
3862 return mpWindowImpl->mpFrameData->mpBuffer;
3863}
3864
3866{
3867 if (bRequest)
3868 {
3869 mpWindowImpl->mpFrameData->mpBuffer = VclPtrInstance<VirtualDevice>();
3870 // Make sure that the buffer size matches the frame size.
3871 mpWindowImpl->mpFrameData->mpBuffer->SetOutputSizePixel(mpWindowImpl->mpFrameWindow->GetOutputSizePixel());
3872 }
3873 else
3874 mpWindowImpl->mpFrameData->mpBuffer.reset();
3875}
3876
3877/*
3878 * The rationale here is that we moved destructors to
3879 * dispose and this altered a lot of code paths, that
3880 * are better left unchanged for now.
3881 */
3883{
3884 if (!mpWindowImpl || mpWindowImpl->mbInDispose)
3886 else
3887 GetFocus();
3888}
3889
3891{
3892 if (!mpWindowImpl || mpWindowImpl->mbInDispose)
3894 else
3895 LoseFocus();
3896}
3897
3899{
3900 if (!mpWindowImpl || mpWindowImpl->mbInDispose)
3901 Window::StateChanged(nStateChange);
3902 else
3903 StateChanged(nStateChange);
3904}
3905
3907{
3908 if (!mpWindowImpl || mpWindowImpl->mbInDispose)
3909 Window::DataChanged(rDCEvt);
3910 else
3911 DataChanged(rDCEvt);
3912}
3913
3915{
3916 if (!mpWindowImpl || mpWindowImpl->mbInDispose)
3917 return Window::PreNotify( rNEvt );
3918 else
3919 return PreNotify( rNEvt );
3920}
3921
3923{
3924 if (!mpWindowImpl || mpWindowImpl->mbInDispose)
3925 return Window::EventNotify( rNEvt );
3926 else
3927 return EventNotify( rNEvt );
3928}
3929
3930void Window::set_id(const OUString& rID)
3931{
3932 mpWindowImpl->maID = rID;
3933}
3934
3935const OUString& Window::get_id() const
3936{
3937 static OUString empty;
3938 return mpWindowImpl ? mpWindowImpl->maID : empty;
3939}
3940
3942{
3944}
3945
3948 mxOwnerWindow(&rOwnerWindow)
3949{
3950 assert(mxOwnerWindow);
3951}
3952
3954{
3955 disposeOnce();
3956}
3957
3959{
3960 assert((!mxOwnerWindow || mxOwnerWindow->isDisposed()) && "This belongs to the associated window and must be disposed after it");
3962 // need to do this after OutputDevice::dispose so that the call to WindowOutputDevice::ReleaseGraphics
3963 // can release the graphics properly
3965}
3966
3967css::awt::DeviceInfo WindowOutputDevice::GetDeviceInfo() const
3968{
3969 css::awt::DeviceInfo aInfo = GetCommonDeviceInfo(mxOwnerWindow->GetSizePixel());
3970 mxOwnerWindow->GetBorder(aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset);
3971 return aInfo;
3972}
3973
3974
3975} /* namespace vcl */
3976
3977/* 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:1219
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:1023
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:976
static Help * GetHelp()
Gets the application's help.
Definition: svapp.cxx:1352
static bool IsHeadlessModeEnabled()
Determines if headless mode is enabled.
Definition: svapp.cxx:1539
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:334
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:1110
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:879
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
const Color & GetFillColor() const
Definition: outdev.hxx:515
constexpr tools::Long Y() const
void setX(tools::Long nX)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
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:97
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:949
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:1473
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::u16string_view pPropName, const OUString &rPropValue)
ScopedJsonWriterStruct startStruct()
ScopedJsonWriterArray startArray(std::string_view)
void SetPos(const Point &rPoint)
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 GetPos() 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:3224
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:3845
virtual void dispose() override
Definition: window.cxx:3958
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:2961
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:3953
WindowOutputDevice(vcl::Window &rOwnerWindow)
Definition: window.cxx:3946
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:3715
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:3967
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:2865
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2806
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:1962
SAL_DLLPRIVATE void ImplPosSizeWindow(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags)
Definition: window.cxx:1458
void SetFont(const vcl::Font &rNewFont)
Definition: window3.cxx:59
void SetCursorRect(const tools::Rectangle *pRect=nullptr, tools::Long nExtTextInputWidth=0)
Definition: window.cxx:2112
void SetUpdateMode(bool bUpdate)
Definition: window.cxx:2967
tools::Rectangle GetWindowExtentsAbsolute() const
Definition: window.cxx:2924
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:2875
static SAL_DLLPRIVATE void ImplNewInputContext()
Definition: window.cxx:1740
void SetActivateMode(ActivateModeFlags nMode)
Definition: window.cxx:2635
SAL_DLLPRIVATE void ImplGrabFocus(GetFocusFlags nFlags)
Definition: mouse.cxx:195
bool IsNativeWidgetEnabled() const
Definition: window.cxx:3710
void SetInputContext(const InputContext &rInputContext)
Definition: window.cxx:2076
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:1133
virtual void GetFocus()
Definition: window.cxx:1841
void SimulateKeyPress(sal_uInt16 nKeyCode) const
Definition: window.cxx:1800
vcl::Window * GetParent() const
Definition: window2.cxx:1123
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1869
SAL_DLLPRIVATE void ImplStartToTop(ToTopFlags nFlags)
Definition: stacking.cxx:313
virtual void StateChanged(StateChangedType nStateChange)
Definition: window.cxx:1940
virtual Selection GetSurroundingTextSelection() const
Definition: window.cxx:3782
bool IsInputEnabled() const
Definition: window2.cxx:1153
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier *pNotifier, bool bParent=false)
Interface to register for dialog / window tunneling.
Definition: window.cxx:3178
void DecModalCount()
Definition: window.cxx:3616
bool IsMouseCaptured() const
Definition: mouse.cxx:481
bool HasActiveChildFrame() const
Definition: window.cxx:3644
const InputContext & GetInputContext() const
Definition: window2.cxx:1088
bool HasChildPathFocus(bool bSystemWindow=false) const
Definition: window.cxx:3004
bool IsTracking() const
Definition: window2.cxx:337
SAL_DLLPRIVATE void ImplCallDeactivateListeners(vcl::Window *)
Definition: window.cxx:3403
SAL_DLLPRIVATE bool ImplIsAccessibleCandidate() const
SAL_DLLPRIVATE void ImplClipBoundaries(vcl::Region &rRegion, bool bThis, bool bOverlaps)
tools::Rectangle GetDesktopRectPixel() const
Definition: window.cxx:2799
virtual const Wallpaper & GetDisplayBackground() const
Definition: window.cxx:3067
KeyIndicatorState GetIndicatorState() const
Query the states of keyboard indicators - Caps Lock, Num Lock and Scroll Lock.
Definition: window.cxx:1795
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:3676
SAL_DLLPRIVATE void ImplExcludeWindowRegion(vcl::Region &rRegion)
SAL_DLLPRIVATE tools::Rectangle ImplUnmirroredAbsoluteScreenToOutputPixel(const tools::Rectangle &rRect) const
Definition: window.cxx:2894
VclPtr< vcl::Window > GetFocusedWindow() const
Definition: window.cxx:2991
bool IsBackground() const
Definition: window3.cxx:64
const OUString & get_id() const
Get the ID of the window.
Definition: window.cxx:3935
bool IsPaintTransparent() const
Definition: window2.cxx:1063
WindowType GetType() const
Definition: window2.cxx:1000
bool SupportsDoubleBuffering() const
Can the widget derived from this Window do the double-buffering via RenderContext properly?
Definition: window.cxx:3860
SAL_DLLPRIVATE ::std::vector< VclPtr< vcl::Window > > & ImplGetOwnerDrawList()
Definition: window2.cxx:849
virtual void Tracking(const TrackingEvent &rTEvt)
Definition: window.cxx:1932
virtual void Resize()
Definition: window.cxx:1835
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Definition: window.cxx:2424
SAL_DLLPRIVATE void ImplGenerateMouseMove()
Definition: mouse.cxx:157
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1923
SAL_DLLPRIVATE bool ImplIsOverlapWindow() const
Definition: window2.cxx:962
SAL_DLLPRIVATE bool CompatNotify(NotifyEvent &rNEvt)
Definition: window.cxx:3922
SAL_DLLPRIVATE void ImplInitWinClipRegion()
void SetCursor(vcl::Cursor *pCursor)
Definition: window.cxx:3013
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:1353
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:3441
void GrabFocus()
Definition: window.cxx:2976
bool IsCompoundControl() const
Definition: window2.cxx:1219
void set_id(const OUString &rID)
Sets an ID.
Definition: window.cxx:3930
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:2981
void ReleaseLOKNotifier()
Indicate that LOK is not going to use this dialog any more.
Definition: window.cxx:3214
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
void remove_mnemonic_label(FixedText *pLabel)
Definition: window2.cxx:2013
void SetHelpHdl(const Link< vcl::Window &, bool > &rLink)
Definition: window.cxx:1861
vcl::Window * GetAccessibleParentWindow() const
virtual Point GetPosPixel() const
Definition: window.cxx:2794
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:1414
SAL_DLLPRIVATE bool CompatPreNotify(NotifyEvent &rNEvt)
Definition: window.cxx:3914
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:3636
SAL_DLLPRIVATE void ImplInvalidateParentFrameRegion(const vcl::Region &rRegion)
Definition: paint.cxx:769
void Enable(bool bEnable=true, bool bChild=true)
Definition: window.cxx:2433
Point NormalizedScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2848
SAL_DLLPRIVATE void ImplUpdateSysObjPos()
Definition: window.cxx:1445
SAL_DLLPRIVATE void CollectChildren(::std::vector< vcl::Window * > &rAllChildren)
Add all children to rAllChildren recursively.
Definition: window.cxx:2161
virtual ~Window() override
Definition: window.cxx:556
bool IsMapModeEnabled() const
Definition: window3.cxx:106
void SetFakeFocus(bool bFocus)
Set this when you need to act as if the window has focus even if it doesn't.
Definition: window.cxx:2999
void GrabFocusToDocument()
Definition: window.cxx:2986
WinBits GetStyle() const
Definition: window2.cxx:979
const AllSettings & GetSettings() const
Definition: window3.cxx:129
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2187
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1805
vcl::Window * GetAccessibleRelationLabeledBy() const
SAL_DLLPRIVATE bool ImplSetClipFlag(bool bSysObjOnlySmaller=false)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1020
void SetCompositionCharRect(const tools::Rectangle *pRect, tools::Long nCompositionLength, bool bVertical=false)
Definition: window.cxx:2147
const std::vector< VclPtr< FixedText > > & list_mnemonic_labels() const
Definition: window2.cxx:2023
virtual void Move()
Definition: window.cxx:1833
virtual OUString GetSurroundingText() const
Definition: window.cxx:3777
const OUString & GetHelpId() const
Definition: window2.cxx:859
virtual bool PreNotify(NotifyEvent &rNEvt)
Definition: event.cxx:52
SAL_DLLPRIVATE vcl::Window * ImplGetParent() const
Definition: window2.cxx:896
vcl::Font GetPointFont(vcl::RenderContext const &rRenderContext) const
Definition: window.cxx:2180
SAL_DLLPRIVATE void ImplResetReallyVisible()
Definition: stacking.cxx:707
tools::Long CalcTitleWidth() const
Definition: window.cxx:2048
const MapMode & GetMapMode() const
Definition: window3.cxx:99
bool IsDialog() const
Definition: window2.cxx:1028
SAL_DLLPRIVATE vcl::Window * ImplGetFirstOverlapWindow()
Definition: window2.cxx:911
VclPtr< vcl::Window > GetParentWithLOKNotifier()
Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set.
Definition: window.cxx:3256
Window(WindowType nType)
Definition: window.cxx:95
SAL_DLLPRIVATE void ImplCallActivateListeners(vcl::Window *)
Definition: window.cxx:3421
::OutputDevice const * GetOutDev() const
Definition: window.cxx:567
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
Definition: window.cxx:2666
Color GetBackgroundColor() const
Definition: window3.cxx:214
virtual OUString GetDisplayText() const
Definition: window.cxx:3061
SAL_DLLPRIVATE void ImplRemoveWindow(bool bRemoveFrameData)
Definition: stacking.cxx:113
const vcl::Font & GetFont() const
Definition: window3.cxx:58
SAL_DLLPRIVATE float approximate_char_width() const
Definition: window3.cxx:61
const vcl::ILibreOfficeKitNotifier * GetLOKNotifier() const
Definition: window.cxx:3246
void Hide()
Definition: window.hxx:879
bool IsInModalMode() const
A window is in modal mode if one of its children or subchildren is a running modal window (a modal di...
Definition: window.cxx:3597
SAL_DLLPRIVATE void ImplSetReallyVisible()
Definition: window.cxx:1307
SAL_DLLPRIVATE void CompatDataChanged(const DataChangedEvent &rDCEvt)
Definition: window.cxx:3906
SAL_DLLPRIVATE void ImplCallMove()
Definition: event.cxx:532
void RequestDoubleBuffering(bool bRequest)
Enable/disable double-buffering of the frame window and all its children.
Definition: window.cxx:3865
SAL_DLLPRIVATE ImplWinData * ImplGetWinData() const
Definition: window.cxx:1226
virtual bool DeleteSurroundingText(const Selection &rSelection)
Definition: window.cxx:3811
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
Definition: window.hxx:528
SAL_DLLPRIVATE void ImplInitResolutionSettings()
Definition: window.cxx:1347
SAL_DLLPRIVATE void ImplUpdateSysObjClip()
SAL_DLLPRIVATE void ImplMirrorFramePos(Point &pt) const
Definition: window.cxx:3591
SAL_DLLPRIVATE void CompatLoseFocus()
Definition: window.cxx:3890
static bool IsLOKWindowsEmpty()
check if LOK Window container is empty
Definition: window.cxx:3209
void RecordLayoutData(vcl::ControlLayoutData *pLayout, const tools::Rectangle &rRect)
Definition: window.cxx:3456
virtual css::uno::Reference< css::awt::XVclWindowPeer > GetComponentInterface(bool bCreate=true)
Definition: window.cxx:3145
SAL_DLLPRIVATE void ImplIsInTaskPaneList(bool mbIsInTaskList)
Definition: window.cxx:3631
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:484
vcl::LOKWindowId GetLOKWindowId() const
Definition: window.cxx:3251
SalFrame * ImplGetFrame() const
Definition: window2.cxx:879
void ReleaseMouse()
Definition: mouse.cxx:469
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
Definition: window.cxx:2944
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
Definition: window.cxx:3356
bool IsSystemWindow() const
Definition: window2.cxx:1023
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
virtual Size GetSizePixel() const
Definition: window.cxx:2402
Size GetOutputSizePixel() const
Definition: window3.cxx:89
virtual void Deactivate()
Definition: window.cxx:1839
SAL_DLLPRIVATE void ImplLogicToPoint(vcl::RenderContext const &rRenderContext, vcl::Font &rFont) const
Definition: window.cxx:1396
virtual void Draw(::OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags)
Definition: window.cxx:1829
SAL_DLLPRIVATE void ImplFocusToTop(ToTopFlags nFlags, bool bReallyVisible)
Definition: stacking.cxx:362
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
WindowBorderStyle GetBorderStyle() const
Definition: window.cxx:2034
SAL_DLLPRIVATE void ImplDlgCtrlNextWindow()
Definition: dlgctrl.cxx:1003
virtual void LoseFocus()
Definition: window.cxx:1855
virtual void ImplInvalidate(const vcl::Region *pRegion, InvalidateFlags nFlags)
Definition: paint.cxx:780
void DrawSelectionBackground(const tools::Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder)
Definition: window.cxx:3465
void remove_from_all_size_groups()
Definition: window2.cxx:1991
vcl::Window * GetAccessibleRelationLabelFor() const
void SetPointFont(vcl::RenderContext &rRenderContext, const vcl::Font &rFont)
Definition: window.cxx:2173
const tools::Rectangle * GetCursorRect() const
Definition: window.cxx:2133
SAL_DLLPRIVATE bool ImplIsFloatingWindow() const
Definition: window2.cxx:947
virtual void ApplySettings(vcl::RenderContext &rRenderContext)
Definition: window.cxx:3850
virtual void Activate()
Definition: window.cxx:1837
void PostExtTextInputEvent(VclEventId nType, const OUString &rText)
Definition: window.cxx:2084
bool IsTopWindow() const
Definition: stacking.cxx:609
static VclPtr< vcl::Window > FindLOKWindow(vcl::LOKWindowId nWindowId)
Find an existing Window based on the LOKWindowId.
Definition: window.cxx:3200
void AlwaysEnableInput(bool bAlways, bool bChild=true)
Override EnableInput.
Definition: window.cxx:2608
bool HasPaintEvent() const
Definition: paint.cxx:1241
SAL_DLLPRIVATE void ImplCallResize()
Definition: event.cxx:517
SAL_DLLPRIVATE void ImplCallInitShow()
Definition: event.cxx:492
bool IsVisible() const
Definition: window2.cxx:1128
void SetWindowPeer(css::uno::Reference< css::awt::XVclWindowPeer > const &xPeer, VCLXWindow *pVCLXWindow)
Definition: window.cxx:3124
void IncModalCount()
Definition: window.cxx:3602
tools::Long GetCursorExtTextInputWidth() const
Definition: window.cxx:2140
SAL_DLLPRIVATE void ImplMoveAllInvalidateRegions(const tools::Rectangle &rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren)
Definition: paint.cxx:883
virtual void KeyUp(const KeyEvent &rKEvt)
Definition: window.cxx:1822
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
Definition: window.cxx:2855
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: event.cxx:219
virtual void SetText(const OUString &rStr)
Definition: window.cxx:3026
virtual OUString GetText() const
Definition: window.cxx:3055
SAL_DLLPRIVATE void ImplUpdateGlobalSettings(AllSettings &rSettings, bool bCallHdl=true) const
bool IsScrollable() const
Definition: window.cxx:3577
css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard()
Definition: window.cxx:3447
tools::Rectangle GetOutputRectPixel() const
Definition: window3.cxx:91
void SetBorderStyle(WindowBorderStyle nBorderStyle)
Definition: window.cxx:1994
SAL_DLLPRIVATE tools::Long ImplGetUnmirroredOutOffX() const
Definition: window.cxx:2818
vcl::Window * ImplGetWindow() const
if this is a proxy return the client, otherwise itself
Definition: window2.cxx:866
void SetComponentInterface(css::uno::Reference< css::awt::XVclWindowPeer > const &xIFace)
Definition: window.cxx:3156
Point ScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2812
virtual bool EventNotify(NotifyEvent &rNEvt)
Definition: event.cxx:104
SAL_DLLPRIVATE void ImplShowAllOverlaps()
Definition: stacking.cxx:389
void EnableNativeWidget(bool bEnable=true)
Definition: window.cxx:3681
const OUString & GetQuickHelpText() const
Definition: window2.cxx:1258
tools::Rectangle GetWindowExtentsRelative(const vcl::Window &rRelativeWindow) const
Definition: window.cxx:2914
void EndExtTextInput()
Definition: window.cxx:2106
void SetExtendedStyle(WindowExtendedStyle nExtendedStyle)
Definition: window.cxx:1972
void SetDumpAsPropertyTreeHdl(const Link< tools::JsonWriter &, void > &rLink)
Definition: window.cxx:1782
SAL_DLLPRIVATE SalGraphics * ImplGetFrameGraphics() const
Definition: window.cxx:1289
bool IsActive() const
Definition: window2.cxx:1209
SAL_DLLPRIVATE void ImplInvalidateFrameRegion(const vcl::Region *pRegion, InvalidateFlags nFlags)
Definition: paint.cxx:689
bool IsEnabled() const
Definition: window2.cxx:1148
SAL_DLLPRIVATE void ImplGrabFocusToDocument(GetFocusFlags nFlags)
Definition: mouse.cxx:399
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:941
const OUString & GetHelpText() const
Definition: window.cxx:3090
void SetModalHierarchyHdl(const Link< bool, void > &rLink)
Definition: window.cxx:1790
void EnableInput(bool bEnable=true, bool bChild=true)
Definition: window.cxx:2493
void SetTextColor(const Color &rColor)
Definition: window3.cxx:108
virtual const SystemEnvData * GetSystemData() const
Definition: window.cxx:3854
SAL_DLLPRIVATE void CompatGetFocus()
Definition: window.cxx:3882
SAL_DLLPRIVATE bool ImplIsAccessibleNativeFrame() const
virtual FactoryFunction GetUITestFactory() const
Definition: window.cxx:3941
SAL_DLLPRIVATE bool ImplIsRealParentPath(const vcl::Window *pWindow) const
Definition: stacking.cxx:670
Point OutputToNormalizedScreenPixel(const Point &rPos) const
Definition: window.cxx:2841
void SetBackground()
Definition: window3.cxx:100
SAL_DLLPRIVATE void CompatStateChanged(StateChangedType nStateChange)
Definition: window.cxx:3898
constexpr ::Color COL_GRAY(0x80, 0x80, 0x80)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
ExtTextInputAttr
#define EXTTEXTINPUT_CURSOR_OVERWRITE
#define DBG_TESTSOLARMUTEX()
#define TOOLS_WARN_EXCEPTION(area, stream)
GraphicsSharedPtr mpGraphics
DocumentType eType
void ImplDestroyHelpWindow(bool bUpdateHideTime)
Definition: help.cxx:563
#define OOO_HELP_INDEX
Definition: help.hxx:53
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
void * p
KeyIndicatorState
Definition: keycodes.hxx:187
constexpr sal_uInt16 KEY_MOD2
Definition: keycodes.hxx:32
constexpr sal_uInt16 KEY_MOD1
Definition: keycodes.hxx:31
#define LANGUAGE_ENGLISH_US
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
WINDOW
NONE
@ Exception
Reference< XComponentContext > getProcessComponentContext()
int i
enumrange< T >::Iterator begin(enumrange< T >)
end
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
long Long
static sal_Int32 CountDPIScaleFactor(sal_Int32 nDPI)
Definition: window.cxx:920
sal_uInt32 LOKWindowId
std::map< vcl::LOKWindowId, VclPtr< vcl::Window > > LOKWindowsMap
Definition: window.cxx:3164
sal_Int32 h
SwNodeOffset abs(const SwNodeOffset &a)
@ OUTDEV_WINDOW
Definition: outdev.hxx:145
QPRO_FUNC_TYPE nType
#define SAL_FRAME_POSSIZE_X
Definition: salframe.hxx:103
sal_uInt64 SalExtStyle
Definition: salframe.hxx:95
#define SAL_FRAME_EXT_STYLE_DOCUMENT
Definition: salframe.hxx:99
#define SAL_FRAME_EXT_STYLE_DOCMODIFIED
Definition: salframe.hxx:100
#define SAL_FRAME_POSSIZE_HEIGHT
Definition: salframe.hxx:106
#define SAL_FRAME_POSSIZE_WIDTH
Definition: salframe.hxx:105
#define SAL_FRAME_POSSIZE_Y
Definition: salframe.hxx:104
SalFrameStyleFlags
Definition: salframe.hxx:65
@ EndExtTextInput
VclPtr< vcl::Window > mpTrackWin
Definition: window.h:139
bool mbDragging
Definition: window.h:179
tools::Long mnBeforeLastMouseX
Definition: window.h:149
Idle maResizeIdle
Definition: window.h:132
bool mbNeedSysWindow
Definition: window.h:165
sal_uInt64 mnMouseDownTime
Definition: window.h:156
bool mbInMouseMove
Definition: window.h:162
sal_Int32 mnTouchPanPosition
Definition: window.h:171
ImplFrameData(vcl::Window *pWindow)
Definition: window.cxx:764
bool mbStartFocusState
Definition: window.h:167
MouseEventModifiers mnMouseMode
Definition: window.h:160
bool mbStartDragCalled
Definition: window.h:164
bool mbInBufferedPaint
PaintHelper is in the process of painting into this buffer.
Definition: window.h:181
bool mbInSysObjToTopHdl
Definition: window.h:169
tools::Long mnFirstMouseY
Definition: window.h:152
std::shared_ptr< vcl::font::PhysicalFontCollection > mxFontCollection
Definition: window.h:141
tools::Long mnLastMouseY
Definition: window.h:148
sal_uInt16 mnMouseCode
Definition: window.h:159
VclPtr< vcl::Window > mpMouseMoveWin
Definition: window.h:137
tools::Long mnBeforeLastMouseY
Definition: window.h:150
tools::Long mnLastMouseX
Definition: window.h:147
sal_Int32 mnDPIX
Definition: window.h:143
std::shared_ptr< ImplFontCache > mxFontCache
Definition: window.h:142
Idle maPaintIdle
Definition: window.h:131
ImplSVEvent * mnMouseMoveId
Definition: window.h:146
bool mbInSysObjFocusHdl
Definition: window.h:168
ImplSVEvent * mnFocusId
Definition: window.h:145
tools::Long mnLastMouseWinY
Definition: window.h:154
sal_Int32 mnDPIY
Definition: window.h:144
VclPtr< vcl::Window > mpMouseDownWin
Definition: window.h:138
bool mbMouseIn
Definition: window.h:163
bool mbSysObjFocus
Definition: window.h:170
sal_uInt16 mnClickCount
Definition: window.h:157
tools::Long mnFirstMouseX
Definition: window.h:151
sal_uInt16 mnModalMode
Definition: window.h:155
VclPtr< vcl::Window > mpNextFrame
Definition: window.h:134
VclPtr< vcl::Window > mpFirstOverlap
Definition: window.h:135
bool mbMinimized
Definition: window.h:166
VclPtr< vcl::Window > mpFocusWin
Definition: window.h:136
bool mbHasFocus
Definition: window.h:161
sal_uInt16 mnFirstMouseCode
Definition: window.h:158
bool mbInternalDragGestureRecognizer
Definition: window.h:178
tools::Long mnLastMouseWinX
Definition: window.h:153
std::optional< AllSettings > mxSettings
Definition: svdata.hxx:144
bool mbSettingsInit
Definition: svdata.hxx:165
ImplSVFrameData maFrameData
Definition: svdata.hxx:399
SalInstance * mpDefInst
Definition: svdata.hxx:389
ImplSVNWFData maNWFData
Definition: svdata.hxx:403
ImplSVGDIData maGDIData
Definition: svdata.hxx:398
ImplSVWinData * mpWinData
Definition: svdata.hxx:400
ImplSVAppData maAppData
Definition: svdata.hxx:397
VclPtr< vcl::Window > mpIntroWindow
Definition: svdata.hxx:405
VclPtr< vcl::Window > mpFirstFrame
Definition: svdata.hxx:241
VclPtr< vcl::Window > mpActiveApplicationFrame
Definition: svdata.hxx:242
VclPtr< vcl::WindowOutputDevice > mpLastWinGraphics
Definition: svdata.hxx:216
std::shared_ptr< vcl::font::PhysicalFontCollection > mxScreenFontList
Definition: svdata.hxx:225
tools::Long mnAppFontY
Definition: svdata.hxx:231
std::shared_ptr< ImplFontCache > mxScreenFontCache
Definition: svdata.hxx:226
tools::Long mnAppFontX
Definition: svdata.hxx:230
VclPtr< vcl::WindowOutputDevice > mpFirstWinGraphics
Definition: svdata.hxx:215
bool mbNoFocusRects
Definition: svdata.hxx:325
bool mbAutoAccel
Definition: svdata.hxx:339
VclPtr< vcl::Window > mpLastWheelWindow
Definition: svdata.hxx:261
VclPtr< vcl::Window > mpLastDeacWin
Definition: svdata.hxx:253
VclPtr< vcl::Window > mpFocusWin
Definition: svdata.hxx:251
VclPtr< vcl::Window > mpTrackWin
Definition: svdata.hxx:257
VclPtr< vcl::Window > mpExtTextInputWin
Definition: svdata.hxx:256
Wallpaper maDisplayBackground
Definition: toolbox.h:142
tools::Long mnCompositionCharRects
Definition: window.h:113
std::unique_ptr< tools::Rectangle[]> mpCompositionCharRects
Definition: window.h:112
std::optional< tools::Rectangle > mpCursorRect
Definition: window.h:108
bool mbEnableNativeWidget
Definition: window.h:121
::std::list< VclPtr< vcl::Window > > maTopWindowChildren
Definition: window.h:123
~ImplWinData()
Definition: window.cxx:759
bool mbVertical
Definition: window.h:110
tools::Long mnCursorExtWidth
Definition: window.h:109
rtl::Reference< LogicalFontInstance > mpFont
Definition: salwtype.hxx:243
InputContextFlags mnOptions
Definition: salwtype.hxx:244
tools::Long mnDestY
Definition: salgtype.hxx:44
tools::Long mnSrcX
Definition: salgtype.hxx:39
tools::Long mnDestWidth
Definition: salgtype.hxx:45
tools::Long mnSrcHeight
Definition: salgtype.hxx:42
tools::Long mnSrcWidth
Definition: salgtype.hxx:41
tools::Long mnSrcY
Definition: salgtype.hxx:40
tools::Long mnDestHeight
Definition: salgtype.hxx:46
tools::Long mnDestX
Definition: salgtype.hxx:43
Application * GetpApp()
Definition: svapp.cxx:154
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:77
ImplSVHelpData & ImplGetSVHelpData()
Definition: svdata.cxx:507
DockingManager * ImplGetDockingManager()
Definition: svdata.cxx:316
@ RESIZE
Resize runs before repaint, so we won't paint twice.
@ REPAINT
All repaint events should go in here.
bool bVisible
Reference< XClipboard > GetSystemClipboard()
Definition: transfer2.cxx:459
ShowFlags
Definition: vclenum.hxx:346
WindowBorderStyle
Definition: vclenum.hxx:107
VclEventId
Definition: vclevent.hxx:38
@ WindowChildDestroyed
@ WindowFrameTitleChanged
@ AlwaysInputEnabled
Definition: window.h:201
@ AlwaysInputNone
Definition: window.h:201
ShowTrackFlags
Definition: window.hxx:248
PosSizeFlags
Definition: window.hxx:127
ActivateModeFlags
Definition: window.hxx:160
StateChangedType
Definition: window.hxx:291
InvalidateFlags
Definition: window.hxx:186
@ Children
The child windows are invalidated, too.
@ NoTransparent
The parent window is not invalidated.
ScrollFlags
Definition: window.hxx:222
WindowExtendedStyle
Definition: window.hxx:413
bool ImplWindowFrameProc(vcl::Window *_pWindow, SalEvent nEvent, const void *pEvent)
Definition: winproc.cxx:2653
void ImplHandleResize(vcl::Window *pWindow, tools::Long nNewWidth, tools::Long nNewHeight)
Definition: winproc.cxx:1912
sal_Int64 WinBits
Definition: wintypes.hxx:109
WinBits const WB_CLOSEABLE
Definition: wintypes.hxx:123
WinBits const WB_MOVEABLE
Definition: wintypes.hxx:122
WinBits const WB_DIALOGCONTROL
Definition: wintypes.hxx:113
WinBits const WB_OWNERDRAWDECORATION
Definition: wintypes.hxx:173
WindowType
Definition: wintypes.hxx:27
@ TOOLKIT_FRAMEWINDOW
@ VERTICALTABCONTROL
@ TOOLKIT_SYSTEMCHILDWINDOW
WinBits const WB_SYSTEMCHILDWINDOW
Definition: wintypes.hxx:136
WinBits const WB_SIZEABLE
Definition: wintypes.hxx:117
WinBits const WB_APP
Definition: wintypes.hxx:125
WinBits const WB_3DLOOK
Definition: wintypes.hxx:118
WinBits const WB_DEFAULTWIN
Definition: wintypes.hxx:174
WinBits const WB_BORDER
Definition: wintypes.hxx:115
WinBits const WB_SYSTEMFLOATWIN
Definition: wintypes.hxx:169
WinBits const WB_INTROWIN
Definition: wintypes.hxx:170
WinBits const WB_NODIALOGCONTROL
Definition: wintypes.hxx:114
WinBits const WB_TOOLTIPWIN
Definition: wintypes.hxx:172
WinBits const WB_NOSHADOW
Definition: wintypes.hxx:171