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/* static char datefunc_Id[]="@(#) StarCalc Datefunc AddIn (c) 1998-2000 Sun Microsystems, Inc."; */ 23 24#include <string.h> 25#include <stdlib.h> 26#include <math.h> 27 28#include <xlang.h> 29#include <addin.h> 30#include <dfa.hrc> 31 32 33/** 34 * the current language the Addin is using 35 */ 36static USHORT _nLanguage=LANGUAGE_ENGLISH; 37 38/** 39 * StarCalc calls this function to set a new current Language for the Addin 40 * 41 * @param *nLanguage 42 * 43 */ 44void CALLTYPE SetLanguage( USHORT* nLanguage ) 45{ 46 _nLanguage = GetNeutralLanguage( *nLanguage ); 47} 48 49 50/** 51 * Null Date, initialized in GetFunctionCount 52 * 53 * StarCalc uses a BaseDate 12/30/1899 54 * If not specified otherwise in the Settings for the Spreedsheet Document. 55 * 56 * There's no way to get the Spreadsheet settings from whithin a simple addin, 57 * so this Addin can only be used by documents using the default BaseDate setting. 58 * 59 * The functions in this Addin use a BaseDate 01/01/0001 60 * The nNullDate Variable is the StarCalc BaseDate converted to 61 * this internal date representation. 62 * 63 * @see #GetFunctionCount 64 * 65 */ 66 67static ULONG nNullDate=0; 68 69#define NULLDATE_Year 1899 70#define NULLDATE_Month 12 71#define NULLDATE_Day 30 72 73 74/** 75 * Array holding values for month length, used in DaysInMonth() function 76 * 77 * @see #DaysInMonth 78 * 79 */ 80static USHORT aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30, 81 31, 31, 30, 31, 30, 31 }; 82 83/** 84 * Check if a year is a leap year in the Gregorian calendar 85 * 86 * @param nYear the year which should be checked 87 * @return true if the year is a leap year, false otherwise. 88 * 89 * @see #DaysInMonth, #IsLeapYear, 90 * @see #ScDate_DaysInMonth, #ScDate_IsLeapYear, #ScDate_WeeksInYear 91 * 92 */ 93static BOOL IsLeapYear( USHORT nYear ) 94{ 95 return (BOOL)((((nYear % 4) == 0) && ((nYear % 100) != 0)) || ((nYear % 400) == 0)); 96} 97 98 99/** 100 * Get the number of days in a specified month 101 * 102 * @param nMonth the number of the Month 103 * @param nYear the year 104 * @return number of days 105 * 106 */ 107static USHORT DaysInMonth( USHORT nMonth, USHORT nYear ) 108{ 109 if ( nMonth != 2 ) 110 return aDaysInMonth[nMonth-1]; 111 else 112 { 113 if ( IsLeapYear(nYear) ) 114 return aDaysInMonth[nMonth-1] + 1; 115 else 116 return aDaysInMonth[nMonth-1]; 117 } 118} 119 120 121/** 122 * Convert a date to a count of days starting from 01/01/0001 123 * 124 * The internal representation of a Date used in this Addin 125 * is the number of days between 01/01/0001 and the date 126 * this function converts a Day , Month, Year representation 127 * to this internal Date value. 128 * 129 * @param nDay the day of the Month 130 * @param nMonth the number of the Month 131 * @param nYear the Year 132 * @return count of days from 01/01/0001 to the date specified 133 * 134 */ 135static long DateToDays( USHORT nDay, USHORT nMonth, USHORT nYear ) 136{ 137 long nDays; 138 USHORT i; 139 140 nDays = ((ULONG)nYear-1) * 365; 141 nDays += ((nYear-1) / 4) - ((nYear-1) / 100) + ((nYear-1) / 400); 142 143 for( i = 1; i < nMonth; i++ ) 144 nDays += DaysInMonth(i,nYear); 145 nDays += nDay; 146 147 return nDays; 148} 149 150 151/** 152 * Convert a count of days starting from 01/01/0001 to a date 153 * 154 * The internal representation of a Date used in this Addin 155 * is the number of days between 01/01/0001 and the date 156 * this function converts this internal Date value 157 * to a Day , Month, Year representation of a Date. 158 * 159 * @param nDay count of days from 01/01/0001 160 * @param *pDay pointer to a variable for the day of the month 161 * @param *pMonth pointer to a variable for the month 162 * @param *pYear pointer to a variable for the year 163 * 164 */ 165static void DaysToDate( long nDays, 166 USHORT *pDay, USHORT *pMonth, USHORT *pYear ) 167{ 168 long nTempDays; 169 long i = 0; 170 BOOL bCalc; 171 172 do 173 { 174 nTempDays = (long)nDays; 175 *pYear = (USHORT)((nTempDays / 365) - i); 176 nTempDays -= ((ULONG) *pYear -1) * 365; 177 nTempDays -= (( *pYear -1) / 4) - (( *pYear -1) / 100) + ((*pYear -1) / 400); 178 bCalc = FALSE; 179 if ( nTempDays < 1 ) 180 { 181 i++; 182 bCalc = TRUE; 183 } 184 else 185 { 186 if ( nTempDays > 365 ) 187 { 188 if ( (nTempDays != 366) || !IsLeapYear( *pYear ) ) 189 { 190 i--; 191 bCalc = TRUE; 192 } 193 } 194 } 195 } 196 while ( bCalc ); 197 198 *pMonth = 1; 199 while ( (ULONG)nTempDays > DaysInMonth( *pMonth, *pYear ) ) 200 { 201 nTempDays -= DaysInMonth( *pMonth, *pYear ); 202 (*pMonth)++; 203 } 204 *pDay = (USHORT)nTempDays; 205} 206 207/** 208 * Get week difference between 2 dates 209 * 210 * new Weeks(date1,date2,mode) function for StarCalc 211 * 212 * Two modes of operation are provided. 213 * The first is just a simple division by 7 calculation. 214 * 215 * The second calculates the diffence by week of year. 216 * 217 * The International Standard IS-8601 has decreed that Monday 218 * shall be the first day of the week. 219 * 220 * A week that lies partly in one year and partly in another 221 * is assigned a number in the year in which most of its days lie. 222 * 223 * That means that week 1 of any year is the week that contains the 4. January 224 * 225 * The internal representation of a Date used in the Addin is the number of days based on 01/01/0001 226 * 227 * A WeekDay can be then calculated by subtracting 1 and calculating the rest of 228 * a division by 7, which gives a 0 - 6 value for Monday - Sunday 229 * 230 * Using the 4. January rule explained above the formula 231 * 232 * nWeek1= ( nDays1 - nJan4 + ( (nJan4-1) % 7 ) ) / 7 + 1; 233 * 234 * calculates a number between 0-53 for each day which is in the same year as nJan4 235 * where 0 means that this week belonged to the year before. 236 * 237 * If a day in the same or another year is used in this formula this calculates 238 * an calendar week offset from a given 4. January 239 * 240 * nWeek2 = ( nDays2 - nJan4 + ( (nJan4-1) % 7 ) ) / 7 + 1; 241 * 242 * The 4.January of first Date Argument can thus be used to calculate 243 * the week difference by calendar weeks which is then nWeek = nWeek2 - nWeek1 244 * 245 * which can be optimized to 246 * 247 * nWeek = ( (nDays2-nJan4+((nJan4-1)%7))/7 ) - ( (nDays1-nJan4+((nJan4-1)%7))/7 ) 248 * 249 * Note: All calculations are operating on the long integer data type 250 * % is the modulo operator in C which calculates the rest of an Integer division 251 * 252 * 253 * @param *r - return value for the StarCalc function 254 * @param d1 - date value (in StarCalc representation based 12/30/1899), usually the older date 255 * @param d2 - date value (in StarCalc representation based 12/30/1899), usually the younger date 256 * @param dMode - mode of operation 257 * 258 * mode 0 is the interval between the dates in month, that is days / 7 259 * 260 * mode 1 is the difference by week of year 261 * 262 */ 263void CALLTYPE ScDate_GetDiffWeeks(double *r, double *d1, double *d2, double *dMode) 264{ 265 long nDays1=0; 266 long nDays2=0; 267 int nMode=0; 268 269 if ( d1 ) nDays1=(long)floor(*d1)+nNullDate; 270 if ( d2 ) nDays2=(long)floor(*d2)+nNullDate; 271 272 273 if ( dMode) nMode=(int)*dMode; 274 275 if ( nMode == 1 ) { 276 277 USHORT nDay,nMonth,nYear; 278 long nJan4; 279 280 DaysToDate(nDays1,&nDay,&nMonth,&nYear); 281 nJan4=DateToDays(4,1,nYear); 282 283 *r=(double) ( ( (nDays2-nJan4+((nJan4-1)%7))/7 ) - ( (nDays1-nJan4+((nJan4-1)%7))/7 ) ); 284 285 } else { 286 287 *r= (double) ( (nDays2 - nDays1) / 7 ) ; 288 } 289 290} 291 292/** 293 * Get month difference between 2 dates 294 * =Month(start, end, mode) Function for StarCalc 295 * 296 * two modes are provided 297 * 298 * @param *r - return value for the StarCalc function 299 * @param d1 - date value, start date 300 * @param d2 - date value, end date 301 * @param dMode - mode of operation 302 * 303 * mode 0 is the interval between the dates in month 304 * 305 * mode 1 is the difference in calendar month 306 * 307 */ 308void CALLTYPE ScDate_GetDiffMonths(double *r, double *d1, double *d2, double *dMode) 309{ 310 USHORT nDay1,nMonth1,nYear1; 311 USHORT nDay2,nMonth2,nYear2; 312 long nDays1=0; 313 long nDays2=0; 314 int nMode=0; 315 316 if ( dMode) nMode=(int)*dMode; 317 318 if ( d1 ) nDays1=(long)floor(*d1)+nNullDate; 319 if ( d2 ) nDays2=(long)floor(*d2)+nNullDate; 320 321 DaysToDate(nDays1,&nDay1,&nMonth1,&nYear1); 322 DaysToDate(nDays2,&nDay2,&nMonth2,&nYear2); 323 324 *r=(double) ( nMonth2 - nMonth1 + (nYear2 - nYear1) * 12 ); 325 if ( nMode == 1 || nDays1 == nDays2 ) return; 326 327 if ( nDays1 < nDays2 ) { 328 if ( nDay1 > nDay2 ) { 329 *r -= 1; 330 } 331 } else { 332 if ( nDay1 < nDay2 ) { 333 *r += 1; 334 } 335 } 336 337} 338 339 340/** 341 * Get Year difference between 2 dates 342 * 343 * two modes are provided 344 * 345 * @param *r - return value for the StarCalc function 346 * @param d1 - date value, start date 347 * @param d2 - date value, end date 348 * @param dMode - mode of operation 349 * 350 * mode 0 is the interval between the dates in years 351 * 352 * mode 1 is the difference in calendar years 353 * 354 */ 355void CALLTYPE ScDate_GetDiffYears(double *r, double *d1, double *d2, double *dMode) 356{ 357 USHORT nDay1,nMonth1,nYear1; 358 USHORT nDay2,nMonth2,nYear2; 359 long nDays1=0; 360 long nDays2=0; 361 int nMode=0; 362 363 if ( dMode) nMode=(int)*dMode; 364 365 if ( d1 ) nDays1=(long)floor(*d1)+nNullDate; 366 if ( d2 ) nDays2=(long)floor(*d2)+nNullDate; 367 368 DaysToDate(nDays1,&nDay1,&nMonth1,&nYear1); 369 DaysToDate(nDays2,&nDay2,&nMonth2,&nYear2); 370 if ( nMode != 1 ) { 371 ScDate_GetDiffMonths(r,d1,d2,dMode); 372 *r= (double) ( ((int) *r) / 12 ); 373 } else { 374 *r=(double) ( nYear2 - nYear1 ); 375 } 376} 377 378/** 379 * Check if a Date is in a leap year in the Gregorian calendar 380 * 381 * @param *r - return value for the StarCalc function 382 * @param d - date value (in StarCalc representation based 12/30/1899) 383 * 384 */ 385void CALLTYPE ScDate_IsLeapYear(double *r, double *d) 386{ 387 ULONG nDays; 388 USHORT nDay, nMonth, nYear; 389 double v=0.0; 390 391 if ( d ) v=*d; 392 nDays=(int) v + nNullDate; 393 394 DaysToDate(nDays,&nDay,&nMonth,&nYear); 395 396 *r=(double) ( IsLeapYear(nYear) ); 397 398} 399 400/** 401 * Get the Number of Days in the month for a date 402 * 403 * @param *r - return value for the StarCalc function 404 * @param d - date value (in StarCalc representation based 12/30/1899) 405 * 406 */ 407void CALLTYPE ScDate_DaysInMonth(double *r, double *d) 408{ 409 ULONG nDays; 410 USHORT nDay, nMonth, nYear; 411 double v=0.0; 412 413 if ( d ) v=*d; 414 nDays=(int) v + nNullDate; 415 416 DaysToDate(nDays,&nDay,&nMonth,&nYear); 417 *r=(double) ( DaysInMonth( nMonth, nYear) ); 418 419} 420 421 422/** 423 * Get number of weeks in the year for a date 424 * 425 * Most years have 52 weeks, but years that start on a Thursday 426 * and leep years that start on a Wednesday have 53 weeks 427 * 428 * The International Standard IS-8601 has decreed that Monday 429 * shall be the first day of the week. 430 * 431 * A WeekDay can be calculated by subtracting 1 and calculating the rest of 432 * a division by 7 from the internal date represention 433 * which gives a 0 - 6 value for Monday - Sunday 434 * 435 * @param *r - return value for the StarCalc function 436 * @param d - date value (in StarCalc represantaion based 30.12.1899) 437 * 438 * @see #IsLeapYear #WeekNumber 439 * 440 */ 441void CALLTYPE ScDate_WeeksInYear(double *r, double *d) 442{ 443 ULONG nDays; 444 USHORT nDay, nMonth, nYear; 445 double v=0.0; 446 long nJan1WeekDay; 447 448 if ( d ) v=*d; 449 nDays=(int) v + nNullDate; 450 451 DaysToDate(nDays,&nDay,&nMonth,&nYear); 452 453 nJan1WeekDay= ( DateToDays(1,1,nYear) - 1) % 7; 454 455 if ( nJan1WeekDay == 3 ) { /* Thursday */ 456 *r=(double) 53; 457 return; 458 } else if ( nJan1WeekDay == 2 ) { /* Wednesday */ 459 *r= (double) ( IsLeapYear(nYear) ? 53 : 52 ); 460 } else { 461 *r= (double) 52; 462 } 463} 464 465 466/** 467 * Get number of days in the year of a date specified 468 * 469 * @param *r - return value for the StarCalc function 470 * @param d - date value (in StarCalc represantaion based 30.12.1899) 471 * 472 */ 473void CALLTYPE ScDate_DaysInYear(double *r, double *d) 474{ 475 ULONG nDays; 476 USHORT nDay, nMonth, nYear; 477 double v=0.0; 478 479 if ( d ) v=*d; 480 nDays=(int) v + nNullDate; 481 482 DaysToDate(nDays,&nDay,&nMonth,&nYear); 483 *r=(double) ( IsLeapYear(nYear) ? 366 : 365 ); 484 485} 486 487 488/** 489 * Tell StarCalc how many new functions this Addin provides. 490 * 491 * It's called before any of these new functions is actually 492 * executed and is also used to initialize the NullDate here. 493 * 494 * StarCalc uses a Date Base 12/30/1899 495 * If not specified otherwise in the Options for the Spreedsheet Document 496 * 497 * 498 * @param *nCount - returns the number of functions which are exported to StarCalc 499 * 500 */ 501void CALLTYPE GetFunctionCount( USHORT *nCount ) 502{ 503 504 /* initialize nNullDate Value 0 is 12/30/1899 */ 505 nNullDate=DateToDays(NULLDATE_Day, NULLDATE_Month, NULLDATE_Year); 506 507 *nCount = 7; 508} 509 510/** 511 * Provides necessary data for each new function to StarCalc 512 * 513 * @param *nNo Input: Function number between 0 and nCount - 1 514 * @param *pFuncName Output: Functionname which should be called in the AddIn-DLL 515 * @param *nParamCount Output: Number of Parameter. Must be greater than 0, because there's always a return-Value. Maximum is 16. 516 * @param *peType Output: Pointer to arrray with exactly 16 variables of typ Paramtype. nParamCount Entries are set to the type of the corresponding Parameters. 517 * @param *pInternalName Output: Functionname as seen by the Spreadsheet user 518 * 519 * @see #GetFunctionCount, #GetParameterDescription 520 * 521 */ 522void CALLTYPE GetFunctionData( USHORT * nNo, 523 char * pFuncName, 524 USHORT * nParamCount, 525 ParamType * peType, 526 char * pInternalName ) 527{ 528 529 530 switch( *nNo ) { 531 case 0: 532 SO_StringCopy( pInternalName, getText(DFA_WEEK_NAME) ); 533 SO_StringCopy( pFuncName, "ScDate_GetDiffWeeks" ); 534 peType[0] = PTR_DOUBLE; 535 peType[1] = PTR_DOUBLE; 536 peType[2] = PTR_DOUBLE; 537 peType[3] = PTR_DOUBLE; 538 *nParamCount=4; 539 break; 540 541 case 1: 542 SO_StringCopy( pInternalName, getText(DFA_MONTHS_NAME) ); 543 SO_StringCopy( pFuncName, "ScDate_GetDiffMonths" ); 544 peType[0] = PTR_DOUBLE; 545 peType[1] = PTR_DOUBLE; 546 peType[2] = PTR_DOUBLE; 547 peType[3] = PTR_DOUBLE; 548 *nParamCount=4; 549 break; 550 551 case 2: 552 SO_StringCopy( pInternalName, getText(DFA_YEARS_NAME) ); 553 SO_StringCopy( pFuncName, "ScDate_GetDiffYears" ); 554 peType[0] = PTR_DOUBLE; 555 peType[1] = PTR_DOUBLE; 556 peType[2] = PTR_DOUBLE; 557 peType[3] = PTR_DOUBLE; 558 *nParamCount=4; 559 break; 560 561 case 3: 562 SO_StringCopy( pInternalName, getText(DFA_ISLEAPYEAR_NAME) ); 563 SO_StringCopy( pFuncName, "ScDate_IsLeapYear" ); 564 peType[0] = PTR_DOUBLE; 565 peType[1] = PTR_DOUBLE; 566 *nParamCount=2; 567 break; 568 569 case 4: 570 SO_StringCopy( pInternalName, getText(DFA_DAYSINMONTH_NAME) ); 571 SO_StringCopy( pFuncName, "ScDate_DaysInMonth" ); 572 peType[0] = PTR_DOUBLE; 573 peType[1] = PTR_DOUBLE; 574 *nParamCount=2; 575 break; 576 577 case 5: 578 SO_StringCopy( pInternalName, getText(DFA_DAYSINYEAR_NAME) ); 579 SO_StringCopy( pFuncName, "ScDate_DaysInYear" ); 580 peType[0] = PTR_DOUBLE; 581 peType[1] = PTR_DOUBLE; 582 *nParamCount=2; 583 break; 584 585 case 6: 586 SO_StringCopy( pInternalName, getText(DFA_WEEKSINYEAR_NAME) ); 587 SO_StringCopy( pFuncName, "ScDate_WeeksInYear" ); 588 peType[0] = PTR_DOUBLE; 589 peType[1] = PTR_DOUBLE; 590 *nParamCount=2; 591 break; 592 593 default: 594 *nParamCount = 0; 595 *pFuncName = 0; 596 *pInternalName = 0; 597 break; 598 } 599} 600 601/** 602 * Provides descriptions for each new function to StarCalc 603 * which are shown is the autopilot 604 * 605 * @param *nNo Input Parameter, Function number between 0 and nCount - 1 606 * @param *nParam Parameter Number 607 * @param *pName Output: Name of the parameter 608 * @param *pDesc Output: Description of the parameter 609 * 610 * @see #GetFunctionCount, #GetParameterDescription 611 */ 612void CALLTYPE GetParameterDescription( USHORT* nNo, USHORT* nParam, 613char* pName, char* pDesc ) 614{ 615 *pName = 0; 616 *pDesc = 0; 617 618 switch ( *nNo ) { 619 case 0: /* Weeks */ 620 switch ( *nParam ) { 621 case 0: 622 SO_StringCopy(pDesc,getText(DFA_WEEK_DESC)); 623 break; 624 case 1: 625 SO_StringCopy(pName,getText(DFA_PAR_DATE1_NAME)); 626 SO_StringCopy(pDesc,getText(DFA_WEEK_PAR1_DESC)); 627 break; 628 case 2: 629 SO_StringCopy(pName,getText(DFA_PAR_DATE2_NAME)); 630 SO_StringCopy(pDesc,getText(DFA_WEEK_PAR2_DESC)); 631 break; 632 case 3: 633 SO_StringCopy(pName,getText(DFA_PAR_MODE_NAME)); 634 SO_StringCopy(pDesc,getText(DFA_WEEK_PAR3_DESC)); 635 break; 636 } 637 break; 638 case 1: /* Months */ 639 switch ( *nParam ) { 640 case 0: 641 SO_StringCopy(pDesc,getText(DFA_MONTHS_DESC)); 642 break; 643 case 1: 644 SO_StringCopy(pName,getText(DFA_PAR_DATE1_NAME)); 645 SO_StringCopy(pDesc,getText(DFA_MONTHS_PAR1_DESC)); 646 break; 647 case 2: 648 SO_StringCopy(pName,getText(DFA_PAR_DATE2_NAME)); 649 SO_StringCopy(pDesc,getText(DFA_MONTHS_PAR2_DESC)); 650 break; 651 case 3: 652 SO_StringCopy(pName,getText(DFA_PAR_MODE_NAME)); 653 SO_StringCopy(pDesc,getText(DFA_MONTHS_PAR3_DESC)); 654 break; 655 } 656 break; 657 case 2: /* Years */ 658 switch ( *nParam ) { 659 case 0: 660 SO_StringCopy(pDesc,getText(DFA_YEARS_DESC)); 661 break; 662 case 1: 663 SO_StringCopy(pName,getText(DFA_PAR_DATE1_NAME)); 664 SO_StringCopy(pDesc,getText(DFA_YEARS_PAR1_DESC)); 665 break; 666 case 2: 667 SO_StringCopy(pName,getText(DFA_PAR_DATE2_NAME)); 668 SO_StringCopy(pDesc,getText(DFA_YEARS_PAR2_DESC)); 669 break; 670 case 3: 671 SO_StringCopy(pName,getText(DFA_PAR_MODE_NAME)); 672 SO_StringCopy(pDesc,getText(DFA_YEARS_PAR3_DESC)); 673 break; 674 } 675 break; 676 case 3: /* IsLeapYear */ 677 switch ( *nParam ) { 678 case 0: 679 SO_StringCopy(pDesc,getText(DFA_ISLEAPYEAR_DESC)); 680 break; 681 case 1: 682 SO_StringCopy(pName,getText(DFA_PAR_DATE_NAME)); 683 SO_StringCopy(pDesc,getText(DFA_PAR_DATE_DESC)); /* StarCalc Value */ 684 break; 685 } 686 break; 687 case 4: /* DaysInMonth */ 688 switch ( *nParam ) { 689 case 0: 690 SO_StringCopy(pDesc,getText(DFA_DAYSINMONTH_DESC)); 691 break; 692 case 1: 693 SO_StringCopy(pName,getText(DFA_PAR_DATE_NAME)); 694 SO_StringCopy(pDesc,getText(DFA_PAR_DATE_DESC)); /* StarCalc Value */ 695 break; 696 } 697 break; 698 case 5: /* DaysInYear */ 699 switch ( *nParam ) { 700 case 0: 701 SO_StringCopy(pDesc,getText(DFA_DAYSINYEAR_DESC)); 702 break; 703 case 1: 704 SO_StringCopy(pName,getText(DFA_PAR_DATE_NAME)); 705 SO_StringCopy(pDesc,getText(DFA_PAR_DATE_DESC)); /* StarCalc Value */ 706 break; 707 } 708 break; 709 710 case 6: /* WeeksInYear */ 711 switch ( *nParam ) { 712 case 0: 713 SO_StringCopy(pDesc,getText(DFA_WEEKSINYEAR_DESC)); 714 break; 715 case 1: 716 SO_StringCopy(pName,getText(DFA_PAR_DATE_NAME)); 717 SO_StringCopy(pDesc,getText(DFA_PAR_DATE_DESC)); /* StarCalc Value */ 718 break; 719 } 720 break; 721 } 722 723} 724