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 _RSCCONT_HXX 28 #define _RSCCONT_HXX 29 30 #include <rscall.h> 31 #include <rscerror.h> 32 #include <rsctop.hxx> 33 34 /******************* R s c B a s e C o n t *******************************/ 35 struct ENTRY_STRUCT { 36 RscId aName; 37 RSCINST aInst; 38 void Create(){ aName.Create(); aInst = RSCINST(); } 39 void Destroy(); 40 }; 41 struct RscBaseContInst { 42 sal_uInt32 nEntries; 43 ENTRY_STRUCT * pEntries; 44 sal_Bool bDflt; 45 }; 46 47 class RscBaseCont : public RscTop 48 { 49 protected: 50 RscTop * pTypeClass; // Typ der Eintraege 51 RscTop * pTypeClass1;// Zwei verschiedene Typen moeglich 52 sal_Bool bNoId; // Keine Identifier 53 sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse 54 // mit Superklassen 55 sal_uInt32 nOffInstData;// Offset auf eigen Instanzdaten 56 void DestroyElements( RscBaseContInst * pClassData ); 57 RSCINST SearchElePos( const RSCINST & rInst, const RscId & rEleName, 58 RscTop * pClass, sal_uInt32 nPos ); 59 protected: 60 void ContWriteSrc( const RSCINST & rInst, FILE * fOutput, 61 RscTypCont * pTC, sal_uInt32 nTab, const char * ); 62 ERRTYPE ContWriteRc( const RSCINST & rInst, RscWriteRc & aMem, 63 RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); 64 void ContWriteRcAccess( FILE * fOutput, RscTypCont * pTC, 65 const char *, sal_Bool nWriteSize ); 66 public: 67 RscBaseCont( Atom nId, sal_uInt32 nTypId, 68 RscTop * pSuper = NULL, 69 sal_Bool bNoId = sal_True ); 70 ~RscBaseCont(); 71 virtual RSCCLASS_TYPE GetClassType() const; 72 void SetTypeClass( RscTop * pClass, RscTop * pClass1 = NULL ) 73 { 74 pTypeClass = pClass; 75 pTypeClass1 = pClass1; 76 }; 77 RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); 78 void Destroy( const RSCINST & rInst ); 79 ERRTYPE GetElement( const RSCINST & rInst, const RscId & rEleName, 80 RscTop * pCreateClass, const RSCINST & rCreateInst, 81 RSCINST * pGetInst ); 82 RSCINST SearchEle( const RSCINST & rInst, const RscId & rEleName, 83 RscTop * pClass ); 84 sal_uInt32 GetCount( const RSCINST & rInst ); 85 RSCINST GetPosEle( const RSCINST & rInst, sal_uInt32 nPos ); 86 ERRTYPE MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos, 87 sal_uInt32 nSourcePos ); 88 virtual ERRTYPE SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos, 89 const RscId & rRscId); 90 SUBINFO_STRUCT GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos ); 91 ERRTYPE SetString( const RSCINST &, const char * pStr ); 92 ERRTYPE SetNumber( const RSCINST &, sal_Int32 lValue ); 93 ERRTYPE SetBool( const RSCINST & rInst, sal_Bool bValue ); 94 ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, 95 sal_Int32 nValue ); 96 ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId ); 97 98 // Gibt die Groesse der Klasse in Bytes 99 sal_uInt32 Size(){ return( nSize ); }; 100 101 sal_Bool IsConsistent( const RSCINST & rInst, RscInconsList * pList ); 102 void SetToDefault( const RSCINST & rInst ); 103 sal_Bool IsDefault( const RSCINST & rInst ); 104 sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); 105 106 void Delete( const RSCINST & rInst, RscTop * pClass, 107 const RscId & rId ); 108 void DeletePos( const RSCINST & rInst, sal_uInt32 nPos ); 109 110 void WriteSrc( const RSCINST & rInst, FILE * fOutput, 111 RscTypCont * pTC, sal_uInt32 nTab, const char * ); 112 ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, 113 RscTypCont * pTC, sal_uInt32 , sal_Bool bExtra); 114 ERRTYPE WriteHxx( const RSCINST & rInst, FILE * fOutput, 115 RscTypCont * pTC, const RscId & rId ); 116 ERRTYPE WriteCxx( const RSCINST & rInst, FILE * fOutput, 117 RscTypCont * pTC, const RscId &rId ); 118 }; 119 120 /******************* R s c C o n t W r i t e S r c ***********************/ 121 class RscContWriteSrc : public RscBaseCont 122 { 123 public: 124 RscContWriteSrc( Atom nId, sal_uInt32 nTypId, 125 RscTop * pSuper = NULL, 126 sal_Bool bNoId = sal_True ); 127 void WriteSrc( const RSCINST & rInst, FILE * fOutput, 128 RscTypCont * pTC, sal_uInt32 nTab, const char * ); 129 }; 130 131 /******************* R s c C o n t ***************************************/ 132 class RscCont : public RscContWriteSrc { 133 public: 134 RscCont( Atom nId, sal_uInt32 nTypId, 135 RscTop * pSuper = NULL, 136 sal_Bool bNoId = sal_True ); 137 ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, 138 RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); 139 void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, 140 const char * ); 141 }; 142 143 /******************* R s c C o n t E x t r a D a t a *********************/ 144 class RscContExtraData : public RscContWriteSrc { 145 public: 146 RscContExtraData( Atom nId, sal_uInt32 nTypId, 147 RscTop * pSuper = NULL, 148 sal_Bool bNoId = sal_True ); 149 ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, 150 RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); 151 }; 152 153 #endif //_RSCCONT_HXX 154