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 : class SvMetaType;
35 : typedef tools::SvRef<SvMetaType> SvMetaTypeRef;
36 :
37 0 : class SvMetaAttribute : public SvMetaReference
38 : {
39 : SvMetaTypeRef aType;
40 : SvNumberIdentifier aSlotId;
41 : SvBOOL aAutomation;
42 : SvBOOL aExport;
43 : SvBOOL aReadonly;
44 : SvBOOL aIsCollection;
45 : SvBOOL aReadOnlyDoc;
46 : SvBOOL aHidden;
47 : sal_Bool bNewAttr;
48 :
49 : protected:
50 : virtual void WriteCSource( SvIdlDataBase & rBase,
51 : SvStream & rOutStm, sal_Bool bSet );
52 : sal_uLong MakeSlotValue( SvIdlDataBase & rBase, sal_Bool bVariable ) const;
53 : virtual void WriteAttributes( SvIdlDataBase & rBase,
54 : SvStream & rOutStm, sal_uInt16 nTab,
55 : WriteType, WriteAttribute = 0 ) SAL_OVERRIDE;
56 : virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase,
57 : SvTokenStream & rInStm ) SAL_OVERRIDE;
58 : virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase,
59 : SvStream & rOutStm, sal_uInt16 nTab ) SAL_OVERRIDE;
60 : public:
61 0 : SV_DECL_META_FACTORY1( SvMetaAttribute, SvMetaReference, 2 )
62 : SvMetaAttribute();
63 : SvMetaAttribute( SvMetaType * );
64 :
65 0 : void SetNewAttribute( sal_Bool bNew )
66 0 : { bNewAttr = bNew; }
67 0 : sal_Bool IsNewAttribute() const
68 0 : { return bNewAttr; }
69 : sal_Bool GetReadonly() const;
70 :
71 0 : void SetSlotId( const SvNumberIdentifier & rId )
72 0 : { aSlotId = rId; }
73 : const SvNumberIdentifier & GetSlotId() const;
74 :
75 : void SetExport( sal_Bool bSet )
76 : { aExport = bSet; }
77 : sal_Bool GetExport() const;
78 :
79 : void SetHidden( sal_Bool bSet )
80 : { aHidden = bSet; }
81 : sal_Bool GetHidden() const;
82 :
83 : void SetAutomation( sal_Bool bSet )
84 : { aAutomation = bSet; }
85 : sal_Bool GetAutomation() const;
86 :
87 : void SetIsCollection( sal_Bool bSet )
88 : { aIsCollection = bSet; }
89 : sal_Bool GetIsCollection() const;
90 : void SetReadOnlyDoc( sal_Bool bSet )
91 : { aReadOnlyDoc = bSet; }
92 : sal_Bool GetReadOnlyDoc() const;
93 :
94 : void SetType( SvMetaType * pT ) { aType = pT; }
95 : SvMetaType * GetType() const;
96 :
97 : virtual sal_Bool IsMethod() const;
98 : virtual sal_Bool IsVariable() const;
99 : virtual OString GetMangleName( sal_Bool bVariable ) const;
100 :
101 :
102 : virtual sal_Bool Test( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
103 : virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
104 : virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab ) SAL_OVERRIDE;
105 : virtual void WriteParam( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
106 : WriteType );
107 : void WriteRecursiv_Impl( SvIdlDataBase & rBase,
108 : SvStream & rOutStm, sal_uInt16 nTab,
109 : WriteType, WriteAttribute );
110 : virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
111 : WriteType, WriteAttribute = 0 ) SAL_OVERRIDE;
112 : sal_uLong MakeSfx( OStringBuffer& rAtrrArray );
113 : virtual void Insert( SvSlotElementList&, const OString& rPrefix,
114 : SvIdlDataBase& );
115 : virtual void WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
116 : HelpIdTable& rIdTable );
117 : virtual void WriteCSV( SvIdlDataBase&, SvStream& );
118 : void FillIDTable(HelpIdTable& rIDTable);
119 : OString Compare( SvMetaAttribute *pAttr );
120 : };
121 :
122 : typedef tools::SvRef<SvMetaAttribute> SvMetaAttributeRef;
123 :
124 0 : class SvMetaAttributeMemberList : public SvDeclPersistList<SvMetaAttribute *> {};
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 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 ) SAL_OVERRIDE;
153 : virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab ) SAL_OVERRIDE;
154 : virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
155 : virtual void WriteContextSvIdl( SvIdlDataBase &, SvStream & rOutStm,
156 : sal_uInt16 nTab ) SAL_OVERRIDE;
157 :
158 : virtual void WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm,
159 : sal_uInt16 nTab,
160 : WriteType, WriteAttribute = 0 ) SAL_OVERRIDE;
161 : virtual void WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
162 : WriteType, WriteAttribute = 0 ) SAL_OVERRIDE;
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 OString& rTypeName, char cParserChar,
170 : const OString& rCName );
171 : SvMetaType( const OString& rTypeName, const OString& rSbxName,
172 : const OString& rOdlName, char cParserChar,
173 : const OString& rCName, const OString& rBasicName,
174 : const 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 OString& rName)
206 0 : { aBasicName.setString(rName); }
207 :
208 : const OString& GetBasicName() const;
209 : OString GetBasicPostfix() const;
210 : const OString& GetSvName() const;
211 : const OString& GetSbxName() const;
212 : const OString& GetOdlName() const;
213 : const OString& GetCName() const;
214 0 : char GetParserChar() const { return cParserChar; }
215 :
216 : virtual sal_Bool SetName( const OString& rName, SvIdlDataBase * = NULL ) SAL_OVERRIDE;
217 :
218 :
219 : virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
220 : virtual void WriteSvIdl( SvIdlDataBase & rBase,
221 : SvStream & rOutStm, sal_uInt16 nTab ) SAL_OVERRIDE;
222 : virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
223 : WriteType, WriteAttribute = 0 ) SAL_OVERRIDE;
224 : 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( 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 : OString GetParserString() const;
236 : void WriteParamNames( SvIdlDataBase & rBase, SvStream & rOutStm,
237 : const OString& rChief );
238 : };
239 :
240 0 : class SvMetaTypeMemberList : public SvDeclPersistList<SvMetaType *> {};
241 :
242 0 : class SvMetaTypeString : public SvMetaType
243 : {
244 : public:
245 0 : SV_DECL_META_FACTORY1( SvMetaTypeString, SvMetaType, 19 )
246 : SvMetaTypeString();
247 : };
248 : typedef tools::SvRef<SvMetaTypeString> SvMetaTypeStringRef;
249 :
250 : class SvMetaTypeStringMemberList : public SvDeclPersistList<SvMetaTypeString *> {};
251 :
252 0 : class SvMetaEnumValue : public SvMetaName
253 : {
254 : OString aEnumValue;
255 : public:
256 0 : SV_DECL_META_FACTORY1( SvMetaEnumValue, SvMetaName, 20 )
257 : SvMetaEnumValue();
258 :
259 : virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
260 : virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab ) SAL_OVERRIDE;
261 : virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
262 : WriteType, WriteAttribute = 0 ) SAL_OVERRIDE;
263 : };
264 : typedef tools::SvRef<SvMetaEnumValue> SvMetaEnumValueRef;
265 :
266 0 : class SvMetaEnumValueMemberList : public SvDeclPersistList<SvMetaEnumValue *> {};
267 :
268 0 : class SvMetaTypeEnum : public SvMetaType
269 : {
270 : SvMetaEnumValueMemberList aEnumValueList;
271 : OString aPrefix;
272 : protected:
273 : virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
274 : virtual void WriteContextSvIdl( SvIdlDataBase &, SvStream & rOutStm,
275 : sal_uInt16 nTab ) SAL_OVERRIDE;
276 : virtual void WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
277 : WriteType, WriteAttribute = 0 ) SAL_OVERRIDE;
278 : public:
279 0 : SV_DECL_META_FACTORY1( SvMetaTypeEnum, SvMetaType, 21 )
280 : SvMetaTypeEnum();
281 :
282 : sal_uInt16 GetMaxValue() const;
283 0 : sal_uLong Count() const { return aEnumValueList.size(); }
284 0 : const OString& GetPrefix() const { return aPrefix; }
285 0 : SvMetaEnumValue * GetObject( sal_uLong n ) const
286 0 : { return aEnumValueList[n]; }
287 :
288 : virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
289 : virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab ) SAL_OVERRIDE;
290 :
291 : virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm,
292 : sal_uInt16 nTab,
293 : WriteType, WriteAttribute = 0 ) SAL_OVERRIDE;
294 : };
295 : typedef tools::SvRef<SvMetaTypeEnum> SvMetaTypeEnumRef;
296 :
297 : class SvMetaTypeEnumMemberList : public SvDeclPersistList<SvMetaTypeEnum *> {};
298 :
299 0 : class SvMetaTypevoid : public SvMetaType
300 : {
301 : public:
302 0 : SV_DECL_META_FACTORY1( SvMetaTypevoid, SvMetaName, 22 )
303 : SvMetaTypevoid();
304 : };
305 : typedef tools::SvRef<SvMetaTypevoid> SvMetaTypevoidRef;
306 : class SvMetaTypevoidMemberList : public SvDeclPersistList<SvMetaTypevoid *> {};
307 :
308 :
309 : #endif // _TYPES_HXX
310 :
311 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|