1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_SFX2_SOURCE_INC_WORKWIN_HXX
#define INCLUDED_SFX2_SOURCE_INC_WORKWIN_HXX
#include <vector>
#include <deque>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/ui/XUIElement.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/frame/XLayoutManagerListener.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/propshlp.hxx>
#include <rtl/ustring.hxx>
#include <osl/mutex.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <sfx2/sfx.hrc>
#include <sfx2/childwin.hxx>
#include <sfx2/shell.hxx>
#include <sfx2/ctrlitem.hxx>
#include <sfx2/viewfrm.hxx>
class SfxSplitWindow;
class SfxWorkWindow;
// This struct makes all relevant Information available of Toolboxes
struct SfxObjectBar_Impl
{
sal_uInt16 nId; // Resource - and ConfigId of Toolbox
sal_uInt16 nMode; // special visibility flags
sal_uInt16 nPos;
bool bDestroy;
SfxInterface* pIFace;
SfxObjectBar_Impl() :
nId(0),
nMode(0),
nPos(0),
bDestroy(false),
pIFace(nullptr)
{}
};
// This struct makes all relevant Information available of the status bar
struct SfxStatBar_Impl
{
sal_uInt16 nId;
SfxStatBar_Impl() :
nId(0)
{}
};
enum class SfxChildVisibility
{
NOT_VISIBLE = 0,
ACTIVE = 1, // not disabled through HidePopups
NOT_HIDDEN = 2, // not disabled through HideChildWindow
FITS_IN = 4, // not too large for output size of the parent
VISIBLE = 7, // NOT_HIDDEN | ACTIVE | FITS_IN)
};
namespace o3tl
{
template<> struct typed_flags<SfxChildVisibility> : is_typed_flags<SfxChildVisibility, 0x07> {};
}
struct SfxChild_Impl
{
VclPtr<vcl::Window> pWin;
Size aSize;
SfxChildAlignment eAlign;
SfxChildVisibility nVisible;
bool bResize;
bool bCanGetFocus;
bool bSetFocus;
SfxChild_Impl( vcl::Window& rChild, const Size& rSize,
SfxChildAlignment eAlignment, bool bIsVisible ):
pWin(&rChild), aSize(rSize), eAlign(eAlignment), bResize(false),
bCanGetFocus( false ), bSetFocus( false )
{
nVisible = bIsVisible ? SfxChildVisibility::VISIBLE : SfxChildVisibility::NOT_VISIBLE;
}
};
struct SfxChildWin_Impl
{
sal_uInt16 nSaveId; // the ChildWindow-Id
sal_uInt16 nInterfaceId; // the current context
sal_uInt16 nId; // current Id
SfxChildWindow* pWin;
bool bCreate;
SfxChildWinInfo aInfo;
SfxChild_Impl* pCli; // != 0 at direct Children
sal_uInt16 nVisibility;
bool bEnable;
SfxChildWin_Impl( sal_uInt32 nID ) :
nSaveId((sal_uInt16) (nID & 0xFFFF) ),
nInterfaceId((sal_uInt16) (nID >> 16)),
nId(nSaveId),
pWin(nullptr),
bCreate(false),
pCli(nullptr),
nVisibility( SFX_VISIBILITY_UNVISIBLE ),
bEnable( true )
{}
};
enum class SfxChildIdentifier
{
OBJECTBAR,
DOCKINGWINDOW,
SPLITWINDOW
};
enum class SfxDockingConfig
{
SETDOCKINGRECTS,
ALIGNDOCKINGWINDOW,
TOGGLEFLOATMODE,
MOVEDOCKINGWINDOW
};
#define SFX_SPLITWINDOWS_LEFT 0
#define SFX_SPLITWINDOWS_TOP 2
#define SFX_SPLITWINDOWS_RIGHT 1
#define SFX_SPLITWINDOWS_MAX 4
class LayoutManagerListener : public ::cppu::WeakImplHelper<
css::frame::XLayoutManagerListener,
css::lang::XComponent >
{
public:
LayoutManagerListener( SfxWorkWindow* pWrkWin );
virtual ~LayoutManagerListener() override;
void setFrame( const css::uno::Reference< css::frame::XFrame >& rFrame );
// XComponent
virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw (css::uno::RuntimeException, std::exception) override;
virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException, std::exception) override;
virtual void SAL_CALL dispose() throw( css::uno::RuntimeException, std::exception ) override;
// XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException, std::exception ) override;
// XLayoutManagerEventListener
virtual void SAL_CALL layoutEvent( const css::lang::EventObject& aSource, ::sal_Int16 eLayoutEvent, const css::uno::Any& aInfo ) throw (css::uno::RuntimeException, std::exception) override;
private:
bool m_bHasFrame;
SfxWorkWindow* m_pWrkWin;
css::uno::WeakReference< css::frame::XFrame > m_xFrame;
OUString m_aLayoutManagerPropName;
};
class SfxWorkWindow final
{
friend class LayoutManagerListener;
protected:
std::vector<sal_uInt16> aSortedList;
SfxStatBar_Impl aStatBar;
std::vector< SfxObjectBar_Impl > aObjBarList;
Rectangle aClientArea;
Rectangle aUpperClientArea;
SfxWorkWindow* pParent;
VclPtr<SfxSplitWindow> pSplit[SFX_SPLITWINDOWS_MAX];
std::vector<SfxChild_Impl*>
aChildren;
std::vector<SfxChildWin_Impl*>
aChildWins;
SfxBindings* pBindings;
VclPtr<vcl::Window> pWorkWin;
SfxShell* pConfigShell;
VclPtr<vcl::Window> pActiveChild;
sal_uInt16 nUpdateMode;
sal_uInt16 nChildren;
sal_uInt16 nOrigMode;
bool bSorted : 1;
bool bDockingAllowed : 1;
bool bInternalDockingAllowed : 1;
bool bAllChildrenVisible : 1;
bool bIsFullScreen : 1;
bool bShowStatusBar : 1;
sal_Int32 m_nLock;
OUString m_aStatusBarResName;
OUString m_aLayoutManagerPropName;
OUString m_aTbxTypeName;
OUString m_aProgressBarResName;
css::uno::Reference< css::lang::XComponent > m_xLayoutManagerListener;
SfxFrame* pMasterFrame;
SfxFrame* pFrame;
protected:
void CreateChildWin_Impl(SfxChildWin_Impl*,bool);
void RemoveChildWin_Impl(SfxChildWin_Impl*);
void Sort_Impl();
SfxChild_Impl* FindChild_Impl( const vcl::Window& rWindow ) const;
bool RequestTopToolSpacePixel_Impl( SvBorder aBorder );
Rectangle GetTopRect_Impl();
SvBorder Arrange_Impl();
void SaveStatus_Impl(SfxChildWindow*, const SfxChildWinInfo&);
static bool IsPluginMode( SfxObjectShell* pObjShell );
public:
SfxWorkWindow( vcl::Window* pWin, SfxFrame* pFrm, SfxFrame* pMaster );
~SfxWorkWindow();
SfxBindings& GetBindings()
{ return *pBindings; }
vcl::Window* GetWindow() const
{ return pWorkWin; }
Rectangle GetFreeArea( bool bAutoHide ) const;
void SetDockingAllowed(bool bSet)
{ bDockingAllowed = bSet; }
void SetInternalDockingAllowed(bool bSet)
{ bInternalDockingAllowed = bSet; }
bool IsDockingAllowed() const
{ return bDockingAllowed; }
bool IsInternalDockingAllowed() const
{ return bInternalDockingAllowed; }
SfxWorkWindow* GetParent_Impl() const
{ return pParent; }
// Methods for all Child windows
void DataChanged_Impl( const DataChangedEvent& rDCEvt );
void ReleaseChild_Impl( vcl::Window& rWindow );
SfxChild_Impl* RegisterChild_Impl( vcl::Window& rWindow, SfxChildAlignment eAlign, bool bCanGetFocus );
void ShowChildren_Impl();
void HideChildren_Impl();
bool PrepareClose_Impl();
void ArrangeChildren_Impl( bool bForce = true );
void DeleteControllers_Impl();
void HidePopups_Impl(bool bHide, bool bParent, sal_uInt16 nId=0);
void ConfigChild_Impl(SfxChildIdentifier,
SfxDockingConfig, sal_uInt16);
void MakeChildrenVisible_Impl( bool bVis );
void ArrangeAutoHideWindows( SfxSplitWindow *pSplit );
bool IsAutoHideMode( const SfxSplitWindow *pSplit );
void EndAutoShow_Impl( Point aPos );
void SetFullScreen_Impl( bool bSet ) { bIsFullScreen = bSet; }
// Methods for Objectbars
void UpdateObjectBars_Impl();
void UpdateObjectBars_Impl2();
void ResetObjectBars_Impl();
void SetObjectBar_Impl(sal_uInt16 nPos, sal_uInt32 nResId,
SfxInterface *pIFace);
bool KnowsObjectBar_Impl( sal_uInt16 nPos ) const;
bool IsVisible_Impl();
void MakeVisible_Impl( bool );
void Lock_Impl( bool );
// Methods for ChildWindows
void UpdateChildWindows_Impl();
void ResetChildWindows_Impl();
void SetChildWindowVisible_Impl( sal_uInt32, bool, sal_uInt16 );
void ToggleChildWindow_Impl(sal_uInt16,bool);
bool HasChildWindow_Impl(sal_uInt16);
bool KnowsChildWindow_Impl(sal_uInt16);
void ShowChildWindow_Impl(sal_uInt16, bool bVisible, bool bSetFocus);
void SetChildWindow_Impl(sal_uInt16, bool bOn, bool bSetFocus);
SfxChildWindow* GetChildWindow_Impl(sal_uInt16);
void InitializeChild_Impl(SfxChildWin_Impl*);
SfxSplitWindow* GetSplitWindow_Impl(SfxChildAlignment);
bool IsVisible_Impl( sal_uInt16 nMode ) const;
bool IsFloating( sal_uInt16 nId );
void SetActiveChild_Impl( vcl::Window *pChild );
const VclPtr<vcl::Window>& GetActiveChild_Impl() const { return pActiveChild; }
// Methods for StatusBar
void ResetStatusBar_Impl();
void SetStatusBar_Impl(sal_uInt32 nResId, SfxShell *pShell, SfxBindings& );
void UpdateStatusBar_Impl();
css::uno::Reference< css::task::XStatusIndicator > GetStatusIndicator();
css::uno::Reference< css::frame::XFrame > GetFrameInterface();
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|