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 :
33 : #define C_PREF "C_"
34 :
35 68 : class SvMetaObject : public SvRttiBase
36 : {
37 : public:
38 : TYPEINFO_OVERRIDE();
39 : SvMetaObject();
40 :
41 : static void WriteTab( SvStream & rOutStm, sal_uInt16 nTab );
42 : static void Back2Delemitter( SvStream & );
43 : static void WriteStars( SvStream & );
44 :
45 : virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
46 :
47 : protected:
48 30312 : virtual ~SvMetaObject() {}
49 : };
50 :
51 16 : class SvMetaObjectMemberList : public SvRefMemberList<SvMetaObject *> {};
52 :
53 8 : class SvMetaObjectMemberStack
54 : {
55 : SvMetaObjectMemberList aList;
56 : public:
57 8 : SvMetaObjectMemberStack() {;}
58 :
59 8 : void Push( SvMetaObject * pObj )
60 8 : { aList.push_back( pObj ); }
61 8 : 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(); }
65 :
66 3377 : SvMetaObject * Get( TypeId nType )
67 : {
68 3377 : for( SvMetaObjectMemberList::reverse_iterator it = aList.rbegin(); it != aList.rend(); ++it )
69 3377 : if( (*it)->IsA( nType ) )
70 3377 : return *it;
71 0 : return NULL;
72 : }
73 : };
74 :
75 30380 : class SvMetaName : public SvMetaObject
76 : {
77 : SvString aName;
78 : SvHelpContext aHelpContext;
79 : SvHelpText aHelpText;
80 : SvString aConfigName;
81 : SvString aDescription;
82 :
83 : protected:
84 : bool ReadNameSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
85 : void DoReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm,
86 : char c = '\0' );
87 : virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
88 : virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase,
89 : SvTokenStream & rInStm );
90 : public:
91 : TYPEINFO_OVERRIDE();
92 : SvMetaName();
93 :
94 : virtual bool SetName( const OString& rName, SvIdlDataBase * = NULL );
95 : void SetDescription( const OString& rText )
96 : { aDescription.setString(rText); }
97 5951 : const SvHelpContext& GetHelpContext() const { return aHelpContext; }
98 6190673 : virtual const SvString & GetName() const { return aName; }
99 0 : virtual const SvString & GetHelpText() const { return aHelpText; }
100 0 : virtual const SvString & GetConfigName() const{ return aConfigName; }
101 0 : virtual const SvString& GetDescription() const{ return aDescription; }
102 :
103 : virtual bool Test( SvIdlDataBase &, SvTokenStream & rInStm );
104 : virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
105 : };
106 :
107 : class SvMetaNameMemberList : public SvRefMemberList<SvMetaName *> {};
108 :
109 : class SvMetaReference;
110 : typedef tools::SvRef<SvMetaReference> SvMetaReferenceRef;
111 28681 : class SvMetaReference : public SvMetaName
112 : {
113 : protected:
114 : SvMetaReferenceRef aRef;
115 : public:
116 : TYPEINFO_OVERRIDE();
117 : SvMetaReference();
118 :
119 3666485 : const SvString & GetName() const SAL_OVERRIDE
120 : {
121 3666485 : return ( !aRef.Is()
122 2522572 : || !SvMetaName::GetName().getString().isEmpty() )
123 3666485 : ? SvMetaName::GetName()
124 7332970 : : aRef->GetName();
125 : }
126 :
127 0 : const SvString & GetHelpText() const SAL_OVERRIDE
128 : {
129 0 : return ( !aRef.Is()
130 0 : || !SvMetaName::GetHelpText().getString().isEmpty() )
131 0 : ? SvMetaName::GetHelpText()
132 0 : : aRef->GetHelpText();
133 : }
134 :
135 0 : const SvString & GetConfigName() const SAL_OVERRIDE
136 : {
137 0 : return ( !aRef.Is()
138 0 : || !SvMetaName::GetConfigName().getString().isEmpty() )
139 0 : ? SvMetaName::GetConfigName()
140 0 : : aRef->GetConfigName();
141 : }
142 :
143 0 : const SvString & GetDescription() const SAL_OVERRIDE
144 : {
145 0 : return ( !aRef.Is()
146 0 : || !SvMetaName::GetDescription().getString().isEmpty() )
147 0 : ? SvMetaName::GetDescription()
148 0 : : aRef->GetDescription();
149 : }
150 2708926 : SvMetaReference * GetRef() const { return aRef; }
151 9699 : void SetRef( SvMetaReference * pRef )
152 9699 : { aRef = pRef; }
153 : };
154 :
155 : class SvMetaReferenceMemberList : public SvRefMemberList<SvMetaReference *> {};
156 :
157 :
158 : class SvMetaModule;
159 6408 : class SvMetaExtern : public SvMetaReference
160 : {
161 : SvMetaModule * pModule; // included in which module
162 :
163 : SvUUId aUUId;
164 : SvVersion aVersion;
165 : bool bReadUUId;
166 : bool bReadVersion;
167 : public:
168 : TYPEINFO_OVERRIDE();
169 : SvMetaExtern();
170 :
171 : SvMetaModule * GetModule() const;
172 :
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;
177 :
178 : protected:
179 : virtual void ReadAttributesSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
180 : };
181 :
182 : class SvMetaExternMemberList : public SvRefMemberList<SvMetaExtern *> {};
183 :
184 : #endif // INCLUDED_IDL_INC_BASOBJ_HXX
185 :
186 :
187 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|