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