tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / include / vcl / layout.hxx
blobc42802cc328d29a111bab2fa5e24e9053b69f0ea
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #pragma once
12 #include <config_options.h>
13 #include <vcl/dllapi.h>
14 #include <vcl/ctrl.hxx>
15 #include <vcl/svapp.hxx>
16 #include <vcl/window.hxx>
17 #include <vcl/settings.hxx>
18 #include <vcl/event.hxx>
19 #include <vcl/transfer.hxx>
20 #include <vcl/vclptr.hxx>
21 #include <vcl/IContext.hxx>
22 #include <vcl/commandevent.hxx>
23 #include <set>
25 class ScrollBar;
26 class ScrollBarBox;
27 class Splitter;
29 class VCL_DLLPUBLIC VclContainer : public vcl::Window,
30 public vcl::IContext
32 public:
33 VclContainer(vcl::Window *pParent, WinBits nStyle = WB_HIDE | WB_CLIPCHILDREN);
35 //These take into account the external margins of the rWindow widget
36 //while GetOptimalSize/get_preferred_size and SetPosSizePixel are
37 //oblivious to them
38 static Size getLayoutRequisition(const vcl::Window &rWindow);
39 static void setLayoutPosSize(vcl::Window &rWindow, const Point &rPos, const Size &rSize);
41 //applies the allocation pos and size onto rWindow via setLayoutPosSize taking into account
42 //the rWindows alignment desires within that allocation
43 static void setLayoutAllocation(vcl::Window &rWindow, const Point &rPos, const Size &rSize);
45 virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
46 protected:
47 //these are the two that need to be implemented by
48 //containers, figure out how much space you want...
49 virtual Size calculateRequisition() const = 0;
50 //..and decide what to do when set to this size
51 virtual void setAllocation(const Size &rAllocation) = 0;
53 virtual sal_uInt16 getDefaultAccessibleRole() const override;
55 // support for screenshot context menu
56 virtual void Command(const CommandEvent& rCEvt) override;
58 public:
59 //you don't want to override these
60 virtual Size GetOptimalSize() const override;
61 virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize) override;
62 virtual void SetPosPixel(const Point& rAllocPos) override;
63 virtual void SetSizePixel(const Size& rAllocation) override;
64 private:
65 bool m_bLayoutDirty;
68 class VCL_DLLPUBLIC VclBox : public VclContainer
70 protected:
71 bool m_bHomogeneous;
72 bool m_bVerticalContainer;
73 int m_nSpacing;
74 public:
75 VclBox(vcl::Window *pParent, bool bHomogeneous, int nSpacing)
76 : VclContainer(pParent)
77 , m_bHomogeneous(bHomogeneous)
78 , m_bVerticalContainer(false)
79 , m_nSpacing(nSpacing)
82 void set_spacing(int nSpacing)
84 m_nSpacing = nSpacing;
86 int get_spacing() const
88 return m_nSpacing;
90 void set_homogeneous(bool bHomogeneous)
92 m_bHomogeneous = bHomogeneous;
94 bool get_orientation() const
96 return m_bVerticalContainer;
98 virtual bool set_property(const OUString &rKey, const OUString &rValue) override;
99 virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
100 protected:
101 virtual sal_uInt16 getDefaultAccessibleRole() const override;
102 void accumulateMaxes(const Size &rChildSize, Size &rSize) const;
103 Size finalizeMaxes(const Size &rSize, sal_uInt16 nVisibleChildren) const;
105 virtual Size calculateRequisition() const override;
106 virtual void setAllocation(const Size &rAllocation) override;
108 virtual tools::Long getPrimaryDimension(const Size &rSize) const = 0;
109 virtual void setPrimaryDimension(Size &rSize, tools::Long) const = 0;
110 virtual tools::Long getPrimaryCoordinate(const Point &rPos) const = 0;
111 virtual void setPrimaryCoordinate(Point &rPos, tools::Long) const = 0;
112 virtual tools::Long getSecondaryDimension(const Size &rSize) const = 0;
113 virtual void setSecondaryDimension(Size &rSize, tools::Long) const = 0;
115 virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const = 0;
118 class VCL_DLLPUBLIC VclVBox : public VclBox
120 public:
121 VclVBox(vcl::Window *pParent, bool bHomogeneous = false, int nSpacing = 0)
122 : VclBox(pParent, bHomogeneous, nSpacing)
124 m_bVerticalContainer = true;
126 protected:
127 virtual tools::Long getPrimaryDimension(const Size &rSize) const override
129 return rSize.getHeight();
131 virtual void setPrimaryDimension(Size &rSize, tools::Long nHeight) const override
133 rSize.setHeight(nHeight);
135 virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
137 return rPos.getY();
139 virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
141 rPos.setY(nPos);
143 virtual tools::Long getSecondaryDimension(const Size &rSize) const override
145 return rSize.getWidth();
147 virtual void setSecondaryDimension(Size &rSize, tools::Long nWidth) const override
149 rSize.setWidth(nWidth);
151 virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
153 return rWindow.get_expand() || rWindow.get_vexpand();
157 class VCL_DLLPUBLIC VclHBox : public VclBox
159 public:
160 VclHBox(vcl::Window *pParent, bool bHomogeneous = false, int nSpacing = 0)
161 : VclBox(pParent, bHomogeneous, nSpacing)
163 m_bVerticalContainer = false;
165 protected:
166 virtual tools::Long getPrimaryDimension(const Size &rSize) const override
168 return rSize.getWidth();
170 virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
172 rSize.setWidth(nWidth);
174 virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
176 return rPos.getX();
178 virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
180 rPos.setX(nPos);
182 virtual tools::Long getSecondaryDimension(const Size &rSize) const override
184 return rSize.getHeight();
186 virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
188 rSize.setHeight(nHeight);
190 virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
192 return rWindow.get_expand() || rWindow.get_hexpand();
196 enum class VclButtonBoxStyle
198 Default,
199 Spread,
200 Edge,
201 Start,
202 End,
203 Center
206 class VCL_DLLPUBLIC VclButtonBox : public VclBox
208 public:
209 VclButtonBox(vcl::Window *pParent)
210 : VclBox(pParent, false, Application::GetSettings().GetStyleSettings().GetDialogStyle().button_spacing)
211 , m_eLayoutStyle(VclButtonBoxStyle::Default)
214 virtual bool set_property(const OUString &rKey, const OUString &rValue) override;
215 virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
216 protected:
217 virtual Size calculateRequisition() const override;
218 virtual void setAllocation(const Size &rAllocation) override;
219 Size addSpacing(const Size &rSize, sal_uInt16 nVisibleChildren) const;
220 private:
221 VclButtonBoxStyle m_eLayoutStyle;
222 struct Requisition
224 std::vector<tools::Long> m_aMainGroupDimensions;
225 std::vector<tools::Long> m_aSubGroupDimensions;
226 Size m_aMainGroupSize;
227 Size m_aSubGroupSize;
229 Requisition calculatePrimarySecondaryRequisitions() const;
230 Size addReqGroups(const VclButtonBox::Requisition &rReq) const;
233 class VCL_DLLPUBLIC VclVButtonBox : public VclButtonBox
235 public:
236 VclVButtonBox(vcl::Window *pParent)
237 : VclButtonBox(pParent)
239 m_bVerticalContainer = true;
241 protected:
242 virtual tools::Long getPrimaryDimension(const Size &rSize) const override
244 return rSize.getHeight();
246 virtual void setPrimaryDimension(Size &rSize, tools::Long nHeight) const override
248 rSize.setHeight(nHeight);
250 virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
252 return rPos.getY();
254 virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
256 rPos.setY(nPos);
258 virtual tools::Long getSecondaryDimension(const Size &rSize) const override
260 return rSize.getWidth();
262 virtual void setSecondaryDimension(Size &rSize, tools::Long nWidth) const override
264 rSize.setWidth(nWidth);
266 virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
268 return rWindow.get_expand() || rWindow.get_vexpand();
272 class VCL_DLLPUBLIC VclHButtonBox final : public VclButtonBox
274 public:
275 VclHButtonBox(vcl::Window *pParent)
276 : VclButtonBox(pParent)
278 m_bVerticalContainer = false;
280 private:
281 virtual tools::Long getPrimaryDimension(const Size &rSize) const override
283 return rSize.getWidth();
285 virtual void setPrimaryDimension(Size &rSize, tools::Long nWidth) const override
287 rSize.setWidth(nWidth);
289 virtual tools::Long getPrimaryCoordinate(const Point &rPos) const override
291 return rPos.getX();
293 virtual void setPrimaryCoordinate(Point &rPos, tools::Long nPos) const override
295 rPos.setX(nPos);
297 virtual tools::Long getSecondaryDimension(const Size &rSize) const override
299 return rSize.getHeight();
301 virtual void setSecondaryDimension(Size &rSize, tools::Long nHeight) const override
303 rSize.setHeight(nHeight);
305 virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const override
307 return rWindow.get_expand() || rWindow.get_hexpand();
311 class VCL_DLLPUBLIC VclGrid final : public VclContainer
313 private:
314 bool m_bRowHomogeneous;
315 bool m_bColumnHomogeneous;
316 int m_nRowSpacing;
317 int m_nColumnSpacing;
319 public:
320 struct Value
322 tools::Long m_nValue;
323 bool m_bExpand;
324 Value() : m_nValue(0), m_bExpand(false) {}
326 private:
328 Size calculateRequisitionForSpacings(sal_Int32 nRowSpacing, sal_Int32 nColSpacing) const;
329 virtual Size calculateRequisition() const override;
330 virtual void setAllocation(const Size &rAllocation) override;
331 virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
332 public:
333 VclGrid(vcl::Window *pParent)
334 : VclContainer(pParent)
335 , m_bRowHomogeneous(false), m_bColumnHomogeneous(false)
336 , m_nRowSpacing(0), m_nColumnSpacing(0)
339 bool get_row_homogeneous() const
341 return m_bRowHomogeneous;
343 bool get_column_homogeneous() const
345 return m_bColumnHomogeneous;
347 void set_row_spacing(int nSpacing)
349 m_nRowSpacing = nSpacing;
351 void set_column_spacing(int nSpacing)
353 m_nColumnSpacing = nSpacing;
355 int get_row_spacing() const
357 return m_nRowSpacing;
359 int get_column_spacing() const
361 return m_nColumnSpacing;
363 virtual bool set_property(const OUString &rKey, const OUString &rValue) override;
366 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) VclBin : public VclContainer
368 public:
369 VclBin(vcl::Window *pParent, WinBits nStyle = WB_HIDE | WB_CLIPCHILDREN)
370 : VclContainer(pParent, nStyle)
373 virtual vcl::Window *get_child();
374 virtual const vcl::Window *get_child() const;
375 virtual Size calculateRequisition() const override;
376 virtual void setAllocation(const Size &rAllocation) override;
379 class VclPaned : public VclContainer
381 protected:
382 VclPtr<Splitter> m_pSplitter;
383 tools::Long m_nPosition;
385 VclPaned(vcl::Window *pParent, bool bVertical);
386 public:
387 virtual ~VclPaned() override;
388 virtual void dispose() override;
389 tools::Long get_position() const { return m_nPosition; }
390 virtual void set_position(tools::Long nPosition) { m_nPosition = nPosition; }
393 class VclVPaned final : public VclPaned
395 private:
396 DECL_LINK(SplitHdl, Splitter*, void);
397 void arrange(const Size& rAllocation, tools::Long nFirstHeight, tools::Long nSecondHeight);
399 public:
400 VclVPaned(vcl::Window *pParent);
401 virtual ~VclVPaned() override;
402 virtual Size calculateRequisition() const override;
403 virtual void setAllocation(const Size &rAllocation) override;
404 virtual void set_position(tools::Long nPosition) override;
407 class VclHPaned final : public VclPaned
409 private:
410 DECL_LINK(SplitHdl, Splitter*, void);
411 void arrange(const Size& rAllocation, tools::Long nFirstHeight, tools::Long nSecondHeight);
413 public:
414 VclHPaned(vcl::Window *pParent);
415 virtual ~VclHPaned() override;
416 virtual Size calculateRequisition() const override;
417 virtual void setAllocation(const Size &rAllocation) override;
418 virtual void set_position(tools::Long nPosition) override;
421 class VclFrame final : public VclBin
423 private:
424 VclPtr<vcl::Window> m_pLabel;
425 private:
426 friend class VclBuilder;
427 void designate_label(vcl::Window *pWindow);
428 DECL_LINK(WindowEventListener, VclWindowEvent&, void);
429 public:
430 VclFrame(vcl::Window *pParent)
431 : VclBin(pParent)
432 , m_pLabel(nullptr)
435 virtual ~VclFrame() override;
436 virtual void dispose() override;
437 void set_label(const OUString &rLabel);
438 OUString get_label() const;
439 virtual vcl::Window *get_child() override;
440 virtual const vcl::Window *get_child() const override;
441 vcl::Window *get_label_widget();
442 const vcl::Window *get_label_widget() const;
443 virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
444 private:
445 virtual Size calculateRequisition() const override;
446 virtual void setAllocation(const Size &rAllocation) override;
447 virtual OUString getDefaultAccessibleName() const override;
450 class DisclosureButton;
451 class CheckBox;
453 class VclExpander final : public VclBin
455 public:
456 VclExpander(vcl::Window *pParent);
457 virtual ~VclExpander() override;
458 virtual void dispose() override;
459 virtual vcl::Window *get_child() override;
460 virtual const vcl::Window *get_child() const override;
461 virtual bool set_property(const OUString &rKey, const OUString &rValue) override;
462 bool get_expanded() const;
463 void set_expanded(bool bExpanded);
464 void set_label(const OUString& rLabel);
465 OUString get_label() const;
466 vcl::Window *get_label_widget();
467 const vcl::Window *get_label_widget() const;
468 virtual void StateChanged(StateChangedType nType) override;
469 void SetExpandedHdl( const Link<VclExpander&,void>& rLink ) { maExpandedHdl = rLink; }
470 virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
471 virtual FactoryFunction GetUITestFactory() const override;
472 private:
473 virtual Size calculateRequisition() const override;
474 virtual void setAllocation(const Size &rAllocation) override;
475 bool m_bResizeTopLevel;
476 VclPtr<DisclosureButton> m_pDisclosureButton;
477 Link<VclExpander&,void> maExpandedHdl;
478 DECL_LINK(ClickHdl, CheckBox&, void);
481 class VclScrolledWindow final : public VclBin
483 public:
484 VclScrolledWindow(vcl::Window *pParent );
485 virtual ~VclScrolledWindow() override;
486 virtual void dispose() override;
487 virtual vcl::Window *get_child() override;
488 virtual const vcl::Window *get_child() const override;
489 virtual bool set_property(const OUString &rKey, const OUString &rValue) override;
490 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
491 bool HasVisibleBorder() const { return m_eDrawFrameStyle != DrawFrameStyle::NONE; }
492 ScrollBar& getVertScrollBar() { return *m_pVScroll; }
493 ScrollBar& getHorzScrollBar() { return *m_pHScroll; }
494 Size getVisibleChildSize() const;
495 //set to true to disable the built-in scrolling callbacks to allow the user
496 //to override it
497 void setUserManagedScrolling(bool bUserManagedScrolling) { m_bUserManagedScrolling = bUserManagedScrolling;}
498 void doSetAllocation(const Size &rAllocation, bool bRetryOnFailure);
499 virtual void DumpAsPropertyTree(::tools::JsonWriter& rJsonWriter) override;
500 private:
501 virtual Size calculateRequisition() const override;
502 virtual void setAllocation(const Size &rAllocation) override;
503 int CalcBorderWidth() const;
504 DECL_LINK(ScrollBarHdl, ScrollBar*, void);
505 void InitScrollBars(const Size &rRequest);
506 virtual bool EventNotify(NotifyEvent& rNEvt) override;
507 bool m_bUserManagedScrolling;
508 tools::Long m_nBorderWidth;
509 DrawFrameStyle m_eDrawFrameStyle;
510 DrawFrameFlags m_eDrawFrameFlags;
511 VclPtr<ScrollBar> m_pVScroll;
512 VclPtr<ScrollBar> m_pHScroll;
513 VclPtr<ScrollBarBox> m_aScrollBarBox;
516 class VclViewport final : public VclBin
518 public:
519 VclViewport(vcl::Window *pParent)
520 : VclBin(pParent, WB_HIDE | WB_CLIPCHILDREN)
521 , m_bInitialAllocation(true)
524 private:
525 virtual void setAllocation(const Size &rAllocation) override;
526 bool m_bInitialAllocation;
529 //Enforces that its children are always the same size as itself.
530 //Intercepts any Commands intended for its children.
532 //by default the Commands are discarded, inherit from this
533 //and implement "Command" to get them
534 class VclEventBox final : public VclBin
536 private:
537 //Any Commands an EventBoxHelper receives are forwarded to its parent
538 //The VclEventBox ensures that m_aEventBoxHelper is the
539 //first child and is transparent, but covers the rest of the children
540 class EventBoxHelper final : public vcl::Window
542 public:
543 EventBoxHelper(vcl::Window* pParent)
544 : Window(pParent, 0)
546 SetSizePixel(pParent->GetSizePixel());
547 EnableChildTransparentMode();
548 SetPaintTransparent(true);
549 SetBackground();
551 virtual void Command(const CommandEvent& rCEvt) override
553 GetParent()->Command(rCEvt);
557 VclPtr<EventBoxHelper> m_aEventBoxHelper;
558 virtual void dispose() override;
559 virtual ~VclEventBox() override;
560 public:
561 VclEventBox(vcl::Window* pParent)
562 : VclBin(pParent)
563 , m_aEventBoxHelper(VclPtr<EventBoxHelper>::Create(this))
565 m_aEventBoxHelper->Show();
567 virtual vcl::Window *get_child() override;
568 virtual const vcl::Window *get_child() const override;
569 virtual Size calculateRequisition() const override;
570 virtual void setAllocation(const Size &rAllocation) override;
572 virtual void Command(const CommandEvent& rCEvt) override;
575 class VclSizeGroup
577 private:
578 std::set< VclPtr<vcl::Window> > m_aWindows;
579 bool m_bIgnoreHidden;
580 VclSizeGroupMode m_eMode;
582 void trigger_queue_resize();
583 public:
584 VclSizeGroup()
585 : m_bIgnoreHidden(false)
586 , m_eMode(VclSizeGroupMode::Horizontal)
589 void insert(vcl::Window *pWindow)
591 m_aWindows.insert(VclPtr<vcl::Window>(pWindow));
593 void erase(vcl::Window *pWindow)
595 m_aWindows.erase(VclPtr<vcl::Window>(pWindow));
597 const std::set< VclPtr<vcl::Window> >& get_widgets() const
599 return m_aWindows;
601 std::set< VclPtr<vcl::Window> >& get_widgets()
603 return m_aWindows;
605 void set_ignore_hidden(bool bIgnoreHidden);
606 bool get_ignore_hidden() const
608 return m_bIgnoreHidden;
610 void set_mode(VclSizeGroupMode eMode);
611 VclSizeGroupMode get_mode() const
613 return m_eMode;
615 void set_property(const OUString &rKey, const OUString &rValue);
618 class VCL_DLLPUBLIC VclDrawingArea final : public Control
619 , public DragSourceHelper
621 private:
622 FactoryFunction m_pFactoryFunction;
623 void* m_pUserData;
624 rtl::Reference<TransferDataContainer> m_xTransferHelper;
625 sal_Int8 m_nDragAction;
626 Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void> m_aPaintHdl;
627 Link<const Size&, void> m_aResizeHdl;
628 Link<const MouseEvent&, bool> m_aMousePressHdl;
629 Link<const MouseEvent&, bool> m_aMouseMotionHdl;
630 Link<const MouseEvent&, bool> m_aMouseReleaseHdl;
631 Link<const KeyEvent&, bool> m_aKeyPressHdl;
632 Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
633 Link<VclDrawingArea&, void> m_aStyleUpdatedHdl;
634 Link<const CommandEvent&, bool> m_aCommandHdl;
635 Link<tools::Rectangle&, OUString> m_aQueryTooltipHdl;
636 Link<OUString&, int> m_aGetSurroundingHdl;
637 Link<const Selection&, bool> m_aDeleteSurroundingHdl;
638 Link<VclDrawingArea*, bool> m_aStartDragHdl;
640 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override
642 m_aPaintHdl.Call(std::pair<vcl::RenderContext&, const tools::Rectangle&>(rRenderContext, rRect));
644 virtual void Resize() override
646 m_aResizeHdl.Call(GetOutputSizePixel());
648 virtual void KeyInput(const KeyEvent& rKEvt) override
650 if (!m_aKeyPressHdl.Call(rKEvt))
651 Control::KeyInput(rKEvt);
654 virtual void KeyUp(const KeyEvent& rKEvt) override
656 if (!m_aKeyReleaseHdl.Call(rKEvt))
657 Control::KeyUp(rKEvt);
659 virtual void StateChanged(StateChangedType nType) override
661 Control::StateChanged(nType);
662 if (nType == StateChangedType::ControlForeground || nType == StateChangedType::ControlBackground)
664 m_aStyleUpdatedHdl.Call(*this);
665 Invalidate();
668 virtual void DataChanged(const DataChangedEvent& rDCEvt) override
670 Control::DataChanged(rDCEvt);
671 if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
673 m_aStyleUpdatedHdl.Call(*this);
674 Invalidate();
677 virtual void Command(const CommandEvent& rEvent) override
679 if (m_aCommandHdl.Call(rEvent))
680 return;
681 Control::Command(rEvent);
683 virtual void RequestHelp(const HelpEvent& rHelpEvent) override;
684 virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override;
685 virtual FactoryFunction GetUITestFactory() const override;
687 public:
688 VclDrawingArea(vcl::Window *pParent, WinBits nStyle)
689 : Control(pParent, nStyle)
690 , DragSourceHelper(this)
691 , m_pFactoryFunction(nullptr)
692 , m_pUserData(nullptr)
693 , m_nDragAction(0)
695 SetBackground();
697 virtual void MouseButtonDown(const MouseEvent& rMEvt) override
699 if (!m_aMousePressHdl.Call(rMEvt))
700 Control::MouseButtonDown(rMEvt);
702 virtual void MouseButtonUp(const MouseEvent& rMEvt) override
704 if (!m_aMouseReleaseHdl.Call(rMEvt))
705 Control::MouseButtonUp(rMEvt);
707 virtual void MouseMove(const MouseEvent& rMEvt) override
709 if (!m_aMouseMotionHdl.Call(rMEvt))
710 Control::MouseMove(rMEvt);
712 virtual OUString GetSurroundingText() const override;
713 virtual Selection GetSurroundingTextSelection() const override;
714 virtual bool DeleteSurroundingText(const Selection& rSelection) override;
715 void SetUITestFactory(const FactoryFunction& pFactoryFunction, void* pUserData)
717 m_pFactoryFunction = pFactoryFunction;
718 m_pUserData = pUserData;
720 void* GetUserData() const
722 return m_pUserData;
724 void SetPaintHdl(const Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>& rLink)
726 m_aPaintHdl = rLink;
728 void SetResizeHdl(const Link<const Size&, void>& rLink)
730 m_aResizeHdl = rLink;
732 void SetMousePressHdl(const Link<const MouseEvent&, bool>& rLink)
734 m_aMousePressHdl = rLink;
736 void SetMouseMoveHdl(const Link<const MouseEvent&, bool>& rLink)
738 m_aMouseMotionHdl = rLink;
740 void SetMouseReleaseHdl(const Link<const MouseEvent&, bool>& rLink)
742 m_aMouseReleaseHdl = rLink;
744 void SetKeyPressHdl(const Link<const KeyEvent&, bool>& rLink)
746 m_aKeyPressHdl = rLink;
748 void SetKeyReleaseHdl(const Link<const KeyEvent&, bool>& rLink)
750 m_aKeyReleaseHdl = rLink;
752 void SetStyleUpdatedHdl(const Link<VclDrawingArea&, void>& rLink)
754 m_aStyleUpdatedHdl = rLink;
756 void SetCommandHdl(const Link<const CommandEvent&, bool>& rLink)
758 m_aCommandHdl = rLink;
760 void SetQueryTooltipHdl(const Link<tools::Rectangle&, OUString>& rLink)
762 m_aQueryTooltipHdl = rLink;
764 void SetGetSurroundingHdl(const Link<OUString&, int>& rLink)
766 m_aGetSurroundingHdl = rLink;
768 void SetDeleteSurroundingHdl(const Link<const Selection&, bool>& rLink)
770 m_aDeleteSurroundingHdl = rLink;
772 void SetStartDragHdl(const Link<VclDrawingArea*, bool>& rLink)
774 m_aStartDragHdl = rLink;
776 void SetDragHelper(const rtl::Reference<TransferDataContainer>& rHelper, sal_uInt8 eDNDConstants)
778 m_xTransferHelper = rHelper;
779 m_nDragAction = eDNDConstants;
781 virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
784 //Get first window of a pTopLevel window as
785 //if any intermediate layout widgets didn't exist
786 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::FirstChild);
787 //in a flat hierarchy where dialogs only have one layer
788 //of children
789 vcl::Window* firstLogicalChildOfParent(const vcl::Window *pTopLevel);
791 //Get last window of a pTopLevel window as
792 //if any intermediate layout widgets didn't exist
793 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::LastChild);
794 //in a flat hierarchy where dialogs only have one layer
795 //of children
796 vcl::Window* lastLogicalChildOfParent(const vcl::Window *pTopLevel);
798 //Get next window after pChild of a pTopLevel window as
799 //if any intermediate layout widgets didn't exist
800 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Next);
801 //in a flat hierarchy where dialogs only have one layer
802 //of children
803 vcl::Window* nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
805 //Get previous window before pChild of a pTopLevel window as
806 //if any intermediate layout widgets didn't exist
807 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Prev);
808 //in a flat hierarchy where dialogs only have one layer
809 //of children
810 vcl::Window* prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
812 //Returns true is the Window has a single child which is a container
813 VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow);
815 inline bool isContainerWindow(const vcl::Window &rWindow)
817 WindowType eType = rWindow.GetType();
818 return eType == WindowType::CONTAINER || eType == WindowType::SCROLLWINDOW ||
819 (eType == WindowType::DOCKINGWINDOW && ::isLayoutEnabled(&rWindow));
822 inline bool isContainerWindow(const vcl::Window *pWindow)
824 return pWindow && isContainerWindow(*pWindow);
827 // retro-fitting utilities
829 //Get a Size which is large enough to contain all children with
830 //an equal amount of space at top left and bottom right
831 Size getLegacyBestSizeForChildren(const vcl::Window &rWindow);
833 //Get first parent which is not a layout widget
834 vcl::Window* getNonLayoutParent(vcl::Window *pParent);
836 //Sort ok/cancel etc buttons in platform order
837 void sort_native_button_order(const VclBox& rContainer);
839 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */