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