xref: /trunk/main/rsc/source/res/rscrange.cxx (revision 477794c1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_rsc.hxx"
26 /****************** I N C L U D E S **************************************/
27 
28 // C and C++ Includes.
29 #include <stdlib.h>
30 #include <stdio.h>
31 #include <string.h>
32 
33 // Solar Definitionen
34 #include <tools/solar.h>
35 
36 // Programmabh�ngige Includes.
37 #include <rscrange.hxx>
38 
39 /****************** D E F I N E S ****************************************/
40 /****************** C O D E **********************************************/
41 /****************** R s c R a n g e **************************************/
42 /*************************************************************************
43 |*
44 |*	  RscRange::RscRange()
45 |*
46 |*	  Beschreibung
47 |*	  Ersterstellung	MM 03.04.91
48 |*	  Letzte Aenderung	MM 03.04.91
49 |*
50 *************************************************************************/
RscRange(Atom nId,sal_uInt32 nTypeId)51 RscRange::RscRange( Atom nId, sal_uInt32 nTypeId )
52 						: RscTop( nId, nTypeId )
53 {
54 	nMin = nMax = 0;
55 	nSize = ALIGNED_SIZE( sizeof( RscRangeInst ) );
56 }
57 
58 /*************************************************************************
59 |*
60 |*	  RscRange::GetClassType()
61 |*
62 |*	  Beschreibung
63 |*	  Ersterstellung	MM 03.04.91
64 |*	  Letzte Aenderung	MM 03.04.91
65 |*
66 *************************************************************************/
GetClassType() const67 RSCCLASS_TYPE RscRange::GetClassType() const
68 {
69 	return RSCCLASS_NUMBER;
70 }
71 
72 /*************************************************************************
73 |*
74 |*	  RscRange::SetRange()
75 |*
76 |*	  Beschreibung
77 |*	  Ersterstellung	MM 03.04.91
78 |*	  Letzte Aenderung	MM 03.04.91
79 |*
80 *************************************************************************/
SetRange(sal_Int32 nMinimum,sal_Int32 nMaximum)81 ERRTYPE RscRange::SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum )
82 {
83 	if( nMinimum > nMaximum )
84 	{
85 		nMin = nMaximum;
86 		nMax = nMinimum;
87 	}
88 	else
89 	{
90 		nMax = nMaximum;
91 		nMin = nMinimum;
92 	};
93 
94 	return( ERR_OK );
95 }
96 
97 /*************************************************************************
98 |*
99 |*	  RscRange::IsValueDefault()
100 |*
101 |*	  Beschreibung
102 |*	  Ersterstellung	MM 15.02.92
103 |*	  Letzte Aenderung	MM 15.02.92
104 |*
105 *************************************************************************/
IsValueDefault(const RSCINST & rInst,CLASS_DATA pDef)106 sal_Bool RscRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
107 {
108 	if( pDef )
109 	{
110 		if( ((RscRangeInst*)rInst.pData)->nValue ==
111 		  ((RscRangeInst*)pDef)->nValue )
112 		{
113 			return sal_True;
114 		}
115 	}
116 
117 	return sal_False;
118 }
119 
120 /*************************************************************************
121 |*
122 |*	  RscRange::SetNumber()
123 |*
124 |*	  Beschreibung
125 |*	  Ersterstellung	MM 03.04.91
126 |*	  Letzte Aenderung	MM 03.04.91
127 |*
128 *************************************************************************/
SetNumber(const RSCINST & rInst,sal_Int32 nValue)129 ERRTYPE RscRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue )
130 {
131 	if( nMax < nValue || nMin > nValue )
132 		return( ERR_RSCRANGE_OUTDEFSET );
133 	((RscRangeInst *)rInst.pData)->nValue = (sal_uInt16)( nValue - nMin );
134 	((RscRangeInst *)rInst.pData)->bDflt = sal_False;
135 	return( ERR_OK );
136 }
137 
138 /*************************************************************************
139 |*
140 |*	  RscRange::GetNumber()
141 |*
142 |*	  Beschreibung
143 |*	  Ersterstellung	MM 22.04.91
144 |*	  Letzte Aenderung	MM 22.04.91
145 |*
146 *************************************************************************/
GetNumber(const RSCINST & rInst,sal_Int32 * pN)147 ERRTYPE RscRange::GetNumber( const RSCINST & rInst, sal_Int32 * pN )
148 {
149 	*pN = ((RscRangeInst *)rInst.pData)->nValue + nMin;
150 	return( ERR_OK );
151 }
152 
153 /*************************************************************************
154 |*
155 |*	  RscRange::Create()
156 |*
157 |*	  Beschreibung
158 |*	  Ersterstellung	MM 03.04.91
159 |*	  Letzte Aenderung	MM 03.04.91
160 |*
161 *************************************************************************/
Create(RSCINST * pInst,const RSCINST & rDflt,sal_Bool bOwnClass)162 RSCINST RscRange::Create( RSCINST * pInst, const RSCINST & rDflt,
163 							sal_Bool bOwnClass )
164 {
165 	RSCINST aInst;
166 
167 	if( !pInst )
168 	{
169 		aInst.pClass = this;
170 		aInst.pData = (CLASS_DATA)
171 					  rtl_allocateMemory( sizeof( RscRangeInst ) );
172 	}
173 	else
174 		aInst = *pInst;
175 	if( !bOwnClass && rDflt.IsInst() )
176 		bOwnClass = rDflt.pClass->InHierarchy( this );
177 
178 	if( bOwnClass )
179 		memmove( aInst.pData, rDflt.pData, sizeof( RscRangeInst ) );
180 	else
181 	{
182 		if( 0L >= nMin && 0L <= nMax )
183 			((RscRangeInst *)aInst.pData)->nValue = (sal_uInt16)(0L - nMin);
184 		else
185 			((RscRangeInst *)aInst.pData)->nValue = 0;
186 		((RscRangeInst *)aInst.pData)->bDflt = sal_True;
187 	}
188 
189 	return( aInst );
190 }
191 
192 /*************************************************************************
193 |*
194 |*	  RscRange::WriteSrc()
195 |*
196 |*	  Beschreibung
197 |*	  Ersterstellung	MM 08.04.91
198 |*	  Letzte Aenderung	MM 08.04.91
199 |*
200 *************************************************************************/
WriteSrc(const RSCINST & rInst,FILE * fOutput,RscTypCont *,sal_uInt32,const char *)201 void RscRange::WriteSrc( const RSCINST & rInst, FILE * fOutput,
202 						 RscTypCont *, sal_uInt32, const char * )
203 {
204 	fprintf( fOutput, "%ld", long( ((RscRangeInst *)rInst.pData)->nValue + nMin ) );
205 }
206 
207 /*************************************************************************
208 |*
209 |*	  RscRange::WriteRc()
210 |*
211 |*	  Beschreibung
212 |*	  Ersterstellung	MM 15.04.91
213 |*	  Letzte Aenderung	MM 15.04.91
214 |*
215 *************************************************************************/
WriteRc(const RSCINST & rInst,RscWriteRc & aMem,RscTypCont *,sal_uInt32,sal_Bool)216 ERRTYPE RscRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
217 						   RscTypCont *, sal_uInt32, sal_Bool )
218 {
219 	if( nMin >= 0 )
220 	{
221 		sal_uInt16 n;
222 		n = (sal_uInt16)(((RscRangeInst *)rInst.pData)->nValue + nMin);
223 		aMem.Put( n );
224 	}
225 	else
226 	{
227 		sal_Int16 n;
228 		n = (sal_Int16)(((RscRangeInst *)rInst.pData)->nValue + nMin);
229 		aMem.Put( n );
230 	}
231 
232 	return( ERR_OK );
233 }
234 
235 //=======================================================================
WriteRcAccess(FILE * fOutput,RscTypCont *,const char * pName)236 void RscRange::WriteRcAccess
237 (
238 	FILE * fOutput,
239 	RscTypCont * /*pTC*/,
240 	const char * pName
241 )
242 {
243 	fprintf( fOutput, "\t\tSet%s( ", pName );
244 	if( nMin >= 0 )
245 		fprintf( fOutput, "*(sal_uInt32 *)(pResData+nOffset) );\n" );
246 	else
247 		fprintf( fOutput, "*(sal_Int32 *)(pResData+nOffset) );\n" );
248 	fprintf( fOutput, "\t\tnOffset += sizeof( sal_uInt32 );\n" );
249 }
250 
251 /****************** R s c L o n g R a n g e ******************************/
252 /*************************************************************************
253 |*
254 |*	  RscLongRange::RscLongRange()
255 |*
256 |*	  Beschreibung
257 |*	  Ersterstellung	MM 18.07.94
258 |*	  Letzte Aenderung	MM 18.07.94
259 |*
260 *************************************************************************/
RscLongRange(Atom nId,sal_uInt32 nTypeId)261 RscLongRange::RscLongRange( Atom nId, sal_uInt32 nTypeId )
262 						: RscTop( nId, nTypeId )
263 {
264 	nMin = nMax = 0;
265 	nSize = ALIGNED_SIZE( sizeof( RscLongRangeInst ) );
266 }
267 
268 /*************************************************************************
269 |*
270 |*	  RscLongRange::GetClassType()
271 |*
272 |*	  Beschreibung
273 |*	  Ersterstellung	MM 18.07.94
274 |*	  Letzte Aenderung	MM 18.07.94
275 |*
276 *************************************************************************/
GetClassType() const277 RSCCLASS_TYPE RscLongRange::GetClassType() const
278 {
279 	return RSCCLASS_NUMBER;
280 }
281 
282 /*************************************************************************
283 |*
284 |*	  RscLongRange::SetRange()
285 |*
286 |*	  Beschreibung
287 |*	  Ersterstellung	MM 18.07.94
288 |*	  Letzte Aenderung	MM 18.07.94
289 |*
290 *************************************************************************/
SetRange(sal_Int32 nMinimum,sal_Int32 nMaximum)291 ERRTYPE RscLongRange::SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum )
292 {
293 	if( nMinimum > nMaximum )
294 	{
295 		nMin = nMaximum;
296 		nMax = nMinimum;
297 	}
298 	else
299 	{
300 		nMax = nMaximum;
301 		nMin = nMinimum;
302 	};
303 
304 	return( ERR_OK );
305 }
306 
307 /*************************************************************************
308 |*
309 |*	  RscLongRange::IsValueDefault()
310 |*
311 |*	  Beschreibung
312 |*	  Ersterstellung	MM 15.02.92
313 |*	  Letzte Aenderung	MM 15.02.92
314 |*
315 *************************************************************************/
IsValueDefault(const RSCINST & rInst,CLASS_DATA pDef)316 sal_Bool RscLongRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
317 {
318 	if( pDef )
319 		return 0 == memcmp( &((RscLongRangeInst*)rInst.pData)->nValue,
320 							&((RscLongRangeInst*)pDef)->nValue,
321 							sizeof( sal_Int32 ) );
322 
323 	return sal_False;
324 }
325 
326 /*************************************************************************
327 |*
328 |*	  RscLongRange::SetNumber()
329 |*
330 |*	  Beschreibung
331 |*	  Ersterstellung	MM 18.07.94
332 |*	  Letzte Aenderung	MM 18.07.94
333 |*
334 *************************************************************************/
SetNumber(const RSCINST & rInst,sal_Int32 nValue)335 ERRTYPE RscLongRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue )
336 {
337 	if( nMax < nValue || nMin > nValue )
338 		return( ERR_RSCRANGE_OUTDEFSET );
339 	void * pData = &((RscLongRangeInst*)rInst.pData)->nValue;
340 	memmove( pData, &nValue, sizeof( sal_Int32 ) );
341 	((RscLongRangeInst *)rInst.pData)->bDflt = sal_False;
342 	return( ERR_OK );
343 }
344 
345 /*************************************************************************
346 |*
347 |*	  RscLongRange::GetNumber()
348 |*
349 |*	  Beschreibung
350 |*	  Ersterstellung	MM 22.04.91
351 |*	  Letzte Aenderung	MM 22.04.91
352 |*
353 *************************************************************************/
GetNumber(const RSCINST & rInst,sal_Int32 * pN)354 ERRTYPE RscLongRange::GetNumber( const RSCINST & rInst, sal_Int32 * pN )
355 {
356 	memmove( pN, &((RscLongRangeInst*)rInst.pData)->nValue,
357 			 sizeof( sal_Int32 ) );
358 	return( ERR_OK );
359 }
360 
361 /*************************************************************************
362 |*
363 |*	  RscLongRange::Create()
364 |*
365 |*	  Beschreibung
366 |*	  Ersterstellung	MM 18.07.94
367 |*	  Letzte Aenderung	MM 18.07.94
368 |*
369 *************************************************************************/
Create(RSCINST * pInst,const RSCINST & rDflt,sal_Bool bOwnClass)370 RSCINST RscLongRange::Create( RSCINST * pInst, const RSCINST & rDflt,
371 							  sal_Bool bOwnClass )
372 {
373 	RSCINST aInst;
374 
375 	if( !pInst )
376 	{
377 		aInst.pClass = this;
378 		aInst.pData = (CLASS_DATA)
379 					  rtl_allocateMemory( sizeof( RscLongRangeInst ) );
380 	}
381 	else
382 		aInst = *pInst;
383 	if( !bOwnClass && rDflt.IsInst() )
384 		bOwnClass = rDflt.pClass->InHierarchy( this );
385 
386 	if( bOwnClass )
387 		memmove( aInst.pData, rDflt.pData, sizeof( RscLongRangeInst ) );
388 	else
389 	{
390 		sal_Int32	lDflt;
391 		if( 0L >= nMin && 0L <= nMax )
392 			lDflt = 0;
393 		else
394 			lDflt = nMin;
395 		void * pData = &((RscLongRangeInst*)aInst.pData)->nValue;
396 		memmove( pData, &lDflt, sizeof( sal_Int32 ) );
397 		((RscLongRangeInst *)aInst.pData)->bDflt = sal_True;
398 	}
399 
400 	return( aInst );
401 }
402 
403 /*************************************************************************
404 |*
405 |*	  RscLongRange::WriteSrc()
406 |*
407 |*	  Beschreibung
408 |*	  Ersterstellung	MM 18.07.94
409 |*	  Letzte Aenderung	MM 18.07.94
410 |*
411 *************************************************************************/
WriteSrc(const RSCINST & rInst,FILE * fOutput,RscTypCont *,sal_uInt32,const char *)412 void RscLongRange::WriteSrc( const RSCINST & rInst, FILE * fOutput,
413 						 RscTypCont *, sal_uInt32, const char * )
414 {
415 	sal_Int32 lVal;
416 	GetNumber( rInst, &lVal );
417 	fprintf( fOutput, "%d", static_cast<int>(lVal) );
418 }
419 
420 /*************************************************************************
421 |*
422 |*	  RscLongRange::WriteRc()
423 |*
424 |*	  Beschreibung
425 |*	  Ersterstellung	MM 18.07.94
426 |*	  Letzte Aenderung	MM 18.04.94
427 |*
428 *************************************************************************/
WriteRc(const RSCINST & rInst,RscWriteRc & aMem,RscTypCont *,sal_uInt32,sal_Bool)429 ERRTYPE RscLongRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
430 							   RscTypCont *, sal_uInt32, sal_Bool )
431 {
432 	sal_Int32 lVal;
433 
434 	GetNumber( rInst, &lVal );
435 	aMem.Put( (sal_Int32)lVal );
436 
437 	return( ERR_OK );
438 }
439 
440 //=======================================================================
WriteRcAccess(FILE * fOutput,RscTypCont *,const char * pName)441 void RscLongRange::WriteRcAccess
442 (
443 	FILE * fOutput,
444 	RscTypCont * /*pTC*/,
445 	const char * pName
446 )
447 {
448 	fprintf( fOutput, "\t\tSet%s( ", pName );
449 	fprintf( fOutput, "GetLong( pResData+nOffset ) );\n" );
450 	fprintf( fOutput, "\t\tnOffset += sizeof( sal_Int32 );\n" );
451 }
452 
453 /****************** R s c L o n g E n u m R a n g e *********************/
454 /*************************************************************************
455 |*	  RscLongEnumRange::RscLongEnumRange()
456 |*
457 |*	  Beschreibung
458 *************************************************************************/
RscLongEnumRange(Atom nId,sal_uInt32 nTypeId)459 RscLongEnumRange::RscLongEnumRange( Atom nId, sal_uInt32 nTypeId )
460 						: RscLongRange( nId, nTypeId )
461 {
462 }
463 
464 /*************************************************************************
465 |*	  RscLongEnumRange::SetConst()
466 |*
467 |*	  Beschreibung
468 *************************************************************************/
SetConst(const RSCINST & rInst,Atom,sal_Int32 nValue)469 ERRTYPE RscLongEnumRange::SetConst( const RSCINST & rInst, Atom /*nConst*/,
470 									sal_Int32 nValue )
471 {
472 	return SetNumber( rInst, nValue );
473 }
474 
475 /****************** R s c I d R a n g e **********************************/
476 /*************************************************************************
477 |*
478 |*	  RscIdRange::RscIdRange()
479 |*
480 |*	  Beschreibung
481 |*	  Ersterstellung	MM 03.04.91
482 |*	  Letzte Aenderung	MM 03.04.91
483 |*
484 *************************************************************************/
RscIdRange(Atom nId,sal_uInt32 nTypeId)485 RscIdRange::RscIdRange( Atom nId, sal_uInt32 nTypeId )
486 			: RscTop( nId, nTypeId )
487 {
488 	nSize = ALIGNED_SIZE( sizeof( RscId ) );
489 	nMin = nMax = 0;
490 }
491 
492 /*************************************************************************
493 |*
494 |*	  RscIdRange::RscIdRange()
495 |*
496 |*	  Beschreibung
497 |*	  Ersterstellung	MM 03.04.91
498 |*	  Letzte Aenderung	MM 03.04.91
499 |*
500 *************************************************************************/
GetClassType() const501 RSCCLASS_TYPE RscIdRange::GetClassType() const
502 {
503 	return RSCCLASS_NUMBER;
504 }
505 
506 /*************************************************************************
507 |*
508 |*	  RscIdRange::Create()
509 |*
510 |*	  Beschreibung
511 |*	  Ersterstellung	MM 03.04.91
512 |*	  Letzte Aenderung	MM 03.04.91
513 |*
514 *************************************************************************/
Create(RSCINST * pInst,const RSCINST & rDflt,sal_Bool bOwnClass)515 RSCINST RscIdRange::Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool bOwnClass ){
516 	RSCINST aInst;
517 	RscId * pClassData;
518 
519 	if( !pInst ){
520 		aInst.pClass = this;
521 		aInst.pData = (CLASS_DATA)rtl_allocateMemory( sizeof( RscId ) );
522 	}
523 	else
524 		aInst = *pInst;
525 
526 
527 	if( !bOwnClass && rDflt.IsInst() )
528 		bOwnClass = rDflt.pClass->InHierarchy( this );
529 
530 	pClassData = (RscId *)aInst.pData;
531 
532 	pClassData->Create();
533 	if( bOwnClass )
534 		*pClassData = *(RscId *)rDflt.pData;
535 	else{
536 			*pClassData = RscId();
537 		if( 0 >= nMin && 0 <= nMax )
538 			*pClassData = RscId( (sal_Int32)0 );
539 		else
540 			*pClassData = RscId( nMin );
541 		//cUnused wird fuer Defaultkennung verwendet
542 		((RscId *)aInst.pData)->aExp.cUnused = sal_True;
543 	}
544 
545 	return( aInst );
546 }
547 
548 /*************************************************************************
549 |*
550 |*	  RscIdRange::Destroy()
551 |*
552 |*	  Beschreibung
553 |*	  Ersterstellung	MM 22.11.91
554 |*	  Letzte Aenderung	MM 22.11.91
555 |*
556 *************************************************************************/
Destroy(const RSCINST & rInst)557 void RscIdRange :: Destroy( const RSCINST & rInst ){
558 	((RscId *)rInst.pData)->Destroy();
559 }
560 
561 /*************************************************************************
562 |*
563 |*	  RscIdRange::IsValueDefault()
564 |*
565 |*	  Beschreibung
566 |*	  Ersterstellung	MM 15.01.92
567 |*	  Letzte Aenderung	MM 15.01.92
568 |*
569 *************************************************************************/
IsValueDefault(const RSCINST & rInst,CLASS_DATA pDef)570 sal_Bool RscIdRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){
571 	if( pDef ){
572 		if( ((RscId*)rInst.pData)->aExp.IsNumber()
573 		  && ((RscId*)pDef)->aExp.IsNumber() )
574 		{
575 			if( ((RscId*)rInst.pData)->GetNumber() ==
576 			  ((RscId*)pDef)->GetNumber() )
577 			{
578 				return sal_True;
579 			}
580 		}
581 	}
582 
583 	return sal_False;
584 }
585 
586 /*************************************************************************
587 |*
588 |*	  RscIdRange::SetNumber()
589 |*
590 |*	  Beschreibung
591 |*	  Ersterstellung	MM 25.11.91
592 |*	  Letzte Aenderung	MM 25.11.91
593 |*
594 *************************************************************************/
SetNumber(const RSCINST & rInst,sal_Int32 nValue)595 ERRTYPE RscIdRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue )
596 {
597 	if( nMax < nValue || nMin > nValue )
598 		return( ERR_RSCRANGE_OUTDEFSET );
599 
600 	*(RscId *)rInst.pData = RscId( nValue );
601 	((RscId *)rInst.pData)->aExp.cUnused = sal_False;
602 	return( ERR_OK );
603 }
604 
605 /*************************************************************************
606 |*
607 |*	  RscIdRange::GetNumber()
608 |*
609 |*	  Beschreibung
610 |*	  Ersterstellung	MM 25.11.91
611 |*	  Letzte Aenderung	MM 25.11.91
612 |*
613 *************************************************************************/
GetNumber(const RSCINST & rInst,sal_Int32 * plValue)614 ERRTYPE RscIdRange::GetNumber( const RSCINST & rInst, sal_Int32 * plValue ){
615 	*plValue = ((RscId *)rInst.pData)->GetNumber();
616 	return( ERR_OK );
617 }
618 
619 /*************************************************************************
620 |*
621 |*	  RscIdRange::SetRef()
622 |*
623 |*	  Beschreibung
624 |*	  Ersterstellung	MM 22.11.91
625 |*	  Letzte Aenderung	MM 22.11.91
626 |*
627 *************************************************************************/
SetRef(const RSCINST & rInst,const RscId & rRscId)628 ERRTYPE RscIdRange::SetRef( const RSCINST & rInst, const RscId & rRscId ){
629 	ERRTYPE aError;
630 	if( rRscId.IsId() ){
631 		aError = SetNumber( rInst, rRscId );
632 		if( aError.IsOk() ){
633 			*(RscId *)rInst.pData = rRscId;
634 			((RscId *)rInst.pData)->aExp.cUnused = sal_False;
635 		}
636 	}
637 	else
638 		aError = ERR_RSCRANGE_OUTDEFSET;
639 
640 	return( aError );
641 }
642 
643 /*************************************************************************
644 |*
645 |*	  RscIdRange::GetRef()
646 |*
647 |*	  Beschreibung
648 |*	  Ersterstellung	MM 22.11.91
649 |*	  Letzte Aenderung	MM 22.11.91
650 |*
651 *************************************************************************/
GetRef(const RSCINST & rInst,RscId * pRscId)652 ERRTYPE RscIdRange::GetRef( const RSCINST & rInst, RscId * pRscId ){
653 	*pRscId = *(RscId *)rInst.pData;
654 
655 	return( ERR_OK );
656 }
657 
658 /*************************************************************************
659 |*
660 |*	  RscIdRange::WriteSrc()
661 |*
662 |*	  Beschreibung
663 |*	  Ersterstellung	MM 22.11.91
664 |*	  Letzte Aenderung	MM 25.11.91
665 |*
666 *************************************************************************/
WriteSrc(const RSCINST & rInst,FILE * fOutput,RscTypCont *,sal_uInt32,const char *)667 void RscIdRange::WriteSrc( const RSCINST & rInst, FILE * fOutput,
668 						   RscTypCont *, sal_uInt32, const char * )
669 {
670 	fprintf( fOutput, "%s", ((RscId *)rInst.pData)->GetName().GetBuffer() );
671 }
672 
673 /*************************************************************************
674 |*
675 |*	  RscIdRange::WriteRc()
676 |*
677 |*	  Beschreibung
678 |*	  Ersterstellung	MM 25.11.91
679 |*	  Letzte Aenderung	MM 25.11.91
680 |*
681 *************************************************************************/
WriteRc(const RSCINST & rInst,RscWriteRc & aMem,RscTypCont *,sal_uInt32,sal_Bool)682 ERRTYPE RscIdRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
683 							 RscTypCont *, sal_uInt32, sal_Bool )
684 {
685 	sal_Int32 lVal = ((RscId*)rInst.pData)->GetNumber();
686 
687     aMem.Put( (sal_Int32)lVal );
688 
689 	return( ERR_OK );
690 }
691 
692 //=======================================================================
WriteRcAccess(FILE * fOutput,RscTypCont *,const char * pName)693 void RscIdRange::WriteRcAccess
694 (
695 	FILE * fOutput,
696 	RscTypCont * /*pTC*/,
697 	const char * pName
698 )
699 {
700 	fprintf( fOutput, "\t\tSet%s( ", pName );
701 	fprintf( fOutput, "GetLong( pResData+nOffset ) );\n" );
702 	fprintf( fOutput, "\t\tnOffset += sizeof( sal_Int32 );\n" );
703 }
704 
705 /*************************************************************************
706 |*
707 |*	  RscIdRange::IsConsistent()
708 |*
709 |*	  Beschreibung
710 |*	  Ersterstellung	MM 22.11.91
711 |*	  Letzte Aenderung	MM 22.11.91
712 |*
713 *************************************************************************/
IsConsistent(const RSCINST & rInst,RscInconsList * pList)714 sal_Bool RscIdRange::IsConsistent( const RSCINST & rInst, RscInconsList * pList )
715 {
716 	long nValue = ((RscId *)rInst.pData)->GetNumber();
717 	if( (nMax >= nValue) && (nMin <= nValue) )
718 		return sal_True;
719 	else {
720 		if( pList )
721 			pList->Insert( new RscInconsistent(
722 				*(RscId *)rInst.pData, *(RscId *)rInst.pData ) );
723 		return sal_False;
724 	}
725 }
726 
727 /****************** R s c B o o l ****************************************/
728 /*************************************************************************
729 |*
730 |*	  RscBool::RscBool()
731 |*
732 |*	  Beschreibung
733 |*	  Ersterstellung	MM 29.04.91
734 |*	  Letzte Aenderung	MM 29.04.91
735 |*
736 *************************************************************************/
RscBool(Atom nId,sal_uInt32 nTypeId)737 RscBool::RscBool( Atom nId, sal_uInt32 nTypeId )
738 		: RscRange( nId, nTypeId )
739 {
740 	RscRange::SetRange( 0, 1 );
741 }
742 
743 /*************************************************************************
744 |*
745 |*	  RscBool::GetClassType()
746 |*
747 |*	  Beschreibung
748 |*	  Ersterstellung	MM 29.04.91
749 |*	  Letzte Aenderung	MM 29.04.91
750 |*
751 *************************************************************************/
GetClassType() const752 RSCCLASS_TYPE  RscBool::GetClassType() const
753 {
754 	return RSCCLASS_BOOL;
755 }
756 
757 /*************************************************************************
758 |*
759 |*	  RscBool::WriteSrc()
760 |*
761 |*	  Beschreibung
762 |*	  Ersterstellung	MM 29.04.91
763 |*	  Letzte Aenderung	MM 29.04.91
764 |*
765 *************************************************************************/
WriteSrc(const RSCINST & rInst,FILE * fOutput,RscTypCont *,sal_uInt32,const char *)766 void RscBool::WriteSrc( const RSCINST & rInst, FILE * fOutput,
767 						RscTypCont *, sal_uInt32, const char * )
768 {
769 	sal_Int32 l;
770 
771 	GetNumber( rInst, &l );
772 	if( l )
773 		fprintf( fOutput, "TRUE" );
774 	else
775 		fprintf( fOutput, "FALSE" );
776 }
777 
778 //=======================================================================
WriteRcAccess(FILE * fOutput,RscTypCont *,const char * pName)779 void RscBool::WriteRcAccess
780 (
781 	FILE * fOutput,
782 	RscTypCont * /*pTC*/,
783 	const char * pName
784 )
785 {
786 	fprintf( fOutput, "\t\tSet%s( ", pName );
787 	fprintf( fOutput, "(sal_Bool)*(short *)(pResData+nOffset) );\n" );
788 	fprintf( fOutput, "\t\tnOffset += sizeof( short );\n" );
789 }
790 
791 /****************** R s c B r e a k R a n g e ****************************/
792 /*************************************************************************
793 |*
794 |*	  RscBreakRange::SetNumber()
795 |*
796 |*	  Beschreibung
797 |*	  Ersterstellung	MM 24.06.91
798 |*	  Letzte Aenderung	MM 24.06.91
799 |*
800 *************************************************************************/
RscBreakRange(Atom nId,sal_uInt32 nTypeId)801 RscBreakRange :: RscBreakRange( Atom nId, sal_uInt32 nTypeId )
802 						: RscRange( nId, nTypeId )
803 {
804 	nOutRange = 0xFFFFFFFF;
805 }
806 
807 /*************************************************************************
808 |*
809 |*	  RscBreakRange::SetNumber()
810 |*
811 |*	  Beschreibung
812 |*	  Ersterstellung	MM 24.06.91
813 |*	  Letzte Aenderung	MM 24.06.91
814 |*
815 *************************************************************************/
SetNumber(const RSCINST & rInst,sal_Int32 nValue)816 ERRTYPE RscBreakRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue ){
817 	if( nValue == nOutRange )
818 		return( ERR_RSCRANGE_OUTDEFSET );
819 	else
820 		return( RscRange::SetNumber( rInst, nValue ) );
821 }
822 
823 /*************************************************************************
824 |*
825 |*	  RscBreakRange::Create()
826 |*
827 |*	  Beschreibung
828 |*	  Ersterstellung	MM 24.06.91
829 |*	  Letzte Aenderung	MM 24.06.91
830 |*
831 *************************************************************************/
Create(RSCINST * pInst,const RSCINST & rDflt,sal_Bool bOwnClass)832 RSCINST RscBreakRange::Create( RSCINST * pInst, const RSCINST & rDflt,
833 							   sal_Bool bOwnClass )
834 {
835 	RSCINST aInst;
836 	sal_Int32	l;
837 
838 	aInst = RscRange::Create( pInst, rDflt, bOwnClass );
839 
840 	GetNumber( aInst, &l );
841 	if( l == nOutRange )
842 		((RscRangeInst *)aInst.pData)->nValue++;
843 
844 	return( aInst );
845 }
846 
847