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