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