bump product version to 4.2.0.1
[LibreOffice.git] / rsc / inc / rscrange.hxx
blob00dbf283a77db32903bfc1314d9de4043fe26dde
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 class RscRange : public RscTop
29 protected:
30 struct RscRangeInst
32 sal_uInt16 nValue; // nValue = Ausgangswert - nMin
33 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, 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 = true;
51 bool IsDefault( const RSCINST & rInst)
53 return( ((RscRangeInst*)rInst.pData)->bDflt );
55 // Als Default setzen
56 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, bool bExtra );
65 class RscLongRange : public RscTop
67 protected:
68 struct RscLongRangeInst
70 sal_Int32 nValue; // nValue = Ausgangswert - nMin
71 bool bDflt; // Ist Default
73 sal_Int32 nMin; // Minimum des Bereiches
74 sal_Int32 nMax; // Maximum des Bereiches
75 sal_uInt32 nSize;
76 public:
77 RscLongRange( Atom nId, sal_uInt32 nTypId );
78 virtual RSCCLASS_TYPE GetClassType() const;
79 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool );
80 // Der zulaessige Bereich wird gesetzt
81 ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum );
82 // Gibt die Groesse der Klasse in Bytes
83 sal_uInt32 Size(){ return nSize; }
84 // Eine Zuweisung an eine Variable
85 virtual void SetToDefault( const RSCINST & rInst )
87 ((RscLongRangeInst*)rInst.pData)->bDflt = true;
89 bool IsDefault( const RSCINST & rInst)
91 return( ((RscLongRangeInst*)rInst.pData)->bDflt );
93 // Als Default setzen
94 bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
95 ERRTYPE SetNumber( const RSCINST &, sal_Int32 );
96 ERRTYPE GetNumber( const RSCINST &, sal_Int32 * );
97 void WriteSrc( const RSCINST &, FILE * fOutput,
98 RscTypCont * pTC, sal_uInt32 nTab, const char * );
99 ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
100 RscTypCont * pTC, sal_uInt32, bool bExtra );
104 class RscLongEnumRange : public RscLongRange
106 public:
107 RscLongEnumRange( Atom nId, sal_uInt32 nTypId );
109 ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId,
110 sal_Int32 nValue );
113 class RscIdRange : public RscTop
115 sal_uInt32 nSize;
116 protected:
117 sal_Int32 nMin; // Minimum des Bereiches
118 sal_Int32 nMax; // Maximum des Bereiches
119 public:
120 RscIdRange( Atom nId, sal_uInt32 nTypId );
121 virtual RSCCLASS_TYPE GetClassType() const;
122 // Der zulaessige Bereich wird gesetzt
123 ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum )
125 nMin = nMinimum;
126 nMax = nMaximum;
127 return ERR_OK;
129 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool );
130 void Destroy( const RSCINST & rInst );
131 sal_uInt32 Size(){ return nSize; }
132 virtual void SetToDefault( const RSCINST & rInst )
134 ((RscId*)rInst.pData)->aExp.cUnused = true;
136 bool IsDefault( const RSCINST & rInst)
138 //cUnused wird fuer Defaultkennung verwendet
139 return ((RscId*)rInst.pData)->aExp.cUnused
140 ? true : false;
142 // Als Default setzen
143 bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
144 ERRTYPE SetNumber( const RSCINST &, sal_Int32 );
145 ERRTYPE GetNumber( const RSCINST &, sal_Int32 * );
146 ERRTYPE SetRef( const RSCINST &, const RscId & rRscId );
147 ERRTYPE GetRef( const RSCINST & rInst, RscId * );
148 void WriteSrc( const RSCINST &, FILE * fOutput,
149 RscTypCont * pTC, sal_uInt32 nTab, const char * );
150 ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
151 RscTypCont * pTC, sal_uInt32, bool bExtra );
152 bool IsConsistent( const RSCINST & rInst );
155 class RscBool : public RscRange
157 public:
158 RscBool( Atom nId, sal_uInt32 nTypId );
159 virtual RSCCLASS_TYPE GetClassType() const;
160 // Der zulaessige Bereich wird gesetzt
161 ERRTYPE SetRange( sal_Int32, sal_Int32 ){ return ERR_UNKNOWN_METHOD; }
162 ERRTYPE SetBool( const RSCINST & rInst, bool b )
164 return SetNumber( rInst, (sal_Int32)b );
166 ERRTYPE GetBool( const RSCINST & rInst, bool * pB)
168 sal_Int32 l;
169 GetNumber( rInst, &l );
170 *pB = (0 != l);
171 return ERR_OK;
173 void WriteSrc( const RSCINST &, FILE * fOutput,
174 RscTypCont * pTC, sal_uInt32 nTab, const char * );
177 class RscBreakRange : public RscRange
179 sal_Int32 nOutRange;
180 public:
181 RscBreakRange( Atom nId, sal_uInt32 nTypId );
182 void SetOutRange( sal_Int32 nNumber ) { nOutRange = nNumber; }
183 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool );
184 ERRTYPE SetNumber( const RSCINST &, sal_Int32 );
187 #endif // _RSCRANGE_HXX
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */