Branch data 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 : :
20 : : /****************** I N C L U D E S **************************************/
21 : :
22 : : // C and C++ Includes.
23 : : #include <stdlib.h>
24 : : #include <stdio.h>
25 : : #include <string.h>
26 : :
27 : : // Solar Definitionen
28 : : #include <tools/solar.h>
29 : :
30 : : // Programmabh�ngige Includes.
31 : : #include <rscrange.hxx>
32 : :
33 : : /****************** D E F I N E S ****************************************/
34 : : /****************** C O D E **********************************************/
35 : : /****************** R s c R a n g e **************************************/
36 : : /*************************************************************************
37 : : |*
38 : : |* RscRange::RscRange()
39 : : |*
40 : : *************************************************************************/
41 : 14400 : RscRange::RscRange( Atom nId, sal_uInt32 nTypeId )
42 : 14400 : : RscTop( nId, nTypeId )
43 : : {
44 : 14400 : nMin = nMax = 0;
45 : 14400 : nSize = ALIGNED_SIZE( sizeof( RscRangeInst ) );
46 : 14400 : }
47 : :
48 : : /*************************************************************************
49 : : |*
50 : : |* RscRange::GetClassType()
51 : : |*
52 : : *************************************************************************/
53 : 0 : RSCCLASS_TYPE RscRange::GetClassType() const
54 : : {
55 : 0 : return RSCCLASS_NUMBER;
56 : : }
57 : :
58 : : /*************************************************************************
59 : : |*
60 : : |* RscRange::SetRange()
61 : : |*
62 : : *************************************************************************/
63 : 14400 : ERRTYPE RscRange::SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum )
64 : : {
65 [ - + ]: 14400 : if( nMinimum > nMaximum )
66 : : {
67 : 0 : nMin = nMaximum;
68 : 0 : nMax = nMinimum;
69 : : }
70 : : else
71 : : {
72 : 14400 : nMax = nMaximum;
73 : 14400 : nMin = nMinimum;
74 : : };
75 : :
76 : 14400 : return( ERR_OK );
77 : : }
78 : :
79 : : /*************************************************************************
80 : : |*
81 : : |* RscRange::IsValueDefault()
82 : : |*
83 : : *************************************************************************/
84 : 5442 : sal_Bool RscRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
85 : : {
86 [ + - ]: 5442 : if( pDef )
87 : : {
88 [ + + ]: 5442 : if( ((RscRangeInst*)rInst.pData)->nValue ==
89 : : ((RscRangeInst*)pDef)->nValue )
90 : : {
91 : 1114 : return sal_True;
92 : : }
93 : : }
94 : :
95 : 5442 : return sal_False;
96 : : }
97 : :
98 : : /*************************************************************************
99 : : |*
100 : : |* RscRange::SetNumber()
101 : : |*
102 : : *************************************************************************/
103 : 22108 : ERRTYPE RscRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue )
104 : : {
105 [ + - ][ - + ]: 22108 : if( nMax < nValue || nMin > nValue )
106 : 0 : return( ERR_RSCRANGE_OUTDEFSET );
107 : 22108 : ((RscRangeInst *)rInst.pData)->nValue = (sal_uInt16)( nValue - nMin );
108 : 22108 : ((RscRangeInst *)rInst.pData)->bDflt = sal_False;
109 : 22108 : return( ERR_OK );
110 : : }
111 : :
112 : : /*************************************************************************
113 : : |*
114 : : |* RscRange::GetNumber()
115 : : |*
116 : : *************************************************************************/
117 : 8526 : ERRTYPE RscRange::GetNumber( const RSCINST & rInst, sal_Int32 * pN )
118 : : {
119 : 8526 : *pN = ((RscRangeInst *)rInst.pData)->nValue + nMin;
120 : 8526 : return( ERR_OK );
121 : : }
122 : :
123 : : /*************************************************************************
124 : : |*
125 : : |* RscRange::Create()
126 : : |*
127 : : *************************************************************************/
128 : 181664 : RSCINST RscRange::Create( RSCINST * pInst, const RSCINST & rDflt,
129 : : sal_Bool bOwnClass )
130 : : {
131 : 181664 : RSCINST aInst;
132 : :
133 [ + + ]: 181664 : if( !pInst )
134 : : {
135 : 21650 : aInst.pClass = this;
136 : : aInst.pData = (CLASS_DATA)
137 : 21650 : rtl_allocateMemory( sizeof( RscRangeInst ) );
138 : : }
139 : : else
140 : 160014 : aInst = *pInst;
141 [ + - ][ + + ]: 181664 : if( !bOwnClass && rDflt.IsInst() )
[ + + ]
142 : 332 : bOwnClass = rDflt.pClass->InHierarchy( this );
143 : :
144 [ + + ]: 181664 : if( bOwnClass )
145 : 332 : memmove( aInst.pData, rDflt.pData, sizeof( RscRangeInst ) );
146 : : else
147 : : {
148 [ + + ][ + - ]: 181332 : if( 0L >= nMin && 0L <= nMax )
149 : 181292 : ((RscRangeInst *)aInst.pData)->nValue = (sal_uInt16)(0L - nMin);
150 : : else
151 : 40 : ((RscRangeInst *)aInst.pData)->nValue = 0;
152 : 181332 : ((RscRangeInst *)aInst.pData)->bDflt = sal_True;
153 : : }
154 : :
155 : 181664 : return( aInst );
156 : : }
157 : :
158 : : /*************************************************************************
159 : : |*
160 : : |* RscRange::WriteSrc()
161 : : |*
162 : : *************************************************************************/
163 : 6194 : void RscRange::WriteSrc( const RSCINST & rInst, FILE * fOutput,
164 : : RscTypCont *, sal_uInt32, const char * )
165 : : {
166 : 6194 : fprintf( fOutput, "%ld", long( ((RscRangeInst *)rInst.pData)->nValue + nMin ) );
167 : 6194 : }
168 : :
169 : : /*************************************************************************
170 : : |*
171 : : |* RscRange::WriteRc()
172 : : |*
173 : : *************************************************************************/
174 : 329992 : ERRTYPE RscRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
175 : : RscTypCont *, sal_uInt32, sal_Bool )
176 : : {
177 [ + + ]: 329992 : if( nMin >= 0 )
178 : : {
179 : : sal_uInt16 n;
180 : 12434 : n = (sal_uInt16)(((RscRangeInst *)rInst.pData)->nValue + nMin);
181 : 12434 : aMem.Put( n );
182 : : }
183 : : else
184 : : {
185 : : sal_Int16 n;
186 : 317558 : n = (sal_Int16)(((RscRangeInst *)rInst.pData)->nValue + nMin);
187 : 317558 : aMem.Put( n );
188 : : }
189 : :
190 : 329992 : return( ERR_OK );
191 : : }
192 : :
193 : : //=======================================================================
194 : 0 : void RscRange::WriteRcAccess
195 : : (
196 : : FILE * fOutput,
197 : : RscTypCont * /*pTC*/,
198 : : const char * pName
199 : : )
200 : : {
201 : 0 : fprintf( fOutput, "\t\tSet%s( ", pName );
202 [ # # ]: 0 : if( nMin >= 0 )
203 : 0 : fprintf( fOutput, "*(sal_uInt32 *)(pResData+nOffset) );\n" );
204 : : else
205 : 0 : fprintf( fOutput, "*(sal_Int32 *)(pResData+nOffset) );\n" );
206 : 0 : fprintf( fOutput, "\t\tnOffset += sizeof( sal_uInt32 );\n" );
207 : 0 : }
208 : :
209 : : /****************** R s c L o n g R a n g e ******************************/
210 : : /*************************************************************************
211 : : |*
212 : : |* RscLongRange::RscLongRange()
213 : : |*
214 : : *************************************************************************/
215 : 2880 : RscLongRange::RscLongRange( Atom nId, sal_uInt32 nTypeId )
216 : 2880 : : RscTop( nId, nTypeId )
217 : : {
218 : 2880 : nMin = nMax = 0;
219 : 2880 : nSize = ALIGNED_SIZE( sizeof( RscLongRangeInst ) );
220 : 2880 : }
221 : :
222 : : /*************************************************************************
223 : : |*
224 : : |* RscLongRange::GetClassType()
225 : : |*
226 : : *************************************************************************/
227 : 0 : RSCCLASS_TYPE RscLongRange::GetClassType() const
228 : : {
229 : 0 : return RSCCLASS_NUMBER;
230 : : }
231 : :
232 : : /*************************************************************************
233 : : |*
234 : : |* RscLongRange::SetRange()
235 : : |*
236 : : *************************************************************************/
237 : 2880 : ERRTYPE RscLongRange::SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum )
238 : : {
239 [ - + ]: 2880 : if( nMinimum > nMaximum )
240 : : {
241 : 0 : nMin = nMaximum;
242 : 0 : nMax = nMinimum;
243 : : }
244 : : else
245 : : {
246 : 2880 : nMax = nMaximum;
247 : 2880 : nMin = nMinimum;
248 : : };
249 : :
250 : 2880 : return( ERR_OK );
251 : : }
252 : :
253 : : /*************************************************************************
254 : : |*
255 : : |* RscLongRange::IsValueDefault()
256 : : |*
257 : : *************************************************************************/
258 : 2834 : sal_Bool RscLongRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
259 : : {
260 [ + - ]: 2834 : if( pDef )
261 : : return 0 == memcmp( &((RscLongRangeInst*)rInst.pData)->nValue,
262 : : &((RscLongRangeInst*)pDef)->nValue,
263 : 2834 : sizeof( sal_Int32 ) );
264 : :
265 : 2834 : return sal_False;
266 : : }
267 : :
268 : : /*************************************************************************
269 : : |*
270 : : |* RscLongRange::SetNumber()
271 : : |*
272 : : *************************************************************************/
273 : 161596 : ERRTYPE RscLongRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue )
274 : : {
275 [ + - ][ - + ]: 161596 : if( nMax < nValue || nMin > nValue )
276 : 0 : return( ERR_RSCRANGE_OUTDEFSET );
277 : 161596 : void * pData = &((RscLongRangeInst*)rInst.pData)->nValue;
278 : 161596 : memmove( pData, &nValue, sizeof( sal_Int32 ) );
279 : 161596 : ((RscLongRangeInst *)rInst.pData)->bDflt = sal_False;
280 : 161596 : return( ERR_OK );
281 : : }
282 : :
283 : : /*************************************************************************
284 : : |*
285 : : |* RscLongRange::GetNumber()
286 : : |*
287 : : *************************************************************************/
288 : 165110 : ERRTYPE RscLongRange::GetNumber( const RSCINST & rInst, sal_Int32 * pN )
289 : : {
290 : : memmove( pN, &((RscLongRangeInst*)rInst.pData)->nValue,
291 : 165110 : sizeof( sal_Int32 ) );
292 : 165110 : return( ERR_OK );
293 : : }
294 : :
295 : : /*************************************************************************
296 : : |*
297 : : |* RscLongRange::Create()
298 : : |*
299 : : *************************************************************************/
300 : 219180 : RSCINST RscLongRange::Create( RSCINST * pInst, const RSCINST & rDflt,
301 : : sal_Bool bOwnClass )
302 : : {
303 : 219180 : RSCINST aInst;
304 : :
305 [ + + ]: 219180 : if( !pInst )
306 : : {
307 : 132 : aInst.pClass = this;
308 : : aInst.pData = (CLASS_DATA)
309 : 132 : rtl_allocateMemory( sizeof( RscLongRangeInst ) );
310 : : }
311 : : else
312 : 219048 : aInst = *pInst;
313 [ + - ][ + + ]: 219180 : if( !bOwnClass && rDflt.IsInst() )
[ + + ]
314 : 1084 : bOwnClass = rDflt.pClass->InHierarchy( this );
315 : :
316 [ + + ]: 219180 : if( bOwnClass )
317 : 1084 : memmove( aInst.pData, rDflt.pData, sizeof( RscLongRangeInst ) );
318 : : else
319 : : {
320 : : sal_Int32 lDflt;
321 [ + - ][ + - ]: 218096 : if( 0L >= nMin && 0L <= nMax )
322 : 218096 : lDflt = 0;
323 : : else
324 : 0 : lDflt = nMin;
325 : 218096 : void * pData = &((RscLongRangeInst*)aInst.pData)->nValue;
326 : 218096 : memmove( pData, &lDflt, sizeof( sal_Int32 ) );
327 : 218096 : ((RscLongRangeInst *)aInst.pData)->bDflt = sal_True;
328 : : }
329 : :
330 : 219180 : return( aInst );
331 : : }
332 : :
333 : : /*************************************************************************
334 : : |*
335 : : |* RscLongRange::WriteSrc()
336 : : |*
337 : : *************************************************************************/
338 : 80410 : void RscLongRange::WriteSrc( const RSCINST & rInst, FILE * fOutput,
339 : : RscTypCont *, sal_uInt32, const char * )
340 : : {
341 : : sal_Int32 lVal;
342 [ + - ]: 80410 : GetNumber( rInst, &lVal );
343 [ + - ]: 80410 : fprintf( fOutput, "%d", static_cast<int>(lVal) );
344 : 80410 : }
345 : :
346 : : /*************************************************************************
347 : : |*
348 : : |* RscLongRange::WriteRc()
349 : : |*
350 : : *************************************************************************/
351 : 6236 : ERRTYPE RscLongRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
352 : : RscTypCont *, sal_uInt32, sal_Bool )
353 : : {
354 : : sal_Int32 lVal;
355 : :
356 [ + - ]: 6236 : GetNumber( rInst, &lVal );
357 [ + - ]: 6236 : aMem.Put( (sal_Int32)lVal );
358 : :
359 : 6236 : return( ERR_OK );
360 : : }
361 : :
362 : : //=======================================================================
363 : 0 : void RscLongRange::WriteRcAccess
364 : : (
365 : : FILE * fOutput,
366 : : RscTypCont * /*pTC*/,
367 : : const char * pName
368 : : )
369 : : {
370 : 0 : fprintf( fOutput, "\t\tSet%s( ", pName );
371 : 0 : fprintf( fOutput, "GetLong( pResData+nOffset ) );\n" );
372 : 0 : fprintf( fOutput, "\t\tnOffset += sizeof( sal_Int32 );\n" );
373 : 0 : }
374 : :
375 : : /****************** R s c L o n g E n u m R a n g e *********************/
376 : : /*************************************************************************
377 : : |* RscLongEnumRange::RscLongEnumRange()
378 : : |*
379 : : |* Beschreibung
380 : : *************************************************************************/
381 : 1440 : RscLongEnumRange::RscLongEnumRange( Atom nId, sal_uInt32 nTypeId )
382 : 1440 : : RscLongRange( nId, nTypeId )
383 : : {
384 : 1440 : }
385 : :
386 : : /*************************************************************************
387 : : |* RscLongEnumRange::SetConst()
388 : : |*
389 : : |* Beschreibung
390 : : *************************************************************************/
391 : 102 : ERRTYPE RscLongEnumRange::SetConst( const RSCINST & rInst, Atom /*nConst*/,
392 : : sal_Int32 nValue )
393 : : {
394 : 102 : return SetNumber( rInst, nValue );
395 : : }
396 : :
397 : : /****************** R s c I d R a n g e **********************************/
398 : : /*************************************************************************
399 : : |*
400 : : |* RscIdRange::RscIdRange()
401 : : |*
402 : : *************************************************************************/
403 : 4320 : RscIdRange::RscIdRange( Atom nId, sal_uInt32 nTypeId )
404 : 4320 : : RscTop( nId, nTypeId )
405 : : {
406 : 4320 : nSize = ALIGNED_SIZE( sizeof( RscId ) );
407 : 4320 : nMin = nMax = 0;
408 : 4320 : }
409 : :
410 : : /*************************************************************************
411 : : |*
412 : : |* RscIdRange::RscIdRange()
413 : : |*
414 : : *************************************************************************/
415 : 0 : RSCCLASS_TYPE RscIdRange::GetClassType() const
416 : : {
417 : 0 : return RSCCLASS_NUMBER;
418 : : }
419 : :
420 : : /*************************************************************************
421 : : |*
422 : : |* RscIdRange::Create()
423 : : |*
424 : : *************************************************************************/
425 : 34460 : RSCINST RscIdRange::Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool bOwnClass ){
426 : 34460 : RSCINST aInst;
427 : : RscId * pClassData;
428 : :
429 [ + + ]: 34460 : if( !pInst ){
430 : 1956 : aInst.pClass = this;
431 : 1956 : aInst.pData = (CLASS_DATA)rtl_allocateMemory( sizeof( RscId ) );
432 : : }
433 : : else
434 : 32504 : aInst = *pInst;
435 : :
436 : :
437 [ + - ][ + + ]: 34460 : if( !bOwnClass && rDflt.IsInst() )
[ + + ]
438 : 32 : bOwnClass = rDflt.pClass->InHierarchy( this );
439 : :
440 : 34460 : pClassData = (RscId *)aInst.pData;
441 : :
442 : 34460 : pClassData->Create();
443 [ + + ]: 34460 : if( bOwnClass )
444 : 32 : *pClassData = *(RscId *)rDflt.pData;
445 : : else{
446 [ + - ]: 34428 : *pClassData = RscId();
447 [ + - ][ + + ]: 34428 : if( 0 >= nMin && 0 <= nMax )
448 [ + - ]: 16266 : *pClassData = RscId( (sal_Int32)0 );
449 : : else
450 [ + - ]: 18162 : *pClassData = RscId( nMin );
451 : : //cUnused wird fuer Defaultkennung verwendet
452 : 34428 : ((RscId *)aInst.pData)->aExp.cUnused = sal_True;
453 : : }
454 : :
455 : 34460 : return( aInst );
456 : : }
457 : :
458 : : /*************************************************************************
459 : : |*
460 : : |* RscIdRange::Destroy()
461 : : |*
462 : : *************************************************************************/
463 : 34460 : void RscIdRange :: Destroy( const RSCINST & rInst ){
464 : 34460 : ((RscId *)rInst.pData)->Destroy();
465 : 34460 : }
466 : :
467 : : /*************************************************************************
468 : : |*
469 : : |* RscIdRange::IsValueDefault()
470 : : |*
471 : : *************************************************************************/
472 : 11486 : sal_Bool RscIdRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){
473 [ + - ]: 11486 : if( pDef ){
474 [ + - + - ]: 22972 : if( ((RscId*)rInst.pData)->aExp.IsNumber()
[ + - ]
475 : 11486 : && ((RscId*)pDef)->aExp.IsNumber() )
476 : : {
477 [ + + ]: 22972 : if( ((RscId*)rInst.pData)->GetNumber() ==
478 : 11486 : ((RscId*)pDef)->GetNumber() )
479 : : {
480 : 464 : return sal_True;
481 : : }
482 : : }
483 : : }
484 : :
485 : 11486 : return sal_False;
486 : : }
487 : :
488 : : /*************************************************************************
489 : : |*
490 : : |* RscIdRange::SetNumber()
491 : : |*
492 : : *************************************************************************/
493 : 23900 : ERRTYPE RscIdRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue )
494 : : {
495 [ + - ][ - + ]: 23900 : if( nMax < nValue || nMin > nValue )
496 : 0 : return( ERR_RSCRANGE_OUTDEFSET );
497 : :
498 [ + - ]: 23900 : *(RscId *)rInst.pData = RscId( nValue );
499 : 23900 : ((RscId *)rInst.pData)->aExp.cUnused = sal_False;
500 : 23900 : return( ERR_OK );
501 : : }
502 : :
503 : : /*************************************************************************
504 : : |*
505 : : |* RscIdRange::GetNumber()
506 : : |*
507 : : *************************************************************************/
508 : 0 : ERRTYPE RscIdRange::GetNumber( const RSCINST & rInst, sal_Int32 * plValue ){
509 : 0 : *plValue = ((RscId *)rInst.pData)->GetNumber();
510 : 0 : return( ERR_OK );
511 : : }
512 : :
513 : : /*************************************************************************
514 : : |*
515 : : |* RscIdRange::SetRef()
516 : : |*
517 : : *************************************************************************/
518 : 23900 : ERRTYPE RscIdRange::SetRef( const RSCINST & rInst, const RscId & rRscId ){
519 : 23900 : ERRTYPE aError;
520 [ + - ]: 23900 : if( rRscId.IsId() ){
521 [ + - ]: 23900 : aError = SetNumber( rInst, rRscId );
522 [ + - ]: 23900 : if( aError.IsOk() ){
523 : 23900 : *(RscId *)rInst.pData = rRscId;
524 : 23900 : ((RscId *)rInst.pData)->aExp.cUnused = sal_False;
525 : : }
526 : : }
527 : : else
528 [ # # ]: 0 : aError = ERR_RSCRANGE_OUTDEFSET;
529 : :
530 : 23900 : return( aError );
531 : : }
532 : :
533 : : /*************************************************************************
534 : : |*
535 : : |* RscIdRange::GetRef()
536 : : |*
537 : : *************************************************************************/
538 : 1408 : ERRTYPE RscIdRange::GetRef( const RSCINST & rInst, RscId * pRscId ){
539 : 1408 : *pRscId = *(RscId *)rInst.pData;
540 : :
541 : 1408 : return( ERR_OK );
542 : : }
543 : :
544 : : /*************************************************************************
545 : : |*
546 : : |* RscIdRange::WriteSrc()
547 : : |*
548 : : *************************************************************************/
549 : 12430 : void RscIdRange::WriteSrc( const RSCINST & rInst, FILE * fOutput,
550 : : RscTypCont *, sal_uInt32, const char * )
551 : : {
552 [ + - ]: 12430 : fprintf( fOutput, "%s", ((RscId *)rInst.pData)->GetName().getStr() );
553 : 12430 : }
554 : :
555 : : /*************************************************************************
556 : : |*
557 : : |* RscIdRange::WriteRc()
558 : : |*
559 : : *************************************************************************/
560 : 11054 : ERRTYPE RscIdRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
561 : : RscTypCont *, sal_uInt32, sal_Bool )
562 : : {
563 : 11054 : sal_Int32 lVal = ((RscId*)rInst.pData)->GetNumber();
564 : :
565 : 11054 : aMem.Put( (sal_Int32)lVal );
566 : :
567 : 11054 : return( ERR_OK );
568 : : }
569 : :
570 : : //=======================================================================
571 : 0 : void RscIdRange::WriteRcAccess
572 : : (
573 : : FILE * fOutput,
574 : : RscTypCont * /*pTC*/,
575 : : const char * pName
576 : : )
577 : : {
578 : 0 : fprintf( fOutput, "\t\tSet%s( ", pName );
579 : 0 : fprintf( fOutput, "GetLong( pResData+nOffset ) );\n" );
580 : 0 : fprintf( fOutput, "\t\tnOffset += sizeof( sal_Int32 );\n" );
581 : 0 : }
582 : :
583 : : /*************************************************************************
584 : : |*
585 : : |* RscIdRange::IsConsistent()
586 : : |*
587 : : *************************************************************************/
588 : 0 : sal_Bool RscIdRange::IsConsistent( const RSCINST & rInst )
589 : : {
590 : 0 : long nValue = ((RscId *)rInst.pData)->GetNumber();
591 [ # # ][ # # ]: 0 : if( (nMax >= nValue) && (nMin <= nValue) )
592 : 0 : return sal_True;
593 : : else {
594 : 0 : return sal_False;
595 : : }
596 : : }
597 : :
598 : : /****************** R s c B o o l ****************************************/
599 : : /*************************************************************************
600 : : |*
601 : : |* RscBool::RscBool()
602 : : |*
603 : : *************************************************************************/
604 : 1440 : RscBool::RscBool( Atom nId, sal_uInt32 nTypeId )
605 : 1440 : : RscRange( nId, nTypeId )
606 : : {
607 : 1440 : RscRange::SetRange( 0, 1 );
608 : 1440 : }
609 : :
610 : : /*************************************************************************
611 : : |*
612 : : |* RscBool::GetClassType()
613 : : |*
614 : : *************************************************************************/
615 : 0 : RSCCLASS_TYPE RscBool::GetClassType() const
616 : : {
617 : 0 : return RSCCLASS_BOOL;
618 : : }
619 : :
620 : : /*************************************************************************
621 : : |*
622 : : |* RscBool::WriteSrc()
623 : : |*
624 : : *************************************************************************/
625 : 1562 : void RscBool::WriteSrc( const RSCINST & rInst, FILE * fOutput,
626 : : RscTypCont *, sal_uInt32, const char * )
627 : : {
628 : : sal_Int32 l;
629 : :
630 [ + - ]: 1562 : GetNumber( rInst, &l );
631 [ + - ]: 1562 : if( l )
632 [ + - ]: 1562 : fprintf( fOutput, "TRUE" );
633 : : else
634 [ # # ]: 0 : fprintf( fOutput, "FALSE" );
635 : 1562 : }
636 : :
637 : : //=======================================================================
638 : 0 : void RscBool::WriteRcAccess
639 : : (
640 : : FILE * fOutput,
641 : : RscTypCont * /*pTC*/,
642 : : const char * pName
643 : : )
644 : : {
645 : 0 : fprintf( fOutput, "\t\tSet%s( ", pName );
646 : 0 : fprintf( fOutput, "(sal_Bool)*(short *)(pResData+nOffset) );\n" );
647 : 0 : fprintf( fOutput, "\t\tnOffset += sizeof( short );\n" );
648 : 0 : }
649 : :
650 : : /****************** R s c B r e a k R a n g e ****************************/
651 : : /*************************************************************************
652 : : |*
653 : : |* RscBreakRange::SetNumber()
654 : : |*
655 : : *************************************************************************/
656 : 1440 : RscBreakRange :: RscBreakRange( Atom nId, sal_uInt32 nTypeId )
657 : 1440 : : RscRange( nId, nTypeId )
658 : : {
659 : 1440 : nOutRange = 0xFFFFFFFF;
660 : 1440 : }
661 : :
662 : : /*************************************************************************
663 : : |*
664 : : |* RscBreakRange::SetNumber()
665 : : |*
666 : : *************************************************************************/
667 : 0 : ERRTYPE RscBreakRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue ){
668 [ # # ]: 0 : if( nValue == nOutRange )
669 : 0 : return( ERR_RSCRANGE_OUTDEFSET );
670 : : else
671 : 0 : return( RscRange::SetNumber( rInst, nValue ) );
672 : : }
673 : :
674 : : /*************************************************************************
675 : : |*
676 : : |* RscBreakRange::Create()
677 : : |*
678 : : *************************************************************************/
679 : 0 : RSCINST RscBreakRange::Create( RSCINST * pInst, const RSCINST & rDflt,
680 : : sal_Bool bOwnClass )
681 : : {
682 : 0 : RSCINST aInst;
683 : : sal_Int32 l;
684 : :
685 [ # # ]: 0 : aInst = RscRange::Create( pInst, rDflt, bOwnClass );
686 : :
687 [ # # ]: 0 : GetNumber( aInst, &l );
688 [ # # ]: 0 : if( l == nOutRange )
689 : 0 : ((RscRangeInst *)aInst.pData)->nValue++;
690 : :
691 : 0 : return( aInst );
692 : : }
693 : :
694 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|