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 protected:
218  virtual Size calculateRequisition() const override;
219  virtual void setAllocation(const Size &rAllocation) override;
220  Size addSpacing(const Size &rSize, sal_uInt16 nVisibleChildren) const;
221 private:
223  struct Requisition
224  {
225  std::vector<tools::Long> m_aMainGroupDimensions;
226  std::vector<tools::Long> m_aSubGroupDimensions;
229  };
230  Requisition calculatePrimarySecondaryRequisitions() const;
231  Size addReqGroups(const VclButtonBox::Requisition &rReq) const;
232 };
233 
235 {
236 public:
238  : VclButtonBox(pParent)
239  {
240  m_bVerticalContainer = true;
241  }
242 protected:
243  virtual tools::Long getPrimaryDimension(const Size &rSize) const override
244  {
245  return rSize.getHeight();
246  }
247  virtual void setPrimaryDimension(Size &rSize, tools::Long nHeight) const override
248  {
249  rSize.setHeight(nHeight);
250  }
251  virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
252  {
253  return rPos.getY();
254  }
255  virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
256  {
257  rPos.setY(nPos);
258  }
259  virtual tools::Long getSecondaryDimension(const Size &rSize) const override
260  {
261  return rSize.getWidth();
262  }
263  virtual void setSecondaryDimension(Size &rSize, tools::Long nWidth) const override
264  {
265  rSize.setWidth(nWidth);
266  }
267  virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
268  {
269  return rWindow.get_expand() || rWindow.get_vexpand();
270  }
271 };
272 
274 {
275 public:
277  : VclButtonBox(pParent)
278  {
279  m_bVerticalContainer = false;
280  }
281 private:
282  virtual tools::Long getPrimaryDimension(const Size &rSize) const override
283  {
284  return rSize.getWidth();
285  }
286  virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
287  {
288  rSize.setWidth(nWidth);
289  }
290  virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
291  {
292  return rPos.getX();
293  }
294  virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
295  {
296  rPos.setX(nPos);
297  }
298  virtual tools::Long getSecondaryDimension(const Size &rSize) const override
299  {
300  return rSize.getHeight();
301  }
302  virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
303  {
304  rSize.setHeight(nHeight);
305  }
306  virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
307  {
308  return rWindow.get_expand() || rWindow.get_hexpand();
309  }
310 };
311 
312 class VCL_DLLPUBLIC VclGrid final : public VclContainer
313 {
314 private:
319 
320 public:
321  struct Value
322  {
324  bool m_bExpand;
325  Value() : m_nValue(0), m_bExpand(false) {}
326  };
327 private:
328 
329  Size calculateRequisitionForSpacings(sal_Int32 nRowSpacing, sal_Int32 nColSpacing) const;
330  virtual Size calculateRequisition() const override;
331  virtual void setAllocation(const Size &rAllocation) override;
332  virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
333 public:
335  : VclContainer(pParent)
336  , m_bRowHomogeneous(false), m_bColumnHomogeneous(false)
337  , m_nRowSpacing(0), m_nColumnSpacing(0)
338  {
339  }
340  bool get_row_homogeneous() const
341  {
342  return m_bRowHomogeneous;
343  }
345  {
346  return m_bColumnHomogeneous;
347  }
348  void set_row_spacing(int nSpacing)
349  {
350  m_nRowSpacing = nSpacing;
351  }
352  void set_column_spacing(int nSpacing)
353  {
354  m_nColumnSpacing = nSpacing;
355  }
356  int get_row_spacing() const
357  {
358  return m_nRowSpacing;
359  }
360  int get_column_spacing() const
361  {
362  return m_nColumnSpacing;
363  }
364  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
365 };
366 
367 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) VclBin : public VclContainer
368 {
369 public:
370  VclBin(vcl::Window *pParent, WinBits nStyle = WB_HIDE | WB_CLIPCHILDREN)
371  : VclContainer(pParent, nStyle)
372  {
373  }
374  virtual vcl::Window *get_child();
375  virtual const vcl::Window *get_child() const;
376  virtual Size calculateRequisition() const override;
377  virtual void setAllocation(const Size &rAllocation) override;
378 };
379 
380 class VclPaned : public VclContainer
381 {
382 protected:
385 
386  VclPaned(vcl::Window *pParent, bool bVertical);
387 public:
388  virtual ~VclPaned() override;
389  virtual void dispose() override;
390  tools::Long get_position() const { return m_nPosition; }
391  virtual void set_position(tools::Long nPosition) { m_nPosition = nPosition; }
392 };
393 
394 class VclVPaned final : public VclPaned
395 {
396 private:
397  DECL_LINK(SplitHdl, Splitter*, void);
398  void arrange(const Size& rAllocation, tools::Long nFirstHeight, tools::Long nSecondHeight);
399 
400 public:
401  VclVPaned(vcl::Window *pParent);
402  virtual ~VclVPaned() override;
403  virtual Size calculateRequisition() const override;
404  virtual void setAllocation(const Size &rAllocation) override;
405  virtual void set_position(tools::Long nPosition) override;
406 };
407 
408 class VclHPaned final : public VclPaned
409 {
410 private:
411  DECL_LINK(SplitHdl, Splitter*, void);
412  void arrange(const Size& rAllocation, tools::Long nFirstHeight, tools::Long nSecondHeight);
413 
414 public:
415  VclHPaned(vcl::Window *pParent);
416  virtual ~VclHPaned() override;
417  virtual Size calculateRequisition() const override;
418  virtual void setAllocation(const Size &rAllocation) override;
419  virtual void set_position(tools::Long nPosition) override;
420 };
421 
422 class VclFrame final : public VclBin
423 {
424 private:
426 private:
427  friend class VclBuilder;
428  void designate_label(vcl::Window *pWindow);
429  DECL_LINK(WindowEventListener, VclWindowEvent&, void);
430 public:
432  : VclBin(pParent)
433  , m_pLabel(nullptr)
434  {
435  }
436  virtual ~VclFrame() override;
437  virtual void dispose() override;
438  void set_label(const OUString &rLabel);
439  OUString get_label() const;
440  virtual vcl::Window *get_child() override;
441  virtual const vcl::Window *get_child() const override;
442  vcl::Window *get_label_widget();
443  const vcl::Window *get_label_widget() const;
444  virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
445 private:
446  virtual Size calculateRequisition() const override;
447  virtual void setAllocation(const Size &rAllocation) override;
448  virtual OUString getDefaultAccessibleName() const override;
449 };
450 
451 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) VclAlignment final : public VclBin
452 {
453 public:
454  VclAlignment(vcl::Window *pParent)
455  : VclBin(pParent)
456  , m_nBottomPadding(0)
457  , m_nLeftPadding(0)
458  , m_nRightPadding(0)
459  , m_nTopPadding(0)
460  {
461  }
462  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
463 private:
464  virtual Size calculateRequisition() const override;
465  virtual void setAllocation(const Size &rAllocation) override;
466  sal_Int32 m_nBottomPadding;
467  sal_Int32 m_nLeftPadding;
468  sal_Int32 m_nRightPadding;
469  sal_Int32 m_nTopPadding;
470 };
471 
472 class DisclosureButton;
473 class CheckBox;
474 
475 class VclExpander final : public VclBin
476 {
477 public:
478  VclExpander(vcl::Window *pParent);
479  virtual ~VclExpander() override;
480  virtual void dispose() override;
481  virtual vcl::Window *get_child() override;
482  virtual const vcl::Window *get_child() const override;
483  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
484  bool get_expanded() const;
485  void set_expanded(bool bExpanded);
486  void set_label(const OUString& rLabel);
487  OUString get_label() const;
488  vcl::Window *get_label_widget();
489  const vcl::Window *get_label_widget() const;
490  virtual void StateChanged(StateChangedType nType) override;
491  void SetExpandedHdl( const Link<VclExpander&,void>& rLink ) { maExpandedHdl = rLink; }
492  virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
493 private:
494  virtual Size calculateRequisition() const override;
495  virtual void setAllocation(const Size &rAllocation) override;
499  DECL_LINK(ClickHdl, CheckBox&, void);
500 };
501 
502 class VCL_DLLPUBLIC VclScrolledWindow final : public VclBin
503 {
504 public:
505  VclScrolledWindow(vcl::Window *pParent );
506  virtual ~VclScrolledWindow() override;
507  virtual void dispose() override;
508  virtual vcl::Window *get_child() override;
509  virtual const vcl::Window *get_child() const override;
510  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
511  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
512  bool HasVisibleBorder() const { return m_eDrawFrameStyle != DrawFrameStyle::NONE; }
513  ScrollBar& getVertScrollBar() { return *m_pVScroll; }
514  ScrollBar& getHorzScrollBar() { return *m_pHScroll; }
515  Size getVisibleChildSize() const;
516  //set to true to disable the built-in scrolling callbacks to allow the user
517  //to override it
518  void setUserManagedScrolling(bool bUserManagedScrolling) { m_bUserManagedScrolling = bUserManagedScrolling;}
519  void doSetAllocation(const Size &rAllocation, bool bRetryOnFailure);
520 private:
521  virtual Size calculateRequisition() const override;
522  virtual void setAllocation(const Size &rAllocation) override;
523  // sets new border size and adapts scrollbar and child widget position/size as needed
524  void updateBorderWidth(tools::Long nBorderWidth);
525  DECL_LINK(ScrollBarHdl, ScrollBar*, void);
526  void InitScrollBars(const Size &rRequest);
527  virtual bool EventNotify(NotifyEvent& rNEvt) override;
535 };
536 
537 class VclViewport final : public VclBin
538 {
539 public:
541  : VclBin(pParent, WB_HIDE | WB_CLIPCHILDREN)
542  , m_bInitialAllocation(true)
543  {
544  }
545 private:
546  virtual void setAllocation(const Size &rAllocation) override;
548 };
549 
550 //Enforces that its children are always the same size as itself.
551 //Intercepts any Commands intended for its children.
552 //
553 //by default the Commands are discarded, inherit from this
554 //and implement "Command" to get them
555 class VclEventBox final : public VclBin
556 {
557 private:
558  //Any Commands an EventBoxHelper receives are forwarded to its parent
559  //The VclEventBox ensures that m_aEventBoxHelper is the
560  //first child and is transparent, but covers the rest of the children
562  {
563  public:
565  : Window(pParent, 0)
566  {
567  SetSizePixel(pParent->GetSizePixel());
568  EnableChildTransparentMode();
569  SetPaintTransparent(true);
570  SetBackground();
571  }
572  virtual void Command(const CommandEvent& rCEvt) override
573  {
574  GetParent()->Command(rCEvt);
575  }
576  };
577 
579  virtual void dispose() override;
580  virtual ~VclEventBox() override;
581 public:
583  : VclBin(pParent)
584  , m_aEventBoxHelper(VclPtr<EventBoxHelper>::Create(this))
585  {
586  m_aEventBoxHelper->Show();
587  }
588  virtual vcl::Window *get_child() override;
589  virtual const vcl::Window *get_child() const override;
590  virtual Size calculateRequisition() const override;
591  virtual void setAllocation(const Size &rAllocation) override;
592 
593  virtual void Command(const CommandEvent& rCEvt) override;
594 };
595 
597 {
598 private:
599  std::set< VclPtr<vcl::Window> > m_aWindows;
602 
603  void trigger_queue_resize();
604 public:
606  : m_bIgnoreHidden(false)
607  , m_eMode(VclSizeGroupMode::Horizontal)
608  {
609  }
610  void insert(vcl::Window *pWindow)
611  {
612  m_aWindows.insert(VclPtr<vcl::Window>(pWindow));
613  }
614  void erase(vcl::Window *pWindow)
615  {
616  m_aWindows.erase(VclPtr<vcl::Window>(pWindow));
617  }
618  const std::set< VclPtr<vcl::Window> >& get_widgets() const
619  {
620  return m_aWindows;
621  }
622  std::set< VclPtr<vcl::Window> >& get_widgets()
623  {
624  return m_aWindows;
625  }
626  void set_ignore_hidden(bool bIgnoreHidden);
627  bool get_ignore_hidden() const
628  {
629  return m_bIgnoreHidden;
630  }
631  void set_mode(VclSizeGroupMode eMode);
633  {
634  return m_eMode;
635  }
636  void set_property(const OString &rKey, const OUString &rValue);
637 };
638 
640  , public DragSourceHelper
641 {
642 private:
644  void* m_pUserData;
660 
661  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override
662  {
663  m_aPaintHdl.Call(std::pair<vcl::RenderContext&, const tools::Rectangle&>(rRenderContext, rRect));
664  }
665  virtual void Resize() override
666  {
667  m_aResizeHdl.Call(GetOutputSizePixel());
668  }
669  virtual void MouseMove(const MouseEvent& rMEvt) override
670  {
671  if (!m_aMouseMotionHdl.Call(rMEvt))
672  Control::MouseMove(rMEvt);
673  }
674  virtual void KeyInput(const KeyEvent& rKEvt) override
675  {
676  if (!m_aKeyPressHdl.Call(rKEvt))
677  Control::KeyInput(rKEvt);
678 
679  }
680  virtual void KeyUp(const KeyEvent& rKEvt) override
681  {
682  if (!m_aKeyReleaseHdl.Call(rKEvt))
683  Control::KeyUp(rKEvt);
684  }
685  virtual void StateChanged(StateChangedType nType) override
686  {
687  Control::StateChanged(nType);
689  {
690  m_aStyleUpdatedHdl.Call(*this);
691  Invalidate();
692  }
693  }
694  virtual void DataChanged(const DataChangedEvent& rDCEvt) override
695  {
696  Control::DataChanged(rDCEvt);
698  {
699  m_aStyleUpdatedHdl.Call(*this);
700  Invalidate();
701  }
702  }
703  virtual void Command(const CommandEvent& rEvent) override
704  {
705  if (m_aCommandHdl.Call(rEvent))
706  return;
707  Control::Command(rEvent);
708  }
709  virtual void RequestHelp(const HelpEvent& rHelpEvent) override
710  {
711  if (rHelpEvent.GetMode() & (HelpEventMode::QUICK | HelpEventMode::BALLOON))
712  {
713  Point aPos(ScreenToOutputPixel(rHelpEvent.GetMousePosPixel()));
714  tools::Rectangle aHelpArea(aPos.X(), aPos.Y());
715  OUString sHelpTip = m_aQueryTooltipHdl.Call(aHelpArea);
716  if (sHelpTip.isEmpty())
717  return;
718  Point aPt = OutputToScreenPixel(aHelpArea.TopLeft());
719  aHelpArea.SetLeft(aPt.X());
720  aHelpArea.SetTop(aPt.Y());
721  aPt = OutputToScreenPixel(aHelpArea.BottomRight());
722  aHelpArea.SetRight(aPt.X());
723  aHelpArea.SetBottom(aPt.Y());
724  // tdf#125369 recover newline support of tdf#101779
725  QuickHelpFlags eHelpWinStyle = sHelpTip.indexOf('\n') != -1 ? QuickHelpFlags::TipStyleBalloon : QuickHelpFlags::NONE;
726  Help::ShowQuickHelp(this, aHelpArea, sHelpTip, eHelpWinStyle);
727  }
728  }
729  virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override;
730  virtual FactoryFunction GetUITestFactory() const override
731  {
732  if (m_pFactoryFunction)
733  return m_pFactoryFunction;
734  return Control::GetUITestFactory();
735  }
736 
737 public:
739  : Control(pParent, nStyle)
740  , DragSourceHelper(this)
741  , m_pFactoryFunction(nullptr)
742  , m_pUserData(nullptr)
743  , m_nDragAction(0)
744  {
745  SetBackground();
746  }
747  virtual void MouseButtonDown(const MouseEvent& rMEvt) override
748  {
749  if (!m_aMousePressHdl.Call(rMEvt))
751  }
752  virtual void MouseButtonUp(const MouseEvent& rMEvt) override
753  {
754  if (!m_aMouseReleaseHdl.Call(rMEvt))
755  Control::MouseButtonUp(rMEvt);
756  }
757  virtual OUString GetSurroundingText() const override;
758  virtual Selection GetSurroundingTextSelection() const override;
759  virtual bool DeleteSurroundingText(const Selection& rSelection) override;
760  void SetUITestFactory(FactoryFunction pFactoryFunction, void* pUserData)
761  {
762  m_pFactoryFunction = pFactoryFunction;
763  m_pUserData = pUserData;
764  }
765  void* GetUserData() const
766  {
767  return m_pUserData;
768  }
769  void SetPaintHdl(const Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>& rLink)
770  {
771  m_aPaintHdl = rLink;
772  }
774  {
775  m_aResizeHdl = rLink;
776  }
778  {
779  m_aMousePressHdl = rLink;
780  }
782  {
783  m_aMouseMotionHdl = rLink;
784  }
786  {
787  m_aMouseReleaseHdl = rLink;
788  }
790  {
791  m_aKeyPressHdl = rLink;
792  }
794  {
795  m_aKeyReleaseHdl = rLink;
796  }
798  {
799  m_aStyleUpdatedHdl = rLink;
800  }
802  {
803  m_aCommandHdl = rLink;
804  }
806  {
807  m_aQueryTooltipHdl = rLink;
808  }
810  {
811  m_aGetSurroundingHdl = rLink;
812  }
814  {
815  m_aDeleteSurroundingHdl = rLink;
816  }
818  {
819  m_aStartDragHdl = rLink;
820  }
822  {
823  m_xTransferHelper = rHelper;
824  m_nDragAction = eDNDConstants;
825  }
826  virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
827 };
828 
829 //Get first window of a pTopLevel window as
830 //if any intermediate layout widgets didn't exist
831 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::FirstChild);
832 //in a flat hierarchy where dialogs only have one layer
833 //of children
835 
836 //Get last window of a pTopLevel window as
837 //if any intermediate layout widgets didn't exist
838 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::LastChild);
839 //in a flat hierarchy where dialogs only have one layer
840 //of children
842 
843 //Get next window after pChild of a pTopLevel window as
844 //if any intermediate layout widgets didn't exist
845 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Next);
846 //in a flat hierarchy where dialogs only have one layer
847 //of children
848 vcl::Window* nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
849 
850 //Get previous window before pChild of a pTopLevel window as
851 //if any intermediate layout widgets didn't exist
852 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Prev);
853 //in a flat hierarchy where dialogs only have one layer
854 //of children
855 vcl::Window* prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
856 
857 //Returns true is the Window has a single child which is a container
858 VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow);
859 
860 inline bool isContainerWindow(const vcl::Window &rWindow)
861 {
862  WindowType eType = rWindow.GetType();
863  return eType == WindowType::CONTAINER || eType == WindowType::SCROLLWINDOW ||
864  (eType == WindowType::DOCKINGWINDOW && ::isLayoutEnabled(&rWindow));
865 }
866 
867 inline bool isContainerWindow(const vcl::Window *pWindow)
868 {
869  return pWindow && isContainerWindow(*pWindow);
870 }
871 
872 // retro-fitting utilities
873 
874 //Get a Size which is large enough to contain all children with
875 //an equal amount of space at top left and bottom right
877 
878 //Get first parent which is not a layout widget
880 
881 //Sort ok/cancel etc buttons in platform order
882 void sort_native_button_order(const VclBox& rContainer);
883 
884 #endif
885 
886 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void set_position(tools::Long nPosition)
Definition: layout.hxx:391
virtual void Command(const CommandEvent &rCEvt) override
Definition: layout.hxx:572
virtual sal_uInt16 getDefaultAccessibleRole() const override
Definition: layout.cxx:45
tools::Long m_nPosition
Definition: layout.hxx:384
void SetDeleteSurroundingHdl(const Link< const Selection &, bool > &rLink)
Definition: layout.hxx:813
bool m_bColumnHomogeneous
Definition: layout.hxx:316
virtual void setAllocation(const Size &rAllocation)=0
int get_column_spacing() const
Definition: layout.hxx:360
VclFrame(vcl::Window *pParent)
Definition: layout.hxx:431
DrawFrameFlags m_eDrawFrameFlags
Definition: layout.hxx:531
bool get_vexpand() const
Definition: window2.cxx:1720
virtual FactoryFunction GetUITestFactory() const
Definition: window.cxx:3918
vcl::Window * lastLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:196
VclPtr< ScrollBar > m_pHScroll
Definition: layout.hxx:533
Link< VclDrawingArea &, void > m_aStyleUpdatedHdl
Definition: layout.hxx:654
void setWidth(tools::Long nWidth)
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: layout.hxx:747
Link< std::pair< vcl::RenderContext &, const tools::Rectangle & >, void > m_aPaintHdl
Definition: layout.hxx:647
virtual void MouseButtonDown(const MouseEvent &rMEvt)
Definition: mouse.cxx:414
virtual tools::Long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:129
VclPtr< vcl::Window > m_pLabel
Definition: layout.hxx:425
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: layout.hxx:694
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:738
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
VclPtr< DisclosureButton > m_pDisclosureButton
Definition: layout.hxx:497
tools::Long getWidth() const
bool get_hexpand() const
Definition: window2.cxx:1708
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
ScrollBar & getHorzScrollBar()
Definition: layout.hxx:514
long Long
VclViewport(vcl::Window *pParent)
Definition: layout.hxx:540
void SetMousePressHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:777
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:260
VclHButtonBox(vcl::Window *pParent)
Definition: layout.hxx:276
bool get_ignore_hidden() const
Definition: layout.hxx:627
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual Size GetSizePixel() const
Definition: window.cxx:2400
void * GetUserData() const
Definition: layout.hxx:765
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1262
virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:290
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: layout.hxx:669
virtual Size GetOptimalSize() const
Definition: window3.cxx:33
bool m_bRowHomogeneous
Definition: layout.hxx:315
void set_row_spacing(int nSpacing)
Definition: layout.hxx:348
DataChangedEventType GetType() const
Definition: event.hxx:356
vcl::Window * getNonLayoutParent(vcl::Window *pParent)
Definition: layout.cxx:2841
void set_spacing(int nSpacing)
Definition: layout.hxx:84
Link< const CommandEvent &, bool > m_aCommandHdl
Definition: layout.hxx:655
bool m_bExpand
Definition: layout.hxx:324
VclButtonBoxStyle
Definition: layout.hxx:198
Size getLegacyBestSizeForChildren(const vcl::Window &rWindow)
Definition: layout.cxx:2816
std::set< VclPtr< vcl::Window > > & get_widgets()
Definition: layout.hxx:622
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:306
void SetQueryTooltipHdl(const Link< tools::Rectangle &, OUString > &rLink)
Definition: layout.hxx:805
virtual void MouseButtonUp(const MouseEvent &rMEvt)
Definition: mouse.cxx:421
tools::Long m_nBorderWidth
Definition: layout.hxx:529
vcl::Window * prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
Definition: dialog.cxx:160
HelpEventMode GetMode() const
Definition: event.hxx:205
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: layout.hxx:674
virtual tools::Long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:184
void SetKeyReleaseHdl(const Link< const KeyEvent &, bool > &rLink)
Definition: layout.hxx:793
Link< const KeyEvent &, bool > m_aKeyReleaseHdl
Definition: layout.hxx:653
std::vector< tools::Long > m_aMainGroupDimensions
Definition: layout.hxx:225
StateChangedType
Definition: window.hxx:317
css::uno::Any const & rValue
rtl::Reference< TransferDataContainer > m_xTransferHelper
Definition: layout.hxx:645
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:821
sal_Int64 WinBits
Link< OUString &, int > m_aGetSurroundingHdl
Definition: layout.hxx:657
std::set< VclPtr< vcl::Window > > m_aWindows
Definition: layout.hxx:599
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:3330
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:789
virtual tools::Long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:243
VclSizeGroupMode
Definition: vclenum.hxx:265
virtual tools::Long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:259
Link< VclExpander &, void > maExpandedHdl
Definition: layout.hxx:498
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1327
sal_Int8 m_nDragAction
Definition: layout.hxx:646
virtual FactoryFunction GetUITestFactory() const override
Definition: layout.hxx:730
force balloon-style in ShowPopover and ShowQuickHelp
int m_nRowSpacing
Definition: layout.hxx:317
WinBits const WB_HIDE
Link< VclDrawingArea *, bool > m_aStartDragHdl
Definition: layout.hxx:659
bool m_bResizeTopLevel
Definition: layout.hxx:496
void * m_pUserData
Definition: layout.hxx:644
bool isContainerWindow(const vcl::Window &rWindow)
Definition: layout.hxx:860
virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
Definition: layout.hxx:302
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:491
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:817
void SetResizeHdl(const Link< const Size &, void > &rLink)
Definition: layout.hxx:773
void setUserManagedScrolling(bool bUserManagedScrolling)
Definition: layout.hxx:518
void erase(vcl::Window *pWindow)
Definition: layout.hxx:614
virtual tools::Long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:282
virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
Definition: layout.hxx:294
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:245
VclPtr< ScrollBarBox > m_aScrollBarBox
Definition: layout.hxx:534
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: layout.hxx:752
DrawFrameStyle m_eDrawFrameStyle
Definition: layout.hxx:530
VclPtr< ScrollBar > m_pVScroll
Definition: layout.hxx:532
void SetStyleUpdatedHdl(const Link< VclDrawingArea &, void > &rLink)
Definition: layout.hxx:797
virtual void Resize() override
Definition: layout.hxx:665
bool m_bIgnoreHidden
Definition: layout.hxx:600
void SetGetSurroundingHdl(const Link< OUString &, int > &rLink)
Definition: layout.hxx:809
QuickHelpFlags
Definition: help.hxx:32
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:302
void sort_native_button_order(const VclBox &rContainer)
Definition: layout.cxx:795
VclSizeGroupMode get_mode() const
Definition: layout.hxx:632
const std::set< VclPtr< vcl::Window > > & get_widgets() const
Definition: layout.hxx:618
VclSizeGroupMode m_eMode
Definition: layout.hxx:601
virtual sal_uInt16 getDefaultAccessibleRole() const
void set_homogeneous(bool bHomogeneous)
Definition: layout.hxx:92
EventBoxHelper(vcl::Window *pParent)
Definition: layout.hxx:564
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:230
VclPtr< Splitter > m_pSplitter
Definition: layout.hxx:383
bool get_row_homogeneous() const
Definition: layout.hxx:340
virtual bool set_property(const OString &rKey, const OUString &rValue)
Definition: window2.cxx:1445
FactoryFunction m_pFactoryFunction
Definition: layout.hxx:643
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:769
virtual void KeyUp(const KeyEvent &rKEvt) override
Definition: layout.hxx:680
Link< const MouseEvent &, bool > m_aMouseMotionHdl
Definition: layout.hxx:650
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
Definition: window2.cxx:1268
bool get_expand() const
Definition: window2.cxx:1732
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: layout.hxx:661
Link< const Size &, void > m_aResizeHdl
Definition: layout.hxx:648
DrawFrameStyle
Definition: vclenum.hxx:336
VclButtonBox(vcl::Window *pParent)
Definition: layout.hxx:211
vcl::Window * firstLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:188
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1804
bool m_bInitialAllocation
Definition: layout.hxx:547
virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:251
Link< const MouseEvent &, bool > m_aMousePressHdl
Definition: layout.hxx:649
void SetUITestFactory(FactoryFunction pFactoryFunction, void *pUserData)
Definition: layout.hxx:760
VclVButtonBox(vcl::Window *pParent)
Definition: layout.hxx:237
Link< const MouseEvent &, bool > m_aMouseReleaseHdl
Definition: layout.hxx:651
WindowType
Definition: ctrl.hxx:33
bool get_column_homogeneous() const
Definition: layout.hxx:344
unsigned char sal_uInt8
int m_nSpacing
Definition: layout.hxx:75
virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
Definition: layout.hxx:188
VclPtr< EventBoxHelper > m_aEventBoxHelper
Definition: layout.hxx:578
void set_column_spacing(int nSpacing)
Definition: layout.hxx:352
virtual void setPrimaryDimension(Size &rSize, tools::Long nHeight) const override
Definition: layout.hxx:247
void SetCommandHdl(const Link< const CommandEvent &, bool > &rLink)
Definition: layout.hxx:801
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:709
Link< tools::Rectangle &, OUString > m_aQueryTooltipHdl
Definition: layout.hxx:656
ScrollBar & getVertScrollBar()
Definition: layout.hxx:513
virtual void KeyUp(const KeyEvent &rKEvt)
Definition: window.cxx:1821
void insert(vcl::Window *pWindow)
Definition: layout.hxx:610
Link< const Selection &, bool > m_aDeleteSurroundingHdl
Definition: layout.hxx:658
VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow)
Definition: layout.cxx:2878
virtual void setSecondaryDimension(Size &rSize, tools::Long nWidth) const override
Definition: layout.hxx:263
VclBox(vcl::Window *pParent, bool bHomogeneous, int nSpacing)
Definition: layout.hxx:77
void setHeight(tools::Long nHeight)
WindowType GetType() const
Definition: window2.cxx:974
std::vector< tools::Long > m_aSubGroupDimensions
Definition: layout.hxx:226
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:408
virtual tools::Long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:298
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:267
virtual void StateChanged(StateChangedType nType) override
Definition: layout.hxx:685
virtual Size calculateRequisition() const override
Definition: layout.cxx:223
int m_nColumnSpacing
Definition: layout.hxx:318
virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
Definition: layout.hxx:286
VclEventBox(vcl::Window *pParent)
Definition: layout.hxx:582
VclGrid(vcl::Window *pParent)
Definition: layout.hxx:334
void dispose()
vcl::Window * nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
Definition: dialog.cxx:132
DrawFrameFlags
Definition: vclenum.hxx:348
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1922
int get_row_spacing() const
Definition: layout.hxx:356
bool m_bUserManagedScrolling
Definition: layout.hxx:528
bool m_bHomogeneous
Definition: layout.hxx:73
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:192
void SetMouseMoveHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:781
int get_spacing() const
Definition: layout.hxx:88
VclButtonBoxStyle m_eLayoutStyle
Definition: layout.hxx:222
virtual tools::Long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:145
virtual void Command(const CommandEvent &rEvent) override
Definition: layout.hxx:703
virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
Definition: layout.hxx:255
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:35
void SetMouseReleaseHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:785
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:153
tools::Long m_nValue
Definition: layout.hxx:323
Link< const KeyEvent &, bool > m_aKeyPressHdl
Definition: layout.hxx:652
bool HasVisibleBorder() const
Definition: layout.hxx:512
tools::Long get_position() const
Definition: layout.hxx:390
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: layout.cxx:356