1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_WINDOW_HXX
21 #define INCLUDED_VCL_WINDOW_HXX
23 #include <vcl/dllapi.h>
24 #include <vcl/outdev.hxx>
25 #include <tools/link.hxx>
26 #include <vcl/wintypes.hxx>
27 #include <vcl/vclenum.hxx>
28 #include <vcl/keycodes.hxx>
29 #include <vcl/region.hxx>
30 #include <vcl/uitest/factory.hxx>
31 #include <vcl/IDialogRenderable.hxx>
32 #include <rtl/ustring.hxx>
33 #include <com/sun/star/uno/Reference.hxx>
40 struct ImplCalcToTopData
;
42 struct SystemParentData
;
43 class ImplBorderWindow
;
54 class DataChangedEvent
;
59 class MenuFloatingWindow
;
64 class VclEventListeners
;
65 enum class ImplPaintFlags
;
66 enum class VclEventId
;
67 enum class PointerStyle
;
69 namespace com::sun::star
{
70 namespace accessibility
{
71 struct AccessibleRelation
;
84 namespace datatransfer::clipboard
{
87 namespace datatransfer::dnd
{
88 class XDragGestureRecognizer
;
95 struct ControlLayoutData
;
98 namespace svt
{ class PopupWindowControllerImpl
; }
100 namespace weld
{ class Window
; }
102 template<class T
> class VclPtr
;
103 namespace tools
{ class JsonWriter
; }
105 // Type for GetWindow()
106 enum class GetWindowType
120 FirstTopWindowChild
= 13,
121 NextTopWindowSibling
= 16,
124 // Flags for setPosSizePixel()
125 // These must match the definitions in css::awt::PosSize
126 enum class PosSizeFlags
134 Size
= Width
| Height
,
135 PosSize
= Pos
| Size
,
141 template<> struct typed_flags
<PosSizeFlags
> : is_typed_flags
<PosSizeFlags
, 0x000f> {};
144 // Flags for SetZOrder()
145 enum class ZOrderFlags
155 template<> struct typed_flags
<ZOrderFlags
> : is_typed_flags
<ZOrderFlags
, 0x000f> {};
159 enum class ActivateModeFlags
166 template<> struct typed_flags
<ActivateModeFlags
> : is_typed_flags
<ActivateModeFlags
, 0x0001> {};
170 enum class ToTopFlags
173 RestoreWhenMin
= 0x0001,
174 ForegroundTask
= 0x0002,
175 NoGrabFocus
= 0x0004,
176 GrabFocusOnly
= 0x0008,
180 template<> struct typed_flags
<ToTopFlags
> : is_typed_flags
<ToTopFlags
, 0x000f> {};
183 // Flags for Invalidate
184 // must match css::awt::InvalidateStyle
185 enum class InvalidateFlags
188 /** The child windows are invalidated, too. */
190 /** The child windows are not invalidated. */
192 /** The invalidated area is painted with the background color/pattern. */
194 /** The invalidated area is updated immediately. */
196 /** The parent window is invalidated, too. */
197 Transparent
= 0x0010,
198 /** The parent window is not invalidated. */
199 NoTransparent
= 0x0020,
200 /** The area is invalidated regardless of overlapping child windows. */
201 NoClipChildren
= 0x4000,
205 template<> struct typed_flags
<InvalidateFlags
> : is_typed_flags
<InvalidateFlags
, 0x403f> {};
208 // Flags for Validate
209 enum class ValidateFlags
217 template<> struct typed_flags
<ValidateFlags
> : is_typed_flags
<ValidateFlags
, 0x0003> {};
221 enum class ScrollFlags
227 UseClipRegion
= 0x0008,
232 template<> struct typed_flags
<ScrollFlags
> : is_typed_flags
<ScrollFlags
, 0x001f> {};
235 // Flags for ParentClipMode
236 enum class ParentClipMode
244 template<> struct typed_flags
<ParentClipMode
> : is_typed_flags
<ParentClipMode
, 0x0003> {};
247 // Flags for ShowTracking()
248 enum class ShowTrackFlags
{
255 TrackWindow
= 0x1000,
260 template<> struct typed_flags
<ShowTrackFlags
> : is_typed_flags
<ShowTrackFlags
, 0x300f> {};
263 // Flags for StartTracking()
264 enum class StartTrackingFlags
268 ScrollRepeat
= 0x0004,
269 ButtonRepeat
= 0x0008,
274 template<> struct typed_flags
<StartTrackingFlags
> : is_typed_flags
<StartTrackingFlags
, 0x000f> {};
277 // Flags for StartAutoScroll()
278 enum class StartAutoScrollFlags
286 template<> struct typed_flags
<StartAutoScrollFlags
> : is_typed_flags
<StartAutoScrollFlags
, 0x0003> {};
289 // Flags for StateChanged()
290 enum class StateChangedType
: sal_uInt16
302 ControlForeground
= 14,
303 ControlBackground
= 15,
311 // must match constants in css:awt::FocusChangeReason
312 enum class GetFocusFlags
316 CURSOR
= 0x0002, // avoid name-clash with X11 #define
322 UniqueMnemonic
= 0x0100,
324 FloatWinPopupModeEndCancel
= 0x0400,
328 template<> struct typed_flags
<GetFocusFlags
> : is_typed_flags
<GetFocusFlags
, 0x077f> {};
331 // DialogControl-Flags
332 enum class DialogControlFlags
337 FloatWinPopupModeEndCancel
= 0x0004,
341 template<> struct typed_flags
<DialogControlFlags
> : is_typed_flags
<DialogControlFlags
, 0x0007> {};
344 // EndExtTextInput() Flags
345 enum class EndExtTextInputFlags
352 template<> struct typed_flags
<EndExtTextInputFlags
> : is_typed_flags
<EndExtTextInputFlags
, 0x0001> {};
355 #define IMPL_MINSIZE_BUTTON_WIDTH 70
356 #define IMPL_MINSIZE_BUTTON_HEIGHT 22
357 #define IMPL_EXTRA_BUTTON_WIDTH 18
358 #define IMPL_EXTRA_BUTTON_HEIGHT 10
359 #define IMPL_SEP_BUTTON_X 5
360 #define IMPL_SEP_BUTTON_Y 5
361 #define IMPL_MINSIZE_MSGBOX_WIDTH 150
362 #define IMPL_DIALOG_OFFSET 5
363 #define IMPL_DIALOG_BAR_OFFSET 3
364 #define IMPL_MSGBOX_OFFSET_EXTRA_X 0
365 #define IMPL_MSGBOX_OFFSET_EXTRA_Y 2
366 #define IMPL_SEP_MSGBOX_IMAGE 8
368 // ImplGetDlgWindow()
369 enum class GetDlgWindowType
376 const char* ImplDbgCheckWindow( const void* pObj
);
379 namespace vcl
{ class Window
; }
380 namespace vcl
{ class Cursor
; }
381 namespace vcl
{ class WindowOutputDevice
; }
392 class FloatingWindow
;
396 class SalInstanceWidget
;
397 class SystemChildWindow
;
398 class ImplDockingWindowWrapper
;
399 class ImplPopupFloatWin
;
403 enum class WindowHitTest
{
409 template<> struct typed_flags
<WindowHitTest
> : is_typed_flags
<WindowHitTest
, 0x0003> {};
413 enum class WindowExtendedStyle
{
416 DocModified
= 0x0002,
418 * This is a frame window that is requested to be hidden (not just "not yet
424 template<> struct typed_flags
<WindowExtendedStyle
> : is_typed_flags
<WindowExtendedStyle
, 0x0007> {};
432 // transparent background for selected or checked items in toolboxes etc.
433 // + selection Color with a text color complementing the selection background
435 static void DrawSelectionBackground(vcl::RenderContext
& rRenderContext
, vcl::Window
const & rWindow
,
436 const tools::Rectangle
& rRect
, sal_uInt16 nHighlight
,
437 bool bChecked
, bool bDrawBorder
, bool bDrawExtBorderOnly
,
438 Color
* pSelectionTextColor
= nullptr, tools::Long nCornerRadius
= 0,
439 Color
const * pPaintColor
= nullptr);
442 class VCL_DLLPUBLIC Window
: public virtual VclReferenceBase
444 friend class ::vcl::Cursor
;
445 friend class ::vcl::WindowOutputDevice
;
446 friend class ::OutputDevice
;
447 friend class ::Application
;
448 friend class ::SystemWindow
;
449 friend class ::WorkWindow
;
450 friend class ::Dialog
;
452 friend class ::MessBox
;
453 friend class ::MessageDialog
;
454 friend class ::DockingWindow
;
455 friend class ::FloatingWindow
;
456 friend class ::GroupBox
;
457 friend class ::PushButton
;
458 friend class ::RadioButton
;
459 friend class ::SalInstanceWidget
;
460 friend class ::SystemChildWindow
;
461 friend class ::ImplBorderWindow
;
462 friend class ::PaintHelper
;
463 friend class ::LifecycleTest
;
464 friend class ::VclEventListeners
;
466 // TODO: improve missing functionality
467 // only required because of SetFloatingMode()
468 friend class ::ImplDockingWindowWrapper
;
469 friend class ::ImplPopupFloatWin
;
470 friend class ::MenuFloatingWindow
;
472 friend class ::svt::PopupWindowControllerImpl
;
475 // NOTE: to remove many dependencies of other modules
476 // to this central file, all members are now hidden
477 // in the WindowImpl class and all inline functions
479 // (WindowImpl is a pImpl pattern)
481 // Please do *not* add new members or inline functions to class Window,
482 // but use class WindowImpl instead
484 std::unique_ptr
<WindowImpl
> mpWindowImpl
;
487 friend const char* ::ImplDbgCheckWindow( const void* pObj
);
492 DECL_DLLPRIVATE_LINK( ImplHandlePaintHdl
, Timer
*, void );
493 DECL_DLLPRIVATE_LINK( ImplGenerateMouseMoveHdl
, void*, void );
494 DECL_DLLPRIVATE_LINK( ImplTrackTimerHdl
, Timer
*, void );
495 DECL_DLLPRIVATE_LINK( ImplAsyncFocusHdl
, void*, void );
496 DECL_DLLPRIVATE_LINK( ImplHandleResizeTimerHdl
, Timer
*, void );
499 SAL_DLLPRIVATE
static void ImplInitAppFontData( vcl::Window
const * pWindow
);
501 SAL_DLLPRIVATE
vcl::Window
* ImplGetFrameWindow() const;
502 weld::Window
* GetFrameWeld() const;
503 vcl::Window
* GetFrameWindow() const;
504 SalFrame
* ImplGetFrame() const;
505 SAL_DLLPRIVATE ImplFrameData
* ImplGetFrameData();
507 vcl::Window
* ImplGetWindow() const; ///< if this is a proxy return the client, otherwise itself
508 SAL_DLLPRIVATE ImplWinData
* ImplGetWinData() const;
509 SAL_DLLPRIVATE
vcl::Window
* ImplGetClientWindow() const;
510 SAL_DLLPRIVATE
vcl::Window
* ImplGetDlgWindow( sal_uInt16 n
, GetDlgWindowType nType
, sal_uInt16 nStart
= 0, sal_uInt16 nEnd
= 0xFFFF, sal_uInt16
* pIndex
= nullptr );
511 SAL_DLLPRIVATE
vcl::Window
* ImplGetParent() const;
512 SAL_DLLPRIVATE
vcl::Window
* ImplFindWindow( const Point
& rFramePos
);
514 SAL_DLLPRIVATE
void ImplInvalidateFrameRegion( const vcl::Region
* pRegion
, InvalidateFlags nFlags
);
515 SAL_DLLPRIVATE
void ImplInvalidateOverlapFrameRegion( const vcl::Region
& rRegion
);
517 SAL_DLLPRIVATE
bool ImplSetClipFlag( bool bSysObjOnlySmaller
= false );
519 SAL_DLLPRIVATE
bool ImplIsWindowOrChild( const vcl::Window
* pWindow
, bool bSystemWindow
= false ) const;
520 SAL_DLLPRIVATE
bool ImplIsChild( const vcl::Window
* pWindow
, bool bSystemWindow
= false ) const;
521 SAL_DLLPRIVATE
bool ImplIsFloatingWindow() const;
522 SAL_DLLPRIVATE
bool ImplIsPushButton() const;
523 SAL_DLLPRIVATE
bool ImplIsSplitter() const;
524 SAL_DLLPRIVATE
bool ImplIsOverlapWindow() const;
526 SAL_DLLPRIVATE
void ImplIsInTaskPaneList( bool mbIsInTaskList
);
528 SAL_DLLPRIVATE WindowImpl
* ImplGetWindowImpl() const { return mpWindowImpl
.get(); }
530 SAL_DLLPRIVATE Point
ImplFrameToOutput( const Point
& rPos
);
532 SAL_DLLPRIVATE
void ImplGrabFocus( GetFocusFlags nFlags
);
533 SAL_DLLPRIVATE
void ImplGrabFocusToDocument( GetFocusFlags nFlags
);
534 SAL_DLLPRIVATE
void ImplInvertFocus( const tools::Rectangle
& rRect
);
536 SAL_DLLPRIVATE PointerStyle
ImplGetMousePointer() const;
537 SAL_DLLPRIVATE
void ImplCallMouseMove( sal_uInt16 nMouseCode
, bool bModChanged
= false );
538 SAL_DLLPRIVATE
void ImplGenerateMouseMove();
540 SAL_DLLPRIVATE
void ImplNotifyKeyMouseCommandEventListeners( NotifyEvent
& rNEvt
);
541 SAL_DLLPRIVATE
void ImplNotifyIconifiedState( bool bIconified
);
543 SAL_DLLPRIVATE
void ImplUpdateAll();
545 SAL_DLLPRIVATE
void ImplControlFocus( GetFocusFlags nFlags
= GetFocusFlags::NONE
);
547 SAL_DLLPRIVATE
void ImplMirrorFramePos( Point
&pt
) const;
549 SAL_DLLPRIVATE
void ImplPosSizeWindow( tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
, PosSizeFlags nFlags
);
551 SAL_DLLPRIVATE
void ImplCallResize();
552 SAL_DLLPRIVATE
void ImplCallMove();
554 // These methods call the relevant virtual method when not in/post dispose
555 SAL_DLLPRIVATE
void CompatGetFocus();
556 SAL_DLLPRIVATE
void CompatLoseFocus();
557 SAL_DLLPRIVATE
void CompatStateChanged( StateChangedType nStateChange
);
558 SAL_DLLPRIVATE
void CompatDataChanged( const DataChangedEvent
& rDCEvt
);
559 SAL_DLLPRIVATE
bool CompatPreNotify( NotifyEvent
& rNEvt
);
560 SAL_DLLPRIVATE
bool CompatNotify( NotifyEvent
& rNEvt
);
562 void IncModalCount();
563 void DecModalCount();
565 SAL_DLLPRIVATE
static void ImplCalcSymbolRect( tools::Rectangle
& rRect
);
569 /** This is intended to be used to clear any locally held references to other Window-subclass objects */
570 virtual void dispose() override
;
572 SAL_DLLPRIVATE
void ImplInit( vcl::Window
* pParent
, WinBits nStyle
, SystemParentData
* pSystemParentData
);
574 SAL_DLLPRIVATE Point
ImplOutputToFrame( const Point
& rPos
);
576 SAL_DLLPRIVATE
void ImplInvalidateParentFrameRegion( const vcl::Region
& rRegion
);
577 SAL_DLLPRIVATE
void ImplValidateFrameRegion( const vcl::Region
* rRegion
, ValidateFlags nFlags
);
578 SAL_DLLPRIVATE
void ImplValidate();
579 SAL_DLLPRIVATE
void ImplMoveInvalidateRegion( const tools::Rectangle
& rRect
, tools::Long nHorzScroll
, tools::Long nVertScroll
, bool bChildren
);
580 SAL_DLLPRIVATE
void ImplMoveAllInvalidateRegions( const tools::Rectangle
& rRect
, tools::Long nHorzScroll
, tools::Long nVertScroll
, bool bChildren
);
582 SAL_DLLPRIVATE
vcl::Window
* ImplGetBorderWindow() const;
584 SAL_DLLPRIVATE
void ImplInvalidate( const vcl::Region
* rRegion
, InvalidateFlags nFlags
);
586 virtual WindowHitTest
ImplHitTest( const Point
& rFramePos
);
588 SAL_DLLPRIVATE
void ImplSetMouseTransparent( bool bTransparent
);
590 SAL_DLLPRIVATE
void ImplScroll( const tools::Rectangle
& rRect
, tools::Long nHorzScroll
, tools::Long nVertScroll
, ScrollFlags nFlags
);
592 SAL_DLLPRIVATE
bool ImplSetClipFlagChildren( bool bSysObjOnlySmaller
);
593 SAL_DLLPRIVATE
bool ImplSetClipFlagOverlapWindows( bool bSysObjOnlySmaller
= false );
595 SAL_DLLPRIVATE
void PushPaintHelper(PaintHelper
* pHelper
, vcl::RenderContext
& rRenderContext
);
596 SAL_DLLPRIVATE
void PopPaintHelper(PaintHelper
const * pHelper
);
600 SAL_DLLPRIVATE
void ImplSetFrameParent( const vcl::Window
* pParent
);
602 SAL_DLLPRIVATE
void ImplInsertWindow( vcl::Window
* pParent
);
603 SAL_DLLPRIVATE
void ImplRemoveWindow( bool bRemoveFrameData
);
605 SAL_DLLPRIVATE SalGraphics
* ImplGetFrameGraphics() const;
607 SAL_DLLPRIVATE
static void ImplCallFocusChangeActivate( vcl::Window
* pNewOverlapWindow
, vcl::Window
* pOldOverlapWindow
);
608 SAL_DLLPRIVATE
vcl::Window
* ImplGetFirstOverlapWindow();
609 SAL_DLLPRIVATE
const vcl::Window
* ImplGetFirstOverlapWindow() const;
611 SAL_DLLPRIVATE
bool ImplIsRealParentPath( const vcl::Window
* pWindow
) const;
613 SAL_DLLPRIVATE
bool ImplTestMousePointerSet();
615 SAL_DLLPRIVATE
void ImplResetReallyVisible();
616 SAL_DLLPRIVATE
void ImplSetReallyVisible();
618 SAL_DLLPRIVATE
void ImplCallInitShow();
620 SAL_DLLPRIVATE
void ImplInitResolutionSettings();
622 SAL_DLLPRIVATE
void ImplPointToLogic(vcl::RenderContext
const & rRenderContext
, vcl::Font
& rFont
) const;
623 SAL_DLLPRIVATE
void ImplLogicToPoint(vcl::RenderContext
const & rRenderContext
, vcl::Font
& rFont
) const;
625 SAL_DLLPRIVATE
bool ImplSysObjClip( const vcl::Region
* pOldRegion
);
626 SAL_DLLPRIVATE
void ImplUpdateSysObjChildrenClip();
627 SAL_DLLPRIVATE
void ImplUpdateSysObjOverlapsClip();
628 SAL_DLLPRIVATE
void ImplUpdateSysObjClip();
630 SAL_DLLPRIVATE
void ImplIntersectWindowClipRegion( vcl::Region
& rRegion
);
631 SAL_DLLPRIVATE
void ImplIntersectWindowRegion( vcl::Region
& rRegion
);
632 SAL_DLLPRIVATE
void ImplExcludeWindowRegion( vcl::Region
& rRegion
);
633 SAL_DLLPRIVATE
void ImplExcludeOverlapWindows( vcl::Region
& rRegion
) const;
634 SAL_DLLPRIVATE
void ImplExcludeOverlapWindows2( vcl::Region
& rRegion
);
636 SAL_DLLPRIVATE
void ImplClipBoundaries( vcl::Region
& rRegion
, bool bThis
, bool bOverlaps
);
637 SAL_DLLPRIVATE
bool ImplClipChildren( vcl::Region
& rRegion
) const;
638 SAL_DLLPRIVATE
void ImplClipAllChildren( vcl::Region
& rRegion
) const;
639 SAL_DLLPRIVATE
void ImplClipSiblings( vcl::Region
& rRegion
) const;
641 SAL_DLLPRIVATE
void ImplInitWinClipRegion();
642 SAL_DLLPRIVATE
void ImplInitWinChildClipRegion();
643 SAL_DLLPRIVATE
vcl::Region
& ImplGetWinChildClipRegion();
645 SAL_DLLPRIVATE
void ImplIntersectAndUnionOverlapWindows( const vcl::Region
& rInterRegion
, vcl::Region
& rRegion
) const;
646 SAL_DLLPRIVATE
void ImplIntersectAndUnionOverlapWindows2( const vcl::Region
& rInterRegion
, vcl::Region
& rRegion
);
647 SAL_DLLPRIVATE
void ImplCalcOverlapRegionOverlaps( const vcl::Region
& rInterRegion
, vcl::Region
& rRegion
) const;
648 SAL_DLLPRIVATE
void ImplCalcOverlapRegion( const tools::Rectangle
& rSourceRect
, vcl::Region
& rRegion
,
649 bool bChildren
, bool bSiblings
);
651 /** Invoke the actual painting.
653 This function is kind of recursive - it may be called from the
654 PaintHelper destructor; and on the other hand it creates PaintHelper
655 that (when destructed) calls other ImplCallPaint()'s.
657 SAL_DLLPRIVATE
void ImplCallPaint(const vcl::Region
* pRegion
, ImplPaintFlags nPaintFlags
);
659 SAL_DLLPRIVATE
void ImplCallOverlapPaint();
661 SAL_DLLPRIVATE
void ImplUpdateWindowPtr( vcl::Window
* pWindow
);
662 SAL_DLLPRIVATE
void ImplUpdateWindowPtr();
663 SAL_DLLPRIVATE
void ImplUpdateOverlapWindowPtr( bool bNewFrame
);
665 SAL_DLLPRIVATE
bool ImplUpdatePos();
666 SAL_DLLPRIVATE
void ImplUpdateSysObjPos();
668 SAL_DLLPRIVATE
void ImplUpdateGlobalSettings( AllSettings
& rSettings
, bool bCallHdl
= true ) const;
670 SAL_DLLPRIVATE
void ImplToBottomChild();
672 SAL_DLLPRIVATE
void ImplCalcToTop( ImplCalcToTopData
* pPrevData
);
673 SAL_DLLPRIVATE
void ImplToTop( ToTopFlags nFlags
);
674 SAL_DLLPRIVATE
void ImplStartToTop( ToTopFlags nFlags
);
675 SAL_DLLPRIVATE
void ImplFocusToTop( ToTopFlags nFlags
, bool bReallyVisible
);
677 SAL_DLLPRIVATE
void ImplShowAllOverlaps();
678 SAL_DLLPRIVATE
void ImplHideAllOverlaps();
680 SAL_DLLPRIVATE
bool ImplDlgCtrl( const KeyEvent
& rKEvt
, bool bKeyInput
);
681 SAL_DLLPRIVATE
bool ImplHasDlgCtrl() const;
682 SAL_DLLPRIVATE
void ImplDlgCtrlNextWindow();
683 SAL_DLLPRIVATE
void ImplDlgCtrlFocusChanged( vcl::Window
* pWindow
, bool bGetFocus
);
684 SAL_DLLPRIVATE
vcl::Window
* ImplFindDlgCtrlWindow( vcl::Window
* pWindow
);
686 SAL_DLLPRIVATE
static void ImplNewInputContext();
688 SAL_DLLPRIVATE
void ImplCallActivateListeners(vcl::Window
*);
689 SAL_DLLPRIVATE
void ImplCallDeactivateListeners(vcl::Window
*);
691 SAL_DLLPRIVATE
static void ImplHandleScroll(Scrollable
* pHScrl
, double nX
, Scrollable
* pVScrl
, double nY
);
693 SAL_DLLPRIVATE
tools::Rectangle
ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle
& rRect
) const;
694 SAL_DLLPRIVATE
tools::Rectangle
ImplUnmirroredAbsoluteScreenToOutputPixel( const tools::Rectangle
& rRect
) const;
695 SAL_DLLPRIVATE
tools::Long
ImplGetUnmirroredOutOffX();
697 // retrieves the list of owner draw decorated windows for this window hierarchy
698 SAL_DLLPRIVATE ::std::vector
<VclPtr
<vcl::Window
> >& ImplGetOwnerDrawList();
700 SAL_DLLPRIVATE
vcl::Window
* ImplGetTopmostFrameWindow();
702 SAL_DLLPRIVATE
tools::Rectangle
ImplGetWindowExtentsRelative(const vcl::Window
*pRelativeWindow
) const;
704 SAL_DLLPRIVATE
bool ImplStopDnd();
705 SAL_DLLPRIVATE
void ImplStartDnd();
707 virtual void ImplPaintToDevice( ::OutputDevice
* pTargetOutDev
, const Point
& rPos
);
710 // Single argument ctors shall be explicit.
711 explicit Window( WindowType nType
);
713 void SetCompoundControl( bool bCompound
);
715 void CallEventListeners( VclEventId nEvent
, void* pData
= nullptr );
717 // FIXME: this is a hack to workaround missing layout functionality
718 virtual void ImplAdjustNWFSizes();
720 virtual void ApplySettings(vcl::RenderContext
& rRenderContext
);
723 // Single argument ctors shall be explicit.
724 explicit Window( vcl::Window
* pParent
, WinBits nStyle
= 0 );
726 virtual ~Window() override
;
728 ::OutputDevice
const* GetOutDev() const;
729 ::OutputDevice
* GetOutDev();
731 Color
GetBackgroundColor() const;
732 const Wallpaper
& GetBackground() const;
733 bool IsBackground() const;
734 const MapMode
& GetMapMode() const;
735 void SetBackground();
736 void SetBackground( const Wallpaper
& rBackground
);
738 virtual void MouseMove( const MouseEvent
& rMEvt
);
739 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
740 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
741 virtual void KeyInput( const KeyEvent
& rKEvt
);
742 virtual void KeyUp( const KeyEvent
& rKEvt
);
743 virtual void PrePaint(vcl::RenderContext
& rRenderContext
);
744 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
);
745 virtual void PostPaint(vcl::RenderContext
& rRenderContext
);
747 void Erase(vcl::RenderContext
& rRenderContext
);
749 virtual void Draw( ::OutputDevice
* pDev
, const Point
& rPos
, SystemTextColorFlags nFlags
);
751 virtual void Resize();
752 virtual void Activate();
753 virtual void Deactivate();
754 virtual void GetFocus();
755 virtual void LoseFocus();
756 virtual void RequestHelp( const HelpEvent
& rHEvt
);
757 virtual void Command( const CommandEvent
& rCEvt
);
758 virtual void Tracking( const TrackingEvent
& rTEvt
);
759 virtual void StateChanged( StateChangedType nStateChange
);
760 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
761 virtual bool PreNotify( NotifyEvent
& rNEvt
);
762 virtual bool EventNotify( NotifyEvent
& rNEvt
);
764 void AddEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
765 void RemoveEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
766 void AddChildEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
767 void RemoveChildEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
769 ImplSVEvent
* PostUserEvent( const Link
<void*,void>& rLink
, void* pCaller
= nullptr, bool bReferenceLink
= false );
770 void RemoveUserEvent( ImplSVEvent
* nUserEvent
);
772 // returns the input language used for the last key stroke
773 // may be LANGUAGE_DONTKNOW if not supported by the OS
774 LanguageType
GetInputLanguage() const;
776 void SetStyle( WinBits nStyle
);
777 WinBits
GetStyle() const;
778 WinBits
GetPrevStyle() const;
779 void SetExtendedStyle( WindowExtendedStyle nExtendedStyle
);
780 WindowExtendedStyle
GetExtendedStyle() const;
781 void SetType( WindowType nType
);
782 WindowType
GetType() const;
783 bool IsSystemWindow() const;
784 bool IsDockingWindow() const;
785 bool IsDialog() const;
786 bool IsMenuFloatingWindow() const;
787 bool IsToolbarFloatingWindow() const;
788 bool IsTopWindow() const;
789 SystemWindow
* GetSystemWindow() const;
791 /// Can the widget derived from this Window do the double-buffering via RenderContext properly?
792 bool SupportsDoubleBuffering() const;
793 /// Enable/disable double-buffering of the frame window and all its children.
794 void RequestDoubleBuffering(bool bRequest
);
796 void EnableAllResize();
798 void SetBorderStyle( WindowBorderStyle nBorderStyle
);
799 WindowBorderStyle
GetBorderStyle() const;
800 void GetBorder( sal_Int32
& rLeftBorder
, sal_Int32
& rTopBorder
,
801 sal_Int32
& rRightBorder
, sal_Int32
& rBottomBorder
) const;
802 Size
CalcWindowSize( const Size
& rOutSz
) const;
803 Size
CalcOutputSize( const Size
& rWinSz
) const;
804 tools::Long
CalcTitleWidth() const;
806 void EnableClipSiblings( bool bClipSiblings
= true );
808 void EnableChildTransparentMode( bool bEnable
= true );
809 bool IsChildTransparentModeEnabled() const;
811 void SetMouseTransparent( bool bTransparent
);
812 bool IsMouseTransparent() const;
813 void SetPaintTransparent( bool bTransparent
);
814 bool IsPaintTransparent() const;
815 void SetDialogControlStart( bool bStart
);
816 bool IsDialogControlStart() const;
817 void SetDialogControlFlags( DialogControlFlags nFlags
);
818 DialogControlFlags
GetDialogControlFlags() const;
822 sal_Int32 mnState
; // the button state
823 Point maPos
; // mouse position in output coordinates
825 PointerState
GetPointerState();
826 bool IsMouseOver() const;
828 void SetInputContext( const InputContext
& rInputContext
);
829 const InputContext
& GetInputContext() const;
830 void PostExtTextInputEvent(VclEventId nType
, const OUString
& rText
);
831 void EndExtTextInput();
832 void SetCursorRect( const tools::Rectangle
* pRect
= nullptr, tools::Long nExtTextInputWidth
= 0 );
833 const tools::Rectangle
* GetCursorRect() const;
834 tools::Long
GetCursorExtTextInputWidth() const;
836 void SetCompositionCharRect( const tools::Rectangle
* pRect
, tools::Long nCompositionLength
, bool bVertical
= false );
838 void UpdateSettings( const AllSettings
& rSettings
, bool bChild
= false );
839 void NotifyAllChildren( DataChangedEvent
& rDCEvt
);
841 void SetPointFont(vcl::RenderContext
& rRenderContext
, const vcl::Font
& rFont
);
842 vcl::Font
GetPointFont(vcl::RenderContext
const & rRenderContext
) const;
843 void SetZoomedPointFont(vcl::RenderContext
& rRenderContext
, const vcl::Font
& rFont
);
844 tools::Long
GetDrawPixel( ::OutputDevice
const * pDev
, tools::Long nPixels
) const;
845 vcl::Font
GetDrawPixelFont( ::OutputDevice
const * pDev
) const;
847 void SetControlFont();
848 void SetControlFont( const vcl::Font
& rFont
);
849 vcl::Font
GetControlFont() const;
850 bool IsControlFont() const;
851 void ApplyControlFont(vcl::RenderContext
& rRenderContext
, const vcl::Font
& rDefaultFont
);
853 void SetControlForeground();
854 void SetControlForeground(const Color
& rColor
);
855 const Color
& GetControlForeground() const;
856 bool IsControlForeground() const;
857 void ApplyControlForeground(vcl::RenderContext
& rRenderContext
, const Color
& rDefaultColor
);
859 void SetControlBackground();
860 void SetControlBackground( const Color
& rColor
);
861 const Color
& GetControlBackground() const;
862 bool IsControlBackground() const;
863 void ApplyControlBackground(vcl::RenderContext
& rRenderContext
, const Color
& rDefaultColor
);
865 void SetParentClipMode( ParentClipMode nMode
= ParentClipMode::NONE
);
866 ParentClipMode
GetParentClipMode() const;
868 void SetWindowRegionPixel();
869 void SetWindowRegionPixel( const vcl::Region
& rRegion
);
870 vcl::Region
GetWindowClipRegionPixel() const;
871 vcl::Region
GetPaintRegion() const;
872 bool IsInPaint() const;
873 // while IsInPaint returns true ExpandPaintClipRegion adds the
874 // submitted region to the paint clip region so you can
875 // paint additional parts of your window if necessary
876 void ExpandPaintClipRegion( const vcl::Region
& rRegion
);
878 void SetParent( vcl::Window
* pNewParent
);
879 vcl::Window
* GetParent() const;
880 // return the dialog we are contained in or NULL if un-contained
881 Dialog
* GetParentDialog() const;
882 bool IsAncestorOf( const vcl::Window
& rWindow
) const;
884 void Show( bool bVisible
= true, ShowFlags nFlags
= ShowFlags::NONE
);
885 void Hide() { Show( false ); }
886 bool IsVisible() const;
887 bool IsReallyVisible() const;
888 bool IsReallyShown() const;
889 bool IsInInitShow() const;
891 void Enable( bool bEnable
= true, bool bChild
= true );
892 void Disable( bool bChild
= true ) { Enable( false, bChild
); }
893 bool IsEnabled() const;
895 void EnableInput( bool bEnable
= true, bool bChild
= true );
896 void EnableInput( bool bEnable
, const vcl::Window
* pExcludeWindow
);
897 bool IsInputEnabled() const;
899 /** Override <code>EnableInput</code>. This can be necessary due to other people
900 using EnableInput for whole window hierarchies.
903 sets always enabled flag
906 if true children are recursively set to AlwaysEnableInput
908 void AlwaysEnableInput( bool bAlways
, bool bChild
= true );
910 /** returns the current AlwaysEnableInput state
912 true if window is in AlwaysEnableInput state
914 bool IsAlwaysEnableInput() const;
916 /** A window is in modal mode if one of its children or subchildren
917 is a running modal window (a modal dialog)
919 @returns sal_True if a child or subchild is a running modal window
921 bool IsInModalMode() const;
923 void SetActivateMode( ActivateModeFlags nMode
);
924 ActivateModeFlags
GetActivateMode() const;
926 void ToTop( ToTopFlags nFlags
= ToTopFlags::NONE
);
927 void SetZOrder( vcl::Window
* pRefWindow
, ZOrderFlags nFlags
);
928 void EnableAlwaysOnTop( bool bEnable
= true );
929 bool IsAlwaysOnTopEnabled() const;
931 virtual void setPosSizePixel( tools::Long nX
, tools::Long nY
,
932 tools::Long nWidth
, tools::Long nHeight
,
933 PosSizeFlags nFlags
= PosSizeFlags::All
);
934 virtual void SetPosPixel( const Point
& rNewPos
);
935 virtual Point
GetPosPixel() const;
936 virtual void SetSizePixel( const Size
& rNewSize
);
937 virtual Size
GetSizePixel() const;
938 virtual void SetPosSizePixel( const Point
& rNewPos
,
939 const Size
& rNewSize
);
940 virtual void SetOutputSizePixel( const Size
& rNewSize
);
941 bool IsDefaultPos() const;
942 bool IsDefaultSize() const;
943 Point
GetOffsetPixelFrom(const vcl::Window
& rWindow
) const;
945 // those conversion routines might deliver different results during UI mirroring
946 Point
OutputToScreenPixel( const Point
& rPos
) const;
947 Point
ScreenToOutputPixel( const Point
& rPos
) const;
948 // the normalized screen methods work independent from UI mirroring
949 Point
OutputToNormalizedScreenPixel( const Point
& rPos
) const;
950 Point
NormalizedScreenToOutputPixel( const Point
& rPos
) const;
951 Point
OutputToAbsoluteScreenPixel( const Point
& rPos
) const;
952 Point
AbsoluteScreenToOutputPixel( const Point
& rPos
) const;
953 tools::Rectangle
GetDesktopRectPixel() const;
954 // window extents including border and decoration
955 tools::Rectangle
GetWindowExtentsRelative(const vcl::Window
*pRelativeWindow
) const;
957 bool IsScrollable() const;
958 virtual void Scroll( tools::Long nHorzScroll
, tools::Long nVertScroll
,
959 ScrollFlags nFlags
= ScrollFlags::NONE
);
960 void Scroll( tools::Long nHorzScroll
, tools::Long nVertScroll
,
961 const tools::Rectangle
& rRect
, ScrollFlags nFlags
= ScrollFlags::NONE
);
962 virtual void Invalidate( InvalidateFlags nFlags
= InvalidateFlags::NONE
);
963 virtual void Invalidate( const tools::Rectangle
& rRect
, InvalidateFlags nFlags
= InvalidateFlags::NONE
);
964 virtual void Invalidate( const vcl::Region
& rRegion
, InvalidateFlags nFlags
= InvalidateFlags::NONE
);
966 * Notification about some rectangle of the output device got invalidated.Used for the main
969 * @param pRectangle If 0, that means the whole area, otherwise the area in logic coordinates.
971 virtual void LogicInvalidate(const tools::Rectangle
* pRectangle
);
974 * Notification about some rectangle of the output device got invalidated. Used for the
975 * dialogs and floating windows (e.g. context menu, popup).
977 * @param pRectangle If 0, that means the whole area, otherwise the area in pixel coordinates.
979 virtual void PixelInvalidate(const tools::Rectangle
* pRectangle
);
981 bool HasPaintEvent() const;
982 void PaintImmediately();
984 // toggles new docking support, enabled via toolkit
985 void EnableDocking( bool bEnable
= true );
986 // retrieves the single dockingmanager instance
987 static DockingManager
* GetDockingManager();
989 void EnablePaint( bool bEnable
);
990 bool IsPaintEnabled() const;
991 void SetUpdateMode( bool bUpdate
);
992 bool IsUpdateMode() const;
993 void SetParentUpdateMode( bool bUpdate
);
996 bool HasFocus() const;
997 bool HasChildPathFocus( bool bSystemWindow
= false ) const;
998 bool IsActive() const;
999 bool HasActiveChildFrame() const;
1000 GetFocusFlags
GetGetFocusFlags() const;
1001 void GrabFocusToDocument();
1002 VclPtr
<vcl::Window
> GetFocusedWindow() const;
1005 * Set this when you need to act as if the window has focus even if it
1006 * doesn't. This is necessary for implementing tab stops inside floating
1007 * windows, but floating windows don't get focus from the system.
1009 void SetFakeFocus( bool bFocus
);
1011 bool IsCompoundControl() const;
1013 static VclPtr
<vcl::Window
> SaveFocus();
1014 static void EndSaveFocus(const VclPtr
<vcl::Window
>& xFocusWin
);
1016 void LocalStartDrag();
1017 void CaptureMouse();
1018 void ReleaseMouse();
1019 bool IsMouseCaptured() const;
1021 virtual void SetPointer( PointerStyle
);
1022 PointerStyle
GetPointer() const;
1023 void EnableChildPointerOverwrite( bool bOverwrite
);
1024 void SetPointerPosPixel( const Point
& rPos
);
1025 Point
GetPointerPosPixel();
1026 Point
GetLastPointerPosPixel();
1027 /// Similar to SetPointerPosPixel(), but sets the frame data's last mouse position instead.
1028 void SetLastMousePos(const Point
& rPos
);
1029 void ShowPointer( bool bVisible
);
1032 bool IsWait() const;
1034 void SetCursor( vcl::Cursor
* pCursor
);
1035 vcl::Cursor
* GetCursor() const;
1037 void SetZoom( const Fraction
& rZoom
);
1038 const Fraction
& GetZoom() const;
1039 bool IsZoom() const;
1040 tools::Long
CalcZoom( tools::Long n
) const;
1042 virtual void SetText( const OUString
& rStr
);
1043 virtual OUString
GetText() const;
1044 // return the actual text displayed
1045 // this may have e.g. accelerators removed or portions
1046 // replaced by ellipses
1047 virtual OUString
GetDisplayText() const;
1048 // gets the visible background color. for transparent windows
1049 // this may be the parent's background color; for controls
1050 // this may be a child's background color (e.g. ListBox)
1051 virtual const Wallpaper
& GetDisplayBackground() const;
1053 void SetHelpText( const OUString
& rHelpText
);
1054 const OUString
& GetHelpText() const;
1056 void SetQuickHelpText( const OUString
& rHelpText
);
1057 const OUString
& GetQuickHelpText() const;
1059 void SetHelpId( const OUString
& );
1060 const OUString
& GetHelpId() const;
1062 sal_uInt16
GetChildCount() const;
1063 vcl::Window
* GetChild( sal_uInt16 nChild
) const;
1064 vcl::Window
* GetWindow( GetWindowType nType
) const;
1065 bool IsChild( const vcl::Window
* pWindow
) const;
1066 bool IsWindowOrChild( const vcl::Window
* pWindow
, bool bSystemWindow
= false ) const;
1068 /// Add all children to rAllChildren recursively.
1069 SAL_DLLPRIVATE
void CollectChildren(::std::vector
<vcl::Window
*>& rAllChildren
);
1071 virtual void ShowFocus(const tools::Rectangle
& rRect
);
1074 // transparent background for selected or checked items in toolboxes etc.
1075 void DrawSelectionBackground( const tools::Rectangle
& rRect
, sal_uInt16 highlight
, bool bChecked
, bool bDrawBorder
);
1077 void ShowTracking( const tools::Rectangle
& rRect
,
1078 ShowTrackFlags nFlags
= ShowTrackFlags::Small
);
1079 void HideTracking();
1080 void InvertTracking( const tools::Rectangle
& rRect
, ShowTrackFlags nFlags
);
1082 void StartTracking( StartTrackingFlags nFlags
= StartTrackingFlags::NONE
);
1083 void EndTracking( TrackingEventFlags nFlags
= TrackingEventFlags::NONE
);
1084 bool IsTracking() const;
1086 void StartAutoScroll( StartAutoScrollFlags nFlags
);
1087 void EndAutoScroll();
1089 bool HandleScrollCommand( const CommandEvent
& rCmd
,
1091 Scrollable
* pVScrl
);
1093 virtual const SystemEnvData
* GetSystemData() const;
1095 // API to set/query the component interfaces
1096 virtual css::uno::Reference
< css::awt::XVclWindowPeer
>
1097 GetComponentInterface( bool bCreate
= true );
1099 void SetComponentInterface( css::uno::Reference
< css::awt::XVclWindowPeer
> const & xIFace
);
1101 void SetUseFrameData(bool bUseFrameData
);
1103 /// Interface to register for dialog / window tunneling.
1104 void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier
* pNotifier
, bool bParent
= false);
1105 const vcl::ILibreOfficeKitNotifier
* GetLOKNotifier() const;
1106 vcl::LOKWindowId
GetLOKWindowId() const;
1108 /// Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set.
1109 VclPtr
<vcl::Window
> GetParentWithLOKNotifier();
1111 /// Indicate that LOK is not going to use this dialog any more.
1112 void ReleaseLOKNotifier();
1114 /// Find an existing Window based on the LOKWindowId.
1115 static VclPtr
<vcl::Window
> FindLOKWindow(vcl::LOKWindowId nWindowId
);
1117 /// check if LOK Window container is empty
1118 static bool IsLOKWindowsEmpty();
1120 /// Dumps itself and potentially its children to a property tree, to be written easily to JSON.
1121 virtual void DumpAsPropertyTree(tools::JsonWriter
&);
1123 /** @name Accessibility
1128 css::uno::Reference
< css::accessibility::XAccessible
>
1129 GetAccessible( bool bCreate
= true );
1131 virtual css::uno::Reference
< css::accessibility::XAccessible
>
1134 void SetAccessible( const css::uno::Reference
< css::accessibility::XAccessible
>& );
1136 vcl::Window
* GetAccessibleParentWindow() const;
1137 sal_uInt16
GetAccessibleChildWindowCount();
1138 vcl::Window
* GetAccessibleChildWindow( sal_uInt16 n
);
1140 void SetAccessibleRole( sal_uInt16 nRole
);
1141 sal_uInt16
GetAccessibleRole() const;
1143 void SetAccessibleName( const OUString
& rName
);
1144 OUString
GetAccessibleName() const;
1146 void SetAccessibleDescription( const OUString
& rDescr
);
1147 OUString
GetAccessibleDescription() const;
1149 void SetAccessibleRelationLabeledBy( vcl::Window
* pLabeledBy
);
1150 vcl::Window
* GetAccessibleRelationLabeledBy() const;
1152 void SetAccessibleRelationLabelFor( vcl::Window
* pLabelFor
);
1153 vcl::Window
* GetAccessibleRelationLabelFor() const;
1155 vcl::Window
* GetAccessibleRelationMemberOf() const;
1157 // to avoid sending accessibility events in cases like closing dialogs
1158 // by default checks complete parent path
1159 bool IsAccessibilityEventsSuppressed( bool bTraverseParentPath
= true );
1160 void SetAccessibilityEventsSuppressed(bool bSuppressed
);
1162 KeyEvent
GetActivationKey() const;
1166 // These eventually are supposed to go when everything is converted to .ui
1167 SAL_DLLPRIVATE
vcl::Window
* getLegacyNonLayoutAccessibleRelationMemberOf() const;
1168 SAL_DLLPRIVATE
vcl::Window
* getLegacyNonLayoutAccessibleRelationLabeledBy() const;
1169 SAL_DLLPRIVATE
vcl::Window
* getLegacyNonLayoutAccessibleRelationLabelFor() const;
1171 // Let Label override the code part of GetAccessibleRelationLabelFor
1172 virtual vcl::Window
* getAccessibleRelationLabelFor() const;
1173 virtual sal_uInt16
getDefaultAccessibleRole() const;
1174 virtual OUString
getDefaultAccessibleName() const;
1177 * Advisory Sizing - what is a good size for this widget
1179 * Retrieves the preferred size of a widget ignoring
1180 * "width-request" and "height-request" properties.
1182 * Implement this in sub-classes to tell layout
1183 * the preferred widget size.
1185 * Use get_preferred_size to retrieve this value
1186 * cached and mediated via height and width requests
1188 virtual Size
GetOptimalSize() const;
1189 /// clear OptimalSize cache
1190 void InvalidateSizeCache();
1193 SAL_DLLPRIVATE
bool ImplIsAccessibleCandidate() const;
1194 SAL_DLLPRIVATE
bool ImplIsAccessibleNativeFrame() const;
1198 * Retrieves the preferred size of a widget taking
1199 * into account the "width-request" and "height-request" properties.
1201 * Overrides the result of GetOptimalSize to honor the
1202 * width-request and height-request properties.
1204 * So the same as get_ungrouped_preferred_size except
1205 * it ignores groups. A building block of get_preferred_size
1206 * that access the size cache
1208 * @see get_preferred_size
1210 Size
get_ungrouped_preferred_size() const;
1212 /* records all DrawText operations within the passed rectangle;
1213 * a synchronous paint is sent to achieve this
1215 void RecordLayoutData( vcl::ControlLayoutData
* pLayout
, const tools::Rectangle
& rRect
);
1217 // set and retrieve for Toolkit
1218 VCLXWindow
* GetWindowPeer() const;
1219 void SetWindowPeer( css::uno::Reference
< css::awt::XVclWindowPeer
> const & xPeer
, VCLXWindow
* pVCLXWindow
);
1221 // remember if it was generated by Toolkit
1222 bool IsCreatedWithToolkit() const;
1223 void SetCreatedWithToolkit( bool b
);
1225 // Drag and Drop interfaces
1226 css::uno::Reference
< css::datatransfer::dnd::XDropTarget
> GetDropTarget();
1227 css::uno::Reference
< css::datatransfer::dnd::XDragSource
> GetDragSource();
1228 css::uno::Reference
< css::datatransfer::dnd::XDragGestureRecognizer
> GetDragGestureRecognizer();
1230 // Clipboard/Selection interfaces
1231 css::uno::Reference
< css::datatransfer::clipboard::XClipboard
> GetClipboard();
1232 /// Sets a custom clipboard for the window's frame, instead of creating it on-demand using css::datatransfer::clipboard::SystemClipboard.
1233 void SetClipboard(css::uno::Reference
<css::datatransfer::clipboard::XClipboard
> const & xClipboard
);
1236 * Widgets call this to inform their owner container that the widget wants
1237 * to renegotiate its size. Should be called when a widget has a new size
1238 * request. e.g. a FixedText Control gets a new label.
1240 * akin to gtk_widget_queue_resize
1242 virtual void queue_resize(StateChangedType eReason
= StateChangedType::Layout
);
1245 * Sets the "height-request" property
1247 * Override for height request of the widget, or -1 if natural request
1250 * @see get_preferred_size, set_width_request
1252 void set_height_request(sal_Int32 nHeightRequest
);
1253 sal_Int32
get_height_request() const;
1256 * Sets the "width-request" property
1258 * Override for width request of the widget, or -1 if natural request
1261 * @see get_preferred_size, set_height_request
1263 void set_width_request(sal_Int32 nWidthRequest
);
1264 sal_Int32
get_width_request() const;
1267 * Retrieves the preferred size of a widget taking
1268 * into account the "width-request" and "height-request" properties.
1270 * Overrides the result of GetOptimalSize to honor the
1271 * width-request and height-request properties.
1273 * @see GetOptimalSize
1275 * akin to gtk_widget_get_preferred_size
1277 Size
get_preferred_size() const;
1280 * How to horizontally align this widget
1282 VclAlign
get_halign() const;
1283 void set_halign(VclAlign eAlign
);
1286 * How to vertically align this widget
1288 VclAlign
get_valign() const;
1289 void set_valign(VclAlign eAlign
);
1292 * Whether the widget would like to use any available extra horizontal
1295 bool get_hexpand() const;
1296 void set_hexpand(bool bExpand
);
1299 * Whether the widget would like to use any available extra vertical
1302 bool get_vexpand() const;
1303 void set_vexpand(bool bExpand
);
1306 * Whether the widget would like to use any available extra space.
1308 bool get_expand() const;
1309 void set_expand(bool bExpand
);
1312 * Whether the widget should receive extra space when the parent grows
1314 bool get_fill() const;
1315 void set_fill(bool bFill
);
1317 void set_border_width(sal_Int32 nBorderWidth
);
1318 sal_Int32
get_border_width() const;
1320 void set_margin_start(sal_Int32 nWidth
);
1321 sal_Int32
get_margin_start() const;
1323 void set_margin_end(sal_Int32 nWidth
);
1324 sal_Int32
get_margin_end() const;
1326 void set_margin_top(sal_Int32 nWidth
);
1327 sal_Int32
get_margin_top() const;
1329 void set_margin_bottom(sal_Int32 nWidth
);
1330 sal_Int32
get_margin_bottom() const;
1333 * How the widget is packed with reference to the start or end of the parent
1335 VclPackType
get_pack_type() const;
1336 void set_pack_type(VclPackType ePackType
);
1339 * The extra space to put between the widget and its neighbors
1341 sal_Int32
get_padding() const;
1342 void set_padding(sal_Int32 nPadding
);
1345 * The number of columns that the widget spans
1347 sal_Int32
get_grid_width() const;
1348 void set_grid_width(sal_Int32 nCols
);
1351 * The column number to attach the left side of the widget to
1353 sal_Int32
get_grid_left_attach() const;
1354 void set_grid_left_attach(sal_Int32 nAttach
);
1357 * The number of row that the widget spans
1359 sal_Int32
get_grid_height() const;
1360 void set_grid_height(sal_Int32 nRows
);
1363 * The row number to attach the top side of the widget to
1365 sal_Int32
get_grid_top_attach() const;
1366 void set_grid_top_attach(sal_Int32 nAttach
);
1369 * If true this child appears in a secondary layout group of children
1370 * e.g. help buttons in a buttonbox
1372 bool get_secondary() const;
1373 void set_secondary(bool bSecondary
);
1376 * If true this child is exempted from homogeneous sizing
1377 * e.g. special button in a buttonbox
1379 bool get_non_homogeneous() const;
1380 void set_non_homogeneous(bool bNonHomogeneous
);
1383 * Sets a widget property
1385 * @return false if property is unknown
1387 virtual bool set_property(const OUString
&rKey
, const OUString
&rValue
);
1390 * Sets a font attribute
1392 * @return false if attribute is unknown
1394 bool set_font_attribute(const OUString
&rKey
, std::u16string_view rValue
);
1397 * Adds this widget to the xGroup VclSizeGroup
1400 void add_to_size_group(const std::shared_ptr
<VclSizeGroup
>& xGroup
);
1401 void remove_from_all_size_groups();
1404 * add/remove mnemonic label
1406 void add_mnemonic_label(FixedText
*pLabel
);
1407 void remove_mnemonic_label(FixedText
*pLabel
);
1408 const std::vector
<VclPtr
<FixedText
> >& list_mnemonic_labels() const;
1411 * Move this widget to be the nNewPosition'd child of its parent
1413 void reorderWithinParent(sal_uInt16 nNewPosition
);
1418 void set_id(const OUString
& rID
);
1421 * Get the ID of the window.
1423 const OUString
& get_id() const;
1426 // Native Widget Rendering functions
1429 // form controls must never use native widgets, this can be toggled here
1430 void EnableNativeWidget( bool bEnable
= true );
1431 bool IsNativeWidgetEnabled() const;
1433 // a helper method for a Control's Draw method
1434 void PaintToDevice( ::OutputDevice
* pDevice
, const Point
& rPos
);
1436 // Keyboard access functions
1438 /** Query the states of keyboard indicators - Caps Lock, Num Lock and
1439 Scroll Lock. Use the following mask to retrieve the state of each
1442 KeyIndicatorState::CAPS_LOCK
1443 KeyIndicatorState::NUM_LOCK
1444 KeyIndicatorState::SCROLL_LOCK
1446 KeyIndicatorState
GetIndicatorState() const;
1448 void SimulateKeyPress( sal_uInt16 nKeyCode
) const;
1450 virtual OUString
GetSurroundingText() const;
1451 virtual Selection
GetSurroundingTextSelection() const;
1452 virtual bool DeleteSurroundingText(const Selection
& rSelection
);
1454 virtual FactoryFunction
GetUITestFactory() const;
1456 virtual bool IsChart() const { return false; }
1457 virtual bool IsStarMath() const { return false; }
1459 void SetHelpHdl(const Link
<vcl::Window
&, bool>& rLink
);
1460 void SetMnemonicActivateHdl(const Link
<vcl::Window
&, bool>& rLink
);
1461 void SetModalHierarchyHdl(const Link
<bool, void>& rLink
);
1462 void SetDumpAsPropertyTreeHdl(const Link
<tools::JsonWriter
&, void>& rLink
);
1464 Size
GetOutputSizePixel() const;
1465 tools::Rectangle
GetOutputRectPixel() const;
1467 Point
LogicToPixel( const Point
& rLogicPt
) const;
1468 Size
LogicToPixel( const Size
& rLogicSize
) const;
1469 tools::Rectangle
LogicToPixel( const tools::Rectangle
& rLogicRect
) const;
1470 vcl::Region
LogicToPixel( const vcl::Region
& rLogicRegion
)const;
1471 Point
LogicToPixel( const Point
& rLogicPt
,
1472 const MapMode
& rMapMode
) const;
1473 Size
LogicToPixel( const Size
& rLogicSize
,
1474 const MapMode
& rMapMode
) const;
1475 tools::Rectangle
LogicToPixel( const tools::Rectangle
& rLogicRect
,
1476 const MapMode
& rMapMode
) const;
1478 Point
PixelToLogic( const Point
& rDevicePt
) const;
1479 Size
PixelToLogic( const Size
& rDeviceSize
) const;
1480 tools::Rectangle
PixelToLogic( const tools::Rectangle
& rDeviceRect
) const;
1481 tools::PolyPolygon
PixelToLogic( const tools::PolyPolygon
& rDevicePolyPoly
) const;
1482 vcl::Region
PixelToLogic( const vcl::Region
& rDeviceRegion
) const;
1483 Point
PixelToLogic( const Point
& rDevicePt
,
1484 const MapMode
& rMapMode
) const;
1485 Size
PixelToLogic( const Size
& rDeviceSize
,
1486 const MapMode
& rMapMode
) const;
1487 tools::Rectangle
PixelToLogic( const tools::Rectangle
& rDeviceRect
,
1488 const MapMode
& rMapMode
) const;
1490 Size
LogicToLogic( const Size
& rSzSource
,
1491 const MapMode
* pMapModeSource
,
1492 const MapMode
* pMapModeDest
) const;
1494 const AllSettings
& GetSettings() const;
1495 void SetSettings( const AllSettings
& rSettings
);
1496 void SetSettings( const AllSettings
& rSettings
, bool bChild
);
1498 tools::Rectangle
GetTextRect( const tools::Rectangle
& rRect
,
1499 const OUString
& rStr
, DrawTextFlags nStyle
= DrawTextFlags::WordBreak
,
1500 TextRectInfo
* pInfo
= nullptr,
1501 const vcl::ITextLayout
* _pTextLayout
= nullptr ) const;
1502 float GetDPIScaleFactor() const;
1503 tools::Long
GetOutOffXPixel() const;
1504 tools::Long
GetOutOffYPixel() const;
1506 void EnableMapMode( bool bEnable
= true );
1507 bool IsMapModeEnabled() const;
1509 void SetMapMode( const MapMode
& rNewMapMode
);
1511 // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphicsLayout
1512 virtual void EnableRTL( bool bEnable
= true);
1513 bool IsRTLEnabled() const;
1515 void SetFont( const vcl::Font
& rNewFont
);
1516 const vcl::Font
& GetFont() const;
1518 /** Width of the text.
1520 See also GetTextBoundRect() for more explanation + code examples.
1522 tools::Long
GetTextWidth( const OUString
& rStr
, sal_Int32 nIndex
= 0, sal_Int32 nLen
= -1,
1523 vcl::text::TextLayoutCache
const* = nullptr,
1524 SalLayoutGlyphs
const*const pLayoutCache
= nullptr) const;
1526 /** Height where any character of the current font fits; in logic coordinates.
1528 See also GetTextBoundRect() for more explanation + code examples.
1530 tools::Long
GetTextHeight() const;
1531 float approximate_digit_width() const;
1533 void SetTextColor( const Color
& rColor
);
1534 const Color
& GetTextColor() const;
1536 void SetTextFillColor();
1537 void SetTextFillColor( const Color
& rColor
);
1538 Color
GetTextFillColor() const;
1539 bool IsTextFillColor() const;
1541 void SetTextLineColor();
1542 void SetTextLineColor( const Color
& rColor
);
1543 const Color
& GetTextLineColor() const;
1544 bool IsTextLineColor() const;
1546 void SetOverlineColor();
1547 void SetOverlineColor( const Color
& rColor
);
1548 const Color
& GetOverlineColor() const;
1549 bool IsOverlineColor() const;
1551 void SetTextAlign( TextAlign eAlign
);
1552 TextAlign
GetTextAlign() const;
1554 /** Query the platform layer for control support
1556 bool IsNativeControlSupported( ControlType nType
, ControlPart nPart
) const;
1558 /** Query the native control's actual drawing region (including adornment)
1560 bool GetNativeControlRegion(
1563 const tools::Rectangle
& rControlRegion
,
1564 ControlState nState
,
1565 const ImplControlValue
& aValue
,
1566 tools::Rectangle
&rNativeBoundingRegion
,
1567 tools::Rectangle
&rNativeContentRegion
) const;
1569 SAL_DLLPRIVATE
float approximate_char_width() const;
1571 SAL_DLLPRIVATE
void ImplEnableRTL(bool bEnable
);
1576 #endif // INCLUDED_VCL_WINDOW_HXX
1578 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */