1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef _RSCRANGE_HXX 28*cdf0e10cSrcweir #define _RSCRANGE_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include <rscall.h> 31*cdf0e10cSrcweir #include <rscerror.h> 32*cdf0e10cSrcweir #include <rschash.hxx> 33*cdf0e10cSrcweir #include <rsctop.hxx> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir /******************* R s c R a n g e *************************************/ 36*cdf0e10cSrcweir class RscRange : public RscTop 37*cdf0e10cSrcweir { 38*cdf0e10cSrcweir protected: 39*cdf0e10cSrcweir struct RscRangeInst { 40*cdf0e10cSrcweir sal_uInt16 nValue; // nValue = Ausgangswert - nMin 41*cdf0e10cSrcweir sal_Bool bDflt; // Ist Default 42*cdf0e10cSrcweir }; 43*cdf0e10cSrcweir sal_Int32 nMin; // Minimum des Bereiches 44*cdf0e10cSrcweir sal_Int32 nMax; // Maximum des Bereiches 45*cdf0e10cSrcweir sal_uInt32 nSize; 46*cdf0e10cSrcweir public: 47*cdf0e10cSrcweir RscRange( Atom nId, sal_uInt32 nTypId ); 48*cdf0e10cSrcweir virtual RSCCLASS_TYPE GetClassType() const; 49*cdf0e10cSrcweir RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); 50*cdf0e10cSrcweir // Der zulaessige Bereich wird gesetzt 51*cdf0e10cSrcweir ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ); 52*cdf0e10cSrcweir // Gibt die Groesse der Klasse in Bytes 53*cdf0e10cSrcweir sal_uInt32 Size(){ return nSize; } 54*cdf0e10cSrcweir // Eine Zuweisung an eine Variable 55*cdf0e10cSrcweir virtual void SetToDefault( const RSCINST & rInst ) 56*cdf0e10cSrcweir { 57*cdf0e10cSrcweir ((RscRangeInst*)rInst.pData)->bDflt = sal_True; 58*cdf0e10cSrcweir } 59*cdf0e10cSrcweir sal_Bool IsDefault( const RSCINST & rInst) 60*cdf0e10cSrcweir { 61*cdf0e10cSrcweir return( ((RscRangeInst*)rInst.pData)->bDflt ); 62*cdf0e10cSrcweir }; 63*cdf0e10cSrcweir // Als Default setzen 64*cdf0e10cSrcweir sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); 65*cdf0e10cSrcweir ERRTYPE SetNumber( const RSCINST &, sal_Int32 ); 66*cdf0e10cSrcweir ERRTYPE GetNumber( const RSCINST &, sal_Int32 * ); 67*cdf0e10cSrcweir void WriteSrc( const RSCINST &, FILE * fOutput, 68*cdf0e10cSrcweir RscTypCont * pTC, sal_uInt32 nTab, const char * ); 69*cdf0e10cSrcweir ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, 70*cdf0e10cSrcweir RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); 71*cdf0e10cSrcweir void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, 72*cdf0e10cSrcweir const char * ); 73*cdf0e10cSrcweir }; 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir /******************* R s c L o n g R a n g e ******************************/ 76*cdf0e10cSrcweir class RscLongRange : public RscTop 77*cdf0e10cSrcweir { 78*cdf0e10cSrcweir protected: 79*cdf0e10cSrcweir struct RscLongRangeInst 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir sal_Int32 nValue; // nValue = Ausgangswert - nMin 82*cdf0e10cSrcweir sal_Bool bDflt; // Ist Default 83*cdf0e10cSrcweir }; 84*cdf0e10cSrcweir sal_Int32 nMin; // Minimum des Bereiches 85*cdf0e10cSrcweir sal_Int32 nMax; // Maximum des Bereiches 86*cdf0e10cSrcweir sal_uInt32 nSize; 87*cdf0e10cSrcweir public: 88*cdf0e10cSrcweir RscLongRange( Atom nId, sal_uInt32 nTypId ); 89*cdf0e10cSrcweir virtual RSCCLASS_TYPE GetClassType() const; 90*cdf0e10cSrcweir RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); 91*cdf0e10cSrcweir // Der zulaessige Bereich wird gesetzt 92*cdf0e10cSrcweir ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ); 93*cdf0e10cSrcweir // Gibt die Groesse der Klasse in Bytes 94*cdf0e10cSrcweir sal_uInt32 Size(){ return nSize; } 95*cdf0e10cSrcweir // Eine Zuweisung an eine Variable 96*cdf0e10cSrcweir virtual void SetToDefault( const RSCINST & rInst ) 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir ((RscLongRangeInst*)rInst.pData)->bDflt = sal_True; 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir sal_Bool IsDefault( const RSCINST & rInst) 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir return( ((RscLongRangeInst*)rInst.pData)->bDflt ); 103*cdf0e10cSrcweir }; 104*cdf0e10cSrcweir // Als Default setzen 105*cdf0e10cSrcweir sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); 106*cdf0e10cSrcweir ERRTYPE SetNumber( const RSCINST &, sal_Int32 ); 107*cdf0e10cSrcweir ERRTYPE GetNumber( const RSCINST &, sal_Int32 * ); 108*cdf0e10cSrcweir void WriteSrc( const RSCINST &, FILE * fOutput, 109*cdf0e10cSrcweir RscTypCont * pTC, sal_uInt32 nTab, const char * ); 110*cdf0e10cSrcweir ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, 111*cdf0e10cSrcweir RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); 112*cdf0e10cSrcweir void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, 113*cdf0e10cSrcweir const char * ); 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir }; 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir /******************* R s c L o n g E n u m R a n g e ******************/ 118*cdf0e10cSrcweir class RscLongEnumRange : public RscLongRange 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir public: 121*cdf0e10cSrcweir RscLongEnumRange( Atom nId, sal_uInt32 nTypId ); 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, 124*cdf0e10cSrcweir sal_Int32 nValue ); 125*cdf0e10cSrcweir }; 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir /******************* R s c I d R a n g e ***********************************/ 128*cdf0e10cSrcweir class RscIdRange : public RscTop 129*cdf0e10cSrcweir { 130*cdf0e10cSrcweir sal_uInt32 nSize; 131*cdf0e10cSrcweir protected: 132*cdf0e10cSrcweir sal_Int32 nMin; // Minimum des Bereiches 133*cdf0e10cSrcweir sal_Int32 nMax; // Maximum des Bereiches 134*cdf0e10cSrcweir public: 135*cdf0e10cSrcweir RscIdRange( Atom nId, sal_uInt32 nTypId ); 136*cdf0e10cSrcweir virtual RSCCLASS_TYPE GetClassType() const; 137*cdf0e10cSrcweir // Der zulaessige Bereich wird gesetzt 138*cdf0e10cSrcweir ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ){ 139*cdf0e10cSrcweir nMin = nMinimum; 140*cdf0e10cSrcweir nMax = nMaximum; 141*cdf0e10cSrcweir return ERR_OK; 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); 144*cdf0e10cSrcweir void Destroy( const RSCINST & rInst ); 145*cdf0e10cSrcweir sal_uInt32 Size(){ return nSize; } 146*cdf0e10cSrcweir virtual void SetToDefault( const RSCINST & rInst ) 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir ((RscId*)rInst.pData)->aExp.cUnused = sal_True; 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir sal_Bool IsDefault( const RSCINST & rInst) 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir //cUnused wird fuer Defaultkennung verwendet 153*cdf0e10cSrcweir return ((RscId*)rInst.pData)->aExp.cUnused 154*cdf0e10cSrcweir ? sal_True : sal_False; 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir // Als Default setzen 157*cdf0e10cSrcweir sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); 158*cdf0e10cSrcweir ERRTYPE SetNumber( const RSCINST &, sal_Int32 ); 159*cdf0e10cSrcweir ERRTYPE GetNumber( const RSCINST &, sal_Int32 * ); 160*cdf0e10cSrcweir ERRTYPE SetRef( const RSCINST &, const RscId & rRscId ); 161*cdf0e10cSrcweir ERRTYPE GetRef( const RSCINST & rInst, RscId * ); 162*cdf0e10cSrcweir void WriteSrc( const RSCINST &, FILE * fOutput, 163*cdf0e10cSrcweir RscTypCont * pTC, sal_uInt32 nTab, const char * ); 164*cdf0e10cSrcweir ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, 165*cdf0e10cSrcweir RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); 166*cdf0e10cSrcweir sal_Bool IsConsistent( const RSCINST & rInst, RscInconsList * pList ); 167*cdf0e10cSrcweir void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, 168*cdf0e10cSrcweir const char * ); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir }; 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir /******************* R s c B o o l ***************************************/ 173*cdf0e10cSrcweir class RscBool : public RscRange 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir public: 176*cdf0e10cSrcweir RscBool( Atom nId, sal_uInt32 nTypId ); 177*cdf0e10cSrcweir virtual RSCCLASS_TYPE GetClassType() const; 178*cdf0e10cSrcweir // Der zulaessige Bereich wird gesetzt 179*cdf0e10cSrcweir ERRTYPE SetRange( sal_Int32, sal_Int32 ){ 180*cdf0e10cSrcweir return( ERR_UNKNOWN_METHOD ); 181*cdf0e10cSrcweir }; 182*cdf0e10cSrcweir ERRTYPE SetBool( const RSCINST & rInst, sal_Bool b ){ 183*cdf0e10cSrcweir return( SetNumber( rInst, (sal_Int32)b ) ); 184*cdf0e10cSrcweir }; 185*cdf0e10cSrcweir ERRTYPE GetBool( const RSCINST & rInst, sal_Bool * pB){ 186*cdf0e10cSrcweir sal_Int32 l; 187*cdf0e10cSrcweir GetNumber( rInst, &l ); 188*cdf0e10cSrcweir *pB = (0 != l); 189*cdf0e10cSrcweir return( ERR_OK ); 190*cdf0e10cSrcweir }; 191*cdf0e10cSrcweir void WriteSrc( const RSCINST &, FILE * fOutput, 192*cdf0e10cSrcweir RscTypCont * pTC, sal_uInt32 nTab, const char * ); 193*cdf0e10cSrcweir void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, 194*cdf0e10cSrcweir const char * ); 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir }; 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir class RscBreakRange : public RscRange { 199*cdf0e10cSrcweir sal_Int32 nOutRange; 200*cdf0e10cSrcweir public: 201*cdf0e10cSrcweir RscBreakRange( Atom nId, sal_uInt32 nTypId ); 202*cdf0e10cSrcweir void SetOutRange( sal_Int32 nNumber ){ 203*cdf0e10cSrcweir nOutRange = nNumber; 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); 206*cdf0e10cSrcweir ERRTYPE SetNumber( const RSCINST &, sal_Int32 ); 207*cdf0e10cSrcweir }; 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir #endif // _RSCRANGE_HXX 210