Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / rsc / inc / rscrange.hxx
blobd1a8c97d66a49f4dbad3696502c8bd9e24efe5d1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _RSCRANGE_HXX
20 #define _RSCRANGE_HXX
22 #include <rscall.h>
23 #include <rscerror.h>
24 #include <rschash.hxx>
25 #include <rsctop.hxx>
27 /******************* R s c R a n g e *************************************/
28 class RscRange : public RscTop
30 protected:
31 struct RscRangeInst {
32 sal_uInt16 nValue; // nValue = Ausgangswert - nMin
33 sal_Bool bDflt; // Ist Default
35 sal_Int32 nMin; // Minimum des Bereiches
36 sal_Int32 nMax; // Maximum des Bereiches
37 sal_uInt32 nSize;
38 public:
39 RscRange( Atom nId, sal_uInt32 nTypId );
40 virtual RSCCLASS_TYPE GetClassType() const;
41 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool );
42 // Der zulaessige Bereich wird gesetzt
43 ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum );
44 // Gibt die Groesse der Klasse in Bytes
45 sal_uInt32 Size(){ return nSize; }
46 // Eine Zuweisung an eine Variable
47 virtual void SetToDefault( const RSCINST & rInst )
49 ((RscRangeInst*)rInst.pData)->bDflt = sal_True;
51 sal_Bool IsDefault( const RSCINST & rInst)
53 return( ((RscRangeInst*)rInst.pData)->bDflt );
55 // Als Default setzen
56 sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
57 ERRTYPE SetNumber( const RSCINST &, sal_Int32 );
58 ERRTYPE GetNumber( const RSCINST &, sal_Int32 * );
59 void WriteSrc( const RSCINST &, FILE * fOutput,
60 RscTypCont * pTC, sal_uInt32 nTab, const char * );
61 ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
62 RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
63 void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
64 const char * );
67 /******************* R s c L o n g R a n g e ******************************/
68 class RscLongRange : public RscTop
70 protected:
71 struct RscLongRangeInst
73 sal_Int32 nValue; // nValue = Ausgangswert - nMin
74 sal_Bool bDflt; // Ist Default
76 sal_Int32 nMin; // Minimum des Bereiches
77 sal_Int32 nMax; // Maximum des Bereiches
78 sal_uInt32 nSize;
79 public:
80 RscLongRange( Atom nId, sal_uInt32 nTypId );
81 virtual RSCCLASS_TYPE GetClassType() const;
82 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool );
83 // Der zulaessige Bereich wird gesetzt
84 ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum );
85 // Gibt die Groesse der Klasse in Bytes
86 sal_uInt32 Size(){ return nSize; }
87 // Eine Zuweisung an eine Variable
88 virtual void SetToDefault( const RSCINST & rInst )
90 ((RscLongRangeInst*)rInst.pData)->bDflt = sal_True;
92 sal_Bool IsDefault( const RSCINST & rInst)
94 return( ((RscLongRangeInst*)rInst.pData)->bDflt );
96 // Als Default setzen
97 sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
98 ERRTYPE SetNumber( const RSCINST &, sal_Int32 );
99 ERRTYPE GetNumber( const RSCINST &, sal_Int32 * );
100 void WriteSrc( const RSCINST &, FILE * fOutput,
101 RscTypCont * pTC, sal_uInt32 nTab, const char * );
102 ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
103 RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
104 void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
105 const char * );
109 /******************* R s c L o n g E n u m R a n g e ******************/
110 class RscLongEnumRange : public RscLongRange
112 public:
113 RscLongEnumRange( Atom nId, sal_uInt32 nTypId );
115 ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId,
116 sal_Int32 nValue );
119 /******************* R s c I d R a n g e ***********************************/
120 class RscIdRange : public RscTop
122 sal_uInt32 nSize;
123 protected:
124 sal_Int32 nMin; // Minimum des Bereiches
125 sal_Int32 nMax; // Maximum des Bereiches
126 public:
127 RscIdRange( Atom nId, sal_uInt32 nTypId );
128 virtual RSCCLASS_TYPE GetClassType() const;
129 // Der zulaessige Bereich wird gesetzt
130 ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ){
131 nMin = nMinimum;
132 nMax = nMaximum;
133 return ERR_OK;
135 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool );
136 void Destroy( const RSCINST & rInst );
137 sal_uInt32 Size(){ return nSize; }
138 virtual void SetToDefault( const RSCINST & rInst )
140 ((RscId*)rInst.pData)->aExp.cUnused = sal_True;
142 sal_Bool IsDefault( const RSCINST & rInst)
144 //cUnused wird fuer Defaultkennung verwendet
145 return ((RscId*)rInst.pData)->aExp.cUnused
146 ? sal_True : sal_False;
148 // Als Default setzen
149 sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
150 ERRTYPE SetNumber( const RSCINST &, sal_Int32 );
151 ERRTYPE GetNumber( const RSCINST &, sal_Int32 * );
152 ERRTYPE SetRef( const RSCINST &, const RscId & rRscId );
153 ERRTYPE GetRef( const RSCINST & rInst, RscId * );
154 void WriteSrc( const RSCINST &, FILE * fOutput,
155 RscTypCont * pTC, sal_uInt32 nTab, const char * );
156 ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
157 RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
158 sal_Bool IsConsistent( const RSCINST & rInst );
159 void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
160 const char * );
164 /******************* R s c B o o l ***************************************/
165 class RscBool : public RscRange
167 public:
168 RscBool( Atom nId, sal_uInt32 nTypId );
169 virtual RSCCLASS_TYPE GetClassType() const;
170 // Der zulaessige Bereich wird gesetzt
171 ERRTYPE SetRange( sal_Int32, sal_Int32 ){
172 return( ERR_UNKNOWN_METHOD );
174 ERRTYPE SetBool( const RSCINST & rInst, sal_Bool b ){
175 return( SetNumber( rInst, (sal_Int32)b ) );
177 ERRTYPE GetBool( const RSCINST & rInst, sal_Bool * pB){
178 sal_Int32 l;
179 GetNumber( rInst, &l );
180 *pB = (0 != l);
181 return( ERR_OK );
183 void WriteSrc( const RSCINST &, FILE * fOutput,
184 RscTypCont * pTC, sal_uInt32 nTab, const char * );
185 void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
186 const char * );
190 class RscBreakRange : public RscRange {
191 sal_Int32 nOutRange;
192 public:
193 RscBreakRange( Atom nId, sal_uInt32 nTypId );
194 void SetOutRange( sal_Int32 nNumber ){
195 nOutRange = nNumber;
197 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool );
198 ERRTYPE SetNumber( const RSCINST &, sal_Int32 );
201 #endif // _RSCRANGE_HXX
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */