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 <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/outdev.hxx>
26 #include <tools/link.hxx>
27 #include <tools/wintypes.hxx>
28 #include <vcl/vclenum.hxx>
29 #include <vcl/keycodes.hxx>
30 #include <vcl/region.hxx>
31 #include <vcl/uitest/factory.hxx>
32 #include <vcl/IDialogRenderable.hxx>
33 #include <rtl/ustring.hxx>
34 #include <com/sun/star/uno/Reference.hxx>
37 #include <boost/property_tree/ptree_fwd.hpp>
43 struct ImplCalcToTopData
;
45 struct SystemParentData
;
46 class ImplBorderWindow
;
56 class DataChangedEvent
;
61 class MenuFloatingWindow
;
66 enum class ImplPaintFlags
;
67 enum class VclEventId
;
68 enum class PointerStyle
;
70 namespace com
{ namespace sun
{ namespace star
{
71 namespace accessibility
{
72 struct AccessibleRelation
;
86 namespace datatransfer
{ namespace clipboard
{
90 class XDragGestureRecognizer
;
96 struct ControlLayoutData
;
99 namespace svt
{ class PopupWindowControllerImpl
; }
101 namespace weld
{ class Window
; }
103 template<class T
> class VclPtr
;
105 enum class TrackingEventFlags
116 template<> struct typed_flags
<TrackingEventFlags
> : is_typed_flags
<TrackingEventFlags
, 0x1107> {};
120 // Type for GetWindow()
121 enum class GetWindowType
135 FirstTopWindowChild
= 13,
136 NextTopWindowSibling
= 16,
139 // Flags for setPosSizePixel()
140 // These must match the definitions in css::awt::PosSize
141 enum class PosSizeFlags
149 Size
= Width
| Height
,
150 PosSize
= Pos
| Size
,
156 template<> struct typed_flags
<PosSizeFlags
> : is_typed_flags
<PosSizeFlags
, 0x000f> {};
163 NoFocusChange
= 0x0002,
165 ForegroundTask
= 0x0008,
169 template<> struct typed_flags
<ShowFlags
> : is_typed_flags
<ShowFlags
, 0x000e> {};
172 // Flags for SetZOrder()
173 enum class ZOrderFlags
183 template<> struct typed_flags
<ZOrderFlags
> : is_typed_flags
<ZOrderFlags
, 0x000f> {};
187 enum class ActivateModeFlags
194 template<> struct typed_flags
<ActivateModeFlags
> : is_typed_flags
<ActivateModeFlags
, 0x0001> {};
198 enum class ToTopFlags
201 RestoreWhenMin
= 0x0001,
202 ForegroundTask
= 0x0002,
203 NoGrabFocus
= 0x0004,
204 GrabFocusOnly
= 0x0008,
208 template<> struct typed_flags
<ToTopFlags
> : is_typed_flags
<ToTopFlags
, 0x000f> {};
211 // Flags for Invalidate
212 // must match css::awt::InvalidateStyle
213 enum class InvalidateFlags
220 Transparent
= 0x0010,
221 NoTransparent
= 0x0020,
222 NoClipChildren
= 0x4000,
226 template<> struct typed_flags
<InvalidateFlags
> : is_typed_flags
<InvalidateFlags
, 0x403f> {};
229 // Flags for Validate
230 enum class ValidateFlags
238 template<> struct typed_flags
<ValidateFlags
> : is_typed_flags
<ValidateFlags
, 0x0003> {};
242 enum class ScrollFlags
248 UseClipRegion
= 0x0008,
253 template<> struct typed_flags
<ScrollFlags
> : is_typed_flags
<ScrollFlags
, 0x001f> {};
256 // Flags for ParentClipMode
257 enum class ParentClipMode
265 template<> struct typed_flags
<ParentClipMode
> : is_typed_flags
<ParentClipMode
, 0x0003> {};
268 // Flags for ShowTracking()
269 enum class ShowTrackFlags
{
276 TrackWindow
= 0x1000,
281 template<> struct typed_flags
<ShowTrackFlags
> : is_typed_flags
<ShowTrackFlags
, 0x300f> {};
284 // Flags for StartTracking()
285 enum class StartTrackingFlags
289 ScrollRepeat
= 0x0004,
290 ButtonRepeat
= 0x0008,
295 template<> struct typed_flags
<StartTrackingFlags
> : is_typed_flags
<StartTrackingFlags
, 0x000f> {};
298 // Flags for StartAutoScroll()
299 enum class StartAutoScrollFlags
307 template<> struct typed_flags
<StartAutoScrollFlags
> : is_typed_flags
<StartAutoScrollFlags
, 0x0003> {};
310 // Flags for StateChanged()
311 enum class StateChangedType
: sal_uInt16
323 ControlForeground
= 14,
324 ControlBackground
= 15,
332 // must match constants in css:awt::FocusChangeReason
333 enum class GetFocusFlags
337 CURSOR
= 0x0002, // avoid name-clash with X11 #define
343 UniqueMnemonic
= 0x0100,
345 FloatWinPopupModeEndCancel
= 0x0400,
349 template<> struct typed_flags
<GetFocusFlags
> : is_typed_flags
<GetFocusFlags
, 0x077f> {};
362 template<> struct typed_flags
<DrawFlags
> : is_typed_flags
<DrawFlags
, 0x0005> {};
365 // DialogControl-Flags
366 enum class DialogControlFlags
371 FloatWinPopupModeEndCancel
= 0x0004,
375 template<> struct typed_flags
<DialogControlFlags
> : is_typed_flags
<DialogControlFlags
, 0x0007> {};
378 // EndExtTextInput() Flags
379 enum class EndExtTextInputFlags
386 template<> struct typed_flags
<EndExtTextInputFlags
> : is_typed_flags
<EndExtTextInputFlags
, 0x0001> {};
389 #define IMPL_MINSIZE_BUTTON_WIDTH 70
390 #define IMPL_MINSIZE_BUTTON_HEIGHT 22
391 #define IMPL_EXTRA_BUTTON_WIDTH 18
392 #define IMPL_EXTRA_BUTTON_HEIGHT 10
393 #define IMPL_SEP_BUTTON_X 5
394 #define IMPL_SEP_BUTTON_Y 5
395 #define IMPL_MINSIZE_MSGBOX_WIDTH 150
396 #define IMPL_DIALOG_OFFSET 5
397 #define IMPL_DIALOG_BAR_OFFSET 3
398 #define IMPL_MSGBOX_OFFSET_EXTRA_X 0
399 #define IMPL_MSGBOX_OFFSET_EXTRA_Y 2
400 #define IMPL_SEP_MSGBOX_IMAGE 8
402 // ImplGetDlgWindow()
403 enum class GetDlgWindowType
410 const char* ImplDbgCheckWindow( const void* pObj
);
413 namespace vcl
{ class Window
; }
414 namespace vcl
{ class Cursor
; }
424 class FloatingWindow
;
428 class SystemChildWindow
;
429 class ImplDockingWindowWrapper
;
430 class ImplPopupFloatWin
;
434 enum class WindowHitTest
{
440 template<> struct typed_flags
<WindowHitTest
> : is_typed_flags
<WindowHitTest
, 0x0003> {};
444 enum class WindowExtendedStyle
{
447 DocModified
= 0x0002,
449 * This is a frame window that is requested to be hidden (not just "not yet
455 template<> struct typed_flags
<WindowExtendedStyle
> : is_typed_flags
<WindowExtendedStyle
, 0x0007> {};
460 class VCL_DLLPUBLIC RenderTools
463 // transparent background for selected or checked items in toolboxes etc.
464 // + selection Color with a text color complementing the selection background
466 static void DrawSelectionBackground(vcl::RenderContext
& rRenderContext
, vcl::Window
const & rWindow
,
467 const tools::Rectangle
& rRect
, sal_uInt16 nHighlight
,
468 bool bChecked
, bool bDrawBorder
, bool bDrawExtBorderOnly
,
469 Color
* pSelectionTextColor
= nullptr, long nCornerRadius
= 0,
470 Color
const * pPaintColor
= nullptr);
473 class VCL_DLLPUBLIC Window
: public ::OutputDevice
475 friend class ::vcl::Cursor
;
476 friend class ::OutputDevice
;
477 friend class ::Application
;
478 friend class ::SystemWindow
;
479 friend class ::WorkWindow
;
480 friend class ::Dialog
;
481 friend class ::MessBox
;
482 friend class ::MessageDialog
;
483 friend class ::DockingWindow
;
484 friend class ::FloatingWindow
;
485 friend class ::GroupBox
;
486 friend class ::PushButton
;
487 friend class ::RadioButton
;
488 friend class ::SystemChildWindow
;
489 friend class ::ImplBorderWindow
;
490 friend class ::PaintHelper
;
491 friend class ::LifecycleTest
;
493 // TODO: improve missing functionality
494 // only required because of SetFloatingMode()
495 friend class ::ImplDockingWindowWrapper
;
496 friend class ::ImplPopupFloatWin
;
497 friend class ::MenuFloatingWindow
;
499 friend class ::svt::PopupWindowControllerImpl
;
502 // NOTE: to remove many dependencies of other modules
503 // to this central file, all members are now hidden
504 // in the WindowImpl class and all inline functions
506 // (WindowImpl is a pImpl pattern)
508 // Please do *not* add new members or inline functions to class Window,
509 // but use class WindowImpl instead
511 std::unique_ptr
<WindowImpl
> mpWindowImpl
;
514 friend const char* ::ImplDbgCheckWindow( const void* pObj
);
519 DECL_DLLPRIVATE_LINK( ImplHandlePaintHdl
, Timer
*, void );
520 DECL_DLLPRIVATE_LINK( ImplGenerateMouseMoveHdl
, void*, void );
521 DECL_DLLPRIVATE_LINK( ImplTrackTimerHdl
, Timer
*, void );
522 DECL_DLLPRIVATE_LINK( ImplAsyncFocusHdl
, void*, void );
523 DECL_DLLPRIVATE_LINK( ImplHandleResizeTimerHdl
, Timer
*, void );
526 SAL_DLLPRIVATE
static void ImplInitAppFontData( vcl::Window
const * pWindow
);
528 SAL_DLLPRIVATE
vcl::Window
* ImplGetFrameWindow() const;
529 weld::Window
* GetFrameWeld() const;
530 vcl::Window
* GetFrameWindow() const;
531 SalFrame
* ImplGetFrame() const;
532 SAL_DLLPRIVATE ImplFrameData
* ImplGetFrameData();
534 vcl::Window
* ImplGetWindow() const; ///< if this is a proxy return the client, otherwise itself
535 SAL_DLLPRIVATE ImplWinData
* ImplGetWinData() const;
536 SAL_DLLPRIVATE
vcl::Window
* ImplGetClientWindow() const;
537 SAL_DLLPRIVATE
vcl::Window
* ImplGetDlgWindow( sal_uInt16 n
, GetDlgWindowType nType
, sal_uInt16 nStart
= 0, sal_uInt16 nEnd
= 0xFFFF, sal_uInt16
* pIndex
= nullptr );
538 SAL_DLLPRIVATE
vcl::Window
* ImplGetParent() const;
539 SAL_DLLPRIVATE
vcl::Window
* ImplFindWindow( const Point
& rFramePos
);
541 SAL_DLLPRIVATE
void ImplInvalidateFrameRegion( const vcl::Region
* pRegion
, InvalidateFlags nFlags
);
542 SAL_DLLPRIVATE
void ImplInvalidateOverlapFrameRegion( const vcl::Region
& rRegion
);
544 SAL_DLLPRIVATE
bool ImplSetClipFlag( bool bSysObjOnlySmaller
= false );
546 SAL_DLLPRIVATE
bool ImplIsWindowOrChild( const vcl::Window
* pWindow
, bool bSystemWindow
= false ) const;
547 SAL_DLLPRIVATE
bool ImplIsChild( const vcl::Window
* pWindow
, bool bSystemWindow
= false ) const;
548 SAL_DLLPRIVATE
bool ImplIsFloatingWindow() const;
549 SAL_DLLPRIVATE
bool ImplIsPushButton() const;
550 SAL_DLLPRIVATE
bool ImplIsSplitter() const;
551 SAL_DLLPRIVATE
bool ImplIsOverlapWindow() const;
553 SAL_DLLPRIVATE
void ImplIsInTaskPaneList( bool mbIsInTaskList
);
555 SAL_DLLPRIVATE WindowImpl
* ImplGetWindowImpl() const { return mpWindowImpl
.get(); }
557 SAL_DLLPRIVATE Point
ImplFrameToOutput( const Point
& rPos
);
559 SAL_DLLPRIVATE
void ImplGrabFocus( GetFocusFlags nFlags
);
560 SAL_DLLPRIVATE
void ImplGrabFocusToDocument( GetFocusFlags nFlags
);
561 SAL_DLLPRIVATE
void ImplInvertFocus( const tools::Rectangle
& rRect
);
563 SAL_DLLPRIVATE PointerStyle
ImplGetMousePointer() const;
564 SAL_DLLPRIVATE
void ImplCallMouseMove( sal_uInt16 nMouseCode
, bool bModChanged
= false );
565 SAL_DLLPRIVATE
void ImplGenerateMouseMove();
567 SAL_DLLPRIVATE
void ImplNotifyKeyMouseCommandEventListeners( NotifyEvent
& rNEvt
);
568 SAL_DLLPRIVATE
void ImplNotifyIconifiedState( bool bIconified
);
570 SAL_DLLPRIVATE
void ImplUpdateAll();
572 SAL_DLLPRIVATE
void ImplControlFocus( GetFocusFlags nFlags
= GetFocusFlags::NONE
);
574 SAL_DLLPRIVATE
void ImplMirrorFramePos( Point
&pt
) const;
576 SAL_DLLPRIVATE
void ImplPosSizeWindow( long nX
, long nY
, long nWidth
, long nHeight
, PosSizeFlags nFlags
);
578 SAL_DLLPRIVATE
void ImplCallResize();
579 SAL_DLLPRIVATE
void ImplCallMove();
581 void IncModalCount();
582 void DecModalCount();
584 SAL_DLLPRIVATE
static void ImplCalcSymbolRect( tools::Rectangle
& rRect
);
588 /** This is intended to be used to clear any locally held references to other Window-subclass objects */
589 virtual void dispose() override
;
591 SAL_DLLPRIVATE
void ImplInit( vcl::Window
* pParent
, WinBits nStyle
, SystemParentData
* pSystemParentData
);
593 SAL_DLLPRIVATE Point
ImplOutputToFrame( const Point
& rPos
);
595 SAL_DLLPRIVATE
void ImplInvalidateParentFrameRegion( vcl::Region
& rRegion
);
596 SAL_DLLPRIVATE
void ImplValidateFrameRegion( const vcl::Region
* rRegion
, ValidateFlags nFlags
);
597 SAL_DLLPRIVATE
void ImplValidate();
598 SAL_DLLPRIVATE
void ImplMoveInvalidateRegion( const tools::Rectangle
& rRect
, long nHorzScroll
, long nVertScroll
, bool bChildren
);
599 SAL_DLLPRIVATE
void ImplMoveAllInvalidateRegions( const tools::Rectangle
& rRect
, long nHorzScroll
, long nVertScroll
, bool bChildren
);
601 SAL_DLLPRIVATE
vcl::Window
* ImplGetBorderWindow() const;
603 SAL_DLLPRIVATE
void ImplInvalidate( const vcl::Region
* rRegion
, InvalidateFlags nFlags
);
605 virtual WindowHitTest
ImplHitTest( const Point
& rFramePos
);
607 SAL_DLLPRIVATE
void ImplSetMouseTransparent( bool bTransparent
);
609 SAL_DLLPRIVATE
void ImplScroll( const tools::Rectangle
& rRect
, long nHorzScroll
, long nVertScroll
, ScrollFlags nFlags
);
611 SAL_DLLPRIVATE
bool ImplSetClipFlagChildren( bool bSysObjOnlySmaller
);
612 SAL_DLLPRIVATE
bool ImplSetClipFlagOverlapWindows( bool bSysObjOnlySmaller
= false );
614 SAL_DLLPRIVATE
void PushPaintHelper(PaintHelper
* pHelper
, vcl::RenderContext
& rRenderContext
);
615 SAL_DLLPRIVATE
void PopPaintHelper(PaintHelper
const * pHelper
);
619 SAL_DLLPRIVATE
void ImplSetFrameParent( const vcl::Window
* pParent
);
621 SAL_DLLPRIVATE
void ImplInsertWindow( vcl::Window
* pParent
);
622 SAL_DLLPRIVATE
void ImplRemoveWindow( bool bRemoveFrameData
);
624 SAL_DLLPRIVATE SalGraphics
* ImplGetFrameGraphics() const;
626 SAL_DLLPRIVATE
static void ImplCallFocusChangeActivate( vcl::Window
* pNewOverlapWindow
, vcl::Window
* pOldOverlapWindow
);
627 SAL_DLLPRIVATE
vcl::Window
* ImplGetFirstOverlapWindow();
628 SAL_DLLPRIVATE
const vcl::Window
* ImplGetFirstOverlapWindow() const;
630 SAL_DLLPRIVATE
bool ImplIsRealParentPath( const vcl::Window
* pWindow
) const;
632 SAL_DLLPRIVATE
bool ImplTestMousePointerSet();
634 SAL_DLLPRIVATE
void ImplResetReallyVisible();
635 SAL_DLLPRIVATE
void ImplSetReallyVisible();
637 SAL_DLLPRIVATE
void ImplCallInitShow();
639 SAL_DLLPRIVATE
void ImplInitResolutionSettings();
641 SAL_DLLPRIVATE
void ImplPointToLogic(vcl::RenderContext
const & rRenderContext
, vcl::Font
& rFont
) const;
642 SAL_DLLPRIVATE
void ImplLogicToPoint(vcl::RenderContext
const & rRenderContext
, vcl::Font
& rFont
) const;
644 SAL_DLLPRIVATE
bool ImplSysObjClip( const vcl::Region
* pOldRegion
);
645 SAL_DLLPRIVATE
void ImplUpdateSysObjChildrenClip();
646 SAL_DLLPRIVATE
void ImplUpdateSysObjOverlapsClip();
647 SAL_DLLPRIVATE
void ImplUpdateSysObjClip();
649 SAL_DLLPRIVATE
void ImplIntersectWindowClipRegion( vcl::Region
& rRegion
);
650 SAL_DLLPRIVATE
void ImplIntersectWindowRegion( vcl::Region
& rRegion
);
651 SAL_DLLPRIVATE
void ImplExcludeWindowRegion( vcl::Region
& rRegion
);
652 SAL_DLLPRIVATE
void ImplExcludeOverlapWindows( vcl::Region
& rRegion
) const;
653 SAL_DLLPRIVATE
void ImplExcludeOverlapWindows2( vcl::Region
& rRegion
);
655 SAL_DLLPRIVATE
void ImplClipBoundaries( vcl::Region
& rRegion
, bool bThis
, bool bOverlaps
);
656 SAL_DLLPRIVATE
bool ImplClipChildren( vcl::Region
& rRegion
) const;
657 SAL_DLLPRIVATE
void ImplClipAllChildren( vcl::Region
& rRegion
) const;
658 SAL_DLLPRIVATE
void ImplClipSiblings( vcl::Region
& rRegion
) const;
660 SAL_DLLPRIVATE
void ImplInitWinClipRegion();
661 SAL_DLLPRIVATE
void ImplInitWinChildClipRegion();
662 SAL_DLLPRIVATE
vcl::Region
* ImplGetWinChildClipRegion();
664 SAL_DLLPRIVATE
void ImplIntersectAndUnionOverlapWindows( const vcl::Region
& rInterRegion
, vcl::Region
& rRegion
) const;
665 SAL_DLLPRIVATE
void ImplIntersectAndUnionOverlapWindows2( const vcl::Region
& rInterRegion
, vcl::Region
& rRegion
);
666 SAL_DLLPRIVATE
void ImplCalcOverlapRegionOverlaps( const vcl::Region
& rInterRegion
, vcl::Region
& rRegion
) const;
667 SAL_DLLPRIVATE
void ImplCalcOverlapRegion( const tools::Rectangle
& rSourceRect
, vcl::Region
& rRegion
,
668 bool bChildren
, bool bSiblings
);
670 /** Invoke the actual painting.
672 This function is kind of recursive - it may be called from the
673 PaintHelper destructor; and on the other hand it creates PaintHelper
674 that (when destructed) calls other ImplCallPaint()'s.
676 SAL_DLLPRIVATE
void ImplCallPaint(const vcl::Region
* pRegion
, ImplPaintFlags nPaintFlags
);
678 SAL_DLLPRIVATE
void ImplCallOverlapPaint();
680 SAL_DLLPRIVATE
void ImplUpdateWindowPtr( vcl::Window
* pWindow
);
681 SAL_DLLPRIVATE
void ImplUpdateWindowPtr();
682 SAL_DLLPRIVATE
void ImplUpdateOverlapWindowPtr( bool bNewFrame
);
684 SAL_DLLPRIVATE
bool ImplUpdatePos();
685 SAL_DLLPRIVATE
void ImplUpdateSysObjPos();
687 SAL_DLLPRIVATE
void ImplUpdateGlobalSettings( AllSettings
& rSettings
, bool bCallHdl
= true ) const;
689 SAL_DLLPRIVATE
void ImplToBottomChild();
691 SAL_DLLPRIVATE
void ImplCalcToTop( ImplCalcToTopData
* pPrevData
);
692 SAL_DLLPRIVATE
void ImplToTop( ToTopFlags nFlags
);
693 SAL_DLLPRIVATE
void ImplStartToTop( ToTopFlags nFlags
);
694 SAL_DLLPRIVATE
void ImplFocusToTop( ToTopFlags nFlags
, bool bReallyVisible
);
696 SAL_DLLPRIVATE
void ImplShowAllOverlaps();
697 SAL_DLLPRIVATE
void ImplHideAllOverlaps();
699 SAL_DLLPRIVATE
bool ImplDlgCtrl( const KeyEvent
& rKEvt
, bool bKeyInput
);
700 SAL_DLLPRIVATE
bool ImplHasDlgCtrl() const;
701 SAL_DLLPRIVATE
void ImplDlgCtrlNextWindow();
702 SAL_DLLPRIVATE
void ImplDlgCtrlFocusChanged( vcl::Window
* pWindow
, bool bGetFocus
);
703 SAL_DLLPRIVATE
vcl::Window
* ImplFindDlgCtrlWindow( vcl::Window
* pWindow
);
705 SAL_DLLPRIVATE
static void ImplNewInputContext();
707 SAL_DLLPRIVATE
void ImplCallActivateListeners(vcl::Window
*);
708 SAL_DLLPRIVATE
void ImplCallDeactivateListeners(vcl::Window
*);
710 SAL_DLLPRIVATE
static void ImplHandleScroll(ScrollBar
* pHScrl
, double nX
, ScrollBar
* pVScrl
, double nY
);
712 SAL_DLLPRIVATE
tools::Rectangle
ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle
& rRect
) const;
713 SAL_DLLPRIVATE
long ImplGetUnmirroredOutOffX();
715 // retrieves the list of owner draw decorated windows for this window hierarchy
716 SAL_DLLPRIVATE ::std::vector
<VclPtr
<vcl::Window
> >& ImplGetOwnerDrawList();
718 SAL_DLLPRIVATE
vcl::Window
* ImplGetTopmostFrameWindow();
720 SAL_DLLPRIVATE
tools::Rectangle
ImplGetWindowExtentsRelative( vcl::Window
*pRelativeWindow
, bool bClientOnly
) const;
722 SAL_DLLPRIVATE
bool ImplStopDnd();
723 SAL_DLLPRIVATE
void ImplStartDnd();
725 SAL_DLLPRIVATE
void ImplPaintToDevice( ::OutputDevice
* pTargetOutDev
, const Point
& rPos
);
727 SAL_DLLPRIVATE
css::uno::Reference
< css::rendering::XCanvas
>
728 ImplGetCanvas( bool bSpriteCanvas
) const;
731 virtual vcl::Region
GetActiveClipRegion() const override
;
734 // Single argument ctors shall be explicit.
735 explicit Window( WindowType nType
);
737 void SetCompoundControl( bool bCompound
);
739 void CallEventListeners( VclEventId nEvent
, void* pData
= nullptr );
740 static void FireVclEvent( VclSimpleEvent
& rEvent
);
742 virtual bool AcquireGraphics() const override
;
743 virtual void ReleaseGraphics( bool bRelease
= true ) override
;
745 virtual void InitClipRegion() override
;
747 void ImplClearFontData(bool bNewFontLists
) override
;
748 void ImplRefreshFontData(bool bNewFontLists
) override
;
750 // FIXME: this is a hack to workaround missing layout functionality
751 SAL_DLLPRIVATE
void ImplAdjustNWFSizes();
753 virtual void CopyDeviceArea( SalTwoRect
& aPosAry
, bool bWindowInvalidate
) override
;
754 virtual void ClipToPaintRegion( tools::Rectangle
& rDstRect
) override
;
755 virtual bool UsePolyPolygonForComplexGradient() override
;
757 virtual void ApplySettings(vcl::RenderContext
& rRenderContext
);
759 bool HasMirroredGraphics() const override
;
762 // Single argument ctors shall be explicit.
763 explicit Window( vcl::Window
* pParent
, WinBits nStyle
= 0 );
765 virtual ~Window() override
;
767 ::OutputDevice
const* GetOutDev() const;
768 ::OutputDevice
* GetOutDev();
770 Color
GetBackgroundColor() const override
;
772 virtual void EnableRTL ( bool bEnable
= true ) override
;
773 virtual void MouseMove( const MouseEvent
& rMEvt
);
774 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
775 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
776 virtual void KeyInput( const KeyEvent
& rKEvt
);
777 virtual void KeyUp( const KeyEvent
& rKEvt
);
778 virtual void PrePaint(vcl::RenderContext
& rRenderContext
);
779 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
);
780 virtual void PostPaint(vcl::RenderContext
& rRenderContext
);
782 using OutputDevice::Erase
;
783 void Erase(vcl::RenderContext
& rRenderContext
);
785 virtual void Draw( ::OutputDevice
* pDev
, const Point
& rPos
, const Size
& rSize
, DrawFlags nFlags
);
787 virtual void Resize();
788 virtual void Activate();
789 virtual void Deactivate();
790 virtual void GetFocus();
791 virtual void LoseFocus();
792 virtual void RequestHelp( const HelpEvent
& rHEvt
);
793 virtual void Command( const CommandEvent
& rCEvt
);
794 virtual void Tracking( const TrackingEvent
& rTEvt
);
795 virtual void StateChanged( StateChangedType nStateChange
);
796 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
797 virtual bool PreNotify( NotifyEvent
& rNEvt
);
798 virtual bool EventNotify( NotifyEvent
& rNEvt
);
800 // These methods call the relevant virtual method when not in/post dispose
801 void CompatGetFocus();
802 void CompatLoseFocus();
803 void CompatStateChanged( StateChangedType nStateChange
);
804 void CompatDataChanged( const DataChangedEvent
& rDCEvt
);
805 bool CompatPreNotify( NotifyEvent
& rNEvt
);
806 bool CompatNotify( NotifyEvent
& rNEvt
);
808 void AddEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
809 void RemoveEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
810 void AddChildEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
811 void RemoveChildEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
813 ImplSVEvent
* PostUserEvent( const Link
<void*,void>& rLink
, void* pCaller
= nullptr, bool bReferenceLink
= false );
814 void RemoveUserEvent( ImplSVEvent
* nUserEvent
);
816 // returns the input language used for the last key stroke
817 // may be LANGUAGE_DONTKNOW if not supported by the OS
818 LanguageType
GetInputLanguage() const;
820 void SetStyle( WinBits nStyle
);
821 WinBits
GetStyle() const;
822 WinBits
GetPrevStyle() const;
823 void SetExtendedStyle( WindowExtendedStyle nExtendedStyle
);
824 WindowExtendedStyle
GetExtendedStyle() const;
825 void SetType( WindowType nType
);
826 WindowType
GetType() const;
827 bool IsSystemWindow() const;
828 bool IsDockingWindow() const;
829 bool IsDialog() const;
830 bool IsMenuFloatingWindow() const;
831 bool IsToolbarFloatingWindow() const;
832 bool IsTopWindow() const;
833 bool IsDisposed() const;
834 SystemWindow
* GetSystemWindow() const;
836 /// Can the widget derived from this Window do the double-buffering via RenderContext properly?
837 bool SupportsDoubleBuffering() const;
838 /// Enable/disable double-buffering of the frame window and all its children.
839 void RequestDoubleBuffering(bool bRequest
);
841 void EnableAllResize();
843 void SetBorderStyle( WindowBorderStyle nBorderStyle
);
844 WindowBorderStyle
GetBorderStyle() const;
845 void GetBorder( sal_Int32
& rLeftBorder
, sal_Int32
& rTopBorder
,
846 sal_Int32
& rRightBorder
, sal_Int32
& rBottomBorder
) const;
847 Size
CalcWindowSize( const Size
& rOutSz
) const;
848 Size
CalcOutputSize( const Size
& rWinSz
) const;
849 long CalcTitleWidth() const;
851 void EnableClipSiblings( bool bClipSiblings
= true );
853 void EnableChildTransparentMode( bool bEnable
= true );
854 bool IsChildTransparentModeEnabled() const;
856 void SetMouseTransparent( bool bTransparent
);
857 bool IsMouseTransparent() const;
858 void SetPaintTransparent( bool bTransparent
);
859 bool IsPaintTransparent() const;
860 void SetDialogControlStart( bool bStart
);
861 bool IsDialogControlStart() const;
862 void SetDialogControlFlags( DialogControlFlags nFlags
);
863 DialogControlFlags
GetDialogControlFlags() const;
867 sal_uLong mnState
; // the button state
868 Point maPos
; // mouse position in output coordinates
870 PointerState
GetPointerState();
871 bool IsMouseOver() const;
873 void SetInputContext( const InputContext
& rInputContext
);
874 const InputContext
& GetInputContext() const;
875 void PostExtTextInputEvent(VclEventId nType
, const OUString
& rText
);
876 void EndExtTextInput();
877 void SetCursorRect( const tools::Rectangle
* pRect
= nullptr, long nExtTextInputWidth
= 0 );
878 const tools::Rectangle
* GetCursorRect() const;
879 long GetCursorExtTextInputWidth() const;
881 void SetCompositionCharRect( const tools::Rectangle
* pRect
, long nCompositionLength
, bool bVertical
= false );
883 using ::OutputDevice::SetSettings
;
884 virtual void SetSettings( const AllSettings
& rSettings
) override
;
885 void SetSettings( const AllSettings
& rSettings
, bool bChild
);
886 void UpdateSettings( const AllSettings
& rSettings
, bool bChild
= false );
887 void NotifyAllChildren( DataChangedEvent
& rDCEvt
);
889 void SetPointFont(vcl::RenderContext
& rRenderContext
, const vcl::Font
& rFont
);
890 vcl::Font
GetPointFont(vcl::RenderContext
const & rRenderContext
) const;
891 void SetZoomedPointFont(vcl::RenderContext
& rRenderContext
, const vcl::Font
& rFont
);
892 long GetDrawPixel( ::OutputDevice
const * pDev
, long nPixels
) const;
893 vcl::Font
GetDrawPixelFont( ::OutputDevice
const * pDev
) const;
895 void SetControlFont();
896 void SetControlFont( const vcl::Font
& rFont
);
897 vcl::Font
GetControlFont() const;
898 bool IsControlFont() const;
899 void ApplyControlFont(vcl::RenderContext
& rRenderContext
, const vcl::Font
& rDefaultFont
);
901 void SetControlForeground();
902 void SetControlForeground(const Color
& rColor
);
903 const Color
& GetControlForeground() const;
904 bool IsControlForeground() const;
905 void ApplyControlForeground(vcl::RenderContext
& rRenderContext
, const Color
& rDefaultColor
);
907 void SetControlBackground();
908 void SetControlBackground( const Color
& rColor
);
909 const Color
& GetControlBackground() const;
910 bool IsControlBackground() const;
911 void ApplyControlBackground(vcl::RenderContext
& rRenderContext
, const Color
& rDefaultColor
);
913 void SetParentClipMode( ParentClipMode nMode
= ParentClipMode::NONE
);
914 ParentClipMode
GetParentClipMode() const;
916 void SetWindowRegionPixel();
917 void SetWindowRegionPixel( const vcl::Region
& rRegion
);
918 vcl::Region
GetWindowClipRegionPixel() const;
919 vcl::Region
GetPaintRegion() const;
920 bool IsInPaint() const;
921 // while IsInPaint returns true ExpandPaintClipRegion adds the
922 // submitted region to the paint clip region so you can
923 // paint additional parts of your window if necessary
924 void ExpandPaintClipRegion( const vcl::Region
& rRegion
);
926 void SetParent( vcl::Window
* pNewParent
);
927 vcl::Window
* GetParent() const;
928 // return the dialog we are contained in or NULL if un-contained
929 Dialog
* GetParentDialog() const;
930 bool IsAncestorOf( const vcl::Window
& rWindow
) const;
932 void Show( bool bVisible
= true, ShowFlags nFlags
= ShowFlags::NONE
);
933 void Hide() { Show( false ); }
934 bool IsVisible() const;
935 bool IsReallyVisible() const;
936 bool IsReallyShown() const;
937 bool IsInInitShow() const;
939 void Enable( bool bEnable
= true, bool bChild
= true );
940 void Disable( bool bChild
= true ) { Enable( false, bChild
); }
941 bool IsEnabled() const;
943 void EnableInput( bool bEnable
= true, bool bChild
= true );
944 void EnableInput( bool bEnable
, const vcl::Window
* pExcludeWindow
);
945 bool IsInputEnabled() const;
947 /** Override <code>EnableInput</code>. This can be necessary due to other people
948 using EnableInput for whole window hierarchies.
951 <code>AlwaysEnableInput</code> and <code>AlwaysDisableInput</code> are
952 mutually exclusive; the last setter wins.
954 sets always enabled flag
957 if true children are recursively set to AlwaysEnableInput
959 void AlwaysEnableInput( bool bAlways
, bool bChild
= true );
960 /** returns the current AlwaysEnableInput state
962 true if window is in AlwaysEnableInput state
964 bool IsAlwaysEnableInput() const;
965 /** Override <code>EnableInput</code>, counterpart to AlwaysEnableInput.
966 Windows with AlwaysDisableInput will not get key events even if enabled
967 and input enabled.This can be necessary due to other people using EnableInput
968 for whole window hierarchies.
970 <code>AlwaysEnableInput</code> and <code>AlwaysDisableInput</code> are
971 mutually exclusive; the last setter wins.
974 sets always disable flag
977 if true children are recursively set to AlwaysDisableInput
979 void AlwaysDisableInput( bool bAlways
, bool bChild
= true );
981 /** usually event handlers (see AddEventListener and AddChildEventListener)
982 are not called on disabled, modal or input disabled windows. There are however rare cases
983 in which one wants a Window or rather one of its Control subclasses to
984 not evaluate events but still react to those events externally. In these
985 rare cases call SetCallHandlersOnInputDisabled( true ) to have your handler
988 Currently only mouse events get this special treatment.
990 Use this sparingly, chances are if you want to use it you're working around
994 Enable/Disable calling event handlers for this disabled, modal or input disabled window.
995 This call is implicitly done recursively for possible child windows.
997 void SetCallHandlersOnInputDisabled( bool bCall
);
998 /** get state of SetCallHandlersOnInputDisabled
1000 @returns whether handlers are called regardless of input enabled state
1002 bool IsCallHandlersOnInputDisabled() const;
1003 /** A window is in modal mode if one of its children or subchildren
1004 is a running modal window (a modal dialog)
1006 @returns sal_True if a child or subchild is a running modal window
1008 bool IsInModalMode() const;
1010 void SetActivateMode( ActivateModeFlags nMode
);
1011 ActivateModeFlags
GetActivateMode() const;
1013 void ToTop( ToTopFlags nFlags
= ToTopFlags::NONE
);
1014 void SetZOrder( vcl::Window
* pRefWindow
, ZOrderFlags nFlags
);
1015 void EnableAlwaysOnTop( bool bEnable
= true );
1016 bool IsAlwaysOnTopEnabled() const;
1018 virtual void setPosSizePixel( long nX
, long nY
,
1019 long nWidth
, long nHeight
,
1020 PosSizeFlags nFlags
= PosSizeFlags::All
);
1021 virtual void SetPosPixel( const Point
& rNewPos
);
1022 virtual Point
GetPosPixel() const;
1023 virtual void SetSizePixel( const Size
& rNewSize
);
1024 virtual Size
GetSizePixel() const;
1025 virtual void SetPosSizePixel( const Point
& rNewPos
,
1026 const Size
& rNewSize
);
1027 virtual void SetOutputSizePixel( const Size
& rNewSize
);
1028 bool IsDefaultPos() const;
1029 bool IsDefaultSize() const;
1030 Point
GetOffsetPixelFrom(const vcl::Window
& rWindow
) const;
1032 // those conversion routines might deliver different results during UI mirroring
1033 Point
OutputToScreenPixel( const Point
& rPos
) const;
1034 Point
ScreenToOutputPixel( const Point
& rPos
) const;
1035 // the normalized screen methods work independent from UI mirroring
1036 Point
OutputToNormalizedScreenPixel( const Point
& rPos
) const;
1037 Point
NormalizedScreenToOutputPixel( const Point
& rPos
) const;
1038 Point
OutputToAbsoluteScreenPixel( const Point
& rPos
) const;
1039 Point
AbsoluteScreenToOutputPixel( const Point
& rPos
) const;
1040 tools::Rectangle
GetDesktopRectPixel() const;
1041 // window extents including border and decoration
1042 tools::Rectangle
GetWindowExtentsRelative( vcl::Window
*pRelativeWindow
) const;
1043 // window extents of the client window, coordinates to be used in SetPosPixel
1044 tools::Rectangle
GetClientWindowExtentsRelative() const;
1046 bool IsScrollable() const;
1047 virtual void Scroll( long nHorzScroll
, long nVertScroll
,
1048 ScrollFlags nFlags
= ScrollFlags::NONE
);
1049 void Scroll( long nHorzScroll
, long nVertScroll
,
1050 const tools::Rectangle
& rRect
, ScrollFlags nFlags
= ScrollFlags::NONE
);
1051 virtual void Invalidate( InvalidateFlags nFlags
= InvalidateFlags::NONE
);
1052 virtual void Invalidate( const tools::Rectangle
& rRect
, InvalidateFlags nFlags
= InvalidateFlags::NONE
);
1053 virtual void Invalidate( const vcl::Region
& rRegion
, InvalidateFlags nFlags
= InvalidateFlags::NONE
);
1055 * Notification about some rectangle of the output device got invalidated.Used for the main
1058 * @param pRectangle If 0, that means the whole area, otherwise the area in logic coordinates.
1060 virtual void LogicInvalidate(const tools::Rectangle
* pRectangle
);
1063 * Notification about some rectangle of the output device got invalidated. Used for the
1064 * dialogs and floating windows (e.g. context menu, popup).
1066 * @param pRectangle If 0, that means the whole area, otherwise the area in pixel coordinates.
1068 virtual void PixelInvalidate(const tools::Rectangle
* pRectangle
);
1070 bool HasPaintEvent() const;
1072 void Flush() override
;
1074 // toggles new docking support, enabled via toolkit
1075 void EnableDocking( bool bEnable
= true );
1076 // retrieves the single dockingmanager instance
1077 static DockingManager
* GetDockingManager();
1079 void EnablePaint( bool bEnable
);
1080 bool IsPaintEnabled() const;
1081 void SetUpdateMode( bool bUpdate
);
1082 bool IsUpdateMode() const;
1083 void SetParentUpdateMode( bool bUpdate
);
1086 bool HasFocus() const;
1087 bool HasChildPathFocus( bool bSystemWindow
= false ) const;
1088 bool IsActive() const;
1089 bool HasActiveChildFrame() const;
1090 GetFocusFlags
GetGetFocusFlags() const;
1091 void GrabFocusToDocument();
1092 VclPtr
<vcl::Window
> GetFocusedWindow() const;
1095 * Set this when you need to act as if the window has focus even if it
1096 * doesn't. This is necessary for implementing tab stops inside floating
1097 * windows, but floating windows don't get focus from the system.
1099 void SetFakeFocus( bool bFocus
);
1101 bool IsCompoundControl() const;
1103 static VclPtr
<vcl::Window
> SaveFocus();
1104 static void EndSaveFocus(const VclPtr
<vcl::Window
>& xFocusWin
);
1106 void CaptureMouse();
1107 void ReleaseMouse();
1108 bool IsMouseCaptured() const;
1110 void SetPointer( PointerStyle
);
1111 PointerStyle
GetPointer() const;
1112 void EnableChildPointerOverwrite( bool bOverwrite
);
1113 void SetPointerPosPixel( const Point
& rPos
);
1114 Point
GetPointerPosPixel();
1115 Point
GetLastPointerPosPixel();
1116 /// Similar to SetPointerPosPixel(), but sets the frame data's last mouse position instead.
1117 void SetLastMousePos(const Point
& rPos
);
1118 void ShowPointer( bool bVisible
);
1121 bool IsWait() const;
1123 void SetCursor( vcl::Cursor
* pCursor
);
1124 vcl::Cursor
* GetCursor() const;
1126 void SetZoom( const Fraction
& rZoom
);
1127 const Fraction
& GetZoom() const;
1128 bool IsZoom() const;
1129 long CalcZoom( long n
) const;
1131 virtual void SetText( const OUString
& rStr
);
1132 virtual OUString
GetText() const;
1133 // return the actual text displayed
1134 // this may have e.g. accelerators removed or portions
1135 // replaced by ellipses
1136 virtual OUString
GetDisplayText() const;
1137 // gets the visible background color. for transparent windows
1138 // this may be the parent's background color; for controls
1139 // this may be a child's background color (e.g. ListBox)
1140 virtual const Wallpaper
& GetDisplayBackground() const;
1142 void SetHelpText( const OUString
& rHelpText
);
1143 const OUString
& GetHelpText() const;
1145 void SetQuickHelpText( const OUString
& rHelpText
);
1146 const OUString
& GetQuickHelpText() const;
1148 void SetHelpId( const OString
& );
1149 const OString
& GetHelpId() const;
1151 vcl::Window
* FindWindow( const Point
& rPos
) const;
1153 sal_uInt16
GetChildCount() const;
1154 vcl::Window
* GetChild( sal_uInt16 nChild
) const;
1155 vcl::Window
* GetWindow( GetWindowType nType
) const;
1156 bool IsChild( const vcl::Window
* pWindow
) const;
1157 bool IsWindowOrChild( const vcl::Window
* pWindow
, bool bSystemWindow
= false ) const;
1159 /// Add all children to rAllChildren recursively.
1160 SAL_DLLPRIVATE
void CollectChildren(::std::vector
<vcl::Window
*>& rAllChildren
);
1162 virtual void ShowFocus(const tools::Rectangle
& rRect
);
1165 // transparent background for selected or checked items in toolboxes etc.
1166 void DrawSelectionBackground( const tools::Rectangle
& rRect
, sal_uInt16 highlight
, bool bChecked
, bool bDrawBorder
);
1168 void ShowTracking( const tools::Rectangle
& rRect
,
1169 ShowTrackFlags nFlags
= ShowTrackFlags::Small
);
1170 void HideTracking();
1171 void InvertTracking( const tools::Rectangle
& rRect
, ShowTrackFlags nFlags
);
1173 void StartTracking( StartTrackingFlags nFlags
= StartTrackingFlags::NONE
);
1174 void EndTracking( TrackingEventFlags nFlags
= TrackingEventFlags::NONE
);
1175 bool IsTracking() const;
1177 void StartAutoScroll( StartAutoScrollFlags nFlags
);
1178 void EndAutoScroll();
1180 bool HandleScrollCommand( const CommandEvent
& rCmd
,
1182 ScrollBar
* pVScrl
);
1184 void SaveBackground(VirtualDevice
& rSaveDevice
,
1185 const Point
& rPos
, const Size
& rSize
, const Size
&) const override
;
1187 virtual const SystemEnvData
* GetSystemData() const;
1189 // API to set/query the component interfaces
1190 virtual css::uno::Reference
< css::awt::XWindowPeer
>
1191 GetComponentInterface( bool bCreate
= true );
1193 void SetComponentInterface( css::uno::Reference
< css::awt::XWindowPeer
> const & xIFace
);
1195 /// Interface to register for dialog / window tunneling.
1196 void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier
* pNotifier
, bool bParent
= false);
1197 const vcl::ILibreOfficeKitNotifier
* GetLOKNotifier() const;
1198 vcl::LOKWindowId
GetLOKWindowId() const;
1200 /// Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set.
1201 VclPtr
<vcl::Window
> GetParentWithLOKNotifier();
1203 /// Indicate that LOK is not going to use this dialog any more.
1204 void ReleaseLOKNotifier();
1206 /// Find an existing Window based on the LOKWindowId.
1207 static VclPtr
<vcl::Window
> FindLOKWindow(vcl::LOKWindowId nWindowId
);
1209 /// check if LOK Window container is empty
1210 static bool IsLOKWindowsEmpty();
1212 /// Dumps itself and potentially its children to a property tree, to be written easily to JSON.
1213 virtual boost::property_tree::ptree
DumpAsPropertyTree();
1215 /// Same as MouseButtonDown(), but coordinates are in logic unit. used for LOK
1216 virtual void LogicMouseButtonDown(const MouseEvent
&) {};
1217 /// Same as MouseButtonUp(), but coordinates are in logic unit. used for LOK
1218 virtual void LogicMouseButtonUp(const MouseEvent
&) {};
1219 /// Same as MouseMove(), but coordinates are in logic unit. used for LOK
1220 virtual void LogicMouseMove(const MouseEvent
&) {};
1222 /** @name Accessibility
1227 css::uno::Reference
< css::accessibility::XAccessible
>
1228 GetAccessible( bool bCreate
= true );
1230 virtual css::uno::Reference
< css::accessibility::XAccessible
>
1233 void SetAccessible( const css::uno::Reference
< css::accessibility::XAccessible
>& );
1235 vcl::Window
* GetAccessibleParentWindow() const;
1236 sal_uInt16
GetAccessibleChildWindowCount();
1237 vcl::Window
* GetAccessibleChildWindow( sal_uInt16 n
);
1239 void SetAccessibleRole( sal_uInt16 nRole
);
1240 sal_uInt16
GetAccessibleRole() const;
1242 void SetAccessibleName( const OUString
& rName
);
1243 OUString
GetAccessibleName() const;
1245 void SetAccessibleDescription( const OUString
& rDescr
);
1246 OUString
GetAccessibleDescription() const;
1248 void SetAccessibleRelationLabeledBy( vcl::Window
* pLabeledBy
);
1249 vcl::Window
* GetAccessibleRelationLabeledBy() const;
1251 void SetAccessibleRelationLabelFor( vcl::Window
* pLabelFor
);
1252 vcl::Window
* GetAccessibleRelationLabelFor() const;
1254 void SetAccessibleRelationMemberOf( vcl::Window
* pMemberOf
);
1255 vcl::Window
* GetAccessibleRelationMemberOf() const;
1257 // to avoid sending accessibility events in cases like closing dialogs
1258 // by default checks complete parent path
1259 bool IsAccessibilityEventsSuppressed( bool bTraverseParentPath
= true );
1260 void SetAccessibilityEventsSuppressed(bool bSuppressed
);
1262 KeyEvent
GetActivationKey() const;
1266 // These eventually are supposed to go when everything is converted to .ui
1267 SAL_DLLPRIVATE
vcl::Window
* getLegacyNonLayoutAccessibleRelationMemberOf() const;
1268 SAL_DLLPRIVATE
vcl::Window
* getLegacyNonLayoutAccessibleRelationLabeledBy() const;
1269 SAL_DLLPRIVATE
vcl::Window
* getLegacyNonLayoutAccessibleRelationLabelFor() const;
1271 // Let Label override the code part of GetAccessibleRelationLabelFor
1272 virtual vcl::Window
* getAccessibleRelationLabelFor() const;
1273 virtual sal_uInt16
getDefaultAccessibleRole() const;
1274 virtual OUString
getDefaultAccessibleName() const;
1277 * Advisory Sizing - what is a good size for this widget
1279 * Retrieves the preferred size of a widget ignoring
1280 * "width-request" and "height-request" properties.
1282 * Implement this in sub-classes to tell layout
1283 * the preferred widget size.
1285 * Use get_preferred_size to retrieve this value
1286 * cached and mediated via height and width requests
1288 virtual Size
GetOptimalSize() const;
1289 /// clear OptimalSize cache
1290 void InvalidateSizeCache();
1293 SAL_DLLPRIVATE
bool ImplIsAccessibleCandidate() const;
1294 SAL_DLLPRIVATE
bool ImplIsAccessibleNativeFrame() const;
1298 * Retrieves the preferred size of a widget taking
1299 * into account the "width-request" and "height-request" properties.
1301 * Overrides the result of GetOptimalSize to honor the
1302 * width-request and height-request properties.
1304 * So the same as get_ungrouped_preferred_size except
1305 * it ignores groups. A building block of get_preferred_size
1306 * that access the size cache
1308 * @see get_preferred_size
1310 Size
get_ungrouped_preferred_size() const;
1312 /// request XCanvas render interface for this window
1313 css::uno::Reference
< css::rendering::XCanvas
>
1315 /// request XSpriteCanvas render interface for this window
1316 css::uno::Reference
< css::rendering::XSpriteCanvas
>
1317 GetSpriteCanvas() const;
1319 /* records all DrawText operations within the passed rectangle;
1320 * a synchronous paint is sent to achieve this
1322 void RecordLayoutData( vcl::ControlLayoutData
* pLayout
, const tools::Rectangle
& rRect
);
1324 // set and retrieve for Toolkit
1325 VCLXWindow
* GetWindowPeer() const;
1326 void SetWindowPeer( css::uno::Reference
< css::awt::XWindowPeer
> const & xPeer
, VCLXWindow
* pVCLXWindow
);
1328 // remember if it was generated by Toolkit
1329 bool IsCreatedWithToolkit() const;
1330 void SetCreatedWithToolkit( bool b
);
1332 // Drag and Drop interfaces
1333 css::uno::Reference
< css::datatransfer::dnd::XDropTarget
> GetDropTarget();
1334 css::uno::Reference
< css::datatransfer::dnd::XDragSource
> GetDragSource();
1335 css::uno::Reference
< css::datatransfer::dnd::XDragGestureRecognizer
> GetDragGestureRecognizer();
1337 // Clipboard/Selection interfaces
1338 css::uno::Reference
< css::datatransfer::clipboard::XClipboard
> GetClipboard();
1339 /// Sets a custom clipboard for the window's frame, instead of creating it on-demand using css::datatransfer::clipboard::SystemClipboard.
1340 void SetClipboard(css::uno::Reference
<css::datatransfer::clipboard::XClipboard
> const & xClipboard
);
1341 css::uno::Reference
< css::datatransfer::clipboard::XClipboard
> GetPrimarySelection();
1344 * Widgets call this to inform their owner container that the widget wants
1345 * to renegotiate its size. Should be called when a widget has a new size
1346 * request. e.g. a FixedText Control gets a new label.
1348 * akin to gtk_widget_queue_resize
1350 virtual void queue_resize(StateChangedType eReason
= StateChangedType::Layout
);
1353 * Sets the "height-request" property
1355 * Override for height request of the widget, or -1 if natural request
1358 * @see get_preferred_size, set_width_request
1360 void set_height_request(sal_Int32 nHeightRequest
);
1361 sal_Int32
get_height_request() const;
1364 * Sets the "width-request" property
1366 * Override for width request of the widget, or -1 if natural request
1369 * @see get_preferred_size, set_height_request
1371 void set_width_request(sal_Int32 nWidthRequest
);
1372 sal_Int32
get_width_request() const;
1375 * Retrieves the preferred size of a widget taking
1376 * into account the "width-request" and "height-request" properties.
1378 * Overrides the result of GetOptimalSize to honor the
1379 * width-request and height-request properties.
1381 * @see GetOptimalSize
1383 * akin to gtk_widget_get_preferred_size
1385 Size
get_preferred_size() const;
1388 * How to horizontally align this widget
1390 VclAlign
get_halign() const;
1391 void set_halign(VclAlign eAlign
);
1394 * How to vertically align this widget
1396 VclAlign
get_valign() const;
1397 void set_valign(VclAlign eAlign
);
1400 * Whether the widget would like to use any available extra horizontal
1403 bool get_hexpand() const;
1404 void set_hexpand(bool bExpand
);
1407 * Whether the widget would like to use any available extra vertical
1410 bool get_vexpand() const;
1411 void set_vexpand(bool bExpand
);
1414 * Whether the widget would like to use any available extra space.
1416 bool get_expand() const;
1417 void set_expand(bool bExpand
);
1420 * Whether the widget should receive extra space when the parent grows
1422 bool get_fill() const;
1423 void set_fill(bool bFill
);
1425 void set_border_width(sal_Int32 nBorderWidth
);
1426 sal_Int32
get_border_width() const;
1428 void set_margin_left(sal_Int32 nWidth
);
1429 sal_Int32
get_margin_left() const;
1431 void set_margin_right(sal_Int32 nWidth
);
1432 sal_Int32
get_margin_right() const;
1434 void set_margin_top(sal_Int32 nWidth
);
1435 sal_Int32
get_margin_top() const;
1437 void set_margin_bottom(sal_Int32 nWidth
);
1438 sal_Int32
get_margin_bottom() const;
1441 * How the widget is packed with reference to the start or end of the parent
1443 VclPackType
get_pack_type() const;
1444 void set_pack_type(VclPackType ePackType
);
1447 * The extra space to put between the widget and its neighbors
1449 sal_Int32
get_padding() const;
1450 void set_padding(sal_Int32 nPadding
);
1453 * The number of columns that the widget spans
1455 sal_Int32
get_grid_width() const;
1456 void set_grid_width(sal_Int32 nCols
);
1459 * The column number to attach the left side of the widget to
1461 sal_Int32
get_grid_left_attach() const;
1462 void set_grid_left_attach(sal_Int32 nAttach
);
1465 * The number of row that the widget spans
1467 sal_Int32
get_grid_height() const;
1468 void set_grid_height(sal_Int32 nRows
);
1471 * The row number to attach the top side of the widget to
1473 sal_Int32
get_grid_top_attach() const;
1474 void set_grid_top_attach(sal_Int32 nAttach
);
1477 * If true this child appears in a secondary layout group of children
1478 * e.g. help buttons in a buttonbox
1480 bool get_secondary() const;
1481 void set_secondary(bool bSecondary
);
1484 * If true this child is exempted from homogeneous sizing
1485 * e.g. special button in a buttonbox
1487 bool get_non_homogeneous() const;
1488 void set_non_homogeneous(bool bNonHomogeneous
);
1491 * Sets a widget property
1493 * @return false if property is unknown
1495 virtual bool set_property(const OString
&rKey
, const OUString
&rValue
);
1498 * Sets a font attribute
1500 * @return false if attribute is unknown
1502 bool set_font_attribute(const OString
&rKey
, const OUString
&rValue
);
1505 * Adds this widget to the xGroup VclSizeGroup
1508 void add_to_size_group(const std::shared_ptr
<VclSizeGroup
>& xGroup
);
1509 void remove_from_all_size_groups();
1512 * add/remove mnemonic label
1514 void add_mnemonic_label(FixedText
*pLabel
);
1515 void remove_mnemonic_label(FixedText
*pLabel
);
1516 const std::vector
<VclPtr
<FixedText
> >& list_mnemonic_labels() const;
1519 * Move this widget to be the nNewPosition'd child of its parent
1521 void reorderWithinParent(sal_uInt16 nNewPosition
);
1526 void set_id(const OUString
& rID
);
1529 * Get the ID of the window.
1531 const OUString
& get_id() const;
1534 // Native Widget Rendering functions
1537 // form controls must never use native widgets, this can be toggled here
1538 void EnableNativeWidget( bool bEnable
= true );
1539 bool IsNativeWidgetEnabled() const;
1541 // a helper method for a Control's Draw method
1542 void PaintToDevice( ::OutputDevice
* pDevice
, const Point
& rPos
, const Size
& rSize
);
1544 /* tdf#119390 set parent to default window. Typically for use in advance of destroying
1545 * a floating windows which has the current focus so focus will revert to the main
1546 * document window and not the first widget in the current parent of the floating
1549 void SetParentToDefaultWindow();
1552 // Keyboard access functions
1554 /** Query the states of keyboard indicators - Caps Lock, Num Lock and
1555 Scroll Lock. Use the following mask to retrieve the state of each
1558 KeyIndicatorState::CAPS_LOCK
1559 KeyIndicatorState::NUM_LOCK
1560 KeyIndicatorState::SCROLL_LOCK
1562 KeyIndicatorState
GetIndicatorState() const;
1564 void SimulateKeyPress( sal_uInt16 nKeyCode
) const;
1566 virtual OUString
GetSurroundingText() const;
1567 virtual Selection
GetSurroundingTextSelection() const;
1569 virtual FactoryFunction
GetUITestFactory() const;
1571 virtual bool IsChart() const { return false; }
1573 void SetHelpHdl(const Link
<vcl::Window
&, bool>& rLink
);
1574 void SetMnemonicActivateHdl(const Link
<vcl::Window
&, bool>& rLink
);
1575 void SetModalHierarchyHdl(const Link
<bool, void>& rLink
);
1580 #endif // INCLUDED_VCL_WINDOW_HXX
1582 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */