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 OUString &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 OUString &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 OUString &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 OUString &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 OUString &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);
501 virtual void DumpAsPropertyTree(::tools::JsonWriter& rJsonWriter) override;
502private:
503 virtual Size calculateRequisition() const override;
504 virtual void setAllocation(const Size &rAllocation) override;
505 int CalcBorderWidth() const;
506 DECL_LINK(ScrollBarHdl, ScrollBar*, void);
507 void InitScrollBars(const Size &rRequest);
508 virtual bool EventNotify(NotifyEvent& rNEvt) override;
516};
517
518class VclViewport final : public VclBin
519{
520public:
522 : VclBin(pParent, WB_HIDE | WB_CLIPCHILDREN)
523 , m_bInitialAllocation(true)
524 {
525 }
526private:
527 virtual void setAllocation(const Size &rAllocation) override;
529};
530
531//Enforces that its children are always the same size as itself.
532//Intercepts any Commands intended for its children.
533//
534//by default the Commands are discarded, inherit from this
535//and implement "Command" to get them
536class VclEventBox final : public VclBin
537{
538private:
539 //Any Commands an EventBoxHelper receives are forwarded to its parent
540 //The VclEventBox ensures that m_aEventBoxHelper is the
541 //first child and is transparent, but covers the rest of the children
542 class EventBoxHelper final : public vcl::Window
543 {
544 public:
546 : Window(pParent, 0)
547 {
548 SetSizePixel(pParent->GetSizePixel());
549 EnableChildTransparentMode();
550 SetPaintTransparent(true);
551 SetBackground();
552 }
553 virtual void Command(const CommandEvent& rCEvt) override
554 {
555 GetParent()->Command(rCEvt);
556 }
557 };
558
560 virtual void dispose() override;
561 virtual ~VclEventBox() override;
562public:
564 : VclBin(pParent)
565 , m_aEventBoxHelper(VclPtr<EventBoxHelper>::Create(this))
566 {
567 m_aEventBoxHelper->Show();
568 }
569 virtual vcl::Window *get_child() override;
570 virtual const vcl::Window *get_child() const override;
571 virtual Size calculateRequisition() const override;
572 virtual void setAllocation(const Size &rAllocation) override;
573
574 virtual void Command(const CommandEvent& rCEvt) override;
575};
576
578{
579private:
580 std::set< VclPtr<vcl::Window> > m_aWindows;
583
584 void trigger_queue_resize();
585public:
587 : m_bIgnoreHidden(false)
588 , m_eMode(VclSizeGroupMode::Horizontal)
589 {
590 }
591 void insert(vcl::Window *pWindow)
592 {
593 m_aWindows.insert(VclPtr<vcl::Window>(pWindow));
594 }
595 void erase(vcl::Window *pWindow)
596 {
597 m_aWindows.erase(VclPtr<vcl::Window>(pWindow));
598 }
599 const std::set< VclPtr<vcl::Window> >& get_widgets() const
600 {
601 return m_aWindows;
602 }
603 std::set< VclPtr<vcl::Window> >& get_widgets()
604 {
605 return m_aWindows;
606 }
607 void set_ignore_hidden(bool bIgnoreHidden);
608 bool get_ignore_hidden() const
609 {
610 return m_bIgnoreHidden;
611 }
612 void set_mode(VclSizeGroupMode eMode);
614 {
615 return m_eMode;
616 }
617 void set_property(const OUString &rKey, const OUString &rValue);
618};
619
621 , public DragSourceHelper
622{
623private:
641
642 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override
643 {
644 m_aPaintHdl.Call(std::pair<vcl::RenderContext&, const tools::Rectangle&>(rRenderContext, rRect));
645 }
646 virtual void Resize() override
647 {
648 m_aResizeHdl.Call(GetOutputSizePixel());
649 }
650 virtual void KeyInput(const KeyEvent& rKEvt) override
651 {
652 if (!m_aKeyPressHdl.Call(rKEvt))
653 Control::KeyInput(rKEvt);
654
655 }
656 virtual void KeyUp(const KeyEvent& rKEvt) override
657 {
658 if (!m_aKeyReleaseHdl.Call(rKEvt))
659 Control::KeyUp(rKEvt);
660 }
661 virtual void StateChanged(StateChangedType nType) override
662 {
665 {
666 m_aStyleUpdatedHdl.Call(*this);
667 Invalidate();
668 }
669 }
670 virtual void DataChanged(const DataChangedEvent& rDCEvt) override
671 {
672 Control::DataChanged(rDCEvt);
674 {
675 m_aStyleUpdatedHdl.Call(*this);
676 Invalidate();
677 }
678 }
679 virtual void Command(const CommandEvent& rEvent) override
680 {
681 if (m_aCommandHdl.Call(rEvent))
682 return;
683 Control::Command(rEvent);
684 }
685 virtual void RequestHelp(const HelpEvent& rHelpEvent) override;
686 virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override;
687 virtual FactoryFunction GetUITestFactory() const override;
688
689public:
691 : Control(pParent, nStyle)
692 , DragSourceHelper(this)
693 , m_pFactoryFunction(nullptr)
694 , m_pUserData(nullptr)
695 , m_nDragAction(0)
696 {
697 SetBackground();
698 }
699 virtual void MouseButtonDown(const MouseEvent& rMEvt) override
700 {
701 if (!m_aMousePressHdl.Call(rMEvt))
703 }
704 virtual void MouseButtonUp(const MouseEvent& rMEvt) override
705 {
706 if (!m_aMouseReleaseHdl.Call(rMEvt))
708 }
709 virtual void MouseMove(const MouseEvent& rMEvt) override
710 {
711 if (!m_aMouseMotionHdl.Call(rMEvt))
712 Control::MouseMove(rMEvt);
713 }
714 virtual OUString GetSurroundingText() const override;
715 virtual Selection GetSurroundingTextSelection() const override;
716 virtual bool DeleteSurroundingText(const Selection& rSelection) override;
717 void SetUITestFactory(FactoryFunction pFactoryFunction, void* pUserData)
718 {
719 m_pFactoryFunction = pFactoryFunction;
720 m_pUserData = pUserData;
721 }
722 void* GetUserData() const
723 {
724 return m_pUserData;
725 }
726 void SetPaintHdl(const Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>& rLink)
727 {
728 m_aPaintHdl = rLink;
729 }
731 {
732 m_aResizeHdl = rLink;
733 }
735 {
736 m_aMousePressHdl = rLink;
737 }
739 {
740 m_aMouseMotionHdl = rLink;
741 }
743 {
744 m_aMouseReleaseHdl = rLink;
745 }
747 {
748 m_aKeyPressHdl = rLink;
749 }
751 {
752 m_aKeyReleaseHdl = rLink;
753 }
755 {
756 m_aStyleUpdatedHdl = rLink;
757 }
759 {
760 m_aCommandHdl = rLink;
761 }
763 {
764 m_aQueryTooltipHdl = rLink;
765 }
767 {
768 m_aGetSurroundingHdl = rLink;
769 }
771 {
772 m_aDeleteSurroundingHdl = rLink;
773 }
775 {
776 m_aStartDragHdl = rLink;
777 }
779 {
780 m_xTransferHelper = rHelper;
781 m_nDragAction = eDNDConstants;
782 }
783 virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
784};
785
786//Get first window of a pTopLevel window as
787//if any intermediate layout widgets didn't exist
788//i.e. acts like pChild = pChild->GetWindow(GetWindowType::FirstChild);
789//in a flat hierarchy where dialogs only have one layer
790//of children
792
793//Get last window of a pTopLevel window as
794//if any intermediate layout widgets didn't exist
795//i.e. acts like pChild = pChild->GetWindow(GetWindowType::LastChild);
796//in a flat hierarchy where dialogs only have one layer
797//of children
799
800//Get next window after pChild of a pTopLevel window as
801//if any intermediate layout widgets didn't exist
802//i.e. acts like pChild = pChild->GetWindow(GetWindowType::Next);
803//in a flat hierarchy where dialogs only have one layer
804//of children
805vcl::Window* nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
806
807//Get previous window before pChild of a pTopLevel window as
808//if any intermediate layout widgets didn't exist
809//i.e. acts like pChild = pChild->GetWindow(GetWindowType::Prev);
810//in a flat hierarchy where dialogs only have one layer
811//of children
812vcl::Window* prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
813
814//Returns true is the Window has a single child which is a container
815VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow);
816
817inline bool isContainerWindow(const vcl::Window &rWindow)
818{
819 WindowType eType = rWindow.GetType();
822}
823
824inline bool isContainerWindow(const vcl::Window *pWindow)
825{
826 return pWindow && isContainerWindow(*pWindow);
827}
828
829// retro-fitting utilities
830
831//Get a Size which is large enough to contain all children with
832//an equal amount of space at top left and bottom right
834
835//Get first parent which is not a layout widget
837
838//Sort ok/cancel etc buttons in platform order
839void sort_native_button_order(const VclBox& rContainer);
840
841#endif
842
843/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 m_nPosition
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:237
Definition: ctrl.hxx:80
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:256
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:170
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long getX() const
constexpr tools::Long getY() const
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:642
Link< std::pair< vcl::RenderContext &, const tools::Rectangle & >, void > m_aPaintHdl
Definition: layout.hxx:628
void SetStyleUpdatedHdl(const Link< VclDrawingArea &, void > &rLink)
Definition: layout.hxx:754
Link< const MouseEvent &, bool > m_aMouseReleaseHdl
Definition: layout.hxx:632
void SetCommandHdl(const Link< const CommandEvent &, bool > &rLink)
Definition: layout.hxx:758
void * m_pUserData
Definition: layout.hxx:625
rtl::Reference< TransferDataContainer > m_xTransferHelper
Definition: layout.hxx:626
Link< const MouseEvent &, bool > m_aMouseMotionHdl
Definition: layout.hxx:631
void * GetUserData() const
Definition: layout.hxx:722
void SetMouseMoveHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:738
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: layout.hxx:704
void SetDeleteSurroundingHdl(const Link< const Selection &, bool > &rLink)
Definition: layout.hxx:770
Link< VclDrawingArea &, void > m_aStyleUpdatedHdl
Definition: layout.hxx:635
Link< const KeyEvent &, bool > m_aKeyPressHdl
Definition: layout.hxx:633
virtual void KeyUp(const KeyEvent &rKEvt) override
Definition: layout.hxx:656
Link< const CommandEvent &, bool > m_aCommandHdl
Definition: layout.hxx:636
void SetQueryTooltipHdl(const Link< tools::Rectangle &, OUString > &rLink)
Definition: layout.hxx:762
Link< const Size &, void > m_aResizeHdl
Definition: layout.hxx:629
void SetMouseReleaseHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:742
void SetMousePressHdl(const Link< const MouseEvent &, bool > &rLink)
Definition: layout.hxx:734
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: layout.hxx:709
void SetResizeHdl(const Link< const Size &, void > &rLink)
Definition: layout.hxx:730
void SetDragHelper(const rtl::Reference< TransferDataContainer > &rHelper, sal_uInt8 eDNDConstants)
Definition: layout.hxx:778
Link< VclDrawingArea *, bool > m_aStartDragHdl
Definition: layout.hxx:640
void SetStartDragHdl(const Link< VclDrawingArea *, bool > &rLink)
Definition: layout.hxx:774
Link< const Selection &, bool > m_aDeleteSurroundingHdl
Definition: layout.hxx:639
void SetUITestFactory(FactoryFunction pFactoryFunction, void *pUserData)
Definition: layout.hxx:717
void SetPaintHdl(const Link< std::pair< vcl::RenderContext &, const tools::Rectangle & >, void > &rLink)
Definition: layout.hxx:726
void SetKeyReleaseHdl(const Link< const KeyEvent &, bool > &rLink)
Definition: layout.hxx:750
virtual void StateChanged(StateChangedType nType) override
Definition: layout.hxx:661
Link< const KeyEvent &, bool > m_aKeyReleaseHdl
Definition: layout.hxx:634
Link< OUString &, int > m_aGetSurroundingHdl
Definition: layout.hxx:638
VclDrawingArea(vcl::Window *pParent, WinBits nStyle)
Definition: layout.hxx:690
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: layout.hxx:670
FactoryFunction m_pFactoryFunction
Definition: layout.hxx:624
Link< tools::Rectangle &, OUString > m_aQueryTooltipHdl
Definition: layout.hxx:637
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: layout.hxx:699
virtual void Resize() override
Definition: layout.hxx:646
Link< const MouseEvent &, bool > m_aMousePressHdl
Definition: layout.hxx:630
void SetGetSurroundingHdl(const Link< OUString &, int > &rLink)
Definition: layout.hxx:766
void SetKeyPressHdl(const Link< const KeyEvent &, bool > &rLink)
Definition: layout.hxx:746
sal_Int8 m_nDragAction
Definition: layout.hxx:627
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: layout.hxx:650
virtual void Command(const CommandEvent &rEvent) override
Definition: layout.hxx:679
EventBoxHelper(vcl::Window *pParent)
Definition: layout.hxx:545
virtual void Command(const CommandEvent &rCEvt) override
Definition: layout.hxx:553
VclEventBox(vcl::Window *pParent)
Definition: layout.hxx:563
VclPtr< EventBoxHelper > m_aEventBoxHelper
Definition: layout.hxx:559
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:513
bool HasVisibleBorder() const
Definition: layout.hxx:493
void setUserManagedScrolling(bool bUserManagedScrolling)
Definition: layout.hxx:499
bool m_bUserManagedScrolling
Definition: layout.hxx:509
DrawFrameFlags m_eDrawFrameFlags
Definition: layout.hxx:512
VclPtr< ScrollBarBox > m_aScrollBarBox
Definition: layout.hxx:515
tools::Long m_nBorderWidth
Definition: layout.hxx:510
ScrollBar & getVertScrollBar()
Definition: layout.hxx:494
VclPtr< ScrollBar > m_pHScroll
Definition: layout.hxx:514
DrawFrameStyle m_eDrawFrameStyle
Definition: layout.hxx:511
std::set< VclPtr< vcl::Window > > & get_widgets()
Definition: layout.hxx:603
std::set< VclPtr< vcl::Window > > m_aWindows
Definition: layout.hxx:580
void insert(vcl::Window *pWindow)
Definition: layout.hxx:591
VclSizeGroupMode m_eMode
Definition: layout.hxx:582
void erase(vcl::Window *pWindow)
Definition: layout.hxx:595
bool m_bIgnoreHidden
Definition: layout.hxx:581
const std::set< VclPtr< vcl::Window > > & get_widgets() const
Definition: layout.hxx:599
bool get_ignore_hidden() const
Definition: layout.hxx:608
VclSizeGroupMode get_mode() const
Definition: layout.hxx:613
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:528
VclViewport(vcl::Window *pParent)
Definition: layout.hxx:521
WindowType GetType() const
Definition: window2.cxx:1000
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1288
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1923
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1353
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:1805
bool get_vexpand() const
Definition: window2.cxx:1761
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:3356
virtual Size GetSizePixel() const
Definition: window.cxx:2402
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
bool get_expand() const
Definition: window2.cxx:1773
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1283
virtual void KeyUp(const KeyEvent &rKEvt)
Definition: window.cxx:1822
virtual bool set_property(const OUString &rKey, const OUString &rValue)
Definition: window2.cxx:1478
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
Definition: window2.cxx:1294
bool get_hexpand() const
Definition: window2.cxx:1749
#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:3005
vcl::Window * firstLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:189
Size getLegacyBestSizeForChildren(const vcl::Window &rWindow)
Definition: layout.cxx:2943
vcl::Window * lastLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:197
void sort_native_button_order(const VclBox &rContainer)
Definition: layout.cxx:862
VclButtonBoxStyle
Definition: layout.hxx:199
vcl::Window * getNonLayoutParent(vcl::Window *pParent)
Definition: layout.cxx:2968
vcl::Window * prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
Definition: dialog.cxx:161
bool isContainerWindow(const vcl::Window &rWindow)
Definition: layout.hxx:817
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:290
DrawFrameFlags
Definition: vclenum.hxx:302
VclSizeGroupMode
Definition: vclenum.hxx:235
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