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 <o3tl/typed_flags_set.hxx>
30 #include <memory>
32 
33 class MenuBar;
34 class NotebookBar;
35 class TaskPaneList;
36 
37 #define ICON_LO_DEFAULT 1
38 #define ICON_TEXT_DOCUMENT 2
39 #define ICON_SPREADSHEET_DOCUMENT 4
40 #define ICON_DRAWING_DOCUMENT 6
41 #define ICON_PRESENTATION_DOCUMENT 8
42 #define ICON_TEMPLATE 11
43 #define ICON_DATABASE_DOCUMENT 12
44 #define ICON_MATH_DOCUMENT 13
45 #define ICON_MACROLIBRARY 1
46 
47 enum class MenuBarMode
48 {
49  Normal, Hide
50 };
51 
52 enum class TitleButton
53 {
54  Docking = 1,
55  Hide = 2,
56  Menu = 4,
57 };
58 
60  : public vcl::Window
61  , public VclBuilderContainer
62 {
63  friend class WorkWindow;
64  class ImplData;
65 
66 private:
71  bool mbRollUp;
72  bool mbDockBtn;
73  bool mbHideBtn;
74  bool mbSysChild;
78  sal_uInt16 mnIcon;
79  std::unique_ptr<ImplData> mpImplData;
82 protected:
85 public:
87  SAL_DLLPRIVATE bool ImplIsInTaskPaneList( vcl::Window* pWin );
88  SAL_DLLPRIVATE bool isDeferredInit() const { return mbIsDeferredInit; }
89 
90 private:
91  SAL_DLLPRIVATE void ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, vcl::Window const * i_pConfigureWin );
92  SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox);
93  DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, Timer*, void );
94 
95  // try to extract content and return as Bitmap. To do that reliably, a Yield-loop
96  // like in Execute() has to be executed and it is necessary to detect when the
97  // paint is finished
98  virtual void PrePaint(vcl::RenderContext& rRenderContext) override;
99  virtual void PostPaint(vcl::RenderContext& rRenderContext) override;
100 
101  // ensureRepaint - triggers Application::Yield until the dialog is
102  // completely repainted. Sometimes needed for dialogs showing progress
103  // during actions
104  SAL_DLLPRIVATE void ensureRepaint();
105 
106 protected:
107  // Single argument ctors shall be explicit.
108  explicit SystemWindow(WindowType nType);
109  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 
111  void SetWindowStateData( const WindowStateData& rData );
112 
113  virtual void settingOptimalLayoutSize(Window *pBox);
114 
115  SAL_DLLPRIVATE void DoInitialLayout();
116 
117  SAL_DLLPRIVATE void SetIdleDebugName( const sal_Char *pDebugName );
118 
119 public:
120  virtual ~SystemWindow() override;
121  virtual void dispose() override;
122 
123  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
124  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
125 
126  virtual bool Close();
127  virtual void TitleButtonClick( TitleButton nButton );
128  virtual void Resizing( Size& rSize );
129  virtual void Resize() override;
130  virtual Size GetOptimalSize() const override;
131  virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
132  bool isLayoutEnabled() const;
133  void setOptimalLayoutSize();
134  bool isCalculatingInitialLayoutSize() const { return mbIsCalculatingInitialLayoutSize; }
135 
136  void SetIcon( sal_uInt16 nIcon );
137  sal_uInt16 GetIcon() const { return mnIcon; }
138  // for systems like MacOSX which can display the URL a document is loaded from
139  // separately from the window title
140  void SetRepresentedURL( const OUString& );
141 
142  void ShowTitleButton( TitleButton nButton, bool bVisible );
143  bool IsTitleButtonVisible( TitleButton nButton ) const;
144 
145  void RollUp();
146  void RollDown();
147  bool IsRollUp() const { return mbRollUp; }
148 
149  void SetRollUpOutputSizePixel( const Size& rSize ) { maRollUpOutSize = rSize; }
150  const Size& GetRollUpOutputSizePixel() const { return maRollUpOutSize; }
151 
152  void SetMinOutputSizePixel( const Size& rSize );
153  const Size& GetMinOutputSizePixel() const { return maMinOutSize; }
154  void SetMaxOutputSizePixel( const Size& rSize );
155  const Size& GetMaxOutputSizePixel() const;
156 
157  void SetWindowState(const OString& rStr);
158  OString GetWindowState(WindowStateMask nMask = WindowStateMask::All) const;
159 
160  void SetMenuBar(MenuBar* pMenuBar);
161  MenuBar* GetMenuBar() const { return mpMenuBar; }
162  void SetMenuBarMode( MenuBarMode nMode );
163 
164  void SetNotebookBar(const OUString& rUIXMLDescription,
165  const css::uno::Reference<css::frame::XFrame>& rFrame,
166  const NotebookBarAddonsItem& aNotebookBarAddonsItem,
167  bool bReloadNotebookbar = false);
168 
169  void CloseNotebookBar();
170  VclPtr<NotebookBar> const & GetNotebookBar() const;
171 
172  TaskPaneList* GetTaskPaneList();
173  void GetWindowStateData( WindowStateData& rData ) const;
174 
175  virtual void SetText( const OUString& rStr ) override;
176  virtual OUString GetText() const override;
177 
196  unsigned int GetScreenNumber() const;
208  void SetScreenNumber( unsigned int nNewScreen );
209 
210  void SetApplicationID( const OUString &rApplicationID );
211 
212  void SetCloseHdl(const Link<SystemWindow&,void>& rLink);
213  const Link<SystemWindow&,void>& GetCloseHdl() const;
214 
215  SAL_DLLPRIVATE bool hasPendingLayout() const { return maLayoutIdle.IsActive(); }
216 
217  virtual void doDeferredInit(WinBits nBits);
218 
219  // Screenshot interface
220  void createScreenshot(VirtualDevice& rOutput);
221 };
222 
223 inline void SystemWindow::SetIdleDebugName( const sal_Char *pDebugName )
224 {
225  maLayoutIdle.SetDebugName( pDebugName );
226 }
227 
228 #endif // INCLUDED_VCL_SYSWIN_HXX
229 
230 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SetText(const OUString &rStr)
Definition: window.cxx:3031
SAL_DLLPRIVATE bool isDeferredInit() const
Definition: syswin.hxx:88
SAL_DLLPRIVATE void ImplIsInTaskPaneList(bool mbIsInTaskList)
Definition: window.cxx:3625
DECL_DLLPRIVATE_LINK(ImplHandlePaintHdl, Timer *, void)
VclPtr< MenuBar > mpMenuBar
Definition: syswin.hxx:64
bool IsRollUp() const
Definition: syswin.hxx:147
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
virtual Size GetOptimalSize() const
Definition: window3.cxx:33
std::unique_ptr< ImplData > mpImplData
Definition: syswin.hxx:79
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: window.cxx:142
bool IsActive() const
Definition: task.hxx:90
StateChangedType
Definition: window.hxx:311
sal_Int64 WinBits
char sal_Char
WindowStateMask
Definition: vclenum.hxx:123
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1303
virtual OUString GetText() const
Definition: window.cxx:3060
Idle maLayoutIdle
Definition: syswin.hxx:80
const Size & GetMinOutputSizePixel() const
Definition: syswin.hxx:153
virtual void PrePaint(vcl::RenderContext &rRenderContext)
Definition: paint.cxx:1005
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:150
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
bool isCalculatingInitialLayoutSize() const
Definition: syswin.hxx:134
sal_uInt16 mnIcon
Definition: syswin.hxx:78
virtual void Resize()
Definition: window.cxx:1799
bool mbIsDeferredInit
Definition: syswin.hxx:83
bool isLayoutEnabled(const vcl::Window *pWindow)
Definition: layout.cxx:2641
OUString maNotebookBarUIFile
Definition: syswin.hxx:81
Size maMinOutSize
Definition: syswin.hxx:70
SAL_DLLPRIVATE bool hasPendingLayout() const
Definition: syswin.hxx:215
Definition: menu.hxx:121
WindowType
MenuBar * GetMenuBar() const
Definition: syswin.hxx:161
void SetRollUpOutputSizePixel(const Size &rSize)
Definition: syswin.hxx:149
bool mbDockBtn
Definition: syswin.hxx:72
MenuBarMode mnMenuBarMode
Definition: syswin.hxx:77
Size maRollUpOutSize
Definition: syswin.hxx:69
VclPtr< vcl::Window > mpDialogParent
Definition: syswin.hxx:84
sal_uInt16 GetIcon() const
Definition: syswin.hxx:137
bool mbHideBtn
Definition: syswin.hxx:73
Definition: timer.hxx:26
bool mbIsCalculatingInitialLayoutSize
Definition: syswin.hxx:75
Size maOrgSize
Definition: syswin.hxx:68
virtual void PostPaint(vcl::RenderContext &rRenderContext)
Definition: paint.cxx:1009
bool mbPaintComplete
Definition: syswin.hxx:76
SAL_DLLPRIVATE void SetIdleDebugName(const sal_Char *pDebugName)
Definition: syswin.hxx:223
This implements Widget Layout-based notebook-like menu bar.
Definition: notebookbar.hxx:25
bool mbSysChild
Definition: syswin.hxx:74
An idle is a timer to be scheduled immediately.
Definition: idle.hxx:30
void SetDebugName(const sal_Char *pDebugName)
Definition: task.hxx:81
TitleButton
Definition: syswin.hxx:52
MenuBarMode
Definition: syswin.hxx:47
bool mbRollUp
Definition: syswin.hxx:71