[Libreoffice-commits] core.git: scaddins/source

Eike Rathke erack at redhat.com
Wed Oct 7 06:44:34 PDT 2015


 scaddins/source/analysis/analysis.cxx       |    8 +++++++-
 scaddins/source/analysis/analysis.src       |   18 +++++++++---------
 scaddins/source/analysis/analysishelper.cxx |   12 +++++++++---
 scaddins/source/analysis/analysishelper.hxx |   10 ++++++++++
 4 files changed, 35 insertions(+), 13 deletions(-)

New commits:
commit 74010f1c502a4bd7eb1ef3ee3d0e8c45a1c9afee
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Oct 7 15:37:54 2015 +0200

    rename WEEKNUM_ADD to WEEKNUM_EXCEL2003 in UI, tdf#50950 follow-up
    
    ... and add description to clarify that it exists for interoperability
    and for new documents WEEKNUM should be used instead.
    
    Also NETWORKDAYS_ADD to NETWORKDAYS_XCL.
    
    Change-Id: I01e705d57f0b31983950ac0e47ecb894f657de88

diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx
index 5bece71..3cc9fe9 100644
--- a/scaddins/source/analysis/analysis.cxx
+++ b/scaddins/source/analysis/analysis.cxx
@@ -289,7 +289,13 @@ OUString SAL_CALL AnalysisAddIn::getDisplayFunctionName( const OUString& aProgra
     {
         aRet = GetDisplFuncStr( it->GetUINameID() );
         if( it->IsDouble() )
-            aRet += "_ADD";
+        {
+            const OUString& rSuffix = it->GetSuffix();
+            if (!rSuffix.isEmpty())
+                aRet += rSuffix;
+            else
+                aRet += "_ADD";
+        }
     }
     else
     {
diff --git a/scaddins/source/analysis/analysis.src b/scaddins/source/analysis/analysis.src
index f45b0e3..d121fe4 100644
--- a/scaddins/source/analysis/analysis.src
+++ b/scaddins/source/analysis/analysis.src
@@ -127,29 +127,29 @@ Resource RID_ANALYSIS_FUNCTION_DESCRIPTIONS
 
     Resource ANALYSIS_Weeknum
     {
-        String 1    // description Weeknum_add
+        String 1    // description Weeknum_Excel2003
         {
-            Text [ en-US ] = "Returns the number of the calendar week in which the specified date occurs.";
+            Text [ en-US ] = "Returns the number of the calendar week in which the specified date occurs.\nThis function exists for interoperability with older Microsoft Excel documents, for new documents use WEEKNUM instead.";
         };
 
-        String 2 // name of parameter 1         Weeknum_add
+        String 2 // name of parameter 1         Weeknum_Excel2003
         {
             Text [ en-US ] = "Date";
         };
 
-        String 3 // description of parameter 1  Weeknum_add
+        String 3 // description of parameter 1  Weeknum_Excel2003
         {
-            Text [ en-US ] = "The date";
+            Text [ en-US ] = "The date or date serial number";
         };
 
-        String 4 // name of parameter 2         Weeknum_add
+        String 4 // name of parameter 2         Weeknum_Excel2003
         {
             Text [ en-US ] = "Return type";
         };
 
-        String 5 // description of parameter 2  Weeknum_add
+        String 5 // description of parameter 2  Weeknum_Excel2003
         {
-            Text [ en-US ] = "Indicates the first day of the week (1 = Sunday, other values = Monday)";
+            Text [ en-US ] = "Indicates the first day of the week (1 = Sunday, 2 = Monday)";
         };
     };
 
@@ -185,7 +185,7 @@ Resource RID_ANALYSIS_FUNCTION_DESCRIPTIONS
     {
         String 1    // description Networkdays
         {
-            Text [ en-US ] = "Returns the number of workdays between two dates";
+            Text [ en-US ] = "Returns the number of workdays between two dates.\nThis function exists for interoperability with older Microsoft Excel documents, for new documents use NETWORKDAYS instead.";
         };
 
         String 2 // name of parameter 1         Networkdays
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index 2e4da5c..d22d34b 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -39,7 +39,10 @@ using namespace sca::analysis;
 #define INTPAR              true    // first parameter is internal
 
 #define FUNCDATA( FUNCNAME, DBL, OPT, NUMOFPAR, CAT ) \
-    { "get" #FUNCNAME, ANALYSIS_FUNCNAME_##FUNCNAME, ANALYSIS_##FUNCNAME, DBL, OPT, ANALYSIS_DEFFUNCNAME_##FUNCNAME, NUMOFPAR, CAT }
+    { "get" #FUNCNAME, ANALYSIS_FUNCNAME_##FUNCNAME, ANALYSIS_##FUNCNAME, DBL, OPT, ANALYSIS_DEFFUNCNAME_##FUNCNAME, NUMOFPAR, CAT, NULL }
+
+#define FUNCDATAS( FUNCNAME, DBL, OPT, NUMOFPAR, CAT, SUFFIX ) \
+    { "get" #FUNCNAME, ANALYSIS_FUNCNAME_##FUNCNAME, ANALYSIS_##FUNCNAME, DBL, OPT, ANALYSIS_DEFFUNCNAME_##FUNCNAME, NUMOFPAR, CAT, SUFFIX }
 
 const FuncDataBase pFuncDatas[] =
 {
@@ -48,9 +51,9 @@ const FuncDataBase pFuncDatas[] =
     FUNCDATA( Workday,          UNIQUE,     INTPAR,     3,          FDCat_DateTime ),
     FUNCDATA( Yearfrac,         UNIQUE,     INTPAR,     3,          FDCat_DateTime ),
     FUNCDATA( Edate,            UNIQUE,     INTPAR,     2,          FDCat_DateTime ),
-    FUNCDATA( Weeknum,          DOUBLE,     INTPAR,     2,          FDCat_DateTime ),
+    FUNCDATAS( Weeknum,         DOUBLE,     INTPAR,     2,          FDCat_DateTime, "_EXCEL2003" ),
     FUNCDATA( Eomonth,          UNIQUE,     INTPAR,     2,          FDCat_DateTime ),
-    FUNCDATA( Networkdays,      DOUBLE,     INTPAR,     3,          FDCat_DateTime ),
+    FUNCDATAS( Networkdays,     DOUBLE,     INTPAR,     3,          FDCat_DateTime, "_XCL" ),
     FUNCDATA( Iseven,           DOUBLE,     STDPAR,     1,          FDCat_Inf ),
     FUNCDATA( Isodd,            DOUBLE,     STDPAR,     1,          FDCat_Inf ),
     FUNCDATA( Multinomial,      UNIQUE,     STDPAR,     1,          FDCat_Math ),
@@ -1402,6 +1405,9 @@ FuncData::FuncData( const FuncDataBase& r, ResMgr& rResMgr ) :
     nCompID( r.nCompListID ),
     eCat( r.eCat )
 {
+    if (r.pSuffix)
+        aSuffix = OUString::createFromAscii( r.pSuffix);
+
     AnalysisRscStrArrLoader aArrLoader( RID_ANALYSIS_DEFFUNCTION_NAMES, nCompID, rResMgr );
     const ResStringArray&   rArr = aArrLoader.GetStringArray();
 
diff --git a/scaddins/source/analysis/analysishelper.hxx b/scaddins/source/analysis/analysishelper.hxx
index 4d7bc82..d578aa9 100644
--- a/scaddins/source/analysis/analysishelper.hxx
+++ b/scaddins/source/analysis/analysishelper.hxx
@@ -166,6 +166,7 @@ struct FuncDataBase
     sal_uInt16              nCompListID;        // resource ID to list of valid names
     sal_uInt16              nNumOfParams;       // number of named / described parameters
     FDCategory              eCat;               // function category
+    const char*             pSuffix;            // if bDouble, append a suffix other than "_ADD" for UI
 };
 
 
@@ -182,6 +183,8 @@ private:
     sal_uInt16              nCompID;
     std::vector<OUString>  aCompList;          // list of all valid names
     FDCategory              eCat;               // function category
+    OUString                aSuffix;            // if bDouble and not empty, append a suffix other than "_ADD" for UI
+
 public:
                             FuncData( const FuncDataBase& rBaseData, ResMgr& );
     virtual                 ~FuncData();
@@ -189,6 +192,7 @@ public:
     inline sal_uInt16       GetUINameID() const;
     inline sal_uInt16       GetDescrID() const;
     inline bool             IsDouble() const;
+    inline const OUString&  GetSuffix() const;
 
     sal_uInt16              GetStrIndex( sal_uInt16 nParamNum ) const;
     inline bool             Is( const OUString& rCompareTo ) const;
@@ -563,6 +567,12 @@ inline bool FuncData::IsDouble() const
 }
 
 
+inline const OUString& FuncData::GetSuffix() const
+{
+    return aSuffix;
+}
+
+
 inline bool FuncData::Is( const OUString& r ) const
 {
     return aIntName == r;


More information about the Libreoffice-commits mailing list