vcl: 'horizontically'
[LibreOffice.git] / include / vcl / syswin.hxx
blob6238e9f382caca1cd24d3b54dd1ae9a401ee1435
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 <vcl/dllapi.h>
24 #include <vcl/builder.hxx>
25 #include <vcl/idle.hxx>
26 #include <vcl/vclenum.hxx>
27 #include <vcl/window.hxx>
28 #include <vcl/windowstate.hxx>
29 #include <memory>
30 #include <vcl/notebookbar/NotebookBarAddonsMerger.hxx>
32 class MenuBar;
33 class NotebookBar;
34 class TaskPaneList;
36 #define ICON_LO_DEFAULT 1
37 #define ICON_TEXT_DOCUMENT 2
38 #define ICON_SPREADSHEET_DOCUMENT 4
39 #define ICON_DRAWING_DOCUMENT 6
40 #define ICON_PRESENTATION_DOCUMENT 8
41 #define ICON_TEMPLATE 11
42 #define ICON_DATABASE_DOCUMENT 12
43 #define ICON_MATH_DOCUMENT 13
44 #define ICON_MACROLIBRARY 1
46 enum class MenuBarMode
48 Normal, Hide
51 enum class TitleButton
53 Docking = 1,
54 Hide = 2,
55 Menu = 4,
58 class VCL_DLLPUBLIC SystemWindow
59 : public vcl::Window
60 , public VclBuilderContainer
62 friend class WorkWindow;
63 class ImplData;
65 private:
66 VclPtr<MenuBar> mpMenuBar;
67 Size maOrgSize;
68 Size maRollUpOutSize;
69 Size maMinOutSize;
70 bool mbRollUp;
71 bool mbDockBtn;
72 bool mbHideBtn;
73 bool mbSysChild;
74 bool mbIsCalculatingInitialLayoutSize;
75 bool mbPaintComplete;
76 MenuBarMode mnMenuBarMode;
77 sal_uInt16 mnIcon;
78 std::unique_ptr<ImplData> mpImplData;
79 Idle maLayoutIdle;
80 OUString maNotebookBarUIFile;
81 protected:
82 bool mbIsDeferredInit;
83 VclPtr<vcl::Window> mpDialogParent;
84 public:
85 using Window::ImplIsInTaskPaneList;
86 SAL_DLLPRIVATE bool ImplIsInTaskPaneList( vcl::Window* pWin );
87 SAL_DLLPRIVATE bool isDeferredInit() const { return mbIsDeferredInit; }
89 private:
90 SAL_DLLPRIVATE void ImplMoveToScreen( tools::Long& io_rX, tools::Long& io_rY, tools::Long i_nWidth, tools::Long i_nHeight, vcl::Window const * i_pConfigureWin );
91 SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox);
92 DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, Timer*, void );
94 // try to extract content and return as Bitmap. To do that reliably, a Yield-loop
95 // like in Execute() has to be executed and it is necessary to detect when the
96 // paint is finished
97 virtual void PrePaint(vcl::RenderContext& rRenderContext) override;
98 virtual void PostPaint(vcl::RenderContext& rRenderContext) override;
100 // ensureRepaint - triggers Application::Yield until the dialog is
101 // completely repainted. Sometimes needed for dialogs showing progress
102 // during actions
103 SAL_DLLPRIVATE void ensureRepaint();
105 protected:
106 // Single argument ctors shall be explicit.
107 explicit SystemWindow(WindowType nType);
108 void loadUI(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
110 void SetWindowStateData( const WindowStateData& rData );
112 virtual void settingOptimalLayoutSize(Window *pBox);
114 SAL_DLLPRIVATE void DoInitialLayout();
116 SAL_DLLPRIVATE void SetIdleDebugName( const char *pDebugName );
118 public:
119 virtual ~SystemWindow() override;
120 virtual void dispose() override;
122 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
123 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
125 virtual bool Close();
126 virtual void TitleButtonClick( TitleButton nButton );
127 virtual void Resizing( Size& rSize );
128 virtual void Resize() override;
129 virtual Size GetOptimalSize() const override;
130 virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
131 bool isLayoutEnabled() const;
132 void setOptimalLayoutSize();
133 bool isCalculatingInitialLayoutSize() const { return mbIsCalculatingInitialLayoutSize; }
135 void SetIcon( sal_uInt16 nIcon );
136 sal_uInt16 GetIcon() const { return mnIcon; }
137 // for systems like MacOSX which can display the URL a document is loaded from
138 // separately from the window title
139 void SetRepresentedURL( const OUString& );
141 void ShowTitleButton( TitleButton nButton, bool bVisible );
142 bool IsTitleButtonVisible( TitleButton nButton ) const;
144 void RollUp();
145 void RollDown();
146 bool IsRollUp() const { return mbRollUp; }
148 void SetRollUpOutputSizePixel( const Size& rSize ) { maRollUpOutSize = rSize; }
149 const Size& GetRollUpOutputSizePixel() const { return maRollUpOutSize; }
151 void SetMinOutputSizePixel( const Size& rSize );
152 const Size& GetMinOutputSizePixel() const { return maMinOutSize; }
153 void SetMaxOutputSizePixel( const Size& rSize );
154 const Size& GetMaxOutputSizePixel() const;
156 void SetWindowState(const OString& rStr);
157 OString GetWindowState(WindowStateMask nMask = WindowStateMask::All) const;
159 void SetMenuBar(MenuBar* pMenuBar);
160 MenuBar* GetMenuBar() const { return mpMenuBar; }
161 void SetMenuBarMode( MenuBarMode nMode );
163 void SetNotebookBar(const OUString& rUIXMLDescription,
164 const css::uno::Reference<css::frame::XFrame>& rFrame,
165 const NotebookBarAddonsItem& aNotebookBarAddonsItem,
166 bool bReloadNotebookbar = false);
168 void CloseNotebookBar();
169 VclPtr<NotebookBar> const & GetNotebookBar() const;
171 TaskPaneList* GetTaskPaneList();
172 void GetWindowStateData( WindowStateData& rData ) const;
174 virtual void SetText( const OUString& rStr ) override;
175 virtual OUString GetText() const override;
178 Returns the screen number the window is on
180 The Display Screen number is counted the same way that
181 <code>Application::GetScreenPosSizePixel</code>
182 and of course <code>SystemWindow::SetScreenNumber</code>
183 are counted in.
185 In case the window is positioned on multiple screens the
186 screen number returned will be of the screen containing the
187 upper left pixel of the frame area (that is of the client
188 area on system decorated windows, or the frame area of
189 undecorated resp. owner decorated windows.
191 @returns the screen number
193 @see SystemWindow::SetScreenNumber
195 unsigned int GetScreenNumber() const;
197 Move the Window to a new screen. The same rules for
198 positioning apply as in <code>SystemWindow::GetScreenNumber</code>
200 The Display Screen number is counted the same way that
201 <code>Application::GetScreenPosSizePixel</code>
202 and of course <code>SystemWindow::GetScreenNumber</code>
203 are counted in.
205 @see GetScreenNumber
207 void SetScreenNumber( unsigned int nNewScreen );
209 void SetApplicationID( const OUString &rApplicationID );
211 void SetCloseHdl(const Link<SystemWindow&,void>& rLink);
212 const Link<SystemWindow&,void>& GetCloseHdl() const;
214 SAL_DLLPRIVATE bool hasPendingLayout() const { return maLayoutIdle.IsActive(); }
216 virtual void doDeferredInit(WinBits nBits);
218 // Screenshot interface
219 VclPtr<VirtualDevice> createScreenshot();
222 inline void SystemWindow::SetIdleDebugName( const char *pDebugName )
224 maLayoutIdle.SetDebugName( pDebugName );
227 #endif // INCLUDED_VCL_SYSWIN_HXX
229 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */