fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / vcl / dockwin.hxx
blob19b516b004a34cb752892ed036ad1b9f4339e87d
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SV_DOCKWIN_HXX
21 #define _SV_DOCKWIN_HXX
23 #include <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/floatwin.hxx>
26 #include <vector>
28 // data to be sent with docking events
29 struct DockingData
31 Point maMousePos; // in
32 Rectangle maTrackRect; // in/out
33 sal_Bool mbFloating; // out
34 sal_Bool mbLivemode; // in
35 sal_Bool mbInteractive; // in
37 DockingData() {};
38 DockingData( const Point& rPt, const Rectangle& rRect, sal_Bool b) :
39 maMousePos( rPt ), maTrackRect( rRect ), mbFloating( b ), mbLivemode( sal_False ), mbInteractive( sal_True )
40 {};
43 struct EndDockingData
45 Rectangle maWindowRect; // in
46 sal_Bool mbFloating; // in
47 sal_Bool mbCancelled; // in
49 EndDockingData() {};
50 EndDockingData( const Rectangle& rRect, sal_Bool b, sal_Bool bCancelled ) :
51 maWindowRect( rRect ), mbFloating( b ), mbCancelled( bCancelled )
52 {};
55 struct EndPopupModeData
57 Point maFloatingPos; // in
58 sal_Bool mbTearoff; // in
60 EndPopupModeData() {};
61 EndPopupModeData( const Point& rPos, sal_Bool bTearoff ) :
62 maFloatingPos( rPos ), mbTearoff( bTearoff )
63 {};
66 /** ImplDockingWindowWrapper
68 * ImplDockingWindowWrapper obsoletes the DockingWindow class.
69 * It is better because it can make a "normal window" dockable.
70 * All DockingWindows should be converted the new class.
73 class ImplDockingWindowWrapper
75 friend class Window;
76 friend class DockingManager;
77 friend class DockingWindow;
79 private:
81 // the original 'Docking'window
82 Window *mpDockingWindow;
84 // the original DockingWindow members
85 FloatingWindow* mpFloatWin;
86 Window* mpOldBorderWin;
87 Window* mpParent;
88 Point maFloatPos;
89 Point maDockPos;
90 Point maMouseOff;
91 Point maMouseStart;
92 Size maRollUpOutSize;
93 Size maMinOutSize;
94 Size maMaxOutSize;
95 Rectangle maDragArea;
96 long mnTrackX;
97 long mnTrackY;
98 long mnTrackWidth;
99 long mnTrackHeight;
100 sal_Int32 mnDockLeft;
101 sal_Int32 mnDockTop;
102 sal_Int32 mnDockRight;
103 sal_Int32 mnDockBottom;
104 WinBits mnFloatBits;
105 sal_Bool mbDockCanceled:1,
106 mbFloatPrevented:1,
107 mbDockable:1,
108 mbDocking:1,
109 mbDragFull:1,
110 mbLastFloatMode:1,
111 mbStartFloat:1,
112 mbTrackDock:1,
113 mbPined:1,
114 mbRollUp:1,
115 mbDockBtn:1,
116 mbHideBtn:1,
117 mbStartDockingEnabled:1,
118 mbLocked:1;
120 void ImplInitData();
122 DECL_LINK( PopupModeEnd, void* );
123 void ImplEnableStartDocking( sal_Bool bEnable = sal_True ) { mbStartDockingEnabled = bEnable; }
124 sal_Bool ImplStartDockingEnabled() { return mbStartDockingEnabled; }
126 public:
127 ImplDockingWindowWrapper( const Window *pWindow );
128 virtual ~ImplDockingWindowWrapper();
130 Window* GetWindow() { return mpDockingWindow; }
131 sal_Bool ImplStartDocking( const Point& rPos );
133 // those methods actually call the corresponding handlers
134 void StartDocking( const Point& rPos, Rectangle& rRect );
135 sal_Bool Docking( const Point& rPos, Rectangle& rRect );
136 void EndDocking( const Rectangle& rRect, sal_Bool bFloatMode );
137 sal_Bool PrepareToggleFloatingMode();
138 void ToggleFloatingMode();
140 void SetDragArea( const Rectangle& rRect );
141 Rectangle GetDragArea() const;
143 void Lock();
144 void Unlock();
145 sal_Bool IsLocked() const;
147 void StartPopupMode( ToolBox* pParentToolBox, sal_uLong nPopupModeFlags );
148 sal_Bool IsInPopupMode() const;
150 void TitleButtonClick( sal_uInt16 nButton );
151 void Pin();
152 void Roll();
153 void PopupModeEnd();
154 void Resizing( Size& rSize );
155 sal_Bool Close();
156 void Tracking( const TrackingEvent& rTEvt );
157 long Notify( NotifyEvent& rNEvt );
159 void ShowTitleButton( sal_uInt16 nButton, sal_Bool bVisible = sal_True );
161 void SetMinOutputSizePixel( const Size& rSize );
163 void SetMaxOutputSizePixel( const Size& rSize );
165 sal_Bool IsDocking() const { return mbDocking; }
166 sal_Bool IsDockable() const { return mbDockable; }
167 sal_Bool IsDockingCanceled() const { return mbDockCanceled; }
168 sal_Bool IsFloatingPrevented() const { return mbFloatPrevented; }
170 void SetFloatingMode( sal_Bool bFloatMode = sal_False );
171 sal_Bool IsFloatingMode() const;
172 FloatingWindow* GetFloatingWindow() const { return mpFloatWin; }
174 void SetFloatStyle( WinBits nWinStyle );
175 WinBits GetFloatStyle() const;
177 virtual void setPosSizePixel( long nX, long nY,
178 long nWidth, long nHeight,
179 sal_uInt16 nFlags = WINDOW_POSSIZE_ALL );
180 void SetPosSizePixel( const Point& rNewPos,
181 const Size& rNewSize )
182 { mpDockingWindow->SetPosSizePixel( rNewPos, rNewSize ); }
183 Point GetPosPixel() const;
184 Size GetSizePixel() const;
187 class VCL_DLLPUBLIC DockingManager
189 protected:
190 ::std::vector<ImplDockingWindowWrapper *> mDockingWindows;
192 public:
193 DockingManager();
194 ~DockingManager();
196 void AddWindow( const Window *pWin );
197 void RemoveWindow( const Window *pWin );
199 ImplDockingWindowWrapper* GetDockingWindowWrapper( const Window *pWin );
200 sal_Bool IsDockable( const Window *pWin );
202 sal_Bool IsFloating( const Window *pWin );
203 void SetFloatingMode( const Window *pWin, sal_Bool bFloating );
205 void Lock( const Window *pWin );
206 void Unlock( const Window *pWin );
207 sal_Bool IsLocked( const Window *pWin );
209 void StartPopupMode( ToolBox *pParentToolBox, const Window *pWin );
210 void StartPopupMode( ToolBox *pParentToolBox, const Window *pWin, sal_uLong nPopupModeFlags );
212 sal_Bool IsInPopupMode( const Window *pWin );
213 void EndPopupMode( const Window *pWin );
215 // required because those methods are not virtual in Window (!!!) and must
216 // be availbale from the toolkit
217 void SetPosSizePixel( Window *pWin, long nX, long nY,
218 long nWidth, long nHeight,
219 sal_uInt16 nFlags = WINDOW_POSSIZE_ALL );
220 Rectangle GetPosSizePixel( const Window *pWin );
223 // -----------------
224 // - DockingWindow -
225 // -----------------
227 class VCL_DLLPUBLIC DockingWindow : public Window
229 class ImplData;
230 private:
231 FloatingWindow* mpFloatWin;
232 Window* mpOldBorderWin;
233 ImplData* mpImplData;
234 Point maFloatPos;
235 Point maDockPos;
236 Point maMouseOff;
237 Point maMouseStart;
238 Size maRollUpOutSize;
239 Size maMinOutSize;
240 long mnTrackX;
241 long mnTrackY;
242 long mnTrackWidth;
243 long mnTrackHeight;
244 sal_Int32 mnDockLeft;
245 sal_Int32 mnDockTop;
246 sal_Int32 mnDockRight;
247 sal_Int32 mnDockBottom;
248 WinBits mnFloatBits;
249 sal_Bool mbDockCanceled:1,
250 mbDockPrevented:1,
251 mbFloatPrevented:1,
252 mbDockable:1,
253 mbDocking:1,
254 mbDragFull:1,
255 mbLastFloatMode:1,
256 mbStartFloat:1,
257 mbTrackDock:1,
258 mbPined:1,
259 mbRollUp:1,
260 mbDockBtn:1,
261 mbHideBtn:1;
263 SAL_DLLPRIVATE void ImplInitDockingWindowData();
265 // Copy assignment is forbidden and not implemented.
266 SAL_DLLPRIVATE DockingWindow (const DockingWindow &);
267 SAL_DLLPRIVATE DockingWindow & operator= (const DockingWindow &);
269 protected:
270 using Window::ImplInit;
271 SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
272 SAL_DLLPRIVATE void ImplInitSettings();
273 SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
275 public:
276 SAL_DLLPRIVATE sal_Bool ImplStartDocking( const Point& rPos );
278 protected:
279 DockingWindow( WindowType nType );
281 public:
282 DockingWindow( Window* pParent, WinBits nStyle = WB_STDDOCKWIN );
283 DockingWindow( Window* pParent, const ResId& rResId );
284 ~DockingWindow();
286 virtual void StartDocking();
287 virtual sal_Bool Docking( const Point& rPos, Rectangle& rRect );
288 virtual void EndDocking( const Rectangle& rRect, sal_Bool bFloatMode );
289 virtual sal_Bool PrepareToggleFloatingMode();
290 virtual void ToggleFloatingMode();
292 virtual void TitleButtonClick( sal_uInt16 nButton );
293 virtual void Pin();
294 virtual void Roll();
295 virtual void PopupModeEnd();
296 virtual void Resizing( Size& rSize );
297 virtual sal_Bool Close();
298 virtual void Tracking( const TrackingEvent& rTEvt );
299 virtual long Notify( NotifyEvent& rNEvt );
300 virtual void StateChanged( StateChangedType nType );
301 virtual void DataChanged( const DataChangedEvent& rDCEvt );
303 void SetPin( sal_Bool bPin );
304 sal_Bool IsPined() const;
306 void RollUp();
307 void RollDown();
308 sal_Bool IsRollUp() const;
310 void SetRollUpOutputSizePixel( const Size& rSize );
311 Size GetRollUpOutputSizePixel() const;
313 void SetMinOutputSizePixel( const Size& rSize );
314 const Size& GetMinOutputSizePixel() const;
316 void SetMaxOutputSizePixel( const Size& rSize );
318 sal_Bool IsDocking() const { return mbDocking; }
319 sal_Bool IsDockable() const { return mbDockable; }
320 sal_Bool IsDockingCanceled() const { return mbDockCanceled; }
321 sal_Bool IsDockingPrevented() const { return mbDockPrevented; }
322 sal_Bool IsFloatingPrevented() const { return mbFloatPrevented; }
324 void SetFloatingMode( sal_Bool bFloatMode = sal_False );
325 sal_Bool IsFloatingMode() const;
326 FloatingWindow* GetFloatingWindow() const { return mpFloatWin; }
328 void SetFloatingPos( const Point& rNewPos );
329 Point GetFloatingPos() const;
331 void SetFloatStyle( WinBits nWinStyle );
332 WinBits GetFloatStyle() const;
334 virtual void setPosSizePixel( long nX, long nY,
335 long nWidth, long nHeight,
336 sal_uInt16 nFlags = WINDOW_POSSIZE_ALL );
337 void SetPosSizePixel( const Point& rNewPos,
338 const Size& rNewSize )
339 { Window::SetPosSizePixel( rNewPos, rNewSize ); }
340 Point GetPosPixel() const;
341 Size GetSizePixel() const;
342 void SetOutputSizePixel( const Size& rNewSize );
343 Size GetOutputSizePixel() const;
346 inline void DockingWindow::SetPin( sal_Bool bPin )
348 if ( mpFloatWin )
349 mpFloatWin->SetPin( bPin );
350 mbPined = bPin;
353 inline sal_Bool DockingWindow::IsPined() const
355 if ( mpFloatWin )
356 return mpFloatWin->IsPined();
357 return mbPined;
360 inline void DockingWindow::RollUp()
362 if ( mpFloatWin )
363 mpFloatWin->RollUp();
364 mbRollUp = sal_True;
367 inline void DockingWindow::RollDown()
369 if ( mpFloatWin )
370 mpFloatWin->RollDown();
371 mbRollUp = sal_False;
374 inline sal_Bool DockingWindow::IsRollUp() const
376 if ( mpFloatWin )
377 return mpFloatWin->IsRollUp();
378 return mbRollUp;
381 inline void DockingWindow::SetRollUpOutputSizePixel( const Size& rSize )
383 if ( mpFloatWin )
384 mpFloatWin->SetRollUpOutputSizePixel( rSize );
385 maRollUpOutSize = rSize;
388 inline Size DockingWindow::GetRollUpOutputSizePixel() const
390 if ( mpFloatWin )
391 return mpFloatWin->GetRollUpOutputSizePixel();
392 return maRollUpOutSize;
395 inline void DockingWindow::SetMinOutputSizePixel( const Size& rSize )
397 if ( mpFloatWin )
398 mpFloatWin->SetMinOutputSizePixel( rSize );
399 maMinOutSize = rSize;
402 inline const Size& DockingWindow::GetMinOutputSizePixel() const
404 if ( mpFloatWin )
405 return mpFloatWin->GetMinOutputSizePixel();
406 return maMinOutSize;
409 inline void DockingWindow::SetFloatingPos( const Point& rNewPos )
411 if ( mpFloatWin )
412 mpFloatWin->SetPosPixel( rNewPos );
413 else
414 maFloatPos = rNewPos;
418 #endif // _SV_DOCKWIN_HXX
420 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */