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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _SFX_SHELL_HXX
#define _SFX_SHELL_HXX
#include "sal/config.h"
#include "sfx2/dllapi.h"
#include "sal/types.h"
#include <com/sun/star/embed/VerbDescriptor.hpp>
#include <tools/debug.hxx>
#include <tools/rtti.hxx>
#include <svl/brdcst.hxx>
#include <tools/ownlist.hxx>
#include <tools/unqid.hxx>
#include <tools/string.hxx>
#include <sfx2/sfxuno.hxx>
class ResMgr;
class Window;
class ToolBox;
class SfxItemPool;
class SfxPoolItem;
class SfxRequest;
class SfxItemSet;
struct SfxFormalArgument;
class StatusBar;
class SfxInterface;
class SfxViewShell;
class SfxObjectShell;
class SfxSlotPool;
class SvGlobalName;
class SfxShellObject;
class SfxShell;
struct SfxShell_Impl;
struct SfxTypeLibImpl;
class SfxShellObject;
class SfxShellSubObject;
class SfxDispatcher;
class SfxViewFrame;
class SfxSlot;
class SfxUndoManager;
class SfxRepeatTarget;
class SbxVariable;
class SbxBase;
class SfxBindings;
//====================================================================
enum SfxInterfaceId
/* [Beschreibung]
Id f"ur die <SfxInterface>s, damit wird "uber ein Array an der
<SfxApplication> ein quasi-statischer Zugriff auf die Interfaces
erlaubt.
*/
{
SFX_INTERFACE_NONE,
SFX_INTERFACE_SFXAPP,
SFX_INTERFACE_SFXDOCSH,
SFX_INTERFACE_SFXIPFRM,
SFX_INTERFACE_SFXVIEWSH,
SFX_INTERFACE_SFXVIEWFRM,
SFX_INTERFACE_SFXPLUGINFRM,
SFX_INTERFACE_SFXPLUGINOBJ,
SFX_INTERFACE_SFXPLUGINVIEWSH,
SFX_INTERFACE_SFXFRAMESETOBJ,
SFX_INTERFACE_SFXFRAMESETVIEWSH,
SFX_INTERFACE_SFXINTERNALFRM,
SFX_INTERFACE_SFXCOMPONENTDOCSH,
SFX_INTERFACE_SFXGENERICOBJ,
SFX_INTERFACE_SFXGENERICVIEWSH,
SFX_INTERFACE_SFXEXPLOBJ,
SFX_INTERFACE_SFXEXPLVIEWSH,
SFX_INTERFACE_SFXPLUGINVIEWSHDYNAMIC,
SFX_INTERFACE_SFXEXTERNALVIEWFRM,
SFX_INTERFACE_SFXMODULE,
SFX_INTERFACE_SFXFRAMESETVIEW,
SFX_INTERFACE_SFXFRAMESETSOURCEVIEW,
SFX_INTERFACE_SFXHELP_DOCSH,
SFX_INTERFACE_SFXHELP_VIEWSH,
SFX_INTERFACE_SFXTASK,
SFX_INTERFACE_OFA_START = 100,
SFX_INTERFACE_OFA_END = 100,
SFX_INTERFACE_SC_START = 150,
SFX_INTERFACE_SC_END = 199,
SFX_INTERFACE_SD_START = 200,
SFX_INTERFACE_SD_END = 249,
SFX_INTERFACE_SW_START = 250,
SFX_INTERFACE_SW_END = 299,
SFX_INTERFACE_SIM_START = 300,
SFX_INTERFACE_SIM_END = 319,
SFX_INTERFACE_SCH_START = 320,
SFX_INTERFACE_SCH_END = 339,
SFX_INTERFACE_SMA_START = 340,
SFX_INTERFACE_SMA_END = 359,
SFX_INTERFACE_SBA_START = 360,
SFX_INTERFACE_SBA_END = 399,
SFX_INTERFACE_IDE_START = 400,
SFX_INTERFACE_IDE_END = 409,
//-falls die noch einer braucht
SFX_INTERFACE_APP = SFX_INTERFACE_SW_START,
SFX_INTERFACE_LIB = 450
};
//TODO/CLEANUP: replace by UNO constant
#define SVVERB_SHOW -1
//====================================================================
typedef void (*SfxExecFunc)(SfxShell *, SfxRequest &rReq);
typedef void (*SfxStateFunc)(SfxShell *, SfxItemSet &rSet);
class SFX2_DLLPUBLIC SfxShell: public SfxBroadcaster
/* [Beschreibung]
Die Klasse SfxShell ist Basisklasse f"ur alle Schichten, die
Funktionalit"at Form von <Slot>s bereitstellen wollen.
Jede Instanz hat einen Verweis auf eine Interface-Beschreibung, der
mit <SfxShell::GetInterface()const> erh"altlich ist. Dieses Interface
stellt die Verbindung zu konkreten Methoden her und enth"alt einige
weitere beschreibende Daten f"ur Controller wie Menus und Toolboxen, aber
auch f"ur die diversen APIs. Der Hautpteil der Interface-Beschreibung
liegt in Form einer <Type-Library> vor, die mit dem <SVIDL-Compiler>
aus einem IDL-File generiert wird. F"ur jede SfxShell-Subclass ist ein
solches IDL-File zu schreiben.
*/
{
friend class SfxObjectItem;
SfxShell_Impl* pImp;
SfxItemPool* pPool;
SfxUndoManager* pUndoMgr;
private:
SfxShell( const SfxShell & ); // n.i.
SfxShell& operator = ( const SfxShell & ); // n.i.
protected:
SfxShell();
SfxShell( SfxViewShell *pViewSh );
#ifndef _SFXSH_HXX
SAL_DLLPRIVATE void SetViewShell_Impl( SfxViewShell* pView );
SAL_DLLPRIVATE void Invalidate_Impl( SfxBindings& rBindings, USHORT nId );
SAL_DLLPRIVATE SfxShellObject* GetShellObj_Impl() const;
SAL_DLLPRIVATE void SetShellObj_Impl( SfxShellObject* pObj );
#endif
public:
TYPEINFO();
virtual ~SfxShell();
SfxBroadcaster* GetBroadcaster();
// TODO/CLEANUP: still needed?!
virtual SvGlobalName GetGlobalName() const;
virtual SfxInterface* GetInterface() const;
static SfxInterface* GetStaticInterface() { return 0; }
void SetName( const String &rName );
const String& GetName() const;
SfxViewShell* GetViewShell() const;
void CallExec( SfxExecFunc pFunc, SfxRequest &rReq )
{ (*pFunc)(this, rReq); }
void CallState( SfxStateFunc pFunc, SfxItemSet &rSet )
{ (*pFunc)(this, rSet); }
static void EmptyExecStub(SfxShell *pShell, SfxRequest &);
static void EmptyStateStub(SfxShell *pShell, SfxItemSet &);
const SfxPoolItem* GetSlotState( USHORT nSlotId, const SfxInterface *pIF = 0, SfxItemSet *pStateSet = 0 );
const SfxPoolItem* ExecuteSlot( SfxRequest &rReq, const SfxInterface *pIF = 0 );
const SfxPoolItem* ExecuteSlot( SfxRequest &rReq, BOOL bAsync );
ULONG ExecuteSlot( USHORT nSlot, USHORT nMemberId, SbxVariable& rRet, SbxBase* pArgs = 0 );
inline SfxItemPool& GetPool() const;
inline void SetPool( SfxItemPool *pNewPool ) ;
virtual SfxUndoManager* GetUndoManager();
void SetUndoManager( SfxUndoManager *pNewUndoMgr );
SfxRepeatTarget* GetRepeatTarget() const;
void SetRepeatTarget( SfxRepeatTarget *pTarget );
virtual void Invalidate(USHORT nId = 0);
BOOL IsActive() const;
virtual void Activate(BOOL bMDI);
virtual void Deactivate(BOOL bMDI);
virtual void ParentActivate();
virtual void ParentDeactivate();
SfxDispatcher* GetDispatcher() const;
SfxViewFrame* GetFrame() const;
ResMgr* GetResMgr() const;
virtual sal_Bool HasUIFeature( sal_uInt32 nFeature );
void UIFeatureChanged();
// Items
const SfxPoolItem* GetItem( USHORT nSlotId ) const;
void PutItem( const SfxPoolItem& rItem );
void RemoveItem( USHORT nSlotId );
// TODO/CLEANUP: still needed?!
void SetVerbs(const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& aVerbs);
const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& GetVerbs() const;
void VerbExec (SfxRequest&);
void VerbState (SfxItemSet&);
SAL_DLLPRIVATE const SfxSlot* GetVerbSlot_Impl(USHORT nId) const;
void SetHelpId(ULONG nId);
ULONG GetHelpId() const;
virtual SfxObjectShell* GetObjectShell();
void SetDisableFlags( ULONG nFlags );
ULONG GetDisableFlags() const;
virtual SfxItemSet* CreateItemSet( USHORT nId );
virtual void ApplyItemSet( USHORT nId, const SfxItemSet& rSet );
#ifndef _SFXSH_HXX
SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot );
SAL_DLLPRIVATE void DoActivate_Impl( SfxViewFrame *pFrame, BOOL bMDI);
SAL_DLLPRIVATE void DoDeactivate_Impl( SfxViewFrame *pFrame, BOOL bMDI);
#endif
};
//--------------------------------------------------------------------
SfxItemPool& SfxShell::GetPool() const
/*
[Beschreibung]
Jede Subclass von SfxShell mu"s einen Pool referenzieren. Dieser
wird teilweise von SFx-eigenen Subklassen gesetzt (z.B. <SfxViewShell>),
mu"s aber insbesondere bei direkt von SfxShell abgeleiteten Klassen
und bei Ableitungen von SfxObjectShell selbst gesetzt werden.
Die Klasse SfxShell selbst hat noch keinen SfxItemPool, es wird
daher ein 0-Pointer zur"uckgeliefert.
*/
{
DBG_ASSERT( pPool, "no pool" );
return *pPool;
}
//-------------------------------------------------------------------
inline void SfxShell::SetPool
(
SfxItemPool* pNewPool // Pointer auf den neuen Pool oder 0
)
/* [Beschreibung]
Mit dieser Methode melden die Subklassen ihren speziellen <SfxItemPool>
an der SfxShell an. Jede SfxShell Instanz mu\s Zugriff auf einen
SfxItemPool haben. In der Regel ist dies der SfxItemPool der
SfxDocumentShell. Die SfxShell Subklasse "ubernimmt nicht die
Eigent"umerschaft "uber den "ubergebenen Pool. Bevor er gel"oscht
wirde, mu\s er mit SetPool(0) abgemeldet werden.
*/
{
pPool = pNewPool;
}
//=====================================================================
#define SFX_ARGUMENTMAP(ShellClass) static SfxFormalArgument a##ShellClass##Args_Impl[] =
#define SFX_SLOTMAP(ShellClass) static SfxFormalArgument a##ShellClass##Args_Impl[1]; \
static SfxSlot a##ShellClass##Slots_Impl[] =
#define SFX_SLOTMAP_ARG(ShellClass) static SfxSlot a##ShellClass##Slots_Impl[] =
#define SFX_DECL_INTERFACE(nId) \
static SfxInterface* pInterface; \
private: \
static void InitInterface_Impl(); \
public: \
static const SfxFormalArgument* pSfxFormalArgs_Impl; \
static SfxInterface* GetStaticInterface(); \
static SfxInterfaceId GetInterfaceId() {return SfxInterfaceId(nId);} \
static void RegisterInterface(SfxModule* pMod=NULL); \
virtual SfxInterface* GetInterface() const;
#define SFX_IMPL_INTERFACE(Class,SuperClass,NameResId) \
\
SfxInterface* Class::pInterface = 0; \
const SfxFormalArgument* Class::pSfxFormalArgs_Impl = a##Class##Args_Impl;\
SfxInterface* Class::GetStaticInterface() \
{ \
if ( !pInterface ) \
{ \
pInterface = \
new SfxInterface( \
#Class, NameResId, GetInterfaceId(), \
SuperClass::GetStaticInterface(), \
a##Class##Slots_Impl[0], \
(USHORT) (sizeof(a##Class##Slots_Impl) / sizeof(SfxSlot) ) ); \
InitInterface_Impl(); \
} \
return pInterface; \
} \
\
SfxInterface* Class::GetInterface() const \
{ \
return GetStaticInterface(); \
} \
\
void Class::RegisterInterface(SfxModule* pMod) \
{ \
GetStaticInterface()->Register(pMod); \
} \
\
void Class::InitInterface_Impl()
#define SFX_POSITION_MASK 0x000F
#define SFX_VISIBILITY_MASK 0xFFF0
#define SFX_VISIBILITY_UNVISIBLE 0x0000 // nie sichtbar
#define SFX_VISIBILITY_PLUGSERVER 0x0010
#define SFX_VISIBILITY_PLUGCLIENT 0x0020
#define SFX_VISIBILITY_VIEWER 0x0040
// noch 1 sind frei!
#define SFX_VISIBILITY_RECORDING 0x0200
#define SFX_VISIBILITY_READONLYDOC 0x0400
#define SFX_VISIBILITY_DESKTOP 0x0800
#define SFX_VISIBILITY_STANDARD 0x1000
#define SFX_VISIBILITY_FULLSCREEN 0x2000
#define SFX_VISIBILITY_CLIENT 0x4000
#define SFX_VISIBILITY_SERVER 0x8000
#define SFX_VISIBILITY_NOCONTEXT 0xFFFF // immer sichtbar
#define SFX_OBJECTBAR_REGISTRATION(nPos,rResId) \
GetStaticInterface()->RegisterObjectBar( nPos, rResId )
#define SFX_FEATURED_OBJECTBAR_REGISTRATION(nPos,rResId,nFeature) \
GetStaticInterface()->RegisterObjectBar( nPos, rResId, nFeature )
#define SFX_CHILDWINDOW_REGISTRATION(nId) \
GetStaticInterface()->RegisterChildWindow( nId, (BOOL) FALSE )
#define SFX_FEATURED_CHILDWINDOW_REGISTRATION(nId,nFeature) \
GetStaticInterface()->RegisterChildWindow( nId, (BOOL) FALSE, nFeature )
#define SFX_CHILDWINDOW_CONTEXT_REGISTRATION(nId) \
GetStaticInterface()->RegisterChildWindow( nId, (BOOL) TRUE )
#define SFX_POPUPMENU_REGISTRATION(rResId) \
GetStaticInterface()->RegisterPopupMenu( rResId )
#define SFX_OBJECTMENU_REGISTRATION(nPos,rResId) \
GetStaticInterface()->RegisterObjectMenu( nPos, rResId )
#define SFX_STATUSBAR_REGISTRATION(rResId) \
GetStaticInterface()->RegisterStatusBar( rResId )
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|