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_SYSWIN_HXX
30 : : #define _SV_SYSWIN_HXX
31 : :
32 : : #include <tools/solar.h>
33 : : #include <vcl/dllapi.h>
34 : : #include <vcl/window.hxx>
35 : :
36 : : class ModalDialog;
37 : : class MenuBar;
38 : : class TaskPaneList;
39 : :
40 : : // --------------
41 : : // - Icon-Types -
42 : : // --------------
43 : :
44 : : #define ICON_LO_DEFAULT 1
45 : : #define ICON_TEXT_DOCUMENT 2
46 : : #define ICON_TEXT_TEMPLATE 3
47 : : #define ICON_SPREADSHEET_DOCUMENT 4
48 : : #define ICON_SPREADSHEET_TEMPLATE 5
49 : : #define ICON_DRAWING_DOCUMENT 6
50 : : #define ICON_DRAWING_TEMPLATE 7
51 : : #define ICON_PRESENTATION_DOCUMENT 8
52 : : #define ICON_PRESENTATION_TEMPLATE 9
53 : : #define ICON_MASTER_DOCUMENT 10
54 : : #define ICON_TEMPLATE 11
55 : : #define ICON_DATABASE_DOCUMENT 12
56 : : #define ICON_MATH_DOCUMENT 13
57 : : #define ICON_MACROLIBRARY 1
58 : : #define ICON_SETUP 500
59 : :
60 : : // -------------------
61 : : // - WindowStateData -
62 : : // -------------------
63 : :
64 : : #define WINDOWSTATE_MASK_X ((sal_uLong)0x00000001)
65 : : #define WINDOWSTATE_MASK_Y ((sal_uLong)0x00000002)
66 : : #define WINDOWSTATE_MASK_WIDTH ((sal_uLong)0x00000004)
67 : : #define WINDOWSTATE_MASK_HEIGHT ((sal_uLong)0x00000008)
68 : : #define WINDOWSTATE_MASK_STATE ((sal_uLong)0x00000010)
69 : : #define WINDOWSTATE_MASK_MINIMIZED ((sal_uLong)0x00000020)
70 : : #define WINDOWSTATE_MASK_MAXIMIZED_X ((sal_uLong)0x00000100)
71 : : #define WINDOWSTATE_MASK_MAXIMIZED_Y ((sal_uLong)0x00000200)
72 : : #define WINDOWSTATE_MASK_MAXIMIZED_WIDTH ((sal_uLong)0x00000400)
73 : : #define WINDOWSTATE_MASK_MAXIMIZED_HEIGHT ((sal_uLong)0x00000800)
74 : : #define WINDOWSTATE_MASK_POS (WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y)
75 : : #define WINDOWSTATE_MASK_ALL (WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_WIDTH | WINDOWSTATE_MASK_HEIGHT | WINDOWSTATE_MASK_MAXIMIZED_X | WINDOWSTATE_MASK_MAXIMIZED_Y | WINDOWSTATE_MASK_MAXIMIZED_WIDTH | WINDOWSTATE_MASK_MAXIMIZED_HEIGHT | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)
76 : :
77 : : #define WINDOWSTATE_STATE_NORMAL ((sal_uLong)0x00000001)
78 : : #define WINDOWSTATE_STATE_MINIMIZED ((sal_uLong)0x00000002)
79 : : #define WINDOWSTATE_STATE_MAXIMIZED ((sal_uLong)0x00000004)
80 : : #define WINDOWSTATE_STATE_ROLLUP ((sal_uLong)0x00000008)
81 : : #define WINDOWSTATE_STATE_MAXIMIZED_HORZ ((sal_uLong)0x00000010)
82 : : #define WINDOWSTATE_STATE_MAXIMIZED_VERT ((sal_uLong)0x00000020)
83 : :
84 : : class VCL_PLUGIN_PUBLIC WindowStateData
85 : : {
86 : : private:
87 : : sal_uInt32 mnValidMask;
88 : : int mnX;
89 : : int mnY;
90 : : unsigned int mnWidth;
91 : : unsigned int mnHeight;
92 : : int mnMaximizedX;
93 : : int mnMaximizedY;
94 : : unsigned int mnMaximizedWidth;
95 : : unsigned int mnMaximizedHeight;
96 : : sal_uInt32 mnState;
97 : :
98 : : public:
99 : 5233 : WindowStateData()
100 : : {
101 : 5233 : mnValidMask = mnX = mnY = mnWidth = mnHeight = mnState = 0;
102 : 5233 : mnMaximizedX = mnMaximizedY = mnMaximizedWidth = mnMaximizedHeight = 0;
103 : 5233 : }
104 : :
105 : 8595 : void SetMask( sal_uLong nValidMask ) { mnValidMask = nValidMask; }
106 : 19565 : sal_uInt32 GetMask() const { return mnValidMask; }
107 : :
108 : 5233 : void SetX( int nX ) { mnX = nX; }
109 : 8719 : int GetX() const { return mnX; }
110 : 5233 : void SetY( int nY ) { mnY = nY; }
111 : 8719 : int GetY() const { return mnY; }
112 : 5159 : void SetWidth( unsigned int nWidth ) { mnWidth = nWidth; }
113 : 8653 : unsigned int GetWidth() const { return mnWidth; }
114 : 5159 : void SetHeight( unsigned int nHeight ) { mnHeight = nHeight; }
115 : 8525 : unsigned int GetHeight() const { return mnHeight; }
116 : 5233 : void SetState( sal_uInt32 nState ) { mnState = nState; }
117 : 5233 : sal_uInt32 GetState() const { return mnState; }
118 : 1871 : void SetMaximizedX( int nRX ) { mnMaximizedX = nRX; }
119 : 8525 : int GetMaximizedX() const { return mnMaximizedX; }
120 : 1871 : void SetMaximizedY( int nRY ) { mnMaximizedY = nRY; }
121 : 8525 : int GetMaximizedY() const { return mnMaximizedY; }
122 : 3554 : void SetMaximizedWidth( unsigned int nRWidth ) { mnMaximizedWidth = nRWidth; }
123 : 6842 : unsigned int GetMaximizedWidth() const { return mnMaximizedWidth; }
124 : 3554 : void SetMaximizedHeight( unsigned int nRHeight ) { mnMaximizedHeight = nRHeight; }
125 : 6842 : unsigned int GetMaximizedHeight() const { return mnMaximizedHeight; }
126 : : };
127 : :
128 : : // ----------------------
129 : : // - SystemWindow-Types -
130 : : // ----------------------
131 : :
132 : : #define MENUBAR_MODE_NORMAL ((sal_uInt16)0)
133 : : #define MENUBAR_MODE_HIDE ((sal_uInt16)1)
134 : :
135 : : #define TITLE_BUTTON_DOCKING ((sal_uInt16)1)
136 : : #define TITLE_BUTTON_HIDE ((sal_uInt16)2)
137 : : #define TITLE_BUTTON_MENU ((sal_uInt16)4)
138 : :
139 : : // ----------------
140 : : // - SystemWindow -
141 : : // ----------------
142 : :
143 : :
144 : : class VCL_DLLPUBLIC SystemWindow : public Window
145 : : {
146 : : friend class WorkWindow;
147 : : class ImplData;
148 : :
149 : : private:
150 : : MenuBar* mpMenuBar;
151 : : Size maOrgSize;
152 : : Size maRollUpOutSize;
153 : : Size maMinOutSize;
154 : : sal_Bool mbPined;
155 : : sal_Bool mbRollUp;
156 : : sal_Bool mbRollFunc;
157 : : sal_Bool mbDockBtn;
158 : : sal_Bool mbHideBtn;
159 : : sal_Bool mbSysChild;
160 : : sal_uInt16 mnMenuBarMode;
161 : : sal_uInt16 mnIcon;
162 : : ImplData* mpImplData;
163 : :
164 : : #if _SOLAR__PRIVATE
165 : : public:
166 : : using Window::ImplIsInTaskPaneList;
167 : : SAL_DLLPRIVATE sal_Bool ImplIsInTaskPaneList( Window* pWin );
168 : : #endif
169 : :
170 : : private:
171 : : // Default construction is forbidden and not implemented.
172 : : SystemWindow();
173 : :
174 : : // Copy assignment is forbidden and not implemented.
175 : : SystemWindow (const SystemWindow &);
176 : : SystemWindow & operator= (const SystemWindow &);
177 : :
178 : : SAL_DLLPRIVATE void ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, Window* i_pConfigureWin );
179 : :
180 : : protected:
181 : : // Single argument ctors shall be explicit.
182 : : explicit SystemWindow( WindowType nType );
183 : :
184 : : void SetWindowStateData( const WindowStateData& rData );
185 : :
186 : : public:
187 : : ~SystemWindow();
188 : : virtual long Notify( NotifyEvent& rNEvt );
189 : : virtual long PreNotify( NotifyEvent& rNEvt );
190 : :
191 : : virtual sal_Bool Close();
192 : : virtual void TitleButtonClick( sal_uInt16 nButton );
193 : : virtual void Pin();
194 : : virtual void Roll();
195 : : virtual void Resizing( Size& rSize );
196 : :
197 : : void SetIcon( sal_uInt16 nIcon );
198 : 0 : sal_uInt16 GetIcon() const { return mnIcon; }
199 : : // for systems like MacOSX which can display the URL a document is loaded from
200 : : // separately from the window title
201 : : void SetRepresentedURL( const rtl::OUString& );
202 : :
203 : : void EnableSaveBackground( sal_Bool bSave = sal_True );
204 : : sal_Bool IsSaveBackgroundEnabled() const;
205 : :
206 : : void ShowTitleButton( sal_uInt16 nButton, sal_Bool bVisible = sal_True );
207 : : sal_Bool IsTitleButtonVisible( sal_uInt16 nButton ) const;
208 : :
209 : : void SetPin( sal_Bool bPin );
210 : 0 : sal_Bool IsPined() const { return mbPined; }
211 : :
212 : : void RollUp();
213 : : void RollDown();
214 : 98 : sal_Bool IsRollUp() const { return mbRollUp; }
215 : :
216 : 0 : void SetRollUpOutputSizePixel( const Size& rSize ) { maRollUpOutSize = rSize; }
217 : 0 : Size GetRollUpOutputSizePixel() const { return maRollUpOutSize; }
218 : :
219 : : void SetMinOutputSizePixel( const Size& rSize );
220 : 176 : const Size& GetMinOutputSizePixel() const { return maMinOutSize; }
221 : : void SetMaxOutputSizePixel( const Size& rSize );
222 : : const Size& GetMaxOutputSizePixel() const;
223 : : Size GetResizeOutputSizePixel() const;
224 : :
225 : : void SetWindowState(const rtl::OString& rStr);
226 : : rtl::OString GetWindowState(sal_uLong nMask = WINDOWSTATE_MASK_ALL) const;
227 : :
228 : : void SetMenuBar( MenuBar* pMenuBar );
229 : 14402 : MenuBar* GetMenuBar() const { return mpMenuBar; }
230 : : void SetMenuBarMode( sal_uInt16 nMode );
231 : : sal_uInt16 GetMenuBarMode() const { return mnMenuBarMode; }
232 : :
233 : : TaskPaneList* GetTaskPaneList();
234 : : void GetWindowStateData( WindowStateData& rData ) const;
235 : :
236 : : /**
237 : : Returns the screen number the window is on
238 : :
239 : : The Display Screen number is counted the same way that
240 : : <code>Application::GetScreenPosSizePixel</code>,
241 : : <code>Application::GetWorkAreaPosSizePixel</code>,
242 : : <code>Application::GetDisplayScreenName</code>
243 : : and of course <code>SystemWindow::SetScreenNumber</code>
244 : : are counted in.
245 : :
246 : : In case the window is positioned on multiple screens the
247 : : screen number returned will be of the screen containing the
248 : : upper left pixel of the frame area (that is of the client
249 : : area on system decorated windows, or the frame area of
250 : : undecorated resp. owner decorated windows.
251 : :
252 : : @returns the screen number
253 : :
254 : : @see SystemWindow::SetScreenNumber
255 : : */
256 : : unsigned int GetScreenNumber() const;
257 : : /**
258 : : Move the Window to a new screen. The same rules for
259 : : positioning apply as in <code>SystemWindow::GetScreenNumber</code>
260 : :
261 : : The Display Screen number is counted the same way that
262 : : <code>Application::GetScreenPosSizePixel</code>,
263 : : <code>Application::GetWorkAreaPosSizePixel</code>,
264 : : <code>Application::GetDisplayScreenName</code>
265 : : and of course <code>SystemWindow::GetScreenNumber</code>
266 : : are counted in.
267 : :
268 : : @see GetScreenNumber
269 : : */
270 : : void SetScreenNumber( unsigned int nNewScreen );
271 : :
272 : : void SetApplicationID( const rtl::OUString &rApplicationID );
273 : :
274 : : void SetCloseHdl(const Link& rLink);
275 : : const Link& GetCloseHdl() const;
276 : : };
277 : :
278 : : #endif // _SV_SYSWIN_HXX
279 : :
280 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|