1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _RSCARRAY_HXX 28 #define _RSCARRAY_HXX 29 30 #include <rscall.h> 31 #include <rscerror.h> 32 #include <rsctop.hxx> 33 34 class RscEnum; 35 36 /******************* R s c A r r a y ************************************/ 37 class RscInstNode : public IdNode 38 { 39 sal_uInt32 nTypeId; 40 protected: 41 using NameNode::Search; 42 public: 43 RSCINST aInst; 44 RscInstNode( sal_uInt32 nId ); 45 ~RscInstNode(); 46 virtual sal_uInt32 GetId() const; 47 RscInstNode * Left() const { return (RscInstNode *)pLeft ; }; 48 RscInstNode * Right() const{ return (RscInstNode *)pRight ; }; 49 RscInstNode * Search( sal_uInt32 nId ) const 50 { 51 return (RscInstNode *)IdNode::Search( nId ); 52 } 53 }; 54 55 struct RscArrayInst 56 { 57 RscInstNode * pNode; 58 }; 59 60 /* Der Baum wird ueber die Werte des Enums sortiert, nicht ueber 61 seine HashId. 62 */ 63 class RscArray : public RscTop 64 { 65 protected: 66 RscEnum * pTypeClass; // Typ der Eintraege 67 sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse 68 // mit Superklassen 69 sal_uInt32 nOffInstData;// Offset auf eigen Instanzdaten 70 void WriteSrcArray( const RSCINST & rInst, FILE * fOutput, 71 RscTypCont * pTC, sal_uInt32 nTab, const char * ); 72 public: 73 RscArray( Atom nId, sal_uInt32 nTypId, 74 RscTop * pSuper, RscEnum * pTypeClass ); 75 ~RscArray(); 76 virtual RSCCLASS_TYPE GetClassType() const; 77 78 void SetTypeClass( RscEnum * pClass ) 79 { 80 pTypeClass = pClass; 81 } 82 virtual RscTop * GetTypeClass() const; 83 RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); 84 void Destroy( const RSCINST & rInst ); 85 virtual ERRTYPE GetValueEle( const RSCINST & rInst, sal_Int32 lValue, 86 RscTop * pCreateClass, 87 RSCINST * pGetInst ); 88 virtual ERRTYPE GetArrayEle( const RSCINST & rInst, Atom nId, 89 RscTop * pCreateClass, 90 RSCINST * pGetInst ); 91 92 // Gibt die Groesse der Klasse in Bytes 93 sal_uInt32 Size(){ return( nSize ); }; 94 95 sal_Bool IsConsistent( const RSCINST & rInst, RscInconsList * pList ); 96 virtual void SetToDefault( const RSCINST & rInst ); 97 sal_Bool IsDefault( const RSCINST & rInst ); 98 sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); 99 100 virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, 101 RscTypCont * pTC, sal_uInt32 nTab, 102 const RscId & aId, const char * ); 103 void WriteSrc( const RSCINST & rInst, FILE * fOutput, 104 RscTypCont * pTC, sal_uInt32 nTab, const char * ); 105 ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, 106 RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); 107 virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, 108 const char * ); 109 }; 110 111 class RscClassArray : public RscArray 112 { 113 public: 114 RscClassArray( Atom nId, sal_uInt32 nTypId, 115 RscTop * pSuper, RscEnum * pTypeClass ); 116 ~RscClassArray(); 117 virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, 118 RscTypCont * pTC, sal_uInt32 nTab, 119 const RscId & aId, const char * ); 120 void WriteSrc( const RSCINST & rInst, FILE * fOutput, 121 RscTypCont * pTC, sal_uInt32 nTab, const char * ); 122 virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, 123 RscTypCont * pTC, const RscId & aId, 124 sal_uInt32 nDeep, sal_Bool bExtra ); 125 }; 126 127 128 class RscLangArray : public RscArray 129 { 130 public: 131 RscLangArray( Atom nId, sal_uInt32 nTypId, 132 RscTop * pSuper, RscEnum * pTypeClass ); 133 virtual RSCCLASS_TYPE GetClassType() const; 134 }; 135 136 #endif //_RSCARRAY 137