LibreOffice Module vcl (master) 1
syswin.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <vcl/dllapi.h>
23#include <vcl/idle.hxx>
24#include <vcl/vclenum.hxx>
25#include <vcl/window.hxx>
26#include <vcl/windowstate.hxx>
27#include <com/sun/star/frame/XFrame.hpp>
28#include <memory>
29
31class ScreenshotTest;
32class MenuBar;
34class NotebookBar;
35class TaskPaneList;
36class VclBuilder;
38
39#define ICON_LO_DEFAULT 1
40#define ICON_TEXT_DOCUMENT 2
41#define ICON_SPREADSHEET_DOCUMENT 4
42#define ICON_DRAWING_DOCUMENT 6
43#define ICON_PRESENTATION_DOCUMENT 8
44#define ICON_TEMPLATE 11
45#define ICON_DATABASE_DOCUMENT 12
46#define ICON_MATH_DOCUMENT 13
47#define ICON_MACROLIBRARY 1
48
49enum class MenuBarMode
50{
52};
53
54enum class TitleButton
55{
56 Docking = 1,
57 Hide = 2,
58 Menu = 4,
59};
60
61//helper baseclass to ease retro fitting dialogs/tabpages that load a resource
62//to load a .ui file instead
63//
64//vcl requires the Window Children of a Parent Window to be destroyed before
65//the Parent Window. VclBuilderContainer owns the VclBuilder which owns the
66//Children Window. So the VclBuilderContainer dtor must be called before
67//the Parent Window dtor.
68//
69//i.e. class Dialog : public SystemWindow, public VclBuilderContainer
70//not class Dialog : public VclBuilderContainer, public SystemWindow
71//
72//With the new 'dispose' framework, it is necessary to force the builder
73//dispose before the Window dispose; so a Dialog::dispose() method would
74//finish: disposeBuilder(); SystemWindow::dispose() to capture this ordering.
75
76class VCL_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") VclBuilderContainer
77{
78public:
79 VclBuilderContainer();
80 virtual ~VclBuilderContainer();
81 void disposeBuilder();
82
83 void setDeferredProperties();
84
85protected:
86 std::unique_ptr<VclBuilder> m_pUIBuilder;
87
88 friend class ::SalInstanceBuilder;
89 friend class ::ScreenshotTest;
90};
91
93 : public vcl::Window
94 , public VclBuilderContainer
95{
96 friend class WorkWindow;
97 class ImplData;
98
99private:
109 sal_uInt16 mnIcon;
110 std::unique_ptr<ImplData> mpImplData;
113protected:
116public:
117 using Window::ImplIsInTaskPaneList;
118 SAL_DLLPRIVATE bool ImplIsInTaskPaneList( vcl::Window* pWin );
119 SAL_DLLPRIVATE bool isDeferredInit() const { return mbIsDeferredInit; }
120
121private:
122 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 );
123 SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox);
124 DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, Timer*, void );
125
126 // try to extract content and return as Bitmap. To do that reliably, a Yield-loop
127 // like in Execute() has to be executed and it is necessary to detect when the
128 // paint is finished
129 virtual void PrePaint(vcl::RenderContext& rRenderContext) override;
130 virtual void PostPaint(vcl::RenderContext& rRenderContext) override;
131
132 // ensureRepaint - triggers Application::Yield until the dialog is
133 // completely repainted. Sometimes needed for dialogs showing progress
134 // during actions
135 SAL_DLLPRIVATE void ensureRepaint();
136
137protected:
138 // Single argument ctors shall be explicit.
139 explicit SystemWindow(WindowType nType, const char* pIdleDebugName);
140 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>());
141
142 void SetWindowState(const vcl::WindowData& rData);
143
144 virtual void settingOptimalLayoutSize(Window *pBox);
145
146 SAL_DLLPRIVATE void DoInitialLayout();
147
148public:
149 virtual ~SystemWindow() override;
150 virtual void dispose() override;
151
152 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
153 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
154
155 virtual bool Close();
156 virtual void TitleButtonClick( TitleButton nButton );
157 virtual void Resizing( Size& rSize );
158 virtual void Resize() override;
159 virtual Size GetOptimalSize() const override;
160 virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
161 bool isLayoutEnabled() const;
162 void setOptimalLayoutSize(bool bAllowWindowShrink);
163 bool isCalculatingInitialLayoutSize() const { return mbIsCalculatingInitialLayoutSize; }
164
165 void SetIcon( sal_uInt16 nIcon );
166 sal_uInt16 GetIcon() const { return mnIcon; }
167 // for systems like MacOSX which can display the URL a document is loaded from
168 // separately from the window title
169 void SetRepresentedURL( const OUString& );
170
171 void ShowTitleButton( TitleButton nButton, bool bVisible );
172 bool IsTitleButtonVisible( TitleButton nButton ) const;
173
174 void SetMinOutputSizePixel( const Size& rSize );
175 const Size& GetMinOutputSizePixel() const { return maMinOutSize; }
176 void SetMaxOutputSizePixel( const Size& rSize );
177 const Size& GetMaxOutputSizePixel() const;
178
179 void SetWindowState(std::string_view rStr);
180 OString GetWindowState(vcl::WindowDataMask nMask = vcl::WindowDataMask::All) const;
181
182 void SetMenuBar(MenuBar* pMenuBar);
183 MenuBar* GetMenuBar() const { return mpMenuBar; }
184 void SetMenuBarMode( MenuBarMode nMode );
185 void CollectMenuBarMnemonics(MnemonicGenerator& rMnemonicGenerator) const;
186 int GetMenuBarHeight() const;
187
188 void SetNotebookBar(const OUString& rUIXMLDescription,
189 const css::uno::Reference<css::frame::XFrame>& rFrame,
190 const NotebookBarAddonsItem& aNotebookBarAddonsItem,
191 bool bReloadNotebookbar = false);
192
193 void CloseNotebookBar();
194 VclPtr<NotebookBar> const & GetNotebookBar() const;
195
196 TaskPaneList* GetTaskPaneList();
197 void GetWindowState(vcl::WindowData& rData) const;
198
199 virtual void SetText( const OUString& rStr ) override;
200 virtual OUString GetText() const override;
201
220 unsigned int GetScreenNumber() const;
232 void SetScreenNumber( unsigned int nNewScreen );
233
234 void SetApplicationID( const OUString &rApplicationID );
235
236 bool UpdatePositionData();
237
238 void SetCloseHdl(const Link<SystemWindow&,void>& rLink);
239 const Link<SystemWindow&,void>& GetCloseHdl() const;
240
241 SAL_DLLPRIVATE bool hasPendingLayout() const { return maLayoutIdle.IsActive(); }
242
243 virtual void doDeferredInit(WinBits nBits);
244
245 // Screenshot interface
247};
248
249/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
An idle is a timer to be scheduled immediately.
Definition: idle.hxx:35
Definition: menu.hxx:116
This implements Widget Layout-based notebook-like menu bar.
Definition: notebookbar.hxx:28
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
OUString maNotebookBarUIFile
Definition: syswin.hxx:112
bool mbIsDeferredInit
Definition: syswin.hxx:114
bool mbSysChild
Definition: syswin.hxx:104
MenuBar * GetMenuBar() const
Definition: syswin.hxx:183
const Size & GetMinOutputSizePixel() const
Definition: syswin.hxx:175
bool mbInitialLayoutSizeCalculated
Definition: syswin.hxx:106
bool mbPaintComplete
Definition: syswin.hxx:107
VclPtr< MenuBar > mpMenuBar
Definition: syswin.hxx:97
sal_uInt16 GetIcon() const
Definition: syswin.hxx:166
bool isCalculatingInitialLayoutSize() const
Definition: syswin.hxx:163
SAL_DLLPRIVATE bool isDeferredInit() const
Definition: syswin.hxx:119
Size maMinOutSize
Definition: syswin.hxx:101
bool mbIsCalculatingInitialLayoutSize
Definition: syswin.hxx:105
bool mbHideBtn
Definition: syswin.hxx:103
sal_uInt16 mnIcon
Definition: syswin.hxx:109
std::unique_ptr< ImplData > mpImplData
Definition: syswin.hxx:110
SAL_DLLPRIVATE bool hasPendingLayout() const
Definition: syswin.hxx:241
bool mbDockBtn
Definition: syswin.hxx:102
DECL_DLLPRIVATE_LINK(ImplHandleLayoutTimerHdl, Timer *, void)
VclPtr< vcl::Window > mpDialogParent
Definition: syswin.hxx:115
MenuBarMode mnMenuBarMode
Definition: syswin.hxx:108
Idle maLayoutIdle
Definition: syswin.hxx:111
bool IsActive() const
Definition: task.hxx:101
Definition: timer.hxx:27
Creates a hierarchy of vcl::Windows (widgets) from a .ui file for dialogs, sidebar,...
Definition: builder.hxx:69
virtual BitmapEx createScreenshot() const override
virtual void SetText(const OUString &rStr) override
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
bool isLayoutEnabled(const vcl::Window *pWindow)
Definition: layout.cxx:2923
void dispose()
long Long
WindowDataMask
Definition: windowstate.hxx:43
TitleButton
Definition: syswin.hxx:55
class VCL_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") VclBuilderContainer
Definition: syswin.hxx:76
MenuBarMode
Definition: syswin.hxx:50
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109
WindowType
Definition: wintypes.hxx:27