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_BASOBJ_HXX
21 #define INCLUDED_IDL_INC_BASOBJ_HXX
23 #include <tools/ref.hxx>
24 #include <bastype.hxx>
25 #include <tools/pstm.hxx>
31 typedef SvMetaObject
* (*CreateMetaObjectType
)();
35 class SvMetaObject
: public SvRttiBase
41 static void WriteTab( SvStream
& rOutStm
, sal_uInt16 nTab
);
42 static void Back2Delemitter( SvStream
& );
43 static void WriteStars( SvStream
& );
45 virtual bool ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
48 virtual ~SvMetaObject() {}
51 class SvMetaObjectMemberList
: public SvRefMemberList
<SvMetaObject
*> {};
53 class SvMetaObjectMemberStack
55 SvMetaObjectMemberList aList
;
57 SvMetaObjectMemberStack() {;}
59 void Push( SvMetaObject
* pObj
)
60 { aList
.push_back( pObj
); }
61 SvMetaObject
* Pop() { return aList
.pop_back(); }
62 SvMetaObject
* Top() const { return aList
.back(); }
63 void Clear() { aList
.clear(); }
64 sal_uLong
Count() const { return aList
.size(); }
66 SvMetaObject
* Get( TypeId nType
)
68 for( SvMetaObjectMemberList::reverse_iterator it
= aList
.rbegin(); it
!= aList
.rend(); ++it
)
69 if( (*it
)->IsA( nType
) )
75 class SvMetaName
: public SvMetaObject
78 SvHelpContext aHelpContext
;
81 SvString aDescription
;
84 bool ReadNameSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
85 void DoReadContextSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
,
87 virtual void ReadContextSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
88 virtual void ReadAttributesSvIdl( SvIdlDataBase
& rBase
,
89 SvTokenStream
& rInStm
);
94 virtual bool SetName( const OString
& rName
, SvIdlDataBase
* = NULL
);
95 void SetDescription( const OString
& rText
)
96 { aDescription
.setString(rText
); }
97 const SvHelpContext
& GetHelpContext() const { return aHelpContext
; }
98 virtual const SvString
& GetName() const { return aName
; }
99 virtual const SvString
& GetHelpText() const { return aHelpText
; }
100 virtual const SvString
& GetConfigName() const{ return aConfigName
; }
101 virtual const SvString
& GetDescription() const{ return aDescription
; }
103 virtual bool Test( SvIdlDataBase
&, SvTokenStream
& rInStm
);
104 virtual bool ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
) SAL_OVERRIDE
;
107 class SvMetaNameMemberList
: public SvRefMemberList
<SvMetaName
*> {};
109 class SvMetaReference
;
110 typedef tools::SvRef
<SvMetaReference
> SvMetaReferenceRef
;
111 class SvMetaReference
: public SvMetaName
114 SvMetaReferenceRef aRef
;
119 const SvString
& GetName() const SAL_OVERRIDE
122 || !SvMetaName::GetName().getString().isEmpty() )
123 ? SvMetaName::GetName()
127 const SvString
& GetHelpText() const SAL_OVERRIDE
130 || !SvMetaName::GetHelpText().getString().isEmpty() )
131 ? SvMetaName::GetHelpText()
132 : aRef
->GetHelpText();
135 const SvString
& GetConfigName() const SAL_OVERRIDE
138 || !SvMetaName::GetConfigName().getString().isEmpty() )
139 ? SvMetaName::GetConfigName()
140 : aRef
->GetConfigName();
143 const SvString
& GetDescription() const SAL_OVERRIDE
146 || !SvMetaName::GetDescription().getString().isEmpty() )
147 ? SvMetaName::GetDescription()
148 : aRef
->GetDescription();
150 SvMetaReference
* GetRef() const { return aRef
; }
151 void SetRef( SvMetaReference
* pRef
)
155 class SvMetaReferenceMemberList
: public SvRefMemberList
<SvMetaReference
*> {};
159 class SvMetaExtern
: public SvMetaReference
161 SvMetaModule
* pModule
; // included in which module
171 SvMetaModule
* GetModule() const;
173 const SvGlobalName
&GetUUId() const;
174 const SvVersion
& GetVersion() const { return aVersion
; }
175 void SetModule( SvIdlDataBase
& rBase
);
176 virtual bool ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
) SAL_OVERRIDE
;
179 virtual void ReadAttributesSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
) SAL_OVERRIDE
;
182 class SvMetaExternMemberList
: public SvRefMemberList
<SvMetaExtern
*> {};
184 #endif // INCLUDED_IDL_INC_BASOBJ_HXX
187 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */