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