LibreOffice Module vcl (master) 1
window.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_VCL_WINDOW_HXX
21#define INCLUDED_VCL_WINDOW_HXX
22
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>
32#include <rtl/ustring.hxx>
33#include <com/sun/star/uno/Reference.hxx>
34#include <memory>
35
36class VirtualDevice;
37struct ImplSVEvent;
38struct ImplWinData;
39struct ImplFrameData;
41struct SystemEnvData;
42struct SystemParentData;
44class Timer;
45class DockingManager;
46class Scrollable;
47class ScrollBar;
48class FixedText;
49class MouseEvent;
50class KeyEvent;
51class CommandEvent;
52class TrackingEvent;
53class HelpEvent;
55class VclSimpleEvent;
56class NotifyEvent;
57class SystemWindow;
58class SalFrame;
60class VCLXWindow;
61class VclWindowEvent;
62class AllSettings;
63class InputContext;
65enum class ImplPaintFlags;
66enum class VclEventId;
67enum class PointerStyle;
68
69namespace com::sun::star {
70 namespace accessibility {
71 struct AccessibleRelation;
72 class XAccessible;
73 }
74 namespace rendering {
75 class XCanvas;
76 class XSpriteCanvas;
77 }
78 namespace awt {
79 class XVclWindowPeer;
80 }
81 namespace uno {
82 class Any;
83 }
84 namespace datatransfer::clipboard {
85 class XClipboard;
86 }
87 namespace datatransfer::dnd {
88 class XDragGestureRecognizer;
89 class XDragSource;
90 class XDropTarget;
91 }
92}
93
94namespace vcl {
95 struct ControlLayoutData;
96}
97
98namespace svt { class PopupWindowControllerImpl; }
99
100namespace weld { class Window; }
101
102template<class T> class VclPtr;
103namespace tools { class JsonWriter; }
104
105// Type for GetWindow()
107{
108 Parent = 0,
109 FirstChild = 1,
110 LastChild = 2,
111 Prev = 3,
112 Next = 4,
113 FirstOverlap = 5,
114 Overlap = 7,
115 ParentOverlap = 8,
116 Client = 9,
117 RealParent = 10,
118 Frame = 11,
119 Border = 12,
122};
123
124// Flags for setPosSizePixel()
125// These must match the definitions in css::awt::PosSize
126enum class PosSizeFlags
127{
128 NONE = 0x0000,
129 X = 0x0001,
130 Y = 0x0002,
131 Width = 0x0004,
132 Height = 0x0008,
133 Pos = X | Y,
134 Size = Width | Height,
135 PosSize = Pos | Size,
136 All = PosSize,
137};
138
139namespace o3tl
140{
141 template<> struct typed_flags<PosSizeFlags> : is_typed_flags<PosSizeFlags, 0x000f> {};
142}
143
144// Flags for SetZOrder()
145enum class ZOrderFlags
146{
147 NONE = 0x0000,
148 Before = 0x0001,
149 Behind = 0x0002,
150 First = 0x0004,
151 Last = 0x0008,
152};
153namespace o3tl
154{
155 template<> struct typed_flags<ZOrderFlags> : is_typed_flags<ZOrderFlags, 0x000f> {};
156}
157
158// Activate-Flags
160{
161 NONE = 0,
162 GrabFocus = 0x0001,
163};
164namespace o3tl
165{
166 template<> struct typed_flags<ActivateModeFlags> : is_typed_flags<ActivateModeFlags, 0x0001> {};
167}
168
169// ToTop-Flags
170enum class ToTopFlags
171{
172 NONE = 0x0000,
173 RestoreWhenMin = 0x0001,
174 ForegroundTask = 0x0002,
175 NoGrabFocus = 0x0004,
176 GrabFocusOnly = 0x0008,
177};
178namespace o3tl
179{
180 template<> struct typed_flags<ToTopFlags> : is_typed_flags<ToTopFlags, 0x000f> {};
181}
182
183// Flags for Invalidate
184// must match css::awt::InvalidateStyle
186{
187 NONE = 0x0000,
189 Children = 0x0001,
191 NoChildren = 0x0002,
193 NoErase = 0x0004,
195 Update = 0x0008,
197 Transparent = 0x0010,
199 NoTransparent = 0x0020,
201 NoClipChildren = 0x4000,
202};
203namespace o3tl
204{
205 template<> struct typed_flags<InvalidateFlags> : is_typed_flags<InvalidateFlags, 0x403f> {};
206}
207
208// Flags for Validate
210{
211 NONE = 0x0000,
212 Children = 0x0001,
213 NoChildren = 0x0002
214};
215namespace o3tl
216{
217 template<> struct typed_flags<ValidateFlags> : is_typed_flags<ValidateFlags, 0x0003> {};
218}
219
220// Flags for Scroll
221enum class ScrollFlags
222{
223 NONE = 0x0000,
224 Clip = 0x0001,
225 Children = 0x0002,
226 NoChildren = 0x0004,
227 UseClipRegion = 0x0008,
228 Update = 0x0010,
229};
230namespace o3tl
231{
232 template<> struct typed_flags<ScrollFlags> : is_typed_flags<ScrollFlags, 0x001f> {};
233}
234
235// Flags for ParentClipMode
237{
238 NONE = 0x0000,
239 Clip = 0x0001,
240 NoClip = 0x0002,
241};
242namespace o3tl
243{
244 template<> struct typed_flags<ParentClipMode> : is_typed_flags<ParentClipMode, 0x0003> {};
245}
246
247// Flags for ShowTracking()
248enum class ShowTrackFlags {
249 NONE = 0x0000,
250 Small = 0x0001,
251 Big = 0x0002,
252 Split = 0x0003,
253 Object = 0x0004,
254 StyleMask = 0x000F,
255 TrackWindow = 0x1000,
256 Clip = 0x2000,
257};
258namespace o3tl
259{
260 template<> struct typed_flags<ShowTrackFlags> : is_typed_flags<ShowTrackFlags, 0x300f> {};
261}
262
263// Flags for StartTracking()
265{
266 NONE = 0x0001,
267 KeyMod = 0x0002,
268 ScrollRepeat = 0x0004,
269 ButtonRepeat = 0x0008,
270};
271
272namespace o3tl
273{
274 template<> struct typed_flags<StartTrackingFlags> : is_typed_flags<StartTrackingFlags, 0x000f> {};
275}
276
277// Flags for StartAutoScroll()
279{
280 NONE = 0x0000,
281 Vert = 0x0001,
282 Horz = 0x0002,
283};
284namespace o3tl
285{
286 template<> struct typed_flags<StartAutoScrollFlags> : is_typed_flags<StartAutoScrollFlags, 0x0003> {};
287}
288
289// Flags for StateChanged()
290enum class StateChangedType : sal_uInt16
291{
292 InitShow = 1,
293 Visible = 2,
294 UpdateMode = 3,
295 Enable = 4,
296 Text = 5,
297 Data = 7,
298 State = 8,
299 Style = 9,
300 Zoom = 10,
301 ControlFont = 13,
304 ReadOnly = 16,
305 Mirroring = 18,
306 Layout = 19,
307 ControlFocus = 20
308};
309
310// GetFocusFlags
311// must match constants in css:awt::FocusChangeReason
313{
314 NONE = 0x0000,
315 Tab = 0x0001,
316 CURSOR = 0x0002, // avoid name-clash with X11 #define
317 Mnemonic = 0x0004,
318 F6 = 0x0008,
319 Forward = 0x0010,
320 Backward = 0x0020,
321 Around = 0x0040,
322 UniqueMnemonic = 0x0100,
323 Init = 0x0200,
325};
326namespace o3tl
327{
328 template<> struct typed_flags<GetFocusFlags> : is_typed_flags<GetFocusFlags, 0x077f> {};
329}
330
331// DialogControl-Flags
333{
334 NONE = 0x0000,
335 Return = 0x0001,
336 WantFocus = 0x0002,
338};
339namespace o3tl
340{
341 template<> struct typed_flags<DialogControlFlags> : is_typed_flags<DialogControlFlags, 0x0007> {};
342}
343
344// EndExtTextInput() Flags
346{
347 NONE = 0x0000,
348 Complete = 0x0001
349};
350namespace o3tl
351{
352 template<> struct typed_flags<EndExtTextInputFlags> : is_typed_flags<EndExtTextInputFlags, 0x0001> {};
353}
354
355#define IMPL_MINSIZE_BUTTON_WIDTH 70
356#define IMPL_MINSIZE_BUTTON_HEIGHT 22
357#define IMPL_EXTRA_BUTTON_WIDTH 18
358#define IMPL_EXTRA_BUTTON_HEIGHT 10
359#define IMPL_SEP_BUTTON_X 5
360#define IMPL_SEP_BUTTON_Y 5
361#define IMPL_MINSIZE_MSGBOX_WIDTH 150
362#define IMPL_DIALOG_OFFSET 5
363#define IMPL_DIALOG_BAR_OFFSET 3
364#define IMPL_MSGBOX_OFFSET_EXTRA_X 0
365#define IMPL_MSGBOX_OFFSET_EXTRA_Y 2
366#define IMPL_SEP_MSGBOX_IMAGE 8
367
368// ImplGetDlgWindow()
370{
371 Prev, Next, First
372};
373
374
375#ifdef DBG_UTIL
376const char* ImplDbgCheckWindow( const void* pObj );
377#endif
378
379namespace vcl { class Window; }
380namespace vcl { class Cursor; }
381namespace vcl { class WindowOutputDevice; }
382class Dialog;
383class Edit;
384class WindowImpl;
385class PaintHelper;
386class VclSizeGroup;
387class Application;
388class WorkWindow;
389class MessBox;
390class MessageDialog;
391class DockingWindow;
392class FloatingWindow;
393class GroupBox;
394class PushButton;
395class RadioButton;
400class LifecycleTest;
401
402
403enum class WindowHitTest {
404 NONE = 0x0000,
405 Inside = 0x0001,
406 Transparent = 0x0002
407};
408namespace o3tl {
409 template<> struct typed_flags<WindowHitTest> : is_typed_flags<WindowHitTest, 0x0003> {};
410};
411
412
414 NONE = 0x0000,
415 Document = 0x0001,
416 DocModified = 0x0002,
421 DocHidden = 0x0004,
422};
423namespace o3tl {
424 template<> struct typed_flags<WindowExtendedStyle> : is_typed_flags<WindowExtendedStyle, 0x0007> {};
425};
426
427namespace vcl {
428
430{
431public:
432 // transparent background for selected or checked items in toolboxes etc.
433 // + selection Color with a text color complementing the selection background
434 // + rounded edge
435 static void DrawSelectionBackground(vcl::RenderContext& rRenderContext, vcl::Window const & rWindow,
436 const tools::Rectangle& rRect, sal_uInt16 nHighlight,
437 bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly,
438 Color* pSelectionTextColor = nullptr, tools::Long nCornerRadius = 0,
439 Color const * pPaintColor = nullptr);
440};
441
443{
444 friend class ::vcl::Cursor;
445 friend class ::vcl::WindowOutputDevice;
446 friend class ::OutputDevice;
447 friend class ::Application;
448 friend class ::SystemWindow;
449 friend class ::WorkWindow;
450 friend class ::Dialog;
451 friend class ::Edit;
452 friend class ::MessBox;
453 friend class ::MessageDialog;
454 friend class ::DockingWindow;
455 friend class ::FloatingWindow;
456 friend class ::GroupBox;
457 friend class ::PushButton;
458 friend class ::RadioButton;
459 friend class ::SalInstanceWidget;
460 friend class ::SystemChildWindow;
461 friend class ::ImplBorderWindow;
462 friend class ::PaintHelper;
463 friend class ::LifecycleTest;
464 friend class ::VclEventListeners;
465
466 // TODO: improve missing functionality
467 // only required because of SetFloatingMode()
468 friend class ::ImplDockingWindowWrapper;
469 friend class ::ImplPopupFloatWin;
470 friend class ::MenuFloatingWindow;
471
472 friend class ::svt::PopupWindowControllerImpl;
473
474private:
475 // NOTE: to remove many dependencies of other modules
476 // to this central file, all members are now hidden
477 // in the WindowImpl class and all inline functions
478 // were removed.
479 // (WindowImpl is a pImpl pattern)
480
481 // Please do *not* add new members or inline functions to class Window,
482 // but use class WindowImpl instead
483
484 std::unique_ptr<WindowImpl> mpWindowImpl;
485
486#ifdef DBG_UTIL
487 friend const char* ::ImplDbgCheckWindow( const void* pObj );
488#endif
489
490public:
491
492 DECL_DLLPRIVATE_LINK( ImplHandlePaintHdl, Timer*, void );
493 DECL_DLLPRIVATE_LINK( ImplGenerateMouseMoveHdl, void*, void );
494 DECL_DLLPRIVATE_LINK( ImplTrackTimerHdl, Timer*, void );
495 DECL_DLLPRIVATE_LINK( ImplAsyncFocusHdl, void*, void );
496 DECL_DLLPRIVATE_LINK( ImplHandleResizeTimerHdl, Timer*, void );
497
498
499 SAL_DLLPRIVATE static void ImplInitAppFontData( vcl::Window const * pWindow );
500
501 SAL_DLLPRIVATE vcl::Window* ImplGetFrameWindow() const;
502 weld::Window* GetFrameWeld() const;
503 vcl::Window* GetFrameWindow() const;
504 SalFrame* ImplGetFrame() const;
505 SAL_DLLPRIVATE ImplFrameData* ImplGetFrameData();
506
507 vcl::Window* ImplGetWindow() const;
508 SAL_DLLPRIVATE ImplWinData* ImplGetWinData() const;
509 SAL_DLLPRIVATE vcl::Window* ImplGetClientWindow() const;
510 SAL_DLLPRIVATE vcl::Window* ImplGetDlgWindow( sal_uInt16 n, GetDlgWindowType nType, sal_uInt16 nStart = 0, sal_uInt16 nEnd = 0xFFFF, sal_uInt16* pIndex = nullptr );
511 SAL_DLLPRIVATE vcl::Window* ImplGetParent() const;
512 SAL_DLLPRIVATE vcl::Window* ImplFindWindow( const Point& rFramePos );
513
514 SAL_DLLPRIVATE void ImplInvalidateFrameRegion( const vcl::Region* pRegion, InvalidateFlags nFlags );
515 SAL_DLLPRIVATE void ImplInvalidateOverlapFrameRegion( const vcl::Region& rRegion );
516
517 SAL_DLLPRIVATE bool ImplSetClipFlag( bool bSysObjOnlySmaller = false );
518
519 SAL_DLLPRIVATE bool ImplIsWindowOrChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
520 SAL_DLLPRIVATE bool ImplIsChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
521 SAL_DLLPRIVATE bool ImplIsFloatingWindow() const;
522 SAL_DLLPRIVATE bool ImplIsPushButton() const;
523 SAL_DLLPRIVATE bool ImplIsSplitter() const;
524 SAL_DLLPRIVATE bool ImplIsOverlapWindow() const;
525
526 SAL_DLLPRIVATE void ImplIsInTaskPaneList( bool mbIsInTaskList );
527
528 SAL_DLLPRIVATE WindowImpl* ImplGetWindowImpl() const { return mpWindowImpl.get(); }
529
530 SAL_DLLPRIVATE void ImplGrabFocus( GetFocusFlags nFlags );
531 SAL_DLLPRIVATE void ImplGrabFocusToDocument( GetFocusFlags nFlags );
532 SAL_DLLPRIVATE void ImplInvertFocus( const tools::Rectangle& rRect );
533
534 SAL_DLLPRIVATE PointerStyle ImplGetMousePointer() const;
535 SAL_DLLPRIVATE void ImplCallMouseMove( sal_uInt16 nMouseCode, bool bModChanged = false );
536 SAL_DLLPRIVATE void ImplGenerateMouseMove();
537
538 SAL_DLLPRIVATE void ImplNotifyKeyMouseCommandEventListeners( NotifyEvent& rNEvt );
539 SAL_DLLPRIVATE void ImplNotifyIconifiedState( bool bIconified );
540
541 SAL_DLLPRIVATE void ImplUpdateAll();
542
543 SAL_DLLPRIVATE void ImplControlFocus( GetFocusFlags nFlags = GetFocusFlags::NONE );
544
545 SAL_DLLPRIVATE void ImplMirrorFramePos( Point &pt ) const;
546
547 SAL_DLLPRIVATE void ImplPosSizeWindow( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags );
548
549 SAL_DLLPRIVATE void ImplCallResize();
550 SAL_DLLPRIVATE void ImplCallMove();
551
552 // These methods call the relevant virtual method when not in/post dispose
553 SAL_DLLPRIVATE void CompatGetFocus();
554 SAL_DLLPRIVATE void CompatLoseFocus();
555 SAL_DLLPRIVATE void CompatStateChanged( StateChangedType nStateChange );
556 SAL_DLLPRIVATE void CompatDataChanged( const DataChangedEvent& rDCEvt );
557 SAL_DLLPRIVATE bool CompatPreNotify( NotifyEvent& rNEvt );
558 SAL_DLLPRIVATE bool CompatNotify( NotifyEvent& rNEvt );
559
560 void IncModalCount();
561 void DecModalCount();
562
563 SAL_DLLPRIVATE static void ImplCalcSymbolRect( tools::Rectangle& rRect );
564
565protected:
566
568 virtual void dispose() override;
569
570 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData );
571
572 SAL_DLLPRIVATE void ImplInvalidateParentFrameRegion( const vcl::Region& rRegion );
573 SAL_DLLPRIVATE void ImplValidateFrameRegion( const vcl::Region* rRegion, ValidateFlags nFlags );
574 SAL_DLLPRIVATE void ImplValidate();
575 SAL_DLLPRIVATE void ImplMoveInvalidateRegion( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren );
576 SAL_DLLPRIVATE void ImplMoveAllInvalidateRegions( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren );
577
578 SAL_DLLPRIVATE vcl::Window* ImplGetBorderWindow() const;
579
580 virtual void ImplInvalidate( const vcl::Region* pRegion, InvalidateFlags nFlags );
581
582 virtual WindowHitTest ImplHitTest( const Point& rFramePos );
583
584 SAL_DLLPRIVATE void ImplSetMouseTransparent( bool bTransparent );
585
586 SAL_DLLPRIVATE void ImplScroll( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags );
587
588 SAL_DLLPRIVATE bool ImplSetClipFlagChildren( bool bSysObjOnlySmaller );
589 SAL_DLLPRIVATE bool ImplSetClipFlagOverlapWindows( bool bSysObjOnlySmaller = false );
590
591 SAL_DLLPRIVATE void PushPaintHelper(PaintHelper* pHelper, vcl::RenderContext& rRenderContext);
592 SAL_DLLPRIVATE void PopPaintHelper(PaintHelper const * pHelper);
593
594private:
595
596 SAL_DLLPRIVATE void ImplSetFrameParent( const vcl::Window* pParent );
597
598 SAL_DLLPRIVATE void ImplInsertWindow( vcl::Window* pParent );
599 SAL_DLLPRIVATE void ImplRemoveWindow( bool bRemoveFrameData );
600
601 SAL_DLLPRIVATE SalGraphics* ImplGetFrameGraphics() const;
602
603 SAL_DLLPRIVATE static void ImplCallFocusChangeActivate( vcl::Window* pNewOverlapWindow, vcl::Window* pOldOverlapWindow );
604 SAL_DLLPRIVATE vcl::Window* ImplGetFirstOverlapWindow();
605 SAL_DLLPRIVATE const vcl::Window* ImplGetFirstOverlapWindow() const;
606
607 SAL_DLLPRIVATE bool ImplIsRealParentPath( const vcl::Window* pWindow ) const;
608
609 SAL_DLLPRIVATE bool ImplTestMousePointerSet();
610
611 SAL_DLLPRIVATE void ImplResetReallyVisible();
612 SAL_DLLPRIVATE void ImplSetReallyVisible();
613
614 SAL_DLLPRIVATE void ImplCallInitShow();
615
616 SAL_DLLPRIVATE void ImplInitResolutionSettings();
617
618 SAL_DLLPRIVATE void ImplPointToLogic(vcl::RenderContext const & rRenderContext, vcl::Font& rFont) const;
619 SAL_DLLPRIVATE void ImplLogicToPoint(vcl::RenderContext const & rRenderContext, vcl::Font& rFont) const;
620
621 SAL_DLLPRIVATE bool ImplSysObjClip( const vcl::Region* pOldRegion );
622 SAL_DLLPRIVATE void ImplUpdateSysObjChildrenClip();
623 SAL_DLLPRIVATE void ImplUpdateSysObjOverlapsClip();
624 SAL_DLLPRIVATE void ImplUpdateSysObjClip();
625
626 SAL_DLLPRIVATE void ImplIntersectWindowClipRegion( vcl::Region& rRegion );
627 SAL_DLLPRIVATE void ImplIntersectWindowRegion( vcl::Region& rRegion );
628 SAL_DLLPRIVATE void ImplExcludeWindowRegion( vcl::Region& rRegion );
629 SAL_DLLPRIVATE void ImplExcludeOverlapWindows( vcl::Region& rRegion ) const;
630 SAL_DLLPRIVATE void ImplExcludeOverlapWindows2( vcl::Region& rRegion );
631
632 SAL_DLLPRIVATE void ImplClipBoundaries( vcl::Region& rRegion, bool bThis, bool bOverlaps );
633 SAL_DLLPRIVATE bool ImplClipChildren( vcl::Region& rRegion ) const;
634 SAL_DLLPRIVATE void ImplClipAllChildren( vcl::Region& rRegion ) const;
635 SAL_DLLPRIVATE void ImplClipSiblings( vcl::Region& rRegion ) const;
636
637 SAL_DLLPRIVATE void ImplInitWinClipRegion();
638 SAL_DLLPRIVATE void ImplInitWinChildClipRegion();
639 SAL_DLLPRIVATE vcl::Region& ImplGetWinChildClipRegion();
640
641 SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows( const vcl::Region& rInterRegion, vcl::Region& rRegion ) const;
642 SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows2( const vcl::Region& rInterRegion, vcl::Region& rRegion );
643 SAL_DLLPRIVATE void ImplCalcOverlapRegionOverlaps( const vcl::Region& rInterRegion, vcl::Region& rRegion ) const;
644 SAL_DLLPRIVATE void ImplCalcOverlapRegion( const tools::Rectangle& rSourceRect, vcl::Region& rRegion,
645 bool bChildren, bool bSiblings );
646
653 SAL_DLLPRIVATE void ImplCallPaint(const vcl::Region* pRegion, ImplPaintFlags nPaintFlags);
654
655 SAL_DLLPRIVATE void ImplCallOverlapPaint();
656
657 SAL_DLLPRIVATE void ImplUpdateWindowPtr( vcl::Window* pWindow );
658 SAL_DLLPRIVATE void ImplUpdateWindowPtr();
659 SAL_DLLPRIVATE void ImplUpdateOverlapWindowPtr( bool bNewFrame );
660
661 SAL_DLLPRIVATE bool ImplUpdatePos();
662 SAL_DLLPRIVATE void ImplUpdateSysObjPos();
663
664 SAL_DLLPRIVATE void ImplUpdateGlobalSettings( AllSettings& rSettings, bool bCallHdl = true ) const;
665
666 SAL_DLLPRIVATE void ImplToBottomChild();
667
668 SAL_DLLPRIVATE void ImplCalcToTop( ImplCalcToTopData* pPrevData );
669 SAL_DLLPRIVATE void ImplToTop( ToTopFlags nFlags );
670 SAL_DLLPRIVATE void ImplStartToTop( ToTopFlags nFlags );
671 SAL_DLLPRIVATE void ImplFocusToTop( ToTopFlags nFlags, bool bReallyVisible );
672
673 SAL_DLLPRIVATE void ImplShowAllOverlaps();
674 SAL_DLLPRIVATE void ImplHideAllOverlaps();
675
676 SAL_DLLPRIVATE bool ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput );
677 SAL_DLLPRIVATE bool ImplHasDlgCtrl() const;
678 SAL_DLLPRIVATE void ImplDlgCtrlNextWindow();
679 SAL_DLLPRIVATE void ImplDlgCtrlFocusChanged( vcl::Window* pWindow, bool bGetFocus );
680 SAL_DLLPRIVATE vcl::Window* ImplFindDlgCtrlWindow( vcl::Window* pWindow );
681
682 SAL_DLLPRIVATE static void ImplNewInputContext();
683
684 SAL_DLLPRIVATE void ImplCallActivateListeners(vcl::Window*);
685 SAL_DLLPRIVATE void ImplCallDeactivateListeners(vcl::Window*);
686
687 SAL_DLLPRIVATE static void ImplHandleScroll(Scrollable* pHScrl, double nX, Scrollable* pVScrl, double nY);
688
689 SAL_DLLPRIVATE tools::Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle& rRect ) const;
690 SAL_DLLPRIVATE tools::Rectangle ImplUnmirroredAbsoluteScreenToOutputPixel( const tools::Rectangle& rRect ) const;
691 SAL_DLLPRIVATE tools::Long ImplGetUnmirroredOutOffX() const;
692
693 // retrieves the list of owner draw decorated windows for this window hierarchy
694 SAL_DLLPRIVATE ::std::vector<VclPtr<vcl::Window> >& ImplGetOwnerDrawList();
695
696 SAL_DLLPRIVATE vcl::Window* ImplGetTopmostFrameWindow();
697
698 SAL_DLLPRIVATE bool ImplStopDnd();
699 SAL_DLLPRIVATE void ImplStartDnd();
700
701 virtual void ImplPaintToDevice( ::OutputDevice* pTargetOutDev, const Point& rPos );
702
703protected:
704 // Single argument ctors shall be explicit.
705 explicit Window( WindowType nType );
706
707 void SetCompoundControl( bool bCompound );
708
709 void CallEventListeners( VclEventId nEvent, void* pData = nullptr );
710
711 // FIXME: this is a hack to workaround missing layout functionality
712 virtual void ImplAdjustNWFSizes();
713
714 virtual void ApplySettings(vcl::RenderContext& rRenderContext);
715
716public:
717 // Single argument ctors shall be explicit.
718 explicit Window( vcl::Window* pParent, WinBits nStyle = 0 );
719
720 virtual ~Window() override;
721
722 ::OutputDevice const* GetOutDev() const;
723 ::OutputDevice* GetOutDev();
724
725 Color GetBackgroundColor() const;
726 const Wallpaper & GetBackground() const;
727 bool IsBackground() const;
728 const MapMode& GetMapMode() const;
729 void SetBackground();
730 void SetBackground( const Wallpaper& rBackground );
731
732 virtual void MouseMove( const MouseEvent& rMEvt );
733 virtual void MouseButtonDown( const MouseEvent& rMEvt );
734 virtual void MouseButtonUp( const MouseEvent& rMEvt );
735 virtual void KeyInput( const KeyEvent& rKEvt );
736 virtual void KeyUp( const KeyEvent& rKEvt );
737 virtual void PrePaint(vcl::RenderContext& rRenderContext);
738 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
739 virtual void PostPaint(vcl::RenderContext& rRenderContext);
740
741 void Erase(vcl::RenderContext& rRenderContext);
742
743 virtual void Draw( ::OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags );
744 virtual void Move();
745 virtual void Resize();
746 virtual void Activate();
747 virtual void Deactivate();
748 virtual void GetFocus();
749 virtual void LoseFocus();
750 virtual void RequestHelp( const HelpEvent& rHEvt );
751 virtual void Command( const CommandEvent& rCEvt );
752 virtual void Tracking( const TrackingEvent& rTEvt );
753 virtual void StateChanged( StateChangedType nStateChange );
754 virtual void DataChanged( const DataChangedEvent& rDCEvt );
755 virtual bool PreNotify( NotifyEvent& rNEvt );
756 virtual bool EventNotify( NotifyEvent& rNEvt );
757
758 void AddEventListener( const Link<VclWindowEvent&,void>& rEventListener );
759 void RemoveEventListener( const Link<VclWindowEvent&,void>& rEventListener );
760 void AddChildEventListener( const Link<VclWindowEvent&,void>& rEventListener );
761 void RemoveChildEventListener( const Link<VclWindowEvent&,void>& rEventListener );
762
763 ImplSVEvent * PostUserEvent( const Link<void*,void>& rLink, void* pCaller = nullptr, bool bReferenceLink = false );
764 void RemoveUserEvent( ImplSVEvent * nUserEvent );
765
766 // returns the input language used for the last key stroke
767 // may be LANGUAGE_DONTKNOW if not supported by the OS
768 LanguageType GetInputLanguage() const;
769
770 void SetStyle( WinBits nStyle );
771 WinBits GetStyle() const;
772 WinBits GetPrevStyle() const;
773 void SetExtendedStyle( WindowExtendedStyle nExtendedStyle );
774 WindowExtendedStyle GetExtendedStyle() const;
775 void SetType( WindowType nType );
776 WindowType GetType() const;
777 bool IsSystemWindow() const;
778 bool IsDockingWindow() const;
779 bool IsDialog() const;
780 bool IsMenuFloatingWindow() const;
781 bool IsToolbarFloatingWindow() const;
782 bool IsTopWindow() const;
783 SystemWindow* GetSystemWindow() const;
784
786 bool SupportsDoubleBuffering() const;
788 void RequestDoubleBuffering(bool bRequest);
789
790 void EnableAllResize();
791
792 void SetBorderStyle( WindowBorderStyle nBorderStyle );
793 WindowBorderStyle GetBorderStyle() const;
794 void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
795 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
796 Size CalcWindowSize( const Size& rOutSz ) const;
797 Size CalcOutputSize( const Size& rWinSz ) const;
798 tools::Long CalcTitleWidth() const;
799
800 void EnableClipSiblings( bool bClipSiblings = true );
801
802 void EnableChildTransparentMode( bool bEnable = true );
803 bool IsChildTransparentModeEnabled() const;
804
805 void SetMouseTransparent( bool bTransparent );
806 bool IsMouseTransparent() const;
807 void SetPaintTransparent( bool bTransparent );
808 bool IsPaintTransparent() const;
809 void SetDialogControlStart( bool bStart );
810 bool IsDialogControlStart() const;
811 void SetDialogControlFlags( DialogControlFlags nFlags );
812 DialogControlFlags GetDialogControlFlags() const;
813
815 {
816 sal_Int32 mnState; // the button state
817 Point maPos; // mouse position in output coordinates
818 };
819 PointerState GetPointerState();
820 bool IsMouseOver() const;
821
822 void SetInputContext( const InputContext& rInputContext );
823 const InputContext& GetInputContext() const;
824 void PostExtTextInputEvent(VclEventId nType, const OUString& rText);
825 void EndExtTextInput();
826 void SetCursorRect( const tools::Rectangle* pRect = nullptr, tools::Long nExtTextInputWidth = 0 );
827 const tools::Rectangle* GetCursorRect() const;
828 tools::Long GetCursorExtTextInputWidth() const;
829
830 void SetCompositionCharRect( const tools::Rectangle* pRect, tools::Long nCompositionLength, bool bVertical = false );
831
832 void UpdateSettings( const AllSettings& rSettings, bool bChild = false );
833 void NotifyAllChildren( DataChangedEvent& rDCEvt );
834
835 void SetPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont);
836 vcl::Font GetPointFont(vcl::RenderContext const & rRenderContext) const;
837 void SetZoomedPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont);
838 tools::Long GetDrawPixel( ::OutputDevice const * pDev, tools::Long nPixels ) const;
839 vcl::Font GetDrawPixelFont( ::OutputDevice const * pDev ) const;
840
841 void SetControlFont();
842 void SetControlFont( const vcl::Font& rFont );
843 vcl::Font GetControlFont() const;
844 bool IsControlFont() const;
845 void ApplyControlFont(vcl::RenderContext& rRenderContext, const vcl::Font& rDefaultFont);
846
847 void SetControlForeground();
848 void SetControlForeground(const Color& rColor);
849 const Color& GetControlForeground() const;
850 bool IsControlForeground() const;
851 void ApplyControlForeground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor);
852
853 void SetControlBackground();
854 void SetControlBackground( const Color& rColor );
855 const Color& GetControlBackground() const;
856 bool IsControlBackground() const;
857 void ApplyControlBackground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor);
858
859 void SetParentClipMode( ParentClipMode nMode = ParentClipMode::NONE );
860 ParentClipMode GetParentClipMode() const;
861
862 void SetWindowRegionPixel();
863 void SetWindowRegionPixel( const vcl::Region& rRegion );
864 vcl::Region GetWindowClipRegionPixel() const;
865 vcl::Region GetPaintRegion() const;
866 bool IsInPaint() const;
867 // while IsInPaint returns true ExpandPaintClipRegion adds the
868 // submitted region to the paint clip region so you can
869 // paint additional parts of your window if necessary
870 void ExpandPaintClipRegion( const vcl::Region& rRegion );
871
872 void SetParent( vcl::Window* pNewParent );
873 vcl::Window* GetParent() const;
874 // return the dialog we are contained in or NULL if un-contained
875 Dialog* GetParentDialog() const;
876 bool IsAncestorOf( const vcl::Window& rWindow ) const;
877
878 void Show( bool bVisible = true, ShowFlags nFlags = ShowFlags::NONE );
879 void Hide() { Show( false ); }
880 bool IsVisible() const;
881 bool IsReallyVisible() const;
882 bool IsReallyShown() const;
883 bool IsInInitShow() const;
884
885 void Enable( bool bEnable = true, bool bChild = true );
886 void Disable( bool bChild = true ) { Enable( false, bChild ); }
887 bool IsEnabled() const;
888
889 void EnableInput( bool bEnable = true, bool bChild = true );
890 void EnableInput( bool bEnable, const vcl::Window* pExcludeWindow );
891 bool IsInputEnabled() const;
892
902 void AlwaysEnableInput( bool bAlways, bool bChild = true );
903
908 bool IsAlwaysEnableInput() const;
909
915 bool IsInModalMode() const;
916
917 void SetActivateMode( ActivateModeFlags nMode );
918 ActivateModeFlags GetActivateMode() const;
919
920 void ToTop( ToTopFlags nFlags = ToTopFlags::NONE );
921 void SetZOrder( vcl::Window* pRefWindow, ZOrderFlags nFlags );
922 void EnableAlwaysOnTop( bool bEnable = true );
923 bool IsAlwaysOnTopEnabled() const;
924
925 virtual void setPosSizePixel( tools::Long nX, tools::Long nY,
926 tools::Long nWidth, tools::Long nHeight,
928 virtual void SetPosPixel( const Point& rNewPos );
929 virtual Point GetPosPixel() const;
930 virtual void SetSizePixel( const Size& rNewSize );
931 virtual Size GetSizePixel() const;
932 virtual void SetPosSizePixel( const Point& rNewPos,
933 const Size& rNewSize );
934 virtual void SetOutputSizePixel( const Size& rNewSize );
935 bool IsDefaultPos() const;
936 bool IsDefaultSize() const;
937 Point GetOffsetPixelFrom(const vcl::Window& rWindow) const;
938
939 // those conversion routines might deliver different results during UI mirroring
940 Point OutputToScreenPixel( const Point& rPos ) const;
941 Point ScreenToOutputPixel( const Point& rPos ) const;
942 // the normalized screen methods work independent from UI mirroring
943 Point OutputToNormalizedScreenPixel( const Point& rPos ) const;
944 Point NormalizedScreenToOutputPixel( const Point& rPos ) const;
945 Point OutputToAbsoluteScreenPixel( const Point& rPos ) const;
946 Point AbsoluteScreenToOutputPixel( const Point& rPos ) const;
947 tools::Rectangle GetDesktopRectPixel() const;
948 // window extents including border and decoration, relative to passed in window
949 tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) const;
950 // window extents including border and decoration, in absolute screen coordinates
951 tools::Rectangle GetWindowExtentsAbsolute() const;
952
953 bool IsScrollable() const;
954 virtual void Scroll( tools::Long nHorzScroll, tools::Long nVertScroll,
956 void Scroll( tools::Long nHorzScroll, tools::Long nVertScroll,
957 const tools::Rectangle& rRect, ScrollFlags nFlags = ScrollFlags::NONE );
958 void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE );
959 void Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE );
960 void Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags = InvalidateFlags::NONE );
967 virtual void LogicInvalidate(const tools::Rectangle* pRectangle);
968
975 virtual void PixelInvalidate(const tools::Rectangle* pRectangle);
976 void Validate();
977 bool HasPaintEvent() const;
978 void PaintImmediately();
979
980 // toggles new docking support, enabled via toolkit
981 void EnableDocking( bool bEnable = true );
982 // retrieves the single dockingmanager instance
983 static DockingManager* GetDockingManager();
984
985 void EnablePaint( bool bEnable );
986 bool IsPaintEnabled() const;
987 void SetUpdateMode( bool bUpdate );
988 bool IsUpdateMode() const;
989 void SetParentUpdateMode( bool bUpdate );
990
991 void GrabFocus();
992 bool HasFocus() const;
993 bool HasChildPathFocus( bool bSystemWindow = false ) const;
994 bool IsActive() const;
995 bool HasActiveChildFrame() const;
996 GetFocusFlags GetGetFocusFlags() const;
997 void GrabFocusToDocument();
998 VclPtr<vcl::Window> GetFocusedWindow() const;
999
1005 void SetFakeFocus( bool bFocus );
1006
1007 bool IsCompoundControl() const;
1008
1009 static VclPtr<vcl::Window> SaveFocus();
1010 static void EndSaveFocus(const VclPtr<vcl::Window>& xFocusWin);
1011
1012 void LocalStartDrag();
1013 void CaptureMouse();
1014 void ReleaseMouse();
1015 bool IsMouseCaptured() const;
1016
1017 virtual void SetPointer( PointerStyle );
1018 PointerStyle GetPointer() const;
1019 void EnableChildPointerOverwrite( bool bOverwrite );
1020 void SetPointerPosPixel( const Point& rPos );
1021 Point GetPointerPosPixel();
1022 Point GetLastPointerPosPixel();
1024 void SetLastMousePos(const Point& rPos);
1025 void ShowPointer( bool bVisible );
1026 void EnterWait();
1027 void LeaveWait();
1028 bool IsWait() const;
1029
1030 void SetCursor( vcl::Cursor* pCursor );
1031 vcl::Cursor* GetCursor() const;
1032
1033 void SetZoom( const Fraction& rZoom );
1034 const Fraction& GetZoom() const;
1035 bool IsZoom() const;
1036 tools::Long CalcZoom( tools::Long n ) const;
1037
1038 virtual void SetText( const OUString& rStr );
1039 virtual OUString GetText() const;
1040 // return the actual text displayed
1041 // this may have e.g. accelerators removed or portions
1042 // replaced by ellipses
1043 virtual OUString GetDisplayText() const;
1044 // gets the visible background color. for transparent windows
1045 // this may be the parent's background color; for controls
1046 // this may be a child's background color (e.g. ListBox)
1047 virtual const Wallpaper& GetDisplayBackground() const;
1048
1049 void SetHelpText( const OUString& rHelpText );
1050 const OUString& GetHelpText() const;
1051
1052 void SetQuickHelpText( const OUString& rHelpText );
1053 const OUString& GetQuickHelpText() const;
1054
1055 void SetHelpId( const OUString& );
1056 const OUString& GetHelpId() const;
1057
1058 sal_uInt16 GetChildCount() const;
1059 vcl::Window* GetChild( sal_uInt16 nChild ) const;
1060 vcl::Window* GetWindow( GetWindowType nType ) const;
1061 bool IsChild( const vcl::Window* pWindow ) const;
1062 bool IsWindowOrChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
1063
1065 SAL_DLLPRIVATE void CollectChildren(::std::vector<vcl::Window *>& rAllChildren );
1066
1067 virtual void ShowFocus(const tools::Rectangle& rRect);
1068 void HideFocus();
1069
1070 // transparent background for selected or checked items in toolboxes etc.
1071 void DrawSelectionBackground( const tools::Rectangle& rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder );
1072
1073 void ShowTracking( const tools::Rectangle& rRect,
1075 void HideTracking();
1076 void InvertTracking( const tools::Rectangle& rRect, ShowTrackFlags nFlags );
1077
1078 void StartTracking( StartTrackingFlags nFlags = StartTrackingFlags::NONE );
1079 void EndTracking( TrackingEventFlags nFlags = TrackingEventFlags::NONE );
1080 bool IsTracking() const;
1081
1083 void EndAutoScroll();
1084
1085 bool HandleScrollCommand( const CommandEvent& rCmd,
1086 Scrollable* pHScrl,
1087 Scrollable* pVScrl );
1088
1089 virtual const SystemEnvData* GetSystemData() const;
1090
1091 // API to set/query the component interfaces
1092 virtual css::uno::Reference< css::awt::XVclWindowPeer >
1093 GetComponentInterface( bool bCreate = true );
1094
1095 void SetComponentInterface( css::uno::Reference< css::awt::XVclWindowPeer > const & xIFace );
1096
1097 void SetUseFrameData(bool bUseFrameData);
1098
1100 void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier, bool bParent = false);
1101 const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() const;
1102 vcl::LOKWindowId GetLOKWindowId() const;
1103
1105 VclPtr<vcl::Window> GetParentWithLOKNotifier();
1106
1108 void ReleaseLOKNotifier();
1109
1111 static VclPtr<vcl::Window> FindLOKWindow(vcl::LOKWindowId nWindowId);
1112
1114 static bool IsLOKWindowsEmpty();
1115
1117 virtual void DumpAsPropertyTree(tools::JsonWriter&);
1118
1122public:
1123
1124 css::uno::Reference< css::accessibility::XAccessible >
1125 GetAccessible( bool bCreate = true );
1126
1127 virtual css::uno::Reference< css::accessibility::XAccessible >
1128 CreateAccessible();
1129
1130 void SetAccessible( const css::uno::Reference< css::accessibility::XAccessible >& );
1131
1132 vcl::Window* GetAccessibleParentWindow() const;
1133 sal_uInt16 GetAccessibleChildWindowCount();
1134 vcl::Window* GetAccessibleChildWindow( sal_uInt16 n );
1135
1136 void SetAccessibleRole( sal_uInt16 nRole );
1137 sal_uInt16 GetAccessibleRole() const;
1138
1139 void SetAccessibleName( const OUString& rName );
1140 OUString GetAccessibleName() const;
1141
1142 void SetAccessibleDescription( const OUString& rDescr );
1143 OUString GetAccessibleDescription() const;
1144
1145 void SetAccessibleRelationLabeledBy( vcl::Window* pLabeledBy );
1146 vcl::Window* GetAccessibleRelationLabeledBy() const;
1147
1148 void SetAccessibleRelationLabelFor( vcl::Window* pLabelFor );
1149 vcl::Window* GetAccessibleRelationLabelFor() const;
1150
1151 vcl::Window* GetAccessibleRelationMemberOf() const;
1152
1153 // to avoid sending accessibility events in cases like closing dialogs
1154 // by default checks complete parent path
1155 bool IsAccessibilityEventsSuppressed( bool bTraverseParentPath = true );
1156 void SetAccessibilityEventsSuppressed(bool bSuppressed);
1157
1158 KeyEvent GetActivationKey() const;
1159
1160protected:
1161
1162 // These eventually are supposed to go when everything is converted to .ui
1163 SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationMemberOf() const;
1164 SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabeledBy() const;
1165 SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabelFor() const;
1166
1167 // Let Label override the code part of GetAccessibleRelationLabelFor
1168 virtual vcl::Window* getAccessibleRelationLabelFor() const;
1169 virtual sal_uInt16 getDefaultAccessibleRole() const;
1170 virtual OUString getDefaultAccessibleName() const;
1171
1172 /*
1173 * Advisory Sizing - what is a good size for this widget
1174 *
1175 * Retrieves the preferred size of a widget ignoring
1176 * "width-request" and "height-request" properties.
1177 *
1178 * Implement this in sub-classes to tell layout
1179 * the preferred widget size.
1180 *
1181 * Use get_preferred_size to retrieve this value
1182 * cached and mediated via height and width requests
1183 */
1184 virtual Size GetOptimalSize() const;
1186 void InvalidateSizeCache();
1187private:
1188
1189 SAL_DLLPRIVATE bool ImplIsAccessibleCandidate() const;
1190 SAL_DLLPRIVATE bool ImplIsAccessibleNativeFrame() const;
1192
1193 /*
1194 * Retrieves the preferred size of a widget taking
1195 * into account the "width-request" and "height-request" properties.
1196 *
1197 * Overrides the result of GetOptimalSize to honor the
1198 * width-request and height-request properties.
1199 *
1200 * So the same as get_ungrouped_preferred_size except
1201 * it ignores groups. A building block of get_preferred_size
1202 * that access the size cache
1203 *
1204 * @see get_preferred_size
1205 */
1206 Size get_ungrouped_preferred_size() const;
1207public:
1208 /* records all DrawText operations within the passed rectangle;
1209 * a synchronous paint is sent to achieve this
1210 */
1211 void RecordLayoutData( vcl::ControlLayoutData* pLayout, const tools::Rectangle& rRect );
1212
1213 // set and retrieve for Toolkit
1214 VCLXWindow* GetWindowPeer() const;
1215 void SetWindowPeer( css::uno::Reference< css::awt::XVclWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow );
1216
1217 // remember if it was generated by Toolkit
1218 bool IsCreatedWithToolkit() const;
1219 void SetCreatedWithToolkit( bool b );
1220
1221 // Drag and Drop interfaces
1222 css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget();
1223 css::uno::Reference< css::datatransfer::dnd::XDragSource > GetDragSource();
1224 css::uno::Reference< css::datatransfer::dnd::XDragGestureRecognizer > GetDragGestureRecognizer();
1225
1226 // Clipboard/Selection interfaces
1227 css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard();
1229 void SetClipboard(css::uno::Reference<css::datatransfer::clipboard::XClipboard> const & xClipboard);
1230
1231 /*
1232 * Widgets call this to inform their owner container that the widget wants
1233 * to renegotiate its size. Should be called when a widget has a new size
1234 * request. e.g. a FixedText Control gets a new label.
1235 *
1236 * akin to gtk_widget_queue_resize
1237 */
1238 virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout);
1239
1240 /*
1241 * Sets the "height-request" property
1242 *
1243 * Override for height request of the widget, or -1 if natural request
1244 * should be used.
1245 *
1246 * @see get_preferred_size, set_width_request
1247 */
1248 void set_height_request(sal_Int32 nHeightRequest);
1249 sal_Int32 get_height_request() const;
1250
1251 /*
1252 * Sets the "width-request" property
1253 *
1254 * Override for width request of the widget, or -1 if natural request
1255 * should be used.
1256 *
1257 * @see get_preferred_size, set_height_request
1258 */
1259 void set_width_request(sal_Int32 nWidthRequest);
1260 sal_Int32 get_width_request() const;
1261
1262 /*
1263 * Retrieves the preferred size of a widget taking
1264 * into account the "width-request" and "height-request" properties.
1265 *
1266 * Overrides the result of GetOptimalSize to honor the
1267 * width-request and height-request properties.
1268 *
1269 * @see GetOptimalSize
1270 *
1271 * akin to gtk_widget_get_preferred_size
1272 */
1273 Size get_preferred_size() const;
1274
1275 /*
1276 * How to horizontally align this widget
1277 */
1278 VclAlign get_halign() const;
1279 void set_halign(VclAlign eAlign);
1280
1281 /*
1282 * How to vertically align this widget
1283 */
1284 VclAlign get_valign() const;
1285 void set_valign(VclAlign eAlign);
1286
1287 /*
1288 * Whether the widget would like to use any available extra horizontal
1289 * space.
1290 */
1291 bool get_hexpand() const;
1292 void set_hexpand(bool bExpand);
1293
1294 /*
1295 * Whether the widget would like to use any available extra vertical
1296 * space.
1297 */
1298 bool get_vexpand() const;
1299 void set_vexpand(bool bExpand);
1300
1301 /*
1302 * Whether the widget would like to use any available extra space.
1303 */
1304 bool get_expand() const;
1305 void set_expand(bool bExpand);
1306
1307 /*
1308 * Whether the widget should receive extra space when the parent grows
1309 */
1310 bool get_fill() const;
1311 void set_fill(bool bFill);
1312
1313 void set_border_width(sal_Int32 nBorderWidth);
1314 sal_Int32 get_border_width() const;
1315
1316 void set_margin_start(sal_Int32 nWidth);
1317 sal_Int32 get_margin_start() const;
1318
1319 void set_margin_end(sal_Int32 nWidth);
1320 sal_Int32 get_margin_end() const;
1321
1322 void set_margin_top(sal_Int32 nWidth);
1323 sal_Int32 get_margin_top() const;
1324
1325 void set_margin_bottom(sal_Int32 nWidth);
1326 sal_Int32 get_margin_bottom() const;
1327
1328 /*
1329 * How the widget is packed with reference to the start or end of the parent
1330 */
1331 VclPackType get_pack_type() const;
1332 void set_pack_type(VclPackType ePackType);
1333
1334 /*
1335 * The extra space to put between the widget and its neighbors
1336 */
1337 sal_Int32 get_padding() const;
1338 void set_padding(sal_Int32 nPadding);
1339
1340 /*
1341 * The number of columns that the widget spans
1342 */
1343 sal_Int32 get_grid_width() const;
1344 void set_grid_width(sal_Int32 nCols);
1345
1346 /*
1347 * The column number to attach the left side of the widget to
1348 */
1349 sal_Int32 get_grid_left_attach() const;
1350 void set_grid_left_attach(sal_Int32 nAttach);
1351
1352 /*
1353 * The number of row that the widget spans
1354 */
1355 sal_Int32 get_grid_height() const;
1356 void set_grid_height(sal_Int32 nRows);
1357
1358 /*
1359 * The row number to attach the top side of the widget to
1360 */
1361 sal_Int32 get_grid_top_attach() const;
1362 void set_grid_top_attach(sal_Int32 nAttach);
1363
1364 /*
1365 * If true this child appears in a secondary layout group of children
1366 * e.g. help buttons in a buttonbox
1367 */
1368 bool get_secondary() const;
1369 void set_secondary(bool bSecondary);
1370
1371 /*
1372 * If true this child is exempted from homogeneous sizing
1373 * e.g. special button in a buttonbox
1374 */
1375 bool get_non_homogeneous() const;
1376 void set_non_homogeneous(bool bNonHomogeneous);
1377
1378 /*
1379 * Sets a widget property
1380 *
1381 * @return false if property is unknown
1382 */
1383 virtual bool set_property(const OUString &rKey, const OUString &rValue);
1384
1385 /*
1386 * Sets a font attribute
1387 *
1388 * @return false if attribute is unknown
1389 */
1390 bool set_font_attribute(const OUString &rKey, std::u16string_view rValue);
1391
1392 /*
1393 * Adds this widget to the xGroup VclSizeGroup
1394 *
1395 */
1396 void add_to_size_group(const std::shared_ptr<VclSizeGroup>& xGroup);
1397 void remove_from_all_size_groups();
1398
1399 /*
1400 * add/remove mnemonic label
1401 */
1402 void add_mnemonic_label(FixedText *pLabel);
1403 void remove_mnemonic_label(FixedText *pLabel);
1404 const std::vector<VclPtr<FixedText> >& list_mnemonic_labels() const;
1405
1406 /*
1407 * Move this widget to be the nNewPosition'd child of its parent
1408 */
1409 void reorderWithinParent(sal_uInt16 nNewPosition);
1410
1414 void set_id(const OUString& rID);
1415
1419 const OUString& get_id() const;
1420
1421
1422 // Native Widget Rendering functions
1423
1424
1425 // form controls must never use native widgets, this can be toggled here
1426 void EnableNativeWidget( bool bEnable = true );
1427 bool IsNativeWidgetEnabled() const;
1428
1429 // a helper method for a Control's Draw method
1430 void PaintToDevice( ::OutputDevice* pDevice, const Point& rPos );
1431
1432 // Keyboard access functions
1433
1442 KeyIndicatorState GetIndicatorState() const;
1443
1444 void SimulateKeyPress( sal_uInt16 nKeyCode ) const;
1445
1446 virtual OUString GetSurroundingText() const;
1447 virtual Selection GetSurroundingTextSelection() const;
1448 virtual bool DeleteSurroundingText(const Selection& rSelection);
1449
1450 virtual FactoryFunction GetUITestFactory() const;
1451
1452 virtual bool IsChart() const { return false; }
1453 virtual bool IsStarMath() const { return false; }
1454
1455 void SetHelpHdl(const Link<vcl::Window&, bool>& rLink);
1456 void SetMnemonicActivateHdl(const Link<vcl::Window&, bool>& rLink);
1457 void SetModalHierarchyHdl(const Link<bool, void>& rLink);
1458 void SetDumpAsPropertyTreeHdl(const Link<tools::JsonWriter&, void>& rLink);
1459
1460 Size GetOutputSizePixel() const;
1461 tools::Rectangle GetOutputRectPixel() const;
1462
1463 Point LogicToPixel( const Point& rLogicPt ) const;
1464 Size LogicToPixel( const Size& rLogicSize ) const;
1465 tools::Rectangle LogicToPixel( const tools::Rectangle& rLogicRect ) const;
1466 vcl::Region LogicToPixel( const vcl::Region& rLogicRegion )const;
1467 Point LogicToPixel( const Point& rLogicPt,
1468 const MapMode& rMapMode ) const;
1469 Size LogicToPixel( const Size& rLogicSize,
1470 const MapMode& rMapMode ) const;
1471 tools::Rectangle LogicToPixel( const tools::Rectangle& rLogicRect,
1472 const MapMode& rMapMode ) const;
1473
1474 Point PixelToLogic( const Point& rDevicePt ) const;
1475 Size PixelToLogic( const Size& rDeviceSize ) const;
1476 tools::Rectangle PixelToLogic( const tools::Rectangle& rDeviceRect ) const;
1477 tools::PolyPolygon PixelToLogic( const tools::PolyPolygon& rDevicePolyPoly ) const;
1478 vcl::Region PixelToLogic( const vcl::Region& rDeviceRegion ) const;
1479 Point PixelToLogic( const Point& rDevicePt,
1480 const MapMode& rMapMode ) const;
1481 Size PixelToLogic( const Size& rDeviceSize,
1482 const MapMode& rMapMode ) const;
1483 tools::Rectangle PixelToLogic( const tools::Rectangle& rDeviceRect,
1484 const MapMode& rMapMode ) const;
1485
1486 Size LogicToLogic( const Size& rSzSource,
1487 const MapMode* pMapModeSource,
1488 const MapMode* pMapModeDest ) const;
1489
1490 const AllSettings& GetSettings() const;
1491 void SetSettings( const AllSettings& rSettings );
1492 void SetSettings( const AllSettings& rSettings, bool bChild );
1493
1494 tools::Rectangle GetTextRect( const tools::Rectangle& rRect,
1495 const OUString& rStr, DrawTextFlags nStyle = DrawTextFlags::WordBreak,
1496 TextRectInfo* pInfo = nullptr,
1497 const vcl::ITextLayout* _pTextLayout = nullptr ) const;
1498 float GetDPIScaleFactor() const;
1499 tools::Long GetOutOffXPixel() const;
1500 tools::Long GetOutOffYPixel() const;
1501
1502 void EnableMapMode( bool bEnable = true );
1503 bool IsMapModeEnabled() const;
1504 void SetMapMode();
1505 void SetMapMode( const MapMode& rNewMapMode );
1506
1507 // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphicsLayout
1508 virtual void EnableRTL( bool bEnable = true);
1509 bool IsRTLEnabled() const;
1510
1511 void SetFont( const vcl::Font& rNewFont );
1512 const vcl::Font& GetFont() const;
1513
1518 tools::Long GetTextWidth( const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
1519 vcl::text::TextLayoutCache const* = nullptr,
1520 SalLayoutGlyphs const*const pLayoutCache = nullptr) const;
1521
1526 tools::Long GetTextHeight() const;
1527 float approximate_digit_width() const;
1528
1529 void SetTextColor( const Color& rColor );
1530 const Color& GetTextColor() const;
1531
1532 void SetTextFillColor();
1533 void SetTextFillColor( const Color& rColor );
1534 Color GetTextFillColor() const;
1535 bool IsTextFillColor() const;
1536
1537 void SetTextLineColor();
1538 void SetTextLineColor( const Color& rColor );
1539 const Color& GetTextLineColor() const;
1540 bool IsTextLineColor() const;
1541
1542 void SetOverlineColor();
1543 void SetOverlineColor( const Color& rColor );
1544 const Color& GetOverlineColor() const;
1545 bool IsOverlineColor() const;
1546
1547 void SetTextAlign( TextAlign eAlign );
1548 TextAlign GetTextAlign() const;
1549
1552 bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) const;
1553
1556 bool GetNativeControlRegion(
1557 ControlType nType,
1558 ControlPart nPart,
1559 const tools::Rectangle& rControlRegion,
1560 ControlState nState,
1561 const ImplControlValue& aValue,
1562 tools::Rectangle &rNativeBoundingRegion,
1563 tools::Rectangle &rNativeContentRegion ) const;
1564protected:
1565 SAL_DLLPRIVATE float approximate_char_width() const;
1566private:
1567 SAL_DLLPRIVATE void ImplEnableRTL(bool bEnable);
1568};
1569
1570}
1571
1572#endif // INCLUDED_VCL_WINDOW_HXX
1573
1574/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DrawTextFlags
#define F6
SystemTextColorFlags
ControlType
These types are all based on the supported variants vcl/salnativewidgets.hxx and must be kept in-sync...
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:237
Definition: edit.hxx:56
ImplDockingWindowWrapper.
Class that implements the actual window of the floating menu.
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:115
Definition: timer.hxx:27
A thin wrapper around rtl::Reference to implement the acquire and dispose semantics we want for refer...
Definition: vclptr.hxx:58
static void DrawSelectionBackground(vcl::RenderContext &rRenderContext, vcl::Window const &rWindow, const tools::Rectangle &rRect, sal_uInt16 nHighlight, bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly, Color *pSelectionTextColor=nullptr, tools::Long nCornerRadius=0, Color const *pPaintColor=nullptr)
Definition: paint.cxx:324
DECL_DLLPRIVATE_LINK(ImplAsyncFocusHdl, void *, void)
void Disable(bool bChild=true)
Definition: window.hxx:886
virtual bool IsChart() const
Definition: window.hxx:1452
void Hide()
Definition: window.hxx:879
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
Definition: window.hxx:528
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:484
virtual bool IsStarMath() const
Definition: window.hxx:1453
DECL_DLLPRIVATE_LINK(ImplGenerateMouseMoveHdl, void *, void)
DECL_DLLPRIVATE_LINK(ImplHandleResizeTimerHdl, Timer *, void)
DECL_DLLPRIVATE_LINK(ImplHandlePaintHdl, Timer *, void)
DECL_DLLPRIVATE_LINK(ImplTrackTimerHdl, Timer *, void)
void Init()
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
vcl::Window * ImplFindDlgCtrlWindow(vcl::Window *pParent, vcl::Window *pWindow, sal_uInt16 &rIndex, sal_uInt16 &rFormStart, sal_uInt16 &rFormEnd)
Definition: dlgctrl.cxx:327
virtual void SetText(const OUString &rStr) override
virtual void SetHelpId(const OUString &) override
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
KeyIndicatorState
Definition: keycodes.hxx:187
void reorderWithinParent(vcl::Window &rWindow, sal_uInt16 nNewPosition)
Definition: builder.cxx:2299
NONE
Clip
Layout
Visible
TextAlign
void dispose()
long Long
Color GetTextColor(Color const &rColor, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
Definition: drawmode.cxx:137
vcl::Font GetFont(vcl::Font const &rFont, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
Definition: drawmode.cxx:171
sal_uInt32 LOKWindowId
void SetPointFont(OutputDevice &rDevice, const vcl::Font &rFont)
Definition: weldutils.cxx:620
#define Y
PointerStyle
Definition: ptrstyle.hxx:26
@ EndExtTextInput
@ MouseButtonDown
ShowFlags
Definition: vclenum.hxx:346
VclAlign
Definition: vclenum.hxx:186
VclPackType
Definition: vclenum.hxx:194
TrackingEventFlags
Definition: vclenum.hxx:358
WindowBorderStyle
Definition: vclenum.hxx:107
VclEventId
Definition: vclevent.hxx:38
ImplPaintFlags
Definition: window.h:203
GetDlgWindowType
Definition: window.hxx:370
GetFocusFlags
Definition: window.hxx:313
@ FloatWinPopupModeEndCancel
ShowTrackFlags
Definition: window.hxx:248
const char * ImplDbgCheckWindow(const void *pObj)
Definition: debug.cxx:26
ZOrderFlags
Definition: window.hxx:146
StartAutoScrollFlags
Definition: window.hxx:279
GetWindowType
Definition: window.hxx:107
PosSizeFlags
Definition: window.hxx:127
StartTrackingFlags
Definition: window.hxx:265
ParentClipMode
Definition: window.hxx:237
DialogControlFlags
Definition: window.hxx:333
ValidateFlags
Definition: window.hxx:210
ActivateModeFlags
Definition: window.hxx:160
StateChangedType
Definition: window.hxx:291
WindowHitTest
Definition: window.hxx:403
InvalidateFlags
Definition: window.hxx:186
@ NoErase
The invalidated area is painted with the background color/pattern.
@ Children
The child windows are invalidated, too.
@ NoClipChildren
The area is invalidated regardless of overlapping child windows.
@ NoTransparent
The parent window is not invalidated.
@ NoChildren
The child windows are not invalidated.
ScrollFlags
Definition: window.hxx:222
WindowExtendedStyle
Definition: window.hxx:413
@ DocHidden
This is a frame window that is requested to be hidden (not just "not yet shown").
EndExtTextInputFlags
Definition: window.hxx:346
ToTopFlags
Definition: window.hxx:171
sal_Int64 WinBits
Definition: wintypes.hxx:109
WindowType
Definition: wintypes.hxx:27