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 #ifndef INCLUDED_VCL_SYSWIN_HXX
21 #define INCLUDED_VCL_SYSWIN_HXX
22 
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>
31 
32 class MenuBar;
33 class NotebookBar;
34 class TaskPaneList;
35 
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
45 
46 enum class MenuBarMode
47 {
48  Normal, Hide
49 };
50 
51 enum class TitleButton
52 {
53  Docking = 1,
54  Hide = 2,
55  Menu = 4,
56 };
57 
59  : public vcl::Window
60  , public VclBuilderContainer
61 {
62  friend class WorkWindow;
63  class ImplData;
64 
65 private:
70  bool mbRollUp;
71  bool mbDockBtn;
72  bool mbHideBtn;
73  bool mbSysChild;
77  sal_uInt16 mnIcon;
78  std::unique_ptr<ImplData> mpImplData;
81 protected:
84 public:
86  SAL_DLLPRIVATE bool ImplIsInTaskPaneList( vcl::Window* pWin );
87  SAL_DLLPRIVATE bool isDeferredInit() const { return mbIsDeferredInit; }
88 
89 private:
90  SAL_DLLPRIVATE void ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, vcl::Window const * i_pConfigureWin );
91  SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox);
92  DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, Timer*, void );
93 
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;
99 
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();
104 
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>());
109 
110  void SetWindowStateData( const WindowStateData& rData );
111 
112  virtual void settingOptimalLayoutSize(Window *pBox);
113 
114  SAL_DLLPRIVATE void DoInitialLayout();
115 
116  SAL_DLLPRIVATE void SetIdleDebugName( const char *pDebugName );
117 
118 public:
119  virtual ~SystemWindow() override;
120  virtual void dispose() override;
121 
122  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
123  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
124 
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; }
134 
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& );
140 
141  void ShowTitleButton( TitleButton nButton, bool bVisible );
142  bool IsTitleButtonVisible( TitleButton nButton ) const;
143 
144  void RollUp();
145  void RollDown();
146  bool IsRollUp() const { return mbRollUp; }
147 
148  void SetRollUpOutputSizePixel( const Size& rSize ) { maRollUpOutSize = rSize; }
149  const Size& GetRollUpOutputSizePixel() const { return maRollUpOutSize; }
150 
151  void SetMinOutputSizePixel( const Size& rSize );
152  const Size& GetMinOutputSizePixel() const { return maMinOutSize; }
153  void SetMaxOutputSizePixel( const Size& rSize );
154  const Size& GetMaxOutputSizePixel() const;
155 
156  void SetWindowState(const OString& rStr);
157  OString GetWindowState(WindowStateMask nMask = WindowStateMask::All) const;
158 
159  void SetMenuBar(MenuBar* pMenuBar);
160  MenuBar* GetMenuBar() const { return mpMenuBar; }
161  void SetMenuBarMode( MenuBarMode nMode );
162 
163  void SetNotebookBar(const OUString& rUIXMLDescription,
164  const css::uno::Reference<css::frame::XFrame>& rFrame,
165  const NotebookBarAddonsItem& aNotebookBarAddonsItem,
166  bool bReloadNotebookbar = false);
167 
168  void CloseNotebookBar();
169  VclPtr<NotebookBar> const & GetNotebookBar() const;
170 
171  TaskPaneList* GetTaskPaneList();
172  void GetWindowStateData( WindowStateData& rData ) const;
173 
174  virtual void SetText( const OUString& rStr ) override;
175  virtual OUString GetText() const override;
176 
195  unsigned int GetScreenNumber() const;
207  void SetScreenNumber( unsigned int nNewScreen );
208 
209  void SetApplicationID( const OUString &rApplicationID );
210 
211  void SetCloseHdl(const Link<SystemWindow&,void>& rLink);
212  const Link<SystemWindow&,void>& GetCloseHdl() const;
213 
214  SAL_DLLPRIVATE bool hasPendingLayout() const { return maLayoutIdle.IsActive(); }
215 
216  virtual void doDeferredInit(WinBits nBits);
217 
218  // Screenshot interface
219  VclPtr<VirtualDevice> createScreenshot();
220 };
221 
222 inline void SystemWindow::SetIdleDebugName( const char *pDebugName )
223 {
224  maLayoutIdle.SetDebugName( pDebugName );
225 }
226 
227 #endif // INCLUDED_VCL_SYSWIN_HXX
228 
229 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SetText(const OUString &rStr)
Definition: window.cxx:3010
SAL_DLLPRIVATE bool isDeferredInit() const
Definition: syswin.hxx:87
SAL_DLLPRIVATE void ImplIsInTaskPaneList(bool mbIsInTaskList)
Definition: window.cxx:3600
DECL_DLLPRIVATE_LINK(ImplHandlePaintHdl, Timer *, void)
VclPtr< MenuBar > mpMenuBar
Definition: syswin.hxx:63
bool IsRollUp() const
Definition: syswin.hxx:146
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
virtual Size GetOptimalSize() const
Definition: window3.cxx:33
std::unique_ptr< ImplData > mpImplData
Definition: syswin.hxx:78
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: window.cxx:145
bool IsActive() const
Definition: task.hxx:90
StateChangedType
Definition: window.hxx:317
sal_Int64 WinBits
WindowStateMask
Definition: vclenum.hxx:123
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1314
virtual OUString GetText() const
Definition: window.cxx:3039
Idle maLayoutIdle
Definition: syswin.hxx:79
const Size & GetMinOutputSizePixel() const
Definition: syswin.hxx:152
void SetDebugName(const char *pDebugName)
Definition: task.hxx:81
virtual void PrePaint(vcl::RenderContext &rRenderContext)
Definition: paint.cxx:1011
virtual bool PreNotify(NotifyEvent &rNEvt)
Definition: event.cxx:51
virtual bool EventNotify(NotifyEvent &rNEvt)
Definition: event.cxx:103
const Size & GetRollUpOutputSizePixel() const
Definition: syswin.hxx:149
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:302
bool isCalculatingInitialLayoutSize() const
Definition: syswin.hxx:133
sal_uInt16 mnIcon
Definition: syswin.hxx:77
virtual void Resize()
Definition: window.cxx:1829
bool mbIsDeferredInit
Definition: syswin.hxx:82
bool isLayoutEnabled(const vcl::Window *pWindow)
Definition: layout.cxx:2841
OUString maNotebookBarUIFile
Definition: syswin.hxx:80
Size maMinOutSize
Definition: syswin.hxx:69
SAL_DLLPRIVATE bool hasPendingLayout() const
Definition: syswin.hxx:214
Definition: menu.hxx:118
WindowType
MenuBar * GetMenuBar() const
Definition: syswin.hxx:160
void SetRollUpOutputSizePixel(const Size &rSize)
Definition: syswin.hxx:148
bool mbDockBtn
Definition: syswin.hxx:71
MenuBarMode mnMenuBarMode
Definition: syswin.hxx:76
Size maRollUpOutSize
Definition: syswin.hxx:68
VclPtr< vcl::Window > mpDialogParent
Definition: syswin.hxx:83
sal_uInt16 GetIcon() const
Definition: syswin.hxx:136
bool mbHideBtn
Definition: syswin.hxx:72
Definition: timer.hxx:26
bool mbIsCalculatingInitialLayoutSize
Definition: syswin.hxx:74
Size maOrgSize
Definition: syswin.hxx:67
virtual void PostPaint(vcl::RenderContext &rRenderContext)
Definition: paint.cxx:1015
bool mbPaintComplete
Definition: syswin.hxx:75
This implements Widget Layout-based notebook-like menu bar.
Definition: notebookbar.hxx:27
bool mbSysChild
Definition: syswin.hxx:73
SAL_DLLPRIVATE void SetIdleDebugName(const char *pDebugName)
Definition: syswin.hxx:222
An idle is a timer to be scheduled immediately.
Definition: idle.hxx:30
TitleButton
Definition: syswin.hxx:51
MenuBarMode
Definition: syswin.hxx:46
bool mbRollUp
Definition: syswin.hxx:70