Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / include / vcl / syswin.hxx
blob098f49e34d22c0df950a872a87a7a96c8319c395
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_SYSWIN_HXX
21 #define INCLUDED_VCL_SYSWIN_HXX
23 #include <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/window.hxx>
27 class ModalDialog;
28 class MenuBar;
29 class TaskPaneList;
32 // - Icon-Types -
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
52 // - WindowStateData -
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)
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)
76 class VCL_PLUGIN_PUBLIC WindowStateData
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;
90 public:
91 WindowStateData()
93 mnValidMask = mnX = mnY = mnWidth = mnHeight = mnState = 0;
94 mnMaximizedX = mnMaximizedY = mnMaximizedWidth = mnMaximizedHeight = 0;
97 void SetMask( sal_uLong nValidMask ) { mnValidMask = nValidMask; }
98 sal_uInt32 GetMask() const { return mnValidMask; }
100 void SetX( int nX ) { mnX = nX; }
101 int GetX() const { return mnX; }
102 void SetY( int nY ) { mnY = nY; }
103 int GetY() const { return mnY; }
104 void SetWidth( unsigned int nWidth ) { mnWidth = nWidth; }
105 unsigned int GetWidth() const { return mnWidth; }
106 void SetHeight( unsigned int nHeight ) { mnHeight = nHeight; }
107 unsigned int GetHeight() const { return mnHeight; }
108 void SetState( sal_uInt32 nState ) { mnState = nState; }
109 sal_uInt32 GetState() const { return mnState; }
110 void SetMaximizedX( int nRX ) { mnMaximizedX = nRX; }
111 int GetMaximizedX() const { return mnMaximizedX; }
112 void SetMaximizedY( int nRY ) { mnMaximizedY = nRY; }
113 int GetMaximizedY() const { return mnMaximizedY; }
114 void SetMaximizedWidth( unsigned int nRWidth ) { mnMaximizedWidth = nRWidth; }
115 unsigned int GetMaximizedWidth() const { return mnMaximizedWidth; }
116 void SetMaximizedHeight( unsigned int nRHeight ) { mnMaximizedHeight = nRHeight; }
117 unsigned int GetMaximizedHeight() const { return mnMaximizedHeight; }
121 // - SystemWindow-Types -
124 #define MENUBAR_MODE_NORMAL ((sal_uInt16)0)
125 #define MENUBAR_MODE_HIDE ((sal_uInt16)1)
127 #define TITLE_BUTTON_DOCKING ((sal_uInt16)1)
128 #define TITLE_BUTTON_HIDE ((sal_uInt16)2)
129 #define TITLE_BUTTON_MENU ((sal_uInt16)4)
132 // - SystemWindow -
136 class VCL_DLLPUBLIC SystemWindow : public Window
138 friend class WorkWindow;
139 class ImplData;
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;
156 public:
157 using Window::ImplIsInTaskPaneList;
158 SAL_DLLPRIVATE bool ImplIsInTaskPaneList( Window* pWin );
160 private:
161 // Default construction is forbidden and not implemented.
162 SystemWindow();
164 // Copy assignment is forbidden and not implemented.
165 SystemWindow (const SystemWindow &);
166 SystemWindow & operator= (const SystemWindow &);
168 SAL_DLLPRIVATE void ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, Window* i_pConfigureWin );
170 protected:
171 // Single argument ctors shall be explicit.
172 explicit SystemWindow( WindowType nType );
174 void SetWindowStateData( const WindowStateData& rData );
176 public:
177 virtual ~SystemWindow();
178 virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
179 virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
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 );
187 void SetIcon( sal_uInt16 nIcon );
188 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& );
193 void EnableSaveBackground( bool bSave = true );
194 bool IsSaveBackgroundEnabled() const;
196 void ShowTitleButton( sal_uInt16 nButton, bool bVisible = true );
197 bool IsTitleButtonVisible( sal_uInt16 nButton ) const;
199 void SetPin( bool bPin );
200 bool IsPinned() const { return mbPinned; }
202 void RollUp();
203 void RollDown();
204 bool IsRollUp() const { return mbRollUp; }
206 void SetRollUpOutputSizePixel( const Size& rSize ) { maRollUpOutSize = rSize; }
207 Size GetRollUpOutputSizePixel() const { return maRollUpOutSize; }
209 void SetMinOutputSizePixel( const Size& rSize );
210 const Size& GetMinOutputSizePixel() const { return maMinOutSize; }
211 void SetMaxOutputSizePixel( const Size& rSize );
212 const Size& GetMaxOutputSizePixel() const;
213 Size GetResizeOutputSizePixel() const;
215 void SetWindowState(const OString& rStr);
216 OString GetWindowState(sal_uLong nMask = WINDOWSTATE_MASK_ALL) const;
218 void SetMenuBar( MenuBar* pMenuBar );
219 MenuBar* GetMenuBar() const { return mpMenuBar; }
220 void SetMenuBarMode( sal_uInt16 nMode );
221 sal_uInt16 GetMenuBarMode() const { return mnMenuBarMode; }
223 TaskPaneList* GetTaskPaneList();
224 void GetWindowStateData( WindowStateData& rData ) const;
227 Returns the screen number the window is on
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.
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.
241 @returns the screen number
243 @see SystemWindow::SetScreenNumber
245 unsigned int GetScreenNumber() const;
247 Move the Window to a new screen. The same rules for
248 positioning apply as in <code>SystemWindow::GetScreenNumber</code>
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.
256 @see GetScreenNumber
258 void SetScreenNumber( unsigned int nNewScreen );
260 void SetApplicationID( const OUString &rApplicationID );
262 void SetCloseHdl(const Link& rLink);
263 const Link& GetCloseHdl() const;
266 #endif // INCLUDED_VCL_SYSWIN_HXX
268 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */