merge the formfield patch from ooo-build
[ooovba.git] / idl / inc / types.hxx
blobc8f31028481d345ac75c2950f56fa690ef1c33c5
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: types.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _TYPES_HXX
32 #define _TYPES_HXX
34 #include <tools/ref.hxx>
35 #include <basobj.hxx>
37 class SvSlotElementList;
38 struct SvSlotElement;
40 /******************** class SvMetaAttribute *****************************/
41 SV_DECL_REF(SvMetaType)
42 SV_DECL_REF(SvMetaAttribute)
43 SV_DECL_PERSIST_LIST(SvMetaAttribute,SvMetaAttribute *)
44 class SvMetaAttribute : public SvMetaReference
46 SvMetaTypeRef aType;
47 SvNumberIdentifier aSlotId;
48 SvBOOL aAutomation;
49 SvBOOL aExport;
50 SvBOOL aReadonly;
51 SvBOOL aIsCollection;
52 SvBOOL aReadOnlyDoc;
53 SvBOOL aHidden;
54 BOOL bNewAttr;
56 protected:
57 #ifdef IDL_COMPILER
58 virtual void WriteCSource( SvIdlDataBase & rBase,
59 SvStream & rOutStm, BOOL bSet );
60 ULONG MakeSlotValue( SvIdlDataBase & rBase, BOOL bVariable ) const;
61 virtual void WriteAttributes( SvIdlDataBase & rBase,
62 SvStream & rOutStm, USHORT nTab,
63 WriteType, WriteAttribute = 0 );
64 virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase,
65 SvTokenStream & rInStm );
66 virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase,
67 SvStream & rOutStm, USHORT nTab );
68 #endif
69 public:
70 SV_DECL_META_FACTORY1( SvMetaAttribute, SvMetaReference, 2 )
71 SvMetaAttribute();
72 SvMetaAttribute( SvMetaType * );
74 void SetNewAttribute( BOOL bNew )
75 { bNewAttr = bNew; }
76 BOOL IsNewAttribute() const
77 { return bNewAttr; }
78 BOOL GetReadonly() const;
80 void SetSlotId( const SvNumberIdentifier & rId )
81 { aSlotId = rId; }
82 const SvNumberIdentifier & GetSlotId() const;
84 void SetExport( BOOL bSet )
85 { aExport = bSet; }
86 BOOL GetExport() const;
88 void SetHidden( BOOL bSet )
89 { aHidden = bSet; }
90 BOOL GetHidden() const;
92 void SetAutomation( BOOL bSet )
93 { aAutomation = bSet; }
94 BOOL GetAutomation() const;
96 void SetIsCollection( BOOL bSet )
97 { aIsCollection = bSet; }
98 BOOL GetIsCollection() const;
99 void SetReadOnlyDoc( BOOL bSet )
100 { aReadOnlyDoc = bSet; }
101 BOOL GetReadOnlyDoc() const;
103 void SetType( SvMetaType * pT ) { aType = pT; }
104 SvMetaType * GetType() const;
106 virtual BOOL IsMethod() const;
107 virtual BOOL IsVariable() const;
108 virtual ByteString GetMangleName( BOOL bVariable ) const;
110 // void FillSbxObject( SbxInfo * pInfo, USHORT nSbxFlags = 0 );
111 // virtual void FillSbxObject( SvIdlDataBase & rBase, SbxObject * pObj, BOOL bVariable );
113 #ifdef IDL_COMPILER
114 virtual BOOL Test( SvIdlDataBase &, SvTokenStream & rInStm );
115 virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
116 virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab );
117 virtual void WriteParam( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab,
118 WriteType );
119 void WriteRecursiv_Impl( SvIdlDataBase & rBase,
120 SvStream & rOutStm, USHORT nTab,
121 WriteType, WriteAttribute );
122 virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab,
123 WriteType, WriteAttribute = 0 );
124 ULONG MakeSfx( ByteString * pAtrrArray );
125 virtual void Insert( SvSlotElementList&, const ByteString & rPrefix,
126 SvIdlDataBase& );
127 virtual void WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
128 Table * pIdTable );
129 virtual void WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm,
130 Table * pIdTable );
131 virtual void WriteCSV( SvIdlDataBase&, SvStream& );
132 void FillIDTable(Table *pIDTable);
133 ByteString Compare( SvMetaAttribute *pAttr );
134 #endif
136 SV_IMPL_REF(SvMetaAttribute)
137 SV_IMPL_PERSIST_LIST(SvMetaAttribute,SvMetaAttribute *)
140 /******************** class SvType *********************************/
141 enum { CALL_VALUE, CALL_POINTER, CALL_REFERENCE };
142 enum { TYPE_METHOD, TYPE_STRUCT, TYPE_BASE, TYPE_ENUM, TYPE_UNION,
143 TYPE_CLASS, TYPE_POINTER };
144 class SvMetaType : public SvMetaExtern
146 SvBOOL aIn; // Eingangsparameter
147 SvBOOL aOut; // Returnparameter
148 Svint aCall0, aCall1;
149 Svint aSbxDataType;
150 SvIdentifier aSvName;
151 SvIdentifier aSbxName;
152 SvIdentifier aOdlName;
153 SvIdentifier aCName;
154 SvIdentifier aBasicPostfix;
155 SvIdentifier aBasicName;
156 SvMetaAttributeMemberList * pAttrList;
157 int nType;
158 BOOL bIsItem;
159 BOOL bIsShell;
160 char cParserChar;
162 #ifdef IDL_COMPILER
163 void WriteSfxItem( const ByteString & rItemName, SvIdlDataBase & rBase,
164 SvStream & rOutStm );
165 protected:
166 BOOL ReadNamesSvIdl( SvIdlDataBase & rBase,
167 SvTokenStream & rInStm );
168 virtual void ReadAttributesSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
169 virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab );
170 virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
171 virtual void WriteContextSvIdl( SvIdlDataBase &, SvStream & rOutStm,
172 USHORT nTab );
174 virtual void WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm,
175 USHORT nTab,
176 WriteType, WriteAttribute = 0 );
177 virtual void WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab,
178 WriteType, WriteAttribute = 0 );
179 BOOL ReadHeaderSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
180 void WriteHeaderSvIdl( SvIdlDataBase &, SvStream & rOutStm,
181 USHORT nTab );
182 #endif
183 public:
184 SV_DECL_META_FACTORY1( SvMetaType, SvMetaExtern, 18 )
185 SvMetaType();
186 SvMetaType( const ByteString & rTypeName, char cParserChar,
187 const ByteString & rCName );
188 SvMetaType( const ByteString & rTypeName, const ByteString & rSbxName,
189 const ByteString & rOdlName, char cParserChar,
190 const ByteString & rCName, const ByteString & rBasicName,
191 const ByteString & rBasicPostfix/*, SbxDataType nT = SbxEMPTY */);
193 SvMetaAttributeMemberList & GetAttrList() const;
194 ULONG GetAttrCount() const
196 return pAttrList ? pAttrList->Count() : 0L;
198 void AppendAttr( SvMetaAttribute * pAttr )
200 GetAttrList().Append( pAttr );
203 void SetType( int nT );
204 int GetType() const { return nType; }
205 SvMetaType * GetBaseType() const;
206 SvMetaType * GetReturnType() const;
207 BOOL IsItem() const { return bIsItem; }
208 BOOL IsShell() const { return bIsShell; }
210 // void SetSbxDataType( SbxDataType nT )
211 // { aSbxDataType = (int)nT; }
212 // SbxDataType GetSbxDataType() const;
214 void SetIn( BOOL b ) { aIn = b; }
215 BOOL GetIn() const;
217 void SetOut( BOOL b ) { aOut = b; }
218 BOOL GetOut() const;
220 void SetCall0( int e );
221 int GetCall0() const;
223 void SetCall1( int e);
224 int GetCall1() const;
226 void SetBasicName(const ByteString& rName)
227 { aBasicName = rName; }
229 const ByteString & GetBasicName() const;
230 ByteString GetBasicPostfix() const;
231 const ByteString & GetSvName() const;
232 const ByteString & GetSbxName() const;
233 const ByteString & GetOdlName() const;
234 const ByteString & GetCName() const;
235 char GetParserChar() const { return cParserChar; }
237 virtual BOOL SetName( const ByteString & rName, SvIdlDataBase * = NULL );
239 // void FillSbxObject( SbxVariable * pObj, BOOL bVariable );
241 #ifdef IDL_COMPILER
242 virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
243 virtual void WriteSvIdl( SvIdlDataBase & rBase,
244 SvStream & rOutStm, USHORT nTab );
245 virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab,
246 WriteType, WriteAttribute = 0 );
247 ByteString GetCString() const;
248 void WriteSvIdlType( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab );
249 void WriteOdlType( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab );
250 void AppendParserString (ByteString &rString);
252 ULONG MakeSfx( ByteString * pAtrrArray );
253 virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm );
254 //BOOL ReadTypePrefix( SvIdlDataBase &, SvTokenStream & rInStm );
255 BOOL ReadMethodArgs( SvIdlDataBase & rBase,
256 SvTokenStream & rInStm );
257 void WriteTypePrefix( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, WriteType );
258 void WriteMethodArgs( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, WriteType );
259 void WriteTheType( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, WriteType );
260 ByteString GetParserString() const;
261 void WriteParamNames( SvIdlDataBase & rBase, SvStream & rOutStm,
262 const ByteString & rChief );
263 #endif
265 SV_IMPL_REF(SvMetaType)
266 DECLARE_LIST(SvMetaTypeList,SvMetaType *)
267 SV_DECL_IMPL_PERSIST_LIST(SvMetaType,SvMetaType *)
270 /******************** class SvTypeString *********************************/
271 class SvMetaTypeString : public SvMetaType
273 public:
274 SV_DECL_META_FACTORY1( SvMetaTypeString, SvMetaType, 19 )
275 SvMetaTypeString();
277 SV_DECL_IMPL_REF(SvMetaTypeString)
278 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypeString,SvMetaTypeString *)
281 /******************** class SvMetaEnumValue **********************************/
282 class SvMetaEnumValue : public SvMetaName
284 ByteString aEnumValue;
285 public:
286 SV_DECL_META_FACTORY1( SvMetaEnumValue, SvMetaName, 20 )
287 SvMetaEnumValue();
289 #ifdef IDL_COMPILER
290 virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
291 virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab );
292 virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab,
293 WriteType, WriteAttribute = 0 );
294 #endif
296 SV_DECL_IMPL_REF(SvMetaEnumValue)
297 SV_DECL_IMPL_PERSIST_LIST(SvMetaEnumValue,SvMetaEnumValue *)
300 /******************** class SvTypeEnum *********************************/
301 class SvMetaTypeEnum : public SvMetaType
303 SvMetaEnumValueMemberList aEnumValueList;
304 ByteString aPrefix;
305 protected:
306 #ifdef IDL_COMPILER
307 virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
308 virtual void WriteContextSvIdl( SvIdlDataBase &, SvStream & rOutStm,
309 USHORT nTab );
310 virtual void WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab,
311 WriteType, WriteAttribute = 0 );
312 #endif
313 public:
314 SV_DECL_META_FACTORY1( SvMetaTypeEnum, SvMetaType, 21 )
315 SvMetaTypeEnum();
317 USHORT GetMaxValue() const;
318 ULONG Count() const { return aEnumValueList.Count(); }
319 const ByteString & GetPrefix() const { return aPrefix; }
320 SvMetaEnumValue * GetObject( ULONG n ) const
321 { return aEnumValueList.GetObject( n ); }
323 #ifdef IDL_COMPILER
324 virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
325 virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab );
327 virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm,
328 USHORT nTab,
329 WriteType, WriteAttribute = 0 );
330 #endif
332 SV_DECL_IMPL_REF(SvMetaTypeEnum)
333 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypeEnum,SvMetaTypeEnum *)
336 /******************** class SvTypeVoid ***********************************/
337 class SvMetaTypevoid : public SvMetaType
339 public:
340 SV_DECL_META_FACTORY1( SvMetaTypevoid, SvMetaName, 22 )
341 SvMetaTypevoid();
343 SV_DECL_IMPL_REF(SvMetaTypevoid)
344 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypevoid,SvMetaTypevoid *)
347 #endif // _TYPES_HXX