diff --git a/sc/qa/unit/data/functions/fods/weeks.fods b/sc/qa/unit/data/functions/fods/weeks.fods index 3c7b728e90cc..0002995ff9da 100644 --- a/sc/qa/unit/data/functions/fods/weeks.fods +++ b/sc/qa/unit/data/functions/fods/weeks.fods @@ -1,13 +1,13 @@ - 2016-06-16T20:38:26.745575429P0D1LibreOfficeDev/5.3.0.0.alpha0$Linux_X86_64 LibreOffice_project/131e604073f89e6c1dd54be88b94b7befd881f2e + 2016-06-16T20:38:26.745575429P0D1LibreOfficeDev/5.3.0.0.alpha0$Linux_X86_64 LibreOffice_project/6402c19c9b4d51dd7feaa3129b6f15b20704d356 0 0 35796 - 12440 + 12426 view1 @@ -30,8 +30,8 @@ true - 2 - 15 + 1 + 2 0 0 0 @@ -48,7 +48,7 @@ Sheet2 - 1241 + 1540 0 100 60 @@ -88,10 +88,12 @@ true true true + true + true false 12632256 false - Lexmark-E352dn + Generic Printer cs @@ -115,14 +117,12 @@ - true - true 3 1 true 1 true - qQH+/0xleG1hcmstRTM1MmRuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ1VQUzpMZXhtYXJrLUUzNTJkbgAAAAAAAAAAAAAAAAAWAAMAzwAAAAAAAAAEAAhSAAAEdAAASm9iRGF0YSAxCnByaW50ZXI9TGV4bWFyay1FMzUyZG4Kb3JpZW50YXRpb249UG9ydHJhaXQKY29waWVzPTEKY29sbGF0ZT1mYWxzZQptYXJnaW5kYWp1c3RtZW50PTAsMCwwLDAKY29sb3JkZXB0aD0yNApwc2xldmVsPTAKcGRmZGV2aWNlPTEKY29sb3JkZXZpY2U9MApQUERDb250ZXhEYXRhCkR1cGxleDpOb25lAElucHV0U2xvdDpUcmF5MQBQYWdlU2l6ZTpBNAAAEgBDT01QQVRfRFVQTEVYX01PREUKAERVUExFWF9PRkY= + hAH+/0dlbmVyaWMgUHJpbnRlcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU0dFTlBSVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWAAMAqgAAAAAAAAAIAFZUAAAkbQAASm9iRGF0YSAxCnByaW50ZXI9R2VuZXJpYyBQcmludGVyCm9yaWVudGF0aW9uPVBvcnRyYWl0CmNvcGllcz0xCm1hcmdpbmRhanVzdG1lbnQ9MCwwLDAsMApjb2xvcmRlcHRoPTI0CnBzbGV2ZWw9MApwZGZkZXZpY2U9MApjb2xvcmRldmljZT0wClBQRENvbnRleERhdGEKUGFnZVNpemU6TGV0dGVyAAASAENPTVBBVF9EVVBMRVhfTU9ERQoARFVQTEVYX09GRg== false 0 @@ -146,259 +146,248 @@ - + - - - - - - - - - - - - - - - - £ - - - - - - £ - - - - - £ - - - - - - £ - - - - - £ - - - - - - - £ - - - - - £ - - - - - - - £ - - - - - £ - - - - - - - £ - - - - - - - - - ( - - ) - - - - - - - - ( - - ) - - - £ - - + + + + - - £ - - + + + £ - - + - £ - - + - - - + £ + - - - - + £ + - - - + £ + + - - - - + £ + - - - + £ + - - - - + £ + + £ - - - + £ + + + + + + + + + ( + + ) + + + + + + + + ( + + ) + + + + £ + + + + + - + £ + + + + + + £ + + + + + - + £ + + + + + + + + + + + - + + + + + + + + + + + + - + + + + + + + + + + + + + - + + + + + + - - - $ - - - + - - $ - - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + - + - + - - + - + @@ -407,7 +396,7 @@ / - + @@ -422,7 +411,7 @@ - + @@ -440,64 +429,64 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - . - . + / + + / @@ -506,40 +495,40 @@ - + - + - + - + - + - + - + @@ -550,7 +539,7 @@ - + @@ -564,69 +553,72 @@ - + - + + - - - - + + + + - + + + + + + + + - + - + - + - + - + - + - - - - - - - + + @@ -637,43 +629,48 @@ - - - + + + + + + + + - + - + - + - + - + - + @@ -711,7 +708,7 @@ ??? (???) - 00.00.0000, 00:00:00 + 00/00/0000, 00:00:00 @@ -743,7 +740,7 @@ Result - PRAVDA + TRUE @@ -766,7 +763,7 @@ 1 - PRAVDA + TRUE Simple WEEKS formulas with local references and values @@ -835,15 +832,15 @@ Comment - + DATA - + 1 - + @@ -853,14 +850,14 @@ err - PRAVDA + TRUE - - =WEEKS(K2;K3;K4:K6) + + =WEEKS(K2,K3,K4:K6) - - 01.11.2014 + + 11/01/2014 @@ -868,22 +865,22 @@ - - - 0 + + + Err:502 - - 0 + + err - - PRAVDA + + TRUE - - =WEEKS(K2;K2;K2) + + =WEEKS(K2,K2,K2) - - 30.11.2014 + + 11/30/2014 @@ -898,22 +895,22 @@ 4 - - PRAVDA + + TRUE - - =WEEKS(K2;K3;L2) + + =WEEKS(K2,K3,L2) - - - 11.11.2014 + + + 11/11/2014 - + 0 - + @@ -922,15 +919,15 @@ 4 - - PRAVDA + + TRUE - - =WEEKS(K2;K3;) + + =WEEKS(K2,K3,) - - 27.11.2014 + + 11/27/2014 @@ -945,15 +942,15 @@ -4 - - PRAVDA + + TRUE - - =WEEKS(K3;K2;) + + =WEEKS(K3,K2,) - - 28.11.2014 + + 11/28/2014 @@ -968,22 +965,22 @@ err - - PRAVDA + + TRUE - - =WEEKS(K2;K2+6;;{1;0;1;0;1;0;1}) + + =WEEKS(K2,K2+6,,{1;0;1;0;1;0;1}) - - - 24.12.2001 + + + 12/24/2001 - + 1 - + @@ -992,15 +989,15 @@ 4 - - PRAVDA + + TRUE - - =WEEKS(day1;day2;one) + + =WEEKS(day1,day2,one) - - 25.12.2001 + + 12/25/2001 @@ -1011,15 +1008,15 @@ 10 - - PRAVDA + + TRUE - - =WEEKS(DATE(2014;1;15);DATE(2014;4;1);0) + + =WEEKS(DATE(2014,1,15),DATE(2014,4,1),0) - - 26.12.2001 + + 12/26/2001 @@ -1030,34 +1027,34 @@ Err - - PRAVDA + + TRUE - - =WEEKS(DATE(2014;11;1);DATE(2014;11;30);{"Hello";"Eike";"!"}) + + =WEEKS(DATE(2014,11,1),DATE(2014,11,30),{"Hello";"Eike";"!"}) TDF#100409 - - - 31.12.2001 + + + 12/31/2001 - + - - 01.01.2002 + + 01/01/2002 - + 17 @@ -1066,49 +1063,49 @@ - - - + - - 01.12.2001 + + + + 12/01/2001 - + - - + + - - 10 + + Err:502 err - - - =WEEKS(DATE(2014;1;15);DATE(2014;4;1);2) + + + =WEEKS(DATE(2014,1,15),DATE(2014,4,1),2) Tdf#100440 - - - - - - - + + + + + + + @@ -1116,7 +1113,7 @@ - + WEEKSCalculates the difference in weeks between two dates.SyntaxWEEKS(StartDate; EndDate; Type)StartDate is the first dateEndDate is the second dateType calculates the type of difference. The possible values are 0 (interval) and 1 (in numbers of weeks). @@ -1124,36 +1121,36 @@ - - - - - - - - - - - - - + + + + + + + + - + - + + + + + + @@ -1199,7 +1196,7 @@ - + diff --git a/sc/qa/unit/data/functions/fods/years.fods b/sc/qa/unit/data/functions/fods/years.fods index 71ad7796a772..cd3ac27e652f 100644 --- a/sc/qa/unit/data/functions/fods/years.fods +++ b/sc/qa/unit/data/functions/fods/years.fods @@ -1,13 +1,13 @@ - 2016-06-16T21:00:15.480415068P0D1LibreOfficeDev/5.3.0.0.alpha0$Linux_X86_64 LibreOffice_project/131e604073f89e6c1dd54be88b94b7befd881f2e + 2016-06-16T21:00:15.480415068P0D1LibreOfficeDev/5.3.0.0.alpha0$Linux_X86_64 LibreOffice_project/6402c19c9b4d51dd7feaa3129b6f15b20704d356 0 0 33007 - 15349 + 15335 view1 @@ -30,8 +30,8 @@ true - 4 - 18 + 1 + 2 0 0 0 @@ -48,7 +48,7 @@ Sheet2 - 1241 + 1540 0 100 60 @@ -88,10 +88,12 @@ true true true + true + true false 12632256 false - Lexmark-E352dn + Generic Printer cs @@ -115,14 +117,12 @@ - true - true 3 1 true 1 true - qQH+/0xleG1hcmstRTM1MmRuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ1VQUzpMZXhtYXJrLUUzNTJkbgAAAAAAAAAAAAAAAAAWAAMAzwAAAAAAAAAEAAhSAAAEdAAASm9iRGF0YSAxCnByaW50ZXI9TGV4bWFyay1FMzUyZG4Kb3JpZW50YXRpb249UG9ydHJhaXQKY29waWVzPTEKY29sbGF0ZT1mYWxzZQptYXJnaW5kYWp1c3RtZW50PTAsMCwwLDAKY29sb3JkZXB0aD0yNApwc2xldmVsPTAKcGRmZGV2aWNlPTEKY29sb3JkZXZpY2U9MApQUERDb250ZXhEYXRhCkR1cGxleDpOb25lAElucHV0U2xvdDpUcmF5MQBQYWdlU2l6ZTpBNAAAEgBDT01QQVRfRFVQTEVYX01PREUKAERVUExFWF9PRkY= + hAH+/0dlbmVyaWMgUHJpbnRlcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU0dFTlBSVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWAAMAqgAAAAAAAAAIAFZUAAAkbQAASm9iRGF0YSAxCnByaW50ZXI9R2VuZXJpYyBQcmludGVyCm9yaWVudGF0aW9uPVBvcnRyYWl0CmNvcGllcz0xCm1hcmdpbmRhanVzdG1lbnQ9MCwwLDAsMApjb2xvcmRlcHRoPTI0CnBzbGV2ZWw9MApwZGZkZXZpY2U9MApjb2xvcmRldmljZT0wClBQRENvbnRleERhdGEKUGFnZVNpemU6TGV0dGVyAAASAENPTVBBVF9EVVBMRVhfTU9ERQoARFVQTEVYX09GRg== false 0 @@ -145,259 +145,248 @@ - + - - - - - - - - - - - - - - - - £ - - - - - - £ - - - - - £ - - - - - - £ - - - - - £ - - - - - - - £ - - - - - £ - - - - - - - £ - - - - - £ - - - - - - - £ - - - - - - - - - ( - - ) - - - - - - - - ( - - ) - - - £ - - + + + + - - £ - - + + + £ - - + - £ - - + - - - + £ + - - - - + £ + - - - + £ + + - - - - + £ + - - - + £ + - - - - + £ + + £ - - - + £ + + + + + + + + + ( + + ) + + + + + + + + ( + + ) + + + + £ + + + + + - + £ + + + + + + £ + + + + + - + £ + + + + + + + + + + + - + + + + + + + + + + + + - + + + + + + + + + + + + + - + + + + + + - - - $ - - - + - - $ - - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + - + - + - - + - + @@ -406,7 +395,7 @@ / - + @@ -415,18 +404,18 @@ / - + - + - - + @@ -434,7 +423,7 @@ - + @@ -452,79 +441,79 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - . - . + / + + / @@ -533,40 +522,40 @@ - + - + - + - + - + - + - + @@ -577,7 +566,7 @@ - + @@ -591,76 +580,79 @@ - + - + + - - - - + + + + - + + + + + + + + - + - + - + - + - + - + - + - + - - - - - - - + + @@ -671,43 +663,48 @@ - - - + + + + + + + + - + - + - + - + - + - + @@ -730,7 +727,7 @@ ??? (???) - 00.00.0000, 00:00:00 + 00/00/0000, 00:00:00 @@ -762,7 +759,7 @@ Result - PRAVDA + TRUE @@ -785,7 +782,7 @@ 1 - PRAVDA + TRUE SimpleYEARS formulas with local references and values @@ -854,15 +851,15 @@ Comment - + DATA - + 1 - + @@ -872,14 +869,14 @@ err - PRAVDA + TRUE - - =YEARS(K2;K3;K4:K6) + + =YEARS(K2,K3,K4:K6) - - 01.11.2014 + + 11/01/2014 @@ -887,22 +884,22 @@ - - - 0 + + + Err:502 - - 0 + + err - - PRAVDA + + TRUE - - =YEARS(K2;K2;K2) + + =YEARS(K2,K2,K2) - - 30.11.2017 + + 11/30/2017 @@ -917,22 +914,22 @@ 3 - - PRAVDA + + TRUE - - =YEARS(K2;K3;L2) + + =YEARS(K2,K3,L2) - - - 11.11.2014 + + + 11/11/2014 - + 0 - + @@ -941,15 +938,15 @@ 3 - - PRAVDA + + TRUE - - =YEARS(K2;K3;) + + =YEARS(K2,K3,) - - 27.11.2014 + + 11/27/2014 @@ -964,15 +961,15 @@ -3 - - PRAVDA + + TRUE - - =YEARS(K3;K2;) + + =YEARS(K3,K2,) - - 28.11.2014 + + 11/28/2014 @@ -987,22 +984,22 @@ err - - PRAVDA + + TRUE - - =YEARS(K2;K2+6;;{1;0;1;0;1;0;1}) + + =YEARS(K2,K2+6,,{1;0;1;0;1;0;1}) - - - 24.12.2001 + + + 12/24/2001 - + 1 - + @@ -1011,15 +1008,15 @@ 3 - - PRAVDA + + TRUE - - =YEARS(day1;day2;one) + + =YEARS(day1,day2,one) - - 25.12.2001 + + 12/25/2001 @@ -1030,15 +1027,15 @@ 2 - - PRAVDA + + TRUE - - =YEARS(DATE(2014;1;15);DATE(2016;4;1);0) + + =YEARS(DATE(2014,1,15),DATE(2016,4,1),0) - - 26.12.2001 + + 12/26/2001 @@ -1049,21 +1046,21 @@ Err - - PRAVDA + + TRUE - - =WEEKS(DATE(2014;11;1);DATE(2014;11;30);{"Hello";"Eike";"!"}) + + =WEEKS(DATE(2014,11,1),DATE(2014,11,30),{"Hello";"Eike";"!"}) TDF#100409 - - - 31.12.2001 + + + 12/31/2001 - + @@ -1072,21 +1069,21 @@ 115 - - PRAVDA + + TRUE - - =YEARS(K16;K17;0) + + =YEARS(K16,K17,0) - - 01.01.2002 + + 01/01/2002 - + 17 @@ -1095,64 +1092,64 @@ - - - + - - 01.12.2001 + + + + 12/01/2001 - + - - + + - - + + - - 30.12.1899 + + 12/30/1899 - + - - - 30.12.1899 + + + 12/30/1899 - + - + Tdf#96756 bug - - 02.01.2015 + + 01/02/2015 - - 2 + + Err:502 err - - - =YEARS(DATE(2014;1;15);DATE(2016;4;1);2) + + + =YEARS(DATE(2014,1,15),DATE(2016,4,1),2) Tdf#100440 @@ -1161,18 +1158,18 @@ - - + + - + - + YEARSCalculates the difference in years between two dates.SyntaxYEARS(StartDate; EndDate; Type)StartDate is the first dateEndDate is the second dateType calculates the type of difference. Possible values are 0 (interval) and 1 (in calendar years). @@ -1180,44 +1177,44 @@ - + - + - + - + - + - + - + - + - + @@ -1270,7 +1267,7 @@ - + diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx index cd9b3b005718..ca4003cd37e7 100644 --- a/scaddins/source/datefunc/datefunc.cxx +++ b/scaddins/source/datefunc/datefunc.cxx @@ -591,6 +591,9 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffWeeks( sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException, std::exception ) { + if (nMode != 0 && nMode != 1) + throw lang::IllegalArgumentException(); + sal_Int32 nNullDate = GetNullDate( xOptions ); sal_Int32 nDays1 = nStartDate + nNullDate; @@ -628,6 +631,9 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffMonths( sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException, std::exception ) { + if (nMode != 0 && nMode != 1) + throw lang::IllegalArgumentException(); + sal_Int32 nNullDate = GetNullDate( xOptions ); sal_Int32 nDays1 = nStartDate + nNullDate; @@ -673,6 +679,9 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffYears( sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException, std::exception ) { + if (nMode != 0 && nMode != 1) + throw lang::IllegalArgumentException(); + if ( nMode != 1 ) return getDiffMonths( xOptions, nStartDate, nEndDate, nMode ) / 12;