Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_BRDWIN_HXX
30 : : #define _SV_BRDWIN_HXX
31 : :
32 : : #include <tools/solar.h>
33 : : #include <vcl/window.hxx>
34 : :
35 : : class ImplBorderWindowView;
36 : :
37 : : // --------------------------
38 : : // - ImplBorderWindow-Types -
39 : : // --------------------------
40 : :
41 : : #define BORDERWINDOW_STYLE_OVERLAP ((sal_uInt16)0x0001)
42 : : #define BORDERWINDOW_STYLE_BORDER ((sal_uInt16)0x0002)
43 : : #define BORDERWINDOW_STYLE_FLOAT ((sal_uInt16)0x0004)
44 : : #define BORDERWINDOW_STYLE_FRAME ((sal_uInt16)0x0008)
45 : : #define BORDERWINDOW_STYLE_APP ((sal_uInt16)0x0010)
46 : :
47 : : #define BORDERWINDOW_HITTEST_TITLE ((sal_uInt16)0x0001)
48 : : #define BORDERWINDOW_HITTEST_LEFT ((sal_uInt16)0x0002)
49 : : #define BORDERWINDOW_HITTEST_MENU ((sal_uInt16)0x0004)
50 : : #define BORDERWINDOW_HITTEST_TOP ((sal_uInt16)0x0008)
51 : : #define BORDERWINDOW_HITTEST_RIGHT ((sal_uInt16)0x0010)
52 : : #define BORDERWINDOW_HITTEST_BOTTOM ((sal_uInt16)0x0020)
53 : : #define BORDERWINDOW_HITTEST_TOPLEFT ((sal_uInt16)0x0040)
54 : : #define BORDERWINDOW_HITTEST_TOPRIGHT ((sal_uInt16)0x0080)
55 : : #define BORDERWINDOW_HITTEST_BOTTOMLEFT ((sal_uInt16)0x0100)
56 : : #define BORDERWINDOW_HITTEST_BOTTOMRIGHT ((sal_uInt16)0x0200)
57 : : #define BORDERWINDOW_HITTEST_CLOSE ((sal_uInt16)0x0400)
58 : : #define BORDERWINDOW_HITTEST_ROLL ((sal_uInt16)0x0800)
59 : : #define BORDERWINDOW_HITTEST_DOCK ((sal_uInt16)0x1000)
60 : : #define BORDERWINDOW_HITTEST_HIDE ((sal_uInt16)0x2000)
61 : : #define BORDERWINDOW_HITTEST_HELP ((sal_uInt16)0x4000)
62 : : #define BORDERWINDOW_HITTEST_PIN ((sal_uInt16)0x8000)
63 : :
64 : : #define BORDERWINDOW_DRAW_TITLE ((sal_uInt16)0x0001)
65 : : #define BORDERWINDOW_DRAW_BORDER ((sal_uInt16)0x0002)
66 : : #define BORDERWINDOW_DRAW_FRAME ((sal_uInt16)0x0004)
67 : : #define BORDERWINDOW_DRAW_CLOSE ((sal_uInt16)0x0008)
68 : : #define BORDERWINDOW_DRAW_ROLL ((sal_uInt16)0x0010)
69 : : #define BORDERWINDOW_DRAW_DOCK ((sal_uInt16)0x0020)
70 : : #define BORDERWINDOW_DRAW_HIDE ((sal_uInt16)0x0040)
71 : : #define BORDERWINDOW_DRAW_HELP ((sal_uInt16)0x0080)
72 : : #define BORDERWINDOW_DRAW_PIN ((sal_uInt16)0x0100)
73 : : #define BORDERWINDOW_DRAW_MENU ((sal_uInt16)0x0200)
74 : : #define BORDERWINDOW_DRAW_ALL (BORDERWINDOW_DRAW_TITLE | \
75 : : BORDERWINDOW_DRAW_BORDER | \
76 : : BORDERWINDOW_DRAW_FRAME | \
77 : : BORDERWINDOW_DRAW_CLOSE | \
78 : : BORDERWINDOW_DRAW_ROLL | \
79 : : BORDERWINDOW_DRAW_DOCK | \
80 : : BORDERWINDOW_DRAW_HIDE | \
81 : : BORDERWINDOW_DRAW_HELP | \
82 : : BORDERWINDOW_DRAW_PIN | \
83 : : BORDERWINDOW_DRAW_MENU)
84 : :
85 : : #define BORDERWINDOW_TITLE_NORMAL ((sal_uInt16)0x0001)
86 : : #define BORDERWINDOW_TITLE_SMALL ((sal_uInt16)0x0002)
87 : : #define BORDERWINDOW_TITLE_TEAROFF ((sal_uInt16)0x0004)
88 : : #define BORDERWINDOW_TITLE_POPUP ((sal_uInt16)0x0008)
89 : : #define BORDERWINDOW_TITLE_NONE ((sal_uInt16)0x0010)
90 : :
91 : : // --------------------
92 : : // - ImplBorderWindow -
93 : : // --------------------
94 : :
95 : : class ImplBorderWindow : public Window
96 : : {
97 : : friend class Window;
98 : : friend class ImplBorderWindowView;
99 : : friend class ImplSmallBorderWindowView;
100 : : friend class ImplStdBorderWindowView;
101 : :
102 : : private:
103 : : ImplBorderWindowView* mpBorderView;
104 : : Window* mpMenuBarWindow;
105 : : long mnMinWidth;
106 : : long mnMinHeight;
107 : : long mnMaxWidth;
108 : : long mnMaxHeight;
109 : : long mnRollHeight;
110 : : long mnOrgMenuHeight;
111 : : sal_uInt16 mnTitleType;
112 : : sal_uInt16 mnBorderStyle;
113 : : sal_Bool mbFloatWindow;
114 : : sal_Bool mbSmallOutBorder;
115 : : sal_Bool mbFrameBorder;
116 : : sal_Bool mbPined;
117 : : sal_Bool mbRollUp;
118 : : sal_Bool mbMenuHide;
119 : : sal_Bool mbDockBtn;
120 : : sal_Bool mbHideBtn;
121 : : sal_Bool mbMenuBtn;
122 : : sal_Bool mbDisplayActive;
123 : :
124 : : using Window::ImplInit;
125 : : void ImplInit( Window* pParent,
126 : : WinBits nStyle, sal_uInt16 nTypeStyle,
127 : : SystemParentData* pParentData );
128 : : void ImplInit( Window* pParent,
129 : : WinBits nStyle, sal_uInt16 nTypeStyle,
130 : : const ::com::sun::star::uno::Any& );
131 : :
132 : : // Copy assignment is forbidden and not implemented.
133 : : ImplBorderWindow (const ImplBorderWindow &);
134 : : ImplBorderWindow& operator= (const ImplBorderWindow &);
135 : :
136 : : public:
137 : : ImplBorderWindow( Window* pParent,
138 : : SystemParentData* pParentData,
139 : : WinBits nStyle = 0,
140 : : sal_uInt16 nTypeStyle = 0 );
141 : : ImplBorderWindow( Window* pParent, WinBits nStyle = 0,
142 : : sal_uInt16 nTypeStyle = 0 );
143 : : ~ImplBorderWindow();
144 : :
145 : : virtual void MouseMove( const MouseEvent& rMEvt );
146 : : virtual void MouseButtonDown( const MouseEvent& rMEvt );
147 : : virtual void Tracking( const TrackingEvent& rTEvt );
148 : : virtual void Paint( const Rectangle& rRect );
149 : : virtual void Activate();
150 : : virtual void Deactivate();
151 : : virtual void Resize();
152 : : virtual void RequestHelp( const HelpEvent& rHEvt );
153 : : virtual void StateChanged( StateChangedType nType );
154 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
155 : :
156 : : void InitView();
157 : : void UpdateView( sal_Bool bNewView, const Size& rNewOutSize );
158 : : void InvalidateBorder();
159 : :
160 : : using Window::Draw;
161 : : void Draw( const Rectangle& rRect, OutputDevice* pDev, const Point& rPos );
162 : :
163 : : void SetDisplayActive( sal_Bool bActive );
164 : : sal_Bool IsDisplayActive() const { return mbDisplayActive; }
165 : : void SetTitleType( sal_uInt16 nTitleType, const Size& rSize );
166 : : void SetBorderStyle( sal_uInt16 nStyle );
167 : 40878 : sal_uInt16 GetBorderStyle() const { return mnBorderStyle; }
168 : : void SetPin( sal_Bool bPin );
169 : : void SetRollUp( sal_Bool bRollUp, const Size& rSize );
170 : : void SetCloser();
171 : : void SetDockButton( sal_Bool bDockButton );
172 : : void SetHideButton( sal_Bool bHideButton );
173 : : void SetMenuButton( sal_Bool bMenuButton );
174 : :
175 : : void UpdateMenuHeight();
176 : : void SetMenuBarWindow( Window* pWindow );
177 : : void SetMenuBarMode( sal_Bool bHide );
178 : :
179 : 0 : void SetMinOutputSize( long nWidth, long nHeight )
180 : 0 : { mnMinWidth = nWidth; mnMinHeight = nHeight; }
181 : 0 : void SetMaxOutputSize( long nWidth, long nHeight )
182 : 0 : { mnMaxWidth = nWidth; mnMaxHeight = nHeight; }
183 : :
184 : : void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
185 : : sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
186 : : long CalcTitleWidth() const;
187 : :
188 : : Rectangle GetMenuRect() const;
189 : : };
190 : :
191 : : // =======================================================================
192 : :
193 : : // -----------------------
194 : : // - ImplBorderFrameData -
195 : : // -----------------------
196 : :
197 : 0 : struct ImplBorderFrameData
198 : : {
199 : : ImplBorderWindow* mpBorderWindow;
200 : : OutputDevice* mpOutDev;
201 : : Rectangle maTitleRect;
202 : : Rectangle maPinRect;
203 : : Rectangle maCloseRect;
204 : : Rectangle maRollRect;
205 : : Rectangle maDockRect;
206 : : Rectangle maMenuRect;
207 : : Rectangle maHideRect;
208 : : Rectangle maHelpRect;
209 : : Point maMouseOff;
210 : : long mnWidth;
211 : : long mnHeight;
212 : : long mnTrackX;
213 : : long mnTrackY;
214 : : long mnTrackWidth;
215 : : long mnTrackHeight;
216 : : sal_Int32 mnLeftBorder;
217 : : sal_Int32 mnTopBorder;
218 : : sal_Int32 mnRightBorder;
219 : : sal_Int32 mnBottomBorder;
220 : : long mnNoTitleTop;
221 : : long mnBorderSize;
222 : : long mnTitleHeight;
223 : : long mnTitleOff;
224 : : sal_uInt16 mnHitTest;
225 : : sal_uInt16 mnPinState;
226 : : sal_uInt16 mnCloseState;
227 : : sal_uInt16 mnRollState;
228 : : sal_uInt16 mnDockState;
229 : : sal_uInt16 mnMenuState;
230 : : sal_uInt16 mnHideState;
231 : : sal_uInt16 mnHelpState;
232 : : sal_uInt16 mnTitleType;
233 : : sal_Bool mbFloatWindow;
234 : : sal_Bool mbDragFull;
235 : : sal_Bool mbTitleClipped;
236 : : };
237 : :
238 : : // =======================================================================
239 : :
240 : : // ------------------------
241 : : // - ImplBorderWindowView -
242 : : // ------------------------
243 : :
244 : 13196 : class ImplBorderWindowView
245 : : {
246 : : public:
247 : : virtual ~ImplBorderWindowView();
248 : :
249 : : virtual sal_Bool MouseMove( const MouseEvent& rMEvt );
250 : : virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt );
251 : : virtual sal_Bool Tracking( const TrackingEvent& rTEvt );
252 : : virtual String RequestHelp( const Point& rPos, Rectangle& rHelpRect );
253 : :
254 : : virtual void Init( OutputDevice* pDev, long nWidth, long nHeight ) = 0;
255 : : virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
256 : : sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const = 0;
257 : : virtual long CalcTitleWidth() const = 0;
258 : : virtual void DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev = NULL, const Point* pOffset = NULL ) = 0;
259 : : virtual Rectangle GetMenuRect() const;
260 : :
261 : : void ImplInitTitle( ImplBorderFrameData* pData );
262 : : sal_uInt16 ImplHitTest( ImplBorderFrameData* pData, const Point& rPos );
263 : : sal_Bool ImplMouseMove( ImplBorderFrameData* pData, const MouseEvent& rMEvt );
264 : : sal_Bool ImplMouseButtonDown( ImplBorderFrameData* pData, const MouseEvent& rMEvt );
265 : : sal_Bool ImplTracking( ImplBorderFrameData* pData, const TrackingEvent& rTEvt );
266 : : String ImplRequestHelp( ImplBorderFrameData* pData, const Point& rPos, Rectangle& rHelpRect );
267 : : long ImplCalcTitleWidth( const ImplBorderFrameData* pData ) const;
268 : : };
269 : :
270 : : // =======================================================================
271 : :
272 : : // --------------------------
273 : : // - ImplNoBorderWindowView -
274 : : // --------------------------
275 : :
276 [ - + ]: 3892 : class ImplNoBorderWindowView : public ImplBorderWindowView
277 : : {
278 : : public:
279 : : ImplNoBorderWindowView( ImplBorderWindow* pBorderWindow );
280 : :
281 : : virtual void Init( OutputDevice* pDev, long nWidth, long nHeight );
282 : : virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
283 : : sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
284 : : virtual long CalcTitleWidth() const;
285 : : virtual void DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev, const Point* pOffset );
286 : : };
287 : :
288 : :
289 : : // =======================================================================
290 : :
291 : : // -----------------------------
292 : : // - ImplSmallBorderWindowView -
293 : : // -----------------------------
294 : :
295 [ - + ]: 21924 : class ImplSmallBorderWindowView : public ImplBorderWindowView
296 : : {
297 : : ImplBorderWindow* mpBorderWindow;
298 : : OutputDevice* mpOutDev;
299 : : long mnWidth;
300 : : long mnHeight;
301 : : sal_Int32 mnLeftBorder;
302 : : sal_Int32 mnTopBorder;
303 : : sal_Int32 mnRightBorder;
304 : : sal_Int32 mnBottomBorder;
305 : : bool mbNWFBorder;
306 : :
307 : : public:
308 : : ImplSmallBorderWindowView( ImplBorderWindow* pBorderWindow );
309 : :
310 : : virtual void Init( OutputDevice* pOutDev, long nWidth, long nHeight );
311 : : virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
312 : : sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
313 : : virtual long CalcTitleWidth() const;
314 : : virtual void DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev, const Point* pOffset );
315 : : };
316 : :
317 : :
318 : : // =======================================================================
319 : :
320 : : // ---------------------------
321 : : // - ImplStdBorderWindowView -
322 : : // ---------------------------
323 : :
324 : :
325 : : class ImplStdBorderWindowView : public ImplBorderWindowView
326 : : {
327 : : ImplBorderFrameData maFrameData;
328 : : VirtualDevice* mpATitleVirDev;
329 : : VirtualDevice* mpDTitleVirDev;
330 : :
331 : : public:
332 : : ImplStdBorderWindowView( ImplBorderWindow* pBorderWindow );
333 : : ~ImplStdBorderWindowView();
334 : :
335 : : virtual sal_Bool MouseMove( const MouseEvent& rMEvt );
336 : : virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt );
337 : : virtual sal_Bool Tracking( const TrackingEvent& rTEvt );
338 : : virtual String RequestHelp( const Point& rPos, Rectangle& rHelpRect );
339 : : virtual Rectangle GetMenuRect() const;
340 : :
341 : : virtual void Init( OutputDevice* pDev, long nWidth, long nHeight );
342 : : virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
343 : : sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
344 : : virtual long CalcTitleWidth() const;
345 : : virtual void DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev, const Point* pOffset );
346 : : };
347 : :
348 : :
349 : : #endif // _SV_BRDWIN_HXX
350 : :
351 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|