1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
31 #include <tools/ref.hxx>
34 class SvSlotElementList
;
37 /******************** class SvMetaAttribute *****************************/
38 SV_DECL_REF(SvMetaType
)
39 SV_DECL_REF(SvMetaAttribute
)
40 SV_DECL_PERSIST_LIST(SvMetaAttribute
,SvMetaAttribute
*)
41 class SvMetaAttribute
: public SvMetaReference
44 SvNumberIdentifier aSlotId
;
55 virtual void WriteCSource( SvIdlDataBase
& rBase
,
56 SvStream
& rOutStm
, sal_Bool bSet
);
57 sal_uLong
MakeSlotValue( SvIdlDataBase
& rBase
, sal_Bool bVariable
) const;
58 virtual void WriteAttributes( SvIdlDataBase
& rBase
,
59 SvStream
& rOutStm
, sal_uInt16 nTab
,
60 WriteType
, WriteAttribute
= 0 );
61 virtual void ReadAttributesSvIdl( SvIdlDataBase
& rBase
,
62 SvTokenStream
& rInStm
);
63 virtual void WriteAttributesSvIdl( SvIdlDataBase
& rBase
,
64 SvStream
& rOutStm
, sal_uInt16 nTab
);
67 SV_DECL_META_FACTORY1( SvMetaAttribute
, SvMetaReference
, 2 )
69 SvMetaAttribute( SvMetaType
* );
71 void SetNewAttribute( sal_Bool bNew
)
73 sal_Bool
IsNewAttribute() const
75 sal_Bool
GetReadonly() const;
77 void SetSlotId( const SvNumberIdentifier
& rId
)
79 const SvNumberIdentifier
& GetSlotId() const;
81 void SetExport( sal_Bool bSet
)
83 sal_Bool
GetExport() const;
85 void SetHidden( sal_Bool bSet
)
87 sal_Bool
GetHidden() const;
89 void SetAutomation( sal_Bool bSet
)
90 { aAutomation
= bSet
; }
91 sal_Bool
GetAutomation() const;
93 void SetIsCollection( sal_Bool bSet
)
94 { aIsCollection
= bSet
; }
95 sal_Bool
GetIsCollection() const;
96 void SetReadOnlyDoc( sal_Bool bSet
)
97 { aReadOnlyDoc
= bSet
; }
98 sal_Bool
GetReadOnlyDoc() const;
100 void SetType( SvMetaType
* pT
) { aType
= pT
; }
101 SvMetaType
* GetType() const;
103 virtual sal_Bool
IsMethod() const;
104 virtual sal_Bool
IsVariable() const;
105 virtual ByteString
GetMangleName( sal_Bool bVariable
) const;
107 // void FillSbxObject( SbxInfo * pInfo, sal_uInt16 nSbxFlags = 0 );
108 // virtual void FillSbxObject( SvIdlDataBase & rBase, SbxObject * pObj, sal_Bool bVariable );
111 virtual sal_Bool
Test( SvIdlDataBase
&, SvTokenStream
& rInStm
);
112 virtual sal_Bool
ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
113 virtual void WriteSvIdl( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
);
114 virtual void WriteParam( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
,
116 void WriteRecursiv_Impl( SvIdlDataBase
& rBase
,
117 SvStream
& rOutStm
, sal_uInt16 nTab
,
118 WriteType
, WriteAttribute
);
119 virtual void Write( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
,
120 WriteType
, WriteAttribute
= 0 );
121 sal_uLong
MakeSfx( ByteString
* pAtrrArray
);
122 virtual void Insert( SvSlotElementList
&, const ByteString
& rPrefix
,
124 virtual void WriteHelpId( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
126 virtual void WriteSrc( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
128 virtual void WriteCSV( SvIdlDataBase
&, SvStream
& );
129 void FillIDTable(Table
*pIDTable
);
130 ByteString
Compare( SvMetaAttribute
*pAttr
);
133 SV_IMPL_REF(SvMetaAttribute
)
134 SV_IMPL_PERSIST_LIST(SvMetaAttribute
,SvMetaAttribute
*)
137 /******************** class SvType *********************************/
138 enum { CALL_VALUE
, CALL_POINTER
, CALL_REFERENCE
};
139 enum { TYPE_METHOD
, TYPE_STRUCT
, TYPE_BASE
, TYPE_ENUM
, TYPE_UNION
,
140 TYPE_CLASS
, TYPE_POINTER
};
141 class SvMetaType
: public SvMetaExtern
143 SvBOOL aIn
; // Eingangsparameter
144 SvBOOL aOut
; // Returnparameter
145 Svint aCall0
, aCall1
;
147 SvIdentifier aSvName
;
148 SvIdentifier aSbxName
;
149 SvIdentifier aOdlName
;
151 SvIdentifier aBasicPostfix
;
152 SvIdentifier aBasicName
;
153 SvMetaAttributeMemberList
* pAttrList
;
160 void WriteSfxItem( const ByteString
& rItemName
, SvIdlDataBase
& rBase
,
161 SvStream
& rOutStm
);
163 sal_Bool
ReadNamesSvIdl( SvIdlDataBase
& rBase
,
164 SvTokenStream
& rInStm
);
165 virtual void ReadAttributesSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
166 virtual void WriteAttributesSvIdl( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
);
167 virtual void ReadContextSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
168 virtual void WriteContextSvIdl( SvIdlDataBase
&, SvStream
& rOutStm
,
171 virtual void WriteContext( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
173 WriteType
, WriteAttribute
= 0 );
174 virtual void WriteAttributes( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
,
175 WriteType
, WriteAttribute
= 0 );
176 sal_Bool
ReadHeaderSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
177 void WriteHeaderSvIdl( SvIdlDataBase
&, SvStream
& rOutStm
,
181 SV_DECL_META_FACTORY1( SvMetaType
, SvMetaExtern
, 18 )
183 SvMetaType( const ByteString
& rTypeName
, char cParserChar
,
184 const ByteString
& rCName
);
185 SvMetaType( const ByteString
& rTypeName
, const ByteString
& rSbxName
,
186 const ByteString
& rOdlName
, char cParserChar
,
187 const ByteString
& rCName
, const ByteString
& rBasicName
,
188 const ByteString
& rBasicPostfix
/*, SbxDataType nT = SbxEMPTY */);
190 SvMetaAttributeMemberList
& GetAttrList() const;
191 sal_uLong
GetAttrCount() const
193 return pAttrList
? pAttrList
->Count() : 0L;
195 void AppendAttr( SvMetaAttribute
* pAttr
)
197 GetAttrList().Append( pAttr
);
200 void SetType( int nT
);
201 int GetType() const { return nType
; }
202 SvMetaType
* GetBaseType() const;
203 SvMetaType
* GetReturnType() const;
204 sal_Bool
IsItem() const { return bIsItem
; }
205 sal_Bool
IsShell() const { return bIsShell
; }
207 // void SetSbxDataType( SbxDataType nT )
208 // { aSbxDataType = (int)nT; }
209 // SbxDataType GetSbxDataType() const;
211 void SetIn( sal_Bool b
) { aIn
= b
; }
212 sal_Bool
GetIn() const;
214 void SetOut( sal_Bool b
) { aOut
= b
; }
215 sal_Bool
GetOut() const;
217 void SetCall0( int e
);
218 int GetCall0() const;
220 void SetCall1( int e
);
221 int GetCall1() const;
223 void SetBasicName(const ByteString
& rName
)
224 { aBasicName
= rName
; }
226 const ByteString
& GetBasicName() const;
227 ByteString
GetBasicPostfix() const;
228 const ByteString
& GetSvName() const;
229 const ByteString
& GetSbxName() const;
230 const ByteString
& GetOdlName() const;
231 const ByteString
& GetCName() const;
232 char GetParserChar() const { return cParserChar
; }
234 virtual sal_Bool
SetName( const ByteString
& rName
, SvIdlDataBase
* = NULL
);
236 // void FillSbxObject( SbxVariable * pObj, sal_Bool bVariable );
239 virtual sal_Bool
ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
240 virtual void WriteSvIdl( SvIdlDataBase
& rBase
,
241 SvStream
& rOutStm
, sal_uInt16 nTab
);
242 virtual void Write( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
,
243 WriteType
, WriteAttribute
= 0 );
244 ByteString
GetCString() const;
245 void WriteSvIdlType( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
);
246 void WriteOdlType( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
);
247 void AppendParserString (ByteString
&rString
);
249 sal_uLong
MakeSfx( ByteString
* pAtrrArray
);
250 virtual void WriteSfx( SvIdlDataBase
& rBase
, SvStream
& rOutStm
);
251 //sal_Bool ReadTypePrefix( SvIdlDataBase &, SvTokenStream & rInStm );
252 sal_Bool
ReadMethodArgs( SvIdlDataBase
& rBase
,
253 SvTokenStream
& rInStm
);
254 void WriteTypePrefix( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
, WriteType
);
255 void WriteMethodArgs( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
, WriteType
);
256 void WriteTheType( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
, WriteType
);
257 ByteString
GetParserString() const;
258 void WriteParamNames( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
259 const ByteString
& rChief
);
262 SV_IMPL_REF(SvMetaType
)
263 DECLARE_LIST(SvMetaTypeList
,SvMetaType
*)
264 SV_DECL_IMPL_PERSIST_LIST(SvMetaType
,SvMetaType
*)
267 /******************** class SvTypeString *********************************/
268 class SvMetaTypeString
: public SvMetaType
271 SV_DECL_META_FACTORY1( SvMetaTypeString
, SvMetaType
, 19 )
274 SV_DECL_IMPL_REF(SvMetaTypeString
)
275 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypeString
,SvMetaTypeString
*)
278 /******************** class SvMetaEnumValue **********************************/
279 class SvMetaEnumValue
: public SvMetaName
281 ByteString aEnumValue
;
283 SV_DECL_META_FACTORY1( SvMetaEnumValue
, SvMetaName
, 20 )
287 virtual sal_Bool
ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
288 virtual void WriteSvIdl( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
);
289 virtual void Write( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
,
290 WriteType
, WriteAttribute
= 0 );
293 SV_DECL_IMPL_REF(SvMetaEnumValue
)
294 SV_DECL_IMPL_PERSIST_LIST(SvMetaEnumValue
,SvMetaEnumValue
*)
297 /******************** class SvTypeEnum *********************************/
298 class SvMetaTypeEnum
: public SvMetaType
300 SvMetaEnumValueMemberList aEnumValueList
;
304 virtual void ReadContextSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
305 virtual void WriteContextSvIdl( SvIdlDataBase
&, SvStream
& rOutStm
,
307 virtual void WriteContext( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
,
308 WriteType
, WriteAttribute
= 0 );
311 SV_DECL_META_FACTORY1( SvMetaTypeEnum
, SvMetaType
, 21 )
314 sal_uInt16
GetMaxValue() const;
315 sal_uLong
Count() const { return aEnumValueList
.Count(); }
316 const ByteString
& GetPrefix() const { return aPrefix
; }
317 SvMetaEnumValue
* GetObject( sal_uLong n
) const
318 { return aEnumValueList
.GetObject( n
); }
321 virtual sal_Bool
ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
322 virtual void WriteSvIdl( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
);
324 virtual void Write( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
326 WriteType
, WriteAttribute
= 0 );
329 SV_DECL_IMPL_REF(SvMetaTypeEnum
)
330 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypeEnum
,SvMetaTypeEnum
*)
333 /******************** class SvTypeVoid ***********************************/
334 class SvMetaTypevoid
: public SvMetaType
337 SV_DECL_META_FACTORY1( SvMetaTypevoid
, SvMetaName
, 22 )
340 SV_DECL_IMPL_REF(SvMetaTypevoid
)
341 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypevoid
,SvMetaTypevoid
*)