LibreOffice Module sfx2 (master) 1
viewfrm.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_VIEWFRM_HXX
20#define INCLUDED_SFX2_VIEWFRM_HXX
21
22#include <memory>
23#include <sal/config.h>
24#include <sfx2/dllapi.h>
25#include <sal/types.h>
26#include <svl/lstner.hxx>
27#include <sfx2/frame.hxx>
28#include <sfx2/objsh.hxx>
29#include <sfx2/shell.hxx>
30#include <svl/poolitem.hxx>
31#include <vcl/svapp.hxx>
32
33namespace weld {
34 class Button;
35 class Window;
36}
37class SvBorder;
38class SfxDispatcher;
39class SfxBindings;
40class SfxProgress;
41class SfxViewShell;
42class Point;
43class Size;
44class SfxChildWindow;
46enum class InfobarType;
48
49class SFX2_DLLPUBLIC SfxViewFrame final : public SfxShell, public SfxListener
50{
51 std::unique_ptr<struct SfxViewFrame_Impl> m_pImpl;
52
54 std::unique_ptr<SfxDispatcher> m_pDispatcher;
59
60 std::unique_ptr<CommandPopupHandler> m_pCommandPopupHandler;
61
62 SAL_DLLPRIVATE void Construct_Impl( SfxObjectShell *pObjSh );
63 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
64 DECL_DLLPRIVATE_LINK(GetInvolvedHandler, weld::Button&, void);
65 DECL_DLLPRIVATE_LINK(DonationHandler, weld::Button&, void);
66 DECL_DLLPRIVATE_LINK(WhatsNewHandler, weld::Button&, void);
67 DECL_DLLPRIVATE_LINK(MacroButtonHandler, weld::Button&, void);
68 DECL_DLLPRIVATE_LINK(EventButtonHandler, weld::Button&, void);
69 DECL_DLLPRIVATE_LINK(SwitchReadOnlyHandler, weld::Button&, void);
70 DECL_DLLPRIVATE_LINK(SignDocumentHandler, weld::Button&, void);
71 DECL_DLLPRIVATE_LINK(HiddenTrackChangesHandler, weld::Button&, void);
72 DECL_DLLPRIVATE_LINK(HyphenationMissingHandler, weld::Button&, void);
73 DECL_DLLPRIVATE_LINK(RefreshMasterPasswordHdl, weld::Button&, void);
74 DECL_DLLPRIVATE_STATIC_LINK(SfxViewFrame, HelpMasterPasswordHdl, weld::Button&, void);
75 SAL_DLLPRIVATE void KillDispatcher_Impl();
76
77 virtual ~SfxViewFrame() override;
78
79public:
80 SfxViewFrame( SfxFrame& rFrame, SfxObjectShell *pDoc );
81
83
84private:
86 static void InitInterface_Impl();
87
88 void AppendContainsMacrosInfobar();
89public:
90
91 static void SetViewFrame( SfxViewFrame* );
92
93 static SfxViewFrame* LoadHiddenDocument( SfxObjectShell const & i_rDoc, SfxInterfaceId i_nViewId );
94 static SfxViewFrame* LoadDocument( SfxObjectShell const & i_rDoc, SfxInterfaceId i_nViewId );
95 static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell const & i_rDoc, const SfxFrameItem* i_pFrameItem, SfxInterfaceId i_nViewId );
96 static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell const & i_rDoc, const css::uno::Reference< css::frame::XFrame >& i_rFrameItem );
97 static SfxViewFrame* DisplayNewDocument( SfxObjectShell const & i_rDoc, const SfxRequest& i_rCreateDocRequest );
98
99 SAL_WARN_UNUSED_RESULT static SfxViewFrame* Current();
100 SAL_WARN_UNUSED_RESULT static SfxViewFrame* GetFirst( const SfxObjectShell* pDoc = nullptr, bool bOnlyVisible = true );
101 SAL_WARN_UNUSED_RESULT static SfxViewFrame* GetNext( const SfxViewFrame& rPrev, const SfxObjectShell* pDoc = nullptr, bool bOnlyVisible = true );
102
103 SAL_WARN_UNUSED_RESULT static SfxViewFrame* Get( const css::uno::Reference< css::frame::XController>& i_rController, const SfxObjectShell* i_pDoc );
104
105 void DoActivate(bool bMDI);
106 void DoDeactivate(bool bMDI, SfxViewFrame const *pOld);
107
109 SfxDispatcher* GetDispatcher() { return m_pDispatcher.get(); }
110 SfxBindings& GetBindings() { return *m_pBindings; }
111 const SfxBindings& GetBindings() const { return *m_pBindings; }
112 vcl::Window& GetWindow() const;
113 weld::Window* GetFrameWeld() const;
114
115 SfxProgress* GetProgress() const;
116
118 { m_nAdjustPosPixelLock++; }
120 { m_nAdjustPosPixelLock--; }
121 void DoAdjustPosSizePixel( SfxViewShell * pSh,
122 const Point &rPos, const Size &rSize,
123 bool inplaceEditModeChange );
124 void Show();
125 bool IsVisible() const;
126 void ToTop();
127 void Enable( bool bEnable );
128 void Close();
129 virtual void Activate( bool bUI ) override;
130 virtual void Deactivate( bool bUI ) override;
131
132 void UpdateTitle();
133
134 // interne Handler
135 SAL_DLLPRIVATE void SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder );
136 SAL_DLLPRIVATE const SvBorder& GetBorderPixelImpl() const;
137 SAL_DLLPRIVATE void InvalidateBorderImpl( const SfxViewShell *pSh );
138
139 virtual SfxObjectShell* GetObjectShell() override;
140 SfxInterfaceId GetCurViewId() const;
141 SfxFrame& GetFrame() const;
142 SfxViewFrame* GetTopViewFrame() const;
143
144 bool DoClose();
145 static void GetTargetList( TargetList& rList )
147
148 void SetModalMode( bool );
149 bool IsInModalMode() const;
150 void Resize(bool bForce=false);
151
152 void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true);
153 void ToggleChildWindow(sal_uInt16);
154 bool HasChildWindow(sal_uInt16);
155 bool KnowsChildWindow(sal_uInt16);
156 void ShowChildWindow(sal_uInt16,bool bVisible=true);
157 SfxChildWindow* GetChildWindow(sal_uInt16);
158 void ChildWindowExecute(SfxRequest&);
159 void ChildWindowState(SfxItemSet&);
160
166 VclPtr<SfxInfoBarWindow> AppendInfoBar(const OUString& sId,
167 const OUString& sPrimaryMessage,
168 const OUString& sSecondaryMessage,
169 InfobarType aInfobarType,
170 bool bShowCloseButton=true);
171 void RemoveInfoBar(std::u16string_view sId);
172 void UpdateInfoBar(std::u16string_view sId, const OUString& sPrimaryMessage,
173 const OUString& sSecondaryMessage,
174 InfobarType eType);
175 bool HasInfoBarWithID(std::u16string_view sId);
176 void AppendReadOnlyInfobar();
177
178 SAL_DLLPRIVATE void GetDocNumber_Impl();
179 SAL_DLLPRIVATE void SetViewShell_Impl( SfxViewShell *pVSh );
180 SAL_DLLPRIVATE void ReleaseObjectShell_Impl();
181
182 SAL_DLLPRIVATE void GetState_Impl( SfxItemSet &rSet );
183 void ExecReload_Impl(SfxRequest& rReq);
184 SAL_DLLPRIVATE void StateReload_Impl( SfxItemSet &rSet );
185 SAL_DLLPRIVATE void ExecView_Impl( SfxRequest &rReq );
186 SAL_DLLPRIVATE void StateView_Impl( SfxItemSet &rSet );
187 SAL_DLLPRIVATE void ExecHistory_Impl( SfxRequest &rReq );
188 SAL_DLLPRIVATE void StateHistory_Impl( SfxItemSet &rSet );
189 SAL_DLLPRIVATE void ForceOuterResize_Impl();
190 SAL_DLLPRIVATE void UpdateDocument_Impl();
191
192 SAL_DLLPRIVATE void LockObjectShell_Impl();
193
194 SAL_DLLPRIVATE void MakeActive_Impl( bool bActivate );
195 SAL_DLLPRIVATE const Size& GetMargin_Impl() const;
196 SAL_DLLPRIVATE OUString GetActualPresentationURL_Impl() const;
197 SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &);
198 SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &);
199 SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl();
200 SAL_DLLPRIVATE void AddDispatchMacroToBasic_Impl(const OUString& sMacro);
201
202 SAL_DLLPRIVATE void Exec_Impl(SfxRequest &);
203 SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &);
204 SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &);
205
206 SAL_DLLPRIVATE void SetCurViewId_Impl( const SfxInterfaceId i_nID );
207
208private:
209 SAL_DLLPRIVATE bool SwitchToViewShell_Impl( sal_uInt16 nNo, bool bIsIndex = false );
210 SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell );
211 SAL_DLLPRIVATE void SaveCurrentViewData_Impl( const SfxInterfaceId i_nNewViewId );
212
230 SAL_DLLPRIVATE static SfxViewShell* LoadViewIntoFrame_Impl(
231 const SfxObjectShell& i_rDoc,
232 const css::uno::Reference< css::frame::XFrame >& i_rFrame,
233 const css::uno::Sequence< css::beans::PropertyValue >& i_rLoadArgs,
234 const SfxInterfaceId i_nViewId,
235 const bool i_bHidden
236 );
237
253 SAL_DLLPRIVATE static SfxViewFrame* LoadViewIntoFrame_Impl_NoThrow(
254 const SfxObjectShell& i_rDoc,
255 const css::uno::Reference< css::frame::XFrame >& i_rFrame,
256 const SfxInterfaceId i_nViewId,
257 const bool i_bHidden
258 );
259};
260
261
263{
265
266public:
268 SfxPoolItem( 0 ),
269 pFrame( pViewFrame)
270 {}
271
272 virtual bool operator==( const SfxPoolItem& ) const override;
273 virtual SfxViewFrameItem* Clone( SfxItemPool *pPool = nullptr ) const override;
274
276 { return pFrame; }
277};
278
279#endif
280
281/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static void GetDefaultTargetList(TargetList &)
Definition: frame.cxx:356
Class representing a single InfoBar to be added in a SfxInfoBarContainerWindow.
Definition: infobar.hxx:61
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
The class SfxShell is the base class for all classes, which provide the functionality of the form <Sl...
Definition: shell.hxx:128
virtual void Activate(bool bMDI)
Virtual method that is called when enabling the SfxShell instance, in order to give the Subclasses th...
Definition: shell.cxx:360
SfxViewFrame * GetFrame() const
This method returns a pointer to the <SfxViewFrame> to which this SfxShell instance is associated or ...
Definition: shell.cxx:134
virtual void Deactivate(bool bMDI)
Virtual method that is called when disabling the SfxShell instance, to give the Subclasses the opport...
Definition: shell.cxx:377
void SetViewShell_Impl(SfxViewShell *pView)
Definition: shell.cxx:708
virtual SfxObjectShell * GetObjectShell()
Definition: shell.cxx:649
SfxDispatcher * GetDispatcher() const
This method returns a pointer to the <SfxDispatcher>, when the SfxShell is currently <UI-active> or a...
Definition: shell.cxx:124
SfxViewFrame * GetFrame() const
Definition: viewfrm.hxx:275
SfxViewFrame * pFrame
Definition: viewfrm.hxx:264
SfxViewFrameItem(SfxViewFrame *pViewFrame)
Definition: viewfrm.hxx:267
void LockAdjustPosSizePixel()
Definition: viewfrm.hxx:117
ImplSVHelpData * m_pHelpData
Definition: viewfrm.hxx:56
DECL_DLLPRIVATE_LINK(EventButtonHandler, weld::Button &, void)
static void GetTargetList(TargetList &rList)
Definition: viewfrm.hxx:145
DECL_DLLPRIVATE_LINK(DonationHandler, weld::Button &, void)
SfxBindings & GetBindings()
Definition: viewfrm.hxx:110
DECL_DLLPRIVATE_LINK(HiddenTrackChangesHandler, weld::Button &, void)
DECL_DLLPRIVATE_LINK(SignDocumentHandler, weld::Button &, void)
DECL_DLLPRIVATE_LINK(HyphenationMissingHandler, weld::Button &, void)
const SfxBindings & GetBindings() const
Definition: viewfrm.hxx:111
SfxDispatcher * GetDispatcher()
Definition: viewfrm.hxx:109
std::unique_ptr< CommandPopupHandler > m_pCommandPopupHandler
Definition: viewfrm.hxx:60
sal_uInt16 m_nAdjustPosPixelLock
Definition: viewfrm.hxx:58
DECL_DLLPRIVATE_LINK(MacroButtonHandler, weld::Button &, void)
SfxObjectShellRef m_xObjSh
Definition: viewfrm.hxx:53
SfxBindings * m_pBindings
Definition: viewfrm.hxx:55
std::unique_ptr< SfxDispatcher > m_pDispatcher
Definition: viewfrm.hxx:54
static SfxViewFrame * LoadDocumentIntoFrame(SfxObjectShell const &i_rDoc, const css::uno::Reference< css::frame::XFrame > &i_rFrameItem)
DECL_DLLPRIVATE_LINK(GetInvolvedHandler, weld::Button &, void)
DECL_DLLPRIVATE_LINK(SwitchReadOnlyHandler, weld::Button &, void)
ImplSVWinData * m_pWinData
Definition: viewfrm.hxx:57
DECL_DLLPRIVATE_LINK(RefreshMasterPasswordHdl, weld::Button &, void)
DECL_DLLPRIVATE_LINK(WhatsNewHandler, weld::Button &, void)
void UnlockAdjustPosSizePixel()
Definition: viewfrm.hxx:119
std::unique_ptr< struct SfxViewFrame_Impl > m_pImpl
Definition: viewfrm.hxx:51
DECL_DLLPRIVATE_STATIC_LINK(SfxViewFrame, HelpMasterPasswordHdl, weld::Button &, void)
One SfxViewShell more or less represents one edit window for a document, there can be multiple ones f...
Definition: viewsh.hxx:165
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
::std::vector< OUString > TargetList
InfobarType
Definition: infobar.hxx:22
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
Close
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
static SfxItemSet & rSet
Definition: shell.cxx:534
constexpr auto SFX_INTERFACE_SFXVIEWFRM
Definition: shell.hxx:64
#define SFX_DECL_INTERFACE(nId)
Definition: shell.hxx:532
#define SAL_WARN_UNUSED_RESULT
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)