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 .
20 #ifndef INCLUDED_IDL_INC_TYPES_HXX
21 #define INCLUDED_IDL_INC_TYPES_HXX
23 #include <rtl/strbuf.hxx>
24 #include <tools/ref.hxx>
28 typedef std::vector
< SvSlotElement
* > SvSlotElementList
;
33 typedef tools::SvRef
<SvMetaType
> SvMetaTypeRef
;
35 class SvMetaAttribute
: public SvMetaReference
38 SvNumberIdentifier aSlotId
;
48 virtual void ReadAttributesSvIdl( SvIdlDataBase
& rBase
,
49 SvTokenStream
& rInStm
) SAL_OVERRIDE
;
53 SvMetaAttribute( SvMetaType
* );
55 void SetNewAttribute( bool bNew
)
57 bool IsNewAttribute() const
59 bool GetReadonly() const;
61 void SetSlotId( const SvNumberIdentifier
& rId
)
63 const SvNumberIdentifier
& GetSlotId() const;
65 void SetExport( bool bSet
)
67 bool GetExport() const;
69 void SetHidden( bool bSet
)
71 bool GetHidden() const;
73 void SetAutomation( bool bSet
)
74 { aAutomation
= bSet
; }
75 bool GetAutomation() const;
77 void SetIsCollection( bool bSet
)
78 { aIsCollection
= bSet
; }
79 bool GetIsCollection() const;
80 void SetReadOnlyDoc( bool bSet
)
81 { aReadOnlyDoc
= bSet
; }
82 bool GetReadOnlyDoc() const;
84 void SetType( SvMetaType
* pT
) { aType
= pT
; }
85 SvMetaType
* GetType() const;
87 virtual bool IsMethod() const;
88 virtual bool IsVariable() const;
89 virtual OString
GetMangleName( bool bVariable
) const;
92 virtual bool Test( SvIdlDataBase
&, SvTokenStream
& rInStm
) SAL_OVERRIDE
;
93 virtual bool ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
) SAL_OVERRIDE
;
94 sal_uLong
MakeSfx( OStringBuffer
& rAtrrArray
);
95 virtual void Insert( SvSlotElementList
&, const OString
& rPrefix
,
97 OString
Compare( SvMetaAttribute
*pAttr
);
100 typedef tools::SvRef
<SvMetaAttribute
> SvMetaAttributeRef
;
102 class SvMetaAttributeMemberList
: public SvRefMemberList
<SvMetaAttribute
*> {};
104 enum { CALL_VALUE
, CALL_POINTER
, CALL_REFERENCE
};
105 enum { TYPE_METHOD
, TYPE_STRUCT
, TYPE_BASE
, TYPE_ENUM
, TYPE_UNION
,
106 TYPE_CLASS
, TYPE_POINTER
};
107 class SvMetaType
: public SvMetaExtern
109 SvBOOL aIn
; // input parameter
110 SvBOOL aOut
; // return parameter
111 Svint aCall0
, aCall1
;
113 SvIdentifier aSvName
;
114 SvIdentifier aSbxName
;
115 SvIdentifier aOdlName
;
117 SvIdentifier aBasicPostfix
;
118 SvIdentifier aBasicName
;
119 SvMetaAttributeMemberList
* pAttrList
;
125 void WriteSfxItem( const OString
& rItemName
, SvIdlDataBase
& rBase
,
126 SvStream
& rOutStm
);
128 bool ReadNamesSvIdl( SvIdlDataBase
& rBase
,
129 SvTokenStream
& rInStm
);
130 virtual void ReadAttributesSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
) SAL_OVERRIDE
;
131 virtual void ReadContextSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
) SAL_OVERRIDE
;
133 bool ReadHeaderSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
137 SvMetaType( const OString
& rTypeName
, char cParserChar
,
138 const OString
& rCName
);
139 SvMetaType( const OString
& rTypeName
, const OString
& rSbxName
,
140 const OString
& rOdlName
, char cParserChar
,
141 const OString
& rCName
, const OString
& rBasicName
,
142 const OString
& rBasicPostfix
);
144 virtual ~SvMetaType();
146 SvMetaAttributeMemberList
& GetAttrList() const;
147 sal_uLong
GetAttrCount() const
149 return pAttrList
? pAttrList
->size() : 0L;
151 void AppendAttr( SvMetaAttribute
* pAttr
)
153 GetAttrList().push_back( pAttr
);
156 void SetType( int nT
);
157 int GetType() const { return nType
; }
158 SvMetaType
* GetBaseType() const;
159 SvMetaType
* GetReturnType() const;
160 bool IsItem() const { return bIsItem
; }
161 bool IsShell() const { return bIsShell
; }
163 void SetIn( bool b
) { aIn
= b
; }
166 void SetOut( bool b
) { aOut
= b
; }
169 void SetCall0( int e
);
170 int GetCall0() const;
172 void SetCall1( int e
);
173 int GetCall1() const;
175 void SetBasicName(const OString
& rName
)
176 { aBasicName
.setString(rName
); }
178 const OString
& GetBasicName() const;
179 const OString
& GetSvName() const;
180 const OString
& GetSbxName() const;
181 const OString
& GetOdlName() const;
182 const OString
& GetCName() const;
183 char GetParserChar() const { return cParserChar
; }
185 virtual bool SetName( const OString
& rName
, SvIdlDataBase
* = NULL
) SAL_OVERRIDE
;
188 virtual bool ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
) SAL_OVERRIDE
;
190 sal_uLong
MakeSfx( OStringBuffer
& rAtrrArray
);
191 virtual void WriteSfx( SvIdlDataBase
& rBase
, SvStream
& rOutStm
);
192 bool ReadMethodArgs( SvIdlDataBase
& rBase
,
193 SvTokenStream
& rInStm
);
194 OString
GetParserString() const;
197 class SvMetaTypeMemberList
: public SvRefMemberList
<SvMetaType
*> {};
199 class SvMetaTypeString
: public SvMetaType
206 class SvMetaTypeStringMemberList
: public SvRefMemberList
<SvMetaTypeString
*> {};
208 class SvMetaEnumValue
: public SvMetaName
214 virtual bool ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
) SAL_OVERRIDE
;
216 typedef tools::SvRef
<SvMetaEnumValue
> SvMetaEnumValueRef
;
218 class SvMetaEnumValueMemberList
: public SvRefMemberList
<SvMetaEnumValue
*> {};
220 class SvMetaTypeEnum
: public SvMetaType
222 SvMetaEnumValueMemberList aEnumValueList
;
225 virtual void ReadContextSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
) SAL_OVERRIDE
;
230 sal_uInt16
GetMaxValue() const;
231 sal_uLong
Count() const { return aEnumValueList
.size(); }
232 const OString
& GetPrefix() const { return aPrefix
; }
233 SvMetaEnumValue
* GetObject( sal_uLong n
) const
234 { return aEnumValueList
[n
]; }
236 virtual bool ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
) SAL_OVERRIDE
;
238 typedef tools::SvRef
<SvMetaTypeEnum
> SvMetaTypeEnumRef
;
240 class SvMetaTypeEnumMemberList
: public SvRefMemberList
<SvMetaTypeEnum
*> {};
242 class SvMetaTypevoid
: public SvMetaType
248 class SvMetaTypevoidMemberList
: public SvRefMemberList
<SvMetaTypevoid
*> {};
251 #endif // INCLUDED_IDL_INC_TYPES_HXX
253 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */