bump product version to 5.0.4.1
[LibreOffice.git] / rsc / source / res / rsctop.cxx
blobd91626e2f667ad9bfce7f5f5935ac7917be47f42
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
21 #include <stdio.h>
22 #include <string.h>
23 #include <rsctop.hxx>
25 RscTop::RscTop( Atom nId, sal_uInt32 nTypIdent, RscTop * pSuperCl )
26 : RefNode( nId )
27 , pSuperClass( pSuperCl )
28 , nTypId( nTypIdent )
30 pRefClass = this;
31 if( pSuperClass )
32 SetCallPar( pSuperClass->aCallPar1, pSuperClass->aCallPar2,
33 pSuperClass->aCallParType );
36 void RscTop::SetCallPar(const OString& rPar1, const OString& rPar2,
37 const OString& rParType)
39 aCallPar1 = rPar1;
40 aCallPar2 = rPar2;
41 aCallParType = rParType;
44 RSCINST RscTop::GetDefault()
46 if( !aDfltInst.IsInst() )
47 aDfltInst = this->Create( NULL, RSCINST() );
48 return aDfltInst;
51 void RscTop :: Pre_dtor()
53 if( aDfltInst.IsInst() )
55 aDfltInst.pClass->Destroy( aDfltInst );
56 rtl_freeMemory( aDfltInst.pData );
57 aDfltInst = RSCINST();
61 Atom RscTop :: GetConstant( sal_uInt32 )
63 return InvalidAtom;
66 RscTop * RscTop::GetTypeClass() const
68 if( pSuperClass )
69 return pSuperClass->GetTypeClass();
70 else
71 return NULL;
74 sal_uInt32 RscTop :: Size()
76 if( pSuperClass )
77 return pSuperClass->Size();
78 else
79 return 0;
82 ERRTYPE RscTop :: GetRef( const RSCINST & rInst, RscId * pRscId )
84 if( pSuperClass )
85 return pSuperClass->GetRef( rInst, pRscId );
86 else
87 return ERR_UNKNOWN_METHOD;
90 bool RscTop::InHierarchy( RscTop * pClass )
92 if( this == pClass )
93 return true;
94 if( pSuperClass )
95 return pSuperClass->InHierarchy( pClass );
96 return false;
99 ERRTYPE RscTop::SetVariable( Atom nVarName, RscTop * pClass,
100 RSCINST * pDflt, RSCVAR nVarType, sal_uInt32 nMask,
101 Atom nDataBaseName )
103 if( pSuperClass )
104 return pSuperClass->SetVariable( nVarName, pClass, pDflt,
105 nVarType, nMask, nDataBaseName );
106 else
107 return ERR_UNKNOWN_METHOD;
110 void RscTop::EnumVariables( void * pData, VarEnumCallbackProc pProc )
112 if( pSuperClass )
113 pSuperClass->EnumVariables( pData, pProc );
116 RSCINST RscTop::GetVariable( const RSCINST & rInst,
117 Atom nVarName,
118 const RSCINST & rInitInst,
119 bool bInitDflt,
120 RscTop * pCreateClass)
122 if( pSuperClass )
123 return pSuperClass->GetVariable( rInst, nVarName, rInitInst, bInitDflt, pCreateClass );
124 else
125 return RSCINST();
128 RSCINST RscTop::GetCopyVar( const RSCINST & rInst, Atom nVarName )
130 if( pSuperClass )
131 return pSuperClass->GetCopyVar( rInst, nVarName );
132 else
133 return RSCINST();
136 RSCINST RscTop::GetTupelVar( const RSCINST & rInst, sal_uInt32 nPos,
137 const RSCINST & rInitInst )
139 if( pSuperClass )
140 return pSuperClass->GetTupelVar( rInst, nPos, rInitInst );
141 else
142 return RSCINST();
145 ERRTYPE RscTop::GetElement( const RSCINST & rInst, const RscId & rEleName,
146 RscTop *pCreateClass, const RSCINST & rCreateInst,
147 RSCINST * pGetInst )
149 if( pSuperClass )
150 return pSuperClass-> GetElement( rInst, rEleName,
151 pCreateClass, rCreateInst,
152 pGetInst );
153 else
154 return ERR_UNKNOWN_METHOD;
157 ERRTYPE RscTop::GetArrayEle( const RSCINST & rInst,
158 Atom nId,
159 RscTop * pCreateClass,
160 RSCINST * pGetInst)
162 if( pSuperClass )
163 return pSuperClass->GetArrayEle( rInst, nId, pCreateClass, pGetInst );
164 else
165 return ERR_UNKNOWN_METHOD;
168 ERRTYPE RscTop::GetValueEle( const RSCINST & rInst,
169 sal_Int32 lValue,
170 RscTop * pCreateClass,
171 RSCINST * pGetInst)
173 if( pSuperClass )
174 return pSuperClass->GetValueEle( rInst, lValue, pCreateClass, pGetInst );
175 else
176 return ERR_UNKNOWN_METHOD;
179 RSCINST RscTop::SearchEle( const RSCINST & rInst, const RscId & rEleName,
180 RscTop * pClass )
182 if( pSuperClass )
183 return pSuperClass->SearchEle( rInst, rEleName, pClass );
184 else
185 return RSCINST();
188 RSCINST RscTop::GetPosEle( const RSCINST & rInst, sal_uInt32 nPos )
190 if( pSuperClass )
191 return pSuperClass->GetPosEle( rInst, nPos );
192 else
193 return RSCINST();
196 ERRTYPE RscTop::MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos,
197 sal_uInt32 nSourcePos )
199 if( pSuperClass )
200 return pSuperClass->MovePosEle( rInst, nDestPos, nSourcePos );
201 else
202 return ERR_UNKNOWN_METHOD;
205 ERRTYPE RscTop::SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos,
206 const RscId & rRscId )
208 if( pSuperClass )
209 return pSuperClass->SetPosRscId( rInst, nPos, rRscId );
210 else
211 return ERR_UNKNOWN_METHOD;
214 SUBINFO_STRUCT RscTop::GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos )
216 if( pSuperClass )
217 return pSuperClass->GetInfoEle( rInst, nPos );
218 else
219 return SUBINFO_STRUCT();
222 sal_uInt32 RscTop::GetCount( const RSCINST & rInst )
224 if( pSuperClass )
225 return pSuperClass->GetCount( rInst );
226 else
227 return 0;
230 ERRTYPE RscTop::SetNumber( const RSCINST & rInst, sal_Int32 lValue )
232 if( pSuperClass )
233 return pSuperClass->SetNumber( rInst, lValue );
234 else
235 return ERR_UNKNOWN_METHOD;
238 ERRTYPE RscTop::SetBool( const RSCINST & rInst, bool bValue )
240 if( pSuperClass )
241 return pSuperClass->SetBool( rInst, bValue );
242 else
243 return ERR_UNKNOWN_METHOD;
246 ERRTYPE RscTop::SetConst( const RSCINST & rInst, Atom nId, sal_Int32 nVal )
248 if( pSuperClass )
249 return pSuperClass->SetConst( rInst, nId, nVal );
250 else
251 return ERR_UNKNOWN_METHOD;
254 ERRTYPE RscTop::SetNotConst( const RSCINST & rInst, Atom nId )
256 if( pSuperClass )
257 return pSuperClass->SetNotConst( rInst, nId );
258 else
259 return ERR_UNKNOWN_METHOD;
262 ERRTYPE RscTop::SetString( const RSCINST & rInst, const char * pStr )
264 if( pSuperClass )
265 return pSuperClass->SetString( rInst, pStr );
266 else
267 return ERR_UNKNOWN_METHOD;
270 ERRTYPE RscTop::GetNumber( const RSCINST & rInst, sal_Int32 * pN )
272 if( pSuperClass )
273 return pSuperClass->GetNumber( rInst, pN );
274 else
275 return ERR_UNKNOWN_METHOD;
278 ERRTYPE RscTop::GetBool( const RSCINST & rInst, bool * pB )
280 if( pSuperClass )
281 return pSuperClass->GetBool( rInst, pB );
282 else
283 return ERR_UNKNOWN_METHOD;
286 ERRTYPE RscTop::GetConst( const RSCINST & rInst, Atom * pH )
288 if( pSuperClass )
289 return pSuperClass->GetConst( rInst, pH );
290 else
291 return ERR_UNKNOWN_METHOD;
294 ERRTYPE RscTop::GetString( const RSCINST & rInst, char ** ppStr )
296 if( pSuperClass )
297 return pSuperClass->GetString( rInst, ppStr );
298 else
299 return ERR_UNKNOWN_METHOD;
302 RSCINST RscTop::Create( RSCINST * pInst, const RSCINST & rDefInst, bool bOwnRange )
304 if( pSuperClass )
305 return pSuperClass->Create( pInst, rDefInst, bOwnRange );
306 else
308 if( pInst )
309 return *pInst;
310 return RSCINST();
314 void RscTop::Destroy( const RSCINST & rInst )
316 if( pSuperClass )
317 pSuperClass->Destroy( rInst );
320 bool RscTop::IsConsistent( const RSCINST & rInst )
322 if( pSuperClass )
323 return pSuperClass->IsConsistent( rInst );
324 else
325 return true;
328 void RscTop::SetToDefault( const RSCINST & rInst )
330 if( pSuperClass )
331 pSuperClass->SetToDefault( rInst );
334 bool RscTop::IsDefault( const RSCINST & rInst )
336 if( pSuperClass )
337 return pSuperClass->IsDefault( rInst );
338 else
339 return true;
342 bool RscTop::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
344 if( pSuperClass )
345 return pSuperClass->IsValueDefault( rInst, pDef );
346 else
347 return true;
350 void RscTop::SetDefault( const RSCINST & rInst, Atom nVarId )
352 if( pSuperClass )
353 pSuperClass->SetDefault( rInst, nVarId );
356 RSCINST RscTop::GetDefault( Atom nVarId )
358 if( pSuperClass )
359 return pSuperClass->GetDefault( nVarId );
360 else
361 return RSCINST();
364 void RscTop::Delete( const RSCINST & rInst, RscTop * pClass,
365 const RscId & rId )
367 if( pSuperClass )
368 pSuperClass->Delete( rInst, pClass, rId );
371 void RscTop::DeletePos( const RSCINST & rInst, sal_uInt32 nPos )
373 if( pSuperClass )
374 pSuperClass->DeletePos( rInst, nPos );
377 ERRTYPE RscTop::SetRef( const RSCINST & rInst, const RscId & rRefId )
379 if( pSuperClass )
380 return pSuperClass->SetRef( rInst, rRefId );
381 else
382 return ERR_UNKNOWN_METHOD;
385 void RscTop::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
386 RscTypCont * pTC, sal_uInt32 nTab,
387 const RscId & rId, const char * pVarName )
389 if( pSuperClass )
390 pSuperClass->WriteSrcHeader( rInst, fOutput, pTC, nTab, rId, pVarName );
391 else
392 rInst.pClass->WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
395 void RscTop::WriteSrc( const RSCINST & rInst, FILE * fOutput,
396 RscTypCont * pTC, sal_uInt32 nTab, const char * pVarName )
398 if( pSuperClass )
399 pSuperClass->WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
402 ERRTYPE RscTop::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem,
403 RscTypCont * pTC, const RscId & rId,
404 sal_uInt32 nDeep, bool bExtra )
406 if( pSuperClass )
407 return pSuperClass->WriteRcHeader( rInst, rMem, pTC, rId, nDeep, bExtra );
408 else
409 return rInst.pClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra );
412 ERRTYPE RscTop::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
413 RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra )
415 if( pSuperClass )
416 return pSuperClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra );
417 else
418 return ERR_OK;
421 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */