1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
32 #include <rschash.hxx>
35 /******************* R s c R a n g e *************************************/
36 class RscRange
: public RscTop
40 sal_uInt16 nValue
; // nValue = Ausgangswert - nMin
41 sal_Bool bDflt
; // Ist Default
43 sal_Int32 nMin
; // Minimum des Bereiches
44 sal_Int32 nMax
; // Maximum des Bereiches
47 RscRange( Atom nId
, sal_uInt32 nTypId
);
48 virtual RSCCLASS_TYPE
GetClassType() const;
49 RSCINST
Create( RSCINST
* pInst
, const RSCINST
& rDfltInst
, sal_Bool
);
50 // Der zulaessige Bereich wird gesetzt
51 ERRTYPE
SetRange( sal_Int32 nMinimum
, sal_Int32 nMaximum
);
52 // Gibt die Groesse der Klasse in Bytes
53 sal_uInt32
Size(){ return nSize
; }
54 // Eine Zuweisung an eine Variable
55 virtual void SetToDefault( const RSCINST
& rInst
)
57 ((RscRangeInst
*)rInst
.pData
)->bDflt
= sal_True
;
59 sal_Bool
IsDefault( const RSCINST
& rInst
)
61 return( ((RscRangeInst
*)rInst
.pData
)->bDflt
);
64 sal_Bool
IsValueDefault( const RSCINST
& rInst
, CLASS_DATA pDef
);
65 ERRTYPE
SetNumber( const RSCINST
&, sal_Int32
);
66 ERRTYPE
GetNumber( const RSCINST
&, sal_Int32
* );
67 void WriteSrc( const RSCINST
&, FILE * fOutput
,
68 RscTypCont
* pTC
, sal_uInt32 nTab
, const char * );
69 ERRTYPE
WriteRc( const RSCINST
&, RscWriteRc
& aMem
,
70 RscTypCont
* pTC
, sal_uInt32
, sal_Bool bExtra
);
71 void WriteRcAccess( FILE * fOutput
, RscTypCont
* pTC
,
75 /******************* R s c L o n g R a n g e ******************************/
76 class RscLongRange
: public RscTop
79 struct RscLongRangeInst
81 sal_Int32 nValue
; // nValue = Ausgangswert - nMin
82 sal_Bool bDflt
; // Ist Default
84 sal_Int32 nMin
; // Minimum des Bereiches
85 sal_Int32 nMax
; // Maximum des Bereiches
88 RscLongRange( Atom nId
, sal_uInt32 nTypId
);
89 virtual RSCCLASS_TYPE
GetClassType() const;
90 RSCINST
Create( RSCINST
* pInst
, const RSCINST
& rDfltInst
, sal_Bool
);
91 // Der zulaessige Bereich wird gesetzt
92 ERRTYPE
SetRange( sal_Int32 nMinimum
, sal_Int32 nMaximum
);
93 // Gibt die Groesse der Klasse in Bytes
94 sal_uInt32
Size(){ return nSize
; }
95 // Eine Zuweisung an eine Variable
96 virtual void SetToDefault( const RSCINST
& rInst
)
98 ((RscLongRangeInst
*)rInst
.pData
)->bDflt
= sal_True
;
100 sal_Bool
IsDefault( const RSCINST
& rInst
)
102 return( ((RscLongRangeInst
*)rInst
.pData
)->bDflt
);
104 // Als Default setzen
105 sal_Bool
IsValueDefault( const RSCINST
& rInst
, CLASS_DATA pDef
);
106 ERRTYPE
SetNumber( const RSCINST
&, sal_Int32
);
107 ERRTYPE
GetNumber( const RSCINST
&, sal_Int32
* );
108 void WriteSrc( const RSCINST
&, FILE * fOutput
,
109 RscTypCont
* pTC
, sal_uInt32 nTab
, const char * );
110 ERRTYPE
WriteRc( const RSCINST
&, RscWriteRc
& aMem
,
111 RscTypCont
* pTC
, sal_uInt32
, sal_Bool bExtra
);
112 void WriteRcAccess( FILE * fOutput
, RscTypCont
* pTC
,
117 /******************* R s c L o n g E n u m R a n g e ******************/
118 class RscLongEnumRange
: public RscLongRange
121 RscLongEnumRange( Atom nId
, sal_uInt32 nTypId
);
123 ERRTYPE
SetConst( const RSCINST
& rInst
, Atom nValueId
,
127 /******************* R s c I d R a n g e ***********************************/
128 class RscIdRange
: public RscTop
132 sal_Int32 nMin
; // Minimum des Bereiches
133 sal_Int32 nMax
; // Maximum des Bereiches
135 RscIdRange( Atom nId
, sal_uInt32 nTypId
);
136 virtual RSCCLASS_TYPE
GetClassType() const;
137 // Der zulaessige Bereich wird gesetzt
138 ERRTYPE
SetRange( sal_Int32 nMinimum
, sal_Int32 nMaximum
){
143 RSCINST
Create( RSCINST
* pInst
, const RSCINST
& rDfltInst
, sal_Bool
);
144 void Destroy( const RSCINST
& rInst
);
145 sal_uInt32
Size(){ return nSize
; }
146 virtual void SetToDefault( const RSCINST
& rInst
)
148 ((RscId
*)rInst
.pData
)->aExp
.cUnused
= sal_True
;
150 sal_Bool
IsDefault( const RSCINST
& rInst
)
152 //cUnused wird fuer Defaultkennung verwendet
153 return ((RscId
*)rInst
.pData
)->aExp
.cUnused
154 ? sal_True
: sal_False
;
156 // Als Default setzen
157 sal_Bool
IsValueDefault( const RSCINST
& rInst
, CLASS_DATA pDef
);
158 ERRTYPE
SetNumber( const RSCINST
&, sal_Int32
);
159 ERRTYPE
GetNumber( const RSCINST
&, sal_Int32
* );
160 ERRTYPE
SetRef( const RSCINST
&, const RscId
& rRscId
);
161 ERRTYPE
GetRef( const RSCINST
& rInst
, RscId
* );
162 void WriteSrc( const RSCINST
&, FILE * fOutput
,
163 RscTypCont
* pTC
, sal_uInt32 nTab
, const char * );
164 ERRTYPE
WriteRc( const RSCINST
&, RscWriteRc
& aMem
,
165 RscTypCont
* pTC
, sal_uInt32
, sal_Bool bExtra
);
166 sal_Bool
IsConsistent( const RSCINST
& rInst
, RscInconsList
* pList
);
167 void WriteRcAccess( FILE * fOutput
, RscTypCont
* pTC
,
172 /******************* R s c B o o l ***************************************/
173 class RscBool
: public RscRange
176 RscBool( Atom nId
, sal_uInt32 nTypId
);
177 virtual RSCCLASS_TYPE
GetClassType() const;
178 // Der zulaessige Bereich wird gesetzt
179 ERRTYPE
SetRange( sal_Int32
, sal_Int32
){
180 return( ERR_UNKNOWN_METHOD
);
182 ERRTYPE
SetBool( const RSCINST
& rInst
, sal_Bool b
){
183 return( SetNumber( rInst
, (sal_Int32
)b
) );
185 ERRTYPE
GetBool( const RSCINST
& rInst
, sal_Bool
* pB
){
187 GetNumber( rInst
, &l
);
191 void WriteSrc( const RSCINST
&, FILE * fOutput
,
192 RscTypCont
* pTC
, sal_uInt32 nTab
, const char * );
193 void WriteRcAccess( FILE * fOutput
, RscTypCont
* pTC
,
198 class RscBreakRange
: public RscRange
{
201 RscBreakRange( Atom nId
, sal_uInt32 nTypId
);
202 void SetOutRange( sal_Int32 nNumber
){
205 RSCINST
Create( RSCINST
* pInst
, const RSCINST
& rDfltInst
, sal_Bool
);
206 ERRTYPE
SetNumber( const RSCINST
&, sal_Int32
);
209 #endif // _RSCRANGE_HXX