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 :
75 : class VCL_PLUGIN_PUBLIC WindowStateData
76 : {
77 : private:
78 : sal_uInt32 mnValidMask;
79 : int mnX;
80 : int mnY;
81 : unsigned int mnWidth;
82 : unsigned int mnHeight;
83 : int mnMaximizedX;
84 : int mnMaximizedY;
85 : unsigned int mnMaximizedWidth;
86 : unsigned int mnMaximizedHeight;
87 : sal_uInt32 mnState;
88 :
89 : public:
90 312 : WindowStateData()
91 : {
92 312 : mnValidMask = mnX = mnY = mnWidth = mnHeight = mnState = 0;
93 312 : mnMaximizedX = mnMaximizedY = mnMaximizedWidth = mnMaximizedHeight = 0;
94 312 : }
95 :
96 482 : void SetMask( sal_uLong nValidMask ) { mnValidMask = nValidMask; }
97 1334 : sal_uInt32 GetMask() const { return mnValidMask; }
98 :
99 312 : void SetX( int nX ) { mnX = nX; }
100 596 : int GetX() const { return mnX; }
101 312 : void SetY( int nY ) { mnY = nY; }
102 596 : int GetY() const { return mnY; }
103 312 : void SetWidth( unsigned int nWidth ) { mnWidth = nWidth; }
104 596 : unsigned int GetWidth() const { return mnWidth; }
105 312 : void SetHeight( unsigned int nHeight ) { mnHeight = nHeight; }
106 596 : unsigned int GetHeight() const { return mnHeight; }
107 312 : void SetState( sal_uInt32 nState ) { mnState = nState; }
108 312 : sal_uInt32 GetState() const { return mnState; }
109 142 : void SetMaximizedX( int nRX ) { mnMaximizedX = nRX; }
110 596 : int GetMaximizedX() const { return mnMaximizedX; }
111 142 : void SetMaximizedY( int nRY ) { mnMaximizedY = nRY; }
112 596 : int GetMaximizedY() const { return mnMaximizedY; }
113 284 : void SetMaximizedWidth( unsigned int nRWidth ) { mnMaximizedWidth = nRWidth; }
114 454 : unsigned int GetMaximizedWidth() const { return mnMaximizedWidth; }
115 284 : void SetMaximizedHeight( unsigned int nRHeight ) { mnMaximizedHeight = nRHeight; }
116 454 : unsigned int GetMaximizedHeight() const { return mnMaximizedHeight; }
117 : };
118 :
119 : // ----------------------
120 : // - SystemWindow-Types -
121 : // ----------------------
122 :
123 : #define MENUBAR_MODE_NORMAL ((sal_uInt16)0)
124 : #define MENUBAR_MODE_HIDE ((sal_uInt16)1)
125 :
126 : #define TITLE_BUTTON_DOCKING ((sal_uInt16)1)
127 : #define TITLE_BUTTON_HIDE ((sal_uInt16)2)
128 : #define TITLE_BUTTON_MENU ((sal_uInt16)4)
129 :
130 : // ----------------
131 : // - SystemWindow -
132 : // ----------------
133 :
134 :
135 : class VCL_DLLPUBLIC SystemWindow : public Window
136 : {
137 : friend class WorkWindow;
138 : class ImplData;
139 :
140 : private:
141 : MenuBar* mpMenuBar;
142 : Size maOrgSize;
143 : Size maRollUpOutSize;
144 : Size maMinOutSize;
145 : sal_Bool mbPined;
146 : sal_Bool mbRollUp;
147 : sal_Bool mbRollFunc;
148 : sal_Bool mbDockBtn;
149 : sal_Bool mbHideBtn;
150 : sal_Bool mbSysChild;
151 : sal_uInt16 mnMenuBarMode;
152 : sal_uInt16 mnIcon;
153 : ImplData* mpImplData;
154 :
155 : public:
156 : using Window::ImplIsInTaskPaneList;
157 : SAL_DLLPRIVATE sal_Bool ImplIsInTaskPaneList( Window* pWin );
158 :
159 : private:
160 : // Default construction is forbidden and not implemented.
161 : SystemWindow();
162 :
163 : // Copy assignment is forbidden and not implemented.
164 : SystemWindow (const SystemWindow &);
165 : SystemWindow & operator= (const SystemWindow &);
166 :
167 : SAL_DLLPRIVATE void ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, Window* i_pConfigureWin );
168 :
169 : protected:
170 : // Single argument ctors shall be explicit.
171 : explicit SystemWindow( WindowType nType );
172 :
173 : void SetWindowStateData( const WindowStateData& rData );
174 :
175 : public:
176 : ~SystemWindow();
177 : virtual long Notify( NotifyEvent& rNEvt );
178 : virtual long PreNotify( NotifyEvent& rNEvt );
179 :
180 : virtual sal_Bool Close();
181 : virtual void TitleButtonClick( sal_uInt16 nButton );
182 : virtual void Pin();
183 : virtual void Roll();
184 : virtual void Resizing( Size& rSize );
185 :
186 : void SetIcon( sal_uInt16 nIcon );
187 0 : sal_uInt16 GetIcon() const { return mnIcon; }
188 : // for systems like MacOSX which can display the URL a document is loaded from
189 : // separately from the window title
190 : void SetRepresentedURL( const rtl::OUString& );
191 :
192 : void EnableSaveBackground( sal_Bool bSave = sal_True );
193 : sal_Bool IsSaveBackgroundEnabled() const;
194 :
195 : void ShowTitleButton( sal_uInt16 nButton, sal_Bool bVisible = sal_True );
196 : sal_Bool IsTitleButtonVisible( sal_uInt16 nButton ) const;
197 :
198 : void SetPin( sal_Bool bPin );
199 0 : sal_Bool IsPined() const { return mbPined; }
200 :
201 : void RollUp();
202 : void RollDown();
203 0 : sal_Bool IsRollUp() const { return mbRollUp; }
204 :
205 0 : void SetRollUpOutputSizePixel( const Size& rSize ) { maRollUpOutSize = rSize; }
206 0 : Size GetRollUpOutputSizePixel() const { return maRollUpOutSize; }
207 :
208 : void SetMinOutputSizePixel( const Size& rSize );
209 0 : const Size& GetMinOutputSizePixel() const { return maMinOutSize; }
210 : void SetMaxOutputSizePixel( const Size& rSize );
211 : const Size& GetMaxOutputSizePixel() const;
212 : Size GetResizeOutputSizePixel() const;
213 :
214 : void SetWindowState(const rtl::OString& rStr);
215 : rtl::OString GetWindowState(sal_uLong nMask = WINDOWSTATE_MASK_ALL) const;
216 :
217 : void SetMenuBar( MenuBar* pMenuBar );
218 985 : MenuBar* GetMenuBar() const { return mpMenuBar; }
219 : void SetMenuBarMode( sal_uInt16 nMode );
220 : sal_uInt16 GetMenuBarMode() const { return mnMenuBarMode; }
221 :
222 : TaskPaneList* GetTaskPaneList();
223 : void GetWindowStateData( WindowStateData& rData ) const;
224 :
225 : /**
226 : Returns the screen number the window is on
227 :
228 : The Display Screen number is counted the same way that
229 : <code>Application::GetScreenPosSizePixel</code>,
230 : <code>Application::GetWorkAreaPosSizePixel</code>,
231 : <code>Application::GetDisplayScreenName</code>
232 : and of course <code>SystemWindow::SetScreenNumber</code>
233 : are counted in.
234 :
235 : In case the window is positioned on multiple screens the
236 : screen number returned will be of the screen containing the
237 : upper left pixel of the frame area (that is of the client
238 : area on system decorated windows, or the frame area of
239 : undecorated resp. owner decorated windows.
240 :
241 : @returns the screen number
242 :
243 : @see SystemWindow::SetScreenNumber
244 : */
245 : unsigned int GetScreenNumber() const;
246 : /**
247 : Move the Window to a new screen. The same rules for
248 : positioning apply as in <code>SystemWindow::GetScreenNumber</code>
249 :
250 : The Display Screen number is counted the same way that
251 : <code>Application::GetScreenPosSizePixel</code>,
252 : <code>Application::GetWorkAreaPosSizePixel</code>,
253 : <code>Application::GetDisplayScreenName</code>
254 : and of course <code>SystemWindow::GetScreenNumber</code>
255 : are counted in.
256 :
257 : @see GetScreenNumber
258 : */
259 : void SetScreenNumber( unsigned int nNewScreen );
260 :
261 : void SetApplicationID( const rtl::OUString &rApplicationID );
262 :
263 : void SetCloseHdl(const Link& rLink);
264 : const Link& GetCloseHdl() const;
265 : };
266 :
267 : #endif // _SV_SYSWIN_HXX
268 :
269 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|