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 ScrollBar;
29 class ScrollBarBox;
30 class Splitter;
31 
33  public vcl::IContext
34 {
35 public:
37 
38  //These take into account the external margins of the rWindow widget
39  //while GetOptimalSize/get_preferred_size and SetPosSizePixel are
40  //oblivious to them
41  static Size getLayoutRequisition(const vcl::Window &rWindow);
42  static void setLayoutPosSize(vcl::Window &rWindow, const Point &rPos, const Size &rSize);
43 
44  //applies the allocation pos and size onto rWindow via setLayoutPosSize taking into account
45  //the rWindows alignment desires within that allocation
46  static void setLayoutAllocation(vcl::Window &rWindow, const Point &rPos, const Size &rSize);
47 
48  virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
49 protected:
50  //these are the two that need to be implemented by
51  //containers, figure out how much space you want...
52  virtual Size calculateRequisition() const = 0;
53  //..and decide what to do when set to this size
54  virtual void setAllocation(const Size &rAllocation) = 0;
55 
56  virtual sal_uInt16 getDefaultAccessibleRole() const override;
57 
58  // support for screenshot context menu
59  virtual void Command(const CommandEvent& rCEvt) override;
60 
61 public:
62  //you don't want to override these
63  virtual Size GetOptimalSize() const override;
64  virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize) override;
65  virtual void SetPosPixel(const Point& rAllocPos) override;
66  virtual void SetSizePixel(const Size& rAllocation) override;
67 private:
69 };
70 
72 {
73 protected:
77 public:
78  VclBox(vcl::Window *pParent, bool bHomogeneous, int nSpacing)
79  : VclContainer(pParent)
80  , m_bHomogeneous(bHomogeneous)
81  , m_bVerticalContainer(false)
82  , m_nSpacing(nSpacing)
83  {
84  }
85  void set_spacing(int nSpacing)
86  {
87  m_nSpacing = nSpacing;
88  }
89  int get_spacing() const
90  {
91  return m_nSpacing;
92  }
93  void set_homogeneous(bool bHomogeneous)
94  {
95  m_bHomogeneous = bHomogeneous;
96  }
97  bool get_orientation() const
98  {
99  return m_bVerticalContainer;
100  }
101  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
102  virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
103 protected:
104  virtual sal_uInt16 getDefaultAccessibleRole() const override;
105  void accumulateMaxes(const Size &rChildSize, Size &rSize) const;
106  Size finalizeMaxes(const Size &rSize, sal_uInt16 nVisibleChildren) const;
107 
108  virtual Size calculateRequisition() const override;
109  virtual void setAllocation(const Size &rAllocation) override;
110 
111  virtual long getPrimaryDimension(const Size &rSize) const = 0;
112  virtual void setPrimaryDimension(Size &rSize, long) const = 0;
113  virtual long getPrimaryCoordinate(const Point &rPos) const = 0;
114  virtual void setPrimaryCoordinate(Point &rPos, long) const = 0;
115  virtual long getSecondaryDimension(const Size &rSize) const = 0;
116  virtual void setSecondaryDimension(Size &rSize, long) const = 0;
117 
118  virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const = 0;
119 };
120 
122 {
123 public:
124  VclVBox(vcl::Window *pParent, bool bHomogeneous = false, int nSpacing = 0)
125  : VclBox(pParent, bHomogeneous, nSpacing)
126  {
127  m_bVerticalContainer = true;
128  }
129 protected:
130  virtual long getPrimaryDimension(const Size &rSize) const override
131  {
132  return rSize.getHeight();
133  }
134  virtual void setPrimaryDimension(Size &rSize, long nHeight) const override
135  {
136  rSize.setHeight(nHeight);
137  }
138  virtual long getPrimaryCoordinate(const Point &rPos) const override
139  {
140  return rPos.getY();
141  }
142  virtual void setPrimaryCoordinate(Point &rPos, long nPos) const override
143  {
144  rPos.setY(nPos);
145  }
146  virtual long getSecondaryDimension(const Size &rSize) const override
147  {
148  return rSize.getWidth();
149  }
150  virtual void setSecondaryDimension(Size &rSize, long nWidth) const override
151  {
152  rSize.setWidth(nWidth);
153  }
154  virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
155  {
156  return rWindow.get_expand() || rWindow.get_vexpand();
157  }
158 };
159 
161 {
162 public:
163  VclHBox(vcl::Window *pParent, bool bHomogeneous = false, int nSpacing = 0)
164  : VclBox(pParent, bHomogeneous, nSpacing)
165  {
166  m_bVerticalContainer = false;
167  }
168 protected:
169  virtual long getPrimaryDimension(const Size &rSize) const override
170  {
171  return rSize.getWidth();
172  }
173  virtual void setPrimaryDimension(Size &rSize, long nWidth) const override
174  {
175  rSize.setWidth(nWidth);
176  }
177  virtual long getPrimaryCoordinate(const Point &rPos) const override
178  {
179  return rPos.getX();
180  }
181  virtual void setPrimaryCoordinate(Point &rPos, long nPos) const override
182  {
183  rPos.setX(nPos);
184  }
185  virtual long getSecondaryDimension(const Size &rSize) const override
186  {
187  return rSize.getHeight();
188  }
189  virtual void setSecondaryDimension(Size &rSize, long nHeight) const override
190  {
191  rSize.setHeight(nHeight);
192  }
193  virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
194  {
195  return rWindow.get_expand() || rWindow.get_hexpand();
196  }
197 };
198 
200 {
201  Default,
202  Spread,
203  Edge,
204  Start,
205  End,
206  Center
207 };
208 
210 {
211 public:
213  : VclBox(pParent, false, Application::GetSettings().GetStyleSettings().GetDialogStyle().button_spacing)
214  , m_eLayoutStyle(VclButtonBoxStyle::Default)
215  {
216  }
217  virtual bool set_property(const OString &rKey, const OUString &rValue) 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<long> m_aMainGroupDimensions;
227  std::vector<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 long getPrimaryDimension(const Size &rSize) const override
245  {
246  return rSize.getHeight();
247  }
248  virtual void setPrimaryDimension(Size &rSize, long nHeight) const override
249  {
250  rSize.setHeight(nHeight);
251  }
252  virtual long getPrimaryCoordinate(const Point &rPos) const override
253  {
254  return rPos.getY();
255  }
256  virtual void setPrimaryCoordinate(Point &rPos, long nPos) const override
257  {
258  rPos.setY(nPos);
259  }
260  virtual long getSecondaryDimension(const Size &rSize) const override
261  {
262  return rSize.getWidth();
263  }
264  virtual void setSecondaryDimension(Size &rSize, 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 long getPrimaryDimension(const Size &rSize) const override
284  {
285  return rSize.getWidth();
286  }
287  virtual void setPrimaryDimension(Size &rSize, long nWidth) const override
288  {
289  rSize.setWidth(nWidth);
290  }
291  virtual long getPrimaryCoordinate(const Point &rPos) const override
292  {
293  return rPos.getX();
294  }
295  virtual void setPrimaryCoordinate(Point &rPos, long nPos) const override
296  {
297  rPos.setX(nPos);
298  }
299  virtual long getSecondaryDimension(const Size &rSize) const override
300  {
301  return rSize.getHeight();
302  }
303  virtual void setSecondaryDimension(Size &rSize, 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  {
324  long m_nValue;
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  long get_position() const { return m_nPosition; }
392  virtual void set_position(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, long nFirstHeight, 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(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, long nFirstHeight, 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(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 UNLESS_MERGELIBS(VCL_DLLPUBLIC) VclAlignment final : public VclBin
453 {
454 public:
455  VclAlignment(vcl::Window *pParent)
456  : VclBin(pParent)
457  , m_nBottomPadding(0)
458  , m_nLeftPadding(0)
459  , m_nRightPadding(0)
460  , m_nTopPadding(0)
461  {
462  }
463  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
464 private:
465  virtual Size calculateRequisition() const override;
466  virtual void setAllocation(const Size &rAllocation) override;
467  sal_Int32 m_nBottomPadding;
468  sal_Int32 m_nLeftPadding;
469  sal_Int32 m_nRightPadding;
470  sal_Int32 m_nTopPadding;
471 };
472 
473 class DisclosureButton;
474 class CheckBox;
475 
476 class VclExpander final : public VclBin
477 {
478 public:
479  VclExpander(vcl::Window *pParent);
480  virtual ~VclExpander() override;
481  virtual void dispose() override;
482  virtual vcl::Window *get_child() override;
483  virtual const vcl::Window *get_child() const override;
484  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
485  bool get_expanded() const;
486  void set_expanded(bool bExpanded);
487  void set_label(const OUString& rLabel);
488  virtual void StateChanged(StateChangedType nType) override;
489  void SetExpandedHdl( const Link<VclExpander&,void>& rLink ) { maExpandedHdl = rLink; }
490 private:
491  virtual Size calculateRequisition() const override;
492  virtual void setAllocation(const Size &rAllocation) override;
496  DECL_LINK(ClickHdl, CheckBox&, void);
497 };
498 
499 class VCL_DLLPUBLIC VclScrolledWindow final : public VclBin
500 {
501 public:
502  VclScrolledWindow(vcl::Window *pParent );
503  virtual ~VclScrolledWindow() override;
504  virtual void dispose() override;
505  virtual vcl::Window *get_child() override;
506  virtual const vcl::Window *get_child() const override;
507  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
508  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
509  bool HasVisibleBorder() const { return m_eDrawFrameStyle != DrawFrameStyle::NONE; }
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  void doSetAllocation(const Size &rAllocation, bool bRetryOnFailure);
517 private:
518  virtual Size calculateRequisition() const override;
519  virtual void setAllocation(const Size &rAllocation) override;
520  DECL_LINK(ScrollBarHdl, ScrollBar*, void);
521  void InitScrollBars(const Size &rRequest);
522  virtual bool EventNotify(NotifyEvent& rNEvt) override;
529 };
530 
531 class VclViewport final : public VclBin
532 {
533 public:
535  : VclBin(pParent, WB_HIDE | WB_CLIPCHILDREN)
536  , m_bInitialAllocation(true)
537  {
538  }
539 private:
540  virtual void setAllocation(const Size &rAllocation) override;
542 };
543 
544 //Enforces that its children are always the same size as itself.
545 //Intercepts any Commands intended for its children.
546 //
547 //by default the Commands are discarded, inherit from this
548 //and implement "Command" to get them
549 class VclEventBox final : public VclBin
550 {
551 private:
552  //Any Commands an EventBoxHelper receives are forwarded to its parent
553  //The VclEventBox ensures that m_aEventBoxHelper is the
554  //first child and is transparent, but covers the rest of the children
556  {
557  public:
559  : Window(pParent, 0)
560  {
561  SetSizePixel(pParent->GetSizePixel());
562  EnableChildTransparentMode();
563  SetPaintTransparent(true);
564  SetBackground();
565  }
566  virtual void Command(const CommandEvent& rCEvt) override
567  {
568  GetParent()->Command(rCEvt);
569  }
570  };
571 
573  virtual void dispose() override;
574  virtual ~VclEventBox() override;
575 public:
577  : VclBin(pParent)
578  , m_aEventBoxHelper(VclPtr<EventBoxHelper>::Create(this))
579  {
580  m_aEventBoxHelper->Show();
581  }
582  virtual vcl::Window *get_child() override;
583  virtual const vcl::Window *get_child() const override;
584  virtual Size calculateRequisition() const override;
585  virtual void setAllocation(const Size &rAllocation) override;
586 
587  virtual void Command(const CommandEvent& rCEvt) override;
588 };
589 
591 {
592 private:
593  std::set< VclPtr<vcl::Window> > m_aWindows;
596 
597  void trigger_queue_resize();
598 public:
600  : m_bIgnoreHidden(false)
601  , m_eMode(VclSizeGroupMode::Horizontal)
602  {
603  }
604  void insert(vcl::Window *pWindow)
605  {
606  m_aWindows.insert(VclPtr<vcl::Window>(pWindow));
607  }
608  void erase(vcl::Window *pWindow)
609  {
610  m_aWindows.erase(VclPtr<vcl::Window>(pWindow));
611  }
612  const std::set< VclPtr<vcl::Window> >& get_widgets() const
613  {
614  return m_aWindows;
615  }
616  std::set< VclPtr<vcl::Window> >& get_widgets()
617  {
618  return m_aWindows;
619  }
620  void set_ignore_hidden(bool bIgnoreHidden);
621  bool get_ignore_hidden() const
622  {
623  return m_bIgnoreHidden;
624  }
625  void set_mode(VclSizeGroupMode eMode);
627  {
628  return m_eMode;
629  }
630  void set_property(const OString &rKey, const OUString &rValue);
631 };
632 
634  , public DragSourceHelper
635 {
636 private:
638  void* m_pUserData;
652 
653  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override
654  {
655  m_aPaintHdl.Call(std::pair<vcl::RenderContext&, const tools::Rectangle&>(rRenderContext, rRect));
656  }
657  virtual void Resize() override
658  {
659  m_aResizeHdl.Call(GetOutputSizePixel());
660  }
661  virtual void MouseMove(const MouseEvent& rMEvt) override
662  {
663  if (!m_aMouseMotionHdl.Call(rMEvt))
664  Control::MouseMove(rMEvt);
665  }
666  virtual void KeyInput(const KeyEvent& rKEvt) override
667  {
668  if (!m_aKeyPressHdl.Call(rKEvt))
669  Control::KeyInput(rKEvt);
670 
671  }
672  virtual void KeyUp(const KeyEvent& rKEvt) override
673  {
674  if (!m_aKeyReleaseHdl.Call(rKEvt))
675  Control::KeyUp(rKEvt);
676  }
677  virtual void StateChanged(StateChangedType nType) override
678  {
679  Control::StateChanged(nType);
681  {
682  m_aStyleUpdatedHdl.Call(*this);
683  Invalidate();
684  }
685  }
686  virtual void DataChanged(const DataChangedEvent& rDCEvt) override
687  {
688  Control::DataChanged(rDCEvt);
690  {
691  m_aStyleUpdatedHdl.Call(*this);
692  Invalidate();
693  }
694  }
695  virtual void Command(const CommandEvent& rEvent) override
696  {
697  if (m_aCommandHdl.Call(rEvent))
698  return;
699  Control::Command(rEvent);
700  }
701  virtual void RequestHelp(const HelpEvent& rHelpEvent) override
702  {
703  if (rHelpEvent.GetMode() & (HelpEventMode::QUICK | HelpEventMode::BALLOON))
704  {
705  Point aPos(ScreenToOutputPixel(rHelpEvent.GetMousePosPixel()));
706  tools::Rectangle aHelpArea(aPos.X(), aPos.Y());
707  OUString sHelpTip = m_aQueryTooltipHdl.Call(aHelpArea);
708  if (sHelpTip.isEmpty())
709  return;
710  Point aPt = OutputToScreenPixel(aHelpArea.TopLeft());
711  aHelpArea.SetLeft(aPt.X());
712  aHelpArea.SetTop(aPt.Y());
713  aPt = OutputToScreenPixel(aHelpArea.BottomRight());
714  aHelpArea.SetRight(aPt.X());
715  aHelpArea.SetBottom(aPt.Y());
716  // tdf#125369 recover newline support of tdf#101779
717  QuickHelpFlags eHelpWinStyle = sHelpTip.indexOf('\n') != -1 ? QuickHelpFlags::TipStyleBalloon : QuickHelpFlags::NONE;
718  Help::ShowQuickHelp(this, aHelpArea, sHelpTip, eHelpWinStyle);
719  }
720  }
721  virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override;
722  virtual FactoryFunction GetUITestFactory() const override
723  {
724  if (m_pFactoryFunction)
725  return m_pFactoryFunction;
726  return Control::GetUITestFactory();
727  }
728 
729 public:
731  : Control(pParent, nStyle)
732  , DragSourceHelper(this)
733  , m_pFactoryFunction(nullptr)
734  , m_pUserData(nullptr)
735  , m_nDragAction(0)
736  {
737  SetBackground();
738  }
739  virtual void MouseButtonDown(const MouseEvent& rMEvt) override
740  {
741  if (!m_aMousePressHdl.Call(rMEvt))
743  }
744  virtual void MouseButtonUp(const MouseEvent& rMEvt) override
745  {
746  if (!m_aMouseReleaseHdl.Call(rMEvt))
747  Control::MouseButtonUp(rMEvt);
748  }
749  void SetUITestFactory(FactoryFunction pFactoryFunction, void* pUserData)
750  {
751  m_pFactoryFunction = pFactoryFunction;
752  m_pUserData = pUserData;
753  }
754  void* GetUserData() const
755  {
756  return m_pUserData;
757  }
758  void SetPaintHdl(const Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>& rLink)
759  {
760  m_aPaintHdl = rLink;
761  }
763  {
764  m_aResizeHdl = rLink;
765  }
767  {
768  m_aMousePressHdl = rLink;
769  }
771  {
772  m_aMouseMotionHdl = rLink;
773  }
775  {
776  m_aMouseReleaseHdl = rLink;
777  }
779  {
780  m_aKeyPressHdl = rLink;
781  }
783  {
784  m_aKeyReleaseHdl = rLink;
785  }
787  {
788  m_aStyleUpdatedHdl = rLink;
789  }
791  {
792  m_aCommandHdl = rLink;
793  }
795  {
796  m_aQueryTooltipHdl = rLink;
797  }
799  {
800  m_aStartDragHdl = rLink;
801  }
803  {
804  m_xTransferHelper = rHelper;
805  m_nDragAction = eDNDConstants;
806  }
807  virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
808 };
809 
810 //Get first window of a pTopLevel window as
811 //if any intermediate layout widgets didn't exist
812 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::FirstChild);
813 //in a flat hierarchy where dialogs only have one layer
814 //of children
816 
817 //Get last window of a pTopLevel window as
818 //if any intermediate layout widgets didn't exist
819 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::LastChild);
820 //in a flat hierarchy where dialogs only have one layer
821 //of children
823 
824 //Get next window after pChild of a pTopLevel window as
825 //if any intermediate layout widgets didn't exist
826 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Next);
827 //in a flat hierarchy where dialogs only have one layer
828 //of children
829 vcl::Window* nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
830 
831 //Get previous window before pChild of a pTopLevel window as
832 //if any intermediate layout widgets didn't exist
833 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Prev);
834 //in a flat hierarchy where dialogs only have one layer
835 //of children
836 vcl::Window* prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
837 
838 //Returns true is the Window has a single child which is a container
839 VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow);
840 
841 inline bool isContainerWindow(const vcl::Window &rWindow)
842 {
843  WindowType eType = rWindow.GetType();
844  return eType == WindowType::CONTAINER || eType == WindowType::SCROLLWINDOW ||
845  (eType == WindowType::DOCKINGWINDOW && ::isLayoutEnabled(&rWindow));
846 }
847 
848 inline bool isContainerWindow(const vcl::Window *pWindow)
849 {
850  return pWindow && isContainerWindow(*pWindow);
851 }
852 
853 // retro-fitting utilities
854 
855 //Get a Size which is large enough to contain all children with
856 //an equal amount of space at top left and bottom right
858 
859 //Get first parent which is not a layout widget
861 
862 //Sort ok/cancel etc buttons in platform order
863 void sort_native_button_order(VclBox& rContainer);
864 
865 #endif
866 
867 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void setPrimaryCoordinate(Point &rPos, long nPos) const override
Definition: layout.hxx:256
virtual void Command(const CommandEvent &rCEvt) override
Definition: layout.hxx:566
virtual long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:252
virtual sal_uInt16 getDefaultAccessibleRole() const override
Definition: layout.cxx:46
virtual void setSecondaryDimension(Size &rSize, long nWidth) const override
Definition: layout.hxx:150
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
virtual long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:130
DrawFrameFlags m_eDrawFrameFlags
Definition: layout.hxx:525
bool get_vexpand() const
Definition: window2.cxx:1706
virtual FactoryFunction GetUITestFactory() const
Definition: window.cxx:3864
vcl::Window * lastLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:195
VclPtr< ScrollBar > m_pHScroll
Definition: layout.hxx:527
Link< VclDrawingArea &, void > m_aStyleUpdatedHdl
Definition: layout.hxx:648
virtual void setSecondaryDimension(Size &rSize, long nHeight) const override
Definition: layout.hxx:303
virtual void setPrimaryCoordinate(Point &rPos, long nPos) const override
Definition: layout.hxx:142
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: layout.hxx:739
Link< std::pair< vcl::RenderContext &, const tools::Rectangle & >, void > m_aPaintHdl
Definition: layout.hxx:641
virtual void MouseButtonDown(const MouseEvent &rMEvt)
Definition: mouse.cxx:414
VclPtr< vcl::Window > m_pLabel
Definition: layout.hxx:426
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: layout.hxx:686
signed char sal_Int8
VclVBox(vcl::Window *pParent, bool bHomogeneous=false, int nSpacing=0)
Definition: layout.hxx:124
bool m_bVerticalContainer
Definition: layout.hxx:75
VclDrawingArea(vcl::Window *pParent, WinBits nStyle)
Definition: layout.hxx:730
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
VclPtr< DisclosureButton > m_pDisclosureButton
Definition: layout.hxx:494
bool get_hexpand() const
Definition: window2.cxx:1694
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
ScrollBar & getHorzScrollBar()
Definition: layout.hxx:511
VclViewport(vcl::Window *pParent)
Definition: layout.hxx:534
void SetMousePressHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:766
virtual long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:146
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:621
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual Size GetSizePixel() const
Definition: window.cxx:2395
void * GetUserData() const
Definition: layout.hxx:754
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1262
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: layout.hxx:661
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:357
vcl::Window * getNonLayoutParent(vcl::Window *pParent)
Definition: layout.cxx:2804
void set_spacing(int nSpacing)
Definition: layout.hxx:85
Link< const CommandEvent &, bool > m_aCommandHdl
Definition: layout.hxx:649
bool m_bExpand
Definition: layout.hxx:325
VclButtonBoxStyle
Definition: layout.hxx:199
Size getLegacyBestSizeForChildren(const vcl::Window &rWindow)
Definition: layout.cxx:2779
std::set< VclPtr< vcl::Window > > & get_widgets()
Definition: layout.hxx:616
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:307
void SetQueryTooltipHdl(const Link< tools::Rectangle &, OUString > &rLink)
Definition: layout.hxx:794
virtual void MouseButtonUp(const MouseEvent &rMEvt)
Definition: mouse.cxx:421
vcl::Window * prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
Definition: dialog.cxx:159
HelpEventMode GetMode() const
Definition: event.hxx:205
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: layout.hxx:666
void SetKeyReleaseHdl(const Link< const KeyEvent &, bool > &rLink)
Definition: layout.hxx:782
Link< const KeyEvent &, bool > m_aKeyReleaseHdl
Definition: layout.hxx:647
StateChangedType
Definition: window.hxx:317
css::uno::Any const & rValue
rtl::Reference< TransferDataContainer > m_xTransferHelper
Definition: layout.hxx:639
sal_Int64 WinBits
std::set< VclPtr< vcl::Window > > m_aWindows
Definition: layout.hxx:593
virtual void setPrimaryDimension(Size &rSize, long nWidth) const override
Definition: layout.hxx:173
VclHBox(vcl::Window *pParent, bool bHomogeneous=false, int nSpacing=0)
Definition: layout.hxx:163
bool m_bLayoutDirty
Definition: layout.hxx:68
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: window.cxx:3334
virtual Size calculateRequisition() const =0
Creates a hierarchy of vcl::Windows (widgets) from a .ui file for dialogs, sidebar, etc.
Definition: builder.hxx:64
AllSettingsFlags GetFlags() const
Definition: event.hxx:358
void SetKeyPressHdl(const Link< const KeyEvent &, bool > &rLink)
Definition: layout.hxx:778
VclSizeGroupMode
Definition: vclenum.hxx:265
Link< VclExpander &, void > maExpandedHdl
Definition: layout.hxx:495
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1314
sal_Int8 m_nDragAction
Definition: layout.hxx:640
virtual FactoryFunction GetUITestFactory() const override
Definition: layout.hxx:722
force balloon-style in ShowPopover and ShowQuickHelp
int m_nRowSpacing
Definition: layout.hxx:318
std::vector< long > m_aMainGroupDimensions
Definition: layout.hxx:226
WinBits const WB_HIDE
Link< VclDrawingArea *, bool > m_aStartDragHdl
Definition: layout.hxx:651
bool m_bResizeTopLevel
Definition: layout.hxx:493
void * m_pUserData
Definition: layout.hxx:638
bool isContainerWindow(const vcl::Window &rWindow)
Definition: layout.hxx:841
const Point & GetMousePosPixel() const
Definition: event.hxx:204
DocumentType eType
void SetExpandedHdl(const Link< VclExpander &, void > &rLink)
Definition: layout.hxx:489
void SetStartDragHdl(const Link< VclDrawingArea *, bool > &rLink)
Definition: layout.hxx:798
virtual long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:138
void SetResizeHdl(const Link< const Size &, void > &rLink)
Definition: layout.hxx:762
void setUserManagedScrolling(bool bUserManagedScrolling)
Definition: layout.hxx:515
void erase(vcl::Window *pWindow)
Definition: layout.hxx:608
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:246
VclPtr< ScrollBarBox > m_aScrollBarBox
Definition: layout.hxx:528
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: layout.hxx:744
DrawFrameStyle m_eDrawFrameStyle
Definition: layout.hxx:524
VclPtr< ScrollBar > m_pVScroll
Definition: layout.hxx:526
void SetStyleUpdatedHdl(const Link< VclDrawingArea &, void > &rLink)
Definition: layout.hxx:786
virtual void Resize() override
Definition: layout.hxx:657
bool m_bIgnoreHidden
Definition: layout.hxx:594
QuickHelpFlags
Definition: help.hxx:32
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:302
virtual void setPrimaryDimension(Size &rSize, long nHeight) const override
Definition: layout.hxx:248
VclSizeGroupMode get_mode() const
Definition: layout.hxx:626
const std::set< VclPtr< vcl::Window > > & get_widgets() const
Definition: layout.hxx:612
virtual long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:244
VclSizeGroupMode m_eMode
Definition: layout.hxx:595
void sort_native_button_order(VclBox &rContainer)
Definition: layout.cxx:796
virtual sal_uInt16 getDefaultAccessibleRole() const
void set_homogeneous(bool bHomogeneous)
Definition: layout.hxx:93
EventBoxHelper(vcl::Window *pParent)
Definition: layout.hxx:558
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:230
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:1431
FactoryFunction m_pFactoryFunction
Definition: layout.hxx:637
bool get_orientation() const
Definition: layout.hxx:97
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
Definition: help.cxx:180
virtual long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:185
void SetPaintHdl(const Link< std::pair< vcl::RenderContext &, const tools::Rectangle & >, void > &rLink)
Definition: layout.hxx:758
virtual void KeyUp(const KeyEvent &rKEvt) override
Definition: layout.hxx:672
Link< const MouseEvent &, bool > m_aMouseMotionHdl
Definition: layout.hxx:644
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
Definition: window2.cxx:1268
bool get_expand() const
Definition: window2.cxx:1718
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: layout.hxx:653
Link< const Size &, void > m_aResizeHdl
Definition: layout.hxx:642
DrawFrameStyle
Definition: vclenum.hxx:336
VclButtonBox(vcl::Window *pParent)
Definition: layout.hxx:212
virtual long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:291
vcl::Window * firstLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:187
virtual void set_position(long nPosition)
Definition: layout.hxx:392
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1799
bool m_bInitialAllocation
Definition: layout.hxx:541
Link< const MouseEvent &, bool > m_aMousePressHdl
Definition: layout.hxx:643
void SetUITestFactory(FactoryFunction pFactoryFunction, void *pUserData)
Definition: layout.hxx:749
void SetDragHelper(rtl::Reference< TransferDataContainer > &rHelper, sal_uInt8 eDNDConstants)
Definition: layout.hxx:802
virtual long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:169
VclVButtonBox(vcl::Window *pParent)
Definition: layout.hxx:238
Link< const MouseEvent &, bool > m_aMouseReleaseHdl
Definition: layout.hxx:645
WindowType
virtual long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:177
Definition: ctrl.hxx:33
bool get_column_homogeneous() const
Definition: layout.hxx:345
unsigned char sal_uInt8
int m_nSpacing
Definition: layout.hxx:76
long m_nPosition
Definition: layout.hxx:385
virtual void setPrimaryCoordinate(Point &rPos, long nPos) const override
Definition: layout.hxx:295
VclPtr< EventBoxHelper > m_aEventBoxHelper
Definition: layout.hxx:572
void set_column_spacing(int nSpacing)
Definition: layout.hxx:353
virtual long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:283
void SetCommandHdl(const Link< const CommandEvent &, bool > &rLink)
Definition: layout.hxx:790
virtual void setPrimaryCoordinate(Point &rPos, long nPos) const override
Definition: layout.hxx:181
QPRO_FUNC_TYPE nType
virtual void RequestHelp(const HelpEvent &rHelpEvent) override
Definition: layout.hxx:701
Link< tools::Rectangle &, OUString > m_aQueryTooltipHdl
Definition: layout.hxx:650
virtual void setPrimaryDimension(Size &rSize, long nHeight) const override
Definition: layout.hxx:134
ScrollBar & getVertScrollBar()
Definition: layout.hxx:510
virtual long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:299
virtual void KeyUp(const KeyEvent &rKEvt)
Definition: window.cxx:1816
void insert(vcl::Window *pWindow)
Definition: layout.hxx:604
std::vector< long > m_aSubGroupDimensions
Definition: layout.hxx:227
VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow)
Definition: layout.cxx:2841
virtual long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:260
VclBox(vcl::Window *pParent, bool bHomogeneous, int nSpacing)
Definition: layout.hxx:78
virtual void setSecondaryDimension(Size &rSize, long nHeight) const override
Definition: layout.hxx:189
WindowType GetType() const
Definition: window2.cxx:974
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:408
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:268
virtual void StateChanged(StateChangedType nType) override
Definition: layout.hxx:677
virtual Size calculateRequisition() const override
Definition: layout.cxx:224
virtual void setSecondaryDimension(Size &rSize, long nWidth) const override
Definition: layout.hxx:264
virtual void setPrimaryDimension(Size &rSize, long nWidth) const override
Definition: layout.hxx:287
int m_nColumnSpacing
Definition: layout.hxx:319
long get_position() const
Definition: layout.hxx:391
long getHeight() const
VclEventBox(vcl::Window *pParent)
Definition: layout.hxx:576
VclGrid(vcl::Window *pParent)
Definition: layout.hxx:335
void dispose()
vcl::Window * nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
Definition: dialog.cxx:131
DrawFrameFlags
Definition: vclenum.hxx:348
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1917
int get_row_spacing() const
Definition: layout.hxx:357
long getWidth() const
bool m_bUserManagedScrolling
Definition: layout.hxx:523
void setWidth(long nWidth)
bool m_bHomogeneous
Definition: layout.hxx:74
WinBits const WB_CLIPCHILDREN
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1257
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:193
void SetMouseMoveHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:770
int get_spacing() const
Definition: layout.hxx:89
VclButtonBoxStyle m_eLayoutStyle
Definition: layout.hxx:223
virtual void Command(const CommandEvent &rEvent) override
Definition: layout.hxx:695
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:35
void SetMouseReleaseHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:774
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:154
Link< const KeyEvent &, bool > m_aKeyPressHdl
Definition: layout.hxx:646
bool HasVisibleBorder() const
Definition: layout.hxx:509
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: layout.cxx:357
void setHeight(long nHeight)