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