[Libreoffice-commits] core.git: formula/source include/formula scaddins/source sc/inc sc/qa sc/source

Winfried Donkers winfrieddonkers at libreoffice.org
Tue May 5 12:15:40 PDT 2015


 formula/source/core/resource/core_resource.src |    7 ++
 include/formula/compiler.hrc                   |    3 
 include/formula/opcode.hxx                     |    1 
 sc/inc/helpids.h                               |    1 
 sc/qa/unit/ucalc.cxx                           |    1 
 sc/source/core/inc/interpre.hxx                |    6 +
 sc/source/core/tool/interpr2.cxx               |   77 ++++++++++++++++++++-----
 sc/source/core/tool/interpr4.cxx               |    3 
 sc/source/core/tool/odffmap.cxx                |    2 
 sc/source/core/tool/parclass.cxx               |    1 
 sc/source/filter/excel/xlformula.cxx           |    7 +-
 sc/source/filter/oox/formulabase.cxx           |    2 
 sc/source/ui/src/scfuncs.src                   |   48 +++++++++++++++
 scaddins/source/analysis/analysishelper.cxx    |    2 
 14 files changed, 136 insertions(+), 25 deletions(-)

New commits:
commit 111952dccc1bf9e28e61c0233816248c848cbf53
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Mon May 12 12:02:11 2014 +0200

    fdo#77985 make calc function NETWORKDAYS comply with ODFF1.2
    
    Change-Id: I523b0c71bc0fed501a4d5fffd75c5a4704f6dd13
    Reviewed-on: https://gerrit.libreoffice.org/9827
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src
index 4462ee9..298560c 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -390,6 +390,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
     String SC_OPCODE_WEEK { Text = "ISOWEEKNUM" ; };
     String SC_OPCODE_EASTERSUNDAY { Text = "ORG.OPENOFFICE.EASTERSUNDAY" ; };
     String SC_OPCODE_GET_DAY_OF_WEEK { Text = "WEEKDAY" ; };
+    String SC_OPCODE_NETWORKDAYS { Text = "NETWORKDAYS" ; };
     String SC_OPCODE_NETWORKDAYS_MS { Text = "COM.MICROSOFT.NETWORKDAYS.INTL" ; };
     String SC_OPCODE_WORKDAY_MS { Text = "COM.MICROSOFT.WORKDAY.INTL" ; };
     String SC_OPCODE_NO_NAME { Text = "#NAME!" ; };
@@ -808,6 +809,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
     String SC_OPCODE_WEEK { Text = "WEEKNUM" ; };
     String SC_OPCODE_EASTERSUNDAY { Text = "EASTERSUNDAY" ; };
     String SC_OPCODE_GET_DAY_OF_WEEK { Text = "WEEKDAY" ; };
+    String SC_OPCODE_NETWORKDAYS { Text = "NETWORKDAYS" ; };
     String SC_OPCODE_NETWORKDAYS_MS { Text = "NETWORKDAYS.INTL" ; };
     String SC_OPCODE_WORKDAY_MS { Text = "WORKDAY.INTL" ; };
     String SC_OPCODE_NO_NAME { Text = "#NAME!" ; };
@@ -1228,6 +1230,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
     String SC_OPCODE_WEEK { Text = "WEEKNUM" ; };
     String SC_OPCODE_EASTERSUNDAY { Text = "EASTERSUNDAY" ; };
     String SC_OPCODE_GET_DAY_OF_WEEK { Text = "WEEKDAY" ; };
+    String SC_OPCODE_NETWORKDAYS { Text = "NETWORKDAYS" ; };
     String SC_OPCODE_NETWORKDAYS_MS { Text = "NETWORKDAYS.INTL" ; };
     String SC_OPCODE_WORKDAY_MS { Text = "WORKDAY.INTL" ; };
     String SC_OPCODE_NO_NAME { Text = "#NAME!" ; };
@@ -2689,6 +2692,10 @@ Resource RID_STRLIST_FUNCTION_NAMES
     {
         Text [ en-US ] = "WEEKDAY" ;
     };
+    String SC_OPCODE_NETWORKDAYS
+    {
+        Text [ en-US ] = "NETWORKDAYS" ;
+    };
     String SC_OPCODE_NETWORKDAYS_MS
     {
         Text [ en-US ] = "NETWORKDAYS.INTL" ;
diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc
index f5bd316..4798c19 100644
--- a/include/formula/compiler.hrc
+++ b/include/formula/compiler.hrc
@@ -481,7 +481,8 @@
 #define SC_OPCODE_COLOR             471
 #define SC_OPCODE_CEIL              472
 #define SC_OPCODE_CEIL_PRECISE      473
-#define SC_OPCODE_STOP_2_PAR        474     /* last function with two or more parameters' OpCode + 1 */
+#define SC_OPCODE_NETWORKDAYS       474
+#define SC_OPCODE_STOP_2_PAR        475     /* last function with two or more parameters' OpCode + 1 */
 
 #define SC_OPCODE_STOP_FUNCTION     SC_OPCODE_STOP_2_PAR            /* last function's OpCode + 1 */
 #define SC_OPCODE_LAST_OPCODE_ID    (SC_OPCODE_STOP_FUNCTION - 1)   /* last OpCode */
diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx
index 73b911a..9d4d676 100644
--- a/include/formula/opcode.hxx
+++ b/include/formula/opcode.hxx
@@ -448,6 +448,7 @@ enum OpCode : sal_uInt16
     // miscellaneous
         ocWeek              = SC_OPCODE_WEEK,
         ocGetDayOfWeek      = SC_OPCODE_GET_DAY_OF_WEEK,
+        ocNetWorkdays       = SC_OPCODE_NETWORKDAYS,
         ocNetWorkdays_MS    = SC_OPCODE_NETWORKDAYS_MS,
         ocWorkday_MS        = SC_OPCODE_WORKDAY_MS,
         ocNoName            = SC_OPCODE_NO_NAME,
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 0425fe5..367bb0d 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -621,6 +621,7 @@
 #define HID_FUNC_CEIL_PRECISE                                   "SC_HID_FUNC_CEIL_PRECISE"
 #define HID_FUNC_CEIL_ISO                                       "SC_HID_FUNC_CEIL_ISO"
 #define HID_FUNC_FLOOR_MS                                       "SC_HID_FUNC_FLOOR_MS"
+#define HID_FUNC_NETWORKDAYS                                    "SC_HID_FUNC_NETWORKDAYS"
 #define HID_FUNC_NETWORKDAYS_MS                                 "SC_HID_FUNC_NETWORKDAYS_MS"
 #define HID_FUNC_WORKDAY_MS                                     "SC_HID_FUNC_WORKDAY_MS"
 #define HID_FUNC_ERF_MS                                         "SC_HID_FUNC_ERF_MS"
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 83431ee..c5d7a98 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2354,6 +2354,7 @@ void Test::testFunctionLists()
         "MINUTE",
         "MONTH",
         "MONTHS",
+        "NETWORKDAYS",
         "NETWORKDAYS.INTL",
         "NOW",
         "SECOND",
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index ee5d941..d3eab01 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -612,9 +612,11 @@ void ScGetDayOfWeek();
 void ScGetWeekOfYear();
 void ScEasterSunday();
 sal_uInt16 GetWeekendAndHolidayMasks( const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,
-        ::std::vector<double>& rSortArray, OUString& rWeekendDays, bool bWeekendMask[ 7 ] );
+        ::std::vector<double>& rSortArray, bool bWeekendMask[ 7 ] );
+sal_uInt16 GetWeekendAndHolidayMasks_MS( const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,
+        ::std::vector<double>& rSortArray, bool bWeekendMask[ 7 ] );
 static inline sal_Int16 GetDayOfWeek( sal_Int32 n );
-void ScNetWorkdays_MS();
+void ScNetWorkdays( bool bOOXML_Version );
 void ScWorkday_MS();
 void ScGetHour();
 void ScGetMin();
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 4b2420d..dc85efd 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -249,9 +249,49 @@ void ScInterpreter::ScEasterSunday()
 
 sal_uInt16 ScInterpreter::GetWeekendAndHolidayMasks(
     const sal_uInt8 nParamCount, const sal_uInt32 nNullDate, vector< double >& rSortArray,
-    OUString& rWeekendDays, bool bWeekendMask[ 7 ] )
+    bool bWeekendMask[ 7 ] )
+{
+    if ( nParamCount == 4 )
+    {
+        vector< double > nWeekendDays;
+        GetNumberSequenceArray( 1, nWeekendDays, false );
+        if ( nGlobalError )
+            return nGlobalError;
+        else
+        {
+            if ( nWeekendDays.size() != 7 )
+                return  errIllegalArgument;
+
+            for ( int i = 0; i < 7; i++ )
+                bWeekendMask[ i ] = ( bool ) nWeekendDays[ i ];
+        }
+    }
+    else
+    {
+        for ( int i = 0; i < 7; i++ )
+            bWeekendMask[ i] = false;
+
+        bWeekendMask[ SATURDAY ] = true;
+        bWeekendMask[ SUNDAY ]   = true;
+    }
+
+    if ( nParamCount >= 3 )
+    {
+        GetSortArray( 1, rSortArray, NULL, false );
+        size_t nMax = rSortArray.size();
+        for ( size_t i = 0; i < nMax; i++ )
+            rSortArray.at( i ) = ::rtl::math::approxFloor( rSortArray.at( i ) ) + nNullDate;
+    }
+
+    return nGlobalError;
+}
+
+sal_uInt16 ScInterpreter::GetWeekendAndHolidayMasks_MS(
+    const sal_uInt8 nParamCount, const sal_uInt32 nNullDate, vector< double >& rSortArray,
+    bool bWeekendMask[ 7 ] )
 {
     sal_uInt16 nErr = 0;
+    OUString aWeekendDays;
     if ( nParamCount == 4 )
     {
         GetSortArray( 1, rSortArray, NULL, true );
@@ -261,23 +301,23 @@ sal_uInt16 ScInterpreter::GetWeekendAndHolidayMasks(
     }
 
     if ( nParamCount >= 3 )
-        rWeekendDays = GetString().getString();
+        aWeekendDays = GetString().getString();
 
     for ( int i = 0; i < 7; i++ )
         bWeekendMask[ i] = false;
 
-    if ( rWeekendDays.isEmpty() )
+    if ( aWeekendDays.isEmpty() )
     {
         bWeekendMask[ SATURDAY ] = true;
         bWeekendMask[ SUNDAY ]   = true;
     }
     else
     {
-        switch ( rWeekendDays.getLength() )
+        switch ( aWeekendDays.getLength() )
         {
             case 1 :
                 // Weekend days defined by code
-                switch ( rWeekendDays[ 0 ] )
+                switch ( aWeekendDays[ 0 ] )
                 {
                     case '1' : bWeekendMask[ SATURDAY ]  = true; bWeekendMask[ SUNDAY ]    = true; break;
                     case '2' : bWeekendMask[ SUNDAY ]    = true; bWeekendMask[ MONDAY ]    = true; break;
@@ -291,9 +331,9 @@ sal_uInt16 ScInterpreter::GetWeekendAndHolidayMasks(
                 break;
             case 2 :
                 // Weekend day defined by code
-                if ( rWeekendDays[ 0 ] == '1' )
+                if ( aWeekendDays[ 0 ] == '1' )
                 {
-                    switch ( rWeekendDays[ 1 ] )
+                    switch ( aWeekendDays[ 1 ] )
                     {
                         case '1' : bWeekendMask[ SUNDAY ]    = true; break;
                         case '2' : bWeekendMask[ MONDAY ]    = true; break;
@@ -312,7 +352,7 @@ sal_uInt16 ScInterpreter::GetWeekendAndHolidayMasks(
                 // Weekend days defined by string
                 for ( int i = 0; i < 7 && !nErr; i++ )
                 {
-                    switch ( rWeekendDays[ i ] )
+                    switch ( aWeekendDays[ i ] )
                     {
                         case '0' : bWeekendMask[ i ] = false; break;
                         case '1' : bWeekendMask[ i ] = true;  break;
@@ -328,18 +368,26 @@ sal_uInt16 ScInterpreter::GetWeekendAndHolidayMasks(
     return nErr;
 }
 
-void ScInterpreter::ScNetWorkdays_MS()
+void ScInterpreter::ScNetWorkdays( bool bOOXML_Version )
 {
     sal_uInt8 nParamCount = GetByte();
     if ( MustHaveParamCount( nParamCount, 2, 4 ) )
     {
         vector<double> nSortArray;
         bool bWeekendMask[ 7 ];
-        OUString aWeekendDays;
         Date aNullDate = *( pFormatter->GetNullDate() );
         sal_uInt32 nNullDate = Date::DateToDays( aNullDate.GetDay(), aNullDate.GetMonth(), aNullDate.GetYear() );
-        sal_uInt16 nErr = GetWeekendAndHolidayMasks( nParamCount, nNullDate,
-                            nSortArray , aWeekendDays, bWeekendMask );
+        sal_uInt16 nErr;
+        if ( bOOXML_Version )
+        {
+            nErr = GetWeekendAndHolidayMasks_MS( nParamCount, nNullDate,
+                            nSortArray, bWeekendMask );
+        }
+        else
+        {
+            nErr = GetWeekendAndHolidayMasks( nParamCount, nNullDate,
+                            nSortArray, bWeekendMask );
+        }
         if ( nErr )
             PushError( nErr );
         else
@@ -381,11 +429,10 @@ void ScInterpreter::ScWorkday_MS()
         nFuncFmtType = css::util::NumberFormat::DATE;
         vector<double> nSortArray;
         bool bWeekendMask[ 7 ];
-        OUString aWeekendDays;
         Date aNullDate = *( pFormatter->GetNullDate() );
         sal_uInt32 nNullDate = Date::DateToDays( aNullDate.GetDay(), aNullDate.GetMonth(), aNullDate.GetYear() );
-        sal_uInt16 nErr = GetWeekendAndHolidayMasks( nParamCount, nNullDate,
-                            nSortArray , aWeekendDays, bWeekendMask );
+        sal_uInt16 nErr = GetWeekendAndHolidayMasks_MS( nParamCount, nNullDate,
+                            nSortArray, bWeekendMask );
         if ( nErr )
             PushError( nErr );
         else
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index fb1dc39..f3ee9ea 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3941,7 +3941,8 @@ StackVar ScInterpreter::Interpret()
                 case ocGetDayOfWeek     : ScGetDayOfWeek();             break;
                 case ocWeek             : ScGetWeekOfYear();            break;
                 case ocEasterSunday     : ScEasterSunday();             break;
-                case ocNetWorkdays_MS   : ScNetWorkdays_MS();           break;
+                case ocNetWorkdays      : ScNetWorkdays( false);        break;
+                case ocNetWorkdays_MS   : ScNetWorkdays( true );        break;
                 case ocWorkday_MS       : ScWorkday_MS();               break;
                 case ocGetHour          : ScGetHour();                  break;
                 case ocGetMin           : ScGetMin();                   break;
diff --git a/sc/source/core/tool/odffmap.cxx b/sc/source/core/tool/odffmap.cxx
index fef82c3..494ab81 100644
--- a/sc/source/core/tool/odffmap.cxx
+++ b/sc/source/core/tool/odffmap.cxx
@@ -36,7 +36,7 @@ ScCompiler::AddInMap ScCompiler::maAddInMap[] =
     { "EDATE", "EDATE", false, "com.sun.star.sheet.addin.Analysis.getEdate", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETEDATE" },
     { "WEEKNUM", "WEEKNUM_ADD", false, "com.sun.star.sheet.addin.Analysis.getWeeknum", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETWEEKNUM" },
     { "EOMONTH", "EOMONTH", false, "com.sun.star.sheet.addin.Analysis.getEomonth", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETEOMONTH" },
-    { "NETWORKDAYS", "NETWORKDAYS", false, "com.sun.star.sheet.addin.Analysis.getNetworkdays", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETNETWORKDAYS" },
+    { "NETWORKDAYS", "NETWORKDAYS_XCL", true, "com.sun.star.sheet.addin.Analysis.getNetworkdays", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETNETWORKDAYS" },
     { "ISEVEN", "ISEVEN_ADD", true, "com.sun.star.sheet.addin.Analysis.getIseven", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETISEVEN" },
     { "ISODD", "ISODD_ADD", true, "com.sun.star.sheet.addin.Analysis.getIsodd", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETISODD" },
     { "MULTINOMIAL", "MULTINOMIAL", false, "com.sun.star.sheet.addin.Analysis.getMultinomial", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETMULTINOMIAL" },
diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index a0d99dd..8afc2b0 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -208,6 +208,7 @@ const ScParameterClassification::RawData ScParameterClassification::pRawData[] =
     { ocXor,             {{ Reference                                            }, 1 }},
     { ocZTest,           {{ Reference, Value, Value                              }, 0 }},
     { ocZTest_MS,        {{ Reference, Value, Value                              }, 0 }},
+    { ocNetWorkdays,     {{ Value, Value, Reference, Reference                   }, 0 }},
     { ocNetWorkdays_MS,  {{ Value, Value, Value, Reference                       }, 0 }},
     { ocWorkday_MS,      {{ Value, Value, Value, Reference                       }, 0 }},
     { ocAggregate,       {{ Value, Value, Reference                              }, 1 }},
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index c3ad1b1..173b7b1 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -336,7 +336,8 @@ static const XclFunctionInfo saFuncTable_4[] =
     { ocEffective,          255,    1,  MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getEffect" ) },
     { ocCumPrinc,           255,    1,  MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getCumprinc" ) },
     { ocCumIpmt,            255,    1,  MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getCumipmt" ) },
-    { ocNominal,            255,    1,  MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getNominal" ) }
+    { ocNominal,            255,    1,  MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getNominal" ) },
+    { ocNetWorkdays,        255,    1,  MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getNetworkdays" ) }
 };
 
 /** Functions new in BIFF5/BIFF7. Unsupported functions: DATESTRING, NUMBERSTRING. */
@@ -398,8 +399,8 @@ static const XclFunctionInfo saFuncTable_Oox[] =
     { ocAverageIfs,         255,    4,  MX, V, { RO_E, RO, RO, VR }, EXC_FUNCFLAG_EXPORTONLY|EXC_FUNCFLAG_PARAMPAIRS, EXC_FUNCNAME( "AVERAGEIFS" ) },
     { ocIfError,            NOID,   2,  2,  V, { VO, RO }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "IFERROR" ) },
     { ocIfError,            255,    3,  3,  V, { RO_E, VO, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "IFERROR" ) },
-    { ocNetWorkdays_MS,     NOID,   2,  4,  V, { VR, VR, VR, RO }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "NETWORKDAYS.INTL" ) },
-    { ocNetWorkdays_MS,     255,    3,  5,  V, { RO_E, VR, VR, VR, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "NETWORKDAYS.INTL" ) },
+    { ocNetWorkdays_MS,     NOID,   2,  4,  V, { VR, VR, RO, RO }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "NETWORKDAYS.INTL" ) },
+    { ocNetWorkdays_MS,     255,    3,  5,  V, { RO_E, VR, VR, RO, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "NETWORKDAYS.INTL" ) },
     { ocWorkday_MS,         NOID,   2,  4,  V, { VR, VR, VR, RO }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "WORKDAY.INTL" ) },
     { ocWorkday_MS,         255,    3,  5,  V, { RO_E, VR, VR, VR, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "WORKDAY.INTL" ) },
     EXC_FUNCENTRY_V_VR( ocCeil_ISO,         2,  2,  0,  "ISO.CEILING" )
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index a590a3c2..4294786 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -643,7 +643,7 @@ static const FunctionData saFuncTableBiff4[] =
     { "ACCRINT",                "ACCRINT",              469,    NOID,   6,  7,  V, { RR }, FUNCFLAG_EXTERNAL },
     { "ACCRINTM",               "ACCRINTM",             470,    NOID,   4,  5,  V, { RR }, FUNCFLAG_EXTERNAL },
     { "WORKDAY",                "WORKDAY",              471,    NOID,   2,  3,  V, { RR, RR, RX, C }, FUNCFLAG_EXTERNAL },
-    { "NETWORKDAYS",            "NETWORKDAYS",          472,    NOID,   2,  3,  V, { RR, RR, RX, C }, FUNCFLAG_EXTERNAL },
+    { "NETWORKDAYS",            "NETWORKDAYS",          472,    NOID,   2,  3,  V, { RR, RR, RX, C }, FUNCFLAG_EXTERNAL | FUNCFLAG_INTERNAL }, // Calc: builtin and add-in
     { "GCD",                    "GCD",                  473,    NOID,   1,  MX, V, { RX }, FUNCFLAG_EXTERNAL | FUNCFLAG_INTERNAL }, // Calc: builtin and add-in
     { "MULTINOMIAL",            "MULTINOMIAL",          474,    NOID,   1,  MX, V, { RX }, FUNCFLAG_EXTERNAL },
     { "LCM",                    "LCM",                  475,    NOID,   1,  MX, V, { RX }, FUNCFLAG_EXTERNAL | FUNCFLAG_INTERNAL }, // Calc: builtin and add-in
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index abeba90..de9894a 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -686,6 +686,54 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1
             Text [ en-US ] = "Method used to form differences: Type = 0 denotes US method (NASD), Type = 1 denotes the European method." ;
         };
     };
+     // -=*# Resource for function NETWORKDAYS #*=-
+    Resource SC_OPCODE_NETWORKDAYS
+    {
+        String 1 // Description
+        {
+            Text [ en-US ] = "Returns the number of workdays between two dates using arguments to indicate weekenddays and holidays." ;
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_DATETIME;
+            U2S( HID_FUNC_NETWORKDAYS );
+            4;  0;  0;  1;  1;
+            0;
+        };
+        String 2 // Name of Parameter 1
+        {
+            Text [ en-US ] = "Start Date" ;
+        };
+        String 3 // Description of Parameter 1
+        {
+            Text [ en-US ] = "Start date for calculation." ;
+        };
+        String 4 // Name of Parameter 2
+        {
+            Text [ en-US ] = "End Date" ;
+        };
+        String 5 // Description of Parameter 2
+        {
+            Text [ en-US ] = "End date for calculation." ;
+        };
+        String 6 // Name of Parameter 3
+        {
+            Text [ en-US ] = "array" ;
+        };
+        String 7 // Description of Parameter 3
+        {
+            Text [ en-US ] = "Optional set of one or more dates to be considered as holiday." ;
+        };
+        String 8 // Name of Parameter 4
+        {
+            Text [ en-US ] = "list of numbers" ;
+        };
+        String 9 // Description of Parameter 4
+        {
+            Text [ en-US ] = "Optional list of numbers to indicate working (0) and weekend (non-zero) days. When omitted, weekend is Saturday and Sunday." ;
+        };
+    };
      // -=*# Resource for function NETWORKDAYS.INTL #*=-
     Resource SC_OPCODE_NETWORKDAYS_MS
     {
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index 9c26c7e..5f19fba 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -50,7 +50,7 @@ const FuncDataBase pFuncDatas[] =
     FUNCDATA( Edate,            UNIQUE,     INTPAR,     2,          FDCat_DateTime ),
     FUNCDATA( Weeknum,          DOUBLE,     INTPAR,     2,          FDCat_DateTime ),
     FUNCDATA( Eomonth,          UNIQUE,     INTPAR,     2,          FDCat_DateTime ),
-    FUNCDATA( Networkdays,      UNIQUE,     INTPAR,     3,          FDCat_DateTime ),
+    FUNCDATA( Networkdays,      DOUBLE,     INTPAR,     3,          FDCat_DateTime ),
     FUNCDATA( Iseven,           DOUBLE,     STDPAR,     1,          FDCat_Inf ),
     FUNCDATA( Isodd,            DOUBLE,     STDPAR,     1,          FDCat_Inf ),
     FUNCDATA( Multinomial,      UNIQUE,     STDPAR,     1,          FDCat_Math ),


More information about the Libreoffice-commits mailing list