Branch data Line data Source code
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 : :
20 : : #ifndef _SBXCLASS_HXX
21 : : #define _SBXCLASS_HXX
22 : :
23 : : #include "tools/ref.hxx"
24 : : #include "svl/smplhint.hxx"
25 : : #include "svl/lstner.hxx"
26 : :
27 : : #include <basic/sbxdef.hxx>
28 : : #include <basic/sbxform.hxx>
29 : : #include <basic/sbxobj.hxx>
30 : : #include <basic/sbxprop.hxx>
31 : : #include <basic/sbxmeth.hxx>
32 : : #include "basicdllapi.h"
33 : :
34 : : #include <boost/ptr_container/ptr_vector.hpp>
35 : :
36 : : class String;
37 : : class SvStream;
38 : : class SbxBase;
39 : : class SbxVariable;
40 : : class SbxProperty;
41 : : class SbxMethod;
42 : : class SbxObject;
43 : : class SbxArray;
44 : : class SbxDimArray;
45 : : class SbxFactory;
46 : :
47 : : class SfxBroadcaster;
48 : :
49 : : #ifndef __SBX_SBXPARAMINFO
50 : : #define __SBX_SBXPARAMINFO
51 : :
52 : : // Parameter information
53 : : struct SbxParamInfo
54 : : {
55 : : const String aName; // Name of the parameter
56 : : SbxBaseRef aTypeRef; // Object, if object type
57 : : SbxDataType eType; // Data type
58 : : sal_uInt16 nFlags; // Flag-Bits
59 : : sal_uInt32 nUserData; // IDs etc.
60 : 302 : SbxParamInfo( const String& s, SbxDataType t, sal_uInt16 n, SbxBase* b = NULL )
61 : 302 : : aName( s ), aTypeRef( b ), eType( t ), nFlags( n ), nUserData( 0 ) {}
62 [ + - ]: 302 : ~SbxParamInfo() {}
63 : : };
64 : :
65 : : typedef boost::ptr_vector<SbxParamInfo> SbxParams;
66 : :
67 : : #endif
68 : :
69 : : #ifndef __SBX_SBXINFO
70 : : #define __SBX_SBXINFO
71 : :
72 : : class BASIC_DLLPUBLIC SbxInfo : public SvRefBase
73 : : {
74 : : friend class SbxVariable;
75 : : friend class SbMethod;
76 : :
77 : : String aComment;
78 : : String aHelpFile;
79 : : sal_uInt32 nHelpId;
80 : : SbxParams aParams;
81 : :
82 : : protected:
83 : : sal_Bool LoadData( SvStream&, sal_uInt16 );
84 : : sal_Bool StoreData( SvStream& ) const;
85 : : virtual ~SbxInfo();
86 : : public:
87 : : SbxInfo();
88 : : SbxInfo( const String&, sal_uInt32 );
89 : :
90 : : void AddParam( const rtl::OUString&, SbxDataType, sal_uInt16=SBX_READ );
91 : : const SbxParamInfo* GetParam( sal_uInt16 n ) const; // index starts with 1!
92 : 0 : const String& GetComment() const { return aComment; }
93 : 0 : const String& GetHelpFile() const { return aHelpFile; }
94 : 0 : sal_uInt32 GetHelpId() const { return nHelpId; }
95 : :
96 : 197 : void SetComment( const String& r ) { aComment = r; }
97 : : void SetHelpFile( const String& r ) { aHelpFile = r; }
98 : : void SetHelpId( sal_uInt32 nId ) { nHelpId = nId; }
99 : : };
100 : :
101 : : #endif
102 : :
103 : : #ifndef __SBX_SBXHINT_HXX
104 : : #define __SBX_SBXHINT_HXX
105 : :
106 [ - + ]: 22552 : class BASIC_DLLPUBLIC SbxHint : public SfxSimpleHint
107 : : {
108 : : SbxVariable* pVar;
109 : : public:
110 : : TYPEINFO();
111 : 22552 : SbxHint( sal_uIntPtr n, SbxVariable* v ) : SfxSimpleHint( n ), pVar( v ) {}
112 : 22540 : SbxVariable* GetVar() const { return pVar; }
113 : : };
114 : :
115 : : #endif
116 : :
117 : : #ifndef __SBX_SBXALIAS_HXX
118 : : #define __SBX_SBXALIAS_HXX
119 : :
120 : : // SbxAlias is an alias for a var or object
121 : : class BASIC_DLLPUBLIC SbxAlias : public SbxVariable, public SfxListener
122 : : {
123 : : SbxVariableRef xAlias;
124 : : virtual ~SbxAlias();
125 : : virtual void Broadcast( sal_uIntPtr );
126 : : virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
127 : : const SfxHint& rHint, const TypeId& rHintType );
128 : : public:
129 : : SbxAlias( const SbxAlias& );
130 : : SbxAlias& operator=( const SbxAlias& );
131 : : };
132 : :
133 : : #endif
134 : :
135 : : #ifndef __SBX_SBXARRAY
136 : : #define __SBX_SBXARRAY
137 : :
138 : : // SbxArray is an unidimensional, dynamic Array
139 : : // The variables convert from SbxVariablen. Put()/Insert() into the
140 : : // declared datatype, if they are not SbxVARIANT.
141 : :
142 : : class SbxVarRefs;
143 : : class SbxVariableRef;
144 : :
145 : : class SbxArrayImpl;
146 : :
147 : : class BASIC_DLLPUBLIC SbxArray : public SbxBase
148 : : {
149 : : // #100883 Method to set method directly to parameter array
150 : : friend class SbMethod;
151 : : friend class SbClassModuleObject;
152 : : friend SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
153 : : BASIC_DLLPRIVATE void PutDirect( SbxVariable* pVar, sal_uInt32 nIdx );
154 : :
155 : : SbxArrayImpl* mpSbxArrayImpl; // Impl data
156 : : SbxVarRefs* pData; // The variables
157 : :
158 : : protected:
159 : : SbxDataType eType; // Data type of the array
160 : : virtual ~SbxArray();
161 : : virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
162 : : virtual sal_Bool StoreData( SvStream& ) const;
163 : :
164 : : public:
165 : 0 : SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_ARRAY,1);
166 : : TYPEINFO();
167 : : SbxArray( SbxDataType=SbxVARIANT );
168 : : SbxArray( const SbxArray& );
169 : : SbxArray& operator=( const SbxArray& );
170 : : virtual void Clear();
171 : : sal_uInt16 Count() const;
172 : : virtual SbxDataType GetType() const;
173 : : virtual SbxClassType GetClass() const;
174 : : SbxVariableRef& GetRef( sal_uInt16 );
175 : : SbxVariable* Get( sal_uInt16 );
176 : : void Put( SbxVariable*, sal_uInt16 );
177 : : void Insert( SbxVariable*, sal_uInt16 );
178 : : void Remove( sal_uInt16 );
179 : : void Remove( SbxVariable* );
180 : : void Merge( SbxArray* );
181 : : const String& GetAlias( sal_uInt16 );
182 : : void PutAlias( const String&, sal_uInt16 );
183 : : SbxVariable* FindUserData( sal_uInt32 nUserData );
184 : : virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
185 : :
186 : : // Additional methods for 32-bit indices
187 : : sal_uInt32 Count32() const;
188 : : SbxVariableRef& GetRef32( sal_uInt32 );
189 : : SbxVariable* Get32( sal_uInt32 );
190 : : void Put32( SbxVariable*, sal_uInt32 );
191 : : void Insert32( SbxVariable*, sal_uInt32 );
192 : : void Remove32( sal_uInt32 );
193 : : };
194 : :
195 : : #endif
196 : :
197 : : #ifndef __SBX_SBXDIMARRAY_HXX
198 : : #define __SBX_SBXDIMARRAY_HXX
199 : :
200 : : // SbxDimArray is an array that can dimensioned using BASIC conventions.
201 : : struct SbxDim;
202 : :
203 : : class BASIC_DLLPUBLIC SbxDimArray : public SbxArray
204 : : {
205 : : SbxDim* pFirst, *pLast; // Links to Dimension table
206 : : short nDim; // Number of dimensions
207 : : BASIC_DLLPRIVATE void AddDimImpl32( sal_Int32, sal_Int32, sal_Bool bAllowSize0 );
208 : : bool mbHasFixedSize;
209 : : protected:
210 : : sal_uInt16 Offset( const short* );
211 : : sal_uInt32 Offset32( const sal_Int32* );
212 : : sal_uInt32 Offset32( SbxArray* );
213 : : virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
214 : : virtual sal_Bool StoreData( SvStream& ) const;
215 : : virtual ~SbxDimArray();
216 : : public:
217 : 0 : SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_DIMARRAY,1);
218 : : TYPEINFO();
219 : : SbxDimArray( SbxDataType=SbxVARIANT );
220 : : SbxDimArray( const SbxDimArray& );
221 : : SbxDimArray& operator=( const SbxDimArray& );
222 : : virtual void Clear();
223 : : using SbxArray::GetRef;
224 : : using SbxArray::Get;
225 : : SbxVariable* Get( const short* );
226 : : using SbxArray::Put;
227 : : void Put( SbxVariable*, const short* );
228 : : SbxVariable* Get( SbxArray* );
229 : :
230 : : short GetDims() const;
231 : : void AddDim( short, short );
232 : : void unoAddDim( short, short );
233 : : sal_Bool GetDim( short, short&, short& ) const;
234 : :
235 : : using SbxArray::GetRef32;
236 : : using SbxArray::Get32;
237 : : SbxVariable* Get32( const sal_Int32* );
238 : : using SbxArray::Put32;
239 : : void Put32( SbxVariable*, const sal_Int32* );
240 : : void AddDim32( sal_Int32, sal_Int32 );
241 : : void unoAddDim32( sal_Int32, sal_Int32 );
242 : : sal_Bool GetDim32( sal_Int32, sal_Int32&, sal_Int32& ) const;
243 : 0 : bool hasFixedSize() { return mbHasFixedSize; };
244 : 16 : void setHasFixedSize( bool bHasFixedSize ) {mbHasFixedSize = bHasFixedSize; };
245 : : };
246 : :
247 : : #endif
248 : :
249 : : #ifndef __SBX_SBXCOLLECTION_HXX
250 : : #define __SBX_SBXCOLLECTION_HXX
251 : :
252 : : class BASIC_DLLPUBLIC SbxCollection : public SbxObject
253 : : {
254 : : BASIC_DLLPRIVATE void Initialize();
255 : : protected:
256 : : virtual ~SbxCollection();
257 : : virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
258 : : virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
259 : : const SfxHint& rHint, const TypeId& rHintType );
260 : : // Overridable methods (why not pure virtual?):
261 : : virtual void CollAdd( SbxArray* pPar );
262 : : virtual void CollItem( SbxArray* pPar );
263 : : virtual void CollRemove( SbxArray* pPar );
264 : :
265 : : public:
266 : 0 : SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_COLLECTION,1);
267 : : TYPEINFO();
268 : : SbxCollection( const String& rClassname );
269 : : SbxCollection( const SbxCollection& );
270 : : SbxCollection& operator=( const SbxCollection& );
271 : : virtual SbxVariable* FindUserData( sal_uInt32 nUserData );
272 : : virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
273 : : virtual void Clear();
274 : : };
275 : :
276 : : #endif
277 : :
278 : : #ifndef __SBX_SBXSTDCOLLECTION_HXX
279 : : #define __SBX_SBXSTDCOLLECTION_HXX
280 : :
281 : : class BASIC_DLLPUBLIC SbxStdCollection : public SbxCollection
282 : : {
283 : : protected:
284 : : String aElemClass;
285 : : sal_Bool bAddRemoveOk;
286 : : virtual ~SbxStdCollection();
287 : : virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
288 : : virtual sal_Bool StoreData( SvStream& ) const;
289 : : virtual void CollAdd( SbxArray* pPar );
290 : : virtual void CollRemove( SbxArray* pPar );
291 : : public:
292 : 0 : SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_FIXCOLLECTION,1);
293 : : TYPEINFO();
294 : : SbxStdCollection
295 : : ( const String& rClassname, const String& rElemClass, sal_Bool=sal_True );
296 : : SbxStdCollection( const SbxStdCollection& );
297 : : SbxStdCollection& operator=( const SbxStdCollection& );
298 : : virtual void Insert( SbxVariable* );
299 : : const String& GetElementClass() const { return aElemClass; }
300 : : };
301 : :
302 : : #endif
303 : :
304 : : #ifndef __SBX_SBXREFS_HXX
305 : : #define __SBX_SBXREFS_HXX
306 : :
307 [ + + # ]: 27892 : SV_IMPL_REF(SbxBase)
[ + + ][ # # ]
[ # # ][ # # ]
[ # # ]
308 : :
309 [ + + - ]: 389722 : SV_IMPL_REF(SbxVariable)
[ + + ][ + + ]
[ + - + + ]
[ # # ][ + - ]
[ # # ][ # # ]
310 : :
311 : : #ifndef SBX_ARRAY_DECL_DEFINED
312 : : #define SBX_ARRAY_DECL_DEFINED
313 : : SV_DECL_REF(SbxArray)
314 : : #endif
315 : : #ifndef SBX_ARRAY_IMPL_DEFINED
316 : : #define SBX_ARRAY_IMPL_DEFINED
317 [ # + - ]: 292294 : SV_IMPL_REF(SbxArray)
[ # # ][ + + ]
[ + + ][ + + ]
[ + + ][ + + ]
318 : : #endif
319 : :
320 : : #ifndef SBX_INFO_DECL_DEFINED
321 : : #define SBX_INFO_DECL_DEFINED
322 : : SV_DECL_REF(SbxInfo)
323 : : #endif
324 : : #ifndef SBX_INFO_IMPL_DEFINED
325 : : #define SBX_INFO_IMPL_DEFINED
326 [ + - ][ + - ]: 47560 : SV_IMPL_REF(SbxInfo)
[ - + ][ + + ]
[ + + ][ + + ]
327 : : #endif
328 : :
329 : : #ifndef SBX_DIMARRAY_DECL_DEFINED
330 : : #define SBX_DIMARRAY_DECL_DEFINED
331 : 10 : SV_DECL_REF(SbxDimArray)
332 : : #endif
333 [ # + - ]: 10 : SV_IMPL_REF(SbxDimArray)
[ # # ][ + - ]
[ - + ][ + - ]
[ + - ]
334 : :
335 : : #endif
336 : :
337 : : #endif
338 : :
339 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|