1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
23 #include <rtl/strbuf.hxx>
24 #include <tools/ref.hxx>
29 typedef std::vector
< SvSlotElement
* > SvSlotElementList
;
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
42 SvNumberIdentifier aSlotId
;
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
);
63 SV_DECL_META_FACTORY1( SvMetaAttribute
, SvMetaReference
, 2 )
65 SvMetaAttribute( SvMetaType
* );
67 void SetNewAttribute( sal_Bool bNew
)
69 sal_Bool
IsNewAttribute() const
71 sal_Bool
GetReadonly() const;
73 void SetSlotId( const SvNumberIdentifier
& rId
)
75 const SvNumberIdentifier
& GetSlotId() const;
77 void SetExport( sal_Bool bSet
)
79 sal_Bool
GetExport() const;
81 void SetHidden( sal_Bool 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
,
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
,
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
;
135 SvIdentifier aSvName
;
136 SvIdentifier aSbxName
;
137 SvIdentifier aOdlName
;
139 SvIdentifier aBasicPostfix
;
140 SvIdentifier aBasicName
;
141 SvMetaAttributeMemberList
* pAttrList
;
147 void WriteSfxItem( const OString
& rItemName
, SvIdlDataBase
& rBase
,
148 SvStream
& rOutStm
);
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
,
158 virtual void WriteContext( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
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
,
167 SV_DECL_META_FACTORY1( SvMetaType
, SvMetaExtern
, 18 )
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
246 SV_DECL_META_FACTORY1( SvMetaTypeString
, SvMetaType
, 19 )
249 SV_DECL_IMPL_REF(SvMetaTypeString
)
251 class SvMetaTypeStringMemberList
: public SvDeclPersistList
<SvMetaTypeString
*> {};
253 class SvMetaEnumValue
: public SvMetaName
257 SV_DECL_META_FACTORY1( SvMetaEnumValue
, SvMetaName
, 20 )
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
;
274 virtual void ReadContextSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
275 virtual void WriteContextSvIdl( SvIdlDataBase
&, SvStream
& rOutStm
,
277 virtual void WriteContext( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
,
278 WriteType
, WriteAttribute
= 0 );
280 SV_DECL_META_FACTORY1( SvMetaTypeEnum
, SvMetaType
, 21 )
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
,
294 WriteType
, WriteAttribute
= 0 );
296 SV_DECL_IMPL_REF(SvMetaTypeEnum
)
298 class SvMetaTypeEnumMemberList
: public SvDeclPersistList
<SvMetaTypeEnum
*> {};
300 class SvMetaTypevoid
: public SvMetaType
303 SV_DECL_META_FACTORY1( SvMetaTypevoid
, SvMetaName
, 22 )
306 SV_DECL_IMPL_REF(SvMetaTypevoid
)
307 class SvMetaTypevoidMemberList
: public SvDeclPersistList
<SvMetaTypevoid
*> {};
312 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */