bump product version to 5.0.4.1
[LibreOffice.git] / rsc / source / res / rsccont.cxx
blobe0ddc76ff4bc4f24d7925adde26f7d7a006e2811
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 .
20 #include <stdlib.h>
21 #include <stdio.h>
22 #include <string.h>
24 #include <rsccont.hxx>
26 #include <tools/rcid.h>
28 void ENTRY_STRUCT::Destroy()
30 aName.Destroy();
31 if( aInst.IsInst() )
33 aInst.pClass->Destroy( aInst );
34 rtl_freeMemory( aInst.pData );
38 RscBaseCont::RscBaseCont( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper,
39 bool bNoIdent )
40 : RscTop( nId, nTypeId, pSuper )
41 , nSize( 0 )
43 pTypeClass = NULL;
44 pTypeClass1 = NULL;
45 bNoId = bNoIdent;
46 nOffInstData = RscTop::Size();
47 nSize = nOffInstData + ALIGNED_SIZE( sizeof( RscBaseContInst ) );
50 RscBaseCont::~RscBaseCont()
54 RSCCLASS_TYPE RscBaseCont::GetClassType() const
56 return RSCCLASS_COMPLEX;
59 void RscBaseCont::DestroyElements( RscBaseContInst * pClassData )
61 if( pClassData->nEntries )
63 for (sal_uInt32 i = 0; i < pClassData->nEntries; i++ )
65 pClassData->pEntries[ i ].Destroy();
67 rtl_freeMemory( pClassData->pEntries );
68 pClassData->pEntries = NULL;
69 pClassData->nEntries = 0;
73 RSCINST RscBaseCont::Create( RSCINST * pInst, const RSCINST & rDflt,
74 bool bOwnClass )
76 RSCINST aInst;
77 RscBaseContInst * pClassData;
79 if( !pInst )
81 aInst.pClass = this;
82 aInst.pData = static_cast<CLASS_DATA>(rtl_allocateMemory( Size() ));
84 else
85 aInst = *pInst;
87 if( !bOwnClass && rDflt.IsInst() )
88 bOwnClass = rDflt.pClass->InHierarchy( this );
90 RscTop::Create( &aInst, rDflt, bOwnClass );
92 pClassData = reinterpret_cast<RscBaseContInst *>(aInst.pData + nOffInstData);
93 pClassData->nEntries = 0;
94 pClassData->pEntries = NULL;
95 pClassData->bDflt = true;
97 if( bOwnClass )
99 RscBaseContInst * pDfltClassData;
100 RSCINST aDfltI;
102 pDfltClassData = reinterpret_cast<RscBaseContInst *>(rDflt.pData + nOffInstData);
104 if( 0 != pDfltClassData->nEntries )
106 *pClassData = *pDfltClassData;
107 pClassData->pEntries =
108 static_cast<ENTRY_STRUCT *>(rtl_allocateMemory( sizeof( ENTRY_STRUCT )
109 * pClassData->nEntries ));
110 for (sal_uInt32 i = 0; i < pClassData->nEntries; i++ )
112 pClassData->pEntries[ i ].Create();
113 pClassData->pEntries[ i ].aName =
114 pDfltClassData->pEntries[ i ].aName;
115 aDfltI = pDfltClassData->pEntries[ i ].aInst;
116 pClassData->pEntries[ i ].aInst =
117 aDfltI.pClass->Create( NULL, aDfltI );
122 return aInst;
125 void RscBaseCont::Destroy( const RSCINST & rInst )
127 RscBaseContInst * pClassData;
129 RscTop::Destroy( rInst);
131 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
132 DestroyElements( pClassData );
135 RSCINST RscBaseCont::SearchElePos( const RSCINST & rInst, const RscId & rEleName,
136 RscTop * pClass, sal_uInt32 nPos )
138 RscBaseContInst * pClassData;
140 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
141 if( !pClass )
142 pClass = pTypeClass;
144 if( rEleName.IsId() )
146 for (sal_uInt32 i = nPos; i < pClassData->nEntries; i++ )
148 if( pClassData->pEntries[ i ].aName == rEleName &&
149 pClassData->pEntries[ i ].aInst.pClass == pClass )
151 return pClassData->pEntries[ i ].aInst;
155 return RSCINST();
158 RSCINST RscBaseCont::SearchEle( const RSCINST & rInst, const RscId & rEleName,
159 RscTop * pClass )
161 return SearchElePos( rInst, rEleName, pClass, 0 );
164 ERRTYPE RscBaseCont::GetElement( const RSCINST & rInst, const RscId & rEleName,
165 RscTop * pCreateClass,
166 const RSCINST & rCreateInst, RSCINST * pGetInst )
168 RscBaseContInst * pClassData;
169 RSCINST aTmpI;
170 ERRTYPE aError;
172 if( !bNoId && !rEleName.IsId() )
173 aError = WRN_CONT_NOID;
175 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
177 if( pCreateClass )
179 if( !pCreateClass->InHierarchy( pTypeClass ) )
181 if( pTypeClass1 )
183 if( !pCreateClass->InHierarchy( pTypeClass1 ) )
185 return ERR_CONT_INVALIDTYPE;
188 else
190 return ERR_CONT_INVALIDTYPE;
194 else
195 pCreateClass = pTypeClass;
197 pClassData->bDflt = false;
199 if( !bNoId )
200 aTmpI = SearchEle( rInst, rEleName, pCreateClass );
201 // Eintrag gefunden
202 if( aTmpI.IsInst() )
204 aError = WRN_CONT_DOUBLEID;
205 if( rCreateInst.IsInst() )
207 aTmpI.pClass->Destroy( aTmpI );
208 aTmpI.pClass->Create( &aTmpI, rCreateInst );
211 else
213 if( pClassData->pEntries )
215 pClassData->pEntries =
216 static_cast<ENTRY_STRUCT *>(rtl_reallocateMemory( pClassData->pEntries,
217 sizeof( ENTRY_STRUCT ) * (pClassData->nEntries +1) ));
219 else
221 pClassData->pEntries =
222 static_cast<ENTRY_STRUCT *>(rtl_allocateMemory( sizeof( ENTRY_STRUCT )
223 * (pClassData->nEntries +1) ));
226 pClassData->pEntries[ pClassData->nEntries ].Create();
227 pClassData->pEntries[ pClassData->nEntries ].aName = rEleName;
229 if( rCreateInst.IsInst() )
231 // Instanz mit CreateInst-Daten initialisieren
232 pClassData->pEntries[ pClassData->nEntries ].aInst =
233 pCreateClass->Create( NULL, rCreateInst );
235 else
237 pClassData->pEntries[ pClassData->nEntries ].aInst =
238 pCreateClass->Create( NULL, RSCINST() );
241 pClassData->nEntries++;
242 aTmpI = pClassData->pEntries[ pClassData->nEntries -1 ].aInst;
245 *pGetInst = aTmpI;
246 return aError;
249 sal_uInt32 RscBaseCont::GetCount( const RSCINST & rInst )
251 RscBaseContInst * pClassData;
253 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
254 return pClassData->nEntries;
257 RSCINST RscBaseCont::GetPosEle( const RSCINST & rInst, sal_uInt32 nPos )
259 RscBaseContInst * pClassData;
261 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
263 if( nPos < pClassData->nEntries )
264 return pClassData->pEntries[ nPos ].aInst;
265 return RSCINST();
268 ERRTYPE RscBaseCont::MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos,
269 sal_uInt32 nSourcePos )
271 ERRTYPE aError;
272 RscBaseContInst * pClassData;
274 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
276 if( (nDestPos < pClassData->nEntries) && (nSourcePos < pClassData->nEntries) )
278 ENTRY_STRUCT aEntry;
279 int nInc = 1;
280 sal_uInt32 i = 0;
282 // Quelle Merken
283 aEntry = pClassData->pEntries[ nSourcePos ];
284 // Richtung der for-Schleife bestimmen
285 if( nDestPos < nSourcePos )
286 nInc = -1;
288 for( i = nSourcePos; i != nDestPos; i += nInc )
289 pClassData->pEntries[ i ] = pClassData->pEntries[ i + nInc ];
291 // Zuweisung Quelle auf Ziel
292 pClassData->pEntries[ nDestPos ] = aEntry;
294 else
295 aError = ERR_RSCCONT;
297 return aError;
300 ERRTYPE RscBaseCont::SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos,
301 const RscId & rId )
303 RscBaseContInst * pClassData;
304 RSCINST aTmpI;
305 ERRTYPE aError;
307 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
309 if( nPos < pClassData->nEntries )
311 if( ! (rId == pClassData->pEntries[ nPos ].aName) )
312 aTmpI = SearchEle( rInst, rId,
313 pClassData->pEntries[ nPos ].aInst.pClass );
314 if( !aTmpI.IsInst() )
315 pClassData->pEntries[ nPos ].aName = rId;
316 else
317 aError = ERR_RSCCONT;
319 else
320 aError = ERR_RSCCONT;
322 return aError;
325 SUBINFO_STRUCT RscBaseCont::GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos )
327 RscBaseContInst * pClassData;
328 SUBINFO_STRUCT aInfo;
330 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
332 if( nPos < pClassData->nEntries )
334 aInfo.aId = pClassData->pEntries[ nPos ].aName;
335 aInfo.nPos = nPos;
336 aInfo.pClass = pClassData->pEntries[ nPos ].aInst.pClass;
338 return aInfo;
341 ERRTYPE RscBaseCont::SetString( const RSCINST & rInst, const char * pStr )
343 RscBaseContInst * pClassData;
344 RSCINST aTmpI;
345 ERRTYPE aError;
346 char *pTmpStr;
348 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
350 // otherwise infinite recursion is possible
351 if( RSC_NOTYPE == pTypeClass->GetTypId() )
353 aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI );
354 aError = aTmpI.pClass->GetString( aTmpI, &pTmpStr );
356 if( aError.IsOk() )
357 aError = aTmpI.pClass->SetString( aTmpI, pStr );
358 else
360 aError.Clear();
361 DeletePos( rInst, pClassData->nEntries -1 );
362 aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI );
363 aError = aTmpI.pClass->GetString( aTmpI, &pTmpStr );
364 if( aError.IsOk() )
365 aError = aTmpI.pClass->SetString( aTmpI, pStr );
368 if( aError.IsError() )
369 DeletePos( rInst, pClassData->nEntries -1 );
371 else
372 aError = ERR_UNKNOWN_METHOD;
374 return aError;
377 ERRTYPE RscBaseCont::SetNumber( const RSCINST & rInst, sal_Int32 lValue )
379 RscBaseContInst * pClassData;
380 RSCINST aTmpI;
381 ERRTYPE aError;
382 sal_Int32 lNumber;
384 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
386 // otherwise infinite recursion is possible
387 if( RSC_NOTYPE == pTypeClass->GetTypId() )
389 aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI );
390 aError = aTmpI.pClass->GetNumber( aTmpI, &lNumber );
392 if( aError.IsOk() )
393 aError = aTmpI.pClass->SetNumber( aTmpI, lValue );
394 else
396 aError.Clear();
397 DeletePos( rInst, pClassData->nEntries -1 );
398 aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI );
399 aError = aTmpI.pClass->GetNumber( aTmpI, &lNumber );
400 if( aError.IsOk() )
401 aError = aTmpI.pClass->SetNumber( aTmpI, lValue );
403 if( aError.IsError() )
404 DeletePos( rInst, pClassData->nEntries -1 );
406 else
407 aError = ERR_UNKNOWN_METHOD;
409 return aError;
412 ERRTYPE RscBaseCont::SetBool( const RSCINST & rInst,
413 bool bValue)
415 RscBaseContInst * pClassData;
416 RSCINST aTmpI;
417 ERRTYPE aError;
418 bool bBool;
420 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
422 // otherwise infinite recursion is possible
423 if( RSC_NOTYPE == pTypeClass->GetTypId() )
425 aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI );
426 aError = aTmpI.pClass->GetBool( aTmpI, &bBool );
428 if( aError.IsOk() )
429 aError = aTmpI.pClass->SetBool( aTmpI, bValue );
430 else
432 aError.Clear();
433 DeletePos( rInst, pClassData->nEntries -1 );
434 aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI );
435 aError = aTmpI.pClass->GetBool( aTmpI, &bBool );
436 if( aError.IsOk() )
437 aError = aTmpI.pClass->SetBool( aTmpI, bValue );
440 if( aError.IsError() )
441 DeletePos( rInst, pClassData->nEntries -1 );
443 else
444 aError = ERR_UNKNOWN_METHOD;
446 return aError;
449 ERRTYPE RscBaseCont::SetConst( const RSCINST & rInst,
450 Atom nValueId,
451 sal_Int32 lValue)
453 RscBaseContInst * pClassData;
454 RSCINST aTmpI;
455 ERRTYPE aError;
456 Atom nConst;
458 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
460 // otherwise infinite recursion is possible
461 if( RSC_NOTYPE == pTypeClass->GetTypId() )
463 aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI );
464 aError = aTmpI.pClass->GetConst( aTmpI, &nConst );
466 if( aError.IsOk() )
467 aError = aTmpI.pClass->SetConst( aTmpI, nValueId, lValue );
468 else
470 aError.Clear();
471 DeletePos( rInst, pClassData->nEntries -1 );
472 aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI );
473 aError = aTmpI.pClass->GetConst( aTmpI, &nConst );
474 if( aError.IsOk() )
475 aError = aTmpI.pClass->SetConst( aTmpI, nValueId, lValue );
478 if( aError.IsError() )
479 DeletePos( rInst, pClassData->nEntries -1 );
481 else
482 aError = ERR_UNKNOWN_METHOD;
484 return aError;
487 ERRTYPE RscBaseCont::SetRef( const RSCINST & rInst, const RscId & rRefId )
489 RscBaseContInst * pClassData;
490 RSCINST aTmpI;
491 ERRTYPE aError;
492 RscId aId;
494 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
496 // otherwise infinite recursion is possible
497 if( RSC_NOTYPE == pTypeClass->GetTypId() )
499 aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI );
500 aError = aTmpI.pClass->GetRef( aTmpI, &aId );
502 if( aError.IsOk() )
503 aError = aTmpI.pClass->SetRef( aTmpI, rRefId );
504 else
506 aError.Clear();
507 DeletePos( rInst, pClassData->nEntries -1 );
508 aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI );
509 aError = aTmpI.pClass->GetRef( aTmpI, &aId );
510 if( aError.IsOk() )
511 aError = aTmpI.pClass->SetNumber( aTmpI, rRefId );
514 if( aError.IsError() )
515 DeletePos( rInst, pClassData->nEntries -1 );
517 else
518 aError = ERR_UNKNOWN_METHOD;
520 return aError;
523 bool RscBaseCont::IsConsistent( const RSCINST & rInst )
525 sal_uInt32 i = 0;
526 RscBaseContInst * pClassData;
527 bool bRet;
529 bRet = RscTop::IsConsistent( rInst );
531 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
533 // auf doppelten Id Testen und Reihenfolge beibehalten
534 // Komplexitaet = n^2 / 2
535 for( i = 0; i < pClassData->nEntries; i++ )
537 if( !bNoId )
539 if( (sal_Int32)pClassData->pEntries[ i ].aName > 0x7FFF ||
540 (sal_Int32)pClassData->pEntries[ i ].aName < 1 )
542 bRet = false;
544 else if( SearchElePos( rInst, pClassData->pEntries[ i ].aName,
545 pClassData->pEntries[ i ].aInst.pClass, i +1 ).IsInst() )
547 bRet = false;
550 if( ! pClassData->pEntries[ i ].aInst.pClass->
551 IsConsistent( pClassData->pEntries[ i ].aInst ) )
553 bRet = false;
557 return bRet;
560 void RscBaseCont::SetToDefault( const RSCINST & rInst )
562 sal_uInt32 i = 0;
563 RscBaseContInst * pClassData;
565 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
567 for( i = 0; i < pClassData->nEntries; i++ )
569 pClassData->pEntries[ i ].aInst.pClass->
570 SetToDefault( pClassData->pEntries[ i ].aInst );
573 RscTop::SetToDefault( rInst );
576 bool RscBaseCont::IsDefault( const RSCINST & rInst )
578 sal_uInt32 i = 0;
579 RscBaseContInst * pClassData;
581 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
583 if( !pClassData->bDflt )
584 return false;
586 for( i = 0; i < pClassData->nEntries; i++ )
588 if( ! pClassData->pEntries[ i ].aInst.pClass->
589 IsDefault( pClassData->pEntries[ i ].aInst ) )
591 return false;
595 return RscTop::IsDefault( rInst );
598 bool RscBaseCont::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
600 RscBaseContInst * pClassData;
602 if( !RscTop::IsValueDefault( rInst, pDef ) )
603 return false;
605 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
607 if( pClassData->nEntries )
608 return false;
609 else
610 return true;
613 void RscBaseCont::Delete( const RSCINST & rInst, RscTop * pClass,
614 const RscId & rId )
616 sal_uInt32 i = 0;
617 RscBaseContInst * pClassData;
619 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
620 if( !pClass )
621 pClass = pTypeClass;
623 for( i = 0; i < pClassData->nEntries; i++ )
625 if( pClassData->pEntries[ i ].aName == rId )
627 if( pClassData->pEntries[ i ].aInst.pClass == pClass || !pClass )
629 DeletePos( rInst, i );
630 return;
637 void RscBaseCont::DeletePos( const RSCINST & rInst, sal_uInt32 nPos )
639 RscBaseContInst * pClassData;
641 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
643 if( nPos < pClassData->nEntries )
645 if( 1 == pClassData->nEntries )
646 DestroyElements( pClassData );
647 else
649 pClassData->pEntries[ nPos ].Destroy();
650 pClassData->nEntries--;
652 for (sal_uInt32 i = nPos; i < pClassData->nEntries; i++ )
653 pClassData->pEntries[ i ] = pClassData->pEntries[ i + 1 ];
659 void RscBaseCont::ContWriteSrc( const RSCINST & rInst, FILE * fOutput,
660 RscTypCont * pTC, sal_uInt32 nTab,
661 const char * pVarName )
663 sal_uInt32 i = 0, t = 0;
664 RscBaseContInst * pClassData;
666 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
668 for( i = 0; i < pClassData->nEntries; i++ )
670 for( t = 0; t < nTab; t++ )
671 fputc( '\t', fOutput );
673 pClassData->pEntries[ i ].aInst.pClass->
674 WriteSrcHeader( pClassData->pEntries[ i ].aInst,
675 fOutput, pTC, nTab,
676 pClassData->pEntries[ i ].aName, pVarName );
677 fprintf( fOutput, ";\n" );
681 ERRTYPE RscBaseCont::ContWriteRc( const RSCINST & rInst, RscWriteRc & rMem,
682 RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra )
684 RscBaseContInst * pClassData;
685 ERRTYPE aError;
687 if( bExtra || bNoId )
688 { // Nur Subresourcen schreiben, wenn bExtra == true
689 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
691 for (sal_uInt32 i = 0; i < pClassData->nEntries && aError.IsOk(); i++ )
693 aError = pClassData->pEntries[ i ].aInst.pClass->
694 WriteRcHeader( pClassData->pEntries[ i ].aInst,
695 rMem, pTC,
696 pClassData->pEntries[ i ].aName,
697 nDeep, bExtra );
701 return aError ;
704 void RscBaseCont::WriteSrc( const RSCINST & rInst, FILE * fOutput,
705 RscTypCont * pTC, sal_uInt32 nTab,
706 const char * pVarName )
708 RscTop::WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
709 ContWriteSrc( rInst, fOutput, pTC, nTab, pVarName );
712 ERRTYPE RscBaseCont::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
713 RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra )
715 ERRTYPE aError;
717 aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra );
718 if( aError.IsOk() )
719 aError = ContWriteRc( rInst, rMem, pTC, nDeep, bExtra );
721 return aError;
724 RscContWriteSrc::RscContWriteSrc( Atom nId, sal_uInt32 nTypeId,
725 RscTop * pSuper, bool bNoIdent )
726 : RscBaseCont( nId, nTypeId, pSuper, bNoIdent )
730 void RscContWriteSrc::WriteSrc( const RSCINST & rInst, FILE * fOutput,
731 RscTypCont * pTC, sal_uInt32 nTab,
732 const char * pVarName )
734 sal_uInt32 i;
736 RscTop::WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
738 fprintf( fOutput, "\n" );
739 for( i = 0; i < nTab; i++ )
740 fputc( '\t', fOutput );
742 fprintf( fOutput, "{\n" );
744 ContWriteSrc( rInst, fOutput, pTC, nTab +1, pVarName );
746 for( i = 0; i < nTab; i++ )
747 fputc( '\t', fOutput );
749 fprintf( fOutput, "}" );
752 RscCont::RscCont( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper, bool bNoIdent )
753 : RscContWriteSrc( nId, nTypeId, pSuper, bNoIdent )
757 ERRTYPE RscCont::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
758 RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra )
760 RscBaseContInst * pClassData;
761 ERRTYPE aError;
763 aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra );
765 pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData);
767 rMem.Put( pClassData->nEntries );
769 if( aError.IsOk() )
770 aError = ContWriteRc( rInst, rMem, pTC, nDeep, bExtra );
772 return aError;
775 RscContExtraData::RscContExtraData( Atom nId, sal_uInt32 nTypeId,
776 RscTop * pSuper, bool bNoIdent )
777 : RscContWriteSrc( nId, nTypeId, pSuper, bNoIdent )
781 ERRTYPE RscContExtraData::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
782 RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra )
784 ERRTYPE aError;
786 if( bExtra )
787 aError = RscContWriteSrc::WriteRc( rInst, rMem, pTC, nDeep, bExtra );
788 else
789 aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra );
791 return aError;
794 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */