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 // DialogControl-Flags
332 {
333  NONE = 0x0000,
334  Return = 0x0001,
335  WantFocus = 0x0002,
337 };
338 namespace 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 };
349 namespace 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
375 const char* ImplDbgCheckWindow( const void* pObj );
376 #endif
377 
378 namespace vcl { class Window; }
379 namespace vcl { class Cursor; }
380 namespace vcl { class WindowOutputDevice; }
381 class Dialog;
382 class Edit;
383 class WindowImpl;
384 class PaintHelper;
385 class VclSizeGroup;
386 class Application;
387 class WorkWindow;
388 class MessBox;
389 class MessageDialog;
390 class DockingWindow;
391 class FloatingWindow;
392 class GroupBox;
393 class PushButton;
394 class RadioButton;
395 class SalInstanceWidget;
396 class SystemChildWindow;
398 class ImplPopupFloatWin;
399 class LifecycleTest;
400 
401 
402 enum class WindowHitTest {
403  NONE = 0x0000,
404  Inside = 0x0001,
405  Transparent = 0x0002
406 };
407 namespace 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 };
422 namespace o3tl {
423  template<> struct typed_flags<WindowExtendedStyle> : is_typed_flags<WindowExtendedStyle, 0x0007> {};
424 };
425 
426 namespace vcl {
427 
429 {
430 public:
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 
441 class VCL_DLLPUBLIC Window : public virtual VclReferenceBase
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 
473 private:
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 
489 public:
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 
566 protected:
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( 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 
597 private:
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 
708 protected:
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 
721 public:
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,
932  PosSizeFlags nFlags = PosSizeFlags::All );
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,
958  ScrollFlags nFlags = ScrollFlags::NONE );
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 CaptureMouse();
1016  void ReleaseMouse();
1017  bool IsMouseCaptured() const;
1018 
1019  void SetPointer( PointerStyle );
1020  PointerStyle GetPointer() const;
1021  void EnableChildPointerOverwrite( bool bOverwrite );
1022  void SetPointerPosPixel( const Point& rPos );
1023  Point GetPointerPosPixel();
1024  Point GetLastPointerPosPixel();
1026  void SetLastMousePos(const Point& rPos);
1027  void ShowPointer( bool bVisible );
1028  void EnterWait();
1029  void LeaveWait();
1030  bool IsWait() const;
1031 
1032  void SetCursor( vcl::Cursor* pCursor );
1033  vcl::Cursor* GetCursor() const;
1034 
1035  void SetZoom( const Fraction& rZoom );
1036  const Fraction& GetZoom() const;
1037  bool IsZoom() const;
1038  tools::Long CalcZoom( tools::Long n ) const;
1039 
1040  virtual void SetText( const OUString& rStr );
1041  virtual OUString GetText() const;
1042  // return the actual text displayed
1043  // this may have e.g. accelerators removed or portions
1044  // replaced by ellipses
1045  virtual OUString GetDisplayText() const;
1046  // gets the visible background color. for transparent windows
1047  // this may be the parent's background color; for controls
1048  // this may be a child's background color (e.g. ListBox)
1049  virtual const Wallpaper& GetDisplayBackground() const;
1050 
1051  void SetHelpText( const OUString& rHelpText );
1052  const OUString& GetHelpText() const;
1053 
1054  void SetQuickHelpText( const OUString& rHelpText );
1055  const OUString& GetQuickHelpText() const;
1056 
1057  void SetHelpId( const OString& );
1058  const OString& GetHelpId() const;
1059 
1060  sal_uInt16 GetChildCount() const;
1061  vcl::Window* GetChild( sal_uInt16 nChild ) const;
1062  vcl::Window* GetWindow( GetWindowType nType ) const;
1063  bool IsChild( const vcl::Window* pWindow ) const;
1064  bool IsWindowOrChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
1065 
1067  SAL_DLLPRIVATE void CollectChildren(::std::vector<vcl::Window *>& rAllChildren );
1068 
1069  virtual void ShowFocus(const tools::Rectangle& rRect);
1070  void HideFocus();
1071 
1072  // transparent background for selected or checked items in toolboxes etc.
1073  void DrawSelectionBackground( const tools::Rectangle& rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder );
1074 
1075  void ShowTracking( const tools::Rectangle& rRect,
1077  void HideTracking();
1078  void InvertTracking( const tools::Rectangle& rRect, ShowTrackFlags nFlags );
1079 
1080  void StartTracking( StartTrackingFlags nFlags = StartTrackingFlags::NONE );
1081  void EndTracking( TrackingEventFlags nFlags = TrackingEventFlags::NONE );
1082  bool IsTracking() const;
1083 
1084  void StartAutoScroll( StartAutoScrollFlags nFlags );
1085  void EndAutoScroll();
1086 
1087  bool HandleScrollCommand( const CommandEvent& rCmd,
1088  ScrollBar* pHScrl,
1089  ScrollBar* pVScrl );
1090 
1091  virtual const SystemEnvData* GetSystemData() const;
1092 
1093  // API to set/query the component interfaces
1094  virtual css::uno::Reference< css::awt::XWindowPeer >
1095  GetComponentInterface( bool bCreate = true );
1096 
1097  void SetComponentInterface( css::uno::Reference< css::awt::XWindowPeer > const & xIFace );
1098 
1100  void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier, bool bParent = false);
1101  const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() const;
1102  vcl::LOKWindowId GetLOKWindowId() const;
1103 
1105  VclPtr<vcl::Window> GetParentWithLOKNotifier();
1106 
1108  void ReleaseLOKNotifier();
1109 
1111  static VclPtr<vcl::Window> FindLOKWindow(vcl::LOKWindowId nWindowId);
1112 
1114  static bool IsLOKWindowsEmpty();
1115 
1117  virtual void DumpAsPropertyTree(tools::JsonWriter&);
1118 
1120  virtual void LogicMouseButtonDown(const MouseEvent&) {};
1122  virtual void LogicMouseButtonUp(const MouseEvent&) {};
1124  virtual void LogicMouseMove(const MouseEvent&) {};
1125 
1128 public:
1130 
1131  css::uno::Reference< css::accessibility::XAccessible >
1132  GetAccessible( bool bCreate = true );
1133 
1134  virtual css::uno::Reference< css::accessibility::XAccessible >
1135  CreateAccessible();
1136 
1137  void SetAccessible( const css::uno::Reference< css::accessibility::XAccessible >& );
1138 
1139  vcl::Window* GetAccessibleParentWindow() const;
1140  sal_uInt16 GetAccessibleChildWindowCount();
1141  vcl::Window* GetAccessibleChildWindow( sal_uInt16 n );
1142 
1143  void SetAccessibleRole( sal_uInt16 nRole );
1144  sal_uInt16 GetAccessibleRole() const;
1145 
1146  void SetAccessibleName( const OUString& rName );
1147  OUString GetAccessibleName() const;
1148 
1149  void SetAccessibleDescription( const OUString& rDescr );
1150  OUString GetAccessibleDescription() const;
1151 
1152  void SetAccessibleRelationLabeledBy( vcl::Window* pLabeledBy );
1153  vcl::Window* GetAccessibleRelationLabeledBy() const;
1154 
1155  void SetAccessibleRelationLabelFor( vcl::Window* pLabelFor );
1156  vcl::Window* GetAccessibleRelationLabelFor() const;
1157 
1158  void SetAccessibleRelationMemberOf( vcl::Window* pMemberOf );
1159  vcl::Window* GetAccessibleRelationMemberOf() const;
1160 
1161  // to avoid sending accessibility events in cases like closing dialogs
1162  // by default checks complete parent path
1163  bool IsAccessibilityEventsSuppressed( bool bTraverseParentPath = true );
1164  void SetAccessibilityEventsSuppressed(bool bSuppressed);
1165 
1166  KeyEvent GetActivationKey() const;
1167 
1168 protected:
1169 
1170  // These eventually are supposed to go when everything is converted to .ui
1171  SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationMemberOf() const;
1172  SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabeledBy() const;
1173  SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabelFor() const;
1174 
1175  // Let Label override the code part of GetAccessibleRelationLabelFor
1176  virtual vcl::Window* getAccessibleRelationLabelFor() const;
1177  virtual sal_uInt16 getDefaultAccessibleRole() const;
1178  virtual OUString getDefaultAccessibleName() const;
1179 
1180  /*
1181  * Advisory Sizing - what is a good size for this widget
1182  *
1183  * Retrieves the preferred size of a widget ignoring
1184  * "width-request" and "height-request" properties.
1185  *
1186  * Implement this in sub-classes to tell layout
1187  * the preferred widget size.
1188  *
1189  * Use get_preferred_size to retrieve this value
1190  * cached and mediated via height and width requests
1191  */
1192  virtual Size GetOptimalSize() const;
1194  void InvalidateSizeCache();
1195 private:
1196 
1197  SAL_DLLPRIVATE bool ImplIsAccessibleCandidate() const;
1198  SAL_DLLPRIVATE bool ImplIsAccessibleNativeFrame() const;
1200 
1201  /*
1202  * Retrieves the preferred size of a widget taking
1203  * into account the "width-request" and "height-request" properties.
1204  *
1205  * Overrides the result of GetOptimalSize to honor the
1206  * width-request and height-request properties.
1207  *
1208  * So the same as get_ungrouped_preferred_size except
1209  * it ignores groups. A building block of get_preferred_size
1210  * that access the size cache
1211  *
1212  * @see get_preferred_size
1213  */
1214  Size get_ungrouped_preferred_size() const;
1215 public:
1216  /* records all DrawText operations within the passed rectangle;
1217  * a synchronous paint is sent to achieve this
1218  */
1219  void RecordLayoutData( vcl::ControlLayoutData* pLayout, const tools::Rectangle& rRect );
1220 
1221  // set and retrieve for Toolkit
1222  VCLXWindow* GetWindowPeer() const;
1223  void SetWindowPeer( css::uno::Reference< css::awt::XWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow );
1224 
1225  // remember if it was generated by Toolkit
1226  bool IsCreatedWithToolkit() const;
1227  void SetCreatedWithToolkit( bool b );
1228 
1229  // Drag and Drop interfaces
1230  css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget();
1231  css::uno::Reference< css::datatransfer::dnd::XDragSource > GetDragSource();
1232  css::uno::Reference< css::datatransfer::dnd::XDragGestureRecognizer > GetDragGestureRecognizer();
1233 
1234  // Clipboard/Selection interfaces
1235  css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard();
1237  void SetClipboard(css::uno::Reference<css::datatransfer::clipboard::XClipboard> const & xClipboard);
1238 
1239  /*
1240  * Widgets call this to inform their owner container that the widget wants
1241  * to renegotiate its size. Should be called when a widget has a new size
1242  * request. e.g. a FixedText Control gets a new label.
1243  *
1244  * akin to gtk_widget_queue_resize
1245  */
1246  virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout);
1247 
1248  /*
1249  * Sets the "height-request" property
1250  *
1251  * Override for height request of the widget, or -1 if natural request
1252  * should be used.
1253  *
1254  * @see get_preferred_size, set_width_request
1255  */
1256  void set_height_request(sal_Int32 nHeightRequest);
1257  sal_Int32 get_height_request() const;
1258 
1259  /*
1260  * Sets the "width-request" property
1261  *
1262  * Override for width request of the widget, or -1 if natural request
1263  * should be used.
1264  *
1265  * @see get_preferred_size, set_height_request
1266  */
1267  void set_width_request(sal_Int32 nWidthRequest);
1268  sal_Int32 get_width_request() const;
1269 
1270  /*
1271  * Retrieves the preferred size of a widget taking
1272  * into account the "width-request" and "height-request" properties.
1273  *
1274  * Overrides the result of GetOptimalSize to honor the
1275  * width-request and height-request properties.
1276  *
1277  * @see GetOptimalSize
1278  *
1279  * akin to gtk_widget_get_preferred_size
1280  */
1281  Size get_preferred_size() const;
1282 
1283  /*
1284  * How to horizontally align this widget
1285  */
1286  VclAlign get_halign() const;
1287  void set_halign(VclAlign eAlign);
1288 
1289  /*
1290  * How to vertically align this widget
1291  */
1292  VclAlign get_valign() const;
1293  void set_valign(VclAlign eAlign);
1294 
1295  /*
1296  * Whether the widget would like to use any available extra horizontal
1297  * space.
1298  */
1299  bool get_hexpand() const;
1300  void set_hexpand(bool bExpand);
1301 
1302  /*
1303  * Whether the widget would like to use any available extra vertical
1304  * space.
1305  */
1306  bool get_vexpand() const;
1307  void set_vexpand(bool bExpand);
1308 
1309  /*
1310  * Whether the widget would like to use any available extra space.
1311  */
1312  bool get_expand() const;
1313  void set_expand(bool bExpand);
1314 
1315  /*
1316  * Whether the widget should receive extra space when the parent grows
1317  */
1318  bool get_fill() const;
1319  void set_fill(bool bFill);
1320 
1321  void set_border_width(sal_Int32 nBorderWidth);
1322  sal_Int32 get_border_width() const;
1323 
1324  void set_margin_start(sal_Int32 nWidth);
1325  sal_Int32 get_margin_start() const;
1326 
1327  void set_margin_end(sal_Int32 nWidth);
1328  sal_Int32 get_margin_end() const;
1329 
1330  void set_margin_top(sal_Int32 nWidth);
1331  sal_Int32 get_margin_top() const;
1332 
1333  void set_margin_bottom(sal_Int32 nWidth);
1334  sal_Int32 get_margin_bottom() const;
1335 
1336  /*
1337  * How the widget is packed with reference to the start or end of the parent
1338  */
1339  VclPackType get_pack_type() const;
1340  void set_pack_type(VclPackType ePackType);
1341 
1342  /*
1343  * The extra space to put between the widget and its neighbors
1344  */
1345  sal_Int32 get_padding() const;
1346  void set_padding(sal_Int32 nPadding);
1347 
1348  /*
1349  * The number of columns that the widget spans
1350  */
1351  sal_Int32 get_grid_width() const;
1352  void set_grid_width(sal_Int32 nCols);
1353 
1354  /*
1355  * The column number to attach the left side of the widget to
1356  */
1357  sal_Int32 get_grid_left_attach() const;
1358  void set_grid_left_attach(sal_Int32 nAttach);
1359 
1360  /*
1361  * The number of row that the widget spans
1362  */
1363  sal_Int32 get_grid_height() const;
1364  void set_grid_height(sal_Int32 nRows);
1365 
1366  /*
1367  * The row number to attach the top side of the widget to
1368  */
1369  sal_Int32 get_grid_top_attach() const;
1370  void set_grid_top_attach(sal_Int32 nAttach);
1371 
1372  /*
1373  * If true this child appears in a secondary layout group of children
1374  * e.g. help buttons in a buttonbox
1375  */
1376  bool get_secondary() const;
1377  void set_secondary(bool bSecondary);
1378 
1379  /*
1380  * If true this child is exempted from homogeneous sizing
1381  * e.g. special button in a buttonbox
1382  */
1383  bool get_non_homogeneous() const;
1384  void set_non_homogeneous(bool bNonHomogeneous);
1385 
1386  /*
1387  * Sets a widget property
1388  *
1389  * @return false if property is unknown
1390  */
1391  virtual bool set_property(const OString &rKey, const OUString &rValue);
1392 
1393  /*
1394  * Sets a font attribute
1395  *
1396  * @return false if attribute is unknown
1397  */
1398  bool set_font_attribute(const OString &rKey, const OUString &rValue);
1399 
1400  /*
1401  * Adds this widget to the xGroup VclSizeGroup
1402  *
1403  */
1404  void add_to_size_group(const std::shared_ptr<VclSizeGroup>& xGroup);
1405  void remove_from_all_size_groups();
1406 
1407  /*
1408  * add/remove mnemonic label
1409  */
1410  void add_mnemonic_label(FixedText *pLabel);
1411  void remove_mnemonic_label(FixedText *pLabel);
1412  const std::vector<VclPtr<FixedText> >& list_mnemonic_labels() const;
1413 
1414  /*
1415  * Move this widget to be the nNewPosition'd child of its parent
1416  */
1417  void reorderWithinParent(sal_uInt16 nNewPosition);
1418 
1422  void set_id(const OUString& rID);
1423 
1427  const OUString& get_id() const;
1428 
1429 
1430  // Native Widget Rendering functions
1431 
1432 
1433  // form controls must never use native widgets, this can be toggled here
1434  void EnableNativeWidget( bool bEnable = true );
1435  bool IsNativeWidgetEnabled() const;
1436 
1437  // a helper method for a Control's Draw method
1438  void PaintToDevice( ::OutputDevice* pDevice, const Point& rPos );
1439 
1440  // Keyboard access functions
1441 
1450  KeyIndicatorState GetIndicatorState() const;
1451 
1452  void SimulateKeyPress( sal_uInt16 nKeyCode ) const;
1453 
1454  virtual OUString GetSurroundingText() const;
1455  virtual Selection GetSurroundingTextSelection() const;
1456  virtual bool DeleteSurroundingText(const Selection& rSelection);
1457 
1458  virtual FactoryFunction GetUITestFactory() const;
1459 
1460  virtual bool IsChart() const { return false; }
1461 
1462  void SetHelpHdl(const Link<vcl::Window&, bool>& rLink);
1463  void SetMnemonicActivateHdl(const Link<vcl::Window&, bool>& rLink);
1464  void SetModalHierarchyHdl(const Link<bool, void>& rLink);
1465  void SetDumpAsPropertyTreeHdl(const Link<tools::JsonWriter&, void>& rLink);
1466 
1467  Size GetOutputSizePixel() const;
1468  tools::Rectangle GetOutputRectPixel() const;
1469 
1470  Point LogicToPixel( const Point& rLogicPt ) const;
1471  Size LogicToPixel( const Size& rLogicSize ) const;
1472  tools::Rectangle LogicToPixel( const tools::Rectangle& rLogicRect ) const;
1473  vcl::Region LogicToPixel( const vcl::Region& rLogicRegion )const;
1474  Point LogicToPixel( const Point& rLogicPt,
1475  const MapMode& rMapMode ) const;
1476  Size LogicToPixel( const Size& rLogicSize,
1477  const MapMode& rMapMode ) const;
1478  tools::Rectangle LogicToPixel( const tools::Rectangle& rLogicRect,
1479  const MapMode& rMapMode ) const;
1480 
1481  Point PixelToLogic( const Point& rDevicePt ) const;
1482  Size PixelToLogic( const Size& rDeviceSize ) const;
1483  tools::Rectangle PixelToLogic( const tools::Rectangle& rDeviceRect ) const;
1484  tools::PolyPolygon PixelToLogic( const tools::PolyPolygon& rDevicePolyPoly ) const;
1485  vcl::Region PixelToLogic( const vcl::Region& rDeviceRegion ) const;
1486  Point PixelToLogic( const Point& rDevicePt,
1487  const MapMode& rMapMode ) const;
1488  Size PixelToLogic( const Size& rDeviceSize,
1489  const MapMode& rMapMode ) const;
1490  tools::Rectangle PixelToLogic( const tools::Rectangle& rDeviceRect,
1491  const MapMode& rMapMode ) const;
1492 
1493  Size LogicToLogic( const Size& rSzSource,
1494  const MapMode* pMapModeSource,
1495  const MapMode* pMapModeDest ) const;
1496 
1497  const AllSettings& GetSettings() const;
1498  void SetSettings( const AllSettings& rSettings );
1499  void SetSettings( const AllSettings& rSettings, bool bChild );
1500 
1501  tools::Rectangle GetTextRect( const tools::Rectangle& rRect,
1502  const OUString& rStr, DrawTextFlags nStyle = DrawTextFlags::WordBreak,
1503  TextRectInfo* pInfo = nullptr,
1504  const vcl::ITextLayout* _pTextLayout = nullptr ) const;
1505  float GetDPIScaleFactor() const;
1506  tools::Long GetOutOffXPixel() const;
1507  tools::Long GetOutOffYPixel() const;
1508 
1509  void EnableMapMode( bool bEnable = true );
1510  bool IsMapModeEnabled() const;
1511  void SetMapMode();
1512  void SetMapMode( const MapMode& rNewMapMode );
1513 
1514  // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphicsLayout
1515  virtual void EnableRTL( bool bEnable = true);
1516  bool IsRTLEnabled() const;
1517 
1518  void SetFont( const vcl::Font& rNewFont );
1519  const vcl::Font& GetFont() const;
1520 
1525  tools::Long GetTextWidth( const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
1526  vcl::text::TextLayoutCache const* = nullptr,
1527  SalLayoutGlyphs const*const pLayoutCache = nullptr) const;
1528 
1533  tools::Long GetTextHeight() const;
1534  float approximate_digit_width() const;
1535 
1536  void SetTextColor( const Color& rColor );
1537  const Color& GetTextColor() const;
1538 
1539  void SetTextFillColor();
1540  void SetTextFillColor( const Color& rColor );
1541  Color GetTextFillColor() const;
1542  bool IsTextFillColor() const;
1543 
1544  void SetTextLineColor();
1545  void SetTextLineColor( const Color& rColor );
1546  const Color& GetTextLineColor() const;
1547  bool IsTextLineColor() const;
1548 
1549  void SetOverlineColor();
1550  void SetOverlineColor( const Color& rColor );
1551  const Color& GetOverlineColor() const;
1552  bool IsOverlineColor() const;
1553 
1554  void SetTextAlign( TextAlign eAlign );
1555  TextAlign GetTextAlign() const;
1556 
1559  bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) const;
1560 
1561  static OUString GetNonMnemonicString(const OUString& rStr) { return OutputDevice::GetNonMnemonicString(rStr); }
1562 
1565  bool GetNativeControlRegion(
1566  ControlType nType,
1567  ControlPart nPart,
1568  const tools::Rectangle& rControlRegion,
1569  ControlState nState,
1570  const ImplControlValue& aValue,
1571  tools::Rectangle &rNativeBoundingRegion,
1572  tools::Rectangle &rNativeContentRegion ) const;
1573 protected:
1574  SAL_DLLPRIVATE float approximate_char_width() const;
1575 private:
1576  SAL_DLLPRIVATE void ImplEnableRTL(bool bEnable);
1577 };
1578 
1579 }
1580 
1581 #endif // INCLUDED_VCL_WINDOW_HXX
1582 
1583 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
The child windows are invalidated, too.
WindowHitTest
Definition: window.hxx:402
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:412
Visible
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
ValidateFlags
Definition: window.hxx:208
long Long
Color GetTextColor(Color const &rColor, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
Definition: drawmode.cxx:128
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:527
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:1561
GetDlgWindowType
Definition: window.hxx:368
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:2274
void Hide()
Definition: window.hxx:884
VclEventId
Definition: vclevent.hxx:37
SystemTextColorFlags
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:331
VclPackType
Definition: vclenum.hxx:220
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:168
ActivateModeFlags
Definition: window.hxx:158
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:483
EndExtTextInputFlags
Definition: window.hxx:344
TrackingEventFlags
Definition: vclenum.hxx:401
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:233
vcl::Font GetFont(vcl::Font const &rFont, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
Definition: drawmode.cxx:159
virtual bool IsChart() const
Definition: window.hxx:1460
void Disable(bool bChild=true)
Definition: window.hxx:891
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:1122
WindowType
State
void SetPointFont(OutputDevice &rDevice, const vcl::Font &rFont)
Definition: weldutils.cxx:617
PointerStyle
Definition: ptrstyle.hxx:25
ShowFlags
Definition: vclenum.hxx:389
virtual void LogicMouseButtonDown(const MouseEvent &)
Same as MouseButtonDown(), but coordinates are in logic unit. used for LOK.
Definition: window.hxx:1120
VclAlign
Definition: vclenum.hxx:212
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:1124
void dispose()
static OUString GetNonMnemonicString(const OUString &rStr, sal_Int32 &rMnemonicPos)
Definition: text.cxx:2198
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)