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/svapp.hxx>
17#include <vcl/window.hxx>
18#include <vcl/settings.hxx>
19#include <vcl/event.hxx>
20#include <vcl/transfer.hxx>
21#include <vcl/vclptr.hxx>
22#include <vcl/IContext.hxx>
23#include <vcl/commandevent.hxx>
24#include <set>
25
26class HelpEvent;
27class ScrollBar;
28class ScrollBarBox;
29class Splitter;
30
32 public vcl::IContext
33{
34public:
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;
48protected:
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
60public:
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;
66private:
68};
69
71{
72protected:
76public:
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;
102protected:
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{
122public:
123 VclVBox(vcl::Window *pParent, bool bHomogeneous = false, int nSpacing = 0)
124 : VclBox(pParent, bHomogeneous, nSpacing)
125 {
126 m_bVerticalContainer = true;
127 }
128protected:
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{
161public:
162 VclHBox(vcl::Window *pParent, bool bHomogeneous = false, int nSpacing = 0)
163 : VclBox(pParent, bHomogeneous, nSpacing)
164 {
165 m_bVerticalContainer = false;
166 }
167protected:
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{
210public:
212 : VclBox(pParent, false, Application::GetSettings().GetStyleSettings().GetDialogStyle().button_spacing)
213 , m_eLayoutStyle(VclButtonBoxStyle::Default)
214 {
215 }
216 virtual bool set_property(const OString &rKey, const OUString &rValue) override;
217 virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
218protected:
219 virtual Size calculateRequisition() const override;
220 virtual void setAllocation(const Size &rAllocation) override;
221 Size addSpacing(const Size &rSize, sal_uInt16 nVisibleChildren) const;
222private:
225 {
226 std::vector<tools::Long> m_aMainGroupDimensions;
227 std::vector<tools::Long> m_aSubGroupDimensions;
230 };
231 Requisition calculatePrimarySecondaryRequisitions() const;
232 Size addReqGroups(const VclButtonBox::Requisition &rReq) const;
233};
234
236{
237public:
239 : VclButtonBox(pParent)
240 {
241 m_bVerticalContainer = true;
242 }
243protected:
244 virtual tools::Long getPrimaryDimension(const Size &rSize) const override
245 {
246 return rSize.getHeight();
247 }
248 virtual void setPrimaryDimension(Size &rSize, tools::Long nHeight) const override
249 {
250 rSize.setHeight(nHeight);
251 }
252 virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
253 {
254 return rPos.getY();
255 }
256 virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
257 {
258 rPos.setY(nPos);
259 }
260 virtual tools::Long getSecondaryDimension(const Size &rSize) const override
261 {
262 return rSize.getWidth();
263 }
264 virtual void setSecondaryDimension(Size &rSize, tools::Long nWidth) const override
265 {
266 rSize.setWidth(nWidth);
267 }
268 virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
269 {
270 return rWindow.get_expand() || rWindow.get_vexpand();
271 }
272};
273
275{
276public:
278 : VclButtonBox(pParent)
279 {
280 m_bVerticalContainer = false;
281 }
282private:
283 virtual tools::Long getPrimaryDimension(const Size &rSize) const override
284 {
285 return rSize.getWidth();
286 }
287 virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
288 {
289 rSize.setWidth(nWidth);
290 }
291 virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
292 {
293 return rPos.getX();
294 }
295 virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
296 {
297 rPos.setX(nPos);
298 }
299 virtual tools::Long getSecondaryDimension(const Size &rSize) const override
300 {
301 return rSize.getHeight();
302 }
303 virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
304 {
305 rSize.setHeight(nHeight);
306 }
307 virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
308 {
309 return rWindow.get_expand() || rWindow.get_hexpand();
310 }
311};
312
314{
315private:
320
321public:
322 struct Value
323 {
326 Value() : m_nValue(0), m_bExpand(false) {}
327 };
328private:
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;
334public:
336 : VclContainer(pParent)
337 , m_bRowHomogeneous(false), m_bColumnHomogeneous(false)
338 , m_nRowSpacing(0), m_nColumnSpacing(0)
339 {
340 }
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 }
362 {
363 return m_nColumnSpacing;
364 }
365 virtual bool set_property(const OString &rKey, const OUString &rValue) override;
366};
367
368class UNLESS_MERGELIBS(VCL_DLLPUBLIC) VclBin : public VclContainer
369{
370public:
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
381class VclPaned : public VclContainer
382{
383protected:
386
387 VclPaned(vcl::Window *pParent, bool bVertical);
388public:
389 virtual ~VclPaned() override;
390 virtual void dispose() override;
392 virtual void set_position(tools::Long nPosition) { m_nPosition = nPosition; }
393};
394
395class VclVPaned final : public VclPaned
396{
397private:
398 DECL_LINK(SplitHdl, Splitter*, void);
399 void arrange(const Size& rAllocation, tools::Long nFirstHeight, tools::Long nSecondHeight);
400
401public:
402 VclVPaned(vcl::Window *pParent);
403 virtual ~VclVPaned() override;
404 virtual Size calculateRequisition() const override;
405 virtual void setAllocation(const Size &rAllocation) override;
406 virtual void set_position(tools::Long nPosition) override;
407};
408
409class VclHPaned final : public VclPaned
410{
411private:
412 DECL_LINK(SplitHdl, Splitter*, void);
413 void arrange(const Size& rAllocation, tools::Long nFirstHeight, tools::Long nSecondHeight);
414
415public:
416 VclHPaned(vcl::Window *pParent);
417 virtual ~VclHPaned() override;
418 virtual Size calculateRequisition() const override;
419 virtual void setAllocation(const Size &rAllocation) override;
420 virtual void set_position(tools::Long nPosition) override;
421};
422
423class VclFrame final : public VclBin
424{
425private:
427private:
428 friend class VclBuilder;
429 void designate_label(vcl::Window *pWindow);
430 DECL_LINK(WindowEventListener, VclWindowEvent&, void);
431public:
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;
446private:
447 virtual Size calculateRequisition() const override;
448 virtual void setAllocation(const Size &rAllocation) override;
449 virtual OUString getDefaultAccessibleName() const override;
450};
451
452class DisclosureButton;
453class CheckBox;
454
455class VclExpander final : public VclBin
456{
457public:
458 VclExpander(vcl::Window *pParent);
459 virtual ~VclExpander() override;
460 virtual void dispose() override;
461 virtual vcl::Window *get_child() override;
462 virtual const vcl::Window *get_child() const override;
463 virtual bool set_property(const OString &rKey, const OUString &rValue) override;
464 bool get_expanded() const;
465 void set_expanded(bool bExpanded);
466 void set_label(const OUString& rLabel);
467 OUString get_label() const;
468 vcl::Window *get_label_widget();
469 const vcl::Window *get_label_widget() const;
470 virtual void StateChanged(StateChangedType nType) override;
471 void SetExpandedHdl( const Link<VclExpander&,void>& rLink ) { maExpandedHdl = rLink; }
472 virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
473 virtual FactoryFunction GetUITestFactory() const override;
474private:
475 virtual Size calculateRequisition() const override;
476 virtual void setAllocation(const Size &rAllocation) override;
480 DECL_LINK(ClickHdl, CheckBox&, void);
481};
482
483class VclScrolledWindow final : public VclBin
484{
485public:
487 virtual ~VclScrolledWindow() override;
488 virtual void dispose() override;
489 virtual vcl::Window *get_child() override;
490 virtual const vcl::Window *get_child() const override;
491 virtual bool set_property(const OString &rKey, const OUString &rValue) override;
492 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
493 bool HasVisibleBorder() const { return m_eDrawFrameStyle != DrawFrameStyle::NONE; }
494 ScrollBar& getVertScrollBar() { return *m_pVScroll; }
495 ScrollBar& getHorzScrollBar() { return *m_pHScroll; }
496 Size getVisibleChildSize() const;
497 //set to true to disable the built-in scrolling callbacks to allow the user
498 //to override it
499 void setUserManagedScrolling(bool bUserManagedScrolling) { m_bUserManagedScrolling = bUserManagedScrolling;}
500 void doSetAllocation(const Size &rAllocation, bool bRetryOnFailure);
501private:
502 virtual Size calculateRequisition() const override;
503 virtual void setAllocation(const Size &rAllocation) override;
504 int CalcBorderWidth() const;
505 DECL_LINK(ScrollBarHdl, ScrollBar*, void);
506 void InitScrollBars(const Size &rRequest);
507 virtual bool EventNotify(NotifyEvent& rNEvt) override;
515};
516
517class VclViewport final : public VclBin
518{
519public:
521 : VclBin(pParent, WB_HIDE | WB_CLIPCHILDREN)
522 , m_bInitialAllocation(true)
523 {
524 }
525private:
526 virtual void setAllocation(const Size &rAllocation) override;
528};
529
530//Enforces that its children are always the same size as itself.
531//Intercepts any Commands intended for its children.
532//
533//by default the Commands are discarded, inherit from this
534//and implement "Command" to get them
535class VclEventBox final : public VclBin
536{
537private:
538 //Any Commands an EventBoxHelper receives are forwarded to its parent
539 //The VclEventBox ensures that m_aEventBoxHelper is the
540 //first child and is transparent, but covers the rest of the children
541 class EventBoxHelper final : public vcl::Window
542 {
543 public:
545 : Window(pParent, 0)
546 {
547 SetSizePixel(pParent->GetSizePixel());
548 EnableChildTransparentMode();
549 SetPaintTransparent(true);
550 SetBackground();
551 }
552 virtual void Command(const CommandEvent& rCEvt) override
553 {
554 GetParent()->Command(rCEvt);
555 }
556 };
557
559 virtual void dispose() override;
560 virtual ~VclEventBox() override;
561public:
563 : VclBin(pParent)
564 , m_aEventBoxHelper(VclPtr<EventBoxHelper>::Create(this))
565 {
566 m_aEventBoxHelper->Show();
567 }
568 virtual vcl::Window *get_child() override;
569 virtual const vcl::Window *get_child() const override;
570 virtual Size calculateRequisition() const override;
571 virtual void setAllocation(const Size &rAllocation) override;
572
573 virtual void Command(const CommandEvent& rCEvt) override;
574};
575
577{
578private:
579 std::set< VclPtr<vcl::Window> > m_aWindows;
582
583 void trigger_queue_resize();
584public:
586 : m_bIgnoreHidden(false)
587 , m_eMode(VclSizeGroupMode::Horizontal)
588 {
589 }
590 void insert(vcl::Window *pWindow)
591 {
592 m_aWindows.insert(VclPtr<vcl::Window>(pWindow));
593 }
594 void erase(vcl::Window *pWindow)
595 {
596 m_aWindows.erase(VclPtr<vcl::Window>(pWindow));
597 }
598 const std::set< VclPtr<vcl::Window> >& get_widgets() const
599 {
600 return m_aWindows;
601 }
602 std::set< VclPtr<vcl::Window> >& get_widgets()
603 {
604 return m_aWindows;
605 }
606 void set_ignore_hidden(bool bIgnoreHidden);
607 bool get_ignore_hidden() const
608 {
609 return m_bIgnoreHidden;
610 }
611 void set_mode(VclSizeGroupMode eMode);
613 {
614 return m_eMode;
615 }
616 void set_property(const OString &rKey, const OUString &rValue);
617};
618
620 , public DragSourceHelper
621{
622private:
640
641 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override
642 {
643 m_aPaintHdl.Call(std::pair<vcl::RenderContext&, const tools::Rectangle&>(rRenderContext, rRect));
644 }
645 virtual void Resize() override
646 {
647 m_aResizeHdl.Call(GetOutputSizePixel());
648 }
649 virtual void MouseMove(const MouseEvent& rMEvt) override
650 {
651 if (!m_aMouseMotionHdl.Call(rMEvt))
652 Control::MouseMove(rMEvt);
653 }
654 virtual void KeyInput(const KeyEvent& rKEvt) override
655 {
656 if (!m_aKeyPressHdl.Call(rKEvt))
657 Control::KeyInput(rKEvt);
658
659 }
660 virtual void KeyUp(const KeyEvent& rKEvt) override
661 {
662 if (!m_aKeyReleaseHdl.Call(rKEvt))
663 Control::KeyUp(rKEvt);
664 }
665 virtual void StateChanged(StateChangedType nType) override
666 {
669 {
670 m_aStyleUpdatedHdl.Call(*this);
671 Invalidate();
672 }
673 }
674 virtual void DataChanged(const DataChangedEvent& rDCEvt) override
675 {
676 Control::DataChanged(rDCEvt);
678 {
679 m_aStyleUpdatedHdl.Call(*this);
680 Invalidate();
681 }
682 }
683 virtual void Command(const CommandEvent& rEvent) override
684 {
685 if (m_aCommandHdl.Call(rEvent))
686 return;
687 Control::Command(rEvent);
688 }
689 virtual void RequestHelp(const HelpEvent& rHelpEvent) override;
690 virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override;
691 virtual FactoryFunction GetUITestFactory() const override;
692
693public:
695 : Control(pParent, nStyle)
696 , DragSourceHelper(this)
697 , m_pFactoryFunction(nullptr)
698 , m_pUserData(nullptr)
699 , m_nDragAction(0)
700 {
701 SetBackground();
702 }
703 virtual void MouseButtonDown(const MouseEvent& rMEvt) override
704 {
705 if (!m_aMousePressHdl.Call(rMEvt))
707 }
708 virtual void MouseButtonUp(const MouseEvent& rMEvt) override
709 {
710 if (!m_aMouseReleaseHdl.Call(rMEvt))
712 }
713 virtual OUString GetSurroundingText() const override;
714 virtual Selection GetSurroundingTextSelection() const override;
715 virtual bool DeleteSurroundingText(const Selection& rSelection) override;
716 void SetUITestFactory(FactoryFunction pFactoryFunction, void* pUserData)
717 {
718 m_pFactoryFunction = pFactoryFunction;
719 m_pUserData = pUserData;
720 }
721 void* GetUserData() const
722 {
723 return m_pUserData;
724 }
725 void SetPaintHdl(const Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>& rLink)
726 {
727 m_aPaintHdl = rLink;
728 }
730 {
731 m_aResizeHdl = rLink;
732 }
734 {
735 m_aMousePressHdl = rLink;
736 }
738 {
739 m_aMouseMotionHdl = rLink;
740 }
742 {
743 m_aMouseReleaseHdl = rLink;
744 }
746 {
747 m_aKeyPressHdl = rLink;
748 }
750 {
751 m_aKeyReleaseHdl = rLink;
752 }
754 {
755 m_aStyleUpdatedHdl = rLink;
756 }
758 {
759 m_aCommandHdl = rLink;
760 }
762 {
763 m_aQueryTooltipHdl = rLink;
764 }
766 {
767 m_aGetSurroundingHdl = rLink;
768 }
770 {
771 m_aDeleteSurroundingHdl = rLink;
772 }
774 {
775 m_aStartDragHdl = rLink;
776 }
778 {
779 m_xTransferHelper = rHelper;
780 m_nDragAction = eDNDConstants;
781 }
782 virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
783};
784
785//Get first window of a pTopLevel window as
786//if any intermediate layout widgets didn't exist
787//i.e. acts like pChild = pChild->GetWindow(GetWindowType::FirstChild);
788//in a flat hierarchy where dialogs only have one layer
789//of children
791
792//Get last window of a pTopLevel window as
793//if any intermediate layout widgets didn't exist
794//i.e. acts like pChild = pChild->GetWindow(GetWindowType::LastChild);
795//in a flat hierarchy where dialogs only have one layer
796//of children
798
799//Get next window after pChild of a pTopLevel window as
800//if any intermediate layout widgets didn't exist
801//i.e. acts like pChild = pChild->GetWindow(GetWindowType::Next);
802//in a flat hierarchy where dialogs only have one layer
803//of children
804vcl::Window* nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
805
806//Get previous window before pChild of a pTopLevel window as
807//if any intermediate layout widgets didn't exist
808//i.e. acts like pChild = pChild->GetWindow(GetWindowType::Prev);
809//in a flat hierarchy where dialogs only have one layer
810//of children
811vcl::Window* prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
812
813//Returns true is the Window has a single child which is a container
814VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow);
815
816inline bool isContainerWindow(const vcl::Window &rWindow)
817{
818 WindowType eType = rWindow.GetType();
821}
822
823inline bool isContainerWindow(const vcl::Window *pWindow)
824{
825 return pWindow && isContainerWindow(*pWindow);
826}
827
828// retro-fitting utilities
829
830//Get a Size which is large enough to contain all children with
831//an equal amount of space at top left and bottom right
833
834//Get first parent which is not a layout widget
836
837//Sort ok/cancel etc buttons in platform order
838void sort_native_button_order(const VclBox& rContainer);
839
840#endif
841
842/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 m_nPosition
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:234
Definition: ctrl.hxx:82
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:257
DataChangedEventType GetType() const
Definition: event.hxx:362
AllSettingsFlags GetFlags() const
Definition: event.hxx:363
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:171
constexpr tools::Long getHeight() const
constexpr tools::Long getWidth() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
bool m_bVerticalContainer
Definition: layout.hxx:74
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const =0
void set_homogeneous(bool bHomogeneous)
Definition: layout.hxx:92
bool m_bHomogeneous
Definition: layout.hxx:73
virtual tools::Long getPrimaryDimension(const Size &rSize) const =0
virtual void setSecondaryDimension(Size &rSize, tools::Long) const =0
virtual tools::Long getSecondaryDimension(const Size &rSize) const =0
virtual void setPrimaryCoordinate(Point &rPos, tools::Long) const =0
int get_spacing() const
Definition: layout.hxx:88
int m_nSpacing
Definition: layout.hxx:75
virtual void setPrimaryDimension(Size &rSize, tools::Long) const =0
virtual tools::Long getPrimaryCoordinate(const Point &rPos) const =0
void set_spacing(int nSpacing)
Definition: layout.hxx:84
VclBox(vcl::Window *pParent, bool bHomogeneous, int nSpacing)
Definition: layout.hxx:77
bool get_orientation() const
Definition: layout.hxx:96
Creates a hierarchy of vcl::Windows (widgets) from a .ui file for dialogs, sidebar,...
Definition: builder.hxx:69
VclButtonBox(vcl::Window *pParent)
Definition: layout.hxx:211
VclButtonBoxStyle m_eLayoutStyle
Definition: layout.hxx:223
virtual void setAllocation(const Size &rAllocation)=0
virtual Size calculateRequisition() const =0
bool m_bLayoutDirty
Definition: layout.hxx:67
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: layout.hxx:641
Link< std::pair< vcl::RenderContext &, const tools::Rectangle & >, void > m_aPaintHdl
Definition: layout.hxx:627
void SetStyleUpdatedHdl(const Link< VclDrawingArea &, void > &rLink)
Definition: layout.hxx:753
Link< const MouseEvent &, bool > m_aMouseReleaseHdl
Definition: layout.hxx:631
void SetCommandHdl(const Link< const CommandEvent &, bool > &rLink)
Definition: layout.hxx:757
void * m_pUserData
Definition: layout.hxx:624
rtl::Reference< TransferDataContainer > m_xTransferHelper
Definition: layout.hxx:625
Link< const MouseEvent &, bool > m_aMouseMotionHdl
Definition: layout.hxx:630
void * GetUserData() const
Definition: layout.hxx:721
void SetMouseMoveHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:737
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: layout.hxx:708
void SetDeleteSurroundingHdl(const Link< const Selection &, bool > &rLink)
Definition: layout.hxx:769
Link< VclDrawingArea &, void > m_aStyleUpdatedHdl
Definition: layout.hxx:634
Link< const KeyEvent &, bool > m_aKeyPressHdl
Definition: layout.hxx:632
virtual void KeyUp(const KeyEvent &rKEvt) override
Definition: layout.hxx:660
Link< const CommandEvent &, bool > m_aCommandHdl
Definition: layout.hxx:635
void SetQueryTooltipHdl(const Link< tools::Rectangle &, OUString > &rLink)
Definition: layout.hxx:761
Link< const Size &, void > m_aResizeHdl
Definition: layout.hxx:628
void SetMouseReleaseHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:741
void SetMousePressHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:733
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: layout.hxx:649
void SetResizeHdl(const Link< const Size &, void > &rLink)
Definition: layout.hxx:729
void SetDragHelper(const rtl::Reference< TransferDataContainer > &rHelper, sal_uInt8 eDNDConstants)
Definition: layout.hxx:777
Link< VclDrawingArea *, bool > m_aStartDragHdl
Definition: layout.hxx:639
void SetStartDragHdl(const Link< VclDrawingArea *, bool > &rLink)
Definition: layout.hxx:773
Link< const Selection &, bool > m_aDeleteSurroundingHdl
Definition: layout.hxx:638
void SetUITestFactory(FactoryFunction pFactoryFunction, void *pUserData)
Definition: layout.hxx:716
void SetPaintHdl(const Link< std::pair< vcl::RenderContext &, const tools::Rectangle & >, void > &rLink)
Definition: layout.hxx:725
void SetKeyReleaseHdl(const Link< const KeyEvent &, bool > &rLink)
Definition: layout.hxx:749
virtual void StateChanged(StateChangedType nType) override
Definition: layout.hxx:665
Link< const KeyEvent &, bool > m_aKeyReleaseHdl
Definition: layout.hxx:633
Link< OUString &, int > m_aGetSurroundingHdl
Definition: layout.hxx:637
VclDrawingArea(vcl::Window *pParent, WinBits nStyle)
Definition: layout.hxx:694
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: layout.hxx:674
FactoryFunction m_pFactoryFunction
Definition: layout.hxx:623
Link< tools::Rectangle &, OUString > m_aQueryTooltipHdl
Definition: layout.hxx:636
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: layout.hxx:703
virtual void Resize() override
Definition: layout.hxx:645
Link< const MouseEvent &, bool > m_aMousePressHdl
Definition: layout.hxx:629
void SetGetSurroundingHdl(const Link< OUString &, int > &rLink)
Definition: layout.hxx:765
void SetKeyPressHdl(const Link< const KeyEvent &, bool > &rLink)
Definition: layout.hxx:745
sal_Int8 m_nDragAction
Definition: layout.hxx:626
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: layout.hxx:654
virtual void Command(const CommandEvent &rEvent) override
Definition: layout.hxx:683
EventBoxHelper(vcl::Window *pParent)
Definition: layout.hxx:544
virtual void Command(const CommandEvent &rCEvt) override
Definition: layout.hxx:552
VclEventBox(vcl::Window *pParent)
Definition: layout.hxx:562
VclPtr< EventBoxHelper > m_aEventBoxHelper
Definition: layout.hxx:558
VclPtr< DisclosureButton > m_pDisclosureButton
Definition: layout.hxx:478
DECL_LINK(ClickHdl, CheckBox &, void)
void SetExpandedHdl(const Link< VclExpander &, void > &rLink)
Definition: layout.hxx:471
bool m_bResizeTopLevel
Definition: layout.hxx:477
Link< VclExpander &, void > maExpandedHdl
Definition: layout.hxx:479
DECL_LINK(WindowEventListener, VclWindowEvent &, void)
VclPtr< vcl::Window > m_pLabel
Definition: layout.hxx:426
VclFrame(vcl::Window *pParent)
Definition: layout.hxx:432
int get_column_spacing() const
Definition: layout.hxx:361
bool get_column_homogeneous() const
Definition: layout.hxx:345
int m_nColumnSpacing
Definition: layout.hxx:319
bool m_bColumnHomogeneous
Definition: layout.hxx:317
bool m_bRowHomogeneous
Definition: layout.hxx:316
bool get_row_homogeneous() const
Definition: layout.hxx:341
VclGrid(vcl::Window *pParent)
Definition: layout.hxx:335
int m_nRowSpacing
Definition: layout.hxx:318
void set_row_spacing(int nSpacing)
Definition: layout.hxx:349
void set_column_spacing(int nSpacing)
Definition: layout.hxx:353
int get_row_spacing() const
Definition: layout.hxx:357
virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
Definition: layout.hxx:188
virtual tools::Long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:168
virtual tools::Long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:184
virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
Definition: layout.hxx:180
virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:176
virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
Definition: layout.hxx:172
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:192
VclHBox(vcl::Window *pParent, bool bHomogeneous=false, int nSpacing=0)
Definition: layout.hxx:162
virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:291
virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
Definition: layout.hxx:303
virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
Definition: layout.hxx:287
virtual tools::Long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:283
VclHButtonBox(vcl::Window *pParent)
Definition: layout.hxx:277
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:307
virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
Definition: layout.hxx:295
virtual tools::Long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:299
DECL_LINK(SplitHdl, Splitter *, void)
VclPtr< Splitter > m_pSplitter
Definition: layout.hxx:384
tools::Long m_nPosition
Definition: layout.hxx:385
virtual void set_position(tools::Long nPosition)
Definition: layout.hxx:392
tools::Long get_position() const
Definition: layout.hxx:391
DECL_LINK(ScrollBarHdl, ScrollBar *, void)
ScrollBar & getHorzScrollBar()
Definition: layout.hxx:495
VclPtr< ScrollBar > m_pVScroll
Definition: layout.hxx:512
bool HasVisibleBorder() const
Definition: layout.hxx:493
void setUserManagedScrolling(bool bUserManagedScrolling)
Definition: layout.hxx:499
bool m_bUserManagedScrolling
Definition: layout.hxx:508
DrawFrameFlags m_eDrawFrameFlags
Definition: layout.hxx:511
VclPtr< ScrollBarBox > m_aScrollBarBox
Definition: layout.hxx:514
tools::Long m_nBorderWidth
Definition: layout.hxx:509
ScrollBar & getVertScrollBar()
Definition: layout.hxx:494
VclPtr< ScrollBar > m_pHScroll
Definition: layout.hxx:513
DrawFrameStyle m_eDrawFrameStyle
Definition: layout.hxx:510
std::set< VclPtr< vcl::Window > > & get_widgets()
Definition: layout.hxx:602
std::set< VclPtr< vcl::Window > > m_aWindows
Definition: layout.hxx:579
void insert(vcl::Window *pWindow)
Definition: layout.hxx:590
VclSizeGroupMode m_eMode
Definition: layout.hxx:581
void erase(vcl::Window *pWindow)
Definition: layout.hxx:594
bool m_bIgnoreHidden
Definition: layout.hxx:580
const std::set< VclPtr< vcl::Window > > & get_widgets() const
Definition: layout.hxx:598
bool get_ignore_hidden() const
Definition: layout.hxx:607
VclSizeGroupMode get_mode() const
Definition: layout.hxx:612
virtual void setPrimaryDimension(Size &rSize, tools::Long nHeight) const override
Definition: layout.hxx:133
virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:137
virtual void setSecondaryDimension(Size &rSize, tools::Long nWidth) const override
Definition: layout.hxx:149
virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
Definition: layout.hxx:141
virtual tools::Long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:145
virtual tools::Long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:129
VclVBox(vcl::Window *pParent, bool bHomogeneous=false, int nSpacing=0)
Definition: layout.hxx:123
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:153
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
Definition: layout.hxx:268
virtual tools::Long getSecondaryDimension(const Size &rSize) const override
Definition: layout.hxx:260
VclVButtonBox(vcl::Window *pParent)
Definition: layout.hxx:238
virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
Definition: layout.hxx:252
virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
Definition: layout.hxx:256
virtual void setSecondaryDimension(Size &rSize, tools::Long nWidth) const override
Definition: layout.hxx:264
virtual tools::Long getPrimaryDimension(const Size &rSize) const override
Definition: layout.hxx:244
virtual void setPrimaryDimension(Size &rSize, tools::Long nHeight) const override
Definition: layout.hxx:248
DECL_LINK(SplitHdl, Splitter *, void)
bool m_bInitialAllocation
Definition: layout.hxx:527
VclViewport(vcl::Window *pParent)
Definition: layout.hxx:520
WindowType GetType() const
Definition: window2.cxx:998
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1286
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1925
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1351
virtual void MouseButtonDown(const MouseEvent &rMEvt)
Definition: mouse.cxx:420
virtual void MouseButtonUp(const MouseEvent &rMEvt)
Definition: mouse.cxx:427
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1807
bool get_vexpand() const
Definition: window2.cxx:1759
virtual sal_uInt16 getDefaultAccessibleRole() const
virtual Size GetOptimalSize() const
Definition: window3.cxx:26
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:414
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
Definition: window.cxx:3363
virtual Size GetSizePixel() const
Definition: window.cxx:2404
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
virtual bool set_property(const OString &rKey, const OUString &rValue)
Definition: window2.cxx:1476
bool get_expand() const
Definition: window2.cxx:1771
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1281
virtual void KeyUp(const KeyEvent &rKEvt)
Definition: window.cxx:1824
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
Definition: window2.cxx:1292
bool get_hexpand() const
Definition: window2.cxx:1747
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
DocumentType eType
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow)
Definition: layout.cxx:2923
vcl::Window * firstLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:189
Size getLegacyBestSizeForChildren(const vcl::Window &rWindow)
Definition: layout.cxx:2861
vcl::Window * lastLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:197
void sort_native_button_order(const VclBox &rContainer)
Definition: layout.cxx:857
VclButtonBoxStyle
Definition: layout.hxx:199
vcl::Window * getNonLayoutParent(vcl::Window *pParent)
Definition: layout.cxx:2886
vcl::Window * prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
Definition: dialog.cxx:161
bool isContainerWindow(const vcl::Window &rWindow)
Definition: layout.hxx:816
vcl::Window * nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
Definition: dialog.cxx:133
sal_uInt16 nPos
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
void dispose()
long Long
QPRO_FUNC_TYPE nType
std::vector< tools::Long > m_aMainGroupDimensions
Definition: layout.hxx:226
std::vector< tools::Long > m_aSubGroupDimensions
Definition: layout.hxx:227
bool m_bExpand
Definition: layout.hxx:325
tools::Long m_nValue
Definition: layout.hxx:324
Center
unsigned char sal_uInt8
signed char sal_Int8
DrawFrameStyle
Definition: vclenum.hxx:297
DrawFrameFlags
Definition: vclenum.hxx:309
VclSizeGroupMode
Definition: vclenum.hxx:242
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109
WindowType
Definition: wintypes.hxx:27
WinBits const WB_CLIPCHILDREN
Definition: wintypes.hxx:112
WinBits const WB_HIDE
Definition: wintypes.hxx:160