Bump version to 4.1-6
[LibreOffice.git] / idl / inc / types.hxx
blob0efc9082e13503eb13646d8c8ffaa058197d7f58
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _TYPES_HXX
21 #define _TYPES_HXX
23 #include <rtl/strbuf.hxx>
24 #include <tools/ref.hxx>
25 #include <basobj.hxx>
26 #include <map>
28 struct SvSlotElement;
29 typedef std::vector< SvSlotElement* > SvSlotElementList;
31 class SvMetaSlot;
32 typedef std::map<sal_uLong, SvMetaSlot*> HelpIdTable;
34 SV_DECL_REF(SvMetaType)
35 SV_DECL_REF(SvMetaAttribute)
37 class SvMetaAttributeMemberList : public SvDeclPersistList<SvMetaAttribute *> {};
39 class SvMetaAttribute : public SvMetaReference
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;
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 SV_DECL_META_FACTORY1( SvMetaAttribute, SvMetaReference, 2 )
64 SvMetaAttribute();
65 SvMetaAttribute( SvMetaType * );
67 void SetNewAttribute( sal_Bool bNew )
68 { bNewAttr = bNew; }
69 sal_Bool IsNewAttribute() const
70 { return bNewAttr; }
71 sal_Bool GetReadonly() const;
73 void SetSlotId( const SvNumberIdentifier & rId )
74 { aSlotId = rId; }
75 const SvNumberIdentifier & GetSlotId() const;
77 void SetExport( sal_Bool bSet )
78 { aExport = bSet; }
79 sal_Bool GetExport() const;
81 void SetHidden( sal_Bool bSet )
82 { aHidden = bSet; }
83 sal_Bool GetHidden() const;
85 void SetAutomation( sal_Bool bSet )
86 { aAutomation = bSet; }
87 sal_Bool GetAutomation() const;
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;
96 void SetType( SvMetaType * pT ) { aType = pT; }
97 SvMetaType * GetType() const;
99 virtual sal_Bool IsMethod() const;
100 virtual sal_Bool IsVariable() const;
101 virtual OString GetMangleName( sal_Bool bVariable ) const;
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( OStringBuffer& rAtrrArray );
115 virtual void Insert( SvSlotElementList&, const 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 OString Compare( SvMetaAttribute *pAttr );
123 SV_IMPL_REF(SvMetaAttribute)
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 class SvMetaType : public SvMetaExtern
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;
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 );
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 );
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 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 );
176 SvMetaAttributeMemberList & GetAttrList() const;
177 sal_uLong GetAttrCount() const
179 return pAttrList ? pAttrList->size() : 0L;
181 void AppendAttr( SvMetaAttribute * pAttr )
183 GetAttrList().push_back( pAttr );
186 void SetType( int nT );
187 int GetType() const { return nType; }
188 SvMetaType * GetBaseType() const;
189 SvMetaType * GetReturnType() const;
190 sal_Bool IsItem() const { return bIsItem; }
191 sal_Bool IsShell() const { return bIsShell; }
193 void SetIn( sal_Bool b ) { aIn = b; }
194 sal_Bool GetIn() const;
196 void SetOut( sal_Bool b ) { aOut = b; }
197 sal_Bool GetOut() const;
199 void SetCall0( int e );
200 int GetCall0() const;
202 void SetCall1( int e);
203 int GetCall1() const;
205 void SetBasicName(const OString& rName)
206 { aBasicName.setString(rName); }
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 char GetParserChar() const { return cParserChar; }
216 virtual sal_Bool SetName( const OString& rName, SvIdlDataBase * = NULL );
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 OString GetCString() const;
225 void WriteSvIdlType( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
226 void WriteOdlType( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
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 );
239 SV_IMPL_REF(SvMetaType)
241 class SvMetaTypeMemberList : public SvDeclPersistList<SvMetaType *> {};
243 class SvMetaTypeString : public SvMetaType
245 public:
246 SV_DECL_META_FACTORY1( SvMetaTypeString, SvMetaType, 19 )
247 SvMetaTypeString();
249 SV_DECL_IMPL_REF(SvMetaTypeString)
251 class SvMetaTypeStringMemberList : public SvDeclPersistList<SvMetaTypeString *> {};
253 class SvMetaEnumValue : public SvMetaName
255 OString aEnumValue;
256 public:
257 SV_DECL_META_FACTORY1( SvMetaEnumValue, SvMetaName, 20 )
258 SvMetaEnumValue();
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 );
265 SV_DECL_IMPL_REF(SvMetaEnumValue)
267 class SvMetaEnumValueMemberList : public SvDeclPersistList<SvMetaEnumValue *> {};
269 class SvMetaTypeEnum : public SvMetaType
271 SvMetaEnumValueMemberList aEnumValueList;
272 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 SV_DECL_META_FACTORY1( SvMetaTypeEnum, SvMetaType, 21 )
281 SvMetaTypeEnum();
283 sal_uInt16 GetMaxValue() const;
284 sal_uLong Count() const { return aEnumValueList.size(); }
285 const OString& GetPrefix() const { return aPrefix; }
286 SvMetaEnumValue * GetObject( sal_uLong n ) const
287 { return aEnumValueList[n]; }
289 virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
290 virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
292 virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm,
293 sal_uInt16 nTab,
294 WriteType, WriteAttribute = 0 );
296 SV_DECL_IMPL_REF(SvMetaTypeEnum)
298 class SvMetaTypeEnumMemberList : public SvDeclPersistList<SvMetaTypeEnum *> {};
300 class SvMetaTypevoid : public SvMetaType
302 public:
303 SV_DECL_META_FACTORY1( SvMetaTypevoid, SvMetaName, 22 )
304 SvMetaTypevoid();
306 SV_DECL_IMPL_REF(SvMetaTypevoid)
307 class SvMetaTypevoidMemberList : public SvDeclPersistList<SvMetaTypevoid *> {};
310 #endif // _TYPES_HXX
312 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */