1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
32 #include <rtl/strbuf.hxx>
33 #include <tools/ref.hxx>
38 typedef std::vector
< SvSlotElement
* > SvSlotElementList
;
41 typedef std::map
<sal_uLong
, SvMetaSlot
*> HelpIdTable
;
43 SV_DECL_REF(SvMetaType
)
44 SV_DECL_REF(SvMetaAttribute
)
45 SV_DECL_PERSIST_LIST(SvMetaAttribute
,SvMetaAttribute
*)
46 class SvMetaAttribute
: public SvMetaReference
49 SvNumberIdentifier aSlotId
;
59 virtual void WriteCSource( SvIdlDataBase
& rBase
,
60 SvStream
& rOutStm
, sal_Bool bSet
);
61 sal_uLong
MakeSlotValue( SvIdlDataBase
& rBase
, sal_Bool bVariable
) const;
62 virtual void WriteAttributes( SvIdlDataBase
& rBase
,
63 SvStream
& rOutStm
, sal_uInt16 nTab
,
64 WriteType
, WriteAttribute
= 0 );
65 virtual void ReadAttributesSvIdl( SvIdlDataBase
& rBase
,
66 SvTokenStream
& rInStm
);
67 virtual void WriteAttributesSvIdl( SvIdlDataBase
& rBase
,
68 SvStream
& rOutStm
, sal_uInt16 nTab
);
70 SV_DECL_META_FACTORY1( SvMetaAttribute
, SvMetaReference
, 2 )
72 SvMetaAttribute( SvMetaType
* );
74 void SetNewAttribute( sal_Bool bNew
)
76 sal_Bool
IsNewAttribute() const
78 sal_Bool
GetReadonly() const;
80 void SetSlotId( const SvNumberIdentifier
& rId
)
82 const SvNumberIdentifier
& GetSlotId() const;
84 void SetExport( sal_Bool bSet
)
86 sal_Bool
GetExport() const;
88 void SetHidden( sal_Bool bSet
)
90 sal_Bool
GetHidden() const;
92 void SetAutomation( sal_Bool bSet
)
93 { aAutomation
= bSet
; }
94 sal_Bool
GetAutomation() const;
96 void SetIsCollection( sal_Bool bSet
)
97 { aIsCollection
= bSet
; }
98 sal_Bool
GetIsCollection() const;
99 void SetReadOnlyDoc( sal_Bool bSet
)
100 { aReadOnlyDoc
= bSet
; }
101 sal_Bool
GetReadOnlyDoc() const;
103 void SetType( SvMetaType
* pT
) { aType
= pT
; }
104 SvMetaType
* GetType() const;
106 virtual sal_Bool
IsMethod() const;
107 virtual sal_Bool
IsVariable() const;
108 virtual rtl::OString
GetMangleName( sal_Bool bVariable
) const;
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( rtl::OStringBuffer
& rAtrrArray
);
122 virtual void Insert( SvSlotElementList
&, const rtl::OString
& rPrefix
,
124 virtual void WriteHelpId( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
125 HelpIdTable
& rIdTable
);
126 virtual void WriteCSV( SvIdlDataBase
&, SvStream
& );
127 void FillIDTable(HelpIdTable
& rIDTable
);
128 rtl::OString
Compare( SvMetaAttribute
*pAttr
);
130 SV_IMPL_REF(SvMetaAttribute
)
131 SV_IMPL_PERSIST_LIST(SvMetaAttribute
,SvMetaAttribute
*)
134 enum { CALL_VALUE
, CALL_POINTER
, CALL_REFERENCE
};
135 enum { TYPE_METHOD
, TYPE_STRUCT
, TYPE_BASE
, TYPE_ENUM
, TYPE_UNION
,
136 TYPE_CLASS
, TYPE_POINTER
};
137 class SvMetaType
: public SvMetaExtern
139 SvBOOL aIn
; // input parameter
140 SvBOOL aOut
; // return parameter
141 Svint aCall0
, aCall1
;
143 SvIdentifier aSvName
;
144 SvIdentifier aSbxName
;
145 SvIdentifier aOdlName
;
147 SvIdentifier aBasicPostfix
;
148 SvIdentifier aBasicName
;
149 SvMetaAttributeMemberList
* pAttrList
;
155 void WriteSfxItem( const rtl::OString
& rItemName
, SvIdlDataBase
& rBase
,
156 SvStream
& rOutStm
);
158 sal_Bool
ReadNamesSvIdl( SvIdlDataBase
& rBase
,
159 SvTokenStream
& rInStm
);
160 virtual void ReadAttributesSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
161 virtual void WriteAttributesSvIdl( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
);
162 virtual void ReadContextSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
163 virtual void WriteContextSvIdl( SvIdlDataBase
&, SvStream
& rOutStm
,
166 virtual void WriteContext( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
168 WriteType
, WriteAttribute
= 0 );
169 virtual void WriteAttributes( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
,
170 WriteType
, WriteAttribute
= 0 );
171 sal_Bool
ReadHeaderSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
172 void WriteHeaderSvIdl( SvIdlDataBase
&, SvStream
& rOutStm
,
175 SV_DECL_META_FACTORY1( SvMetaType
, SvMetaExtern
, 18 )
177 SvMetaType( const rtl::OString
& rTypeName
, char cParserChar
,
178 const rtl::OString
& rCName
);
179 SvMetaType( const rtl::OString
& rTypeName
, const rtl::OString
& rSbxName
,
180 const rtl::OString
& rOdlName
, char cParserChar
,
181 const rtl::OString
& rCName
, const rtl::OString
& rBasicName
,
182 const rtl::OString
& rBasicPostfix
);
184 SvMetaAttributeMemberList
& GetAttrList() const;
185 sal_uLong
GetAttrCount() const
187 return pAttrList
? pAttrList
->Count() : 0L;
189 void AppendAttr( SvMetaAttribute
* pAttr
)
191 GetAttrList().Append( pAttr
);
194 void SetType( int nT
);
195 int GetType() const { return nType
; }
196 SvMetaType
* GetBaseType() const;
197 SvMetaType
* GetReturnType() const;
198 sal_Bool
IsItem() const { return bIsItem
; }
199 sal_Bool
IsShell() const { return bIsShell
; }
201 void SetIn( sal_Bool b
) { aIn
= b
; }
202 sal_Bool
GetIn() const;
204 void SetOut( sal_Bool b
) { aOut
= b
; }
205 sal_Bool
GetOut() const;
207 void SetCall0( int e
);
208 int GetCall0() const;
210 void SetCall1( int e
);
211 int GetCall1() const;
213 void SetBasicName(const rtl::OString
& rName
)
214 { aBasicName
.setString(rName
); }
216 const rtl::OString
& GetBasicName() const;
217 rtl::OString
GetBasicPostfix() const;
218 const rtl::OString
& GetSvName() const;
219 const rtl::OString
& GetSbxName() const;
220 const rtl::OString
& GetOdlName() const;
221 const rtl::OString
& GetCName() const;
222 char GetParserChar() const { return cParserChar
; }
224 virtual sal_Bool
SetName( const rtl::OString
& rName
, SvIdlDataBase
* = NULL
);
227 virtual sal_Bool
ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
228 virtual void WriteSvIdl( SvIdlDataBase
& rBase
,
229 SvStream
& rOutStm
, sal_uInt16 nTab
);
230 virtual void Write( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
,
231 WriteType
, WriteAttribute
= 0 );
232 rtl::OString
GetCString() const;
233 void WriteSvIdlType( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
);
234 void WriteOdlType( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
);
236 sal_uLong
MakeSfx( rtl::OStringBuffer
& rAtrrArray
);
237 virtual void WriteSfx( SvIdlDataBase
& rBase
, SvStream
& rOutStm
);
238 sal_Bool
ReadMethodArgs( SvIdlDataBase
& rBase
,
239 SvTokenStream
& rInStm
);
240 void WriteTypePrefix( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
, WriteType
);
241 void WriteMethodArgs( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
, WriteType
);
242 void WriteTheType( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
, WriteType
);
243 rtl::OString
GetParserString() const;
244 void WriteParamNames( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
245 const rtl::OString
& rChief
);
247 SV_IMPL_REF(SvMetaType
)
248 SV_DECL_IMPL_PERSIST_LIST(SvMetaType
,SvMetaType
*)
251 class SvMetaTypeString
: public SvMetaType
254 SV_DECL_META_FACTORY1( SvMetaTypeString
, SvMetaType
, 19 )
257 SV_DECL_IMPL_REF(SvMetaTypeString
)
258 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypeString
,SvMetaTypeString
*)
261 class SvMetaEnumValue
: public SvMetaName
263 rtl::OString aEnumValue
;
265 SV_DECL_META_FACTORY1( SvMetaEnumValue
, SvMetaName
, 20 )
268 virtual sal_Bool
ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
269 virtual void WriteSvIdl( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
);
270 virtual void Write( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
,
271 WriteType
, WriteAttribute
= 0 );
273 SV_DECL_IMPL_REF(SvMetaEnumValue
)
274 SV_DECL_IMPL_PERSIST_LIST(SvMetaEnumValue
,SvMetaEnumValue
*)
277 class SvMetaTypeEnum
: public SvMetaType
279 SvMetaEnumValueMemberList aEnumValueList
;
280 rtl::OString aPrefix
;
282 virtual void ReadContextSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
283 virtual void WriteContextSvIdl( SvIdlDataBase
&, SvStream
& rOutStm
,
285 virtual void WriteContext( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
,
286 WriteType
, WriteAttribute
= 0 );
288 SV_DECL_META_FACTORY1( SvMetaTypeEnum
, SvMetaType
, 21 )
291 sal_uInt16
GetMaxValue() const;
292 sal_uLong
Count() const { return aEnumValueList
.Count(); }
293 const rtl::OString
& GetPrefix() const { return aPrefix
; }
294 SvMetaEnumValue
* GetObject( sal_uLong n
) const
295 { return aEnumValueList
.GetObject( n
); }
297 virtual sal_Bool
ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
298 virtual void WriteSvIdl( SvIdlDataBase
& rBase
, SvStream
& rOutStm
, sal_uInt16 nTab
);
300 virtual void Write( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
302 WriteType
, WriteAttribute
= 0 );
304 SV_DECL_IMPL_REF(SvMetaTypeEnum
)
305 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypeEnum
,SvMetaTypeEnum
*)
308 class SvMetaTypevoid
: public SvMetaType
311 SV_DECL_META_FACTORY1( SvMetaTypevoid
, SvMetaName
, 22 )
314 SV_DECL_IMPL_REF(SvMetaTypevoid
)
315 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypevoid
,SvMetaTypevoid
*)
320 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */