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