1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: types.hxx,v $
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 ************************************************************************/
34 #include <tools/ref.hxx>
37 class SvSlotElementList
;
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
47 SvNumberIdentifier aSlotId
;
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
);
70 SV_DECL_META_FACTORY1( SvMetaAttribute
, SvMetaReference
, 2 )
72 SvMetaAttribute( SvMetaType
* );
74 void SetNewAttribute( BOOL bNew
)
76 BOOL
IsNewAttribute() const
78 BOOL
GetReadonly() const;
80 void SetSlotId( const SvNumberIdentifier
& rId
)
82 const SvNumberIdentifier
& GetSlotId() const;
84 void SetExport( BOOL bSet
)
86 BOOL
GetExport() const;
88 void SetHidden( BOOL 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 );
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
,
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
,
127 virtual void WriteHelpId( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
129 virtual void WriteSrc( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
131 virtual void WriteCSV( SvIdlDataBase
&, SvStream
& );
132 void FillIDTable(Table
*pIDTable
);
133 ByteString
Compare( SvMetaAttribute
*pAttr
);
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
;
150 SvIdentifier aSvName
;
151 SvIdentifier aSbxName
;
152 SvIdentifier aOdlName
;
154 SvIdentifier aBasicPostfix
;
155 SvIdentifier aBasicName
;
156 SvMetaAttributeMemberList
* pAttrList
;
163 void WriteSfxItem( const ByteString
& rItemName
, SvIdlDataBase
& rBase
,
164 SvStream
& rOutStm
);
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
,
174 virtual void WriteContext( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
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
,
184 SV_DECL_META_FACTORY1( SvMetaType
, SvMetaExtern
, 18 )
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
; }
217 void SetOut( BOOL b
) { aOut
= b
; }
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 );
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
);
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
274 SV_DECL_META_FACTORY1( SvMetaTypeString
, SvMetaType
, 19 )
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
;
286 SV_DECL_META_FACTORY1( SvMetaEnumValue
, SvMetaName
, 20 )
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 );
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
;
307 virtual void ReadContextSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
308 virtual void WriteContextSvIdl( SvIdlDataBase
&, SvStream
& rOutStm
,
310 virtual void WriteContext( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, USHORT nTab
,
311 WriteType
, WriteAttribute
= 0 );
314 SV_DECL_META_FACTORY1( SvMetaTypeEnum
, SvMetaType
, 21 )
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
); }
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
,
329 WriteType
, WriteAttribute
= 0 );
332 SV_DECL_IMPL_REF(SvMetaTypeEnum
)
333 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypeEnum
,SvMetaTypeEnum
*)
336 /******************** class SvTypeVoid ***********************************/
337 class SvMetaTypevoid
: public SvMetaType
340 SV_DECL_META_FACTORY1( SvMetaTypevoid
, SvMetaName
, 22 )
343 SV_DECL_IMPL_REF(SvMetaTypevoid
)
344 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypevoid
,SvMetaTypevoid
*)