Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_RSC_INC_RSCRANGE_HXX
20 : #define INCLUDED_RSC_INC_RSCRANGE_HXX
21 :
22 : #include <rscall.h>
23 : #include <rscerror.h>
24 : #include <rschash.hxx>
25 : #include <rsctop.hxx>
26 :
27 1668 : class RscRange : public RscTop
28 : {
29 : protected:
30 : struct RscRangeInst
31 : {
32 : sal_uInt16 nValue; // nValue = Ausgangswert - nMin
33 : bool bDflt; // Ist Default
34 : };
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 26271 : sal_uInt32 Size() SAL_OVERRIDE { return nSize; }
46 : // Eine Zuweisung an eine Variable
47 0 : virtual void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE
48 : {
49 0 : reinterpret_cast<RscRangeInst*>(rInst.pData)->bDflt = true;
50 0 : }
51 0 : bool IsDefault( const RSCINST & rInst) SAL_OVERRIDE
52 : {
53 0 : return reinterpret_cast<RscRangeInst*>(rInst.pData)->bDflt;
54 : };
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;
63 : };
64 :
65 834 : class RscLongRange : public RscTop
66 : {
67 : protected:
68 : struct RscLongRangeInst
69 : {
70 : sal_Int32 nValue; // nValue = Ausgangswert - nMin
71 : bool bDflt; // Ist Default
72 : };
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 5004 : sal_uInt32 Size() SAL_OVERRIDE { return nSize; }
84 : // Eine Zuweisung an eine Variable
85 0 : virtual void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE
86 : {
87 0 : reinterpret_cast<RscLongRangeInst*>(rInst.pData)->bDflt = true;
88 0 : }
89 0 : bool IsDefault( const RSCINST & rInst) SAL_OVERRIDE
90 : {
91 0 : return reinterpret_cast<RscLongRangeInst*>(rInst.pData)->bDflt;
92 : };
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;
101 :
102 : };
103 :
104 417 : class RscLongEnumRange : public RscLongRange
105 : {
106 : public:
107 : RscLongEnumRange( Atom nId, sal_uInt32 nTypId );
108 :
109 : ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId,
110 : sal_Int32 nValue ) SAL_OVERRIDE;
111 : };
112 :
113 1251 : class RscIdRange : public RscTop
114 : {
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 1251 : ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum )
124 : {
125 1251 : nMin = nMinimum;
126 1251 : nMax = nMaximum;
127 1251 : return ERR_OK;
128 : }
129 : RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool ) SAL_OVERRIDE;
130 : void Destroy( const RSCINST & rInst ) SAL_OVERRIDE;
131 7089 : sal_uInt32 Size() SAL_OVERRIDE { return nSize; }
132 0 : virtual void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE
133 : {
134 0 : reinterpret_cast<RscId*>(rInst.pData)->aExp.cUnused = true;
135 0 : }
136 0 : bool IsDefault( const RSCINST & rInst) SAL_OVERRIDE
137 : {
138 : //cUnused wird fuer Defaultkennung verwendet
139 0 : return reinterpret_cast<RscId*>(rInst.pData)->aExp.cUnused;
140 : }
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;
152 : };
153 :
154 417 : class RscBool : public RscRange
155 : {
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 1057 : ERRTYPE SetBool( const RSCINST & rInst, bool b ) SAL_OVERRIDE
162 : {
163 1057 : return SetNumber( rInst, (sal_Int32)b );
164 : };
165 0 : ERRTYPE GetBool( const RSCINST & rInst, bool * pB) SAL_OVERRIDE
166 : {
167 : sal_Int32 l;
168 0 : GetNumber( rInst, &l );
169 0 : *pB = (0 != l);
170 0 : return ERR_OK;
171 : };
172 : void WriteSrc( const RSCINST &, FILE * fOutput,
173 : RscTypCont * pTC, sal_uInt32 nTab, const char * ) SAL_OVERRIDE;
174 : };
175 :
176 417 : class RscBreakRange : public RscRange
177 : {
178 : sal_Int32 nOutRange;
179 : public:
180 : RscBreakRange( Atom nId, sal_uInt32 nTypId );
181 417 : 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;
184 : };
185 :
186 : #endif // INCLUDED_RSC_INC_RSCRANGE_HXX
187 :
188 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|