LibreOffice Module vcl (master)  1
layout.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 
10 #ifndef INCLUDED_VCL_LAYOUT_HXX
11 #define INCLUDED_VCL_LAYOUT_HXX
12 
13 #include <config_options.h>
14 #include <vcl/dllapi.h>
15 #include <vcl/ctrl.hxx>
16 #include <vcl/svapp.hxx>
17 #include <vcl/window.hxx>
18 #include <vcl/settings.hxx>
19 #include <vcl/event.hxx>
20 #include <vcl/transfer.hxx>
21 #include <vcl/vclptr.hxx>
22 #include <vcl/IContext.hxx>
23 #include <vcl/commandevent.hxx>
24 #include <set>
25 
26 class HelpEvent;
27 class ScrollBar;
28 class ScrollBarBox;
29 class Splitter;
30 
32  public vcl::IContext
33 {
34 public:
36 
37  //These take into account the external margins of the rWindow widget
38  //while GetOptimalSize/get_preferred_size and SetPosSizePixel are
39  //oblivious to them
40  static Size getLayoutRequisition(const vcl::Window &rWindow);
41  static void setLayoutPosSize(vcl::Window &rWindow, const Point &rPos, const Size &rSize);
42 
43  //applies the allocation pos and size onto rWindow via setLayoutPosSize taking into account
44  //the rWindows alignment desires within that allocation
45  static void setLayoutAllocation(vcl::Window &rWindow, const Point &rPos, const Size &rSize);
46 
47  virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
48 protected:
49  //these are the two that need to be implemented by
50  //containers, figure out how much space you want...
51  virtual Size calculateRequisition() const = 0;
52  //..and decide what to do when set to this size
53  virtual void setAllocation(const Size &rAllocation) = 0;
54 
55  virtual sal_uInt16 getDefaultAccessibleRole() const override;
56 
57  // support for screenshot context menu
58  virtual void Command(const CommandEvent& rCEvt) override;
59 
60 public:
61  //you don't want to override these
62  virtual Size GetOptimalSize() const override;
63  virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize) override;
64  virtual void SetPosPixel(const Point& rAllocPos) override;
65  virtual void SetSizePixel(const Size& rAllocation) override;
66 private:
68 };
69 
71 {
72 protected:
76 public:
77  VclBox(vcl::Window *pParent, bool bHomogeneous, int nSpacing)
78  : VclContainer(pParent)
79  , m_bHomogeneous(bHomogeneous)
80  , m_bVerticalContainer(false)
81  , m_nSpacing(nSpacing)
82  {
83  }
84  void set_spacing(int nSpacing)
85  {
86  m_nSpacing = nSpacing;
87  }
88  int get_spacing() const
89  {
90  return m_nSpacing;
91  }
92  void set_homogeneous(bool bHomogeneous)
93  {
94  m_bHomogeneous = bHomogeneous;
95  }
96  bool get_orientation() const
97  {
98  return m_bVerticalContainer;
99  }
100  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
101  virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
102 protected:
103  virtual sal_uInt16 getDefaultAccessibleRole() const override;
104  void accumulateMaxes(const Size &rChildSize, Size &rSize) const;
105  Size finalizeMaxes(const Size &rSize, sal_uInt16 nVisibleChildren) const;
106 
107  virtual Size calculateRequisition() const override;
108  virtual void setAllocation(const Size &rAllocation) override;
109 
110  virtual tools::Long getPrimaryDimension(const Size &rSize) const = 0;
111  virtual void setPrimaryDimension(Size &rSize, tools::Long) const = 0;
112  virtual tools::Long getPrimaryCoordinate(const Point &rPos) const = 0;
113  virtual void setPrimaryCoordinate(Point &rPos, tools::Long) const = 0;
114  virtual tools::Long getSecondaryDimension(const Size &rSize) const = 0;
115  virtual void setSecondaryDimension(Size &rSize, tools::Long) const = 0;
116 
117  virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const = 0;
118 };
119 
121 {
122 public:
123  VclVBox(vcl::Window *pParent, bool bHomogeneous = false, int nSpacing = 0)
124  : VclBox(pParent, bHomogeneous, nSpacing)
125  {
126  m_bVerticalContainer = true;
127  }
128 protected:
129  virtual tools::Long getPrimaryDimension(const Size &rSize) const override
130  {
131  return rSize.getHeight();
132  }
133  virtual void setPrimaryDimension(Size &rSize, tools::Long nHeight) const override
134  {
135  rSize.setHeight(nHeight);
136  }
137  virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
138  {
139  return rPos.getY();
140  }
141  virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
142  {
143  rPos.setY(nPos);
144  }
145  virtual tools::Long getSecondaryDimension(const Size &rSize) const override
146  {
147  return rSize.getWidth();
148  }
149  virtual void setSecondaryDimension(Size &rSize, tools::Long nWidth) const override
150  {
151  rSize.setWidth(nWidth);
152  }
153  virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
154  {
155  return rWindow.get_expand() || rWindow.get_vexpand();
156  }
157 };
158 
160 {
161 public:
162  VclHBox(vcl::Window *pParent, bool bHomogeneous = false, int nSpacing = 0)
163  : VclBox(pParent, bHomogeneous, nSpacing)
164  {
165  m_bVerticalContainer = false;
166  }
167 protected:
168  virtual tools::Long getPrimaryDimension(const Size &rSize) const override
169  {
170  return rSize.getWidth();
171  }
172  virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
173  {
174  rSize.setWidth(nWidth);
175  }
176  virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
177  {
178  return rPos.getX();
179  }
180  virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
181  {
182  rPos.setX(nPos);
183  }
184  virtual tools::Long getSecondaryDimension(const Size &rSize) const override
185  {
186  return rSize.getHeight();
187  }
188  virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
189  {
190  rSize.setHeight(nHeight);
191  }
192  virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
193  {
194  return rWindow.get_expand() || rWindow.get_hexpand();
195  }
196 };
197 
199 {
200  Default,
201  Spread,
202  Edge,
203  Start,
204  End,
205  Center
206 };
207 
209 {
210 public:
212  : VclBox(pParent, false, Application::GetSettings().GetStyleSettings().GetDialogStyle().button_spacing)
213  , m_eLayoutStyle(VclButtonBoxStyle::Default)
214  {
215  }
216  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
217  virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
218 protected:
219  virtual Size calculateRequisition() const override;
220  virtual void setAllocation(const Size &rAllocation) override;
221  Size addSpacing(const Size &rSize, sal_uInt16 nVisibleChildren) const;
222 private:
224  struct Requisition
225  {
226  std::vector<tools::Long> m_aMainGroupDimensions;
227  std::vector<tools::Long> m_aSubGroupDimensions;
230  };
231  Requisition calculatePrimarySecondaryRequisitions() const;
232  Size addReqGroups(const VclButtonBox::Requisition &rReq) const;
233 };
234 
236 {
237 public:
239  : VclButtonBox(pParent)
240  {
241  m_bVerticalContainer = true;
242  }
243 protected:
244  virtual tools::Long getPrimaryDimension(const Size &rSize) const override
245  {
246  return rSize.getHeight();
247  }
248  virtual void setPrimaryDimension(Size &rSize, tools::Long nHeight) const override
249  {
250  rSize.setHeight(nHeight);
251  }
252  virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
253  {
254  return rPos.getY();
255  }
256  virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
257  {
258  rPos.setY(nPos);
259  }
260  virtual tools::Long getSecondaryDimension(const Size &rSize) const override
261  {
262  return rSize.getWidth();
263  }
264  virtual void setSecondaryDimension(Size &rSize, tools::Long nWidth) const override
265  {
266  rSize.setWidth(nWidth);
267  }
268  virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
269  {
270  return rWindow.get_expand() || rWindow.get_vexpand();
271  }
272 };
273 
275 {
276 public:
278  : VclButtonBox(pParent)
279  {
280  m_bVerticalContainer = false;
281  }
282 private:
283  virtual tools::Long getPrimaryDimension(const Size &rSize) const override
284  {
285  return rSize.getWidth();
286  }
287  virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
288  {
289  rSize.setWidth(nWidth);
290  }
291  virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
292  {
293  return rPos.getX();
294  }
295  virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
296  {
297  rPos.setX(nPos);
298  }
299  virtual tools::Long getSecondaryDimension(const Size &rSize) const override
300  {
301  return rSize.getHeight();
302  }
303  virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
304  {
305  rSize.setHeight(nHeight);
306  }
307  virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
308  {
309  return rWindow.get_expand() || rWindow.get_hexpand();
310  }
311 };
312 
313 class VCL_DLLPUBLIC VclGrid final : public VclContainer
314 {
315 private:
320 
321 public:
322  struct Value
323  {
325  bool m_bExpand;
326  Value() : m_nValue(0), m_bExpand(false) {}
327  };
328 private:
329 
330  Size calculateRequisitionForSpacings(sal_Int32 nRowSpacing, sal_Int32 nColSpacing) const;
331  virtual Size calculateRequisition() const override;
332  virtual void setAllocation(const Size &rAllocation) override;
333  virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
334 public:
336  : VclContainer(pParent)
337  , m_bRowHomogeneous(false), m_bColumnHomogeneous(false)
338  , m_nRowSpacing(0), m_nColumnSpacing(0)
339  {
340  }
341  bool get_row_homogeneous() const
342  {
343  return m_bRowHomogeneous;
344  }
346  {
347  return m_bColumnHomogeneous;
348  }
349  void set_row_spacing(int nSpacing)
350  {
351  m_nRowSpacing = nSpacing;
352  }
353  void set_column_spacing(int nSpacing)
354  {
355  m_nColumnSpacing = nSpacing;
356  }
357  int get_row_spacing() const
358  {
359  return m_nRowSpacing;
360  }
361  int get_column_spacing() const
362  {
363  return m_nColumnSpacing;
364  }
365  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
366 };
367 
368 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) VclBin : public VclContainer
369 {
370 public:
371  VclBin(vcl::Window *pParent, WinBits nStyle = WB_HIDE | WB_CLIPCHILDREN)
372  : VclContainer(pParent, nStyle)
373  {
374  }
375  virtual vcl::Window *get_child();
376  virtual const vcl::Window *get_child() const;
377  virtual Size calculateRequisition() const override;
378  virtual void setAllocation(const Size &rAllocation) override;
379 };
380 
381 class VclPaned : public VclContainer
382 {
383 protected:
386 
387  VclPaned(vcl::Window *pParent, bool bVertical);
388 public:
389  virtual ~VclPaned() override;
390  virtual void dispose() override;
391  tools::Long get_position() const { return m_nPosition; }
392  virtual void set_position(tools::Long nPosition) { m_nPosition = nPosition; }
393 };
394 
395 class VclVPaned final : public VclPaned
396 {
397 private:
398  DECL_LINK(SplitHdl, Splitter*, void);
399  void arrange(const Size& rAllocation, tools::Long nFirstHeight, tools::Long nSecondHeight);
400 
401 public:
402  VclVPaned(vcl::Window *pParent);
403  virtual ~VclVPaned() override;
404  virtual Size calculateRequisition() const override;
405  virtual void setAllocation(const Size &rAllocation) override;
406  virtual void set_position(tools::Long nPosition) override;
407 };
408 
409 class VclHPaned final : public VclPaned
410 {
411 private:
412  DECL_LINK(SplitHdl, Splitter*, void);
413  void arrange(const Size& rAllocation, tools::Long nFirstHeight, tools::Long nSecondHeight);
414 
415 public:
416  VclHPaned(vcl::Window *pParent);
417  virtual ~VclHPaned() override;
418  virtual Size calculateRequisition() const override;
419  virtual void setAllocation(const Size &rAllocation) override;
420  virtual void set_position(tools::Long nPosition) override;
421 };
422 
423 class VclFrame final : public VclBin
424 {
425 private:
427 private:
428  friend class VclBuilder;
429  void designate_label(vcl::Window *pWindow);
430  DECL_LINK(WindowEventListener, VclWindowEvent&, void);
431 public:
433  : VclBin(pParent)
434  , m_pLabel(nullptr)
435  {
436  }
437  virtual ~VclFrame() override;
438  virtual void dispose() override;
439  void set_label(const OUString &rLabel);
440  OUString get_label() const;
441  virtual vcl::Window *get_child() override;
442  virtual const vcl::Window *get_child() const override;
443  vcl::Window *get_label_widget();
444  const vcl::Window *get_label_widget() const;
445  virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
446 private:
447  virtual Size calculateRequisition() const override;
448  virtual void setAllocation(const Size &rAllocation) override;
449  virtual OUString getDefaultAccessibleName() const override;
450 };
451 
452 class DisclosureButton;
453 class CheckBox;
454 
455 class VclExpander final : public VclBin
456 {
457 public:
458  VclExpander(vcl::Window *pParent);
459  virtual ~VclExpander() override;
460  virtual void dispose() override;
461  virtual vcl::Window *get_child() override;
462  virtual const vcl::Window *get_child() const override;
463  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
464  bool get_expanded() const;
465  void set_expanded(bool bExpanded);
466  void set_label(const OUString& rLabel);
467  OUString get_label() const;
468  vcl::Window *get_label_widget();
469  const vcl::Window *get_label_widget() const;
470  virtual void StateChanged(StateChangedType nType) override;
471  void SetExpandedHdl( const Link<VclExpander&,void>& rLink ) { maExpandedHdl = rLink; }
472  virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
473 private:
474  virtual Size calculateRequisition() const override;
475  virtual void setAllocation(const Size &rAllocation) override;
479  DECL_LINK(ClickHdl, CheckBox&, void);
480 };
481 
482 class VclScrolledWindow final : public VclBin
483 {
484 public:
485  VclScrolledWindow(vcl::Window *pParent );
486  virtual ~VclScrolledWindow() override;
487  virtual void dispose() override;
488  virtual vcl::Window *get_child() override;
489  virtual const vcl::Window *get_child() const override;
490  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
491  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
492  bool HasVisibleBorder() const { return m_eDrawFrameStyle != DrawFrameStyle::NONE; }
493  ScrollBar& getVertScrollBar() { return *m_pVScroll; }
494  ScrollBar& getHorzScrollBar() { return *m_pHScroll; }
495  Size getVisibleChildSize() const;
496  //set to true to disable the built-in scrolling callbacks to allow the user
497  //to override it
498  void setUserManagedScrolling(bool bUserManagedScrolling) { m_bUserManagedScrolling = bUserManagedScrolling;}
499  void doSetAllocation(const Size &rAllocation, bool bRetryOnFailure);
500 private:
501  virtual Size calculateRequisition() const override;
502  virtual void setAllocation(const Size &rAllocation) override;
503  int CalcBorderWidth() const;
504  DECL_LINK(ScrollBarHdl, ScrollBar*, void);
505  void InitScrollBars(const Size &rRequest);
506  virtual bool EventNotify(NotifyEvent& rNEvt) override;
514 };
515 
516 class VclViewport final : public VclBin
517 {
518 public:
520  : VclBin(pParent, WB_HIDE | WB_CLIPCHILDREN)
521  , m_bInitialAllocation(true)
522  {
523  }
524 private:
525  virtual void setAllocation(const Size &rAllocation) override;
527 };
528 
529 //Enforces that its children are always the same size as itself.
530 //Intercepts any Commands intended for its children.
531 //
532 //by default the Commands are discarded, inherit from this
533 //and implement "Command" to get them
534 class VclEventBox final : public VclBin
535 {
536 private:
537  //Any Commands an EventBoxHelper receives are forwarded to its parent
538  //The VclEventBox ensures that m_aEventBoxHelper is the
539  //first child and is transparent, but covers the rest of the children
540  class EventBoxHelper final : public vcl::Window
541  {
542  public:
544  : Window(pParent, 0)
545  {
546  SetSizePixel(pParent->GetSizePixel());
547  EnableChildTransparentMode();
548  SetPaintTransparent(true);
549  SetBackground();
550  }
551  virtual void Command(const CommandEvent& rCEvt) override
552  {
553  GetParent()->Command(rCEvt);
554  }
555  };
556 
558  virtual void dispose() override;
559  virtual ~VclEventBox() override;
560 public:
562  : VclBin(pParent)
563  , m_aEventBoxHelper(VclPtr<EventBoxHelper>::Create(this))
564  {
565  m_aEventBoxHelper->Show();
566  }
567  virtual vcl::Window *get_child() override;
568  virtual const vcl::Window *get_child() const override;
569  virtual Size calculateRequisition() const override;
570  virtual void setAllocation(const Size &rAllocation) override;
571 
572  virtual void Command(const CommandEvent& rCEvt) override;
573 };
574 
576 {
577 private:
578  std::set< VclPtr<vcl::Window> > m_aWindows;
581 
582  void trigger_queue_resize();
583 public:
585  : m_bIgnoreHidden(false)
586  , m_eMode(VclSizeGroupMode::Horizontal)
587  {
588  }
589  void insert(vcl::Window *pWindow)
590  {
591  m_aWindows.insert(VclPtr<vcl::Window>(pWindow));
592  }
593  void erase(vcl::Window *pWindow)
594  {
595  m_aWindows.erase(VclPtr<vcl::Window>(pWindow));
596  }
597  const std::set< VclPtr<vcl::Window> >& get_widgets() const
598  {
599  return m_aWindows;
600  }
601  std::set< VclPtr<vcl::Window> >& get_widgets()
602  {
603  return m_aWindows;
604  }
605  void set_ignore_hidden(bool bIgnoreHidden);
606  bool get_ignore_hidden() const
607  {
608  return m_bIgnoreHidden;
609  }
610  void set_mode(VclSizeGroupMode eMode);
612  {
613  return m_eMode;
614  }
615  void set_property(const OString &rKey, const OUString &rValue);
616 };
617 
619  , public DragSourceHelper
620 {
621 private:
623  void* m_pUserData;
639 
640  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override
641  {
642  m_aPaintHdl.Call(std::pair<vcl::RenderContext&, const tools::Rectangle&>(rRenderContext, rRect));
643  }
644  virtual void Resize() override
645  {
646  m_aResizeHdl.Call(GetOutputSizePixel());
647  }
648  virtual void MouseMove(const MouseEvent& rMEvt) override
649  {
650  if (!m_aMouseMotionHdl.Call(rMEvt))
651  Control::MouseMove(rMEvt);
652  }
653  virtual void KeyInput(const KeyEvent& rKEvt) override
654  {
655  if (!m_aKeyPressHdl.Call(rKEvt))
656  Control::KeyInput(rKEvt);
657 
658  }
659  virtual void KeyUp(const KeyEvent& rKEvt) override
660  {
661  if (!m_aKeyReleaseHdl.Call(rKEvt))
662  Control::KeyUp(rKEvt);
663  }
664  virtual void StateChanged(StateChangedType nType) override
665  {
666  Control::StateChanged(nType);
668  {
669  m_aStyleUpdatedHdl.Call(*this);
670  Invalidate();
671  }
672  }
673  virtual void DataChanged(const DataChangedEvent& rDCEvt) override
674  {
675  Control::DataChanged(rDCEvt);
677  {
678  m_aStyleUpdatedHdl.Call(*this);
679  Invalidate();
680  }
681  }
682  virtual void Command(const CommandEvent& rEvent) override
683  {
684  if (m_aCommandHdl.Call(rEvent))
685  return;
686  Control::Command(rEvent);
687  }
688  virtual void RequestHelp(const HelpEvent& rHelpEvent) override;
689  virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override;
690  virtual FactoryFunction GetUITestFactory() const override;
691 
692 public:
694  : Control(pParent, nStyle)
695  , DragSourceHelper(this)
696  , m_pFactoryFunction(nullptr)
697  , m_pUserData(nullptr)
698  , m_nDragAction(0)
699  {
700  SetBackground();
701  }
702  virtual void MouseButtonDown(const MouseEvent& rMEvt) override
703  {
704  if (!m_aMousePressHdl.Call(rMEvt))
706  }
707  virtual void MouseButtonUp(const MouseEvent& rMEvt) override
708  {
709  if (!m_aMouseReleaseHdl.Call(rMEvt))
710  Control::MouseButtonUp(rMEvt);
711  }
712  virtual OUString GetSurroundingText() const override;
713  virtual Selection GetSurroundingTextSelection() const override;
714  virtual bool DeleteSurroundingText(const Selection& rSelection) override;
715  void SetUITestFactory(FactoryFunction pFactoryFunction, void* pUserData)
716  {
717  m_pFactoryFunction = pFactoryFunction;
718  m_pUserData = pUserData;
719  }
720  void* GetUserData() const
721  {
722  return m_pUserData;
723  }
724  void SetPaintHdl(const Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>& rLink)
725  {
726  m_aPaintHdl = rLink;
727  }
729  {
730  m_aResizeHdl = rLink;
731  }
733  {
734  m_aMousePressHdl = rLink;
735  }
737  {
738  m_aMouseMotionHdl = rLink;
739  }
741  {
742  m_aMouseReleaseHdl = rLink;
743  }
745  {
746  m_aKeyPressHdl = rLink;
747  }
749  {
750  m_aKeyReleaseHdl = rLink;
751  }
753  {
754  m_aStyleUpdatedHdl = rLink;
755  }
757  {
758  m_aCommandHdl = rLink;
759  }
761  {
762  m_aQueryTooltipHdl = rLink;
763  }
765  {
766  m_aGetSurroundingHdl = rLink;
767  }
769  {
770  m_aDeleteSurroundingHdl = rLink;
771  }
773  {
774  m_aStartDragHdl = rLink;
775  }
777  {
778  m_xTransferHelper = rHelper;
779  m_nDragAction = eDNDConstants;
780  }
781  virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
782 };
783 
784 //Get first window of a pTopLevel window as
785 //if any intermediate layout widgets didn't exist
786 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::FirstChild);
787 //in a flat hierarchy where dialogs only have one layer
788 //of children
790 
791 //Get last window of a pTopLevel window as
792 //if any intermediate layout widgets didn't exist
793 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::LastChild);
794 //in a flat hierarchy where dialogs only have one layer
795 //of children
797 
798 //Get next window after pChild of a pTopLevel window as
799 //if any intermediate layout widgets didn't exist
800 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Next);
801 //in a flat hierarchy where dialogs only have one layer
802 //of children
803 vcl::Window* nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
804 
805 //Get previous window before pChild of a pTopLevel window as
806 //if any intermediate layout widgets didn't exist
807 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Prev);
808 //in a flat hierarchy where dialogs only have one layer
809 //of children
810 vcl::Window* prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
811 
812 //Returns true is the Window has a single child which is a container
813 VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow);
814 
815 inline bool isContainerWindow(const vcl::Window &rWindow)
816 {
817  WindowType eType = rWindow.GetType();
818  return eType == WindowType::CONTAINER || eType == WindowType::SCROLLWINDOW ||
819  (eType == WindowType::DOCKINGWINDOW && ::isLayoutEnabled(&rWindow));
820 }
821 
822 inline bool isContainerWindow(const vcl::Window *pWindow)
823 {
824  return pWindow && isContainerWindow(*pWindow);
825 }
826 
827 // retro-fitting utilities
828 
829 //Get a Size which is large enough to contain all children with
830 //an equal amount of space at top left and bottom right
832 
833 //Get first parent which is not a layout widget
835 
836 //Sort ok/cancel etc buttons in platform order
837 void sort_native_button_order(const VclBox& rContainer);
838 
839 #endif
840 
841 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void set_position(tools::Long nPosition)
Definition: layout.hxx:392
virtual void Command(const CommandEvent &rCEvt) override
Definition: layout.hxx:551
virtual sal_uInt16 getDefaultAccessibleRole() const override
Definition: layout.cxx:54
tools::Long m_nPosition
Definition: layout.hxx:385
void SetDeleteSurroundingHdl(const Link< const Selection &, bool > &rLink)
Definition: layout.hxx:768
bool m_bColumnHomogeneous
Definition: layout.hxx:317
virtual void setAllocation(const Size &rAllocation)=0
int get_column_spacing() const
Definition: layout.hxx:361
VclFrame(vcl::Window *pParent)
Definition: layout.hxx:432
DrawFrameFlags m_eDrawFrameFlags
Definition: layout.hxx:510
bool get_vexpand() const
Definition: window2.cxx:1722
vcl::Window * lastLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:196
VclPtr< ScrollBar > m_pHScroll
Definition: layout.hxx:512
Link< VclDrawingArea &, void > m_aStyleUpdatedHdl
Definition: layout.hxx:633
void setWidth(tools::Long nWidth)
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: layout.hxx:702
Link< std::pair< vcl::RenderContext &, const tools::Rectangle & >, void > m_aPaintHdl
Definition: layout.hxx:626
virtual void MouseButtonDown(const MouseEvent &rMEvt)
Definition: mouse.cxx:419
virtual tools::Long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:129
VclPtr< vcl::Window > m_pLabel
Definition: layout.hxx:426
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: layout.hxx:673
signed char sal_Int8
VclVBox(vcl::Window *pParent, bool bHomogeneous=false, int nSpacing=0)
Definition: layout.hxx:123
bool m_bVerticalContainer
Definition: layout.hxx:74
VclDrawingArea(vcl::Window *pParent, WinBits nStyle)
Definition: layout.hxx:693
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
VclPtr< DisclosureButton > m_pDisclosureButton
Definition: layout.hxx:477
bool get_hexpand() const
Definition: window2.cxx:1710
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
ScrollBar & getHorzScrollBar()
Definition: layout.hxx:494
long Long
VclViewport(vcl::Window *pParent)
Definition: layout.hxx:519
void SetMousePressHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:732
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:255
VclHButtonBox(vcl::Window *pParent)
Definition: layout.hxx:277
bool get_ignore_hidden() const
Definition: layout.hxx:606
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual Size GetSizePixel() const
Definition: window.cxx:2402
void * GetUserData() const
Definition: layout.hxx:720
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1256
virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:291
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: layout.hxx:648
virtual Size GetOptimalSize() const
Definition: window3.cxx:26
bool m_bRowHomogeneous
Definition: layout.hxx:316
void set_row_spacing(int nSpacing)
Definition: layout.hxx:349
DataChangedEventType GetType() const
Definition: event.hxx:362
vcl::Window * getNonLayoutParent(vcl::Window *pParent)
Definition: layout.cxx:2867
void set_spacing(int nSpacing)
Definition: layout.hxx:84
Link< const CommandEvent &, bool > m_aCommandHdl
Definition: layout.hxx:634
bool m_bExpand
Definition: layout.hxx:325
VclButtonBoxStyle
Definition: layout.hxx:198
Size getLegacyBestSizeForChildren(const vcl::Window &rWindow)
Definition: layout.cxx:2842
std::set< VclPtr< vcl::Window > > & get_widgets()
Definition: layout.hxx:601
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:307
void SetQueryTooltipHdl(const Link< tools::Rectangle &, OUString > &rLink)
Definition: layout.hxx:760
virtual void MouseButtonUp(const MouseEvent &rMEvt)
Definition: mouse.cxx:426
tools::Long m_nBorderWidth
Definition: layout.hxx:508
vcl::Window * prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
Definition: dialog.cxx:160
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: layout.hxx:653
virtual tools::Long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:184
void SetKeyReleaseHdl(const Link< const KeyEvent &, bool > &rLink)
Definition: layout.hxx:748
Link< const KeyEvent &, bool > m_aKeyReleaseHdl
Definition: layout.hxx:632
std::vector< tools::Long > m_aMainGroupDimensions
Definition: layout.hxx:226
StateChangedType
Definition: window.hxx:289
rtl::Reference< TransferDataContainer > m_xTransferHelper
Definition: layout.hxx:624
virtual void setPrimaryDimension(Size &rSize, tools::Long nHeight) const override
Definition: layout.hxx:133
void SetDragHelper(const rtl::Reference< TransferDataContainer > &rHelper, sal_uInt8 eDNDConstants)
Definition: layout.hxx:776
sal_Int64 WinBits
Link< OUString &, int > m_aGetSurroundingHdl
Definition: layout.hxx:636
std::set< VclPtr< vcl::Window > > m_aWindows
Definition: layout.hxx:578
VclHBox(vcl::Window *pParent, bool bHomogeneous=false, int nSpacing=0)
Definition: layout.hxx:162
bool m_bLayoutDirty
Definition: layout.hxx:67
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: window.cxx:3358
virtual Size calculateRequisition() const =0
Creates a hierarchy of vcl::Windows (widgets) from a .ui file for dialogs, sidebar, etc.
Definition: builder.hxx:66
virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
Definition: layout.hxx:172
AllSettingsFlags GetFlags() const
Definition: event.hxx:363
void SetKeyPressHdl(const Link< const KeyEvent &, bool > &rLink)
Definition: layout.hxx:744
virtual tools::Long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:244
VclSizeGroupMode
Definition: vclenum.hxx:261
virtual tools::Long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:260
Link< VclExpander &, void > maExpandedHdl
Definition: layout.hxx:478
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1321
sal_Int8 m_nDragAction
Definition: layout.hxx:625
constexpr tools::Long getHeight() const
int m_nRowSpacing
Definition: layout.hxx:318
WinBits const WB_HIDE
Link< VclDrawingArea *, bool > m_aStartDragHdl
Definition: layout.hxx:638
bool m_bResizeTopLevel
Definition: layout.hxx:476
void * m_pUserData
Definition: layout.hxx:623
bool isContainerWindow(const vcl::Window &rWindow)
Definition: layout.hxx:815
virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
Definition: layout.hxx:303
DocumentType eType
virtual tools::Long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:168
void SetExpandedHdl(const Link< VclExpander &, void > &rLink)
Definition: layout.hxx:471
virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:137
void SetStartDragHdl(const Link< VclDrawingArea *, bool > &rLink)
Definition: layout.hxx:772
void SetResizeHdl(const Link< const Size &, void > &rLink)
Definition: layout.hxx:728
void setUserManagedScrolling(bool bUserManagedScrolling)
Definition: layout.hxx:498
void erase(vcl::Window *pWindow)
Definition: layout.hxx:593
virtual tools::Long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:283
virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
Definition: layout.hxx:295
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:254
VclPtr< ScrollBarBox > m_aScrollBarBox
Definition: layout.hxx:513
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: layout.hxx:707
DrawFrameStyle m_eDrawFrameStyle
Definition: layout.hxx:509
VclPtr< ScrollBar > m_pVScroll
Definition: layout.hxx:511
void SetStyleUpdatedHdl(const Link< VclDrawingArea &, void > &rLink)
Definition: layout.hxx:752
virtual void Resize() override
Definition: layout.hxx:644
bool m_bIgnoreHidden
Definition: layout.hxx:579
void SetGetSurroundingHdl(const Link< OUString &, int > &rLink)
Definition: layout.hxx:764
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:168
void sort_native_button_order(const VclBox &rContainer)
Definition: layout.cxx:845
VclSizeGroupMode get_mode() const
Definition: layout.hxx:611
const std::set< VclPtr< vcl::Window > > & get_widgets() const
Definition: layout.hxx:597
VclSizeGroupMode m_eMode
Definition: layout.hxx:580
virtual sal_uInt16 getDefaultAccessibleRole() const
void set_homogeneous(bool bHomogeneous)
Definition: layout.hxx:92
EventBoxHelper(vcl::Window *pParent)
Definition: layout.hxx:543
virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:176
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:233
VclPtr< Splitter > m_pSplitter
Definition: layout.hxx:384
bool get_row_homogeneous() const
Definition: layout.hxx:341
virtual bool set_property(const OString &rKey, const OUString &rValue)
Definition: window2.cxx:1439
FactoryFunction m_pFactoryFunction
Definition: layout.hxx:622
bool get_orientation() const
Definition: layout.hxx:96
virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
Definition: layout.hxx:180
void SetPaintHdl(const Link< std::pair< vcl::RenderContext &, const tools::Rectangle & >, void > &rLink)
Definition: layout.hxx:724
virtual void KeyUp(const KeyEvent &rKEvt) override
Definition: layout.hxx:659
Link< const MouseEvent &, bool > m_aMouseMotionHdl
Definition: layout.hxx:629
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
Definition: window2.cxx:1262
bool get_expand() const
Definition: window2.cxx:1734
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: layout.hxx:640
Link< const Size &, void > m_aResizeHdl
Definition: layout.hxx:627
DrawFrameStyle
Definition: vclenum.hxx:334
VclButtonBox(vcl::Window *pParent)
Definition: layout.hxx:211
vcl::Window * firstLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:188
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1805
bool m_bInitialAllocation
Definition: layout.hxx:526
virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:252
Link< const MouseEvent &, bool > m_aMousePressHdl
Definition: layout.hxx:628
void SetUITestFactory(FactoryFunction pFactoryFunction, void *pUserData)
Definition: layout.hxx:715
VclVButtonBox(vcl::Window *pParent)
Definition: layout.hxx:238
Link< const MouseEvent &, bool > m_aMouseReleaseHdl
Definition: layout.hxx:630
WindowType
Definition: ctrl.hxx:81
bool get_column_homogeneous() const
Definition: layout.hxx:345
unsigned char sal_uInt8
int m_nSpacing
Definition: layout.hxx:75
virtual void DumpAsPropertyTree(tools::JsonWriter &) override
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: layout.cxx:384
virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
Definition: layout.hxx:188
VclPtr< EventBoxHelper > m_aEventBoxHelper
Definition: layout.hxx:557
void set_column_spacing(int nSpacing)
Definition: layout.hxx:353
virtual void setPrimaryDimension(Size &rSize, tools::Long nHeight) const override
Definition: layout.hxx:248
void SetCommandHdl(const Link< const CommandEvent &, bool > &rLink)
Definition: layout.hxx:756
virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
Definition: layout.hxx:141
QPRO_FUNC_TYPE nType
Link< tools::Rectangle &, OUString > m_aQueryTooltipHdl
Definition: layout.hxx:635
ScrollBar & getVertScrollBar()
Definition: layout.hxx:493
virtual void KeyUp(const KeyEvent &rKEvt)
Definition: window.cxx:1822
void insert(vcl::Window *pWindow)
Definition: layout.hxx:589
Link< const Selection &, bool > m_aDeleteSurroundingHdl
Definition: layout.hxx:637
VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow)
Definition: layout.cxx:2904
virtual void setSecondaryDimension(Size &rSize, tools::Long nWidth) const override
Definition: layout.hxx:264
VclBox(vcl::Window *pParent, bool bHomogeneous, int nSpacing)
Definition: layout.hxx:77
void setHeight(tools::Long nHeight)
WindowType GetType() const
Definition: window2.cxx:968
std::vector< tools::Long > m_aSubGroupDimensions
Definition: layout.hxx:227
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:413
virtual tools::Long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:299
virtual void setSecondaryDimension(Size &rSize, tools::Long nWidth) const override
Definition: layout.hxx:149
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:268
virtual void StateChanged(StateChangedType nType) override
Definition: layout.hxx:664
virtual Size calculateRequisition() const override
Definition: layout.cxx:232
int m_nColumnSpacing
Definition: layout.hxx:319
constexpr tools::Long getWidth() const
virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
Definition: layout.hxx:287
VclEventBox(vcl::Window *pParent)
Definition: layout.hxx:561
VclGrid(vcl::Window *pParent)
Definition: layout.hxx:335
void dispose()
vcl::Window * nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
Definition: dialog.cxx:132
DrawFrameFlags
Definition: vclenum.hxx:346
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1923
int get_row_spacing() const
Definition: layout.hxx:357
bool m_bUserManagedScrolling
Definition: layout.hxx:507
bool m_bHomogeneous
Definition: layout.hxx:73
WinBits const WB_CLIPCHILDREN
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1251
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:192
void SetMouseMoveHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:736
int get_spacing() const
Definition: layout.hxx:88
VclButtonBoxStyle m_eLayoutStyle
Definition: layout.hxx:223
virtual tools::Long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:145
virtual void Command(const CommandEvent &rEvent) override
Definition: layout.hxx:682
virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
Definition: layout.hxx:256
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
void SetMouseReleaseHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:740
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:153
tools::Long m_nValue
Definition: layout.hxx:324
Link< const KeyEvent &, bool > m_aKeyPressHdl
Definition: layout.hxx:631
bool HasVisibleBorder() const
Definition: layout.hxx:492
tools::Long get_position() const
Definition: layout.hxx:391
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: layout.cxx:373