1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23 #ifndef _SFXOBJFACE_HXX
24 #define _SFXOBJFACE_HXX
25
26 #include "sal/config.h"
27 #include "sfx2/dllapi.h"
28 #include "sal/types.h"
29 #include <tools/string.hxx>
30 #ifndef _RESID_HXX //autogen
31 #include <tools/resid.hxx>
32 #endif
33
34 #include <sfx2/msg.hxx>
35
36 struct SfxFormalArgument;
37 struct SfxTypeLibImpl;
38 struct SfxInterface_Impl;
39 class SfxConfigManager;
40 class SfxConfigItem;
41 class SfxIFConfig_Impl;
42 class SfxObjectUIArr_Impl ;
43 class SfxModule;
44 class SvStream;
45
46 class SFX2_DLLPUBLIC SfxInterface
47 {
48 friend class SfxIFConfig_Impl;
49 friend class SfxSlotPool;
50
51 const char* pName; // Sfx-internal name of interface
52 const SfxInterface* pGenoType; // base interface
53 SfxSlot* pSlots; // SlotMap
54 sal_uInt16 nCount; // number of slots in SlotMap
55 SfxInterfaceId nClassId; // Id of interface
56 ResId aNameResId; // ResId of external interface name
57 SfxInterface_Impl* pImpData;
58
59 SfxSlot* operator[]( sal_uInt16 nPos ) const;
60
61 public:
62 SfxInterface( const char *pClass,
63 const ResId& rResId,
64 SfxInterfaceId nClassId,
65 const SfxInterface* pGeno,
66 SfxSlot &rMessages, sal_uInt16 nMsgCount );
67 virtual ~SfxInterface();
68
69 void SetSlotMap( SfxSlot& rMessages, sal_uInt16 nMsgCount );
70 inline sal_uInt16 Count() const;
71
72 const SfxSlot* GetRealSlot( const SfxSlot * ) const;
73 const SfxSlot* GetRealSlot( sal_uInt16 nSlotId ) const;
74 virtual const SfxSlot* GetSlot( sal_uInt16 nSlotId ) const;
75 const SfxSlot* GetSlot( const String& rCommand ) const;
76
GetClassName() const77 const char* GetClassName() const { return pName; }
HasName() const78 int HasName() const { return 0 != aNameResId.GetId(); }
GetName() const79 String GetName() const
80 { return String(aNameResId); }
GetResMgr() const81 ResMgr* GetResMgr() const
82 { return aNameResId.GetResMgr(); }
83
GetGenoType() const84 const SfxInterface* GetGenoType() const { return pGenoType; }
85 const SfxInterface* GetRealInterfaceForSlot( const SfxSlot* ) const;
86
87 void RegisterObjectBar( sal_uInt16, const ResId&, const String* pST=0 );
88 void RegisterObjectBar( sal_uInt16, const ResId&, sal_uInt32 nFeature, const String* pST=0 );
89 void RegisterChildWindow( sal_uInt16, sal_Bool bContext, const String* pST=0 );
90 void RegisterChildWindow( sal_uInt16, sal_Bool bContext, sal_uInt32 nFeature, const String* pST=0 );
91 void RegisterStatusBar( const ResId& );
92 const ResId& GetObjectBarResId( sal_uInt16 nNo ) const;
93 sal_uInt16 GetObjectBarPos( sal_uInt16 nNo ) const;
94 sal_uInt32 GetObjectBarFeature( sal_uInt16 nNo ) const;
95 sal_uInt16 GetObjectBarCount() const;
96 void SetObjectBarPos( sal_uInt16 nPos, sal_uInt16 nId );
97 const String* GetObjectBarName( sal_uInt16 nNo ) const;
98 sal_Bool IsObjectBarVisible( sal_uInt16 nNo) const;
99 sal_uInt32 GetChildWindowFeature( sal_uInt16 nNo ) const;
100 sal_uInt32 GetChildWindowId( sal_uInt16 nNo ) const;
101 sal_uInt16 GetChildWindowCount() const;
102 void RegisterPopupMenu( const ResId& );
103 const ResId& GetPopupMenuResId() const;
104 const ResId& GetStatusBarResId() const;
105
106 void Register( SfxModule* );
107
108 //#if 0 // _SOLAR__PRIVATE
ContainsSlot_Impl(const SfxSlot * pSlot) const109 SAL_DLLPRIVATE int ContainsSlot_Impl( const SfxSlot *pSlot ) const
110 { return pSlot >= pSlots && pSlot < pSlots + Count(); }
GetResManager_Impl() const111 SAL_DLLPRIVATE ResMgr* GetResManager_Impl() const
112 { return aNameResId.GetResMgr(); }
113 //#endif
114 };
115
116 //--------------------------------------------------------------------
117
118 // returns the number of functions in this cluster
119
Count() const120 inline sal_uInt16 SfxInterface::Count() const
121 {
122 return nCount;
123 }
124
125 //--------------------------------------------------------------------
126
127 // returns a function by position in the array
128
operator [](sal_uInt16 nPos) const129 inline SfxSlot* SfxInterface::operator[]( sal_uInt16 nPos ) const
130 {
131 return nPos < nCount? pSlots+nPos: 0;
132 }
133
134 //#if 0 // _SOLAR__PRIVATE
135 class SfxIFConfig_Impl
136 {
137 friend class SfxInterface;
138 sal_uInt16 nCount;
139 SfxObjectUIArr_Impl* pObjectBars;
140
141 public:
142 SfxIFConfig_Impl();
143 ~SfxIFConfig_Impl();
144 sal_Bool Store(SvStream&);
145 void RegisterObjectBar( sal_uInt16, const ResId&, sal_uInt32 nFeature, const String* pST=0 );
146 sal_uInt16 GetType();
147 };
148 //#endif
149
150 #endif
151