summaryrefslogtreecommitdiff
path: root/scaddins
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-06-10 21:48:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-06-11 14:40:07 +0200
commitccd22d24e6271272e1f5acfd207671bd1cc78fb9 (patch)
tree05b0b38f53c35a61f7afe99355c4bcd59763067c /scaddins
parent27a8afdf93a86ec18f794362ac8329d0b5eb8a1f (diff)
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>
Diffstat (limited to 'scaddins')
-rw-r--r--scaddins/source/pricing/pricing.cxx26
-rw-r--r--scaddins/source/pricing/pricing.hrc7
-rw-r--r--scaddins/source/pricing/pricing.hxx13
-rw-r--r--scaddins/source/pricing/pricing.src37
4 files changed, 21 insertions, 62 deletions
diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx
index 7824f0c4a67e..466c0e78fd44 100644
--- a/scaddins/source/pricing/pricing.cxx
+++ b/scaddins/source/pricing/pricing.cxx
@@ -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
{
diff --git a/scaddins/source/pricing/pricing.hrc b/scaddins/source/pricing/pricing.hrc
index 89a015fba093..af516650eb75 100644
--- a/scaddins/source/pricing/pricing.hrc
+++ b/scaddins/source/pricing/pricing.hrc
@@ -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: */
diff --git a/scaddins/source/pricing/pricing.hxx b/scaddins/source/pricing/pricing.hxx
index efe8c0b1b5a9..111f739e60e7 100644
--- a/scaddins/source/pricing/pricing.hxx
+++ b/scaddins/source/pricing/pricing.hxx
@@ -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
diff --git a/scaddins/source/pricing/pricing.src b/scaddins/source/pricing/pricing.src
index 414ada843122..d1ed46a08898 100644
--- a/scaddins/source/pricing/pricing.src
+++ b/scaddins/source/pricing/pricing.src
@@ -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: */