Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / vcl / inc / brdwin.hxx
blobd0e976430e39e4ab87e4f5a5c659f63b32e04ea3
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_BRDWIN_HXX
21 #define _SV_BRDWIN_HXX
23 #include <tools/solar.h>
24 #include <vcl/window.hxx>
26 class ImplBorderWindowView;
28 // --------------------------
29 // - ImplBorderWindow-Types -
30 // --------------------------
32 #define BORDERWINDOW_STYLE_OVERLAP ((sal_uInt16)0x0001)
33 #define BORDERWINDOW_STYLE_BORDER ((sal_uInt16)0x0002)
34 #define BORDERWINDOW_STYLE_FLOAT ((sal_uInt16)0x0004)
35 #define BORDERWINDOW_STYLE_FRAME ((sal_uInt16)0x0008)
36 #define BORDERWINDOW_STYLE_APP ((sal_uInt16)0x0010)
38 #define BORDERWINDOW_HITTEST_TITLE ((sal_uInt16)0x0001)
39 #define BORDERWINDOW_HITTEST_LEFT ((sal_uInt16)0x0002)
40 #define BORDERWINDOW_HITTEST_MENU ((sal_uInt16)0x0004)
41 #define BORDERWINDOW_HITTEST_TOP ((sal_uInt16)0x0008)
42 #define BORDERWINDOW_HITTEST_RIGHT ((sal_uInt16)0x0010)
43 #define BORDERWINDOW_HITTEST_BOTTOM ((sal_uInt16)0x0020)
44 #define BORDERWINDOW_HITTEST_TOPLEFT ((sal_uInt16)0x0040)
45 #define BORDERWINDOW_HITTEST_TOPRIGHT ((sal_uInt16)0x0080)
46 #define BORDERWINDOW_HITTEST_BOTTOMLEFT ((sal_uInt16)0x0100)
47 #define BORDERWINDOW_HITTEST_BOTTOMRIGHT ((sal_uInt16)0x0200)
48 #define BORDERWINDOW_HITTEST_CLOSE ((sal_uInt16)0x0400)
49 #define BORDERWINDOW_HITTEST_ROLL ((sal_uInt16)0x0800)
50 #define BORDERWINDOW_HITTEST_DOCK ((sal_uInt16)0x1000)
51 #define BORDERWINDOW_HITTEST_HIDE ((sal_uInt16)0x2000)
52 #define BORDERWINDOW_HITTEST_HELP ((sal_uInt16)0x4000)
53 #define BORDERWINDOW_HITTEST_PIN ((sal_uInt16)0x8000)
55 #define BORDERWINDOW_DRAW_TITLE ((sal_uInt16)0x0001)
56 #define BORDERWINDOW_DRAW_BORDER ((sal_uInt16)0x0002)
57 #define BORDERWINDOW_DRAW_FRAME ((sal_uInt16)0x0004)
58 #define BORDERWINDOW_DRAW_CLOSE ((sal_uInt16)0x0008)
59 #define BORDERWINDOW_DRAW_ROLL ((sal_uInt16)0x0010)
60 #define BORDERWINDOW_DRAW_DOCK ((sal_uInt16)0x0020)
61 #define BORDERWINDOW_DRAW_HIDE ((sal_uInt16)0x0040)
62 #define BORDERWINDOW_DRAW_HELP ((sal_uInt16)0x0080)
63 #define BORDERWINDOW_DRAW_PIN ((sal_uInt16)0x0100)
64 #define BORDERWINDOW_DRAW_MENU ((sal_uInt16)0x0200)
65 #define BORDERWINDOW_DRAW_ALL (BORDERWINDOW_DRAW_TITLE | \
66 BORDERWINDOW_DRAW_BORDER | \
67 BORDERWINDOW_DRAW_FRAME | \
68 BORDERWINDOW_DRAW_CLOSE | \
69 BORDERWINDOW_DRAW_ROLL | \
70 BORDERWINDOW_DRAW_DOCK | \
71 BORDERWINDOW_DRAW_HIDE | \
72 BORDERWINDOW_DRAW_HELP | \
73 BORDERWINDOW_DRAW_PIN | \
74 BORDERWINDOW_DRAW_MENU)
76 #define BORDERWINDOW_TITLE_NORMAL ((sal_uInt16)0x0001)
77 #define BORDERWINDOW_TITLE_SMALL ((sal_uInt16)0x0002)
78 #define BORDERWINDOW_TITLE_TEAROFF ((sal_uInt16)0x0004)
79 #define BORDERWINDOW_TITLE_POPUP ((sal_uInt16)0x0008)
80 #define BORDERWINDOW_TITLE_NONE ((sal_uInt16)0x0010)
82 // --------------------
83 // - ImplBorderWindow -
84 // --------------------
86 class ImplBorderWindow : public Window
88 friend class Window;
89 friend class ImplBorderWindowView;
90 friend class ImplSmallBorderWindowView;
91 friend class ImplStdBorderWindowView;
93 private:
94 ImplBorderWindowView* mpBorderView;
95 Window* mpMenuBarWindow;
96 long mnMinWidth;
97 long mnMinHeight;
98 long mnMaxWidth;
99 long mnMaxHeight;
100 long mnRollHeight;
101 long mnOrgMenuHeight;
102 sal_uInt16 mnTitleType;
103 sal_uInt16 mnBorderStyle;
104 sal_Bool mbFloatWindow;
105 sal_Bool mbSmallOutBorder;
106 sal_Bool mbFrameBorder;
107 sal_Bool mbPined;
108 sal_Bool mbRollUp;
109 sal_Bool mbMenuHide;
110 sal_Bool mbDockBtn;
111 sal_Bool mbHideBtn;
112 sal_Bool mbMenuBtn;
113 sal_Bool mbDisplayActive;
115 using Window::ImplInit;
116 void ImplInit( Window* pParent,
117 WinBits nStyle, sal_uInt16 nTypeStyle,
118 SystemParentData* pParentData );
119 void ImplInit( Window* pParent,
120 WinBits nStyle, sal_uInt16 nTypeStyle,
121 const ::com::sun::star::uno::Any& );
123 // Copy assignment is forbidden and not implemented.
124 ImplBorderWindow (const ImplBorderWindow &);
125 ImplBorderWindow& operator= (const ImplBorderWindow &);
127 public:
128 ImplBorderWindow( Window* pParent,
129 SystemParentData* pParentData,
130 WinBits nStyle = 0,
131 sal_uInt16 nTypeStyle = 0 );
132 ImplBorderWindow( Window* pParent, WinBits nStyle = 0,
133 sal_uInt16 nTypeStyle = 0 );
134 ~ImplBorderWindow();
136 virtual void MouseMove( const MouseEvent& rMEvt );
137 virtual void MouseButtonDown( const MouseEvent& rMEvt );
138 virtual void Tracking( const TrackingEvent& rTEvt );
139 virtual void Paint( const Rectangle& rRect );
140 virtual void Activate();
141 virtual void Deactivate();
142 virtual void Resize();
143 virtual void RequestHelp( const HelpEvent& rHEvt );
144 virtual void StateChanged( StateChangedType nType );
145 virtual void DataChanged( const DataChangedEvent& rDCEvt );
147 void InitView();
148 void UpdateView( sal_Bool bNewView, const Size& rNewOutSize );
149 void InvalidateBorder();
151 using Window::Draw;
152 void Draw( const Rectangle& rRect, OutputDevice* pDev, const Point& rPos );
154 void SetDisplayActive( sal_Bool bActive );
155 sal_Bool IsDisplayActive() const { return mbDisplayActive; }
156 void SetTitleType( sal_uInt16 nTitleType, const Size& rSize );
157 void SetBorderStyle( sal_uInt16 nStyle );
158 sal_uInt16 GetBorderStyle() const { return mnBorderStyle; }
159 void SetPin( sal_Bool bPin );
160 void SetRollUp( sal_Bool bRollUp, const Size& rSize );
161 void SetCloser();
162 void SetDockButton( sal_Bool bDockButton );
163 void SetHideButton( sal_Bool bHideButton );
164 void SetMenuButton( sal_Bool bMenuButton );
166 void UpdateMenuHeight();
167 void SetMenuBarWindow( Window* pWindow );
168 void SetMenuBarMode( sal_Bool bHide );
170 void SetMinOutputSize( long nWidth, long nHeight )
171 { mnMinWidth = nWidth; mnMinHeight = nHeight; }
172 void SetMaxOutputSize( long nWidth, long nHeight )
173 { mnMaxWidth = nWidth; mnMaxHeight = nHeight; }
175 void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
176 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
177 long CalcTitleWidth() const;
179 Rectangle GetMenuRect() const;
181 virtual Size GetOptimalSize(WindowSizeType eType) const;
184 // =======================================================================
186 // -----------------------
187 // - ImplBorderFrameData -
188 // -----------------------
190 struct ImplBorderFrameData
192 ImplBorderWindow* mpBorderWindow;
193 OutputDevice* mpOutDev;
194 Rectangle maTitleRect;
195 Rectangle maPinRect;
196 Rectangle maCloseRect;
197 Rectangle maRollRect;
198 Rectangle maDockRect;
199 Rectangle maMenuRect;
200 Rectangle maHideRect;
201 Rectangle maHelpRect;
202 Point maMouseOff;
203 long mnWidth;
204 long mnHeight;
205 long mnTrackX;
206 long mnTrackY;
207 long mnTrackWidth;
208 long mnTrackHeight;
209 sal_Int32 mnLeftBorder;
210 sal_Int32 mnTopBorder;
211 sal_Int32 mnRightBorder;
212 sal_Int32 mnBottomBorder;
213 long mnNoTitleTop;
214 long mnBorderSize;
215 long mnTitleHeight;
216 long mnTitleOff;
217 sal_uInt16 mnHitTest;
218 sal_uInt16 mnPinState;
219 sal_uInt16 mnCloseState;
220 sal_uInt16 mnRollState;
221 sal_uInt16 mnDockState;
222 sal_uInt16 mnMenuState;
223 sal_uInt16 mnHideState;
224 sal_uInt16 mnHelpState;
225 sal_uInt16 mnTitleType;
226 sal_Bool mbFloatWindow;
227 sal_Bool mbDragFull;
228 sal_Bool mbTitleClipped;
231 // =======================================================================
233 // ------------------------
234 // - ImplBorderWindowView -
235 // ------------------------
237 class ImplBorderWindowView
239 public:
240 virtual ~ImplBorderWindowView();
242 virtual sal_Bool MouseMove( const MouseEvent& rMEvt );
243 virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt );
244 virtual sal_Bool Tracking( const TrackingEvent& rTEvt );
245 virtual String RequestHelp( const Point& rPos, Rectangle& rHelpRect );
247 virtual void Init( OutputDevice* pDev, long nWidth, long nHeight ) = 0;
248 virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
249 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const = 0;
250 virtual long CalcTitleWidth() const = 0;
251 virtual void DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev = NULL, const Point* pOffset = NULL ) = 0;
252 virtual Rectangle GetMenuRect() const;
254 void ImplInitTitle( ImplBorderFrameData* pData );
255 sal_uInt16 ImplHitTest( ImplBorderFrameData* pData, const Point& rPos );
256 sal_Bool ImplMouseMove( ImplBorderFrameData* pData, const MouseEvent& rMEvt );
257 sal_Bool ImplMouseButtonDown( ImplBorderFrameData* pData, const MouseEvent& rMEvt );
258 sal_Bool ImplTracking( ImplBorderFrameData* pData, const TrackingEvent& rTEvt );
259 String ImplRequestHelp( ImplBorderFrameData* pData, const Point& rPos, Rectangle& rHelpRect );
260 long ImplCalcTitleWidth( const ImplBorderFrameData* pData ) const;
263 // =======================================================================
265 // --------------------------
266 // - ImplNoBorderWindowView -
267 // --------------------------
269 class ImplNoBorderWindowView : public ImplBorderWindowView
271 public:
272 ImplNoBorderWindowView( ImplBorderWindow* pBorderWindow );
274 virtual void Init( OutputDevice* pDev, long nWidth, long nHeight );
275 virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
276 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
277 virtual long CalcTitleWidth() const;
278 virtual void DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev, const Point* pOffset );
282 // =======================================================================
284 // -----------------------------
285 // - ImplSmallBorderWindowView -
286 // -----------------------------
288 class ImplSmallBorderWindowView : public ImplBorderWindowView
290 ImplBorderWindow* mpBorderWindow;
291 OutputDevice* mpOutDev;
292 long mnWidth;
293 long mnHeight;
294 sal_Int32 mnLeftBorder;
295 sal_Int32 mnTopBorder;
296 sal_Int32 mnRightBorder;
297 sal_Int32 mnBottomBorder;
298 bool mbNWFBorder;
300 public:
301 ImplSmallBorderWindowView( ImplBorderWindow* pBorderWindow );
303 virtual void Init( OutputDevice* pOutDev, long nWidth, long nHeight );
304 virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
305 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
306 virtual long CalcTitleWidth() const;
307 virtual void DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev, const Point* pOffset );
311 // =======================================================================
313 // ---------------------------
314 // - ImplStdBorderWindowView -
315 // ---------------------------
318 class ImplStdBorderWindowView : public ImplBorderWindowView
320 ImplBorderFrameData maFrameData;
321 VirtualDevice* mpATitleVirDev;
322 VirtualDevice* mpDTitleVirDev;
324 public:
325 ImplStdBorderWindowView( ImplBorderWindow* pBorderWindow );
326 ~ImplStdBorderWindowView();
328 virtual sal_Bool MouseMove( const MouseEvent& rMEvt );
329 virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt );
330 virtual sal_Bool Tracking( const TrackingEvent& rTEvt );
331 virtual String RequestHelp( const Point& rPos, Rectangle& rHelpRect );
332 virtual Rectangle GetMenuRect() const;
334 virtual void Init( OutputDevice* pDev, long nWidth, long nHeight );
335 virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
336 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
337 virtual long CalcTitleWidth() const;
338 virtual void DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev, const Point* pOffset );
342 #endif // _SV_BRDWIN_HXX
344 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */