Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_IDL_INC_BASOBJ_HXX
21 : #define INCLUDED_IDL_INC_BASOBJ_HXX
22 :
23 : #include <tools/ref.hxx>
24 : #include <bastype.hxx>
25 : #include <tools/pstm.hxx>
26 :
27 : class SvTokenStream;
28 : class SvMetaObject;
29 : class SvIdlDataBase;
30 :
31 : typedef SvMetaObject * (*CreateMetaObjectType)();
32 : #define IDL_WRITE_COMPILER 0x8000
33 : #define IDL_WRITE_BROWSER 0x4000
34 : #define IDL_WRITE_CALLING 0x2000
35 : #define IDL_WRITE_MASK 0xE000
36 :
37 : #define C_PREF "C_"
38 :
39 68 : class SvMetaObject : public SvRttiBase
40 : {
41 : public:
42 : TYPEINFO_OVERRIDE();
43 : SvMetaObject();
44 :
45 : static void WriteTab( SvStream & rOutStm, sal_uInt16 nTab );
46 : static void Back2Delemitter( SvStream & );
47 : static void WriteStars( SvStream & );
48 :
49 : virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
50 :
51 : protected:
52 30157 : virtual ~SvMetaObject() {}
53 : };
54 : typedef tools::SvRef<SvMetaObject> SvMetaObjectRef;
55 :
56 16 : class SvMetaObjectMemberList : public SvRefMemberList<SvMetaObject *> {};
57 :
58 8 : class SvMetaObjectMemberStack
59 : {
60 : SvMetaObjectMemberList aList;
61 : public:
62 8 : SvMetaObjectMemberStack() {;}
63 :
64 8 : void Push( SvMetaObject * pObj )
65 8 : { aList.push_back( pObj ); }
66 8 : SvMetaObject * Pop() { return aList.pop_back(); }
67 : SvMetaObject * Top() const { return aList.back(); }
68 : void Clear() { aList.clear(); }
69 : sal_uLong Count() const { return aList.size(); }
70 :
71 3363 : SvMetaObject * Get( TypeId nType )
72 : {
73 3363 : for( SvMetaObjectMemberList::reverse_iterator it = aList.rbegin(); it != aList.rend(); ++it )
74 3363 : if( (*it)->IsA( nType ) )
75 3363 : return *it;
76 0 : return NULL;
77 : }
78 : };
79 :
80 30225 : class SvMetaName : public SvMetaObject
81 : {
82 : SvString aName;
83 : SvHelpContext aHelpContext;
84 : SvHelpText aHelpText;
85 : SvString aConfigName;
86 : SvString aDescription;
87 :
88 : protected:
89 : virtual bool ReadNameSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
90 : void DoReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm,
91 : char c = '\0' );
92 : virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
93 : virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase,
94 : SvTokenStream & rInStm );
95 : public:
96 : TYPEINFO_OVERRIDE();
97 : SvMetaName();
98 :
99 : virtual bool SetName( const OString& rName, SvIdlDataBase * = NULL );
100 : void SetDescription( const OString& rText )
101 : { aDescription.setString(rText); }
102 5912 : const SvHelpContext& GetHelpContext() const { return aHelpContext; }
103 6124439 : virtual const SvString & GetName() const { return aName; }
104 0 : virtual const SvString & GetHelpText() const { return aHelpText; }
105 0 : virtual const SvString & GetConfigName() const{ return aConfigName; }
106 0 : virtual const SvString& GetDescription() const{ return aDescription; }
107 :
108 : virtual bool Test( SvIdlDataBase &, SvTokenStream & rInStm );
109 : virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
110 : };
111 : typedef tools::SvRef<SvMetaName> SvMetaNameRef;
112 :
113 : class SvMetaNameMemberList : public SvRefMemberList<SvMetaName *> {};
114 :
115 : class SvMetaReference;
116 : typedef tools::SvRef<SvMetaReference> SvMetaReferenceRef;
117 28526 : class SvMetaReference : public SvMetaName
118 : {
119 : protected:
120 : SvMetaReferenceRef aRef;
121 : public:
122 : TYPEINFO_OVERRIDE();
123 : SvMetaReference();
124 :
125 3629393 : const SvString & GetName() const SAL_OVERRIDE
126 : {
127 3629393 : return ( !aRef.Is()
128 2493430 : || !SvMetaName::GetName().getString().isEmpty() )
129 3629393 : ? SvMetaName::GetName()
130 7258786 : : aRef->GetName();
131 : }
132 :
133 0 : const SvString & GetHelpText() const SAL_OVERRIDE
134 : {
135 0 : return ( !aRef.Is()
136 0 : || !SvMetaName::GetHelpText().getString().isEmpty() )
137 0 : ? SvMetaName::GetHelpText()
138 0 : : aRef->GetHelpText();
139 : }
140 :
141 0 : const SvString & GetConfigName() const SAL_OVERRIDE
142 : {
143 0 : return ( !aRef.Is()
144 0 : || !SvMetaName::GetConfigName().getString().isEmpty() )
145 0 : ? SvMetaName::GetConfigName()
146 0 : : aRef->GetConfigName();
147 : }
148 :
149 0 : const SvString & GetDescription() const SAL_OVERRIDE
150 : {
151 0 : return ( !aRef.Is()
152 0 : || !SvMetaName::GetDescription().getString().isEmpty() )
153 0 : ? SvMetaName::GetDescription()
154 0 : : aRef->GetDescription();
155 : }
156 2687529 : SvMetaReference * GetRef() const { return aRef; }
157 9642 : void SetRef( SvMetaReference * pRef )
158 9642 : { aRef = pRef; }
159 : };
160 :
161 : class SvMetaReferenceMemberList : public SvRefMemberList<SvMetaReference *> {};
162 :
163 :
164 : class SvMetaModule;
165 6380 : class SvMetaExtern : public SvMetaReference
166 : {
167 : SvMetaModule * pModule; // included in which module
168 :
169 : SvUUId aUUId;
170 : SvVersion aVersion;
171 : bool bReadUUId;
172 : bool bReadVersion;
173 : public:
174 : TYPEINFO_OVERRIDE();
175 : SvMetaExtern();
176 :
177 : SvMetaModule * GetModule() const;
178 :
179 : const SvGlobalName &GetUUId() const;
180 : const SvVersion & GetVersion() const { return aVersion; }
181 : void SetModule( SvIdlDataBase & rBase );
182 : virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
183 :
184 : protected:
185 : virtual void ReadAttributesSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
186 : };
187 : typedef tools::SvRef<SvMetaExtern> SvMetaExternRef;
188 :
189 : class SvMetaExternMemberList : public SvRefMemberList<SvMetaExtern *> {};
190 :
191 : #endif // INCLUDED_IDL_INC_BASOBJ_HXX
192 :
193 :
194 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|