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 XWindowPeer;
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 Point ImplFrameToOutput( const Point& rPos );
531
532 SAL_DLLPRIVATE void ImplGrabFocus( GetFocusFlags nFlags );
533 SAL_DLLPRIVATE void ImplGrabFocusToDocument( GetFocusFlags nFlags );
534 SAL_DLLPRIVATE void ImplInvertFocus( const tools::Rectangle& rRect );
535
536 SAL_DLLPRIVATE PointerStyle ImplGetMousePointer() const;
537 SAL_DLLPRIVATE void ImplCallMouseMove( sal_uInt16 nMouseCode, bool bModChanged = false );
538 SAL_DLLPRIVATE void ImplGenerateMouseMove();
539
540 SAL_DLLPRIVATE void ImplNotifyKeyMouseCommandEventListeners( NotifyEvent& rNEvt );
541 SAL_DLLPRIVATE void ImplNotifyIconifiedState( bool bIconified );
542
543 SAL_DLLPRIVATE void ImplUpdateAll();
544
545 SAL_DLLPRIVATE void ImplControlFocus( GetFocusFlags nFlags = GetFocusFlags::NONE );
546
547 SAL_DLLPRIVATE void ImplMirrorFramePos( Point &pt ) const;
548
549 SAL_DLLPRIVATE void ImplPosSizeWindow( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags );
550
551 SAL_DLLPRIVATE void ImplCallResize();
552 SAL_DLLPRIVATE void ImplCallMove();
553
554 // These methods call the relevant virtual method when not in/post dispose
555 SAL_DLLPRIVATE void CompatGetFocus();
556 SAL_DLLPRIVATE void CompatLoseFocus();
557 SAL_DLLPRIVATE void CompatStateChanged( StateChangedType nStateChange );
558 SAL_DLLPRIVATE void CompatDataChanged( const DataChangedEvent& rDCEvt );
559 SAL_DLLPRIVATE bool CompatPreNotify( NotifyEvent& rNEvt );
560 SAL_DLLPRIVATE bool CompatNotify( NotifyEvent& rNEvt );
561
562 void IncModalCount();
563 void DecModalCount();
564
565 SAL_DLLPRIVATE static void ImplCalcSymbolRect( tools::Rectangle& rRect );
566
567protected:
568
570 virtual void dispose() override;
571
572 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData );
573
574 SAL_DLLPRIVATE Point ImplOutputToFrame( const Point& rPos );
575
576 SAL_DLLPRIVATE void ImplInvalidateParentFrameRegion( const vcl::Region& rRegion );
577 SAL_DLLPRIVATE void ImplValidateFrameRegion( const vcl::Region* rRegion, ValidateFlags nFlags );
578 SAL_DLLPRIVATE void ImplValidate();
579 SAL_DLLPRIVATE void ImplMoveInvalidateRegion( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren );
580 SAL_DLLPRIVATE void ImplMoveAllInvalidateRegions( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren );
581
582 SAL_DLLPRIVATE vcl::Window* ImplGetBorderWindow() const;
583
584 SAL_DLLPRIVATE void ImplInvalidate( const vcl::Region* rRegion, InvalidateFlags nFlags );
585
586 virtual WindowHitTest ImplHitTest( const Point& rFramePos );
587
588 SAL_DLLPRIVATE void ImplSetMouseTransparent( bool bTransparent );
589
590 SAL_DLLPRIVATE void ImplScroll( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags );
591
592 SAL_DLLPRIVATE bool ImplSetClipFlagChildren( bool bSysObjOnlySmaller );
593 SAL_DLLPRIVATE bool ImplSetClipFlagOverlapWindows( bool bSysObjOnlySmaller = false );
594
595 SAL_DLLPRIVATE void PushPaintHelper(PaintHelper* pHelper, vcl::RenderContext& rRenderContext);
596 SAL_DLLPRIVATE void PopPaintHelper(PaintHelper const * pHelper);
597
598private:
599
600 SAL_DLLPRIVATE void ImplSetFrameParent( const vcl::Window* pParent );
601
602 SAL_DLLPRIVATE void ImplInsertWindow( vcl::Window* pParent );
603 SAL_DLLPRIVATE void ImplRemoveWindow( bool bRemoveFrameData );
604
605 SAL_DLLPRIVATE SalGraphics* ImplGetFrameGraphics() const;
606
607 SAL_DLLPRIVATE static void ImplCallFocusChangeActivate( vcl::Window* pNewOverlapWindow, vcl::Window* pOldOverlapWindow );
608 SAL_DLLPRIVATE vcl::Window* ImplGetFirstOverlapWindow();
609 SAL_DLLPRIVATE const vcl::Window* ImplGetFirstOverlapWindow() const;
610
611 SAL_DLLPRIVATE bool ImplIsRealParentPath( const vcl::Window* pWindow ) const;
612
613 SAL_DLLPRIVATE bool ImplTestMousePointerSet();
614
615 SAL_DLLPRIVATE void ImplResetReallyVisible();
616 SAL_DLLPRIVATE void ImplSetReallyVisible();
617
618 SAL_DLLPRIVATE void ImplCallInitShow();
619
620 SAL_DLLPRIVATE void ImplInitResolutionSettings();
621
622 SAL_DLLPRIVATE void ImplPointToLogic(vcl::RenderContext const & rRenderContext, vcl::Font& rFont) const;
623 SAL_DLLPRIVATE void ImplLogicToPoint(vcl::RenderContext const & rRenderContext, vcl::Font& rFont) const;
624
625 SAL_DLLPRIVATE bool ImplSysObjClip( const vcl::Region* pOldRegion );
626 SAL_DLLPRIVATE void ImplUpdateSysObjChildrenClip();
627 SAL_DLLPRIVATE void ImplUpdateSysObjOverlapsClip();
628 SAL_DLLPRIVATE void ImplUpdateSysObjClip();
629
630 SAL_DLLPRIVATE void ImplIntersectWindowClipRegion( vcl::Region& rRegion );
631 SAL_DLLPRIVATE void ImplIntersectWindowRegion( vcl::Region& rRegion );
632 SAL_DLLPRIVATE void ImplExcludeWindowRegion( vcl::Region& rRegion );
633 SAL_DLLPRIVATE void ImplExcludeOverlapWindows( vcl::Region& rRegion ) const;
634 SAL_DLLPRIVATE void ImplExcludeOverlapWindows2( vcl::Region& rRegion );
635
636 SAL_DLLPRIVATE void ImplClipBoundaries( vcl::Region& rRegion, bool bThis, bool bOverlaps );
637 SAL_DLLPRIVATE bool ImplClipChildren( vcl::Region& rRegion ) const;
638 SAL_DLLPRIVATE void ImplClipAllChildren( vcl::Region& rRegion ) const;
639 SAL_DLLPRIVATE void ImplClipSiblings( vcl::Region& rRegion ) const;
640
641 SAL_DLLPRIVATE void ImplInitWinClipRegion();
642 SAL_DLLPRIVATE void ImplInitWinChildClipRegion();
643 SAL_DLLPRIVATE vcl::Region& ImplGetWinChildClipRegion();
644
645 SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows( const vcl::Region& rInterRegion, vcl::Region& rRegion ) const;
646 SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows2( const vcl::Region& rInterRegion, vcl::Region& rRegion );
647 SAL_DLLPRIVATE void ImplCalcOverlapRegionOverlaps( const vcl::Region& rInterRegion, vcl::Region& rRegion ) const;
648 SAL_DLLPRIVATE void ImplCalcOverlapRegion( const tools::Rectangle& rSourceRect, vcl::Region& rRegion,
649 bool bChildren, bool bSiblings );
650
657 SAL_DLLPRIVATE void ImplCallPaint(const vcl::Region* pRegion, ImplPaintFlags nPaintFlags);
658
659 SAL_DLLPRIVATE void ImplCallOverlapPaint();
660
661 SAL_DLLPRIVATE void ImplUpdateWindowPtr( vcl::Window* pWindow );
662 SAL_DLLPRIVATE void ImplUpdateWindowPtr();
663 SAL_DLLPRIVATE void ImplUpdateOverlapWindowPtr( bool bNewFrame );
664
665 SAL_DLLPRIVATE bool ImplUpdatePos();
666 SAL_DLLPRIVATE void ImplUpdateSysObjPos();
667
668 SAL_DLLPRIVATE void ImplUpdateGlobalSettings( AllSettings& rSettings, bool bCallHdl = true ) const;
669
670 SAL_DLLPRIVATE void ImplToBottomChild();
671
672 SAL_DLLPRIVATE void ImplCalcToTop( ImplCalcToTopData* pPrevData );
673 SAL_DLLPRIVATE void ImplToTop( ToTopFlags nFlags );
674 SAL_DLLPRIVATE void ImplStartToTop( ToTopFlags nFlags );
675 SAL_DLLPRIVATE void ImplFocusToTop( ToTopFlags nFlags, bool bReallyVisible );
676
677 SAL_DLLPRIVATE void ImplShowAllOverlaps();
678 SAL_DLLPRIVATE void ImplHideAllOverlaps();
679
680 SAL_DLLPRIVATE bool ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput );
681 SAL_DLLPRIVATE bool ImplHasDlgCtrl() const;
682 SAL_DLLPRIVATE void ImplDlgCtrlNextWindow();
683 SAL_DLLPRIVATE void ImplDlgCtrlFocusChanged( vcl::Window* pWindow, bool bGetFocus );
684 SAL_DLLPRIVATE vcl::Window* ImplFindDlgCtrlWindow( vcl::Window* pWindow );
685
686 SAL_DLLPRIVATE static void ImplNewInputContext();
687
688 SAL_DLLPRIVATE void ImplCallActivateListeners(vcl::Window*);
689 SAL_DLLPRIVATE void ImplCallDeactivateListeners(vcl::Window*);
690
691 SAL_DLLPRIVATE static void ImplHandleScroll(Scrollable* pHScrl, double nX, Scrollable* pVScrl, double nY);
692
693 SAL_DLLPRIVATE tools::Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle& rRect ) const;
694 SAL_DLLPRIVATE tools::Rectangle ImplUnmirroredAbsoluteScreenToOutputPixel( const tools::Rectangle& rRect ) const;
695 SAL_DLLPRIVATE tools::Long ImplGetUnmirroredOutOffX();
696
697 // retrieves the list of owner draw decorated windows for this window hierarchy
698 SAL_DLLPRIVATE ::std::vector<VclPtr<vcl::Window> >& ImplGetOwnerDrawList();
699
700 SAL_DLLPRIVATE vcl::Window* ImplGetTopmostFrameWindow();
701
702 SAL_DLLPRIVATE tools::Rectangle ImplGetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const;
703
704 SAL_DLLPRIVATE bool ImplStopDnd();
705 SAL_DLLPRIVATE void ImplStartDnd();
706
707 virtual void ImplPaintToDevice( ::OutputDevice* pTargetOutDev, const Point& rPos );
708
709protected:
710 // Single argument ctors shall be explicit.
711 explicit Window( WindowType nType );
712
713 void SetCompoundControl( bool bCompound );
714
715 void CallEventListeners( VclEventId nEvent, void* pData = nullptr );
716
717 // FIXME: this is a hack to workaround missing layout functionality
718 virtual void ImplAdjustNWFSizes();
719
720 virtual void ApplySettings(vcl::RenderContext& rRenderContext);
721
722public:
723 // Single argument ctors shall be explicit.
724 explicit Window( vcl::Window* pParent, WinBits nStyle = 0 );
725
726 virtual ~Window() override;
727
728 ::OutputDevice const* GetOutDev() const;
729 ::OutputDevice* GetOutDev();
730
731 Color GetBackgroundColor() const;
732 const Wallpaper & GetBackground() const;
733 bool IsBackground() const;
734 const MapMode& GetMapMode() const;
735 void SetBackground();
736 void SetBackground( const Wallpaper& rBackground );
737
738 virtual void MouseMove( const MouseEvent& rMEvt );
739 virtual void MouseButtonDown( const MouseEvent& rMEvt );
740 virtual void MouseButtonUp( const MouseEvent& rMEvt );
741 virtual void KeyInput( const KeyEvent& rKEvt );
742 virtual void KeyUp( const KeyEvent& rKEvt );
743 virtual void PrePaint(vcl::RenderContext& rRenderContext);
744 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
745 virtual void PostPaint(vcl::RenderContext& rRenderContext);
746
747 void Erase(vcl::RenderContext& rRenderContext);
748
749 virtual void Draw( ::OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags );
750 virtual void Move();
751 virtual void Resize();
752 virtual void Activate();
753 virtual void Deactivate();
754 virtual void GetFocus();
755 virtual void LoseFocus();
756 virtual void RequestHelp( const HelpEvent& rHEvt );
757 virtual void Command( const CommandEvent& rCEvt );
758 virtual void Tracking( const TrackingEvent& rTEvt );
759 virtual void StateChanged( StateChangedType nStateChange );
760 virtual void DataChanged( const DataChangedEvent& rDCEvt );
761 virtual bool PreNotify( NotifyEvent& rNEvt );
762 virtual bool EventNotify( NotifyEvent& rNEvt );
763
764 void AddEventListener( const Link<VclWindowEvent&,void>& rEventListener );
765 void RemoveEventListener( const Link<VclWindowEvent&,void>& rEventListener );
766 void AddChildEventListener( const Link<VclWindowEvent&,void>& rEventListener );
767 void RemoveChildEventListener( const Link<VclWindowEvent&,void>& rEventListener );
768
769 ImplSVEvent * PostUserEvent( const Link<void*,void>& rLink, void* pCaller = nullptr, bool bReferenceLink = false );
770 void RemoveUserEvent( ImplSVEvent * nUserEvent );
771
772 // returns the input language used for the last key stroke
773 // may be LANGUAGE_DONTKNOW if not supported by the OS
774 LanguageType GetInputLanguage() const;
775
776 void SetStyle( WinBits nStyle );
777 WinBits GetStyle() const;
778 WinBits GetPrevStyle() const;
779 void SetExtendedStyle( WindowExtendedStyle nExtendedStyle );
780 WindowExtendedStyle GetExtendedStyle() const;
781 void SetType( WindowType nType );
782 WindowType GetType() const;
783 bool IsSystemWindow() const;
784 bool IsDockingWindow() const;
785 bool IsDialog() const;
786 bool IsMenuFloatingWindow() const;
787 bool IsToolbarFloatingWindow() const;
788 bool IsTopWindow() const;
789 SystemWindow* GetSystemWindow() const;
790
792 bool SupportsDoubleBuffering() const;
794 void RequestDoubleBuffering(bool bRequest);
795
796 void EnableAllResize();
797
798 void SetBorderStyle( WindowBorderStyle nBorderStyle );
799 WindowBorderStyle GetBorderStyle() const;
800 void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
801 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
802 Size CalcWindowSize( const Size& rOutSz ) const;
803 Size CalcOutputSize( const Size& rWinSz ) const;
804 tools::Long CalcTitleWidth() const;
805
806 void EnableClipSiblings( bool bClipSiblings = true );
807
808 void EnableChildTransparentMode( bool bEnable = true );
809 bool IsChildTransparentModeEnabled() const;
810
811 void SetMouseTransparent( bool bTransparent );
812 bool IsMouseTransparent() const;
813 void SetPaintTransparent( bool bTransparent );
814 bool IsPaintTransparent() const;
815 void SetDialogControlStart( bool bStart );
816 bool IsDialogControlStart() const;
817 void SetDialogControlFlags( DialogControlFlags nFlags );
818 DialogControlFlags GetDialogControlFlags() const;
819
821 {
822 sal_Int32 mnState; // the button state
823 Point maPos; // mouse position in output coordinates
824 };
825 PointerState GetPointerState();
826 bool IsMouseOver() const;
827
828 void SetInputContext( const InputContext& rInputContext );
829 const InputContext& GetInputContext() const;
830 void PostExtTextInputEvent(VclEventId nType, const OUString& rText);
831 void EndExtTextInput();
832 void SetCursorRect( const tools::Rectangle* pRect = nullptr, tools::Long nExtTextInputWidth = 0 );
833 const tools::Rectangle* GetCursorRect() const;
834 tools::Long GetCursorExtTextInputWidth() const;
835
836 void SetCompositionCharRect( const tools::Rectangle* pRect, tools::Long nCompositionLength, bool bVertical = false );
837
838 void UpdateSettings( const AllSettings& rSettings, bool bChild = false );
839 void NotifyAllChildren( DataChangedEvent& rDCEvt );
840
841 void SetPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont);
842 vcl::Font GetPointFont(vcl::RenderContext const & rRenderContext) const;
843 void SetZoomedPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont);
844 tools::Long GetDrawPixel( ::OutputDevice const * pDev, tools::Long nPixels ) const;
845 vcl::Font GetDrawPixelFont( ::OutputDevice const * pDev ) const;
846
847 void SetControlFont();
848 void SetControlFont( const vcl::Font& rFont );
849 vcl::Font GetControlFont() const;
850 bool IsControlFont() const;
851 void ApplyControlFont(vcl::RenderContext& rRenderContext, const vcl::Font& rDefaultFont);
852
853 void SetControlForeground();
854 void SetControlForeground(const Color& rColor);
855 const Color& GetControlForeground() const;
856 bool IsControlForeground() const;
857 void ApplyControlForeground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor);
858
859 void SetControlBackground();
860 void SetControlBackground( const Color& rColor );
861 const Color& GetControlBackground() const;
862 bool IsControlBackground() const;
863 void ApplyControlBackground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor);
864
865 void SetParentClipMode( ParentClipMode nMode = ParentClipMode::NONE );
866 ParentClipMode GetParentClipMode() const;
867
868 void SetWindowRegionPixel();
869 void SetWindowRegionPixel( const vcl::Region& rRegion );
870 vcl::Region GetWindowClipRegionPixel() const;
871 vcl::Region GetPaintRegion() const;
872 bool IsInPaint() const;
873 // while IsInPaint returns true ExpandPaintClipRegion adds the
874 // submitted region to the paint clip region so you can
875 // paint additional parts of your window if necessary
876 void ExpandPaintClipRegion( const vcl::Region& rRegion );
877
878 void SetParent( vcl::Window* pNewParent );
879 vcl::Window* GetParent() const;
880 // return the dialog we are contained in or NULL if un-contained
881 Dialog* GetParentDialog() const;
882 bool IsAncestorOf( const vcl::Window& rWindow ) const;
883
884 void Show( bool bVisible = true, ShowFlags nFlags = ShowFlags::NONE );
885 void Hide() { Show( false ); }
886 bool IsVisible() const;
887 bool IsReallyVisible() const;
888 bool IsReallyShown() const;
889 bool IsInInitShow() const;
890
891 void Enable( bool bEnable = true, bool bChild = true );
892 void Disable( bool bChild = true ) { Enable( false, bChild ); }
893 bool IsEnabled() const;
894
895 void EnableInput( bool bEnable = true, bool bChild = true );
896 void EnableInput( bool bEnable, const vcl::Window* pExcludeWindow );
897 bool IsInputEnabled() const;
898
908 void AlwaysEnableInput( bool bAlways, bool bChild = true );
909
914 bool IsAlwaysEnableInput() const;
915
921 bool IsInModalMode() const;
922
923 void SetActivateMode( ActivateModeFlags nMode );
924 ActivateModeFlags GetActivateMode() const;
925
926 void ToTop( ToTopFlags nFlags = ToTopFlags::NONE );
927 void SetZOrder( vcl::Window* pRefWindow, ZOrderFlags nFlags );
928 void EnableAlwaysOnTop( bool bEnable = true );
929 bool IsAlwaysOnTopEnabled() const;
930
931 virtual void setPosSizePixel( tools::Long nX, tools::Long nY,
932 tools::Long nWidth, tools::Long nHeight,
934 virtual void SetPosPixel( const Point& rNewPos );
935 virtual Point GetPosPixel() const;
936 virtual void SetSizePixel( const Size& rNewSize );
937 virtual Size GetSizePixel() const;
938 virtual void SetPosSizePixel( const Point& rNewPos,
939 const Size& rNewSize );
940 virtual void SetOutputSizePixel( const Size& rNewSize );
941 bool IsDefaultPos() const;
942 bool IsDefaultSize() const;
943 Point GetOffsetPixelFrom(const vcl::Window& rWindow) const;
944
945 // those conversion routines might deliver different results during UI mirroring
946 Point OutputToScreenPixel( const Point& rPos ) const;
947 Point ScreenToOutputPixel( const Point& rPos ) const;
948 // the normalized screen methods work independent from UI mirroring
949 Point OutputToNormalizedScreenPixel( const Point& rPos ) const;
950 Point NormalizedScreenToOutputPixel( const Point& rPos ) const;
951 Point OutputToAbsoluteScreenPixel( const Point& rPos ) const;
952 Point AbsoluteScreenToOutputPixel( const Point& rPos ) const;
953 tools::Rectangle GetDesktopRectPixel() const;
954 // window extents including border and decoration
955 tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const;
956
957 bool IsScrollable() const;
958 virtual void Scroll( tools::Long nHorzScroll, tools::Long nVertScroll,
960 void Scroll( tools::Long nHorzScroll, tools::Long nVertScroll,
961 const tools::Rectangle& rRect, ScrollFlags nFlags = ScrollFlags::NONE );
962 virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE );
963 virtual void Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE );
964 virtual void Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags = InvalidateFlags::NONE );
971 virtual void LogicInvalidate(const tools::Rectangle* pRectangle);
972
979 virtual void PixelInvalidate(const tools::Rectangle* pRectangle);
980 void Validate();
981 bool HasPaintEvent() const;
982 void PaintImmediately();
983
984 // toggles new docking support, enabled via toolkit
985 void EnableDocking( bool bEnable = true );
986 // retrieves the single dockingmanager instance
987 static DockingManager* GetDockingManager();
988
989 void EnablePaint( bool bEnable );
990 bool IsPaintEnabled() const;
991 void SetUpdateMode( bool bUpdate );
992 bool IsUpdateMode() const;
993 void SetParentUpdateMode( bool bUpdate );
994
995 void GrabFocus();
996 bool HasFocus() const;
997 bool HasChildPathFocus( bool bSystemWindow = false ) const;
998 bool IsActive() const;
999 bool HasActiveChildFrame() const;
1000 GetFocusFlags GetGetFocusFlags() const;
1001 void GrabFocusToDocument();
1002 VclPtr<vcl::Window> GetFocusedWindow() const;
1003
1009 void SetFakeFocus( bool bFocus );
1010
1011 bool IsCompoundControl() const;
1012
1013 static VclPtr<vcl::Window> SaveFocus();
1014 static void EndSaveFocus(const VclPtr<vcl::Window>& xFocusWin);
1015
1016 void LocalStartDrag();
1017 void CaptureMouse();
1018 void ReleaseMouse();
1019 bool IsMouseCaptured() const;
1020
1021 virtual void SetPointer( PointerStyle );
1022 PointerStyle GetPointer() const;
1023 void EnableChildPointerOverwrite( bool bOverwrite );
1024 void SetPointerPosPixel( const Point& rPos );
1025 Point GetPointerPosPixel();
1026 Point GetLastPointerPosPixel();
1028 void SetLastMousePos(const Point& rPos);
1029 void ShowPointer( bool bVisible );
1030 void EnterWait();
1031 void LeaveWait();
1032 bool IsWait() const;
1033
1034 void SetCursor( vcl::Cursor* pCursor );
1035 vcl::Cursor* GetCursor() const;
1036
1037 void SetZoom( const Fraction& rZoom );
1038 const Fraction& GetZoom() const;
1039 bool IsZoom() const;
1040 tools::Long CalcZoom( tools::Long n ) const;
1041
1042 virtual void SetText( const OUString& rStr );
1043 virtual OUString GetText() const;
1044 // return the actual text displayed
1045 // this may have e.g. accelerators removed or portions
1046 // replaced by ellipses
1047 virtual OUString GetDisplayText() const;
1048 // gets the visible background color. for transparent windows
1049 // this may be the parent's background color; for controls
1050 // this may be a child's background color (e.g. ListBox)
1051 virtual const Wallpaper& GetDisplayBackground() const;
1052
1053 void SetHelpText( const OUString& rHelpText );
1054 const OUString& GetHelpText() const;
1055
1056 void SetQuickHelpText( const OUString& rHelpText );
1057 const OUString& GetQuickHelpText() const;
1058
1059 void SetHelpId( const OString& );
1060 const OString& GetHelpId() const;
1061
1062 sal_uInt16 GetChildCount() const;
1063 vcl::Window* GetChild( sal_uInt16 nChild ) const;
1064 vcl::Window* GetWindow( GetWindowType nType ) const;
1065 bool IsChild( const vcl::Window* pWindow ) const;
1066 bool IsWindowOrChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
1067
1069 SAL_DLLPRIVATE void CollectChildren(::std::vector<vcl::Window *>& rAllChildren );
1070
1071 virtual void ShowFocus(const tools::Rectangle& rRect);
1072 void HideFocus();
1073
1074 // transparent background for selected or checked items in toolboxes etc.
1075 void DrawSelectionBackground( const tools::Rectangle& rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder );
1076
1077 void ShowTracking( const tools::Rectangle& rRect,
1079 void HideTracking();
1080 void InvertTracking( const tools::Rectangle& rRect, ShowTrackFlags nFlags );
1081
1082 void StartTracking( StartTrackingFlags nFlags = StartTrackingFlags::NONE );
1083 void EndTracking( TrackingEventFlags nFlags = TrackingEventFlags::NONE );
1084 bool IsTracking() const;
1085
1087 void EndAutoScroll();
1088
1089 bool HandleScrollCommand( const CommandEvent& rCmd,
1090 Scrollable* pHScrl,
1091 Scrollable* pVScrl );
1092
1093 virtual const SystemEnvData* GetSystemData() const;
1094
1095 // API to set/query the component interfaces
1096 virtual css::uno::Reference< css::awt::XWindowPeer >
1097 GetComponentInterface( bool bCreate = true );
1098
1099 void SetComponentInterface( css::uno::Reference< css::awt::XWindowPeer > const & xIFace );
1100
1101 void SetUseFrameData(bool bUseFrameData);
1102
1104 void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier, bool bParent = false);
1105 const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() const;
1106 vcl::LOKWindowId GetLOKWindowId() const;
1107
1109 VclPtr<vcl::Window> GetParentWithLOKNotifier();
1110
1112 void ReleaseLOKNotifier();
1113
1115 static VclPtr<vcl::Window> FindLOKWindow(vcl::LOKWindowId nWindowId);
1116
1118 static bool IsLOKWindowsEmpty();
1119
1121 virtual void DumpAsPropertyTree(tools::JsonWriter&);
1122
1126public:
1127
1128 css::uno::Reference< css::accessibility::XAccessible >
1129 GetAccessible( bool bCreate = true );
1130
1131 virtual css::uno::Reference< css::accessibility::XAccessible >
1132 CreateAccessible();
1133
1134 void SetAccessible( const css::uno::Reference< css::accessibility::XAccessible >& );
1135
1136 vcl::Window* GetAccessibleParentWindow() const;
1137 sal_uInt16 GetAccessibleChildWindowCount();
1138 vcl::Window* GetAccessibleChildWindow( sal_uInt16 n );
1139
1140 void SetAccessibleRole( sal_uInt16 nRole );
1141 sal_uInt16 GetAccessibleRole() const;
1142
1143 void SetAccessibleName( const OUString& rName );
1144 OUString GetAccessibleName() const;
1145
1146 void SetAccessibleDescription( const OUString& rDescr );
1147 OUString GetAccessibleDescription() const;
1148
1149 void SetAccessibleRelationLabeledBy( vcl::Window* pLabeledBy );
1150 vcl::Window* GetAccessibleRelationLabeledBy() const;
1151
1152 void SetAccessibleRelationLabelFor( vcl::Window* pLabelFor );
1153 vcl::Window* GetAccessibleRelationLabelFor() const;
1154
1155 vcl::Window* GetAccessibleRelationMemberOf() const;
1156
1157 // to avoid sending accessibility events in cases like closing dialogs
1158 // by default checks complete parent path
1159 bool IsAccessibilityEventsSuppressed( bool bTraverseParentPath = true );
1160 void SetAccessibilityEventsSuppressed(bool bSuppressed);
1161
1162 KeyEvent GetActivationKey() const;
1163
1164protected:
1165
1166 // These eventually are supposed to go when everything is converted to .ui
1167 SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationMemberOf() const;
1168 SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabeledBy() const;
1169 SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabelFor() const;
1170
1171 // Let Label override the code part of GetAccessibleRelationLabelFor
1172 virtual vcl::Window* getAccessibleRelationLabelFor() const;
1173 virtual sal_uInt16 getDefaultAccessibleRole() const;
1174 virtual OUString getDefaultAccessibleName() const;
1175
1176 /*
1177 * Advisory Sizing - what is a good size for this widget
1178 *
1179 * Retrieves the preferred size of a widget ignoring
1180 * "width-request" and "height-request" properties.
1181 *
1182 * Implement this in sub-classes to tell layout
1183 * the preferred widget size.
1184 *
1185 * Use get_preferred_size to retrieve this value
1186 * cached and mediated via height and width requests
1187 */
1188 virtual Size GetOptimalSize() const;
1190 void InvalidateSizeCache();
1191private:
1192
1193 SAL_DLLPRIVATE bool ImplIsAccessibleCandidate() const;
1194 SAL_DLLPRIVATE bool ImplIsAccessibleNativeFrame() const;
1196
1197 /*
1198 * Retrieves the preferred size of a widget taking
1199 * into account the "width-request" and "height-request" properties.
1200 *
1201 * Overrides the result of GetOptimalSize to honor the
1202 * width-request and height-request properties.
1203 *
1204 * So the same as get_ungrouped_preferred_size except
1205 * it ignores groups. A building block of get_preferred_size
1206 * that access the size cache
1207 *
1208 * @see get_preferred_size
1209 */
1210 Size get_ungrouped_preferred_size() const;
1211public:
1212 /* records all DrawText operations within the passed rectangle;
1213 * a synchronous paint is sent to achieve this
1214 */
1215 void RecordLayoutData( vcl::ControlLayoutData* pLayout, const tools::Rectangle& rRect );
1216
1217 // set and retrieve for Toolkit
1218 VCLXWindow* GetWindowPeer() const;
1219 void SetWindowPeer( css::uno::Reference< css::awt::XWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow );
1220
1221 // remember if it was generated by Toolkit
1222 bool IsCreatedWithToolkit() const;
1223 void SetCreatedWithToolkit( bool b );
1224
1225 // Drag and Drop interfaces
1226 css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget();
1227 css::uno::Reference< css::datatransfer::dnd::XDragSource > GetDragSource();
1228 css::uno::Reference< css::datatransfer::dnd::XDragGestureRecognizer > GetDragGestureRecognizer();
1229
1230 // Clipboard/Selection interfaces
1231 css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard();
1233 void SetClipboard(css::uno::Reference<css::datatransfer::clipboard::XClipboard> const & xClipboard);
1234
1235 /*
1236 * Widgets call this to inform their owner container that the widget wants
1237 * to renegotiate its size. Should be called when a widget has a new size
1238 * request. e.g. a FixedText Control gets a new label.
1239 *
1240 * akin to gtk_widget_queue_resize
1241 */
1242 virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout);
1243
1244 /*
1245 * Sets the "height-request" property
1246 *
1247 * Override for height request of the widget, or -1 if natural request
1248 * should be used.
1249 *
1250 * @see get_preferred_size, set_width_request
1251 */
1252 void set_height_request(sal_Int32 nHeightRequest);
1253 sal_Int32 get_height_request() const;
1254
1255 /*
1256 * Sets the "width-request" property
1257 *
1258 * Override for width request of the widget, or -1 if natural request
1259 * should be used.
1260 *
1261 * @see get_preferred_size, set_height_request
1262 */
1263 void set_width_request(sal_Int32 nWidthRequest);
1264 sal_Int32 get_width_request() const;
1265
1266 /*
1267 * Retrieves the preferred size of a widget taking
1268 * into account the "width-request" and "height-request" properties.
1269 *
1270 * Overrides the result of GetOptimalSize to honor the
1271 * width-request and height-request properties.
1272 *
1273 * @see GetOptimalSize
1274 *
1275 * akin to gtk_widget_get_preferred_size
1276 */
1277 Size get_preferred_size() const;
1278
1279 /*
1280 * How to horizontally align this widget
1281 */
1282 VclAlign get_halign() const;
1283 void set_halign(VclAlign eAlign);
1284
1285 /*
1286 * How to vertically align this widget
1287 */
1288 VclAlign get_valign() const;
1289 void set_valign(VclAlign eAlign);
1290
1291 /*
1292 * Whether the widget would like to use any available extra horizontal
1293 * space.
1294 */
1295 bool get_hexpand() const;
1296 void set_hexpand(bool bExpand);
1297
1298 /*
1299 * Whether the widget would like to use any available extra vertical
1300 * space.
1301 */
1302 bool get_vexpand() const;
1303 void set_vexpand(bool bExpand);
1304
1305 /*
1306 * Whether the widget would like to use any available extra space.
1307 */
1308 bool get_expand() const;
1309 void set_expand(bool bExpand);
1310
1311 /*
1312 * Whether the widget should receive extra space when the parent grows
1313 */
1314 bool get_fill() const;
1315 void set_fill(bool bFill);
1316
1317 void set_border_width(sal_Int32 nBorderWidth);
1318 sal_Int32 get_border_width() const;
1319
1320 void set_margin_start(sal_Int32 nWidth);
1321 sal_Int32 get_margin_start() const;
1322
1323 void set_margin_end(sal_Int32 nWidth);
1324 sal_Int32 get_margin_end() const;
1325
1326 void set_margin_top(sal_Int32 nWidth);
1327 sal_Int32 get_margin_top() const;
1328
1329 void set_margin_bottom(sal_Int32 nWidth);
1330 sal_Int32 get_margin_bottom() const;
1331
1332 /*
1333 * How the widget is packed with reference to the start or end of the parent
1334 */
1335 VclPackType get_pack_type() const;
1336 void set_pack_type(VclPackType ePackType);
1337
1338 /*
1339 * The extra space to put between the widget and its neighbors
1340 */
1341 sal_Int32 get_padding() const;
1342 void set_padding(sal_Int32 nPadding);
1343
1344 /*
1345 * The number of columns that the widget spans
1346 */
1347 sal_Int32 get_grid_width() const;
1348 void set_grid_width(sal_Int32 nCols);
1349
1350 /*
1351 * The column number to attach the left side of the widget to
1352 */
1353 sal_Int32 get_grid_left_attach() const;
1354 void set_grid_left_attach(sal_Int32 nAttach);
1355
1356 /*
1357 * The number of row that the widget spans
1358 */
1359 sal_Int32 get_grid_height() const;
1360 void set_grid_height(sal_Int32 nRows);
1361
1362 /*
1363 * The row number to attach the top side of the widget to
1364 */
1365 sal_Int32 get_grid_top_attach() const;
1366 void set_grid_top_attach(sal_Int32 nAttach);
1367
1368 /*
1369 * If true this child appears in a secondary layout group of children
1370 * e.g. help buttons in a buttonbox
1371 */
1372 bool get_secondary() const;
1373 void set_secondary(bool bSecondary);
1374
1375 /*
1376 * If true this child is exempted from homogeneous sizing
1377 * e.g. special button in a buttonbox
1378 */
1379 bool get_non_homogeneous() const;
1380 void set_non_homogeneous(bool bNonHomogeneous);
1381
1382 /*
1383 * Sets a widget property
1384 *
1385 * @return false if property is unknown
1386 */
1387 virtual bool set_property(const OString &rKey, const OUString &rValue);
1388
1389 /*
1390 * Sets a font attribute
1391 *
1392 * @return false if attribute is unknown
1393 */
1394 bool set_font_attribute(const OString &rKey, std::u16string_view rValue);
1395
1396 /*
1397 * Adds this widget to the xGroup VclSizeGroup
1398 *
1399 */
1400 void add_to_size_group(const std::shared_ptr<VclSizeGroup>& xGroup);
1401 void remove_from_all_size_groups();
1402
1403 /*
1404 * add/remove mnemonic label
1405 */
1406 void add_mnemonic_label(FixedText *pLabel);
1407 void remove_mnemonic_label(FixedText *pLabel);
1408 const std::vector<VclPtr<FixedText> >& list_mnemonic_labels() const;
1409
1410 /*
1411 * Move this widget to be the nNewPosition'd child of its parent
1412 */
1413 void reorderWithinParent(sal_uInt16 nNewPosition);
1414
1418 void set_id(const OUString& rID);
1419
1423 const OUString& get_id() const;
1424
1425
1426 // Native Widget Rendering functions
1427
1428
1429 // form controls must never use native widgets, this can be toggled here
1430 void EnableNativeWidget( bool bEnable = true );
1431 bool IsNativeWidgetEnabled() const;
1432
1433 // a helper method for a Control's Draw method
1434 void PaintToDevice( ::OutputDevice* pDevice, const Point& rPos );
1435
1436 // Keyboard access functions
1437
1446 KeyIndicatorState GetIndicatorState() const;
1447
1448 void SimulateKeyPress( sal_uInt16 nKeyCode ) const;
1449
1450 virtual OUString GetSurroundingText() const;
1451 virtual Selection GetSurroundingTextSelection() const;
1452 virtual bool DeleteSurroundingText(const Selection& rSelection);
1453
1454 virtual FactoryFunction GetUITestFactory() const;
1455
1456 virtual bool IsChart() const { return false; }
1457 virtual bool IsStarMath() const { return false; }
1458
1459 void SetHelpHdl(const Link<vcl::Window&, bool>& rLink);
1460 void SetMnemonicActivateHdl(const Link<vcl::Window&, bool>& rLink);
1461 void SetModalHierarchyHdl(const Link<bool, void>& rLink);
1462 void SetDumpAsPropertyTreeHdl(const Link<tools::JsonWriter&, void>& rLink);
1463
1464 Size GetOutputSizePixel() const;
1465 tools::Rectangle GetOutputRectPixel() const;
1466
1467 Point LogicToPixel( const Point& rLogicPt ) const;
1468 Size LogicToPixel( const Size& rLogicSize ) const;
1469 tools::Rectangle LogicToPixel( const tools::Rectangle& rLogicRect ) const;
1470 vcl::Region LogicToPixel( const vcl::Region& rLogicRegion )const;
1471 Point LogicToPixel( const Point& rLogicPt,
1472 const MapMode& rMapMode ) const;
1473 Size LogicToPixel( const Size& rLogicSize,
1474 const MapMode& rMapMode ) const;
1475 tools::Rectangle LogicToPixel( const tools::Rectangle& rLogicRect,
1476 const MapMode& rMapMode ) const;
1477
1478 Point PixelToLogic( const Point& rDevicePt ) const;
1479 Size PixelToLogic( const Size& rDeviceSize ) const;
1480 tools::Rectangle PixelToLogic( const tools::Rectangle& rDeviceRect ) const;
1481 tools::PolyPolygon PixelToLogic( const tools::PolyPolygon& rDevicePolyPoly ) const;
1482 vcl::Region PixelToLogic( const vcl::Region& rDeviceRegion ) const;
1483 Point PixelToLogic( const Point& rDevicePt,
1484 const MapMode& rMapMode ) const;
1485 Size PixelToLogic( const Size& rDeviceSize,
1486 const MapMode& rMapMode ) const;
1487 tools::Rectangle PixelToLogic( const tools::Rectangle& rDeviceRect,
1488 const MapMode& rMapMode ) const;
1489
1490 Size LogicToLogic( const Size& rSzSource,
1491 const MapMode* pMapModeSource,
1492 const MapMode* pMapModeDest ) const;
1493
1494 const AllSettings& GetSettings() const;
1495 void SetSettings( const AllSettings& rSettings );
1496 void SetSettings( const AllSettings& rSettings, bool bChild );
1497
1498 tools::Rectangle GetTextRect( const tools::Rectangle& rRect,
1499 const OUString& rStr, DrawTextFlags nStyle = DrawTextFlags::WordBreak,
1500 TextRectInfo* pInfo = nullptr,
1501 const vcl::ITextLayout* _pTextLayout = nullptr ) const;
1502 float GetDPIScaleFactor() const;
1503 tools::Long GetOutOffXPixel() const;
1504 tools::Long GetOutOffYPixel() const;
1505
1506 void EnableMapMode( bool bEnable = true );
1507 bool IsMapModeEnabled() const;
1508 void SetMapMode();
1509 void SetMapMode( const MapMode& rNewMapMode );
1510
1511 // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphicsLayout
1512 virtual void EnableRTL( bool bEnable = true);
1513 bool IsRTLEnabled() const;
1514
1515 void SetFont( const vcl::Font& rNewFont );
1516 const vcl::Font& GetFont() const;
1517
1522 tools::Long GetTextWidth( const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
1523 vcl::text::TextLayoutCache const* = nullptr,
1524 SalLayoutGlyphs const*const pLayoutCache = nullptr) const;
1525
1530 tools::Long GetTextHeight() const;
1531 float approximate_digit_width() const;
1532
1533 void SetTextColor( const Color& rColor );
1534 const Color& GetTextColor() const;
1535
1536 void SetTextFillColor();
1537 void SetTextFillColor( const Color& rColor );
1538 Color GetTextFillColor() const;
1539 bool IsTextFillColor() const;
1540
1541 void SetTextLineColor();
1542 void SetTextLineColor( const Color& rColor );
1543 const Color& GetTextLineColor() const;
1544 bool IsTextLineColor() const;
1545
1546 void SetOverlineColor();
1547 void SetOverlineColor( const Color& rColor );
1548 const Color& GetOverlineColor() const;
1549 bool IsOverlineColor() const;
1550
1551 void SetTextAlign( TextAlign eAlign );
1552 TextAlign GetTextAlign() const;
1553
1556 bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) const;
1557
1560 bool GetNativeControlRegion(
1561 ControlType nType,
1562 ControlPart nPart,
1563 const tools::Rectangle& rControlRegion,
1564 ControlState nState,
1565 const ImplControlValue& aValue,
1566 tools::Rectangle &rNativeBoundingRegion,
1567 tools::Rectangle &rNativeContentRegion ) const;
1568protected:
1569 SAL_DLLPRIVATE float approximate_char_width() const;
1570private:
1571 SAL_DLLPRIVATE void ImplEnableRTL(bool bEnable);
1572};
1573
1574}
1575
1576#endif // INCLUDED_VCL_WINDOW_HXX
1577
1578/* 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:892
virtual bool IsChart() const
Definition: window.hxx:1456
void Hide()
Definition: window.hxx:885
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:1457
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 SetHelpId(const OString &) override
virtual void SetText(const OUString &rStr) 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:2310
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:352
VclAlign
Definition: vclenum.hxx:193
VclPackType
Definition: vclenum.hxx:201
TrackingEventFlags
Definition: vclenum.hxx:364
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