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 INCLUDED_VCL_SYSWIN_HXX
21 : #define INCLUDED_VCL_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 0 : WindowStateData()
92 : {
93 0 : mnValidMask = mnX = mnY = mnWidth = mnHeight = mnState = 0;
94 0 : mnMaximizedX = mnMaximizedY = mnMaximizedWidth = mnMaximizedHeight = 0;
95 0 : }
96 :
97 0 : void SetMask( sal_uLong nValidMask ) { mnValidMask = nValidMask; }
98 0 : sal_uInt32 GetMask() const { return mnValidMask; }
99 :
100 0 : void SetX( int nX ) { mnX = nX; }
101 0 : int GetX() const { return mnX; }
102 0 : void SetY( int nY ) { mnY = nY; }
103 0 : int GetY() const { return mnY; }
104 0 : void SetWidth( unsigned int nWidth ) { mnWidth = nWidth; }
105 0 : unsigned int GetWidth() const { return mnWidth; }
106 0 : void SetHeight( unsigned int nHeight ) { mnHeight = nHeight; }
107 0 : unsigned int GetHeight() const { return mnHeight; }
108 0 : void SetState( sal_uInt32 nState ) { mnState = nState; }
109 0 : sal_uInt32 GetState() const { return mnState; }
110 0 : void SetMaximizedX( int nRX ) { mnMaximizedX = nRX; }
111 0 : int GetMaximizedX() const { return mnMaximizedX; }
112 0 : void SetMaximizedY( int nRY ) { mnMaximizedY = nRY; }
113 0 : int GetMaximizedY() const { return mnMaximizedY; }
114 0 : void SetMaximizedWidth( unsigned int nRWidth ) { mnMaximizedWidth = nRWidth; }
115 0 : unsigned int GetMaximizedWidth() const { return mnMaximizedWidth; }
116 0 : void SetMaximizedHeight( unsigned int nRHeight ) { mnMaximizedHeight = nRHeight; }
117 0 : 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 : bool mbPinned;
147 : bool mbRollUp;
148 : bool mbRollFunc;
149 : bool mbDockBtn;
150 : bool mbHideBtn;
151 : bool mbSysChild;
152 : sal_uInt16 mnMenuBarMode;
153 : sal_uInt16 mnIcon;
154 : ImplData* mpImplData;
155 :
156 : public:
157 : using Window::ImplIsInTaskPaneList;
158 : SAL_DLLPRIVATE 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 : virtual ~SystemWindow();
178 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
179 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
180 :
181 : virtual 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( bool bSave = true );
194 : bool IsSaveBackgroundEnabled() const;
195 :
196 : void ShowTitleButton( sal_uInt16 nButton, bool bVisible = true );
197 : bool IsTitleButtonVisible( sal_uInt16 nButton ) const;
198 :
199 : void SetPin( bool bPin );
200 0 : bool IsPinned() const { return mbPinned; }
201 :
202 : void RollUp();
203 : void RollDown();
204 0 : 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 0 : 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 0 : 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::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::GetDisplayScreenName</code>
253 : and of course <code>SystemWindow::GetScreenNumber</code>
254 : are counted in.
255 :
256 : @see GetScreenNumber
257 : */
258 : void SetScreenNumber( unsigned int nNewScreen );
259 :
260 : void SetApplicationID( const OUString &rApplicationID );
261 :
262 : void SetCloseHdl(const Link& rLink);
263 : const Link& GetCloseHdl() const;
264 : };
265 :
266 : #endif // INCLUDED_VCL_SYSWIN_HXX
267 :
268 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|