LibreOffice Module vcl (master) 1
brdwin.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_INC_BRDWIN_HXX
21#define INCLUDED_VCL_INC_BRDWIN_HXX
22
24#include <vcl/window.hxx>
27
28#include <com/sun/star/frame/XFrame.hpp>
29
31enum class DrawButtonFlags;
32
34 NONE = 0x0000,
35 Overlap = 0x0001,
36 Float = 0x0004,
37 Frame = 0x0008,
38 App = 0x0010
39};
40namespace o3tl {
41 template<> struct typed_flags<BorderWindowStyle> : is_typed_flags<BorderWindowStyle, 0x001d> {};
42};
43
45 NONE = 0x0000,
46 Title = 0x0001,
47 Left = 0x0002,
48 Menu = 0x0004,
49 Top = 0x0008,
50 Right = 0x0010,
51 Bottom = 0x0020,
52 TopLeft = 0x0040,
53 TopRight = 0x0080,
54 BottomLeft = 0x0100,
55 BottomRight = 0x0200,
56 Close = 0x0400,
57 Dock = 0x0800,
58 Hide = 0x1000,
59 Help = 0x2000,
60};
61namespace o3tl {
62 template<> struct typed_flags<BorderWindowHitTest> : is_typed_flags<BorderWindowHitTest, 0x3fff> {};
63};
64
66 Normal = 0x0001,
67 Small = 0x0002,
68 Tearoff = 0x0004,
69 Popup = 0x0008,
70 NONE = 0x0010
71};
72namespace o3tl {
73 template<> struct typed_flags<BorderWindowTitleType> : is_typed_flags<BorderWindowTitleType, 0x001f> {};
74};
75
76class ImplBorderWindow final : public vcl::Window
77{
78 friend class vcl::Window;
83
84private:
85 std::unique_ptr<ImplBorderWindowView> mpBorderView;
103
104 using Window::ImplInit;
105 void ImplInit( vcl::Window* pParent,
106 WinBits nStyle, BorderWindowStyle nTypeStyle,
107 SystemParentData* pParentData );
108
111
112public:
114 SystemParentData* pParentData,
115 WinBits nStyle,
116 BorderWindowStyle nTypeStyle );
117 ImplBorderWindow( vcl::Window* pParent, WinBits nStyle,
118 BorderWindowStyle nTypeStyle );
119 virtual ~ImplBorderWindow() override;
120 virtual void dispose() override;
121
122 virtual void MouseMove( const MouseEvent& rMEvt ) override;
123 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
124 virtual void Tracking( const TrackingEvent& rTEvt ) override;
125 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
126 virtual void Activate() override;
127 virtual void Deactivate() override;
128 virtual void Resize() override;
129 virtual void RequestHelp( const HelpEvent& rHEvt ) override;
130 virtual void StateChanged( StateChangedType nType ) override;
131 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
132 virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
133
134 void InitView();
135 void UpdateView( bool bNewView, const Size& rNewOutSize );
136 void InvalidateBorder();
137
138 using Window::Draw;
139 void Draw( OutputDevice* pDev, const Point& rPos );
140
141 void SetDisplayActive( bool bActive );
142 void SetTitleType( BorderWindowTitleType nTitleType, const Size& rSize );
143 void SetBorderStyle( WindowBorderStyle nStyle );
145 void SetCloseButton();
146 void SetDockButton( bool bDockButton );
147 void SetHideButton( bool bHideButton );
148 void SetMenuButton( bool bMenuButton );
149
150 void UpdateMenuHeight();
151 void SetMenuBarWindow( vcl::Window* pWindow );
152 void SetMenuBarMode( bool bHide );
153
154 void SetNotebookBar(const OUString& rUIXMLDescription,
155 const css::uno::Reference<css::frame::XFrame>& rFrame,
156 const NotebookBarAddonsItem &aNotebookBarAddonsItem);
157 void CloseNotebookBar();
159
161 { mnMinWidth = nWidth; mnMinHeight = nHeight; }
163 { mnMaxWidth = nWidth; mnMaxHeight = nHeight; }
164
165 void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
166 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
168
170
171 virtual Size GetOptimalSize() const override;
172};
173
175{
191 sal_Int32 mnLeftBorder;
192 sal_Int32 mnTopBorder;
193 sal_Int32 mnRightBorder;
194 sal_Int32 mnBottomBorder;
207};
208
210{
211public:
212 virtual ~ImplBorderWindowView();
213
214 virtual bool MouseMove( const MouseEvent& rMEvt );
215 virtual bool MouseButtonDown( const MouseEvent& rMEvt );
216 virtual bool Tracking( const TrackingEvent& rTEvt );
217 virtual OUString RequestHelp( const Point& rPos, tools::Rectangle& rHelpRect );
218
219 virtual void Init( OutputDevice* pDev, tools::Long nWidth, tools::Long nHeight ) = 0;
220 virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
221 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const = 0;
222 virtual tools::Long CalcTitleWidth() const = 0;
223 virtual void DrawWindow(vcl::RenderContext& rRenderContext, const Point* pOffset = nullptr) = 0;
224 virtual tools::Rectangle GetMenuRect() const;
225
226 static void ImplInitTitle( ImplBorderFrameData* pData );
227 static BorderWindowHitTest ImplHitTest( ImplBorderFrameData const * pData, const Point& rPos );
228 static void ImplMouseMove( ImplBorderFrameData* pData, const MouseEvent& rMEvt );
229 static OUString ImplRequestHelp( ImplBorderFrameData const * pData, const Point& rPos, tools::Rectangle& rHelpRect );
231};
232
234{
235public:
237
238 virtual void Init( OutputDevice* pDev, tools::Long nWidth, tools::Long nHeight ) override;
239 virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
240 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const override;
241 virtual tools::Long CalcTitleWidth() const override;
242 virtual void DrawWindow(vcl::RenderContext& rRenderContext, const Point* pOffset = nullptr) override;
243};
244
246{
251 sal_Int32 mnLeftBorder;
252 sal_Int32 mnTopBorder;
253 sal_Int32 mnRightBorder;
254 sal_Int32 mnBottomBorder;
256
257public:
259
260 virtual void Init( OutputDevice* pOutDev, tools::Long nWidth, tools::Long nHeight ) override;
261 virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
262 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const override;
263 virtual tools::Long CalcTitleWidth() const override;
264 virtual void DrawWindow(vcl::RenderContext& rRenderContext, const Point* pOffset = nullptr) override;
265};
266
268{
270
271public:
273 virtual ~ImplStdBorderWindowView() override;
274
275 virtual bool MouseMove( const MouseEvent& rMEvt ) override;
276 virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
277 virtual bool Tracking( const TrackingEvent& rTEvt ) override;
278 virtual OUString RequestHelp( const Point& rPos, tools::Rectangle& rHelpRect ) override;
279 virtual tools::Rectangle GetMenuRect() const override;
280
281 virtual void Init( OutputDevice* pDev, tools::Long nWidth, tools::Long nHeight ) override;
282 virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
283 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const override;
284 virtual tools::Long CalcTitleWidth() const override;
285 virtual void DrawWindow(vcl::RenderContext& rRenderContext, const Point* pOffset = nullptr) override;
286};
287
288#endif // INCLUDED_VCL_INC_BRDWIN_HXX
289
290/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BorderWindowHitTest
Definition: brdwin.hxx:44
BorderWindowTitleType
Definition: brdwin.hxx:65
BorderWindowStyle
Definition: brdwin.hxx:33
Definition: help.hxx:61
static void ImplInitTitle(ImplBorderFrameData *pData)
Definition: brdwin.cxx:139
virtual bool MouseButtonDown(const MouseEvent &rMEvt)
Definition: brdwin.cxx:119
static tools::Long ImplCalcTitleWidth(const ImplBorderFrameData *pData)
Definition: brdwin.cxx:337
static void ImplMouseMove(ImplBorderFrameData *pData, const MouseEvent &rMEvt)
Definition: brdwin.cxx:246
virtual bool MouseMove(const MouseEvent &rMEvt)
Definition: brdwin.cxx:114
virtual tools::Rectangle GetMenuRect() const
Definition: brdwin.cxx:134
virtual bool Tracking(const TrackingEvent &rTEvt)
Definition: brdwin.cxx:124
static OUString ImplRequestHelp(ImplBorderFrameData const *pData, const Point &rPos, tools::Rectangle &rHelpRect)
Definition: brdwin.cxx:287
virtual ~ImplBorderWindowView()
Definition: brdwin.cxx:110
virtual void DrawWindow(vcl::RenderContext &rRenderContext, const Point *pOffset=nullptr)=0
static BorderWindowHitTest ImplHitTest(ImplBorderFrameData const *pData, const Point &rPos)
Definition: brdwin.cxx:174
virtual void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const =0
virtual tools::Long CalcTitleWidth() const =0
virtual void Init(OutputDevice *pDev, tools::Long nWidth, tools::Long nHeight)=0
virtual OUString RequestHelp(const Point &rPos, tools::Rectangle &rHelpRect)
Definition: brdwin.cxx:129
BorderWindowTitleType mnTitleType
Definition: brdwin.hxx:93
void SetNotebookBar(const OUString &rUIXMLDescription, const css::uno::Reference< css::frame::XFrame > &rFrame, const NotebookBarAddonsItem &aNotebookBarAddonsItem)
Definition: brdwin.cxx:1944
bool mbFrameBorder
Definition: brdwin.hxx:97
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: brdwin.cxx:1613
ImplBorderWindow & operator=(const ImplBorderWindow &)=delete
void ImplInit(vcl::Window *pParent, WinBits nStyle, BorderWindowStyle nTypeStyle, SystemParentData *pParentData)
Definition: brdwin.cxx:1504
tools::Long CalcTitleWidth() const
Definition: brdwin.cxx:1975
void SetDockButton(bool bDockButton)
Definition: brdwin.cxx:1901
virtual ~ImplBorderWindow() override
Definition: brdwin.cxx:1594
std::unique_ptr< ImplBorderWindowView > mpBorderView
Definition: brdwin.hxx:85
void UpdateView(bool bNewView, const Size &rNewOutSize)
Definition: brdwin.cxx:1796
void SetMenuBarWindow(vcl::Window *pWindow)
Definition: brdwin.cxx:1930
void SetHideButton(bool bHideButton)
Definition: brdwin.cxx:1909
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: brdwin.cxx:1607
const VclPtr< NotebookBar > & GetNotebookBar() const
Definition: brdwin.hxx:158
void InvalidateBorder()
Definition: brdwin.cxx:1837
ImplBorderWindow(const ImplBorderWindow &)=delete
virtual void Activate() override
Definition: brdwin.cxx:1637
VclPtr< NotebookBar > mpNotebookBar
Definition: brdwin.hxx:87
void SetCloseButton()
Definition: brdwin.cxx:1893
bool mbSmallOutBorder
Definition: brdwin.hxx:96
void SetDisplayActive(bool bActive)
Definition: brdwin.cxx:1868
tools::Long mnMaxHeight
Definition: brdwin.hxx:91
VclPtr< vcl::Window > mpMenuBarWindow
Definition: brdwin.hxx:86
tools::Rectangle GetMenuRect() const
Definition: brdwin.cxx:1980
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout) override
Definition: brdwin.cxx:1993
void Draw(OutputDevice *pDev, const Point &rPos)
Definition: brdwin.cxx:1631
tools::Long mnMinWidth
Definition: brdwin.hxx:88
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: brdwin.cxx:1763
void SetMenuButton(bool bMenuButton)
Definition: brdwin.cxx:1917
bool mbDisplayActive
Definition: brdwin.hxx:102
virtual void Resize() override
Definition: brdwin.cxx:1676
WindowBorderStyle mnBorderStyle
Definition: brdwin.hxx:94
tools::Long mnMaxWidth
Definition: brdwin.hxx:90
void SetMaxOutputSize(tools::Long nWidth, tools::Long nHeight)
Definition: brdwin.hxx:162
virtual void RequestHelp(const HelpEvent &rHEvt) override
Definition: brdwin.cxx:1652
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: brdwin.cxx:1625
void UpdateMenuHeight()
Definition: brdwin.cxx:1925
bool mbFloatWindow
Definition: brdwin.hxx:95
tools::Long mnMinHeight
Definition: brdwin.hxx:89
void SetMenuBarMode(bool bHide)
Definition: brdwin.cxx:1938
void SetBorderStyle(WindowBorderStyle nStyle)
Definition: brdwin.cxx:1884
virtual void StateChanged(StateChangedType nType) override
Definition: brdwin.cxx:1751
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Definition: brdwin.cxx:1963
WindowBorderStyle GetBorderStyle() const
Definition: brdwin.hxx:144
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: brdwin.cxx:1599
void SetTitleType(BorderWindowTitleType nTitleType, const Size &rSize)
Definition: brdwin.cxx:1878
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: brdwin.cxx:1619
void CloseNotebookBar()
Definition: brdwin.cxx:1955
virtual void Deactivate() override
Definition: brdwin.cxx:1643
tools::Long mnOrgMenuHeight
Definition: brdwin.hxx:92
void SetMinOutputSize(tools::Long nWidth, tools::Long nHeight)
Definition: brdwin.hxx:160
virtual Size GetOptimalSize() const override
Definition: brdwin.cxx:1985
virtual void Init(OutputDevice *pDev, tools::Long nWidth, tools::Long nHeight) override
Definition: brdwin.cxx:359
virtual void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const override
Definition: brdwin.cxx:363
virtual void DrawWindow(vcl::RenderContext &rRenderContext, const Point *pOffset=nullptr) override
Definition: brdwin.cxx:377
virtual tools::Long CalcTitleWidth() const override
Definition: brdwin.cxx:372
virtual void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const override
Definition: brdwin.cxx:570
VclPtr< ImplBorderWindow > mpBorderWindow
Definition: brdwin.hxx:247
virtual void Init(OutputDevice *pOutDev, tools::Long nWidth, tools::Long nHeight) override
Definition: brdwin.cxx:394
ImplSmallBorderWindowView(ImplBorderWindow *pBorderWindow)
Definition: brdwin.cxx:381
virtual void DrawWindow(vcl::RenderContext &rRenderContext, const Point *pOffset=nullptr) override
Definition: brdwin.cxx:584
VclPtr< OutputDevice > mpOutDev
Definition: brdwin.hxx:248
virtual tools::Long CalcTitleWidth() const override
Definition: brdwin.cxx:579
virtual tools::Rectangle GetMenuRect() const override
Definition: brdwin.cxx:1225
virtual ~ImplStdBorderWindowView() override
Definition: brdwin.cxx:757
virtual void Init(OutputDevice *pDev, tools::Long nWidth, tools::Long nHeight) override
Definition: brdwin.cxx:1230
virtual tools::Long CalcTitleWidth() const override
Definition: brdwin.cxx:1345
virtual void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const override
Definition: brdwin.cxx:1336
virtual OUString RequestHelp(const Point &rPos, tools::Rectangle &rHelpRect) override
Definition: brdwin.cxx:1220
ImplStdBorderWindowView(ImplBorderWindow *pBorderWindow)
Definition: brdwin.cxx:744
virtual bool Tracking(const TrackingEvent &rTEvt) override
Definition: brdwin.cxx:869
virtual bool MouseMove(const MouseEvent &rMEvt) override
Definition: brdwin.cxx:761
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: brdwin.cxx:767
virtual void DrawWindow(vcl::RenderContext &rRenderContext, const Point *pOffset=nullptr) override
Definition: brdwin.cxx:1350
ImplBorderFrameData maFrameData
Definition: brdwin.hxx:269
Definition: menu.hxx:116
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:171
DrawButtonFlags
Definition: decoview.hxx:54
NONE
Title
long Long
sal_Int32 mnRightBorder
Definition: brdwin.hxx:193
DrawButtonFlags mnMenuState
Definition: brdwin.hxx:201
tools::Long mnTrackY
Definition: brdwin.hxx:188
tools::Rectangle maHelpRect
Definition: brdwin.hxx:183
BorderWindowHitTest mnHitTest
Definition: brdwin.hxx:198
DrawButtonFlags mnCloseState
Definition: brdwin.hxx:199
tools::Long mnNoTitleTop
Definition: brdwin.hxx:195
tools::Rectangle maTitleRect
Definition: brdwin.hxx:178
tools::Long mnTrackHeight
Definition: brdwin.hxx:190
DrawButtonFlags mnHideState
Definition: brdwin.hxx:202
BorderWindowTitleType mnTitleType
Definition: brdwin.hxx:204
sal_Int32 mnTopBorder
Definition: brdwin.hxx:192
sal_Int32 mnBottomBorder
Definition: brdwin.hxx:194
tools::Long mnTitleHeight
Definition: brdwin.hxx:197
DrawButtonFlags mnDockState
Definition: brdwin.hxx:200
tools::Long mnTrackWidth
Definition: brdwin.hxx:189
tools::Long mnTrackX
Definition: brdwin.hxx:187
tools::Long mnHeight
Definition: brdwin.hxx:186
sal_Int32 mnLeftBorder
Definition: brdwin.hxx:191
tools::Long mnBorderSize
Definition: brdwin.hxx:196
VclPtr< ImplBorderWindow > mpBorderWindow
Definition: brdwin.hxx:176
VclPtr< OutputDevice > mpOutDev
Definition: brdwin.hxx:177
tools::Rectangle maHideRect
Definition: brdwin.hxx:182
tools::Rectangle maCloseRect
Definition: brdwin.hxx:179
tools::Long mnWidth
Definition: brdwin.hxx:185
tools::Rectangle maDockRect
Definition: brdwin.hxx:180
DrawButtonFlags mnHelpState
Definition: brdwin.hxx:203
tools::Rectangle maMenuRect
Definition: brdwin.hxx:181
Left
Right
WindowBorderStyle
Definition: vclenum.hxx:107
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109