Kaydet (Commit) ccd22d24 authored tarafından Caolán McNamara's avatar Caolán McNamara

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/38644Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 27a8afdf
......@@ -52,20 +52,20 @@ ScaResId::ScaResId( sal_uInt16 nId, ResMgr& rResMgr ) :
#define STDPAR false // all parameters are described
#define FUNCDATA( FuncName, ParamCount, Category, Double, IntPar ) \
{ "get" #FuncName, PRICING_FUNCNAME_##FuncName, PRICING_FUNCDESC_##FuncName, PRICING_DEFFUNCNAME_##FuncName, ParamCount, Category, Double, IntPar }
#define FUNCDATA( FuncName, CompName, ParamCount, Category, Double, IntPar ) \
{ "get" #FuncName, PRICING_FUNCNAME_##FuncName, PRICING_FUNCDESC_##FuncName, CompName, ParamCount, Category, Double, IntPar }
const ScaFuncDataBase pFuncDataArr[] =
{
FUNCDATA( OptBarrier, 13, ScaCategory::Finance, UNIQUE, STDPAR),
FUNCDATA( OptTouch, 11, ScaCategory::Finance, UNIQUE, STDPAR),
FUNCDATA( OptProbHit, 6, ScaCategory::Finance, UNIQUE, STDPAR),
FUNCDATA( OptProbInMoney, 8, ScaCategory::Finance, UNIQUE, STDPAR)
FUNCDATA(OptBarrier, "OPT_BARRIER", 13, ScaCategory::Finance, UNIQUE, STDPAR),
FUNCDATA(OptTouch, "OPT_TOUCH", 11, ScaCategory::Finance, UNIQUE, STDPAR),
FUNCDATA(OptProbHit, "OPT_PROB_HIT", 6, ScaCategory::Finance, UNIQUE, STDPAR),
FUNCDATA(OptProbInMoney, "OPT_PROB_INMONEY", 8, ScaCategory::Finance, UNIQUE, STDPAR)
};
#undef FUNCDATA
ScaFuncData::ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rResMgr ) :
ScaFuncData::ScaFuncData( const ScaFuncDataBase& rBaseData ) :
aIntName( OUString::createFromAscii( rBaseData.pIntName ) ),
nUINameID( rBaseData.nUINameID ),
nDescrID( rBaseData.nDescrID ),
......@@ -74,9 +74,7 @@ ScaFuncData::ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rResMgr ) :
bDouble( rBaseData.bDouble ),
bWithOpt( rBaseData.bWithOpt )
{
ResStringArray aArr(ScaResId(rBaseData.nCompListID, rResMgr));
for (sal_uInt32 nIndex = 0; nIndex < aArr.Count(); ++nIndex)
aCompList.push_back(aArr.GetString(nIndex));
aCompList.push_back(OUString::createFromAscii(rBaseData.pCompName));
}
ScaFuncData::~ScaFuncData()
......@@ -90,10 +88,10 @@ sal_uInt16 ScaFuncData::GetStrIndex( sal_uInt16 nParam ) const
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)
rList.push_back( ScaFuncData( nIndex, rResMgr ) ) ;
for (const auto & nIndex : pFuncDataArr)
rList.push_back(ScaFuncData(nIndex));
}
// entry points for service registration / instantiation
......@@ -189,7 +187,7 @@ void ScaPricingAddIn::InitData()
if(pResMgr)
{
pFuncDataList = new ScaFuncDataList;
InitScaFuncDataList( *pFuncDataList, *pResMgr );
InitScaFuncDataList(*pFuncDataList);
}
else
{
......
......@@ -36,13 +36,6 @@
#define PRICING_FUNCNAME_OptProbHit (PRICING_FUNCNAME_START+2)
#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
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -67,7 +67,12 @@ struct ScaFuncDataBase
const sal_Char* pIntName; // internal name (get***)
sal_uInt16 nUINameID; // resource ID to UI name
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
ScaCategory eCat; // function category
bool bDouble; // name already exist in Calc
......@@ -87,8 +92,8 @@ private:
bool bWithOpt; // first parameter is internal
public:
ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rRscMgr );
~ScaFuncData();
ScaFuncData(const ScaFuncDataBase& rBaseData);
~ScaFuncData();
sal_uInt16 GetUINameID() const { return nUINameID; }
sal_uInt16 GetDescrID() const { return nDescrID; }
......@@ -105,7 +110,7 @@ public:
typedef std::vector<ScaFuncData> ScaFuncDataList;
void InitScaFuncDataList ( ScaFuncDataList& rMap, ResMgr& rResMgr );
void InitScaFuncDataList(ScaFuncDataList& rMap);
// Predicate for use with std::find_if
struct FindScaFuncData
......
......@@ -150,41 +150,4 @@ String PRICING_FUNCNAME_OptProbInMoney
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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment