bump product version to 5.0.4.1
[LibreOffice.git] / rsc / inc / rscrange.hxx
blob0efe0d94d02edc7977557bb6b5a4ce4356e769ef
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 INCLUDED_RSC_INC_RSCRANGE_HXX
20 #define INCLUDED_RSC_INC_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 SAL_OVERRIDE;
41 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool ) SAL_OVERRIDE;
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() SAL_OVERRIDE { return nSize; }
46 // Eine Zuweisung an eine Variable
47 virtual void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE
49 reinterpret_cast<RscRangeInst*>(rInst.pData)->bDflt = true;
51 bool IsDefault( const RSCINST & rInst) SAL_OVERRIDE
53 return reinterpret_cast<RscRangeInst*>(rInst.pData)->bDflt;
55 // Als Default setzen
56 bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) SAL_OVERRIDE;
57 ERRTYPE SetNumber( const RSCINST &, sal_Int32 ) SAL_OVERRIDE;
58 ERRTYPE GetNumber( const RSCINST &, sal_Int32 * ) SAL_OVERRIDE;
59 void WriteSrc( const RSCINST &, FILE * fOutput,
60 RscTypCont * pTC, sal_uInt32 nTab, const char * ) SAL_OVERRIDE;
61 ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
62 RscTypCont * pTC, sal_uInt32, bool bExtra ) SAL_OVERRIDE;
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 SAL_OVERRIDE;
79 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool ) SAL_OVERRIDE;
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() SAL_OVERRIDE { return nSize; }
84 // Eine Zuweisung an eine Variable
85 virtual void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE
87 reinterpret_cast<RscLongRangeInst*>(rInst.pData)->bDflt = true;
89 bool IsDefault( const RSCINST & rInst) SAL_OVERRIDE
91 return reinterpret_cast<RscLongRangeInst*>(rInst.pData)->bDflt;
93 // Als Default setzen
94 bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) SAL_OVERRIDE;
95 ERRTYPE SetNumber( const RSCINST &, sal_Int32 ) SAL_OVERRIDE;
96 ERRTYPE GetNumber( const RSCINST &, sal_Int32 * ) SAL_OVERRIDE;
97 void WriteSrc( const RSCINST &, FILE * fOutput,
98 RscTypCont * pTC, sal_uInt32 nTab, const char * ) SAL_OVERRIDE;
99 ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
100 RscTypCont * pTC, sal_uInt32, bool bExtra ) SAL_OVERRIDE;
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 ) SAL_OVERRIDE;
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 SAL_OVERRIDE;
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 ) SAL_OVERRIDE;
130 void Destroy( const RSCINST & rInst ) SAL_OVERRIDE;
131 sal_uInt32 Size() SAL_OVERRIDE { return nSize; }
132 virtual void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE
134 reinterpret_cast<RscId*>(rInst.pData)->aExp.cUnused = true;
136 bool IsDefault( const RSCINST & rInst) SAL_OVERRIDE
138 //cUnused wird fuer Defaultkennung verwendet
139 return reinterpret_cast<RscId*>(rInst.pData)->aExp.cUnused;
141 // Als Default setzen
142 bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) SAL_OVERRIDE;
143 ERRTYPE SetNumber( const RSCINST &, sal_Int32 ) SAL_OVERRIDE;
144 ERRTYPE GetNumber( const RSCINST &, sal_Int32 * ) SAL_OVERRIDE;
145 ERRTYPE SetRef( const RSCINST &, const RscId & rRscId ) SAL_OVERRIDE;
146 ERRTYPE GetRef( const RSCINST & rInst, RscId * ) SAL_OVERRIDE;
147 void WriteSrc( const RSCINST &, FILE * fOutput,
148 RscTypCont * pTC, sal_uInt32 nTab, const char * ) SAL_OVERRIDE;
149 ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
150 RscTypCont * pTC, sal_uInt32, bool bExtra ) SAL_OVERRIDE;
151 bool IsConsistent( const RSCINST & rInst ) SAL_OVERRIDE;
154 class RscBool : public RscRange
156 public:
157 RscBool( Atom nId, sal_uInt32 nTypId );
158 virtual RSCCLASS_TYPE GetClassType() const SAL_OVERRIDE;
159 // Der zulaessige Bereich wird gesetzt
160 static ERRTYPE SetRange( sal_Int32, sal_Int32 ){ return ERR_UNKNOWN_METHOD; }
161 ERRTYPE SetBool( const RSCINST & rInst, bool b ) SAL_OVERRIDE
163 return SetNumber( rInst, (sal_Int32)b );
165 ERRTYPE GetBool( const RSCINST & rInst, bool * pB) SAL_OVERRIDE
167 sal_Int32 l;
168 GetNumber( rInst, &l );
169 *pB = (0 != l);
170 return ERR_OK;
172 void WriteSrc( const RSCINST &, FILE * fOutput,
173 RscTypCont * pTC, sal_uInt32 nTab, const char * ) SAL_OVERRIDE;
176 class RscBreakRange : public RscRange
178 sal_Int32 nOutRange;
179 public:
180 RscBreakRange( Atom nId, sal_uInt32 nTypId );
181 void SetOutRange( sal_Int32 nNumber ) { nOutRange = nNumber; }
182 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool ) SAL_OVERRIDE;
183 ERRTYPE SetNumber( const RSCINST &, sal_Int32 ) SAL_OVERRIDE;
186 #endif // INCLUDED_RSC_INC_RSCRANGE_HXX
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */