xref: /trunk/main/vcl/inc/vcl/syswin.hxx (revision 0d63794c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SV_SYSWIN_HXX
25 #define _SV_SYSWIN_HXX
26 
27 #include <vcl/sv.h>
28 #include <vcl/dllapi.h>
29 #include <vcl/window.hxx>
30 
31 class ModalDialog;
32 class MenuBar;
33 class TaskPaneList;
34 
35 // --------------
36 // - Icon-Types -
37 // --------------
38 
39 #define ICON_DEFAULT                    0
40 #define ICON_SO_DEFAULT                 1
41 #define ICON_TEXT_DOCUMENT              2
42 #define ICON_TEXT_TEMPLATE              3
43 #define ICON_SPREADSHEET_DOCUMENT       4
44 #define ICON_SPREADSHEET_TEMPLATE       5
45 #define ICON_DRAWING_DOCUMENT           6
46 #define ICON_DRAWING_TEMPLATE           7
47 #define ICON_PRESENTATION_DOCUMENT      8
48 #define ICON_PRESENTATION_TEMPLATE      9
49 #define ICON_PRESENTATION_COMPRESSED    10
50 #define ICON_GLOBAL_DOCUMENT            11
51 #define ICON_HTML_DOCUMENT              12
52 #define ICON_CHART_DOCUMENT             13
53 #define ICON_DATABASE_DOCUMENT          14
54 #define ICON_MATH_DOCUMENT              15
55 #define ICON_TEMPLATE                   16
56 #define ICON_MACROLIBRARY               17
57 #define	ICON_PLAYER						100
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:
WindowStateData()99                 WindowStateData()
100                 {
101                     mnValidMask = mnX = mnY = mnWidth = mnHeight = mnState = 0;
102                     mnMaximizedX = mnMaximizedY = mnMaximizedWidth = mnMaximizedHeight = 0;
103                 }
104 
SetMask(sal_uLong nValidMask)105     void        SetMask( sal_uLong nValidMask ) { mnValidMask = nValidMask; }
GetMask() const106     sal_uInt32  GetMask() const { return mnValidMask; }
107 
SetX(int nX)108     void         SetX( int nX ) { mnX = nX; }
GetX() const109     int          GetX() const { return mnX; }
SetY(int nY)110     void         SetY( int nY ) { mnY = nY; }
GetY() const111     int          GetY() const { return mnY; }
SetWidth(unsigned int nWidth)112     void         SetWidth( unsigned int nWidth ) { mnWidth = nWidth; }
GetWidth() const113     unsigned int GetWidth() const { return mnWidth; }
SetHeight(unsigned int nHeight)114     void         SetHeight( unsigned int nHeight ) { mnHeight = nHeight; }
GetHeight() const115     unsigned int GetHeight() const { return mnHeight; }
SetState(sal_uInt32 nState)116     void         SetState( sal_uInt32 nState ) { mnState = nState; }
GetState() const117     sal_uInt32   GetState() const { return mnState; }
SetMaximizedX(int nRX)118     void         SetMaximizedX( int nRX ) { mnMaximizedX = nRX; }
GetMaximizedX() const119     int          GetMaximizedX() const { return mnMaximizedX; }
SetMaximizedY(int nRY)120     void         SetMaximizedY( int nRY ) { mnMaximizedY = nRY; }
GetMaximizedY() const121     int          GetMaximizedY() const { return mnMaximizedY; }
SetMaximizedWidth(unsigned int nRWidth)122     void         SetMaximizedWidth( unsigned int nRWidth ) { mnMaximizedWidth = nRWidth; }
GetMaximizedWidth() const123     unsigned int GetMaximizedWidth() const { return mnMaximizedWidth; }
SetMaximizedHeight(unsigned int nRHeight)124     void         SetMaximizedHeight( unsigned int nRHeight ) { mnMaximizedHeight = nRHeight; }
GetMaximizedHeight() const125     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 );
GetIcon() const198     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     const rtl::OUString& GetRepresentedURL() const;
203 
204     void            SetZLevel( sal_uInt8 nLevel );
205     sal_uInt8            GetZLevel() const;
206 
207     void            EnableSaveBackground( sal_Bool bSave = sal_True );
208     sal_Bool            IsSaveBackgroundEnabled() const;
209 
210     void            ShowTitleButton( sal_uInt16 nButton, sal_Bool bVisible = sal_True );
211     sal_Bool            IsTitleButtonVisible( sal_uInt16 nButton ) const;
212 
213     void            SetPin( sal_Bool bPin );
IsPined() const214     sal_Bool            IsPined() const { return mbPined; }
215 
216     void            RollUp();
217     void            RollDown();
IsRollUp() const218     sal_Bool            IsRollUp() const { return mbRollUp; }
219 
SetRollUpOutputSizePixel(const Size & rSize)220     void            SetRollUpOutputSizePixel( const Size& rSize ) { maRollUpOutSize = rSize; }
GetRollUpOutputSizePixel() const221     Size            GetRollUpOutputSizePixel() const { return maRollUpOutSize; }
222 
223     void            SetMinOutputSizePixel( const Size& rSize );
GetMinOutputSizePixel() const224     const Size&     GetMinOutputSizePixel() const { return maMinOutSize; }
225     void            SetMaxOutputSizePixel( const Size& rSize );
226     const Size&     GetMaxOutputSizePixel() const;
227     Size            GetResizeOutputSizePixel() const;
228 
229     void            SetWindowState( const ByteString& rStr );
230     ByteString      GetWindowState( sal_uLong nMask = WINDOWSTATE_MASK_ALL ) const;
231 
232     void            SetMenuBar( MenuBar* pMenuBar );
GetMenuBar() const233     MenuBar*        GetMenuBar() const { return mpMenuBar; }
234     void            SetMenuBarMode( sal_uInt16 nMode );
GetMenuBarMode() const235     sal_uInt16          GetMenuBarMode() const { return mnMenuBarMode; }
236 
237 	TaskPaneList*	GetTaskPaneList();
238     void            GetWindowStateData( WindowStateData& rData ) const;
239 
240     /**
241     Returns the screen number the window is on
242 
243     The screen number is counted the same way that
244     <code>Application::GetScreenPosSizePixel</code>,
245     <code>Application::GetWorkAreaPosSizePixel</code>,
246     <code>Application::GetScreenName</code>
247     and of course <code>SystemWindow::SetScreenNumber</code>
248     are counted in.
249 
250     In case the window is positioned on multiple screens the
251     screen number returned will be of the screen containing the
252     upper left pixel of the frame area (that is of the client
253     area on system decorated windows, or the frame area of
254     undecorated resp. owner decorated windows.
255 
256     @returns the screen number
257 
258     @see SystemWindow::SetScreenNumber
259     */
260     unsigned int    GetScreenNumber() const;
261     /**
262     Move the Window to a new screen. The same rules for
263     positioning apply as in <code>SystemWindow::GetScreenNumber</code>
264 
265     The screen number is counted the same way that
266     <code>Application::GetScreenPosSizePixel</code>,
267     <code>Application::GetWorkAreaPosSizePixel</code>,
268     <code>Application::GetScreenName</code>
269     and of course <code>SystemWindow::GetScreenNumber</code>
270     are counted in.
271 
272     @see GetScreenNumber
273     */
274     void            SetScreenNumber( unsigned int nNewScreen );
275 };
276 
277 #endif // _SV_SYSWIN_HXX
278