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 _TYPES_HXX
21 : #define _TYPES_HXX
22 :
23 : #include <rtl/strbuf.hxx>
24 : #include <tools/ref.hxx>
25 : #include <basobj.hxx>
26 : #include <map>
27 :
28 : struct SvSlotElement;
29 : typedef std::vector< SvSlotElement* > SvSlotElementList;
30 :
31 : class SvMetaSlot;
32 : typedef std::map<sal_uLong, SvMetaSlot*> HelpIdTable;
33 :
34 0 : SV_DECL_REF(SvMetaType)
35 0 : SV_DECL_REF(SvMetaAttribute)
36 :
37 0 : class SvMetaAttributeMemberList : public SvDeclPersistList<SvMetaAttribute *> {};
38 :
39 0 : class SvMetaAttribute : public SvMetaReference
40 : {
41 : SvMetaTypeRef aType;
42 : SvNumberIdentifier aSlotId;
43 : SvBOOL aAutomation;
44 : SvBOOL aExport;
45 : SvBOOL aReadonly;
46 : SvBOOL aIsCollection;
47 : SvBOOL aReadOnlyDoc;
48 : SvBOOL aHidden;
49 : sal_Bool bNewAttr;
50 :
51 : protected:
52 : virtual void WriteCSource( SvIdlDataBase & rBase,
53 : SvStream & rOutStm, sal_Bool bSet );
54 : sal_uLong MakeSlotValue( SvIdlDataBase & rBase, sal_Bool bVariable ) const;
55 : virtual void WriteAttributes( SvIdlDataBase & rBase,
56 : SvStream & rOutStm, sal_uInt16 nTab,
57 : WriteType, WriteAttribute = 0 );
58 : virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase,
59 : SvTokenStream & rInStm );
60 : virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase,
61 : SvStream & rOutStm, sal_uInt16 nTab );
62 : public:
63 0 : SV_DECL_META_FACTORY1( SvMetaAttribute, SvMetaReference, 2 )
64 : SvMetaAttribute();
65 : SvMetaAttribute( SvMetaType * );
66 :
67 0 : void SetNewAttribute( sal_Bool bNew )
68 0 : { bNewAttr = bNew; }
69 0 : sal_Bool IsNewAttribute() const
70 0 : { return bNewAttr; }
71 : sal_Bool GetReadonly() const;
72 :
73 0 : void SetSlotId( const SvNumberIdentifier & rId )
74 0 : { aSlotId = rId; }
75 : const SvNumberIdentifier & GetSlotId() const;
76 :
77 : void SetExport( sal_Bool bSet )
78 : { aExport = bSet; }
79 : sal_Bool GetExport() const;
80 :
81 : void SetHidden( sal_Bool bSet )
82 : { aHidden = bSet; }
83 : sal_Bool GetHidden() const;
84 :
85 : void SetAutomation( sal_Bool bSet )
86 : { aAutomation = bSet; }
87 : sal_Bool GetAutomation() const;
88 :
89 : void SetIsCollection( sal_Bool bSet )
90 : { aIsCollection = bSet; }
91 : sal_Bool GetIsCollection() const;
92 : void SetReadOnlyDoc( sal_Bool bSet )
93 : { aReadOnlyDoc = bSet; }
94 : sal_Bool GetReadOnlyDoc() const;
95 :
96 : void SetType( SvMetaType * pT ) { aType = pT; }
97 : SvMetaType * GetType() const;
98 :
99 : virtual sal_Bool IsMethod() const;
100 : virtual sal_Bool IsVariable() const;
101 : virtual rtl::OString GetMangleName( sal_Bool bVariable ) const;
102 :
103 :
104 : virtual sal_Bool Test( SvIdlDataBase &, SvTokenStream & rInStm );
105 : virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
106 : virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
107 : virtual void WriteParam( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
108 : WriteType );
109 : void WriteRecursiv_Impl( SvIdlDataBase & rBase,
110 : SvStream & rOutStm, sal_uInt16 nTab,
111 : WriteType, WriteAttribute );
112 : virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
113 : WriteType, WriteAttribute = 0 );
114 : sal_uLong MakeSfx( rtl::OStringBuffer& rAtrrArray );
115 : virtual void Insert( SvSlotElementList&, const rtl::OString& rPrefix,
116 : SvIdlDataBase& );
117 : virtual void WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
118 : HelpIdTable& rIdTable );
119 : virtual void WriteCSV( SvIdlDataBase&, SvStream& );
120 : void FillIDTable(HelpIdTable& rIDTable);
121 : rtl::OString Compare( SvMetaAttribute *pAttr );
122 : };
123 0 : SV_IMPL_REF(SvMetaAttribute)
124 :
125 :
126 : enum { CALL_VALUE, CALL_POINTER, CALL_REFERENCE };
127 : enum { TYPE_METHOD, TYPE_STRUCT, TYPE_BASE, TYPE_ENUM, TYPE_UNION,
128 : TYPE_CLASS, TYPE_POINTER };
129 0 : class SvMetaType : public SvMetaExtern
130 : {
131 : SvBOOL aIn; // input parameter
132 : SvBOOL aOut; // return parameter
133 : Svint aCall0, aCall1;
134 : Svint aSbxDataType;
135 : SvIdentifier aSvName;
136 : SvIdentifier aSbxName;
137 : SvIdentifier aOdlName;
138 : SvIdentifier aCName;
139 : SvIdentifier aBasicPostfix;
140 : SvIdentifier aBasicName;
141 : SvMetaAttributeMemberList * pAttrList;
142 : int nType;
143 : sal_Bool bIsItem;
144 : sal_Bool bIsShell;
145 : char cParserChar;
146 :
147 : void WriteSfxItem( const rtl::OString& rItemName, SvIdlDataBase & rBase,
148 : SvStream & rOutStm );
149 : protected:
150 : sal_Bool ReadNamesSvIdl( SvIdlDataBase & rBase,
151 : SvTokenStream & rInStm );
152 : virtual void ReadAttributesSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
153 : virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
154 : virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
155 : virtual void WriteContextSvIdl( SvIdlDataBase &, SvStream & rOutStm,
156 : sal_uInt16 nTab );
157 :
158 : virtual void WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm,
159 : sal_uInt16 nTab,
160 : WriteType, WriteAttribute = 0 );
161 : virtual void WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
162 : WriteType, WriteAttribute = 0 );
163 : sal_Bool ReadHeaderSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
164 : void WriteHeaderSvIdl( SvIdlDataBase &, SvStream & rOutStm,
165 : sal_uInt16 nTab );
166 : public:
167 0 : SV_DECL_META_FACTORY1( SvMetaType, SvMetaExtern, 18 )
168 : SvMetaType();
169 : SvMetaType( const rtl::OString& rTypeName, char cParserChar,
170 : const rtl::OString& rCName );
171 : SvMetaType( const rtl::OString& rTypeName, const rtl::OString& rSbxName,
172 : const rtl::OString& rOdlName, char cParserChar,
173 : const rtl::OString& rCName, const rtl::OString& rBasicName,
174 : const rtl::OString& rBasicPostfix );
175 :
176 : SvMetaAttributeMemberList & GetAttrList() const;
177 0 : sal_uLong GetAttrCount() const
178 : {
179 0 : return pAttrList ? pAttrList->size() : 0L;
180 : }
181 : void AppendAttr( SvMetaAttribute * pAttr )
182 : {
183 : GetAttrList().push_back( pAttr );
184 : }
185 :
186 : void SetType( int nT );
187 0 : int GetType() const { return nType; }
188 : SvMetaType * GetBaseType() const;
189 : SvMetaType * GetReturnType() const;
190 0 : sal_Bool IsItem() const { return bIsItem; }
191 0 : sal_Bool IsShell() const { return bIsShell; }
192 :
193 0 : void SetIn( sal_Bool b ) { aIn = b; }
194 : sal_Bool GetIn() const;
195 :
196 0 : void SetOut( sal_Bool b ) { aOut = b; }
197 : sal_Bool GetOut() const;
198 :
199 : void SetCall0( int e );
200 : int GetCall0() const;
201 :
202 : void SetCall1( int e);
203 : int GetCall1() const;
204 :
205 0 : void SetBasicName(const rtl::OString& rName)
206 0 : { aBasicName.setString(rName); }
207 :
208 : const rtl::OString& GetBasicName() const;
209 : rtl::OString GetBasicPostfix() const;
210 : const rtl::OString& GetSvName() const;
211 : const rtl::OString& GetSbxName() const;
212 : const rtl::OString& GetOdlName() const;
213 : const rtl::OString& GetCName() const;
214 0 : char GetParserChar() const { return cParserChar; }
215 :
216 : virtual sal_Bool SetName( const rtl::OString& rName, SvIdlDataBase * = NULL );
217 :
218 :
219 : virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
220 : virtual void WriteSvIdl( SvIdlDataBase & rBase,
221 : SvStream & rOutStm, sal_uInt16 nTab );
222 : virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
223 : WriteType, WriteAttribute = 0 );
224 : rtl::OString GetCString() const;
225 : void WriteSvIdlType( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
226 : void WriteOdlType( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
227 :
228 : sal_uLong MakeSfx( rtl::OStringBuffer& rAtrrArray );
229 : virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm );
230 : sal_Bool ReadMethodArgs( SvIdlDataBase & rBase,
231 : SvTokenStream & rInStm );
232 : void WriteTypePrefix( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab, WriteType );
233 : void WriteMethodArgs( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab, WriteType );
234 : void WriteTheType( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab, WriteType );
235 : rtl::OString GetParserString() const;
236 : void WriteParamNames( SvIdlDataBase & rBase, SvStream & rOutStm,
237 : const rtl::OString& rChief );
238 : };
239 0 : SV_IMPL_REF(SvMetaType)
240 :
241 0 : class SvMetaTypeMemberList : public SvDeclPersistList<SvMetaType *> {};
242 :
243 0 : class SvMetaTypeString : public SvMetaType
244 : {
245 : public:
246 0 : SV_DECL_META_FACTORY1( SvMetaTypeString, SvMetaType, 19 )
247 : SvMetaTypeString();
248 : };
249 : SV_DECL_IMPL_REF(SvMetaTypeString)
250 :
251 : class SvMetaTypeStringMemberList : public SvDeclPersistList<SvMetaTypeString *> {};
252 :
253 0 : class SvMetaEnumValue : public SvMetaName
254 : {
255 : rtl::OString aEnumValue;
256 : public:
257 0 : SV_DECL_META_FACTORY1( SvMetaEnumValue, SvMetaName, 20 )
258 : SvMetaEnumValue();
259 :
260 : virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
261 : virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
262 : virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
263 : WriteType, WriteAttribute = 0 );
264 : };
265 0 : SV_DECL_IMPL_REF(SvMetaEnumValue)
266 :
267 0 : class SvMetaEnumValueMemberList : public SvDeclPersistList<SvMetaEnumValue *> {};
268 :
269 0 : class SvMetaTypeEnum : public SvMetaType
270 : {
271 : SvMetaEnumValueMemberList aEnumValueList;
272 : rtl::OString aPrefix;
273 : protected:
274 : virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
275 : virtual void WriteContextSvIdl( SvIdlDataBase &, SvStream & rOutStm,
276 : sal_uInt16 nTab );
277 : virtual void WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
278 : WriteType, WriteAttribute = 0 );
279 : public:
280 0 : SV_DECL_META_FACTORY1( SvMetaTypeEnum, SvMetaType, 21 )
281 : SvMetaTypeEnum();
282 :
283 : sal_uInt16 GetMaxValue() const;
284 0 : sal_uLong Count() const { return aEnumValueList.size(); }
285 0 : const rtl::OString& GetPrefix() const { return aPrefix; }
286 0 : SvMetaEnumValue * GetObject( sal_uLong n ) const
287 0 : { return aEnumValueList[n]; }
288 :
289 : virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
290 : virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
291 :
292 : virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm,
293 : sal_uInt16 nTab,
294 : WriteType, WriteAttribute = 0 );
295 : };
296 0 : SV_DECL_IMPL_REF(SvMetaTypeEnum)
297 :
298 : class SvMetaTypeEnumMemberList : public SvDeclPersistList<SvMetaTypeEnum *> {};
299 :
300 0 : class SvMetaTypevoid : public SvMetaType
301 : {
302 : public:
303 0 : SV_DECL_META_FACTORY1( SvMetaTypevoid, SvMetaName, 22 )
304 : SvMetaTypevoid();
305 : };
306 : SV_DECL_IMPL_REF(SvMetaTypevoid)
307 : class SvMetaTypevoidMemberList : public SvDeclPersistList<SvMetaTypevoid *> {};
308 :
309 :
310 : #endif // _TYPES_HXX
311 :
312 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|