LibreOffice Module sfx2 (master) 1
dispatch.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_DISPATCH_HXX
20#define INCLUDED_SFX2_DISPATCH_HXX
21
22#include <memory>
23#include <sal/config.h>
24#include <rtl/ref.hxx>
25#include <sfx2/dllapi.h>
26#include <sfx2/toolbarids.hxx>
27#include <sal/types.h>
28
29#include <sfx2/bindings.hxx>
31#include <o3tl/span.hxx>
32
33#include <boost/property_tree/ptree_fwd.hpp>
34#include <initializer_list>
35
36class SfxSlotServer;
37class SfxRequest;
38class SfxViewFrame;
39class SfxItemSet;
40class SfxModule;
41class Point;
43class VCLXPopupMenu;
44
45namespace com::sun::star::awt { class XPopupMenu; }
46namespace vcl { class Window; }
47
49{
50 NONE = 0,
51 POP_UNTIL = 4,
52 POP_DELETE = 2,
53 PUSH = 1,
54};
55namespace o3tl
56{
57 template<> struct typed_flags<SfxDispatcherPopFlags> : is_typed_flags<SfxDispatcherPopFlags, 0x07> {};
58}
59
61{
63 ENABLED,
64 // enabled even if ReadOnlyDoc
66};
67
68
70{
71 std::unique_ptr<SfxDispatcher_Impl> xImp;
72
73 // Search for temporary evaluated Todos
74 SAL_DLLPRIVATE bool CheckVirtualStack( const SfxShell& rShell );
75
76friend class SfxApplication;
77friend class SfxViewFrame;
78friend class SfxBindings;
79friend class SfxStateCache;
80friend class SfxPopupMenuManager;
81friend class SfxHelp;
82
83 DECL_DLLPRIVATE_LINK( EventHdl_Impl, Timer *, void );
84 void PostMsgHandler(std::unique_ptr<SfxRequest>);
85
86 SAL_DLLPRIVATE void Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest &rReq, bool bRecord );
87 SAL_DLLPRIVATE void Update_Impl_( bool,bool,bool,SfxWorkWindow*);
88
89
90 bool FindServer_( sal_uInt16 nId, SfxSlotServer &rServer );
91 bool FillState_( const SfxSlotServer &rServer,
92 SfxItemSet &rState, const SfxSlot *pRealSlot );
93 void Execute_( SfxShell &rShell, const SfxSlot &rSlot,
94 SfxRequest &rReq,
95 SfxCallMode eCall);
96
97 void FlushImpl();
98
99public:
101 SfxDispatcher( SfxViewFrame *pFrame );
102
103 SAL_DLLPRIVATE void Construct_Impl();
104
106
107 const SfxPoolItem* Execute( sal_uInt16 nSlot,
109 const SfxPoolItem **pArgs = nullptr,
110 sal_uInt16 nModi = 0,
111 const SfxPoolItem **pInternalArgs = nullptr);
112
113 const SfxPoolItem* Execute(sal_uInt16 nSlot,
114 SfxCallMode nCall,
115 SfxItemSet const * pArgs,
116 SfxItemSet const * pInternalArgs,
117 sal_uInt16 nModi);
118
119 const SfxPoolItem* ExecuteList(sal_uInt16 nSlot,
120 SfxCallMode nCall,
121 std::initializer_list<SfxPoolItem const*> args,
122 std::initializer_list<SfxPoolItem const*> internalargs = std::initializer_list<SfxPoolItem const*>());
123
124 const SfxPoolItem* Execute( sal_uInt16 nSlot,
125 SfxCallMode nCall,
126 const SfxItemSet &rArgs );
127
128 const SfxSlot* GetSlot( const OUString& rCommand );
129
130 bool IsActive( const SfxShell& rShell );
131 sal_uInt16 GetShellLevel( const SfxShell &rShell );
132 SfxBindings* GetBindings() const;
133
134 void Push( SfxShell& rShell );
136
137 SfxShell* GetShell(sal_uInt16 nIdx) const;
138 SfxViewFrame* GetFrame() const;
139 SfxModule* GetModule() const;
140
141 void ExecutePopup( const OUString &rResName, vcl::Window *pWin = nullptr, const Point *pPos = nullptr );
142 static void ExecutePopup( vcl::Window *pWin = nullptr, const Point *pPosPixel = nullptr );
143
144 bool IsAppDispatcher() const;
145 bool IsFlushed() const;
146 void Flush();
147 void Lock( bool bLock );
148 bool IsLocked() const;
149 void SetSlotFilter( SfxSlotFilterState nEnable = SfxSlotFilterState::DISABLED,
151
152 void HideUI( bool bHide = true );
153 ToolbarId GetObjectBarId( sal_uInt16 nPos ) const;
154
155 SfxItemState QueryState( sal_uInt16 nSID, const SfxPoolItem* &rpState );
156 template<class T>
157 SfxItemState QueryState( TypedWhichId<T> nSID, const T* &rpState )
158 {
159 return QueryState(sal_uInt16(nSID), reinterpret_cast<SfxPoolItem const*&>(rpState));
160 }
161 SfxItemState QueryState( sal_uInt16 nSID, css::uno::Any& rAny );
162
163 void SetDisableFlags( SfxDisableFlags nFlags );
164 SfxDisableFlags GetDisableFlags() const;
165
166 SAL_DLLPRIVATE void SetMenu_Impl();
167 SAL_DLLPRIVATE void Update_Impl( bool bForce = false ); // ObjectBars etc.
168 SAL_DLLPRIVATE bool IsUpdated_Impl() const;
169 SAL_DLLPRIVATE bool GetShellAndSlot_Impl( sal_uInt16 nSlot, SfxShell **ppShell, const SfxSlot **ppSlot,
170 bool bOwnShellsOnly, bool bRealSlot );
171 SAL_DLLPRIVATE void SetReadOnly_Impl( bool bOn );
172 SAL_DLLPRIVATE bool GetReadOnly_Impl() const;
173 SAL_DLLPRIVATE SfxSlotFilterState IsSlotEnabledByFilter_Impl( sal_uInt16 nSID ) const;
174 SAL_DLLPRIVATE void SetQuietMode_Impl( bool bOn );
175 SAL_DLLPRIVATE bool IsReadOnlyShell_Impl( sal_uInt16 nShell ) const;
176 SAL_DLLPRIVATE void RemoveShell_Impl( SfxShell& rShell );
177 SAL_DLLPRIVATE void DoActivate_Impl( bool bMDI );
178 SAL_DLLPRIVATE void DoDeactivate_Impl( bool bMDI, SfxViewFrame const * pNew );
179 SAL_DLLPRIVATE void InvalidateBindings_Impl(bool);
180
181 static boost::property_tree::ptree fillPopupMenu(const rtl::Reference<VCLXPopupMenu>& rMenu);
182};
183
184#endif
185
186/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxCallMode
Definition: bindings.hxx:57
std::unique_ptr< SfxDispatcher_Impl > xImp
Definition: dispatch.hxx:71
SfxItemState QueryState(TypedWhichId< T > nSID, const T *&rpState)
Definition: dispatch.hxx:157
DECL_DLLPRIVATE_LINK(EventHdl_Impl, Timer *, void)
The class SfxShell is the base class for all classes, which provide the functionality of the form <Sl...
Definition: shell.hxx:128
Definition: msg.hxx:184
SfxDispatcherPopFlags
Definition: dispatch.hxx:49
SfxSlotFilterState
Definition: dispatch.hxx:61
virtual SfxBindings & GetBindings() override
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
sal_uInt16 nPos
Definition: linksrc.cxx:118
NONE
Shell * GetShell()
const ::avmedia::MediaItem * Execute(const SdrMarkView *pSdrView, SfxRequest const &rReq)
SfxItemState
SfxDisableFlags
Definition: shell.hxx:102
ToolbarId
Definition: toolbarids.hxx:18