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/help.hxx>
17 #include <vcl/svapp.hxx>
18 #include <vcl/window.hxx>
19 #include <vcl/settings.hxx>
20 #include <vcl/event.hxx>
21 #include <vcl/transfer.hxx>
22 #include <vcl/vclptr.hxx>
23 #include <vcl/IContext.hxx>
24 #include <vcl/commandevent.hxx>
25 #include <set>
26 
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 VCL_DLLPUBLIC 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  // sets new border size and adapts scrollbar and child widget position/size as needed
504  void updateBorderWidth(tools::Long nBorderWidth);
505  DECL_LINK(ScrollBarHdl, ScrollBar*, void);
506  void InitScrollBars(const Size &rRequest);
507  virtual bool EventNotify(NotifyEvent& rNEvt) override;
515 };
516 
517 class VclViewport final : public VclBin
518 {
519 public:
521  : VclBin(pParent, WB_HIDE | WB_CLIPCHILDREN)
522  , m_bInitialAllocation(true)
523  {
524  }
525 private:
526  virtual void setAllocation(const Size &rAllocation) override;
528 };
529 
530 //Enforces that its children are always the same size as itself.
531 //Intercepts any Commands intended for its children.
532 //
533 //by default the Commands are discarded, inherit from this
534 //and implement "Command" to get them
535 class VclEventBox final : public VclBin
536 {
537 private:
538  //Any Commands an EventBoxHelper receives are forwarded to its parent
539  //The VclEventBox ensures that m_aEventBoxHelper is the
540  //first child and is transparent, but covers the rest of the children
542  {
543  public:
545  : Window(pParent, 0)
546  {
547  SetSizePixel(pParent->GetSizePixel());
548  EnableChildTransparentMode();
549  SetPaintTransparent(true);
550  SetBackground();
551  }
552  virtual void Command(const CommandEvent& rCEvt) override
553  {
554  GetParent()->Command(rCEvt);
555  }
556  };
557 
559  virtual void dispose() override;
560  virtual ~VclEventBox() override;
561 public:
563  : VclBin(pParent)
564  , m_aEventBoxHelper(VclPtr<EventBoxHelper>::Create(this))
565  {
566  m_aEventBoxHelper->Show();
567  }
568  virtual vcl::Window *get_child() override;
569  virtual const vcl::Window *get_child() const override;
570  virtual Size calculateRequisition() const override;
571  virtual void setAllocation(const Size &rAllocation) override;
572 
573  virtual void Command(const CommandEvent& rCEvt) override;
574 };
575 
577 {
578 private:
579  std::set< VclPtr<vcl::Window> > m_aWindows;
582 
583  void trigger_queue_resize();
584 public:
586  : m_bIgnoreHidden(false)
587  , m_eMode(VclSizeGroupMode::Horizontal)
588  {
589  }
590  void insert(vcl::Window *pWindow)
591  {
592  m_aWindows.insert(VclPtr<vcl::Window>(pWindow));
593  }
594  void erase(vcl::Window *pWindow)
595  {
596  m_aWindows.erase(VclPtr<vcl::Window>(pWindow));
597  }
598  const std::set< VclPtr<vcl::Window> >& get_widgets() const
599  {
600  return m_aWindows;
601  }
602  std::set< VclPtr<vcl::Window> >& get_widgets()
603  {
604  return m_aWindows;
605  }
606  void set_ignore_hidden(bool bIgnoreHidden);
607  bool get_ignore_hidden() const
608  {
609  return m_bIgnoreHidden;
610  }
611  void set_mode(VclSizeGroupMode eMode);
613  {
614  return m_eMode;
615  }
616  void set_property(const OString &rKey, const OUString &rValue);
617 };
618 
620  , public DragSourceHelper
621 {
622 private:
624  void* m_pUserData;
640 
641  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override
642  {
643  m_aPaintHdl.Call(std::pair<vcl::RenderContext&, const tools::Rectangle&>(rRenderContext, rRect));
644  }
645  virtual void Resize() override
646  {
647  m_aResizeHdl.Call(GetOutputSizePixel());
648  }
649  virtual void MouseMove(const MouseEvent& rMEvt) override
650  {
651  if (!m_aMouseMotionHdl.Call(rMEvt))
652  Control::MouseMove(rMEvt);
653  }
654  virtual void KeyInput(const KeyEvent& rKEvt) override
655  {
656  if (!m_aKeyPressHdl.Call(rKEvt))
657  Control::KeyInput(rKEvt);
658 
659  }
660  virtual void KeyUp(const KeyEvent& rKEvt) override
661  {
662  if (!m_aKeyReleaseHdl.Call(rKEvt))
663  Control::KeyUp(rKEvt);
664  }
665  virtual void StateChanged(StateChangedType nType) override
666  {
667  Control::StateChanged(nType);
669  {
670  m_aStyleUpdatedHdl.Call(*this);
671  Invalidate();
672  }
673  }
674  virtual void DataChanged(const DataChangedEvent& rDCEvt) override
675  {
676  Control::DataChanged(rDCEvt);
678  {
679  m_aStyleUpdatedHdl.Call(*this);
680  Invalidate();
681  }
682  }
683  virtual void Command(const CommandEvent& rEvent) override
684  {
685  if (m_aCommandHdl.Call(rEvent))
686  return;
687  Control::Command(rEvent);
688  }
689  virtual void RequestHelp(const HelpEvent& rHelpEvent) override
690  {
691  if (rHelpEvent.GetMode() & (HelpEventMode::QUICK | HelpEventMode::BALLOON))
692  {
693  Point aPos(ScreenToOutputPixel(rHelpEvent.GetMousePosPixel()));
694  tools::Rectangle aHelpArea(aPos.X(), aPos.Y());
695  OUString sHelpTip = m_aQueryTooltipHdl.Call(aHelpArea);
696  if (sHelpTip.isEmpty())
697  return;
698  Point aPt = OutputToScreenPixel(aHelpArea.TopLeft());
699  aHelpArea.SetLeft(aPt.X());
700  aHelpArea.SetTop(aPt.Y());
701  aPt = OutputToScreenPixel(aHelpArea.BottomRight());
702  aHelpArea.SetRight(aPt.X());
703  aHelpArea.SetBottom(aPt.Y());
704  // tdf#125369 recover newline support of tdf#101779
705  QuickHelpFlags eHelpWinStyle = sHelpTip.indexOf('\n') != -1 ? QuickHelpFlags::TipStyleBalloon : QuickHelpFlags::NONE;
706  Help::ShowQuickHelp(this, aHelpArea, sHelpTip, eHelpWinStyle);
707  }
708  }
709  virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override;
710  virtual FactoryFunction GetUITestFactory() const override
711  {
712  if (m_pFactoryFunction)
713  return m_pFactoryFunction;
714  return Control::GetUITestFactory();
715  }
716 
717 public:
719  : Control(pParent, nStyle)
720  , DragSourceHelper(this)
721  , m_pFactoryFunction(nullptr)
722  , m_pUserData(nullptr)
723  , m_nDragAction(0)
724  {
725  SetBackground();
726  }
727  virtual void MouseButtonDown(const MouseEvent& rMEvt) override
728  {
729  if (!m_aMousePressHdl.Call(rMEvt))
731  }
732  virtual void MouseButtonUp(const MouseEvent& rMEvt) override
733  {
734  if (!m_aMouseReleaseHdl.Call(rMEvt))
735  Control::MouseButtonUp(rMEvt);
736  }
737  virtual OUString GetSurroundingText() const override;
738  virtual Selection GetSurroundingTextSelection() const override;
739  virtual bool DeleteSurroundingText(const Selection& rSelection) override;
740  void SetUITestFactory(FactoryFunction pFactoryFunction, void* pUserData)
741  {
742  m_pFactoryFunction = pFactoryFunction;
743  m_pUserData = pUserData;
744  }
745  void* GetUserData() const
746  {
747  return m_pUserData;
748  }
749  void SetPaintHdl(const Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>& rLink)
750  {
751  m_aPaintHdl = rLink;
752  }
754  {
755  m_aResizeHdl = rLink;
756  }
758  {
759  m_aMousePressHdl = rLink;
760  }
762  {
763  m_aMouseMotionHdl = rLink;
764  }
766  {
767  m_aMouseReleaseHdl = rLink;
768  }
770  {
771  m_aKeyPressHdl = rLink;
772  }
774  {
775  m_aKeyReleaseHdl = rLink;
776  }
778  {
779  m_aStyleUpdatedHdl = rLink;
780  }
782  {
783  m_aCommandHdl = rLink;
784  }
786  {
787  m_aQueryTooltipHdl = rLink;
788  }
790  {
791  m_aGetSurroundingHdl = rLink;
792  }
794  {
795  m_aDeleteSurroundingHdl = rLink;
796  }
798  {
799  m_aStartDragHdl = rLink;
800  }
802  {
803  m_xTransferHelper = rHelper;
804  m_nDragAction = eDNDConstants;
805  }
806  virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
807 };
808 
809 //Get first window of a pTopLevel window as
810 //if any intermediate layout widgets didn't exist
811 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::FirstChild);
812 //in a flat hierarchy where dialogs only have one layer
813 //of children
815 
816 //Get last window of a pTopLevel window as
817 //if any intermediate layout widgets didn't exist
818 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::LastChild);
819 //in a flat hierarchy where dialogs only have one layer
820 //of children
822 
823 //Get next window after pChild of a pTopLevel window as
824 //if any intermediate layout widgets didn't exist
825 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Next);
826 //in a flat hierarchy where dialogs only have one layer
827 //of children
828 vcl::Window* nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
829 
830 //Get previous window before pChild of a pTopLevel window as
831 //if any intermediate layout widgets didn't exist
832 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Prev);
833 //in a flat hierarchy where dialogs only have one layer
834 //of children
835 vcl::Window* prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
836 
837 //Returns true is the Window has a single child which is a container
838 VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow);
839 
840 inline bool isContainerWindow(const vcl::Window &rWindow)
841 {
842  WindowType eType = rWindow.GetType();
843  return eType == WindowType::CONTAINER || eType == WindowType::SCROLLWINDOW ||
844  (eType == WindowType::DOCKINGWINDOW && ::isLayoutEnabled(&rWindow));
845 }
846 
847 inline bool isContainerWindow(const vcl::Window *pWindow)
848 {
849  return pWindow && isContainerWindow(*pWindow);
850 }
851 
852 // retro-fitting utilities
853 
854 //Get a Size which is large enough to contain all children with
855 //an equal amount of space at top left and bottom right
857 
858 //Get first parent which is not a layout widget
860 
861 //Sort ok/cancel etc buttons in platform order
862 void sort_native_button_order(const VclBox& rContainer);
863 
864 #endif
865 
866 /* 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:552
virtual sal_uInt16 getDefaultAccessibleRole() const override
Definition: layout.cxx:46
tools::Long m_nPosition
Definition: layout.hxx:385
void SetDeleteSurroundingHdl(const Link< const Selection &, bool > &rLink)
Definition: layout.hxx:793
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:511
bool get_vexpand() const
Definition: window2.cxx:1726
virtual FactoryFunction GetUITestFactory() const
Definition: window.cxx:3938
vcl::Window * lastLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:197
VclPtr< ScrollBar > m_pHScroll
Definition: layout.hxx:513
Link< VclDrawingArea &, void > m_aStyleUpdatedHdl
Definition: layout.hxx:634
void setWidth(tools::Long nWidth)
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: layout.hxx:727
Link< std::pair< vcl::RenderContext &, const tools::Rectangle & >, void > m_aPaintHdl
Definition: layout.hxx:627
virtual void MouseButtonDown(const MouseEvent &rMEvt)
Definition: mouse.cxx:413
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:674
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:718
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
VclPtr< DisclosureButton > m_pDisclosureButton
Definition: layout.hxx:477
tools::Long getWidth() const
bool get_hexpand() const
Definition: window2.cxx:1714
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
ScrollBar & getHorzScrollBar()
Definition: layout.hxx:494
long Long
VclViewport(vcl::Window *pParent)
Definition: layout.hxx:520
void SetMousePressHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:757
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:260
VclHButtonBox(vcl::Window *pParent)
Definition: layout.hxx:277
bool get_ignore_hidden() const
Definition: layout.hxx:607
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual Size GetSizePixel() const
Definition: window.cxx:2393
void * GetUserData() const
Definition: layout.hxx:745
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1260
virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:291
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: layout.hxx:649
virtual Size GetOptimalSize() const
Definition: window3.cxx:33
bool m_bRowHomogeneous
Definition: layout.hxx:316
void set_row_spacing(int nSpacing)
Definition: layout.hxx:349
DataChangedEventType GetType() const
Definition: event.hxx:356
vcl::Window * getNonLayoutParent(vcl::Window *pParent)
Definition: layout.cxx:2829
void set_spacing(int nSpacing)
Definition: layout.hxx:84
Link< const CommandEvent &, bool > m_aCommandHdl
Definition: layout.hxx:635
bool m_bExpand
Definition: layout.hxx:325
VclButtonBoxStyle
Definition: layout.hxx:198
Size getLegacyBestSizeForChildren(const vcl::Window &rWindow)
Definition: layout.cxx:2804
std::set< VclPtr< vcl::Window > > & get_widgets()
Definition: layout.hxx:602
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:307
void SetQueryTooltipHdl(const Link< tools::Rectangle &, OUString > &rLink)
Definition: layout.hxx:785
virtual void MouseButtonUp(const MouseEvent &rMEvt)
Definition: mouse.cxx:420
tools::Long m_nBorderWidth
Definition: layout.hxx:509
vcl::Window * prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
Definition: dialog.cxx:161
HelpEventMode GetMode() const
Definition: event.hxx:205
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: layout.hxx:654
virtual tools::Long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:184
void SetKeyReleaseHdl(const Link< const KeyEvent &, bool > &rLink)
Definition: layout.hxx:773
Link< const KeyEvent &, bool > m_aKeyReleaseHdl
Definition: layout.hxx:633
std::vector< tools::Long > m_aMainGroupDimensions
Definition: layout.hxx:226
StateChangedType
Definition: window.hxx:317
css::uno::Any const & rValue
rtl::Reference< TransferDataContainer > m_xTransferHelper
Definition: layout.hxx:625
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:801
sal_Int64 WinBits
Link< OUString &, int > m_aGetSurroundingHdl
Definition: layout.hxx:637
std::set< VclPtr< vcl::Window > > m_aWindows
Definition: layout.hxx:579
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:3340
virtual Size calculateRequisition() const =0
Creates a hierarchy of vcl::Windows (widgets) from a .ui file for dialogs, sidebar, etc.
Definition: builder.hxx:65
virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
Definition: layout.hxx:172
AllSettingsFlags GetFlags() const
Definition: event.hxx:357
void SetKeyPressHdl(const Link< const KeyEvent &, bool > &rLink)
Definition: layout.hxx:769
virtual tools::Long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:244
VclSizeGroupMode
Definition: vclenum.hxx:263
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:1325
sal_Int8 m_nDragAction
Definition: layout.hxx:626
virtual FactoryFunction GetUITestFactory() const override
Definition: layout.hxx:710
force balloon-style in ShowPopover and ShowQuickHelp
int m_nRowSpacing
Definition: layout.hxx:318
WinBits const WB_HIDE
Link< VclDrawingArea *, bool > m_aStartDragHdl
Definition: layout.hxx:639
bool m_bResizeTopLevel
Definition: layout.hxx:476
void * m_pUserData
Definition: layout.hxx:624
bool isContainerWindow(const vcl::Window &rWindow)
Definition: layout.hxx:840
virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
Definition: layout.hxx:303
const Point & GetMousePosPixel() const
Definition: event.hxx:204
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
tools::Long getHeight() const
void SetStartDragHdl(const Link< VclDrawingArea *, bool > &rLink)
Definition: layout.hxx:797
void SetResizeHdl(const Link< const Size &, void > &rLink)
Definition: layout.hxx:753
void setUserManagedScrolling(bool bUserManagedScrolling)
Definition: layout.hxx:498
void erase(vcl::Window *pWindow)
Definition: layout.hxx:594
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:246
VclPtr< ScrollBarBox > m_aScrollBarBox
Definition: layout.hxx:514
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: layout.hxx:732
DrawFrameStyle m_eDrawFrameStyle
Definition: layout.hxx:510
VclPtr< ScrollBar > m_pVScroll
Definition: layout.hxx:512
void SetStyleUpdatedHdl(const Link< VclDrawingArea &, void > &rLink)
Definition: layout.hxx:777
virtual void Resize() override
Definition: layout.hxx:645
bool m_bIgnoreHidden
Definition: layout.hxx:580
void SetGetSurroundingHdl(const Link< OUString &, int > &rLink)
Definition: layout.hxx:789
QuickHelpFlags
Definition: help.hxx:32
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:303
void sort_native_button_order(const VclBox &rContainer)
Definition: layout.cxx:829
VclSizeGroupMode get_mode() const
Definition: layout.hxx:612
const std::set< VclPtr< vcl::Window > > & get_widgets() const
Definition: layout.hxx:598
VclSizeGroupMode m_eMode
Definition: layout.hxx:581
virtual sal_uInt16 getDefaultAccessibleRole() const
void set_homogeneous(bool bHomogeneous)
Definition: layout.hxx:92
EventBoxHelper(vcl::Window *pParent)
Definition: layout.hxx:544
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:232
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:1443
FactoryFunction m_pFactoryFunction
Definition: layout.hxx:623
bool get_orientation() const
Definition: layout.hxx:96
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
Definition: help.cxx:180
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:749
virtual void KeyUp(const KeyEvent &rKEvt) override
Definition: layout.hxx:660
Link< const MouseEvent &, bool > m_aMouseMotionHdl
Definition: layout.hxx:630
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
Definition: window2.cxx:1266
bool get_expand() const
Definition: window2.cxx:1738
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: layout.hxx:641
Link< const Size &, void > m_aResizeHdl
Definition: layout.hxx:628
DrawFrameStyle
Definition: vclenum.hxx:336
VclButtonBox(vcl::Window *pParent)
Definition: layout.hxx:211
vcl::Window * firstLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:189
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1797
bool m_bInitialAllocation
Definition: layout.hxx:527
virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:252
Link< const MouseEvent &, bool > m_aMousePressHdl
Definition: layout.hxx:629
void SetUITestFactory(FactoryFunction pFactoryFunction, void *pUserData)
Definition: layout.hxx:740
VclVButtonBox(vcl::Window *pParent)
Definition: layout.hxx:238
Link< const MouseEvent &, bool > m_aMouseReleaseHdl
Definition: layout.hxx:631
WindowType
Definition: ctrl.hxx:33
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:368
virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
Definition: layout.hxx:188
VclPtr< EventBoxHelper > m_aEventBoxHelper
Definition: layout.hxx:558
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:781
virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
Definition: layout.hxx:141
QPRO_FUNC_TYPE nType
virtual void RequestHelp(const HelpEvent &rHelpEvent) override
Definition: layout.hxx:689
Link< tools::Rectangle &, OUString > m_aQueryTooltipHdl
Definition: layout.hxx:636
ScrollBar & getVertScrollBar()
Definition: layout.hxx:493
virtual void KeyUp(const KeyEvent &rKEvt)
Definition: window.cxx:1814
void insert(vcl::Window *pWindow)
Definition: layout.hxx:590
Link< const Selection &, bool > m_aDeleteSurroundingHdl
Definition: layout.hxx:638
VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow)
Definition: layout.cxx:2866
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:972
std::vector< tools::Long > m_aSubGroupDimensions
Definition: layout.hxx:227
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:407
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:665
virtual Size calculateRequisition() const override
Definition: layout.cxx:224
int m_nColumnSpacing
Definition: layout.hxx:319
virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
Definition: layout.hxx:287
VclEventBox(vcl::Window *pParent)
Definition: layout.hxx:562
VclGrid(vcl::Window *pParent)
Definition: layout.hxx:335
void dispose()
vcl::Window * nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
Definition: dialog.cxx:133
DrawFrameFlags
Definition: vclenum.hxx:348
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1915
int get_row_spacing() const
Definition: layout.hxx:357
bool m_bUserManagedScrolling
Definition: layout.hxx:508
bool m_bHomogeneous
Definition: layout.hxx:73
WinBits const WB_CLIPCHILDREN
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1255
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:192
void SetMouseMoveHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:761
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:683
virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
Definition: layout.hxx:256
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:34
void SetMouseReleaseHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:765
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:632
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:357