LibreOffice Module sfx2 (master) 1
workwin.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#ifndef INCLUDED_SFX2_SOURCE_INC_WORKWIN_HXX
20#define INCLUDED_SFX2_SOURCE_INC_WORKWIN_HXX
21
22#include <utility>
23#include <vector>
24#include <com/sun/star/frame/XFrame.hpp>
25#include <com/sun/star/task/XStatusIndicator.hpp>
26#include <com/sun/star/frame/XLayoutManagerListener.hpp>
29
31
32#include <sfx2/basedlgs.hxx>
33#include <sfx2/childwin.hxx>
34#include <sfx2/frame.hxx>
35#include <sfx2/objface.hxx>
36#include <sfx2/shell.hxx>
37#include <sfx2/toolbarids.hxx>
38
39class SfxSplitWindow;
40class SfxWorkWindow;
41
42
43// This struct makes all relevant Information available of Toolboxes
45{
46 ToolbarId eId; // ConfigId of Toolbox
47 SfxVisibilityFlags nMode; // special visibility flags
49
53 bDestroy(false)
54 {}
55};
56
57// This struct makes all relevant Information available of the status bar
58
60{
62
65 {}
66};
67
69{
70 NOT_VISIBLE = 0,
71 ACTIVE = 1, // not disabled through HidePopups
72 NOT_HIDDEN = 2, // not disabled through HideChildWindow
73 FITS_IN = 4, // not too large for output size of the parent
74 VISIBLE = 7, // NOT_HIDDEN | ACTIVE | FITS_IN)
75};
76namespace o3tl
77{
78 template<> struct typed_flags<SfxChildVisibility> : is_typed_flags<SfxChildVisibility, 0x07> {};
79}
80
81
83{
85 std::shared_ptr<SfxDialogController> xController;
89 bool bResize;
91
92 SfxChild_Impl( vcl::Window& rChild, const Size& rSize,
93 SfxChildAlignment eAlignment, bool bIsVisible ):
94 pWin(&rChild), aSize(rSize), eAlign(eAlignment), bResize(false),
95 bSetFocus( false )
96 {
98 }
99
100 SfxChild_Impl(std::shared_ptr<SfxDialogController> xChild,
101 SfxChildAlignment eAlignment):
102 pWin(nullptr), xController(std::move(xChild)), eAlign(eAlignment), bResize(false),
103 bSetFocus( false )
104 {
106 }
107};
108
110{
111 sal_uInt16 nSaveId; // the ChildWindow-Id
112 sal_uInt16 nId; // current Id
116 SfxChild_Impl* pCli; // != 0 at direct Children
119
120 SfxChildWin_Impl( sal_uInt32 nID ) :
121 nSaveId(static_cast<sal_uInt16>(nID & 0xFFFF) ),
122 nId(nSaveId),
123 pWin(nullptr),
124 bCreate(false),
125 pCli(nullptr),
127 bEnable( true )
128 {}
129};
130
132{
135};
136
138{
142};
143
144
145#define SFX_SPLITWINDOWS_LEFT 0
146#define SFX_SPLITWINDOWS_TOP 2
147#define SFX_SPLITWINDOWS_RIGHT 1
148#define SFX_SPLITWINDOWS_MAX 4
149
150
151class LayoutManagerListener final : public ::cppu::WeakImplHelper<
152 css::frame::XLayoutManagerListener,
153 css::lang::XComponent >
154{
155 public:
157 virtual ~LayoutManagerListener() override;
158
159 void setFrame( const css::uno::Reference< css::frame::XFrame >& rFrame );
160
161
162 // XComponent
163
164 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
165 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
166 virtual void SAL_CALL dispose() override;
167
168
169 // XEventListener
170
171 virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) override;
172
173
174 // XLayoutManagerEventListener
175
176 virtual void SAL_CALL layoutEvent( const css::lang::EventObject& aSource, ::sal_Int16 eLayoutEvent, const css::uno::Any& aInfo ) override;
177
178 private:
181 css::uno::WeakReference< css::frame::XFrame > m_xFrame;
182};
183
184class SfxWorkWindow final
185{
187
188 std::vector<sal_uInt16> aSortedList;
190 std::vector< SfxObjectBar_Impl > aObjBarList;
194 std::vector<std::unique_ptr<SfxChild_Impl>>
196 std::vector<std::unique_ptr<SfxChildWin_Impl>>
202 sal_uInt16 nChildren;
204 bool bSorted : 1;
210 sal_Int32 m_nLock;
211 css::uno::Reference< css::lang::XComponent > m_xLayoutManagerListener;
214
217 void Sort_Impl();
218 SfxChild_Impl* FindChild_Impl( const vcl::Window* rWindow ) const;
223 static bool IsPluginMode( SfxObjectShell const * pObjShell );
224
226
227public:
228 SfxWorkWindow( vcl::Window* pWin, SfxFrame* pFrm, SfxFrame* pMaster );
231 { return *pBindings; }
233 { return pWorkWin; }
234 tools::Rectangle GetFreeArea( bool bAutoHide ) const;
235 void SetDockingAllowed(bool bSet)
236 { bDockingAllowed = bSet; }
238 { bInternalDockingAllowed = bSet; }
239 bool IsDockingAllowed() const
240 { return bDockingAllowed; }
242 { return bInternalDockingAllowed; }
243
244 // Methods for all Child windows
245 void DataChanged_Impl();
246 void ReleaseChild_Impl( vcl::Window& rWindow );
249 SfxChild_Impl* RegisterChild_Impl(std::shared_ptr<SfxDialogController>& rController, SfxChildAlignment eAlign);
250 void ShowChildren_Impl();
251 void HideChildren_Impl();
252 bool PrepareClose_Impl();
253 void ArrangeChildren_Impl( bool bForce = true );
255 void HidePopups_Impl(bool bHide, sal_uInt16 nId=0);
257 SfxDockingConfig, sal_uInt16);
258 void MakeChildrenVisible_Impl( bool bVis );
260 bool IsAutoHideMode( const SfxSplitWindow *pSplit );
261 void EndAutoShow_Impl( Point aPos );
262 void SetFullScreen_Impl( bool bSet ) { bIsFullScreen = bSet; }
263
264 // Methods for Objectbars
268 void SetObjectBar_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFlags, ToolbarId eId);
269 bool IsVisible_Impl() const;
270 void MakeVisible_Impl( bool );
271 void Lock_Impl( bool );
272
273 // Methods for ChildWindows
276 void SetChildWindowVisible_Impl( sal_uInt32, bool, SfxVisibilityFlags );
277 void ToggleChildWindow_Impl(sal_uInt16,bool);
278 bool HasChildWindow_Impl(sal_uInt16);
279 bool KnowsChildWindow_Impl(sal_uInt16);
280 void ShowChildWindow_Impl(sal_uInt16, bool bVisible, bool bSetFocus);
281 void SetChildWindow_Impl(sal_uInt16, bool bOn, bool bSetFocus);
285
286 bool IsVisible_Impl( SfxVisibilityFlags nMode ) const;
287 bool IsFloating( sal_uInt16 nId );
288 void SetActiveChild_Impl( vcl::Window *pChild );
290
291 // Methods for StatusBar
292 void ResetStatusBar_Impl();
293 void SetStatusBar_Impl(StatusBarId eResId);
295 css::uno::Reference< css::task::XStatusIndicator > GetStatusIndicator();
296 css::uno::Reference< css::frame::XFrame > GetFrameInterface();
297};
298
299#endif
300
301/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AnyEventRef aEvent
SfxChildAlignment
Definition: chalign.hxx:27
SfxWorkWindow * m_pWrkWin
Definition: workwin.hxx:180
void setFrame(const css::uno::Reference< css::frame::XFrame > &rFrame)
Definition: workwin.cxx:144
virtual void SAL_CALL layoutEvent(const css::lang::EventObject &aSource, ::sal_Int16 eLayoutEvent, const css::uno::Any &aInfo) override
Definition: workwin.cxx:260
virtual void SAL_CALL dispose() override
Definition: workwin.cxx:204
virtual void SAL_CALL disposing(const css::lang::EventObject &aEvent) override
Definition: workwin.cxx:248
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: workwin.cxx:192
virtual ~LayoutManagerListener() override
Definition: workwin.cxx:140
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: workwin.cxx:198
LayoutManagerListener(SfxWorkWindow *pWrkWin)
Definition: workwin.cxx:133
css::uno::WeakReference< css::frame::XFrame > m_xFrame
Definition: workwin.hxx:181
SfxStatBar_Impl aStatBar
Definition: workwin.hxx:189
std::vector< SfxObjectBar_Impl > aObjBarList
Definition: workwin.hxx:190
std::vector< std::unique_ptr< SfxChildWin_Impl > > aChildWins
Definition: workwin.hxx:197
tools::Rectangle aUpperClientArea
Definition: workwin.hxx:192
SfxWorkWindow(vcl::Window *pWin, SfxFrame *pFrm, SfxFrame *pMaster)
Definition: workwin.cxx:445
void ArrangeChildren_Impl(bool bForce=true)
Definition: workwin.cxx:654
void MakeVisible_Impl(bool)
Definition: workwin.cxx:1482
void UpdateObjectBars_Impl()
Definition: workwin.cxx:1091
vcl::Window * GetWindow() const
Definition: workwin.hxx:232
void ResetObjectBars_Impl()
Definition: workwin.cxx:1045
SfxSplitWindow * GetSplitWindow_Impl(SfxChildAlignment)
Definition: workwin.cxx:2193
bool bShowStatusBar
Definition: workwin.hxx:209
void UpdateObjectBars_Impl2()
Definition: workwin.cxx:1164
void SetActiveChild_Impl(vcl::Window *pChild)
Definition: workwin.cxx:2424
void HidePopups_Impl(bool bHide, sal_uInt16 nId=0)
Definition: workwin.cxx:1499
bool PrepareClose_Impl()
Definition: workwin.cxx:863
bool IsFloating(sal_uInt16 nId)
Definition: workwin.cxx:1901
bool bDockingAllowed
Definition: workwin.hxx:205
void ReleaseChild_Impl(vcl::Window &rWindow)
Definition: workwin.cxx:909
void ConfigChild_Impl(SfxChildIdentifier, SfxDockingConfig, sal_uInt16)
Definition: workwin.cxx:1533
bool HasChildWindow_Impl(sal_uInt16)
Definition: workwin.cxx:1883
void DataChanged_Impl()
Definition: workwin.cxx:2429
bool IsDockingAllowed() const
Definition: workwin.hxx:239
void EndAutoShow_Impl(Point aPos)
Definition: workwin.cxx:2251
void SetStatusBar_Impl(StatusBarId eResId)
Definition: workwin.cxx:1449
SfxBindings & GetBindings()
Definition: workwin.hxx:230
void MakeChildrenVisible_Impl(bool bVis)
Definition: workwin.cxx:2214
SfxChild_Impl * RegisterChild_Impl(vcl::Window &rWindow, SfxChildAlignment eAlign)
Definition: workwin.cxx:875
bool IsVisible_Impl() const
Definition: workwin.cxx:1493
void CreateChildWin_Impl(SfxChildWin_Impl *, bool)
Definition: workwin.cxx:1346
void HideChildren_Impl()
Definition: workwin.cxx:1031
VclPtr< vcl::Window > pWorkWin
Definition: workwin.hxx:199
void RemoveChildWin_Impl(SfxChildWin_Impl *)
Definition: workwin.cxx:1408
const VclPtr< vcl::Window > & GetActiveChild_Impl() const
Definition: workwin.hxx:289
void ResetChildWindows_Impl()
Definition: workwin.cxx:2089
bool KnowsChildWindow_Impl(sal_uInt16)
Definition: workwin.cxx:1937
void ShowChildren_Impl()
Definition: workwin.cxx:961
std::vector< sal_uInt16 > aSortedList
Definition: workwin.hxx:188
void SetObjectBar_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFlags, ToolbarId eId)
Definition: workwin.cxx:1054
void SetChildWindow_Impl(sal_uInt16, bool bOn, bool bSetFocus)
Definition: workwin.cxx:1960
sal_uInt16 nChildren
Definition: workwin.hxx:202
css::uno::Reference< css::task::XStatusIndicator > GetStatusIndicator()
Definition: workwin.cxx:1107
SvBorder Arrange_Impl()
Definition: workwin.cxx:704
SfxChild_Impl * FindChild_Impl(const vcl::Window *rWindow) const
Definition: workwin.cxx:947
bool bInternalDockingAllowed
Definition: workwin.hxx:206
bool bIsFullScreen
Definition: workwin.hxx:208
void SetChildWindowVisible_Impl(sal_uInt32, bool, SfxVisibilityFlags)
Definition: workwin.cxx:1752
css::uno::Reference< css::frame::XFrame > GetFrameInterface()
Definition: workwin.cxx:1148
VclPtr< vcl::Window > pActiveChild
Definition: workwin.hxx:200
void SaveStatus_Impl(SfxChildWindow *, const SfxChildWinInfo &)
Definition: workwin.cxx:2117
tools::Rectangle GetTopRect_Impl() const
Definition: workwin.cxx:2101
bool IsAutoHideMode(const SfxSplitWindow *pSplit)
Definition: workwin.cxx:2240
SfxFrame * pFrame
Definition: workwin.hxx:213
tools::Rectangle GetFreeArea(bool bAutoHide) const
Definition: workwin.cxx:2390
SfxVisibilityFlags nUpdateMode
Definition: workwin.hxx:201
css::uno::Reference< css::lang::XComponent > m_xLayoutManagerListener
Definition: workwin.hxx:211
void InitializeChild_Impl(SfxChildWin_Impl *)
Definition: workwin.cxx:2124
tools::Rectangle aClientArea
Definition: workwin.hxx:191
SfxBindings * pBindings
Definition: workwin.hxx:198
void ShowChildWindow_Impl(sal_uInt16, bool bVisible, bool bSetFocus)
Definition: workwin.cxx:1994
bool RequestTopToolSpacePixel_Impl(SvBorder aBorder)
Definition: workwin.cxx:2110
VclPtr< SfxSplitWindow > pSplit[SFX_SPLITWINDOWS_MAX]
Definition: workwin.hxx:193
void Lock_Impl(bool)
Definition: workwin.cxx:533
bool IsInternalDockingAllowed() const
Definition: workwin.hxx:241
void ResetStatusBar_Impl()
Definition: workwin.cxx:1444
void UpdateStatusBar_Impl()
Definition: workwin.cxx:1455
void SetDockingAllowed(bool bSet)
Definition: workwin.hxx:235
bool bAllChildrenVisible
Definition: workwin.hxx:207
void UpdateChildWindows_Impl()
Definition: workwin.cxx:1258
std::vector< std::unique_ptr< SfxChild_Impl > > aChildren
Definition: workwin.hxx:195
void DeleteControllers_Impl()
Definition: workwin.cxx:556
sal_Int32 m_nLock
Definition: workwin.hxx:210
SfxChildWindow * GetChildWindow_Impl(sal_uInt16)
Definition: workwin.cxx:2075
void ArrangeAutoHideWindows(SfxSplitWindow *pSplit)
Definition: workwin.cxx:2265
void SetFullScreen_Impl(bool bSet)
Definition: workwin.hxx:262
static bool IsPluginMode(SfxObjectShell const *pObjShell)
Definition: workwin.cxx:1135
void SetInternalDockingAllowed(bool bSet)
Definition: workwin.hxx:237
SfxFrame * pMasterFrame
Definition: workwin.hxx:212
void ToggleChildWindow_Impl(sal_uInt16, bool)
Definition: workwin.cxx:1788
SfxVisibilityFlags nOrigMode
Definition: workwin.hxx:203
void Sort_Impl()
Definition: workwin.cxx:419
void FlushPendingChildSizes()
Definition: workwin.cxx:689
sal_uInt16 nPos
Definition: linksrc.cxx:118
VISIBLE
None
NOT_VISIBLE
Invisible
StatusBarId
Definition: objface.hxx:45
SfxVisibilityFlags
Definition: shell.hxx:573
SfxVisibilityFlags nVisibility
Definition: workwin.hxx:117
sal_uInt16 nSaveId
Definition: workwin.hxx:111
SfxChild_Impl * pCli
Definition: workwin.hxx:116
SfxChildWinInfo aInfo
Definition: workwin.hxx:115
SfxChildWindow * pWin
Definition: workwin.hxx:113
SfxChildWin_Impl(sal_uInt32 nID)
Definition: workwin.hxx:120
sal_uInt16 nId
Definition: workwin.hxx:112
bool bResize
Definition: workwin.hxx:89
SfxChild_Impl(std::shared_ptr< SfxDialogController > xChild, SfxChildAlignment eAlignment)
Definition: workwin.hxx:100
SfxChildAlignment eAlign
Definition: workwin.hxx:87
std::shared_ptr< SfxDialogController > xController
Definition: workwin.hxx:85
SfxChild_Impl(vcl::Window &rChild, const Size &rSize, SfxChildAlignment eAlignment, bool bIsVisible)
Definition: workwin.hxx:92
VclPtr< vcl::Window > pWin
Definition: workwin.hxx:84
SfxChildVisibility nVisible
Definition: workwin.hxx:88
bool bSetFocus
Definition: workwin.hxx:90
ToolbarId eId
Definition: workwin.hxx:46
SfxVisibilityFlags nMode
Definition: workwin.hxx:47
StatusBarId eId
Definition: workwin.hxx:61
ToolbarId
Definition: toolbarids.hxx:18
#define SFX_SPLITWINDOWS_MAX
Definition: workwin.hxx:148
SfxDockingConfig
Definition: workwin.hxx:138
SfxChildVisibility
Definition: workwin.hxx:69
SfxChildIdentifier
Definition: workwin.hxx:132