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