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