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