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 :
21 : #include <stdio.h>
22 : #include <string.h>
23 :
24 : // Solar Definitionen
25 : #include <tools/solar.h>
26 : #include <rsctop.hxx>
27 168394 : RscTop::RscTop( Atom nId, sal_uInt32 nTypIdent, RscTop * pSuperCl )
28 : : RefNode( nId )
29 : , pSuperClass( pSuperCl )
30 168394 : , nTypId( nTypIdent )
31 : {
32 168394 : pRefClass = this;
33 168394 : if( pSuperClass )
34 : SetCallPar( pSuperClass->aCallPar1, pSuperClass->aCallPar2,
35 65730 : pSuperClass->aCallParType );
36 168394 : }
37 :
38 120818 : void RscTop::SetCallPar(const OString& rPar1, const OString& rPar2,
39 : const OString& rParType)
40 : {
41 120818 : aCallPar1 = rPar1;
42 120818 : aCallPar2 = rPar2;
43 120818 : aCallParType = rParType;
44 120818 : }
45 :
46 188510 : RSCINST RscTop::GetDefault()
47 : {
48 188510 : if( !aDfltInst.IsInst() )
49 5150 : aDfltInst = this->Create( NULL, RSCINST() );
50 188510 : return aDfltInst;
51 : }
52 :
53 160882 : void RscTop :: Pre_dtor()
54 : {
55 160882 : if( aDfltInst.IsInst() )
56 : {
57 4189 : aDfltInst.pClass->Destroy( aDfltInst );
58 4189 : rtl_freeMemory( aDfltInst.pData );
59 4189 : aDfltInst = RSCINST();
60 : };
61 160882 : }
62 :
63 0 : Atom RscTop :: GetConstant( sal_uInt32 )
64 : {
65 0 : return InvalidAtom;
66 : }
67 :
68 0 : RscTop * RscTop::GetTypeClass() const
69 : {
70 0 : if( pSuperClass )
71 0 : return pSuperClass->GetTypeClass();
72 : else
73 0 : return NULL;
74 : }
75 :
76 74494 : sal_uInt32 RscTop :: Size()
77 : {
78 74494 : if( pSuperClass )
79 65730 : return pSuperClass->Size();
80 : else
81 8764 : return 0;
82 : }
83 :
84 3647 : ERRTYPE RscTop :: GetRef( const RSCINST & rInst, RscId * pRscId )
85 : {
86 3647 : if( pSuperClass )
87 9 : return pSuperClass->GetRef( rInst, pRscId );
88 : else
89 3638 : return ERR_UNKNOWN_METHOD;
90 : }
91 :
92 187272 : bool RscTop::InHierarchy( RscTop * pClass )
93 : {
94 187272 : if( this == pClass )
95 89130 : return true;
96 98142 : if( pSuperClass )
97 93902 : return pSuperClass->InHierarchy( pClass );
98 4240 : return false;
99 : }
100 :
101 0 : ERRTYPE RscTop::SetVariable( Atom nVarName, RscTop * pClass,
102 : RSCINST * pDflt, RSCVAR nVarType, sal_uInt32 nMask,
103 : Atom nDataBaseName )
104 : {
105 0 : if( pSuperClass )
106 : return pSuperClass->SetVariable( nVarName, pClass, pDflt,
107 0 : nVarType, nMask, nDataBaseName );
108 : else
109 0 : return ERR_UNKNOWN_METHOD;
110 : }
111 :
112 0 : void RscTop::EnumVariables( void * pData, VarEnumCallbackProc pProc )
113 : {
114 0 : if( pSuperClass )
115 0 : pSuperClass->EnumVariables( pData, pProc );
116 0 : }
117 :
118 353737 : RSCINST RscTop::GetVariable( const RSCINST & rInst,
119 : Atom nVarName,
120 : const RSCINST & rInitInst,
121 : bool bInitDflt,
122 : RscTop * pCreateClass)
123 : {
124 353737 : if( pSuperClass )
125 353737 : return pSuperClass->GetVariable( rInst, nVarName, rInitInst, bInitDflt, pCreateClass );
126 : else
127 0 : return RSCINST();
128 : }
129 :
130 197767 : RSCINST RscTop::GetCopyVar( const RSCINST & rInst, Atom nVarName )
131 : {
132 197767 : if( pSuperClass )
133 197767 : return pSuperClass->GetCopyVar( rInst, nVarName );
134 : else
135 0 : return RSCINST();
136 : }
137 :
138 12 : RSCINST RscTop::GetTupelVar( const RSCINST & rInst, sal_uInt32 nPos,
139 : const RSCINST & rInitInst )
140 : {
141 12 : if( pSuperClass )
142 12 : return pSuperClass->GetTupelVar( rInst, nPos, rInitInst );
143 : else
144 0 : return RSCINST();
145 : }
146 :
147 67010 : ERRTYPE RscTop::GetElement( const RSCINST & rInst, const RscId & rEleName,
148 : RscTop *pCreateClass, const RSCINST & rCreateInst,
149 : RSCINST * pGetInst )
150 : {
151 67010 : if( pSuperClass )
152 : return pSuperClass-> GetElement( rInst, rEleName,
153 : pCreateClass, rCreateInst,
154 67010 : pGetInst );
155 : else
156 0 : return ERR_UNKNOWN_METHOD;
157 : }
158 :
159 0 : ERRTYPE RscTop::GetArrayEle( const RSCINST & rInst,
160 : Atom nId,
161 : RscTop * pCreateClass,
162 : RSCINST * pGetInst)
163 : {
164 0 : if( pSuperClass )
165 0 : return pSuperClass->GetArrayEle( rInst, nId, pCreateClass, pGetInst );
166 : else
167 0 : return ERR_UNKNOWN_METHOD;
168 : }
169 :
170 0 : ERRTYPE RscTop::GetValueEle( const RSCINST & rInst,
171 : sal_Int32 lValue,
172 : RscTop * pCreateClass,
173 : RSCINST * pGetInst)
174 : {
175 0 : if( pSuperClass )
176 0 : return pSuperClass->GetValueEle( rInst, lValue, pCreateClass, pGetInst );
177 : else
178 0 : return ERR_UNKNOWN_METHOD;
179 : }
180 :
181 0 : RSCINST RscTop::SearchEle( const RSCINST & rInst, const RscId & rEleName,
182 : RscTop * pClass )
183 : {
184 0 : if( pSuperClass )
185 0 : return pSuperClass->SearchEle( rInst, rEleName, pClass );
186 : else
187 0 : return RSCINST();
188 : }
189 :
190 0 : RSCINST RscTop::GetPosEle( const RSCINST & rInst, sal_uInt32 nPos )
191 : {
192 0 : if( pSuperClass )
193 0 : return pSuperClass->GetPosEle( rInst, nPos );
194 : else
195 0 : return RSCINST();
196 : }
197 :
198 0 : ERRTYPE RscTop::MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos,
199 : sal_uInt32 nSourcePos )
200 : {
201 0 : if( pSuperClass )
202 0 : return pSuperClass->MovePosEle( rInst, nDestPos, nSourcePos );
203 : else
204 0 : return ERR_UNKNOWN_METHOD;
205 : }
206 :
207 0 : ERRTYPE RscTop::SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos,
208 : const RscId & rRscId )
209 : {
210 0 : if( pSuperClass )
211 0 : return pSuperClass->SetPosRscId( rInst, nPos, rRscId );
212 : else
213 0 : return ERR_UNKNOWN_METHOD;
214 : }
215 :
216 0 : SUBINFO_STRUCT RscTop::GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos )
217 : {
218 0 : if( pSuperClass )
219 0 : return pSuperClass->GetInfoEle( rInst, nPos );
220 : else
221 0 : return SUBINFO_STRUCT();
222 : }
223 :
224 6499 : sal_uInt32 RscTop::GetCount( const RSCINST & rInst )
225 : {
226 6499 : if( pSuperClass )
227 6451 : return pSuperClass->GetCount( rInst );
228 : else
229 48 : return 0;
230 : }
231 :
232 3638 : ERRTYPE RscTop::SetNumber( const RSCINST & rInst, sal_Int32 lValue )
233 : {
234 3638 : if( pSuperClass )
235 0 : return pSuperClass->SetNumber( rInst, lValue );
236 : else
237 3638 : return ERR_UNKNOWN_METHOD;
238 : }
239 :
240 0 : ERRTYPE RscTop::SetBool( const RSCINST & rInst, bool bValue )
241 : {
242 0 : if( pSuperClass )
243 0 : return pSuperClass->SetBool( rInst, bValue );
244 : else
245 0 : return ERR_UNKNOWN_METHOD;
246 : }
247 :
248 0 : ERRTYPE RscTop::SetConst( const RSCINST & rInst, Atom nId, sal_Int32 nVal )
249 : {
250 0 : if( pSuperClass )
251 0 : return pSuperClass->SetConst( rInst, nId, nVal );
252 : else
253 0 : return ERR_UNKNOWN_METHOD;
254 : }
255 :
256 0 : ERRTYPE RscTop::SetNotConst( const RSCINST & rInst, Atom nId )
257 : {
258 0 : if( pSuperClass )
259 0 : return pSuperClass->SetNotConst( rInst, nId );
260 : else
261 0 : return ERR_UNKNOWN_METHOD;
262 : }
263 :
264 24845 : ERRTYPE RscTop::SetString( const RSCINST & rInst, const char * pStr )
265 : {
266 24845 : if( pSuperClass )
267 24845 : return pSuperClass->SetString( rInst, pStr );
268 : else
269 0 : return ERR_UNKNOWN_METHOD;
270 : }
271 :
272 0 : ERRTYPE RscTop::GetNumber( const RSCINST & rInst, sal_Int32 * pN )
273 : {
274 0 : if( pSuperClass )
275 0 : return pSuperClass->GetNumber( rInst, pN );
276 : else
277 0 : return ERR_UNKNOWN_METHOD;
278 : }
279 :
280 0 : ERRTYPE RscTop::GetBool( const RSCINST & rInst, bool * pB )
281 : {
282 0 : if( pSuperClass )
283 0 : return pSuperClass->GetBool( rInst, pB );
284 : else
285 0 : return ERR_UNKNOWN_METHOD;
286 : }
287 :
288 0 : ERRTYPE RscTop::GetConst( const RSCINST & rInst, Atom * pH )
289 : {
290 0 : if( pSuperClass )
291 0 : return pSuperClass->GetConst( rInst, pH );
292 : else
293 0 : return ERR_UNKNOWN_METHOD;
294 : }
295 :
296 912 : ERRTYPE RscTop::GetString( const RSCINST & rInst, char ** ppStr )
297 : {
298 912 : if( pSuperClass )
299 0 : return pSuperClass->GetString( rInst, ppStr );
300 : else
301 912 : return ERR_UNKNOWN_METHOD;
302 : }
303 :
304 268414 : RSCINST RscTop::Create( RSCINST * pInst, const RSCINST & rDefInst, bool bOwnRange )
305 : {
306 268414 : if( pSuperClass )
307 197349 : return pSuperClass->Create( pInst, rDefInst, bOwnRange );
308 : else
309 : {
310 71065 : if( pInst )
311 71065 : return *pInst;
312 0 : return RSCINST();
313 : }
314 : }
315 :
316 489927 : void RscTop::Destroy( const RSCINST & rInst )
317 : {
318 489927 : if( pSuperClass )
319 196785 : pSuperClass->Destroy( rInst );
320 489927 : }
321 :
322 0 : bool RscTop::IsConsistent( const RSCINST & rInst )
323 : {
324 0 : if( pSuperClass )
325 0 : return pSuperClass->IsConsistent( rInst );
326 : else
327 0 : return true;
328 : }
329 :
330 418 : void RscTop::SetToDefault( const RSCINST & rInst )
331 : {
332 418 : if( pSuperClass )
333 0 : pSuperClass->SetToDefault( rInst );
334 418 : }
335 :
336 3020 : bool RscTop::IsDefault( const RSCINST & rInst )
337 : {
338 3020 : if( pSuperClass )
339 3020 : return pSuperClass->IsDefault( rInst );
340 : else
341 0 : return true;
342 : }
343 :
344 27578 : bool RscTop::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
345 : {
346 27578 : if( pSuperClass )
347 25026 : return pSuperClass->IsValueDefault( rInst, pDef );
348 : else
349 2552 : return true;
350 : }
351 :
352 0 : void RscTop::SetDefault( const RSCINST & rInst, Atom nVarId )
353 : {
354 0 : if( pSuperClass )
355 0 : pSuperClass->SetDefault( rInst, nVarId );
356 0 : }
357 :
358 0 : RSCINST RscTop::GetDefault( Atom nVarId )
359 : {
360 0 : if( pSuperClass )
361 0 : return pSuperClass->GetDefault( nVarId );
362 : else
363 0 : return RSCINST();
364 : }
365 :
366 0 : void RscTop::Delete( const RSCINST & rInst, RscTop * pClass,
367 : const RscId & rId )
368 : {
369 0 : if( pSuperClass )
370 0 : pSuperClass->Delete( rInst, pClass, rId );
371 0 : }
372 :
373 0 : void RscTop::DeletePos( const RSCINST & rInst, sal_uInt32 nPos )
374 : {
375 0 : if( pSuperClass )
376 0 : pSuperClass->DeletePos( rInst, nPos );
377 0 : }
378 :
379 4997 : ERRTYPE RscTop::SetRef( const RSCINST & rInst, const RscId & rRefId )
380 : {
381 4997 : if( pSuperClass )
382 6 : return pSuperClass->SetRef( rInst, rRefId );
383 : else
384 4991 : return ERR_UNKNOWN_METHOD;
385 : }
386 :
387 153640 : void RscTop::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
388 : RscTypCont * pTC, sal_uInt32 nTab,
389 : const RscId & rId, const char * pVarName )
390 : {
391 153640 : if( pSuperClass )
392 44318 : pSuperClass->WriteSrcHeader( rInst, fOutput, pTC, nTab, rId, pVarName );
393 : else
394 109322 : rInst.pClass->WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
395 153640 : }
396 :
397 103283 : void RscTop::WriteSrc( const RSCINST & rInst, FILE * fOutput,
398 : RscTypCont * pTC, sal_uInt32 nTab, const char * pVarName )
399 : {
400 103283 : if( pSuperClass )
401 72023 : pSuperClass->WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
402 103283 : }
403 :
404 272028 : ERRTYPE RscTop::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem,
405 : RscTypCont * pTC, const RscId & rId,
406 : sal_uInt32 nDeep, bool bExtra )
407 : {
408 272028 : if( pSuperClass )
409 68605 : return pSuperClass->WriteRcHeader( rInst, rMem, pTC, rId, nDeep, bExtra );
410 : else
411 203423 : return rInst.pClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra );
412 : }
413 :
414 185640 : ERRTYPE RscTop::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
415 : RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra )
416 : {
417 185640 : if( pSuperClass )
418 101489 : return pSuperClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra );
419 : else
420 84151 : return ERR_OK;
421 : }
422 :
423 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|