LibreOffice Module vcl (master) 1
dockwin.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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <vcl/dllapi.h>
23#include <vcl/syswin.hxx>
24#include <o3tl/deleter.hxx>
25#include <memory>
26#include <vector>
27
28class ToolBox;
29class FloatingWindow;
30enum class FloatWinPopupFlags;
31
32// data to be sent with docking events
34{
37 bool mbFloating; // out
38
39 DockingData( const Point& rPt, const tools::Rectangle& rRect, bool b) :
40 maMousePos( rPt ), maTrackRect( rRect ), mbFloating( b )
41 {};
42};
43
45{
47 bool mbFloating; // in
48 bool mbCancelled; // in
49
50 EndDockingData( const tools::Rectangle& rRect, bool b, bool bCancelled ) :
51 maWindowRect( rRect ), mbFloating( b ), mbCancelled( bCancelled )
52 {};
53};
54
56{
58 bool mbTearoff; // in
59
60 EndPopupModeData( const Point& rPos, bool bTearoff ) :
61 maFloatingPos( rPos ), mbTearoff( bTearoff )
62 {};
63};
64
66
68{
69 std::vector<std::unique_ptr<ImplDockingWindowWrapper, o3tl::default_delete<ImplDockingWindowWrapper>>> mvDockingWindows;
70
71public:
74
75 DockingManager& operator=( DockingManager const & ) = delete; // MSVC2015 workaround
76 DockingManager( DockingManager const & ) = delete; // MSVC2015 workaround
77
78 void AddWindow( const vcl::Window *pWin );
79 void RemoveWindow( const vcl::Window *pWin );
80
81 ImplDockingWindowWrapper* GetDockingWindowWrapper( const vcl::Window *pWin );
82 bool IsDockable( const vcl::Window *pWin );
83
84 bool IsFloating( const vcl::Window *pWin );
85 void SetFloatingMode( const vcl::Window *pWin, bool bFloating );
86 SystemWindow* GetFloatingWindow(const vcl::Window *pWin);
87
88 void Lock( const vcl::Window *pWin );
89 void Unlock( const vcl::Window *pWin );
90 bool IsLocked( const vcl::Window *pWin );
91
92 void StartPopupMode( const vcl::Window *pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags );
93 void StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWin );
94 void StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWin, FloatWinPopupFlags nPopupModeFlags );
95
96 void SetPopupModeEndHdl( const vcl::Window *pWindow, const Link<FloatingWindow*,void>& rLink );
97
98 bool IsInPopupMode( const vcl::Window *pWin );
99 void EndPopupMode( const vcl::Window *pWin );
100
101 // required because those methods are not virtual in Window (!!!) and must
102 // be available from the toolkit
103 void SetPosSizePixel( vcl::Window const *pWin, tools::Long nX, tools::Long nY,
104 tools::Long nWidth, tools::Long nHeight,
105 PosSizeFlags nFlags );
106 tools::Rectangle GetPosSizePixel( const vcl::Window *pWin );
107};
108
109
111 : public vcl::Window
112 , public VclBuilderContainer
113{
114 class SAL_DLLPRIVATE ImplData;
115private:
118 std::unique_ptr<ImplData> mpImplData;
127 sal_Int32 mnDockLeft;
128 sal_Int32 mnDockTop;
129 sal_Int32 mnDockRight;
130 sal_Int32 mnDockBottom;
142
143protected:
146private:
147
148 SAL_DLLPRIVATE void ImplInitDockingWindowData();
149 SAL_DLLPRIVATE void setPosSizeOnContainee();
150 DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, Timer*, void );
151
152 DockingWindow (const DockingWindow &) = delete;
153 DockingWindow & operator= (const DockingWindow &) = delete;
154
155protected:
156 using Window::ImplInit;
157 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
158 SAL_DLLPRIVATE void ImplInitSettings();
159
160 SAL_DLLPRIVATE void DoInitialLayout();
161
162 void loadUI(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription,
163 const css::uno::Reference<css::frame::XFrame> &rFrame);
164
165public:
166 bool isLayoutEnabled() const;
167 void setOptimalLayoutSize();
168
169 //FIXME: is it okay to make this public?
170 void ImplStartDocking( const Point& rPos );
171 SAL_DLLPRIVATE bool isDeferredInit() const { return mbIsDeferredInit; }
172 virtual void doDeferredInit(WinBits nBits);
173protected:
174 DockingWindow( WindowType nType, const char* pIdleDebugName = "vcl::DockingWindow maLayoutIdle");
175public:
176 DockingWindow(vcl::Window* pParent, WinBits nStyle, const char* pIdleDebugName = "vcl::DockingWindow maLayoutIdle");
177 DockingWindow(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription,
178 const char* pIdleDebugName = "vcl::DockingWindow maLayoutIdle",
179 const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
180 virtual ~DockingWindow() override;
181 virtual void dispose() override;
182
183 virtual void StartDocking();
184 virtual bool Docking( const Point& rPos, tools::Rectangle& rRect );
185 virtual void EndDocking( const tools::Rectangle& rRect, bool bFloatMode );
186 virtual bool PrepareToggleFloatingMode();
187 virtual void ToggleFloatingMode();
188
189 virtual void Resizing( Size& rSize );
190 virtual bool Close();
191 virtual void Tracking( const TrackingEvent& rTEvt ) override;
192 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
193 virtual void StateChanged( StateChangedType nType ) override;
194 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
195
196 void SetMinOutputSizePixel( const Size& rSize );
197 const Size& GetMinOutputSizePixel() const;
198
199 void SetMaxOutputSizePixel( const Size& rSize );
200
201 bool IsDocking() const { return mbDocking; }
202 bool IsDockable() const { return mbDockable; }
203 bool IsDockingCanceled() const { return mbDockCanceled; }
204
205 void SetFloatingMode( bool bFloatMode );
206 bool IsFloatingMode() const;
207 SystemWindow* GetFloatingWindow() const;
208
209 void SetFloatingPos( const Point& rNewPos );
210 Point GetFloatingPos() const;
211
212 void SetFloatStyle( WinBits nWinStyle );
213 WinBits GetFloatStyle() const;
214
215 virtual void setPosSizePixel( tools::Long nX, tools::Long nY,
216 tools::Long nWidth, tools::Long nHeight,
217 PosSizeFlags nFlags = PosSizeFlags::All ) override;
218
219 Point GetPosPixel() const override;
220 Size GetSizePixel() const override;
221 void SetOutputSizePixel( const Size& rNewSize ) override;
222 Size GetOutputSizePixel() const;
223
224 virtual void SetText( const OUString& rStr ) override;
225 virtual OUString GetText() const override;
226 virtual Size GetOptimalSize() const override;
227 virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
228};
229
231{
232protected:
234public:
236 const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>(),
237 bool bTearable = false);
238 virtual ~DropdownDockingWindow() override;
239 virtual void dispose() override;
240};
241
243{
244protected:
246public:
248 const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
249 void InvalidateChildSizeCache();
251 virtual ~ResizableDockingWindow() override;
252 virtual void dispose() override;
253};
254
255/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< std::unique_ptr< ImplDockingWindowWrapper, o3tl::default_delete< ImplDockingWindowWrapper > > > mvDockingWindows
Definition: dockwin.hxx:69
DockingManager & operator=(DockingManager const &)=delete
DockingManager(DockingManager const &)=delete
sal_Int32 mnDockLeft
Definition: dockwin.hxx:127
bool mbIsDeferredInit
Definition: dockwin.hxx:144
bool mbStartFloat
Definition: dockwin.hxx:138
sal_Int32 mnDockBottom
Definition: dockwin.hxx:130
Point maMouseOff
Definition: dockwin.hxx:121
std::unique_ptr< ImplData > mpImplData
Definition: dockwin.hxx:118
tools::Long mnTrackHeight
Definition: dockwin.hxx:126
DECL_DLLPRIVATE_LINK(ImplHandleLayoutTimerHdl, Timer *, void)
sal_Int32 mnDockRight
Definition: dockwin.hxx:129
bool IsDocking() const
Definition: dockwin.hxx:201
Point maDockPos
Definition: dockwin.hxx:120
tools::Long mnTrackWidth
Definition: dockwin.hxx:125
bool mbDragFull
Definition: dockwin.hxx:136
Point maFloatPos
Definition: dockwin.hxx:119
VclPtr< FloatingWindow > mpFloatWin
Definition: dockwin.hxx:116
bool mbHideBtn
Definition: dockwin.hxx:140
bool mbLastFloatMode
Definition: dockwin.hxx:137
Size maMinOutSize
Definition: dockwin.hxx:122
bool IsDockingCanceled() const
Definition: dockwin.hxx:203
bool mbDockBtn
Definition: dockwin.hxx:139
tools::Long mnTrackX
Definition: dockwin.hxx:123
DockingWindow(const DockingWindow &)=delete
VclPtr< vcl::Window > mpOldBorderWin
Definition: dockwin.hxx:117
Idle maLayoutIdle
Definition: dockwin.hxx:132
bool mbDockCanceled
Definition: dockwin.hxx:133
VclPtr< vcl::Window > mpDialogParent
Definition: dockwin.hxx:145
bool mbIsCalculatingInitialLayoutSize
Definition: dockwin.hxx:141
bool mbDocking
Definition: dockwin.hxx:135
bool mbDockable
Definition: dockwin.hxx:134
tools::Long mnTrackY
Definition: dockwin.hxx:124
bool IsDockable() const
Definition: dockwin.hxx:202
sal_Int32 mnDockTop
Definition: dockwin.hxx:128
SAL_DLLPRIVATE bool isDeferredInit() const
Definition: dockwin.hxx:171
WinBits mnFloatBits
Definition: dockwin.hxx:131
VclPtr< vcl::Window > m_xBox
Definition: dockwin.hxx:233
An idle is a timer to be scheduled immediately.
Definition: idle.hxx:35
ImplDockingWindowWrapper.
VclPtr< vcl::Window > m_xBox
Definition: dockwin.hxx:245
Definition: timer.hxx:27
A toolbar: contains all those icons, typically below the menu bar.
Definition: toolbox.hxx:74
virtual void SetText(const OUString &rStr) override
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
bool isLayoutEnabled(const vcl::Window *pWindow)
Definition: layout.cxx:3005
void dispose()
long Long
bool mbFloating
Definition: dockwin.hxx:37
tools::Rectangle maTrackRect
Definition: dockwin.hxx:36
Point maMousePos
Definition: dockwin.hxx:35
DockingData(const Point &rPt, const tools::Rectangle &rRect, bool b)
Definition: dockwin.hxx:39
EndDockingData(const tools::Rectangle &rRect, bool b, bool bCancelled)
Definition: dockwin.hxx:50
bool mbCancelled
Definition: dockwin.hxx:48
bool mbFloating
Definition: dockwin.hxx:47
tools::Rectangle maWindowRect
Definition: dockwin.hxx:46
Point maFloatingPos
Definition: dockwin.hxx:57
EndPopupModeData(const Point &rPos, bool bTearoff)
Definition: dockwin.hxx:60
FloatWinPopupFlags
Definition: vclenum.hxx:323
PosSizeFlags
Definition: window.hxx:127
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109
WindowType
Definition: wintypes.hxx:27