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