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
This commit is contained in:
Eike Rathke
2015-10-07 15:37:54 +02:00
parent d638ad81f8
commit 74010f1c50
4 changed files with 35 additions and 13 deletions

View File

@@ -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
{

View File

@@ -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

View File

@@ -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();

View File

@@ -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;