vcl: 'horizontically'
[LibreOffice.git] / include / vcl / window.hxx
blob99a1043bb3d3b6a2a3a40f6896e92fac05086f0f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
35 #include <memory>
37 class VirtualDevice;
38 struct ImplSVEvent;
39 struct ImplWinData;
40 struct ImplFrameData;
41 struct ImplCalcToTopData;
42 struct SystemEnvData;
43 struct SystemParentData;
44 class ImplBorderWindow;
45 class Timer;
46 class DockingManager;
47 class ScrollBar;
48 class FixedText;
49 class MouseEvent;
50 class KeyEvent;
51 class CommandEvent;
52 class TrackingEvent;
53 class HelpEvent;
54 class DataChangedEvent;
55 class VclSimpleEvent;
56 class NotifyEvent;
57 class SystemWindow;
58 class SalFrame;
59 class MenuFloatingWindow;
60 class VCLXWindow;
61 class VclWindowEvent;
62 class AllSettings;
63 class InputContext;
64 enum class ImplPaintFlags;
65 enum class VclEventId;
66 enum class PointerStyle;
68 namespace com::sun::star {
69 namespace accessibility {
70 struct AccessibleRelation;
71 class XAccessible;
73 namespace rendering {
74 class XCanvas;
75 class XSpriteCanvas;
77 namespace awt {
78 class XWindowPeer;
80 namespace uno {
81 class Any;
83 namespace datatransfer::clipboard {
84 class XClipboard;
86 namespace datatransfer::dnd {
87 class XDragGestureRecognizer;
88 class XDragSource;
89 class XDropTarget;
93 namespace vcl {
94 struct ControlLayoutData;
97 namespace svt { class PopupWindowControllerImpl; }
99 namespace weld { class Window; }
101 template<class T> class VclPtr;
102 namespace tools { class JsonWriter; }
104 enum class TrackingEventFlags
106 NONE = 0x0000,
107 Cancel = 0x0001,
108 Key = 0x0002,
109 Focus = 0x0004,
110 Repeat = 0x0100,
111 End = 0x1000,
113 namespace o3tl
115 template<> struct typed_flags<TrackingEventFlags> : is_typed_flags<TrackingEventFlags, 0x1107> {};
119 // Type for GetWindow()
120 enum class GetWindowType
122 Parent = 0,
123 FirstChild = 1,
124 LastChild = 2,
125 Prev = 3,
126 Next = 4,
127 FirstOverlap = 5,
128 Overlap = 7,
129 ParentOverlap = 8,
130 Client = 9,
131 RealParent = 10,
132 Frame = 11,
133 Border = 12,
134 FirstTopWindowChild = 13,
135 NextTopWindowSibling = 16,
138 // Flags for setPosSizePixel()
139 // These must match the definitions in css::awt::PosSize
140 enum class PosSizeFlags
142 NONE = 0x0000,
143 X = 0x0001,
144 Y = 0x0002,
145 Width = 0x0004,
146 Height = 0x0008,
147 Pos = X | Y,
148 Size = Width | Height,
149 PosSize = Pos | Size,
150 All = PosSize,
153 namespace o3tl
155 template<> struct typed_flags<PosSizeFlags> : is_typed_flags<PosSizeFlags, 0x000f> {};
158 // Flags for Show()
159 enum class ShowFlags
161 NONE = 0x0000,
162 NoFocusChange = 0x0002,
163 NoActivate = 0x0004,
164 ForegroundTask = 0x0008,
166 namespace o3tl
168 template<> struct typed_flags<ShowFlags> : is_typed_flags<ShowFlags, 0x000e> {};
171 // Flags for SetZOrder()
172 enum class ZOrderFlags
174 NONE = 0x0000,
175 Before = 0x0001,
176 Behind = 0x0002,
177 First = 0x0004,
178 Last = 0x0008,
180 namespace o3tl
182 template<> struct typed_flags<ZOrderFlags> : is_typed_flags<ZOrderFlags, 0x000f> {};
185 // Activate-Flags
186 enum class ActivateModeFlags
188 NONE = 0,
189 GrabFocus = 0x0001,
191 namespace o3tl
193 template<> struct typed_flags<ActivateModeFlags> : is_typed_flags<ActivateModeFlags, 0x0001> {};
196 // ToTop-Flags
197 enum class ToTopFlags
199 NONE = 0x0000,
200 RestoreWhenMin = 0x0001,
201 ForegroundTask = 0x0002,
202 NoGrabFocus = 0x0004,
203 GrabFocusOnly = 0x0008,
205 namespace o3tl
207 template<> struct typed_flags<ToTopFlags> : is_typed_flags<ToTopFlags, 0x000f> {};
210 // Flags for Invalidate
211 // must match css::awt::InvalidateStyle
212 enum class InvalidateFlags
214 NONE = 0x0000,
215 /** The child windows are invalidated, too. */
216 Children = 0x0001,
217 /** The child windows are not invalidated. */
218 NoChildren = 0x0002,
219 /** The invalidated area is painted with the background color/pattern. */
220 NoErase = 0x0004,
221 /** The invalidated area is updated immediately. */
222 Update = 0x0008,
223 /** The parent window is invalidated, too. */
224 Transparent = 0x0010,
225 /** The parent window is not invalidated. */
226 NoTransparent = 0x0020,
227 /** The area is invalidated regardless of overlapping child windows. */
228 NoClipChildren = 0x4000,
230 namespace o3tl
232 template<> struct typed_flags<InvalidateFlags> : is_typed_flags<InvalidateFlags, 0x403f> {};
235 // Flags for Validate
236 enum class ValidateFlags
238 NONE = 0x0000,
239 Children = 0x0001,
240 NoChildren = 0x0002
242 namespace o3tl
244 template<> struct typed_flags<ValidateFlags> : is_typed_flags<ValidateFlags, 0x0003> {};
247 // Flags for Scroll
248 enum class ScrollFlags
250 NONE = 0x0000,
251 Clip = 0x0001,
252 Children = 0x0002,
253 NoChildren = 0x0004,
254 UseClipRegion = 0x0008,
255 Update = 0x0010,
257 namespace o3tl
259 template<> struct typed_flags<ScrollFlags> : is_typed_flags<ScrollFlags, 0x001f> {};
262 // Flags for ParentClipMode
263 enum class ParentClipMode
265 NONE = 0x0000,
266 Clip = 0x0001,
267 NoClip = 0x0002,
269 namespace o3tl
271 template<> struct typed_flags<ParentClipMode> : is_typed_flags<ParentClipMode, 0x0003> {};
274 // Flags for ShowTracking()
275 enum class ShowTrackFlags {
276 NONE = 0x0000,
277 Small = 0x0001,
278 Big = 0x0002,
279 Split = 0x0003,
280 Object = 0x0004,
281 StyleMask = 0x000F,
282 TrackWindow = 0x1000,
283 Clip = 0x2000,
285 namespace o3tl
287 template<> struct typed_flags<ShowTrackFlags> : is_typed_flags<ShowTrackFlags, 0x300f> {};
290 // Flags for StartTracking()
291 enum class StartTrackingFlags
293 NONE = 0x0001,
294 KeyMod = 0x0002,
295 ScrollRepeat = 0x0004,
296 ButtonRepeat = 0x0008,
299 namespace o3tl
301 template<> struct typed_flags<StartTrackingFlags> : is_typed_flags<StartTrackingFlags, 0x000f> {};
304 // Flags for StartAutoScroll()
305 enum class StartAutoScrollFlags
307 NONE = 0x0000,
308 Vert = 0x0001,
309 Horz = 0x0002,
311 namespace o3tl
313 template<> struct typed_flags<StartAutoScrollFlags> : is_typed_flags<StartAutoScrollFlags, 0x0003> {};
316 // Flags for StateChanged()
317 enum class StateChangedType : sal_uInt16
319 InitShow = 1,
320 Visible = 2,
321 UpdateMode = 3,
322 Enable = 4,
323 Text = 5,
324 Data = 7,
325 State = 8,
326 Style = 9,
327 Zoom = 10,
328 ControlFont = 13,
329 ControlForeground = 14,
330 ControlBackground = 15,
331 ReadOnly = 16,
332 Mirroring = 18,
333 Layout = 19,
334 ControlFocus = 20
337 // GetFocusFlags
338 // must match constants in css:awt::FocusChangeReason
339 enum class GetFocusFlags
341 NONE = 0x0000,
342 Tab = 0x0001,
343 CURSOR = 0x0002, // avoid name-clash with X11 #define
344 Mnemonic = 0x0004,
345 F6 = 0x0008,
346 Forward = 0x0010,
347 Backward = 0x0020,
348 Around = 0x0040,
349 UniqueMnemonic = 0x0100,
350 Init = 0x0200,
351 FloatWinPopupModeEndCancel = 0x0400,
353 namespace o3tl
355 template<> struct typed_flags<GetFocusFlags> : is_typed_flags<GetFocusFlags, 0x077f> {};
359 // Flags for Draw()
360 enum class DrawFlags
362 NONE = 0x0000,
363 Mono = 0x0001,
364 NoControls = 0x0004,
366 namespace o3tl
368 template<> struct typed_flags<DrawFlags> : is_typed_flags<DrawFlags, 0x0005> {};
371 // DialogControl-Flags
372 enum class DialogControlFlags
374 NONE = 0x0000,
375 Return = 0x0001,
376 WantFocus = 0x0002,
377 FloatWinPopupModeEndCancel = 0x0004,
379 namespace o3tl
381 template<> struct typed_flags<DialogControlFlags> : is_typed_flags<DialogControlFlags, 0x0007> {};
384 // EndExtTextInput() Flags
385 enum class EndExtTextInputFlags
387 NONE = 0x0000,
388 Complete = 0x0001
390 namespace o3tl
392 template<> struct typed_flags<EndExtTextInputFlags> : is_typed_flags<EndExtTextInputFlags, 0x0001> {};
395 #define IMPL_MINSIZE_BUTTON_WIDTH 70
396 #define IMPL_MINSIZE_BUTTON_HEIGHT 22
397 #define IMPL_EXTRA_BUTTON_WIDTH 18
398 #define IMPL_EXTRA_BUTTON_HEIGHT 10
399 #define IMPL_SEP_BUTTON_X 5
400 #define IMPL_SEP_BUTTON_Y 5
401 #define IMPL_MINSIZE_MSGBOX_WIDTH 150
402 #define IMPL_DIALOG_OFFSET 5
403 #define IMPL_DIALOG_BAR_OFFSET 3
404 #define IMPL_MSGBOX_OFFSET_EXTRA_X 0
405 #define IMPL_MSGBOX_OFFSET_EXTRA_Y 2
406 #define IMPL_SEP_MSGBOX_IMAGE 8
408 // ImplGetDlgWindow()
409 enum class GetDlgWindowType
411 Prev, Next, First
415 #ifdef DBG_UTIL
416 const char* ImplDbgCheckWindow( const void* pObj );
417 #endif
419 namespace vcl { class Window; }
420 namespace vcl { class Cursor; }
421 class Dialog;
422 class Edit;
423 class WindowImpl;
424 class PaintHelper;
425 class VclSizeGroup;
426 class Application;
427 class WorkWindow;
428 class MessBox;
429 class MessageDialog;
430 class DockingWindow;
431 class FloatingWindow;
432 class GroupBox;
433 class PushButton;
434 class RadioButton;
435 class SystemChildWindow;
436 class ImplDockingWindowWrapper;
437 class ImplPopupFloatWin;
438 class LifecycleTest;
441 enum class WindowHitTest {
442 NONE = 0x0000,
443 Inside = 0x0001,
444 Transparent = 0x0002
446 namespace o3tl {
447 template<> struct typed_flags<WindowHitTest> : is_typed_flags<WindowHitTest, 0x0003> {};
451 enum class WindowExtendedStyle {
452 NONE = 0x0000,
453 Document = 0x0001,
454 DocModified = 0x0002,
456 * This is a frame window that is requested to be hidden (not just "not yet
457 * shown").
459 DocHidden = 0x0004,
461 namespace o3tl {
462 template<> struct typed_flags<WindowExtendedStyle> : is_typed_flags<WindowExtendedStyle, 0x0007> {};
465 namespace vcl {
467 class VCL_DLLPUBLIC RenderTools
469 public:
470 // transparent background for selected or checked items in toolboxes etc.
471 // + selection Color with a text color complementing the selection background
472 // + rounded edge
473 static void DrawSelectionBackground(vcl::RenderContext& rRenderContext, vcl::Window const & rWindow,
474 const tools::Rectangle& rRect, sal_uInt16 nHighlight,
475 bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly,
476 Color* pSelectionTextColor = nullptr, tools::Long nCornerRadius = 0,
477 Color const * pPaintColor = nullptr);
480 class VCL_DLLPUBLIC Window : public ::OutputDevice
482 friend class ::vcl::Cursor;
483 friend class ::OutputDevice;
484 friend class ::Application;
485 friend class ::SystemWindow;
486 friend class ::WorkWindow;
487 friend class ::Dialog;
488 friend class ::Edit;
489 friend class ::MessBox;
490 friend class ::MessageDialog;
491 friend class ::DockingWindow;
492 friend class ::FloatingWindow;
493 friend class ::GroupBox;
494 friend class ::PushButton;
495 friend class ::RadioButton;
496 friend class ::SystemChildWindow;
497 friend class ::ImplBorderWindow;
498 friend class ::PaintHelper;
499 friend class ::LifecycleTest;
501 // TODO: improve missing functionality
502 // only required because of SetFloatingMode()
503 friend class ::ImplDockingWindowWrapper;
504 friend class ::ImplPopupFloatWin;
505 friend class ::MenuFloatingWindow;
507 friend class ::svt::PopupWindowControllerImpl;
509 private:
510 // NOTE: to remove many dependencies of other modules
511 // to this central file, all members are now hidden
512 // in the WindowImpl class and all inline functions
513 // were removed.
514 // (WindowImpl is a pImpl pattern)
516 // Please do *not* add new members or inline functions to class Window,
517 // but use class WindowImpl instead
519 std::unique_ptr<WindowImpl> mpWindowImpl;
521 #ifdef DBG_UTIL
522 friend const char* ::ImplDbgCheckWindow( const void* pObj );
523 #endif
525 public:
527 DECL_DLLPRIVATE_LINK( ImplHandlePaintHdl, Timer*, void );
528 DECL_DLLPRIVATE_LINK( ImplGenerateMouseMoveHdl, void*, void );
529 DECL_DLLPRIVATE_LINK( ImplTrackTimerHdl, Timer*, void );
530 DECL_DLLPRIVATE_LINK( ImplAsyncFocusHdl, void*, void );
531 DECL_DLLPRIVATE_LINK( ImplHandleResizeTimerHdl, Timer*, void );
534 SAL_DLLPRIVATE static void ImplInitAppFontData( vcl::Window const * pWindow );
536 SAL_DLLPRIVATE vcl::Window* ImplGetFrameWindow() const;
537 weld::Window* GetFrameWeld() const;
538 vcl::Window* GetFrameWindow() const;
539 SalFrame* ImplGetFrame() const;
540 SAL_DLLPRIVATE ImplFrameData* ImplGetFrameData();
542 vcl::Window* ImplGetWindow() const; ///< if this is a proxy return the client, otherwise itself
543 SAL_DLLPRIVATE ImplWinData* ImplGetWinData() const;
544 SAL_DLLPRIVATE vcl::Window* ImplGetClientWindow() const;
545 SAL_DLLPRIVATE vcl::Window* ImplGetDlgWindow( sal_uInt16 n, GetDlgWindowType nType, sal_uInt16 nStart = 0, sal_uInt16 nEnd = 0xFFFF, sal_uInt16* pIndex = nullptr );
546 SAL_DLLPRIVATE vcl::Window* ImplGetParent() const;
547 SAL_DLLPRIVATE vcl::Window* ImplFindWindow( const Point& rFramePos );
549 SAL_DLLPRIVATE void ImplInvalidateFrameRegion( const vcl::Region* pRegion, InvalidateFlags nFlags );
550 SAL_DLLPRIVATE void ImplInvalidateOverlapFrameRegion( const vcl::Region& rRegion );
552 SAL_DLLPRIVATE bool ImplSetClipFlag( bool bSysObjOnlySmaller = false );
554 SAL_DLLPRIVATE bool ImplIsWindowOrChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
555 SAL_DLLPRIVATE bool ImplIsChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
556 SAL_DLLPRIVATE bool ImplIsFloatingWindow() const;
557 SAL_DLLPRIVATE bool ImplIsPushButton() const;
558 SAL_DLLPRIVATE bool ImplIsSplitter() const;
559 SAL_DLLPRIVATE bool ImplIsOverlapWindow() const;
561 SAL_DLLPRIVATE void ImplIsInTaskPaneList( bool mbIsInTaskList );
563 SAL_DLLPRIVATE WindowImpl* ImplGetWindowImpl() const { return mpWindowImpl.get(); }
565 SAL_DLLPRIVATE Point ImplFrameToOutput( const Point& rPos );
567 SAL_DLLPRIVATE void ImplGrabFocus( GetFocusFlags nFlags );
568 SAL_DLLPRIVATE void ImplGrabFocusToDocument( GetFocusFlags nFlags );
569 SAL_DLLPRIVATE void ImplInvertFocus( const tools::Rectangle& rRect );
571 SAL_DLLPRIVATE PointerStyle ImplGetMousePointer() const;
572 SAL_DLLPRIVATE void ImplCallMouseMove( sal_uInt16 nMouseCode, bool bModChanged = false );
573 SAL_DLLPRIVATE void ImplGenerateMouseMove();
575 SAL_DLLPRIVATE void ImplNotifyKeyMouseCommandEventListeners( NotifyEvent& rNEvt );
576 SAL_DLLPRIVATE void ImplNotifyIconifiedState( bool bIconified );
578 SAL_DLLPRIVATE void ImplUpdateAll();
580 SAL_DLLPRIVATE void ImplControlFocus( GetFocusFlags nFlags = GetFocusFlags::NONE );
582 SAL_DLLPRIVATE void ImplMirrorFramePos( Point &pt ) const;
584 SAL_DLLPRIVATE void ImplPosSizeWindow( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags );
586 SAL_DLLPRIVATE void ImplCallResize();
587 SAL_DLLPRIVATE void ImplCallMove();
589 void IncModalCount();
590 void DecModalCount();
592 SAL_DLLPRIVATE static void ImplCalcSymbolRect( tools::Rectangle& rRect );
594 protected:
596 /** This is intended to be used to clear any locally held references to other Window-subclass objects */
597 virtual void dispose() override;
599 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData );
601 SAL_DLLPRIVATE Point ImplOutputToFrame( const Point& rPos );
603 SAL_DLLPRIVATE void ImplInvalidateParentFrameRegion( vcl::Region& rRegion );
604 SAL_DLLPRIVATE void ImplValidateFrameRegion( const vcl::Region* rRegion, ValidateFlags nFlags );
605 SAL_DLLPRIVATE void ImplValidate();
606 SAL_DLLPRIVATE void ImplMoveInvalidateRegion( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren );
607 SAL_DLLPRIVATE void ImplMoveAllInvalidateRegions( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren );
609 SAL_DLLPRIVATE vcl::Window* ImplGetBorderWindow() const;
611 SAL_DLLPRIVATE void ImplInvalidate( const vcl::Region* rRegion, InvalidateFlags nFlags );
613 virtual WindowHitTest ImplHitTest( const Point& rFramePos );
615 SAL_DLLPRIVATE void ImplSetMouseTransparent( bool bTransparent );
617 SAL_DLLPRIVATE void ImplScroll( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags );
619 SAL_DLLPRIVATE bool ImplSetClipFlagChildren( bool bSysObjOnlySmaller );
620 SAL_DLLPRIVATE bool ImplSetClipFlagOverlapWindows( bool bSysObjOnlySmaller = false );
622 SAL_DLLPRIVATE void PushPaintHelper(PaintHelper* pHelper, vcl::RenderContext& rRenderContext);
623 SAL_DLLPRIVATE void PopPaintHelper(PaintHelper const * pHelper);
625 private:
627 SAL_DLLPRIVATE void ImplSetFrameParent( const vcl::Window* pParent );
629 SAL_DLLPRIVATE void ImplInsertWindow( vcl::Window* pParent );
630 SAL_DLLPRIVATE void ImplRemoveWindow( bool bRemoveFrameData );
632 SAL_DLLPRIVATE SalGraphics* ImplGetFrameGraphics() const;
634 SAL_DLLPRIVATE static void ImplCallFocusChangeActivate( vcl::Window* pNewOverlapWindow, vcl::Window* pOldOverlapWindow );
635 SAL_DLLPRIVATE vcl::Window* ImplGetFirstOverlapWindow();
636 SAL_DLLPRIVATE const vcl::Window* ImplGetFirstOverlapWindow() const;
638 SAL_DLLPRIVATE bool ImplIsRealParentPath( const vcl::Window* pWindow ) const;
640 SAL_DLLPRIVATE bool ImplTestMousePointerSet();
642 SAL_DLLPRIVATE void ImplResetReallyVisible();
643 SAL_DLLPRIVATE void ImplSetReallyVisible();
645 SAL_DLLPRIVATE void ImplCallInitShow();
647 SAL_DLLPRIVATE void ImplInitResolutionSettings();
649 SAL_DLLPRIVATE void ImplPointToLogic(vcl::RenderContext const & rRenderContext, vcl::Font& rFont) const;
650 SAL_DLLPRIVATE void ImplLogicToPoint(vcl::RenderContext const & rRenderContext, vcl::Font& rFont) const;
652 SAL_DLLPRIVATE bool ImplSysObjClip( const vcl::Region* pOldRegion );
653 SAL_DLLPRIVATE void ImplUpdateSysObjChildrenClip();
654 SAL_DLLPRIVATE void ImplUpdateSysObjOverlapsClip();
655 SAL_DLLPRIVATE void ImplUpdateSysObjClip();
657 SAL_DLLPRIVATE void ImplIntersectWindowClipRegion( vcl::Region& rRegion );
658 SAL_DLLPRIVATE void ImplIntersectWindowRegion( vcl::Region& rRegion );
659 SAL_DLLPRIVATE void ImplExcludeWindowRegion( vcl::Region& rRegion );
660 SAL_DLLPRIVATE void ImplExcludeOverlapWindows( vcl::Region& rRegion ) const;
661 SAL_DLLPRIVATE void ImplExcludeOverlapWindows2( vcl::Region& rRegion );
663 SAL_DLLPRIVATE void ImplClipBoundaries( vcl::Region& rRegion, bool bThis, bool bOverlaps );
664 SAL_DLLPRIVATE bool ImplClipChildren( vcl::Region& rRegion ) const;
665 SAL_DLLPRIVATE void ImplClipAllChildren( vcl::Region& rRegion ) const;
666 SAL_DLLPRIVATE void ImplClipSiblings( vcl::Region& rRegion ) const;
668 SAL_DLLPRIVATE void ImplInitWinClipRegion();
669 SAL_DLLPRIVATE void ImplInitWinChildClipRegion();
670 SAL_DLLPRIVATE vcl::Region* ImplGetWinChildClipRegion();
672 SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows( const vcl::Region& rInterRegion, vcl::Region& rRegion ) const;
673 SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows2( const vcl::Region& rInterRegion, vcl::Region& rRegion );
674 SAL_DLLPRIVATE void ImplCalcOverlapRegionOverlaps( const vcl::Region& rInterRegion, vcl::Region& rRegion ) const;
675 SAL_DLLPRIVATE void ImplCalcOverlapRegion( const tools::Rectangle& rSourceRect, vcl::Region& rRegion,
676 bool bChildren, bool bSiblings );
678 /** Invoke the actual painting.
680 This function is kind of recursive - it may be called from the
681 PaintHelper destructor; and on the other hand it creates PaintHelper
682 that (when destructed) calls other ImplCallPaint()'s.
684 SAL_DLLPRIVATE void ImplCallPaint(const vcl::Region* pRegion, ImplPaintFlags nPaintFlags);
686 SAL_DLLPRIVATE void ImplCallOverlapPaint();
688 SAL_DLLPRIVATE void ImplUpdateWindowPtr( vcl::Window* pWindow );
689 SAL_DLLPRIVATE void ImplUpdateWindowPtr();
690 SAL_DLLPRIVATE void ImplUpdateOverlapWindowPtr( bool bNewFrame );
692 SAL_DLLPRIVATE bool ImplUpdatePos();
693 SAL_DLLPRIVATE void ImplUpdateSysObjPos();
695 SAL_DLLPRIVATE void ImplUpdateGlobalSettings( AllSettings& rSettings, bool bCallHdl = true ) const;
697 SAL_DLLPRIVATE void ImplToBottomChild();
699 SAL_DLLPRIVATE void ImplCalcToTop( ImplCalcToTopData* pPrevData );
700 SAL_DLLPRIVATE void ImplToTop( ToTopFlags nFlags );
701 SAL_DLLPRIVATE void ImplStartToTop( ToTopFlags nFlags );
702 SAL_DLLPRIVATE void ImplFocusToTop( ToTopFlags nFlags, bool bReallyVisible );
704 SAL_DLLPRIVATE void ImplShowAllOverlaps();
705 SAL_DLLPRIVATE void ImplHideAllOverlaps();
707 SAL_DLLPRIVATE bool ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput );
708 SAL_DLLPRIVATE bool ImplHasDlgCtrl() const;
709 SAL_DLLPRIVATE void ImplDlgCtrlNextWindow();
710 SAL_DLLPRIVATE void ImplDlgCtrlFocusChanged( vcl::Window* pWindow, bool bGetFocus );
711 SAL_DLLPRIVATE vcl::Window* ImplFindDlgCtrlWindow( vcl::Window* pWindow );
713 SAL_DLLPRIVATE static void ImplNewInputContext();
715 SAL_DLLPRIVATE void ImplCallActivateListeners(vcl::Window*);
716 SAL_DLLPRIVATE void ImplCallDeactivateListeners(vcl::Window*);
718 SAL_DLLPRIVATE static void ImplHandleScroll(ScrollBar* pHScrl, double nX, ScrollBar* pVScrl, double nY);
720 SAL_DLLPRIVATE tools::Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle& rRect ) const;
721 SAL_DLLPRIVATE tools::Rectangle ImplUnmirroredAbsoluteScreenToOutputPixel( const tools::Rectangle& rRect ) const;
722 SAL_DLLPRIVATE tools::Long ImplGetUnmirroredOutOffX();
724 // retrieves the list of owner draw decorated windows for this window hierarchy
725 SAL_DLLPRIVATE ::std::vector<VclPtr<vcl::Window> >& ImplGetOwnerDrawList();
727 SAL_DLLPRIVATE vcl::Window* ImplGetTopmostFrameWindow();
729 SAL_DLLPRIVATE tools::Rectangle ImplGetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const;
731 SAL_DLLPRIVATE bool ImplStopDnd();
732 SAL_DLLPRIVATE void ImplStartDnd();
734 virtual void ImplPaintToDevice( ::OutputDevice* pTargetOutDev, const Point& rPos );
736 SAL_DLLPRIVATE css::uno::Reference< css::rendering::XCanvas >
737 ImplGetCanvas( bool bSpriteCanvas ) const;
739 public:
740 virtual vcl::Region GetActiveClipRegion() const override;
741 virtual vcl::Region GetOutputBoundsClipRegion() const override;
743 protected:
744 // Single argument ctors shall be explicit.
745 explicit Window( WindowType nType );
747 void SetCompoundControl( bool bCompound );
749 void CallEventListeners( VclEventId nEvent, void* pData = nullptr );
751 virtual bool AcquireGraphics() const override;
752 virtual void ReleaseGraphics( bool bRelease = true ) override;
754 virtual void InitClipRegion() override;
756 void ImplClearFontData(bool bNewFontLists) override;
757 void ImplRefreshFontData(bool bNewFontLists) override;
758 void ImplInitMapModeObjects() override;
760 // FIXME: this is a hack to workaround missing layout functionality
761 virtual void ImplAdjustNWFSizes();
763 virtual void CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate) override;
764 virtual const OutputDevice* DrawOutDevDirectCheck(const OutputDevice& rSrcDev) const override;
765 virtual void DrawOutDevDirectProcess(const OutputDevice& rSrcDev, SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override;
766 virtual void ClipToPaintRegion( tools::Rectangle& rDstRect ) override;
767 virtual bool UsePolyPolygonForComplexGradient() override;
769 virtual void ApplySettings(vcl::RenderContext& rRenderContext);
770 public:
771 bool HasMirroredGraphics() const override;
773 public:
774 // Single argument ctors shall be explicit.
775 explicit Window( vcl::Window* pParent, WinBits nStyle = 0 );
777 virtual ~Window() override;
779 ::OutputDevice const* GetOutDev() const;
780 ::OutputDevice* GetOutDev();
782 Color GetBackgroundColor() const override;
784 size_t GetSyncCount() const override { return 0x000000ff; }
785 virtual void EnableRTL ( bool bEnable = true ) override;
786 virtual void MouseMove( const MouseEvent& rMEvt );
787 virtual void MouseButtonDown( const MouseEvent& rMEvt );
788 virtual void MouseButtonUp( const MouseEvent& rMEvt );
789 virtual void KeyInput( const KeyEvent& rKEvt );
790 virtual void KeyUp( const KeyEvent& rKEvt );
791 virtual void PrePaint(vcl::RenderContext& rRenderContext);
792 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
793 virtual void PostPaint(vcl::RenderContext& rRenderContext);
795 using OutputDevice::Erase;
796 void Erase(vcl::RenderContext& rRenderContext);
798 virtual void Draw( ::OutputDevice* pDev, const Point& rPos, DrawFlags nFlags );
799 virtual void Move();
800 virtual void Resize();
801 virtual void Activate();
802 virtual void Deactivate();
803 virtual void GetFocus();
804 virtual void LoseFocus();
805 virtual void RequestHelp( const HelpEvent& rHEvt );
806 virtual void Command( const CommandEvent& rCEvt );
807 virtual void Tracking( const TrackingEvent& rTEvt );
808 virtual void StateChanged( StateChangedType nStateChange );
809 virtual void DataChanged( const DataChangedEvent& rDCEvt );
810 virtual bool PreNotify( NotifyEvent& rNEvt );
811 virtual bool EventNotify( NotifyEvent& rNEvt );
813 // These methods call the relevant virtual method when not in/post dispose
814 void CompatGetFocus();
815 void CompatLoseFocus();
816 void CompatStateChanged( StateChangedType nStateChange );
817 void CompatDataChanged( const DataChangedEvent& rDCEvt );
818 bool CompatPreNotify( NotifyEvent& rNEvt );
819 bool CompatNotify( NotifyEvent& rNEvt );
821 void AddEventListener( const Link<VclWindowEvent&,void>& rEventListener );
822 void RemoveEventListener( const Link<VclWindowEvent&,void>& rEventListener );
823 void AddChildEventListener( const Link<VclWindowEvent&,void>& rEventListener );
824 void RemoveChildEventListener( const Link<VclWindowEvent&,void>& rEventListener );
826 ImplSVEvent * PostUserEvent( const Link<void*,void>& rLink, void* pCaller = nullptr, bool bReferenceLink = false );
827 void RemoveUserEvent( ImplSVEvent * nUserEvent );
829 // returns the input language used for the last key stroke
830 // may be LANGUAGE_DONTKNOW if not supported by the OS
831 LanguageType GetInputLanguage() const;
833 void SetStyle( WinBits nStyle );
834 WinBits GetStyle() const;
835 WinBits GetPrevStyle() const;
836 void SetExtendedStyle( WindowExtendedStyle nExtendedStyle );
837 WindowExtendedStyle GetExtendedStyle() const;
838 void SetType( WindowType nType );
839 WindowType GetType() const;
840 bool IsSystemWindow() const;
841 bool IsDockingWindow() const;
842 bool IsDialog() const;
843 bool IsMenuFloatingWindow() const;
844 bool IsToolbarFloatingWindow() const;
845 bool IsTopWindow() const;
846 bool IsDisposed() const;
847 SystemWindow* GetSystemWindow() const;
849 /// Can the widget derived from this Window do the double-buffering via RenderContext properly?
850 bool SupportsDoubleBuffering() const;
851 /// Enable/disable double-buffering of the frame window and all its children.
852 void RequestDoubleBuffering(bool bRequest);
854 void EnableAllResize();
856 void SetBorderStyle( WindowBorderStyle nBorderStyle );
857 WindowBorderStyle GetBorderStyle() const;
858 void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
859 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
860 Size CalcWindowSize( const Size& rOutSz ) const;
861 Size CalcOutputSize( const Size& rWinSz ) const;
862 tools::Long CalcTitleWidth() const;
864 void EnableClipSiblings( bool bClipSiblings = true );
866 void EnableChildTransparentMode( bool bEnable = true );
867 bool IsChildTransparentModeEnabled() const;
869 void SetMouseTransparent( bool bTransparent );
870 bool IsMouseTransparent() const;
871 void SetPaintTransparent( bool bTransparent );
872 bool IsPaintTransparent() const;
873 void SetDialogControlStart( bool bStart );
874 bool IsDialogControlStart() const;
875 void SetDialogControlFlags( DialogControlFlags nFlags );
876 DialogControlFlags GetDialogControlFlags() const;
878 struct PointerState
880 sal_uLong mnState; // the button state
881 Point maPos; // mouse position in output coordinates
883 PointerState GetPointerState();
884 bool IsMouseOver() const;
886 void SetInputContext( const InputContext& rInputContext );
887 const InputContext& GetInputContext() const;
888 void PostExtTextInputEvent(VclEventId nType, const OUString& rText);
889 void EndExtTextInput();
890 void SetCursorRect( const tools::Rectangle* pRect = nullptr, tools::Long nExtTextInputWidth = 0 );
891 const tools::Rectangle* GetCursorRect() const;
892 tools::Long GetCursorExtTextInputWidth() const;
894 void SetCompositionCharRect( const tools::Rectangle* pRect, tools::Long nCompositionLength, bool bVertical = false );
896 using ::OutputDevice::SetSettings;
897 virtual void SetSettings( const AllSettings& rSettings ) override;
898 void SetSettings( const AllSettings& rSettings, bool bChild );
899 void UpdateSettings( const AllSettings& rSettings, bool bChild = false );
900 void NotifyAllChildren( DataChangedEvent& rDCEvt );
902 void SetPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont);
903 vcl::Font GetPointFont(vcl::RenderContext const & rRenderContext) const;
904 void SetZoomedPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont);
905 tools::Long GetDrawPixel( ::OutputDevice const * pDev, tools::Long nPixels ) const;
906 vcl::Font GetDrawPixelFont( ::OutputDevice const * pDev ) const;
908 void SetControlFont();
909 void SetControlFont( const vcl::Font& rFont );
910 vcl::Font GetControlFont() const;
911 bool IsControlFont() const;
912 void ApplyControlFont(vcl::RenderContext& rRenderContext, const vcl::Font& rDefaultFont);
914 void SetControlForeground();
915 void SetControlForeground(const Color& rColor);
916 const Color& GetControlForeground() const;
917 bool IsControlForeground() const;
918 void ApplyControlForeground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor);
920 void SetControlBackground();
921 void SetControlBackground( const Color& rColor );
922 const Color& GetControlBackground() const;
923 bool IsControlBackground() const;
924 void ApplyControlBackground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor);
926 void SetParentClipMode( ParentClipMode nMode = ParentClipMode::NONE );
927 ParentClipMode GetParentClipMode() const;
929 void SetWindowRegionPixel();
930 void SetWindowRegionPixel( const vcl::Region& rRegion );
931 vcl::Region GetWindowClipRegionPixel() const;
932 vcl::Region GetPaintRegion() const;
933 bool IsInPaint() const;
934 // while IsInPaint returns true ExpandPaintClipRegion adds the
935 // submitted region to the paint clip region so you can
936 // paint additional parts of your window if necessary
937 void ExpandPaintClipRegion( const vcl::Region& rRegion );
939 void SetParent( vcl::Window* pNewParent );
940 vcl::Window* GetParent() const;
941 // return the dialog we are contained in or NULL if un-contained
942 Dialog* GetParentDialog() const;
943 bool IsAncestorOf( const vcl::Window& rWindow ) const;
945 void Show( bool bVisible = true, ShowFlags nFlags = ShowFlags::NONE );
946 void Hide() { Show( false ); }
947 bool IsVisible() const;
948 bool IsReallyVisible() const;
949 bool IsReallyShown() const;
950 bool IsInInitShow() const;
952 void Enable( bool bEnable = true, bool bChild = true );
953 void Disable( bool bChild = true ) { Enable( false, bChild ); }
954 bool IsEnabled() const;
956 void EnableInput( bool bEnable = true, bool bChild = true );
957 void EnableInput( bool bEnable, const vcl::Window* pExcludeWindow );
958 bool IsInputEnabled() const;
960 /** Override <code>EnableInput</code>. This can be necessary due to other people
961 using EnableInput for whole window hierarchies.
963 @param bAlways
964 sets always enabled flag
966 @param bChild
967 if true children are recursively set to AlwaysEnableInput
969 void AlwaysEnableInput( bool bAlways, bool bChild = true );
971 /** returns the current AlwaysEnableInput state
972 @return
973 true if window is in AlwaysEnableInput state
975 bool IsAlwaysEnableInput() const;
977 /** A window is in modal mode if one of its children or subchildren
978 is a running modal window (a modal dialog)
980 @returns sal_True if a child or subchild is a running modal window
982 bool IsInModalMode() const;
984 void SetActivateMode( ActivateModeFlags nMode );
985 ActivateModeFlags GetActivateMode() const;
987 void ToTop( ToTopFlags nFlags = ToTopFlags::NONE );
988 void SetZOrder( vcl::Window* pRefWindow, ZOrderFlags nFlags );
989 void EnableAlwaysOnTop( bool bEnable = true );
990 bool IsAlwaysOnTopEnabled() const;
992 virtual void setPosSizePixel( tools::Long nX, tools::Long nY,
993 tools::Long nWidth, tools::Long nHeight,
994 PosSizeFlags nFlags = PosSizeFlags::All );
995 virtual void SetPosPixel( const Point& rNewPos );
996 virtual Point GetPosPixel() const;
997 virtual void SetSizePixel( const Size& rNewSize );
998 virtual Size GetSizePixel() const;
999 virtual void SetPosSizePixel( const Point& rNewPos,
1000 const Size& rNewSize );
1001 virtual void SetOutputSizePixel( const Size& rNewSize );
1002 bool IsDefaultPos() const;
1003 bool IsDefaultSize() const;
1004 Point GetOffsetPixelFrom(const vcl::Window& rWindow) const;
1006 // those conversion routines might deliver different results during UI mirroring
1007 Point OutputToScreenPixel( const Point& rPos ) const;
1008 Point ScreenToOutputPixel( const Point& rPos ) const;
1009 // the normalized screen methods work independent from UI mirroring
1010 Point OutputToNormalizedScreenPixel( const Point& rPos ) const;
1011 Point NormalizedScreenToOutputPixel( const Point& rPos ) const;
1012 Point OutputToAbsoluteScreenPixel( const Point& rPos ) const;
1013 Point AbsoluteScreenToOutputPixel( const Point& rPos ) const;
1014 tools::Rectangle GetDesktopRectPixel() const;
1015 // window extents including border and decoration
1016 tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const;
1018 bool IsScrollable() const;
1019 virtual void Scroll( tools::Long nHorzScroll, tools::Long nVertScroll,
1020 ScrollFlags nFlags = ScrollFlags::NONE );
1021 void Scroll( tools::Long nHorzScroll, tools::Long nVertScroll,
1022 const tools::Rectangle& rRect, ScrollFlags nFlags = ScrollFlags::NONE );
1023 virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE );
1024 virtual void Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE );
1025 virtual void Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags = InvalidateFlags::NONE );
1027 * Notification about some rectangle of the output device got invalidated.Used for the main
1028 * document window.
1030 * @param pRectangle If 0, that means the whole area, otherwise the area in logic coordinates.
1032 virtual void LogicInvalidate(const tools::Rectangle* pRectangle);
1035 * Notification about some rectangle of the output device got invalidated. Used for the
1036 * dialogs and floating windows (e.g. context menu, popup).
1038 * @param pRectangle If 0, that means the whole area, otherwise the area in pixel coordinates.
1040 virtual void PixelInvalidate(const tools::Rectangle* pRectangle);
1041 void Validate();
1042 bool HasPaintEvent() const;
1043 void PaintImmediately();
1044 void Flush() override;
1046 // toggles new docking support, enabled via toolkit
1047 void EnableDocking( bool bEnable = true );
1048 // retrieves the single dockingmanager instance
1049 static DockingManager* GetDockingManager();
1051 void EnablePaint( bool bEnable );
1052 bool IsPaintEnabled() const;
1053 void SetUpdateMode( bool bUpdate );
1054 bool IsUpdateMode() const;
1055 void SetParentUpdateMode( bool bUpdate );
1057 void GrabFocus();
1058 bool HasFocus() const;
1059 bool HasChildPathFocus( bool bSystemWindow = false ) const;
1060 bool IsActive() const;
1061 bool HasActiveChildFrame() const;
1062 GetFocusFlags GetGetFocusFlags() const;
1063 void GrabFocusToDocument();
1064 VclPtr<vcl::Window> GetFocusedWindow() const;
1067 * Set this when you need to act as if the window has focus even if it
1068 * doesn't. This is necessary for implementing tab stops inside floating
1069 * windows, but floating windows don't get focus from the system.
1071 void SetFakeFocus( bool bFocus );
1073 bool IsCompoundControl() const;
1075 static VclPtr<vcl::Window> SaveFocus();
1076 static void EndSaveFocus(const VclPtr<vcl::Window>& xFocusWin);
1078 void CaptureMouse();
1079 void ReleaseMouse();
1080 bool IsMouseCaptured() const;
1082 void SetPointer( PointerStyle );
1083 PointerStyle GetPointer() const;
1084 void EnableChildPointerOverwrite( bool bOverwrite );
1085 void SetPointerPosPixel( const Point& rPos );
1086 Point GetPointerPosPixel();
1087 Point GetLastPointerPosPixel();
1088 /// Similar to SetPointerPosPixel(), but sets the frame data's last mouse position instead.
1089 void SetLastMousePos(const Point& rPos);
1090 void ShowPointer( bool bVisible );
1091 void EnterWait();
1092 void LeaveWait();
1093 bool IsWait() const;
1095 void SetCursor( vcl::Cursor* pCursor );
1096 vcl::Cursor* GetCursor() const;
1098 void SetZoom( const Fraction& rZoom );
1099 const Fraction& GetZoom() const;
1100 bool IsZoom() const;
1101 tools::Long CalcZoom( tools::Long n ) const;
1103 virtual void SetText( const OUString& rStr );
1104 virtual OUString GetText() const;
1105 // return the actual text displayed
1106 // this may have e.g. accelerators removed or portions
1107 // replaced by ellipses
1108 virtual OUString GetDisplayText() const;
1109 // gets the visible background color. for transparent windows
1110 // this may be the parent's background color; for controls
1111 // this may be a child's background color (e.g. ListBox)
1112 virtual const Wallpaper& GetDisplayBackground() const;
1114 void SetHelpText( const OUString& rHelpText );
1115 const OUString& GetHelpText() const;
1117 void SetQuickHelpText( const OUString& rHelpText );
1118 const OUString& GetQuickHelpText() const;
1120 void SetHelpId( const OString& );
1121 const OString& GetHelpId() const;
1123 sal_uInt16 GetChildCount() const;
1124 vcl::Window* GetChild( sal_uInt16 nChild ) const;
1125 vcl::Window* GetWindow( GetWindowType nType ) const;
1126 bool IsChild( const vcl::Window* pWindow ) const;
1127 bool IsWindowOrChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
1129 /// Add all children to rAllChildren recursively.
1130 SAL_DLLPRIVATE void CollectChildren(::std::vector<vcl::Window *>& rAllChildren );
1132 virtual void ShowFocus(const tools::Rectangle& rRect);
1133 void HideFocus();
1135 // transparent background for selected or checked items in toolboxes etc.
1136 void DrawSelectionBackground( const tools::Rectangle& rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder );
1138 void ShowTracking( const tools::Rectangle& rRect,
1139 ShowTrackFlags nFlags = ShowTrackFlags::Small );
1140 void HideTracking();
1141 void InvertTracking( const tools::Rectangle& rRect, ShowTrackFlags nFlags );
1143 void StartTracking( StartTrackingFlags nFlags = StartTrackingFlags::NONE );
1144 void EndTracking( TrackingEventFlags nFlags = TrackingEventFlags::NONE );
1145 bool IsTracking() const;
1147 void StartAutoScroll( StartAutoScrollFlags nFlags );
1148 void EndAutoScroll();
1150 bool HandleScrollCommand( const CommandEvent& rCmd,
1151 ScrollBar* pHScrl,
1152 ScrollBar* pVScrl );
1154 void SaveBackground(VirtualDevice& rSaveDevice,
1155 const Point& rPos, const Size& rSize, const Size&) const override;
1157 virtual const SystemEnvData* GetSystemData() const;
1159 // API to set/query the component interfaces
1160 virtual css::uno::Reference< css::awt::XWindowPeer >
1161 GetComponentInterface( bool bCreate = true );
1163 void SetComponentInterface( css::uno::Reference< css::awt::XWindowPeer > const & xIFace );
1165 /// Interface to register for dialog / window tunneling.
1166 void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier, bool bParent = false);
1167 const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() const;
1168 vcl::LOKWindowId GetLOKWindowId() const;
1170 /// Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set.
1171 VclPtr<vcl::Window> GetParentWithLOKNotifier();
1173 /// Indicate that LOK is not going to use this dialog any more.
1174 void ReleaseLOKNotifier();
1176 /// Find an existing Window based on the LOKWindowId.
1177 static VclPtr<vcl::Window> FindLOKWindow(vcl::LOKWindowId nWindowId);
1179 bool IsDisableIdleNotify();
1180 void SetDisableIdleNotify(bool bValue);
1182 /// check if LOK Window container is empty
1183 static bool IsLOKWindowsEmpty();
1185 /// Dumps itself and potentially its children to a property tree, to be written easily to JSON.
1186 virtual void DumpAsPropertyTree(tools::JsonWriter&);
1188 /// Same as MouseButtonDown(), but coordinates are in logic unit. used for LOK
1189 virtual void LogicMouseButtonDown(const MouseEvent&) {};
1190 /// Same as MouseButtonUp(), but coordinates are in logic unit. used for LOK
1191 virtual void LogicMouseButtonUp(const MouseEvent&) {};
1192 /// Same as MouseMove(), but coordinates are in logic unit. used for LOK
1193 virtual void LogicMouseMove(const MouseEvent&) {};
1195 /** @name Accessibility
1197 ///@{
1198 public:
1200 css::uno::Reference< css::accessibility::XAccessible >
1201 GetAccessible( bool bCreate = true );
1203 virtual css::uno::Reference< css::accessibility::XAccessible >
1204 CreateAccessible();
1206 void SetAccessible( const css::uno::Reference< css::accessibility::XAccessible >& );
1208 vcl::Window* GetAccessibleParentWindow() const;
1209 sal_uInt16 GetAccessibleChildWindowCount();
1210 vcl::Window* GetAccessibleChildWindow( sal_uInt16 n );
1212 void SetAccessibleRole( sal_uInt16 nRole );
1213 sal_uInt16 GetAccessibleRole() const;
1215 void SetAccessibleName( const OUString& rName );
1216 OUString GetAccessibleName() const;
1218 void SetAccessibleDescription( const OUString& rDescr );
1219 OUString GetAccessibleDescription() const;
1221 void SetAccessibleRelationLabeledBy( vcl::Window* pLabeledBy );
1222 vcl::Window* GetAccessibleRelationLabeledBy() const;
1224 void SetAccessibleRelationLabelFor( vcl::Window* pLabelFor );
1225 vcl::Window* GetAccessibleRelationLabelFor() const;
1227 void SetAccessibleRelationMemberOf( vcl::Window* pMemberOf );
1228 vcl::Window* GetAccessibleRelationMemberOf() const;
1230 // to avoid sending accessibility events in cases like closing dialogs
1231 // by default checks complete parent path
1232 bool IsAccessibilityEventsSuppressed( bool bTraverseParentPath = true );
1233 void SetAccessibilityEventsSuppressed(bool bSuppressed);
1235 KeyEvent GetActivationKey() const;
1237 protected:
1239 // These eventually are supposed to go when everything is converted to .ui
1240 SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationMemberOf() const;
1241 SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabeledBy() const;
1242 SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabelFor() const;
1244 // Let Label override the code part of GetAccessibleRelationLabelFor
1245 virtual vcl::Window* getAccessibleRelationLabelFor() const;
1246 virtual sal_uInt16 getDefaultAccessibleRole() const;
1247 virtual OUString getDefaultAccessibleName() const;
1250 * Advisory Sizing - what is a good size for this widget
1252 * Retrieves the preferred size of a widget ignoring
1253 * "width-request" and "height-request" properties.
1255 * Implement this in sub-classes to tell layout
1256 * the preferred widget size.
1258 * Use get_preferred_size to retrieve this value
1259 * cached and mediated via height and width requests
1261 virtual Size GetOptimalSize() const;
1262 /// clear OptimalSize cache
1263 void InvalidateSizeCache();
1264 private:
1266 SAL_DLLPRIVATE bool ImplIsAccessibleCandidate() const;
1267 SAL_DLLPRIVATE bool ImplIsAccessibleNativeFrame() const;
1268 ///@}
1271 * Retrieves the preferred size of a widget taking
1272 * into account the "width-request" and "height-request" properties.
1274 * Overrides the result of GetOptimalSize to honor the
1275 * width-request and height-request properties.
1277 * So the same as get_ungrouped_preferred_size except
1278 * it ignores groups. A building block of get_preferred_size
1279 * that access the size cache
1281 * @see get_preferred_size
1283 Size get_ungrouped_preferred_size() const;
1284 public:
1285 /// request XCanvas render interface for this window
1286 css::uno::Reference< css::rendering::XCanvas >
1287 GetCanvas() const;
1288 /// request XSpriteCanvas render interface for this window
1289 css::uno::Reference< css::rendering::XSpriteCanvas >
1290 GetSpriteCanvas() const;
1292 /* records all DrawText operations within the passed rectangle;
1293 * a synchronous paint is sent to achieve this
1295 void RecordLayoutData( vcl::ControlLayoutData* pLayout, const tools::Rectangle& rRect );
1297 // set and retrieve for Toolkit
1298 VCLXWindow* GetWindowPeer() const;
1299 void SetWindowPeer( css::uno::Reference< css::awt::XWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow );
1301 // remember if it was generated by Toolkit
1302 bool IsCreatedWithToolkit() const;
1303 void SetCreatedWithToolkit( bool b );
1305 // Drag and Drop interfaces
1306 css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget();
1307 css::uno::Reference< css::datatransfer::dnd::XDragSource > GetDragSource();
1308 css::uno::Reference< css::datatransfer::dnd::XDragGestureRecognizer > GetDragGestureRecognizer();
1310 // Clipboard/Selection interfaces
1311 css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard();
1312 /// Sets a custom clipboard for the window's frame, instead of creating it on-demand using css::datatransfer::clipboard::SystemClipboard.
1313 void SetClipboard(css::uno::Reference<css::datatransfer::clipboard::XClipboard> const & xClipboard);
1314 css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetPrimarySelection();
1317 * Widgets call this to inform their owner container that the widget wants
1318 * to renegotiate its size. Should be called when a widget has a new size
1319 * request. e.g. a FixedText Control gets a new label.
1321 * akin to gtk_widget_queue_resize
1323 virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout);
1326 * Sets the "height-request" property
1328 * Override for height request of the widget, or -1 if natural request
1329 * should be used.
1331 * @see get_preferred_size, set_width_request
1333 void set_height_request(sal_Int32 nHeightRequest);
1334 sal_Int32 get_height_request() const;
1337 * Sets the "width-request" property
1339 * Override for width request of the widget, or -1 if natural request
1340 * should be used.
1342 * @see get_preferred_size, set_height_request
1344 void set_width_request(sal_Int32 nWidthRequest);
1345 sal_Int32 get_width_request() const;
1348 * Retrieves the preferred size of a widget taking
1349 * into account the "width-request" and "height-request" properties.
1351 * Overrides the result of GetOptimalSize to honor the
1352 * width-request and height-request properties.
1354 * @see GetOptimalSize
1356 * akin to gtk_widget_get_preferred_size
1358 Size get_preferred_size() const;
1361 * How to horizontally align this widget
1363 VclAlign get_halign() const;
1364 void set_halign(VclAlign eAlign);
1367 * How to vertically align this widget
1369 VclAlign get_valign() const;
1370 void set_valign(VclAlign eAlign);
1373 * Whether the widget would like to use any available extra horizontal
1374 * space.
1376 bool get_hexpand() const;
1377 void set_hexpand(bool bExpand);
1380 * Whether the widget would like to use any available extra vertical
1381 * space.
1383 bool get_vexpand() const;
1384 void set_vexpand(bool bExpand);
1387 * Whether the widget would like to use any available extra space.
1389 bool get_expand() const;
1390 void set_expand(bool bExpand);
1393 * Whether the widget should receive extra space when the parent grows
1395 bool get_fill() const;
1396 void set_fill(bool bFill);
1398 void set_border_width(sal_Int32 nBorderWidth);
1399 sal_Int32 get_border_width() const;
1401 void set_margin_start(sal_Int32 nWidth);
1402 sal_Int32 get_margin_start() const;
1404 void set_margin_end(sal_Int32 nWidth);
1405 sal_Int32 get_margin_end() const;
1407 void set_margin_top(sal_Int32 nWidth);
1408 sal_Int32 get_margin_top() const;
1410 void set_margin_bottom(sal_Int32 nWidth);
1411 sal_Int32 get_margin_bottom() const;
1414 * How the widget is packed with reference to the start or end of the parent
1416 VclPackType get_pack_type() const;
1417 void set_pack_type(VclPackType ePackType);
1420 * The extra space to put between the widget and its neighbors
1422 sal_Int32 get_padding() const;
1423 void set_padding(sal_Int32 nPadding);
1426 * The number of columns that the widget spans
1428 sal_Int32 get_grid_width() const;
1429 void set_grid_width(sal_Int32 nCols);
1432 * The column number to attach the left side of the widget to
1434 sal_Int32 get_grid_left_attach() const;
1435 void set_grid_left_attach(sal_Int32 nAttach);
1438 * The number of row that the widget spans
1440 sal_Int32 get_grid_height() const;
1441 void set_grid_height(sal_Int32 nRows);
1444 * The row number to attach the top side of the widget to
1446 sal_Int32 get_grid_top_attach() const;
1447 void set_grid_top_attach(sal_Int32 nAttach);
1450 * If true this child appears in a secondary layout group of children
1451 * e.g. help buttons in a buttonbox
1453 bool get_secondary() const;
1454 void set_secondary(bool bSecondary);
1457 * If true this child is exempted from homogeneous sizing
1458 * e.g. special button in a buttonbox
1460 bool get_non_homogeneous() const;
1461 void set_non_homogeneous(bool bNonHomogeneous);
1464 * Sets a widget property
1466 * @return false if property is unknown
1468 virtual bool set_property(const OString &rKey, const OUString &rValue);
1471 * Sets a font attribute
1473 * @return false if attribute is unknown
1475 bool set_font_attribute(const OString &rKey, const OUString &rValue);
1478 * Adds this widget to the xGroup VclSizeGroup
1481 void add_to_size_group(const std::shared_ptr<VclSizeGroup>& xGroup);
1482 void remove_from_all_size_groups();
1485 * add/remove mnemonic label
1487 void add_mnemonic_label(FixedText *pLabel);
1488 void remove_mnemonic_label(FixedText *pLabel);
1489 const std::vector<VclPtr<FixedText> >& list_mnemonic_labels() const;
1492 * Move this widget to be the nNewPosition'd child of its parent
1494 void reorderWithinParent(sal_uInt16 nNewPosition);
1497 * Sets an ID.
1499 void set_id(const OUString& rID);
1502 * Get the ID of the window.
1504 const OUString& get_id() const;
1507 // Native Widget Rendering functions
1510 // form controls must never use native widgets, this can be toggled here
1511 void EnableNativeWidget( bool bEnable = true );
1512 bool IsNativeWidgetEnabled() const;
1514 // a helper method for a Control's Draw method
1515 void PaintToDevice( ::OutputDevice* pDevice, const Point& rPos );
1517 /* tdf#119390 set parent to default window. Typically for use in advance of destroying
1518 * a floating windows which has the current focus so focus will revert to the main
1519 * document window and not the first widget in the current parent of the floating
1520 * window.
1522 void SetParentToDefaultWindow();
1525 // Keyboard access functions
1527 /** Query the states of keyboard indicators - Caps Lock, Num Lock and
1528 Scroll Lock. Use the following mask to retrieve the state of each
1529 indicator:
1531 KeyIndicatorState::CAPS_LOCK
1532 KeyIndicatorState::NUM_LOCK
1533 KeyIndicatorState::SCROLL_LOCK
1535 KeyIndicatorState GetIndicatorState() const;
1537 void SimulateKeyPress( sal_uInt16 nKeyCode ) const;
1539 virtual OUString GetSurroundingText() const;
1540 virtual Selection GetSurroundingTextSelection() const;
1541 virtual bool DeleteSurroundingText(const Selection& rSelection);
1543 virtual FactoryFunction GetUITestFactory() const;
1545 virtual bool IsChart() const { return false; }
1547 void SetHelpHdl(const Link<vcl::Window&, bool>& rLink);
1548 void SetMnemonicActivateHdl(const Link<vcl::Window&, bool>& rLink);
1549 void SetModalHierarchyHdl(const Link<bool, void>& rLink);
1550 void SetDumpAsPropertyTreeHdl(const Link<tools::JsonWriter&, void>& rLink);
1555 #endif // INCLUDED_VCL_WINDOW_HXX
1557 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */