move unlocalized pricing strings into source
and each string array is always 1 string in length, so simplify a little based on that Change-Id: I822dbe884608a935ff2cf86c059c558ee9ad4d4b Reviewed-on: https://gerrit.libreoffice.org/38644 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
parent
27a8afdf93
commit
ccd22d24e6
@ -52,20 +52,20 @@ ScaResId::ScaResId( sal_uInt16 nId, ResMgr& rResMgr ) :
|
|||||||
|
|
||||||
#define STDPAR false // all parameters are described
|
#define STDPAR false // all parameters are described
|
||||||
|
|
||||||
#define FUNCDATA( FuncName, ParamCount, Category, Double, IntPar ) \
|
#define FUNCDATA( FuncName, CompName, ParamCount, Category, Double, IntPar ) \
|
||||||
{ "get" #FuncName, PRICING_FUNCNAME_##FuncName, PRICING_FUNCDESC_##FuncName, PRICING_DEFFUNCNAME_##FuncName, ParamCount, Category, Double, IntPar }
|
{ "get" #FuncName, PRICING_FUNCNAME_##FuncName, PRICING_FUNCDESC_##FuncName, CompName, ParamCount, Category, Double, IntPar }
|
||||||
|
|
||||||
const ScaFuncDataBase pFuncDataArr[] =
|
const ScaFuncDataBase pFuncDataArr[] =
|
||||||
{
|
{
|
||||||
FUNCDATA( OptBarrier, 13, ScaCategory::Finance, UNIQUE, STDPAR),
|
FUNCDATA(OptBarrier, "OPT_BARRIER", 13, ScaCategory::Finance, UNIQUE, STDPAR),
|
||||||
FUNCDATA( OptTouch, 11, ScaCategory::Finance, UNIQUE, STDPAR),
|
FUNCDATA(OptTouch, "OPT_TOUCH", 11, ScaCategory::Finance, UNIQUE, STDPAR),
|
||||||
FUNCDATA( OptProbHit, 6, ScaCategory::Finance, UNIQUE, STDPAR),
|
FUNCDATA(OptProbHit, "OPT_PROB_HIT", 6, ScaCategory::Finance, UNIQUE, STDPAR),
|
||||||
FUNCDATA( OptProbInMoney, 8, ScaCategory::Finance, UNIQUE, STDPAR)
|
FUNCDATA(OptProbInMoney, "OPT_PROB_INMONEY", 8, ScaCategory::Finance, UNIQUE, STDPAR)
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef FUNCDATA
|
#undef FUNCDATA
|
||||||
|
|
||||||
ScaFuncData::ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rResMgr ) :
|
ScaFuncData::ScaFuncData( const ScaFuncDataBase& rBaseData ) :
|
||||||
aIntName( OUString::createFromAscii( rBaseData.pIntName ) ),
|
aIntName( OUString::createFromAscii( rBaseData.pIntName ) ),
|
||||||
nUINameID( rBaseData.nUINameID ),
|
nUINameID( rBaseData.nUINameID ),
|
||||||
nDescrID( rBaseData.nDescrID ),
|
nDescrID( rBaseData.nDescrID ),
|
||||||
@ -74,9 +74,7 @@ ScaFuncData::ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rResMgr ) :
|
|||||||
bDouble( rBaseData.bDouble ),
|
bDouble( rBaseData.bDouble ),
|
||||||
bWithOpt( rBaseData.bWithOpt )
|
bWithOpt( rBaseData.bWithOpt )
|
||||||
{
|
{
|
||||||
ResStringArray aArr(ScaResId(rBaseData.nCompListID, rResMgr));
|
aCompList.push_back(OUString::createFromAscii(rBaseData.pCompName));
|
||||||
for (sal_uInt32 nIndex = 0; nIndex < aArr.Count(); ++nIndex)
|
|
||||||
aCompList.push_back(aArr.GetString(nIndex));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScaFuncData::~ScaFuncData()
|
ScaFuncData::~ScaFuncData()
|
||||||
@ -90,10 +88,10 @@ sal_uInt16 ScaFuncData::GetStrIndex( sal_uInt16 nParam ) const
|
|||||||
return (nParam > nParamCount) ? (nParamCount * 2) : (nParam * 2);
|
return (nParam > nParamCount) ? (nParamCount * 2) : (nParam * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sca::pricing::InitScaFuncDataList( ScaFuncDataList& rList, ResMgr& rResMgr )
|
void sca::pricing::InitScaFuncDataList(ScaFuncDataList& rList)
|
||||||
{
|
{
|
||||||
for (const auto & nIndex : pFuncDataArr)
|
for (const auto & nIndex : pFuncDataArr)
|
||||||
rList.push_back( ScaFuncData( nIndex, rResMgr ) ) ;
|
rList.push_back(ScaFuncData(nIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
// entry points for service registration / instantiation
|
// entry points for service registration / instantiation
|
||||||
@ -189,7 +187,7 @@ void ScaPricingAddIn::InitData()
|
|||||||
if(pResMgr)
|
if(pResMgr)
|
||||||
{
|
{
|
||||||
pFuncDataList = new ScaFuncDataList;
|
pFuncDataList = new ScaFuncDataList;
|
||||||
InitScaFuncDataList( *pFuncDataList, *pResMgr );
|
InitScaFuncDataList(*pFuncDataList);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -36,13 +36,6 @@
|
|||||||
#define PRICING_FUNCNAME_OptProbHit (PRICING_FUNCNAME_START+2)
|
#define PRICING_FUNCNAME_OptProbHit (PRICING_FUNCNAME_START+2)
|
||||||
#define PRICING_FUNCNAME_OptProbInMoney (PRICING_FUNCNAME_START+3)
|
#define PRICING_FUNCNAME_OptProbInMoney (PRICING_FUNCNAME_START+3)
|
||||||
|
|
||||||
#define PRICING_DEFFUNCNAME_START (PRICING_RESOURCE_START+2000)
|
|
||||||
|
|
||||||
#define PRICING_DEFFUNCNAME_OptBarrier (PRICING_DEFFUNCNAME_START)
|
|
||||||
#define PRICING_DEFFUNCNAME_OptTouch (PRICING_DEFFUNCNAME_START+1)
|
|
||||||
#define PRICING_DEFFUNCNAME_OptProbHit (PRICING_DEFFUNCNAME_START+2)
|
|
||||||
#define PRICING_DEFFUNCNAME_OptProbInMoney (PRICING_DEFFUNCNAME_START+3)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@ -67,7 +67,12 @@ struct ScaFuncDataBase
|
|||||||
const sal_Char* pIntName; // internal name (get***)
|
const sal_Char* pIntName; // internal name (get***)
|
||||||
sal_uInt16 nUINameID; // resource ID to UI name
|
sal_uInt16 nUINameID; // resource ID to UI name
|
||||||
sal_uInt16 nDescrID; // resource ID to description, parameter names and ~ description
|
sal_uInt16 nDescrID; // resource ID to description, parameter names and ~ description
|
||||||
sal_uInt16 nCompListID; // resource ID to list of valid names
|
// pCompName was originally meant to be able to load Excel documents that for
|
||||||
|
// some time were stored with localized function names.
|
||||||
|
// This is not relevant to this add-in, so we only supply the same
|
||||||
|
// (English) function names again.
|
||||||
|
// see also: GetExcelName() or GetCompNames() or getCompatibilityNames()
|
||||||
|
const char* pCompName;
|
||||||
sal_uInt16 nParamCount; // number of named / described parameters
|
sal_uInt16 nParamCount; // number of named / described parameters
|
||||||
ScaCategory eCat; // function category
|
ScaCategory eCat; // function category
|
||||||
bool bDouble; // name already exist in Calc
|
bool bDouble; // name already exist in Calc
|
||||||
@ -87,7 +92,7 @@ private:
|
|||||||
bool bWithOpt; // first parameter is internal
|
bool bWithOpt; // first parameter is internal
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rRscMgr );
|
ScaFuncData(const ScaFuncDataBase& rBaseData);
|
||||||
~ScaFuncData();
|
~ScaFuncData();
|
||||||
|
|
||||||
sal_uInt16 GetUINameID() const { return nUINameID; }
|
sal_uInt16 GetUINameID() const { return nUINameID; }
|
||||||
@ -105,7 +110,7 @@ public:
|
|||||||
|
|
||||||
typedef std::vector<ScaFuncData> ScaFuncDataList;
|
typedef std::vector<ScaFuncData> ScaFuncDataList;
|
||||||
|
|
||||||
void InitScaFuncDataList ( ScaFuncDataList& rMap, ResMgr& rResMgr );
|
void InitScaFuncDataList(ScaFuncDataList& rMap);
|
||||||
|
|
||||||
// Predicate for use with std::find_if
|
// Predicate for use with std::find_if
|
||||||
struct FindScaFuncData
|
struct FindScaFuncData
|
||||||
|
@ -150,41 +150,4 @@ String PRICING_FUNCNAME_OptProbInMoney
|
|||||||
Text [ en-US ] = "OPT_PROB_INMONEY";
|
Text [ en-US ] = "OPT_PROB_INMONEY";
|
||||||
};
|
};
|
||||||
|
|
||||||
// These were originally meant to be able to load Excel documents that for
|
|
||||||
// some time were stored with localized function names.
|
|
||||||
// This is not relevant to this add-in, so we only supply the same
|
|
||||||
// (English) function names again.
|
|
||||||
// see also: GetExcelName() or GetCompNames() or getCompatibilityNames()
|
|
||||||
StringArray PRICING_DEFFUNCNAME_OptBarrier
|
|
||||||
{
|
|
||||||
ItemList =
|
|
||||||
{
|
|
||||||
< "OPT_BARRIER"; >;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
StringArray PRICING_DEFFUNCNAME_OptTouch
|
|
||||||
{
|
|
||||||
ItemList =
|
|
||||||
{
|
|
||||||
< "OPT_TOUCH"; >;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
StringArray PRICING_DEFFUNCNAME_OptProbHit
|
|
||||||
{
|
|
||||||
ItemList =
|
|
||||||
{
|
|
||||||
< "OPT_PROB_HIT"; >;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
StringArray PRICING_DEFFUNCNAME_OptProbInMoney
|
|
||||||
{
|
|
||||||
ItemList =
|
|
||||||
{
|
|
||||||
< "OPT_PROB_INMONEY"; >;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user