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
;
66 enum class ImplPaintFlags
;
67 enum class VclEventId
;
68 enum class PointerStyle
;
70 namespace com::sun::star
{
71 namespace accessibility
{
72 struct AccessibleRelation
;
85 namespace datatransfer::clipboard
{
88 namespace datatransfer::dnd
{
89 class XDragGestureRecognizer
;
96 struct ControlLayoutData
;
99 namespace svt
{ class PopupWindowControllerImpl
; }
101 namespace weld
{ class Window
; }
103 template<class T
> class VclPtr
;
104 namespace tools
{ class JsonWriter
; }
106 // Type for GetWindow()
107 enum class GetWindowType
121 FirstTopWindowChild
= 13,
122 NextTopWindowSibling
= 16,
125 // Flags for setPosSizePixel()
126 // These must match the definitions in css::awt::PosSize
127 enum class PosSizeFlags
135 Size
= Width
| Height
,
136 PosSize
= Pos
| Size
,
142 template<> struct typed_flags
<PosSizeFlags
> : is_typed_flags
<PosSizeFlags
, 0x000f> {};
145 // Flags for SetZOrder()
146 enum class ZOrderFlags
156 template<> struct typed_flags
<ZOrderFlags
> : is_typed_flags
<ZOrderFlags
, 0x000f> {};
160 enum class ActivateModeFlags
167 template<> struct typed_flags
<ActivateModeFlags
> : is_typed_flags
<ActivateModeFlags
, 0x0001> {};
171 enum class ToTopFlags
174 RestoreWhenMin
= 0x0001,
175 ForegroundTask
= 0x0002,
176 NoGrabFocus
= 0x0004,
177 GrabFocusOnly
= 0x0008,
181 template<> struct typed_flags
<ToTopFlags
> : is_typed_flags
<ToTopFlags
, 0x000f> {};
184 // Flags for Invalidate
185 // must match css::awt::InvalidateStyle
186 enum class InvalidateFlags
189 /** The child windows are invalidated, too. */
191 /** The child windows are not invalidated. */
193 /** The invalidated area is painted with the background color/pattern. */
195 /** The invalidated area is updated immediately. */
197 /** The parent window is invalidated, too. */
198 Transparent
= 0x0010,
199 /** The parent window is not invalidated. */
200 NoTransparent
= 0x0020,
201 /** The area is invalidated regardless of overlapping child windows. */
202 NoClipChildren
= 0x4000,
206 template<> struct typed_flags
<InvalidateFlags
> : is_typed_flags
<InvalidateFlags
, 0x403f> {};
209 // Flags for Validate
210 enum class ValidateFlags
218 template<> struct typed_flags
<ValidateFlags
> : is_typed_flags
<ValidateFlags
, 0x0003> {};
222 enum class ScrollFlags
228 UseClipRegion
= 0x0008,
233 template<> struct typed_flags
<ScrollFlags
> : is_typed_flags
<ScrollFlags
, 0x001f> {};
236 // Flags for ParentClipMode
237 enum class ParentClipMode
245 template<> struct typed_flags
<ParentClipMode
> : is_typed_flags
<ParentClipMode
, 0x0003> {};
248 // Flags for ShowTracking()
249 enum class ShowTrackFlags
{
256 TrackWindow
= 0x1000,
261 template<> struct typed_flags
<ShowTrackFlags
> : is_typed_flags
<ShowTrackFlags
, 0x300f> {};
264 // Flags for StartTracking()
265 enum class StartTrackingFlags
269 ScrollRepeat
= 0x0004,
270 ButtonRepeat
= 0x0008,
275 template<> struct typed_flags
<StartTrackingFlags
> : is_typed_flags
<StartTrackingFlags
, 0x000f> {};
278 // Flags for StartAutoScroll()
279 enum class StartAutoScrollFlags
287 template<> struct typed_flags
<StartAutoScrollFlags
> : is_typed_flags
<StartAutoScrollFlags
, 0x0003> {};
290 // Flags for StateChanged()
291 enum class StateChangedType
: sal_uInt16
303 ControlForeground
= 14,
304 ControlBackground
= 15,
312 // must match constants in css:awt::FocusChangeReason
313 enum class GetFocusFlags
317 CURSOR
= 0x0002, // avoid name-clash with X11 #define
323 UniqueMnemonic
= 0x0100,
325 FloatWinPopupModeEndCancel
= 0x0400,
329 template<> struct typed_flags
<GetFocusFlags
> : is_typed_flags
<GetFocusFlags
, 0x077f> {};
332 // DialogControl-Flags
333 enum class DialogControlFlags
338 FloatWinPopupModeEndCancel
= 0x0004,
342 template<> struct typed_flags
<DialogControlFlags
> : is_typed_flags
<DialogControlFlags
, 0x0007> {};
345 // EndExtTextInput() Flags
346 enum class EndExtTextInputFlags
353 template<> struct typed_flags
<EndExtTextInputFlags
> : is_typed_flags
<EndExtTextInputFlags
, 0x0001> {};
356 #define IMPL_MINSIZE_BUTTON_WIDTH 70
357 #define IMPL_MINSIZE_BUTTON_HEIGHT 22
358 #define IMPL_EXTRA_BUTTON_WIDTH 18
359 #define IMPL_EXTRA_BUTTON_HEIGHT 10
360 #define IMPL_SEP_BUTTON_X 5
361 #define IMPL_SEP_BUTTON_Y 5
362 #define IMPL_MINSIZE_MSGBOX_WIDTH 150
363 #define IMPL_DIALOG_OFFSET 5
364 #define IMPL_DIALOG_BAR_OFFSET 3
365 #define IMPL_MSGBOX_OFFSET_EXTRA_X 0
366 #define IMPL_MSGBOX_OFFSET_EXTRA_Y 2
367 #define IMPL_SEP_MSGBOX_IMAGE 8
369 // ImplGetDlgWindow()
370 enum class GetDlgWindowType
377 const char* ImplDbgCheckWindow( const void* pObj
);
380 namespace vcl
{ class Window
; }
381 namespace vcl
{ class Cursor
; }
382 namespace vcl
{ class WindowOutputDevice
; }
393 class FloatingWindow
;
397 class SalInstanceWidget
;
398 class SystemChildWindow
;
399 class ImplDockingWindowWrapper
;
400 class ImplPopupFloatWin
;
404 enum class WindowHitTest
{
410 template<> struct typed_flags
<WindowHitTest
> : is_typed_flags
<WindowHitTest
, 0x0003> {};
414 enum class WindowExtendedStyle
{
417 DocModified
= 0x0002,
419 * This is a frame window that is requested to be hidden (not just "not yet
425 template<> struct typed_flags
<WindowExtendedStyle
> : is_typed_flags
<WindowExtendedStyle
, 0x0007> {};
433 // transparent background for selected or checked items in toolboxes etc.
434 // + selection Color with a text color complementing the selection background
436 static void DrawSelectionBackground(vcl::RenderContext
& rRenderContext
, vcl::Window
const & rWindow
,
437 const tools::Rectangle
& rRect
, sal_uInt16 nHighlight
,
438 bool bChecked
, bool bDrawBorder
, bool bDrawExtBorderOnly
,
439 Color
* pSelectionTextColor
= nullptr, tools::Long nCornerRadius
= 0,
440 Color
const * pPaintColor
= nullptr);
443 class VCL_DLLPUBLIC Window
: public virtual VclReferenceBase
445 friend class ::vcl::Cursor
;
446 friend class ::vcl::WindowOutputDevice
;
447 friend class ::OutputDevice
;
448 friend class ::Application
;
449 friend class ::SystemWindow
;
450 friend class ::WorkWindow
;
451 friend class ::Dialog
;
453 friend class ::MessBox
;
454 friend class ::MessageDialog
;
455 friend class ::DockingWindow
;
456 friend class ::FloatingWindow
;
457 friend class ::GroupBox
;
458 friend class ::PushButton
;
459 friend class ::RadioButton
;
460 friend class ::SalInstanceWidget
;
461 friend class ::SystemChildWindow
;
462 friend class ::ImplBorderWindow
;
463 friend class ::PaintHelper
;
464 friend class ::LifecycleTest
;
465 friend class ::VclEventListeners
;
467 // TODO: improve missing functionality
468 // only required because of SetFloatingMode()
469 friend class ::ImplDockingWindowWrapper
;
470 friend class ::ImplPopupFloatWin
;
471 friend class ::MenuFloatingWindow
;
473 friend class ::svt::PopupWindowControllerImpl
;
476 // NOTE: to remove many dependencies of other modules
477 // to this central file, all members are now hidden
478 // in the WindowImpl class and all inline functions
480 // (WindowImpl is a pImpl pattern)
482 // Please do *not* add new members or inline functions to class Window,
483 // but use class WindowImpl instead
485 std::unique_ptr
<WindowImpl
> mpWindowImpl
;
488 friend const char* ::ImplDbgCheckWindow( const void* pObj
);
493 DECL_DLLPRIVATE_LINK( ImplHandlePaintHdl
, Timer
*, void );
494 DECL_DLLPRIVATE_LINK( ImplGenerateMouseMoveHdl
, void*, void );
495 DECL_DLLPRIVATE_LINK( ImplTrackTimerHdl
, Timer
*, void );
496 DECL_DLLPRIVATE_LINK( ImplAsyncFocusHdl
, void*, void );
497 DECL_DLLPRIVATE_LINK( ImplHandleResizeTimerHdl
, Timer
*, void );
500 SAL_DLLPRIVATE
static void ImplInitAppFontData( vcl::Window
const * pWindow
);
502 SAL_DLLPRIVATE
vcl::Window
* ImplGetFrameWindow() const;
503 weld::Window
* GetFrameWeld() const;
504 vcl::Window
* GetFrameWindow() const;
505 SalFrame
* ImplGetFrame() const;
506 SAL_DLLPRIVATE ImplFrameData
* ImplGetFrameData();
508 vcl::Window
* ImplGetWindow() const; ///< if this is a proxy return the client, otherwise itself
509 SAL_DLLPRIVATE ImplWinData
* ImplGetWinData() const;
510 SAL_DLLPRIVATE
vcl::Window
* ImplGetClientWindow() const;
511 SAL_DLLPRIVATE
vcl::Window
* ImplGetDlgWindow( sal_uInt16 n
, GetDlgWindowType nType
, sal_uInt16 nStart
= 0, sal_uInt16 nEnd
= 0xFFFF, sal_uInt16
* pIndex
= nullptr );
512 SAL_DLLPRIVATE
vcl::Window
* ImplGetParent() const;
513 SAL_DLLPRIVATE
vcl::Window
* ImplFindWindow( const Point
& rFramePos
);
515 SAL_DLLPRIVATE
void ImplInvalidateFrameRegion( const vcl::Region
* pRegion
, InvalidateFlags nFlags
);
516 SAL_DLLPRIVATE
void ImplInvalidateOverlapFrameRegion( const vcl::Region
& rRegion
);
518 SAL_DLLPRIVATE
bool ImplSetClipFlag( bool bSysObjOnlySmaller
= false );
520 SAL_DLLPRIVATE
bool ImplIsWindowOrChild( const vcl::Window
* pWindow
, bool bSystemWindow
= false ) const;
521 SAL_DLLPRIVATE
bool ImplIsChild( const vcl::Window
* pWindow
, bool bSystemWindow
= false ) const;
522 SAL_DLLPRIVATE
bool ImplIsFloatingWindow() const;
523 SAL_DLLPRIVATE
bool ImplIsPushButton() const;
524 SAL_DLLPRIVATE
bool ImplIsSplitter() const;
525 SAL_DLLPRIVATE
bool ImplIsOverlapWindow() const;
527 SAL_DLLPRIVATE
void ImplIsInTaskPaneList( bool mbIsInTaskList
);
529 SAL_DLLPRIVATE WindowImpl
* ImplGetWindowImpl() const { return mpWindowImpl
.get(); }
531 SAL_DLLPRIVATE
void ImplGrabFocus( GetFocusFlags nFlags
);
532 SAL_DLLPRIVATE
void ImplGrabFocusToDocument( GetFocusFlags nFlags
);
533 SAL_DLLPRIVATE
void ImplInvertFocus( const tools::Rectangle
& rRect
);
535 SAL_DLLPRIVATE PointerStyle
ImplGetMousePointer() const;
536 SAL_DLLPRIVATE
void ImplCallMouseMove( sal_uInt16 nMouseCode
, bool bModChanged
= false );
537 SAL_DLLPRIVATE
void ImplGenerateMouseMove();
539 SAL_DLLPRIVATE
void ImplNotifyKeyMouseCommandEventListeners( NotifyEvent
& rNEvt
);
540 SAL_DLLPRIVATE
void ImplNotifyIconifiedState( bool bIconified
);
542 SAL_DLLPRIVATE
void ImplUpdateAll();
544 SAL_DLLPRIVATE
void ImplControlFocus( GetFocusFlags nFlags
= GetFocusFlags::NONE
);
546 SAL_DLLPRIVATE
void ImplMirrorFramePos( Point
&pt
) const;
548 SAL_DLLPRIVATE
void ImplPosSizeWindow( tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
, PosSizeFlags nFlags
);
550 SAL_DLLPRIVATE
void ImplCallResize();
551 SAL_DLLPRIVATE
void ImplCallMove();
553 // These methods call the relevant virtual method when not in/post dispose
554 SAL_DLLPRIVATE
void CompatGetFocus();
555 SAL_DLLPRIVATE
void CompatLoseFocus();
556 SAL_DLLPRIVATE
void CompatStateChanged( StateChangedType nStateChange
);
557 SAL_DLLPRIVATE
void CompatDataChanged( const DataChangedEvent
& rDCEvt
);
558 SAL_DLLPRIVATE
bool CompatPreNotify( NotifyEvent
& rNEvt
);
559 SAL_DLLPRIVATE
bool CompatNotify( NotifyEvent
& rNEvt
);
561 void IncModalCount();
562 void DecModalCount();
564 SAL_DLLPRIVATE
static void ImplCalcSymbolRect( tools::Rectangle
& rRect
);
568 /** This is intended to be used to clear any locally held references to other Window-subclass objects */
569 virtual void dispose() override
;
571 SAL_DLLPRIVATE
void ImplInit( vcl::Window
* pParent
, WinBits nStyle
, SystemParentData
* pSystemParentData
);
573 SAL_DLLPRIVATE
void ImplInvalidateParentFrameRegion( const vcl::Region
& rRegion
);
574 SAL_DLLPRIVATE
void ImplValidateFrameRegion( const vcl::Region
* rRegion
, ValidateFlags nFlags
);
575 SAL_DLLPRIVATE
void ImplValidate();
576 SAL_DLLPRIVATE
void ImplMoveInvalidateRegion( const tools::Rectangle
& rRect
, tools::Long nHorzScroll
, tools::Long nVertScroll
, bool bChildren
);
577 SAL_DLLPRIVATE
void ImplMoveAllInvalidateRegions( const tools::Rectangle
& rRect
, tools::Long nHorzScroll
, tools::Long nVertScroll
, bool bChildren
);
579 SAL_DLLPRIVATE
vcl::Window
* ImplGetBorderWindow() const;
581 virtual void ImplInvalidate( const vcl::Region
* pRegion
, InvalidateFlags nFlags
);
583 virtual WindowHitTest
ImplHitTest( const Point
& rFramePos
);
585 SAL_DLLPRIVATE
void ImplSetMouseTransparent( bool bTransparent
);
587 SAL_DLLPRIVATE
void ImplScroll( const tools::Rectangle
& rRect
, tools::Long nHorzScroll
, tools::Long nVertScroll
, ScrollFlags nFlags
);
589 SAL_DLLPRIVATE
bool ImplSetClipFlagChildren( bool bSysObjOnlySmaller
);
590 SAL_DLLPRIVATE
bool ImplSetClipFlagOverlapWindows( bool bSysObjOnlySmaller
= false );
592 SAL_DLLPRIVATE
void PushPaintHelper(PaintHelper
* pHelper
, vcl::RenderContext
& rRenderContext
);
593 SAL_DLLPRIVATE
void PopPaintHelper(PaintHelper
const * pHelper
);
597 SAL_DLLPRIVATE
void ImplSetFrameParent( const vcl::Window
* pParent
);
599 SAL_DLLPRIVATE
void ImplInsertWindow( vcl::Window
* pParent
);
600 SAL_DLLPRIVATE
void ImplRemoveWindow( bool bRemoveFrameData
);
602 SAL_DLLPRIVATE SalGraphics
* ImplGetFrameGraphics() const;
604 SAL_DLLPRIVATE
static void ImplCallFocusChangeActivate( vcl::Window
* pNewOverlapWindow
, vcl::Window
* pOldOverlapWindow
);
605 SAL_DLLPRIVATE
vcl::Window
* ImplGetFirstOverlapWindow();
606 SAL_DLLPRIVATE
const vcl::Window
* ImplGetFirstOverlapWindow() const;
608 SAL_DLLPRIVATE
bool ImplIsRealParentPath( const vcl::Window
* pWindow
) const;
610 SAL_DLLPRIVATE
bool ImplTestMousePointerSet();
612 SAL_DLLPRIVATE
void ImplResetReallyVisible();
613 SAL_DLLPRIVATE
void ImplSetReallyVisible();
615 SAL_DLLPRIVATE
void ImplCallInitShow();
617 SAL_DLLPRIVATE
void ImplInitResolutionSettings();
619 SAL_DLLPRIVATE
void ImplPointToLogic(vcl::RenderContext
const & rRenderContext
, vcl::Font
& rFont
, bool bUseRenderContextDPI
= false) const;
620 SAL_DLLPRIVATE
void ImplLogicToPoint(vcl::RenderContext
const & rRenderContext
, vcl::Font
& rFont
) const;
622 SAL_DLLPRIVATE
bool ImplSysObjClip( const vcl::Region
* pOldRegion
);
623 SAL_DLLPRIVATE
void ImplUpdateSysObjChildrenClip();
624 SAL_DLLPRIVATE
void ImplUpdateSysObjOverlapsClip();
625 SAL_DLLPRIVATE
void ImplUpdateSysObjClip();
627 SAL_DLLPRIVATE
void ImplIntersectWindowClipRegion( vcl::Region
& rRegion
);
628 SAL_DLLPRIVATE
void ImplIntersectWindowRegion( vcl::Region
& rRegion
);
629 SAL_DLLPRIVATE
void ImplExcludeWindowRegion( vcl::Region
& rRegion
);
630 SAL_DLLPRIVATE
void ImplExcludeOverlapWindows( vcl::Region
& rRegion
) const;
631 SAL_DLLPRIVATE
void ImplExcludeOverlapWindows2( vcl::Region
& rRegion
);
633 SAL_DLLPRIVATE
void ImplClipBoundaries( vcl::Region
& rRegion
, bool bThis
, bool bOverlaps
);
634 SAL_DLLPRIVATE
bool ImplClipChildren( vcl::Region
& rRegion
) const;
635 SAL_DLLPRIVATE
void ImplClipAllChildren( vcl::Region
& rRegion
) const;
636 SAL_DLLPRIVATE
void ImplClipSiblings( vcl::Region
& rRegion
) const;
638 SAL_DLLPRIVATE
void ImplInitWinClipRegion();
639 SAL_DLLPRIVATE
void ImplInitWinChildClipRegion();
640 SAL_DLLPRIVATE
vcl::Region
& ImplGetWinChildClipRegion();
642 SAL_DLLPRIVATE
void ImplIntersectAndUnionOverlapWindows( const vcl::Region
& rInterRegion
, vcl::Region
& rRegion
) const;
643 SAL_DLLPRIVATE
void ImplIntersectAndUnionOverlapWindows2( const vcl::Region
& rInterRegion
, vcl::Region
& rRegion
);
644 SAL_DLLPRIVATE
void ImplCalcOverlapRegionOverlaps( const vcl::Region
& rInterRegion
, vcl::Region
& rRegion
) const;
645 SAL_DLLPRIVATE
void ImplCalcOverlapRegion( const tools::Rectangle
& rSourceRect
, vcl::Region
& rRegion
,
646 bool bChildren
, bool bSiblings
);
648 /** Invoke the actual painting.
650 This function is kind of recursive - it may be called from the
651 PaintHelper destructor; and on the other hand it creates PaintHelper
652 that (when destructed) calls other ImplCallPaint()'s.
654 SAL_DLLPRIVATE
void ImplCallPaint(const vcl::Region
* pRegion
, ImplPaintFlags nPaintFlags
);
656 SAL_DLLPRIVATE
void ImplCallOverlapPaint();
658 SAL_DLLPRIVATE
void ImplUpdateWindowPtr( vcl::Window
* pWindow
);
659 SAL_DLLPRIVATE
void ImplUpdateWindowPtr();
660 SAL_DLLPRIVATE
void ImplUpdateOverlapWindowPtr( bool bNewFrame
);
662 SAL_DLLPRIVATE
bool ImplUpdatePos();
663 SAL_DLLPRIVATE
void ImplUpdateSysObjPos();
665 SAL_DLLPRIVATE
void ImplUpdateGlobalSettings( AllSettings
& rSettings
, bool bCallHdl
= true ) const;
667 SAL_DLLPRIVATE
void ImplToBottomChild();
669 SAL_DLLPRIVATE
void ImplCalcToTop( ImplCalcToTopData
* pPrevData
);
670 SAL_DLLPRIVATE
void ImplToTop( ToTopFlags nFlags
);
671 SAL_DLLPRIVATE
void ImplStartToTop( ToTopFlags nFlags
);
672 SAL_DLLPRIVATE
void ImplFocusToTop( ToTopFlags nFlags
, bool bReallyVisible
);
674 SAL_DLLPRIVATE
void ImplShowAllOverlaps();
675 SAL_DLLPRIVATE
void ImplHideAllOverlaps();
677 SAL_DLLPRIVATE
bool ImplDlgCtrl( const KeyEvent
& rKEvt
, bool bKeyInput
);
678 SAL_DLLPRIVATE
bool ImplHasDlgCtrl() const;
679 SAL_DLLPRIVATE
void ImplDlgCtrlNextWindow();
680 SAL_DLLPRIVATE
void ImplDlgCtrlFocusChanged( vcl::Window
* pWindow
, bool bGetFocus
);
681 SAL_DLLPRIVATE
vcl::Window
* ImplFindDlgCtrlWindow( vcl::Window
* pWindow
);
683 SAL_DLLPRIVATE
static void ImplNewInputContext();
685 SAL_DLLPRIVATE
void ImplCallActivateListeners(vcl::Window
*);
686 SAL_DLLPRIVATE
void ImplCallDeactivateListeners(vcl::Window
*);
688 SAL_DLLPRIVATE
static void ImplHandleScroll(Scrollable
* pHScrl
, double nX
, Scrollable
* pVScrl
, double nY
);
690 SAL_DLLPRIVATE AbsoluteScreenPixelRectangle
ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle
& rRect
) const;
691 SAL_DLLPRIVATE
tools::Rectangle
ImplUnmirroredAbsoluteScreenToOutputPixel( const AbsoluteScreenPixelRectangle
& rRect
) const;
692 SAL_DLLPRIVATE
tools::Long
ImplGetUnmirroredOutOffX() const;
694 // retrieves the list of owner draw decorated windows for this window hierarchy
695 SAL_DLLPRIVATE ::std::vector
<VclPtr
<vcl::Window
> >& ImplGetOwnerDrawList();
697 SAL_DLLPRIVATE
vcl::Window
* ImplGetTopmostFrameWindow() const;
699 SAL_DLLPRIVATE
bool ImplStopDnd();
700 SAL_DLLPRIVATE
void ImplStartDnd();
702 virtual void ImplPaintToDevice( ::OutputDevice
* pTargetOutDev
, const Point
& rPos
);
705 // Single argument ctors shall be explicit.
706 SAL_DLLPRIVATE
explicit Window( WindowType nType
);
708 void SetCompoundControl( bool bCompound
);
710 void CallEventListeners( VclEventId nEvent
, void* pData
= nullptr );
712 // FIXME: this is a hack to workaround missing layout functionality
713 virtual void ImplAdjustNWFSizes();
715 virtual void ApplySettings(vcl::RenderContext
& rRenderContext
);
718 // Single argument ctors shall be explicit.
719 explicit Window( vcl::Window
* pParent
, WinBits nStyle
= 0 );
721 virtual ~Window() override
;
723 ::OutputDevice
const* GetOutDev() const;
724 ::OutputDevice
* GetOutDev();
726 Color
GetBackgroundColor() const;
727 const Wallpaper
& GetBackground() const;
728 bool IsBackground() const;
729 const MapMode
& GetMapMode() const;
730 void SetBackground();
731 void SetBackground( const Wallpaper
& rBackground
);
733 virtual void MouseMove( const MouseEvent
& rMEvt
);
734 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
735 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
736 virtual void KeyInput( const KeyEvent
& rKEvt
);
737 virtual void KeyUp( const KeyEvent
& rKEvt
);
738 virtual void PrePaint(vcl::RenderContext
& rRenderContext
);
739 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
);
740 virtual void PostPaint(vcl::RenderContext
& rRenderContext
);
742 SAL_DLLPRIVATE
void Erase(vcl::RenderContext
& rRenderContext
);
744 virtual void Draw( ::OutputDevice
* pDev
, const Point
& rPos
, SystemTextColorFlags nFlags
);
746 virtual void Resize();
747 virtual void Activate();
748 virtual void Deactivate();
749 virtual void GetFocus();
750 virtual void LoseFocus();
751 virtual void RequestHelp( const HelpEvent
& rHEvt
);
752 virtual void Command( const CommandEvent
& rCEvt
);
753 virtual void Tracking( const TrackingEvent
& rTEvt
);
754 virtual void StateChanged( StateChangedType nStateChange
);
755 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
756 virtual bool PreNotify( NotifyEvent
& rNEvt
);
757 virtual bool EventNotify( NotifyEvent
& rNEvt
);
759 void AddEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
760 void RemoveEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
761 void AddChildEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
762 void RemoveChildEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
764 ImplSVEvent
* PostUserEvent( const Link
<void*,void>& rLink
, void* pCaller
= nullptr, bool bReferenceLink
= false );
765 void RemoveUserEvent( ImplSVEvent
* nUserEvent
);
767 // returns the input language used for the last key stroke
768 // may be LANGUAGE_DONTKNOW if not supported by the OS
769 LanguageType
GetInputLanguage() const;
771 void SetStyle( WinBits nStyle
);
772 WinBits
GetStyle() const;
773 SAL_DLLPRIVATE WinBits
GetPrevStyle() const;
774 void SetExtendedStyle( WindowExtendedStyle nExtendedStyle
);
775 WindowExtendedStyle
GetExtendedStyle() const;
776 void SetType( WindowType nType
);
777 WindowType
GetType() const;
778 bool IsSystemWindow() const;
779 SAL_DLLPRIVATE
bool IsDockingWindow() const;
780 bool IsDialog() const;
781 bool IsMenuFloatingWindow() const;
782 bool IsToolbarFloatingWindow() const;
783 bool IsNativeFrame() const;
784 bool IsTopWindow() const;
785 SystemWindow
* GetSystemWindow() const;
787 /// Can the widget derived from this Window do the double-buffering via RenderContext properly?
788 bool SupportsDoubleBuffering() const;
789 /// Enable/disable double-buffering of the frame window and all its children.
790 void RequestDoubleBuffering(bool bRequest
);
792 void EnableAllResize();
794 void SetBorderStyle( WindowBorderStyle nBorderStyle
);
795 WindowBorderStyle
GetBorderStyle() const;
796 void GetBorder( sal_Int32
& rLeftBorder
, sal_Int32
& rTopBorder
,
797 sal_Int32
& rRightBorder
, sal_Int32
& rBottomBorder
) const;
798 Size
CalcWindowSize( const Size
& rOutSz
) const;
799 SAL_DLLPRIVATE Size
CalcOutputSize( const Size
& rWinSz
) const;
800 tools::Long
CalcTitleWidth() const;
802 void EnableClipSiblings( bool bClipSiblings
= true );
804 void EnableChildTransparentMode( bool bEnable
= true );
805 bool IsChildTransparentModeEnabled() const;
807 void SetMouseTransparent( bool bTransparent
);
808 bool IsMouseTransparent() const;
809 void SetPaintTransparent( bool bTransparent
);
810 bool IsPaintTransparent() const;
811 void SetDialogControlStart( bool bStart
);
812 SAL_DLLPRIVATE
bool IsDialogControlStart() const;
813 void SetDialogControlFlags( DialogControlFlags nFlags
);
814 SAL_DLLPRIVATE DialogControlFlags
GetDialogControlFlags() const;
818 sal_Int32 mnState
; // the button state
819 Point maPos
; // mouse position in output coordinates
821 PointerState
GetPointerState();
822 bool IsMouseOver() const;
824 void SetInputContext( const InputContext
& rInputContext
);
825 const InputContext
& GetInputContext() const;
826 void PostExtTextInputEvent(VclEventId nType
, const OUString
& rText
);
827 SAL_DLLPRIVATE
void EndExtTextInput();
828 void SetCursorRect( const tools::Rectangle
* pRect
= nullptr, tools::Long nExtTextInputWidth
= 0 );
829 SAL_DLLPRIVATE
const tools::Rectangle
* GetCursorRect() const;
830 SAL_DLLPRIVATE
tools::Long
GetCursorExtTextInputWidth() const;
832 void SetCompositionCharRect( const tools::Rectangle
* pRect
, tools::Long nCompositionLength
, bool bVertical
= false );
834 SAL_DLLPRIVATE
void UpdateSettings( const AllSettings
& rSettings
, bool bChild
= false );
835 SAL_DLLPRIVATE
void NotifyAllChildren( DataChangedEvent
& rDCEvt
);
837 void SetPointFont(vcl::RenderContext
& rRenderContext
, const vcl::Font
& rFont
, bool bUseRenderContextDPI
= false);
838 vcl::Font
GetPointFont(vcl::RenderContext
const & rRenderContext
) const;
839 void SetZoomedPointFont(vcl::RenderContext
& rRenderContext
, const vcl::Font
& rFont
);
840 SAL_DLLPRIVATE
tools::Long
GetDrawPixel( ::OutputDevice
const * pDev
, tools::Long nPixels
) const;
841 vcl::Font
GetDrawPixelFont( ::OutputDevice
const * pDev
) const;
843 void SetControlFont();
844 void SetControlFont( const vcl::Font
& rFont
);
845 vcl::Font
GetControlFont() const;
846 bool IsControlFont() const;
847 void ApplyControlFont(vcl::RenderContext
& rRenderContext
, const vcl::Font
& rDefaultFont
);
849 void SetControlForeground();
850 void SetControlForeground(const Color
& rColor
);
851 const Color
& GetControlForeground() const;
852 bool IsControlForeground() const;
853 void ApplyControlForeground(vcl::RenderContext
& rRenderContext
, const Color
& rDefaultColor
);
855 void SetControlBackground();
856 void SetControlBackground( const Color
& rColor
);
857 const Color
& GetControlBackground() const;
858 bool IsControlBackground() const;
859 void ApplyControlBackground(vcl::RenderContext
& rRenderContext
, const Color
& rDefaultColor
);
861 void SetParentClipMode( ParentClipMode nMode
= ParentClipMode::NONE
);
862 SAL_DLLPRIVATE ParentClipMode
GetParentClipMode() const;
864 SAL_DLLPRIVATE
void SetWindowRegionPixel();
865 SAL_DLLPRIVATE
void SetWindowRegionPixel( const vcl::Region
& rRegion
);
866 vcl::Region
GetWindowClipRegionPixel() const;
867 vcl::Region
GetPaintRegion() const;
868 bool IsInPaint() const;
869 // while IsInPaint returns true ExpandPaintClipRegion adds the
870 // submitted region to the paint clip region so you can
871 // paint additional parts of your window if necessary
872 void ExpandPaintClipRegion( const vcl::Region
& rRegion
);
874 void SetParent( vcl::Window
* pNewParent
);
875 vcl::Window
* GetParent() const;
876 // return the dialog we are contained in or NULL if un-contained
877 SAL_DLLPRIVATE Dialog
* GetParentDialog() const;
878 bool IsAncestorOf( const vcl::Window
& rWindow
) const;
880 void Show( bool bVisible
= true, ShowFlags nFlags
= ShowFlags::NONE
);
881 void Hide() { Show( false ); }
882 bool IsVisible() const;
883 bool IsReallyVisible() const;
884 bool IsReallyShown() const;
885 SAL_DLLPRIVATE
bool IsInInitShow() const;
887 void Enable( bool bEnable
= true, bool bChild
= true );
888 void Disable( bool bChild
= true ) { Enable( false, bChild
); }
889 bool IsEnabled() const;
891 void EnableInput( bool bEnable
= true, bool bChild
= true );
892 SAL_DLLPRIVATE
void EnableInput( bool bEnable
, const vcl::Window
* pExcludeWindow
);
893 bool IsInputEnabled() const;
895 /** Override <code>EnableInput</code>. This can be necessary due to other people
896 using EnableInput for whole window hierarchies.
899 sets always enabled flag
902 if true children are recursively set to AlwaysEnableInput
904 void AlwaysEnableInput( bool bAlways
, bool bChild
= true );
906 /** returns the current AlwaysEnableInput state
908 true if window is in AlwaysEnableInput state
910 SAL_DLLPRIVATE
bool IsAlwaysEnableInput() const;
912 /** A window is in modal mode if one of its children or subchildren
913 is a running modal window (a modal dialog)
915 @returns sal_True if a child or subchild is a running modal window
917 bool IsInModalMode() const;
919 SAL_DLLPRIVATE
void SetActivateMode( ActivateModeFlags nMode
);
920 SAL_DLLPRIVATE ActivateModeFlags
GetActivateMode() const;
922 void ToTop( ToTopFlags nFlags
= ToTopFlags::NONE
);
923 void SetZOrder( vcl::Window
* pRefWindow
, ZOrderFlags nFlags
);
924 SAL_DLLPRIVATE
void EnableAlwaysOnTop( bool bEnable
= true );
925 SAL_DLLPRIVATE
bool IsAlwaysOnTopEnabled() const;
927 virtual void setPosSizePixel( tools::Long nX
, tools::Long nY
,
928 tools::Long nWidth
, tools::Long nHeight
,
929 PosSizeFlags nFlags
= PosSizeFlags::All
);
930 virtual void SetPosPixel( const Point
& rNewPos
);
931 virtual Point
GetPosPixel() const;
932 virtual void SetSizePixel( const Size
& rNewSize
);
933 virtual Size
GetSizePixel() const;
934 virtual void SetPosSizePixel( const Point
& rNewPos
,
935 const Size
& rNewSize
);
936 virtual void SetOutputSizePixel( const Size
& rNewSize
);
937 bool IsDefaultPos() const;
938 SAL_DLLPRIVATE
bool IsDefaultSize() const;
939 Point
GetOffsetPixelFrom(const vcl::Window
& rWindow
) const;
941 // those conversion routines might deliver different results during UI mirroring
942 Point
OutputToScreenPixel( const Point
& rPos
) const;
943 Point
ScreenToOutputPixel( const Point
& rPos
) const;
944 // the normalized screen methods work independent from UI mirroring
945 Point
OutputToNormalizedScreenPixel( const Point
& rPos
) const;
946 SAL_DLLPRIVATE Point
NormalizedScreenToOutputPixel( const Point
& rPos
) const;
947 AbsoluteScreenPixelPoint
OutputToAbsoluteScreenPixel( const Point
& rPos
) const;
948 Point
AbsoluteScreenToOutputPixel( const AbsoluteScreenPixelPoint
& rPos
) const;
949 AbsoluteScreenPixelRectangle
GetDesktopRectPixel() const;
950 // window extents including border and decoration, relative to passed in window
951 tools::Rectangle
GetWindowExtentsRelative(const vcl::Window
& rRelativeWindow
) const;
952 // window extents including border and decoration, in absolute screen coordinates
953 AbsoluteScreenPixelRectangle
GetWindowExtentsAbsolute() const;
955 SAL_DLLPRIVATE
bool IsScrollable() const;
956 virtual void Scroll( tools::Long nHorzScroll
, tools::Long nVertScroll
,
957 ScrollFlags nFlags
= ScrollFlags::NONE
);
958 void Scroll( tools::Long nHorzScroll
, tools::Long nVertScroll
,
959 const tools::Rectangle
& rRect
, ScrollFlags nFlags
= ScrollFlags::NONE
);
960 void Invalidate( InvalidateFlags nFlags
= InvalidateFlags::NONE
);
961 void Invalidate( const tools::Rectangle
& rRect
, InvalidateFlags nFlags
= InvalidateFlags::NONE
);
962 void Invalidate( const vcl::Region
& rRegion
, InvalidateFlags nFlags
= InvalidateFlags::NONE
);
964 * Notification about some rectangle of the output device got invalidated.Used for the main
967 * @param pRectangle If 0, that means the whole area, otherwise the area in logic coordinates.
969 virtual void LogicInvalidate(const tools::Rectangle
* pRectangle
);
971 virtual bool InvalidateByForeignEditView(EditView
* );
973 * Notification about some rectangle of the output device got invalidated. Used for the
974 * dialogs and floating windows (e.g. context menu, popup).
976 * @param pRectangle If 0, that means the whole area, otherwise the area in pixel coordinates.
978 virtual void PixelInvalidate(const tools::Rectangle
* pRectangle
);
980 SAL_DLLPRIVATE
bool HasPaintEvent() const;
981 void PaintImmediately();
983 // toggles new docking support, enabled via toolkit
984 void EnableDocking( bool bEnable
= true );
985 // retrieves the single dockingmanager instance
986 static DockingManager
* GetDockingManager();
988 void EnablePaint( bool bEnable
);
989 bool IsPaintEnabled() const;
990 void SetUpdateMode( bool bUpdate
);
991 bool IsUpdateMode() const;
992 void SetParentUpdateMode( bool bUpdate
);
995 bool HasFocus() const;
996 bool HasChildPathFocus( bool bSystemWindow
= false ) const;
997 bool IsActive() const;
998 bool HasActiveChildFrame() const;
999 GetFocusFlags
GetGetFocusFlags() const;
1000 void GrabFocusToDocument();
1001 VclPtr
<vcl::Window
> GetFocusedWindow() const;
1004 * Set this when you need to act as if the window has focus even if it
1005 * doesn't. This is necessary for implementing tab stops inside floating
1006 * windows, but floating windows don't get focus from the system.
1008 SAL_DLLPRIVATE
void SetFakeFocus( bool bFocus
);
1010 bool IsCompoundControl() const;
1012 SAL_DLLPRIVATE
static VclPtr
<vcl::Window
> SaveFocus();
1013 SAL_DLLPRIVATE
static void EndSaveFocus(const VclPtr
<vcl::Window
>& xFocusWin
);
1015 void LocalStartDrag();
1016 void CaptureMouse();
1017 void ReleaseMouse();
1018 bool IsMouseCaptured() const;
1020 virtual void SetPointer( PointerStyle
);
1021 PointerStyle
GetPointer() const;
1022 void EnableChildPointerOverwrite( bool bOverwrite
);
1023 void SetPointerPosPixel( const Point
& rPos
);
1024 Point
GetPointerPosPixel();
1025 SAL_DLLPRIVATE Point
GetLastPointerPosPixel();
1026 /// Similar to SetPointerPosPixel(), but sets the frame data's last mouse position instead.
1027 void SetLastMousePos(const Point
& rPos
);
1028 void ShowPointer( bool bVisible
);
1031 bool IsWait() const;
1033 void SetCursor( vcl::Cursor
* pCursor
);
1034 vcl::Cursor
* GetCursor() const;
1036 void SetZoom( const Fraction
& rZoom
);
1037 const Fraction
& GetZoom() const;
1038 bool IsZoom() const;
1039 tools::Long
CalcZoom( tools::Long n
) const;
1041 virtual void SetText( const OUString
& rStr
);
1042 virtual OUString
GetText() const;
1043 // return the actual text displayed
1044 // this may have e.g. accelerators removed or portions
1045 // replaced by ellipses
1046 virtual OUString
GetDisplayText() const;
1047 // gets the visible background color. for transparent windows
1048 // this may be the parent's background color; for controls
1049 // this may be a child's background color (e.g. ListBox)
1050 virtual const Wallpaper
& GetDisplayBackground() const;
1052 void SetHelpText( const OUString
& rHelpText
);
1053 const OUString
& GetHelpText() const;
1055 void SetQuickHelpText( const OUString
& rHelpText
);
1056 const OUString
& GetQuickHelpText() const;
1058 void SetHelpId( const OUString
& );
1059 const OUString
& GetHelpId() const;
1061 sal_uInt16
GetChildCount() const;
1062 vcl::Window
* GetChild( sal_uInt16 nChild
) const;
1063 vcl::Window
* GetWindow( GetWindowType nType
) const;
1064 bool IsChild( const vcl::Window
* pWindow
) const;
1065 bool IsWindowOrChild( const vcl::Window
* pWindow
, bool bSystemWindow
= false ) const;
1067 /// Add all children to rAllChildren recursively.
1068 SAL_DLLPRIVATE
void CollectChildren(::std::vector
<vcl::Window
*>& rAllChildren
);
1070 virtual void ShowFocus(const tools::Rectangle
& rRect
);
1073 // transparent background for selected or checked items in toolboxes etc.
1074 void DrawSelectionBackground( const tools::Rectangle
& rRect
, sal_uInt16 highlight
, bool bChecked
, bool bDrawBorder
);
1076 void ShowTracking( const tools::Rectangle
& rRect
,
1077 ShowTrackFlags nFlags
= ShowTrackFlags::Small
);
1078 void HideTracking();
1079 void InvertTracking( const tools::Rectangle
& rRect
, ShowTrackFlags nFlags
);
1081 void StartTracking( StartTrackingFlags nFlags
= StartTrackingFlags::NONE
);
1082 void EndTracking( TrackingEventFlags nFlags
= TrackingEventFlags::NONE
);
1083 bool IsTracking() const;
1085 SAL_DLLPRIVATE
void StartAutoScroll( StartAutoScrollFlags nFlags
);
1086 SAL_DLLPRIVATE
void EndAutoScroll();
1088 bool HandleScrollCommand( const CommandEvent
& rCmd
,
1090 Scrollable
* pVScrl
);
1092 virtual const SystemEnvData
* GetSystemData() const;
1094 // API to set/query the component interfaces
1095 virtual css::uno::Reference
< css::awt::XVclWindowPeer
>
1096 GetComponentInterface( bool bCreate
= true );
1098 void SetComponentInterface( css::uno::Reference
< css::awt::XVclWindowPeer
> const & xIFace
);
1100 void SetUseFrameData(bool bUseFrameData
);
1102 /// Interface to register for dialog / window tunneling.
1103 void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier
* pNotifier
, bool bParent
= false);
1104 const vcl::ILibreOfficeKitNotifier
* GetLOKNotifier() const;
1105 vcl::LOKWindowId
GetLOKWindowId() const;
1107 /// Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set.
1108 VclPtr
<vcl::Window
> GetParentWithLOKNotifier();
1110 /// Indicate that LOK is not going to use this dialog any more.
1111 void ReleaseLOKNotifier();
1113 /// Find an existing Window based on the LOKWindowId.
1114 static VclPtr
<vcl::Window
> FindLOKWindow(vcl::LOKWindowId nWindowId
);
1116 /// check if LOK Window container is empty
1117 SAL_DLLPRIVATE
static bool IsLOKWindowsEmpty();
1119 /// Dumps itself and potentially its children to a property tree, to be written easily to JSON.
1120 virtual void DumpAsPropertyTree(tools::JsonWriter
&);
1122 /// Use OS specific way to bring user attention to current window
1123 virtual void FlashWindow() const;
1125 void SetTaskBarProgress(int nCurrentProgress
);
1126 void SetTaskBarState(VclTaskBarStates eTaskBarState
);
1128 /** @name Accessibility
1133 css::uno::Reference
< css::accessibility::XAccessible
>
1134 GetAccessible( bool bCreate
= true );
1136 virtual css::uno::Reference
< css::accessibility::XAccessible
>
1139 void SetAccessible( const css::uno::Reference
< css::accessibility::XAccessible
>& );
1141 vcl::Window
* GetAccessibleParentWindow() const;
1142 sal_uInt16
GetAccessibleChildWindowCount();
1143 vcl::Window
* GetAccessibleChildWindow( sal_uInt16 n
);
1145 void SetAccessibleRole( sal_uInt16 nRole
);
1146 sal_uInt16
GetAccessibleRole() const;
1148 void SetAccessibleName( const OUString
& rName
);
1149 OUString
GetAccessibleName() const;
1151 SAL_DLLPRIVATE
void SetAccessibleDescription( const OUString
& rDescr
);
1152 OUString
GetAccessibleDescription() const;
1154 SAL_DLLPRIVATE
void SetAccessibleRelationLabeledBy( vcl::Window
* pLabeledBy
);
1155 vcl::Window
* GetAccessibleRelationLabeledBy() const;
1157 SAL_DLLPRIVATE
void SetAccessibleRelationLabelFor( vcl::Window
* pLabelFor
);
1158 vcl::Window
* GetAccessibleRelationLabelFor() const;
1160 vcl::Window
* GetAccessibleRelationMemberOf() const;
1162 // to avoid sending accessibility events in cases like closing dialogs
1163 // checks complete parent path
1164 bool IsAccessibilityEventsSuppressed();
1166 KeyEvent
GetActivationKey() const;
1170 // These eventually are supposed to go when everything is converted to .ui
1171 SAL_DLLPRIVATE
vcl::Window
* getLegacyNonLayoutAccessibleRelationMemberOf() const;
1172 SAL_DLLPRIVATE
vcl::Window
* getLegacyNonLayoutAccessibleRelationLabeledBy() const;
1173 SAL_DLLPRIVATE
vcl::Window
* getLegacyNonLayoutAccessibleRelationLabelFor() const;
1175 // Let Label override the code part of GetAccessibleRelationLabelFor
1176 virtual vcl::Window
* getAccessibleRelationLabelFor() const;
1177 virtual sal_uInt16
getDefaultAccessibleRole() const;
1178 virtual OUString
getDefaultAccessibleName() const;
1181 * Advisory Sizing - what is a good size for this widget
1183 * Retrieves the preferred size of a widget ignoring
1184 * "width-request" and "height-request" properties.
1186 * Implement this in sub-classes to tell layout
1187 * the preferred widget size.
1189 * Use get_preferred_size to retrieve this value
1190 * cached and mediated via height and width requests
1192 virtual Size
GetOptimalSize() const;
1193 /// clear OptimalSize cache
1194 SAL_DLLPRIVATE
void InvalidateSizeCache();
1197 SAL_DLLPRIVATE
bool ImplIsAccessibleCandidate() const;
1201 * Retrieves the preferred size of a widget taking
1202 * into account the "width-request" and "height-request" properties.
1204 * Overrides the result of GetOptimalSize to honor the
1205 * width-request and height-request properties.
1207 * So the same as get_ungrouped_preferred_size except
1208 * it ignores groups. A building block of get_preferred_size
1209 * that access the size cache
1211 * @see get_preferred_size
1213 SAL_DLLPRIVATE Size
get_ungrouped_preferred_size() const;
1215 /* records all DrawText operations within the passed rectangle;
1216 * a synchronous paint is sent to achieve this
1218 void RecordLayoutData( vcl::ControlLayoutData
* pLayout
, const tools::Rectangle
& rRect
);
1220 // set and retrieve for Toolkit
1221 VCLXWindow
* GetWindowPeer() const;
1222 void SetWindowPeer( css::uno::Reference
< css::awt::XVclWindowPeer
> const & xPeer
, VCLXWindow
* pVCLXWindow
);
1224 // remember if it was generated by Toolkit
1225 SAL_DLLPRIVATE
bool IsCreatedWithToolkit() const;
1226 void SetCreatedWithToolkit( bool b
);
1228 // Drag and Drop interfaces
1229 css::uno::Reference
< css::datatransfer::dnd::XDropTarget
> GetDropTarget();
1230 css::uno::Reference
< css::datatransfer::dnd::XDragSource
> GetDragSource();
1231 css::uno::Reference
< css::datatransfer::dnd::XDragGestureRecognizer
> GetDragGestureRecognizer();
1233 // Clipboard/Selection interfaces
1234 css::uno::Reference
< css::datatransfer::clipboard::XClipboard
> GetClipboard();
1235 /// Sets a custom clipboard for the window's frame, instead of creating it on-demand using css::datatransfer::clipboard::SystemClipboard.
1236 void SetClipboard(css::uno::Reference
<css::datatransfer::clipboard::XClipboard
> const & xClipboard
);
1239 * Widgets call this to inform their owner container that the widget wants
1240 * to renegotiate its size. Should be called when a widget has a new size
1241 * request. e.g. a FixedText Control gets a new label.
1243 * akin to gtk_widget_queue_resize
1245 virtual void queue_resize(StateChangedType eReason
= StateChangedType::Layout
);
1248 * Sets the "height-request" property
1250 * Override for height request of the widget, or -1 if natural request
1253 * @see get_preferred_size, set_width_request
1255 void set_height_request(sal_Int32 nHeightRequest
);
1256 sal_Int32
get_height_request() const;
1259 * Sets the "width-request" property
1261 * Override for width request of the widget, or -1 if natural request
1264 * @see get_preferred_size, set_height_request
1266 void set_width_request(sal_Int32 nWidthRequest
);
1267 sal_Int32
get_width_request() const;
1270 * Retrieves the preferred size of a widget taking
1271 * into account the "width-request" and "height-request" properties.
1273 * Overrides the result of GetOptimalSize to honor the
1274 * width-request and height-request properties.
1276 * @see GetOptimalSize
1278 * akin to gtk_widget_get_preferred_size
1280 Size
get_preferred_size() const;
1283 * How to horizontally align this widget
1285 SAL_DLLPRIVATE VclAlign
get_halign() const;
1286 SAL_DLLPRIVATE
void set_halign(VclAlign eAlign
);
1289 * How to vertically align this widget
1291 SAL_DLLPRIVATE VclAlign
get_valign() const;
1292 SAL_DLLPRIVATE
void set_valign(VclAlign eAlign
);
1295 * Whether the widget would like to use any available extra horizontal
1298 bool get_hexpand() const;
1299 void set_hexpand(bool bExpand
);
1302 * Whether the widget would like to use any available extra vertical
1305 bool get_vexpand() const;
1306 void set_vexpand(bool bExpand
);
1309 * Whether the widget would like to use any available extra space.
1311 bool get_expand() const;
1312 void set_expand(bool bExpand
);
1315 * Whether the widget should receive extra space when the parent grows
1317 SAL_DLLPRIVATE
bool get_fill() const;
1318 SAL_DLLPRIVATE
void set_fill(bool bFill
);
1320 void set_border_width(sal_Int32 nBorderWidth
);
1321 SAL_DLLPRIVATE sal_Int32
get_border_width() const;
1323 SAL_DLLPRIVATE
void set_margin_start(sal_Int32 nWidth
);
1324 SAL_DLLPRIVATE sal_Int32
get_margin_start() const;
1326 SAL_DLLPRIVATE
void set_margin_end(sal_Int32 nWidth
);
1327 SAL_DLLPRIVATE sal_Int32
get_margin_end() const;
1329 void set_margin_top(sal_Int32 nWidth
);
1330 SAL_DLLPRIVATE sal_Int32
get_margin_top() const;
1332 SAL_DLLPRIVATE
void set_margin_bottom(sal_Int32 nWidth
);
1333 SAL_DLLPRIVATE sal_Int32
get_margin_bottom() const;
1336 * How the widget is packed with reference to the start or end of the parent
1338 SAL_DLLPRIVATE VclPackType
get_pack_type() const;
1339 SAL_DLLPRIVATE
void set_pack_type(VclPackType ePackType
);
1342 * The extra space to put between the widget and its neighbors
1344 SAL_DLLPRIVATE sal_Int32
get_padding() const;
1345 SAL_DLLPRIVATE
void set_padding(sal_Int32 nPadding
);
1348 * The number of columns that the widget spans
1350 SAL_DLLPRIVATE sal_Int32
get_grid_width() const;
1351 SAL_DLLPRIVATE
void set_grid_width(sal_Int32 nCols
);
1354 * The column number to attach the left side of the widget to
1356 SAL_DLLPRIVATE sal_Int32
get_grid_left_attach() const;
1357 SAL_DLLPRIVATE
void set_grid_left_attach(sal_Int32 nAttach
);
1360 * The number of row that the widget spans
1362 SAL_DLLPRIVATE sal_Int32
get_grid_height() const;
1363 SAL_DLLPRIVATE
void set_grid_height(sal_Int32 nRows
);
1366 * The row number to attach the top side of the widget to
1368 SAL_DLLPRIVATE sal_Int32
get_grid_top_attach() const;
1369 SAL_DLLPRIVATE
void set_grid_top_attach(sal_Int32 nAttach
);
1372 * If true this child appears in a secondary layout group of children
1373 * e.g. help buttons in a buttonbox
1375 SAL_DLLPRIVATE
bool get_secondary() const;
1376 SAL_DLLPRIVATE
void set_secondary(bool bSecondary
);
1379 * If true this child is exempted from homogeneous sizing
1380 * e.g. special button in a buttonbox
1382 SAL_DLLPRIVATE
bool get_non_homogeneous() const;
1383 SAL_DLLPRIVATE
void set_non_homogeneous(bool bNonHomogeneous
);
1386 * Sets a widget property
1388 * @return false if property is unknown
1390 virtual bool set_property(const OUString
&rKey
, const OUString
&rValue
);
1393 * Sets a font attribute
1395 * @return false if attribute is unknown
1397 SAL_DLLPRIVATE
bool set_font_attribute(const OUString
&rKey
, std::u16string_view rValue
);
1400 * Adds this widget to the xGroup VclSizeGroup
1403 SAL_DLLPRIVATE
void add_to_size_group(const std::shared_ptr
<VclSizeGroup
>& xGroup
);
1404 SAL_DLLPRIVATE
void remove_from_all_size_groups();
1407 * add/remove mnemonic label
1409 SAL_DLLPRIVATE
void add_mnemonic_label(FixedText
*pLabel
);
1410 SAL_DLLPRIVATE
void remove_mnemonic_label(FixedText
*pLabel
);
1411 SAL_DLLPRIVATE
const std::vector
<VclPtr
<FixedText
> >& list_mnemonic_labels() const;
1414 * Move this widget to be the nNewPosition'd child of its parent
1416 SAL_DLLPRIVATE
void reorderWithinParent(sal_uInt16 nNewPosition
);
1421 void set_id(const OUString
& rID
);
1424 * Get the ID of the window.
1426 const OUString
& get_id() const;
1429 // Native Widget Rendering functions
1432 // form controls must never use native widgets, this can be toggled here
1433 void EnableNativeWidget( bool bEnable
= true );
1434 bool IsNativeWidgetEnabled() const;
1436 // a helper method for a Control's Draw method
1437 void PaintToDevice( ::OutputDevice
* pDevice
, const Point
& rPos
);
1439 // Keyboard access functions
1441 /** Query the states of keyboard indicators - Caps Lock, Num Lock and
1442 Scroll Lock. Use the following mask to retrieve the state of each
1445 KeyIndicatorState::CAPS_LOCK
1446 KeyIndicatorState::NUM_LOCK
1447 KeyIndicatorState::SCROLL_LOCK
1449 KeyIndicatorState
GetIndicatorState() const;
1451 void SimulateKeyPress( sal_uInt16 nKeyCode
) const;
1453 virtual OUString
GetSurroundingText() const;
1454 virtual Selection
GetSurroundingTextSelection() const;
1455 virtual bool DeleteSurroundingText(const Selection
& rSelection
);
1457 virtual FactoryFunction
GetUITestFactory() const;
1459 virtual bool IsChart() const { return false; }
1460 virtual bool IsStarMath() const { return false; }
1462 SAL_DLLPRIVATE
void SetHelpHdl(const Link
<vcl::Window
&, bool>& rLink
);
1463 SAL_DLLPRIVATE
void SetMnemonicActivateHdl(const Link
<vcl::Window
&, bool>& rLink
);
1464 void SetModalHierarchyHdl(const Link
<bool, void>& rLink
);
1465 SAL_DLLPRIVATE
void SetDumpAsPropertyTreeHdl(const Link
<tools::JsonWriter
&, void>& rLink
);
1467 Size
GetOutputSizePixel() const;
1468 SAL_DLLPRIVATE
tools::Rectangle
GetOutputRectPixel() const;
1470 Point
LogicToPixel( const Point
& rLogicPt
) const;
1471 Size
LogicToPixel( const Size
& rLogicSize
) const;
1472 tools::Rectangle
LogicToPixel( const tools::Rectangle
& rLogicRect
) const;
1473 vcl::Region
LogicToPixel( const vcl::Region
& rLogicRegion
)const;
1474 Point
LogicToPixel( const Point
& rLogicPt
,
1475 const MapMode
& rMapMode
) const;
1476 Size
LogicToPixel( const Size
& rLogicSize
,
1477 const MapMode
& rMapMode
) const;
1478 tools::Rectangle
LogicToPixel( const tools::Rectangle
& rLogicRect
,
1479 const MapMode
& rMapMode
) const;
1481 Point
PixelToLogic( const Point
& rDevicePt
) const;
1482 Size
PixelToLogic( const Size
& rDeviceSize
) const;
1483 tools::Rectangle
PixelToLogic( const tools::Rectangle
& rDeviceRect
) const;
1484 tools::PolyPolygon
PixelToLogic( const tools::PolyPolygon
& rDevicePolyPoly
) const;
1485 SAL_DLLPRIVATE
vcl::Region
PixelToLogic( const vcl::Region
& rDeviceRegion
) const;
1486 Point
PixelToLogic( const Point
& rDevicePt
,
1487 const MapMode
& rMapMode
) const;
1488 Size
PixelToLogic( const Size
& rDeviceSize
,
1489 const MapMode
& rMapMode
) const;
1490 tools::Rectangle
PixelToLogic( const tools::Rectangle
& rDeviceRect
,
1491 const MapMode
& rMapMode
) const;
1493 Size
LogicToLogic( const Size
& rSzSource
,
1494 const MapMode
* pMapModeSource
,
1495 const MapMode
* pMapModeDest
) const;
1497 const AllSettings
& GetSettings() const;
1498 void SetSettings( const AllSettings
& rSettings
);
1499 void SetSettings( const AllSettings
& rSettings
, bool bChild
);
1501 tools::Rectangle
GetTextRect( const tools::Rectangle
& rRect
,
1502 const OUString
& rStr
, DrawTextFlags nStyle
= DrawTextFlags::WordBreak
,
1503 TextRectInfo
* pInfo
= nullptr,
1504 const vcl::TextLayoutCommon
* _pTextLayout
= nullptr ) const;
1505 float GetDPIScaleFactor() const;
1506 tools::Long
GetOutOffXPixel() const;
1507 tools::Long
GetOutOffYPixel() const;
1509 void EnableMapMode( bool bEnable
= true );
1510 bool IsMapModeEnabled() const;
1511 SAL_DLLPRIVATE
void SetMapMode();
1512 void SetMapMode( const MapMode
& rNewMapMode
);
1514 // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphicsLayout
1515 virtual void EnableRTL( bool bEnable
= true);
1516 bool IsRTLEnabled() const;
1518 void SetFont( const vcl::Font
& rNewFont
);
1519 const vcl::Font
& GetFont() const;
1521 /** Width of the text.
1523 See also GetTextBoundRect() for more explanation + code examples.
1525 tools::Long
GetTextWidth( const OUString
& rStr
, sal_Int32 nIndex
= 0, sal_Int32 nLen
= -1,
1526 vcl::text::TextLayoutCache
const* = nullptr,
1527 SalLayoutGlyphs
const*const pLayoutCache
= nullptr) const;
1529 /** Height where any character of the current font fits; in logic coordinates.
1531 See also GetTextBoundRect() for more explanation + code examples.
1533 tools::Long
GetTextHeight() const;
1534 float approximate_digit_width() const;
1536 void SetTextColor( const Color
& rColor
);
1537 const Color
& GetTextColor() const;
1539 void SetTextFillColor();
1540 void SetTextFillColor( const Color
& rColor
);
1541 Color
GetTextFillColor() const;
1542 SAL_DLLPRIVATE
bool IsTextFillColor() const;
1544 void SetTextLineColor();
1545 void SetTextLineColor( const Color
& rColor
);
1546 const Color
& GetTextLineColor() const;
1547 bool IsTextLineColor() const;
1549 SAL_DLLPRIVATE
void SetOverlineColor();
1550 SAL_DLLPRIVATE
void SetOverlineColor( const Color
& rColor
);
1551 SAL_DLLPRIVATE
const Color
& GetOverlineColor() const;
1552 SAL_DLLPRIVATE
bool IsOverlineColor() const;
1554 void SetTextAlign( TextAlign eAlign
);
1555 SAL_DLLPRIVATE TextAlign
GetTextAlign() const;
1557 /** Query the platform layer for control support
1559 SAL_DLLPRIVATE
bool IsNativeControlSupported( ControlType nType
, ControlPart nPart
) const;
1561 /** Query the native control's actual drawing region (including adornment)
1563 SAL_DLLPRIVATE
bool GetNativeControlRegion(
1566 const tools::Rectangle
& rControlRegion
,
1567 ControlState nState
,
1568 const ImplControlValue
& aValue
,
1569 tools::Rectangle
&rNativeBoundingRegion
,
1570 tools::Rectangle
&rNativeContentRegion
) const;
1572 SAL_DLLPRIVATE
float approximate_char_width() const;
1574 SAL_DLLPRIVATE
void ImplEnableRTL(bool bEnable
);
1579 #endif // INCLUDED_VCL_WINDOW_HXX
1581 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */