summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-06-25 16:24:29 +0200
committerMichael Stahl <mstahl@redhat.com>2012-07-04 23:23:20 +0200
commit7a2206ce0d78a26acff3d60b471cfcc93e827559 (patch)
tree472b3c1a45142cd1d5c5c5379c1dee9db75bd695 /sw
parent485e097ba8cc55a49188ec239042a92b8c160104 (diff)
Convert Svptrarr to std::vector<const SwUserFieldType*>
Also convert method return type from sal_Bool to bool Change-Id: I259e99709297d4c3b9b74643920e2afefa469a93
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/calc.hxx8
-rw-r--r--sw/source/core/bastyp/calc.cxx16
-rw-r--r--sw/source/core/fields/usrfld.cxx2
3 files changed, 13 insertions, 13 deletions
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index 69ab36a84e38..191480c49411 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -28,7 +28,6 @@
#ifndef _CALC_HXX
#define _CALC_HXX
-#include <svl/svarray.hxx>
#include <unotools/syslocale.hxx>
#ifndef __SBX_SBXVALUE //autogen
@@ -40,6 +39,7 @@ class CharClass;
class LocaleDataWrapper;
class SwFieldType;
class SwDoc;
+class SwUserFieldType;
#define TBLSZ 47 // should be a prime, because of hash table
@@ -176,7 +176,7 @@ class SwCalc
SwHash* VarTable[ TBLSZ ];
String aVarName, sCurrSym;
String sCommand;
- SvPtrarr aRekurStk;
+ std::vector<const SwUserFieldType*> aRekurStk;
SwSbxValue nLastLeft;
SwSbxValue nNumberValue;
SwCalcExp aErrExpr;
@@ -221,8 +221,8 @@ public:
void VarChange( const String& rStr, double );
SwHash** GetVarTable() { return VarTable; }
- sal_Bool Push( const VoidPtr pPtr );
- void Pop( const VoidPtr pPtr );
+ bool Push(const SwUserFieldType* pUserFieldType);
+ void Pop();
void SetCalcError( SwCalcError eErr ) { eError = eErr; }
sal_Bool IsCalcError() const { return 0 != eError; }
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 6250178a07a3..a4676ec59435 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -634,20 +634,20 @@ void SwCalc::VarChange( const String& rStr, const SwSbxValue& rValue )
}
}
-sal_Bool SwCalc::Push( const VoidPtr pPtr )
+bool SwCalc::Push( const SwUserFieldType* pUserFieldType )
{
- if( USHRT_MAX != aRekurStk.GetPos( pPtr ) )
- return sal_False;
+ if( aRekurStk.end() != std::find(aRekurStk.begin(), aRekurStk.end(), pUserFieldType ) )
+ return false;
- aRekurStk.Insert( pPtr, aRekurStk.Count() );
- return sal_True;
+ aRekurStk.push_back( pUserFieldType );
+ return true;
}
-void SwCalc::Pop( const VoidPtr )
+void SwCalc::Pop()
{
- OSL_ENSURE( aRekurStk.Count(), "SwCalc: Pop on an invalid pointer" );
+ OSL_ENSURE( aRekurStk.size(), "SwCalc: Pop on an invalid pointer" );
- aRekurStk.Remove( aRekurStk.Count() - 1 );
+ aRekurStk.pop_back();
}
SwCalcOper SwCalc::GetToken()
diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx
index 5495a7a37509..7457fc799463 100644
--- a/sw/source/core/fields/usrfld.cxx
+++ b/sw/source/core/fields/usrfld.cxx
@@ -247,7 +247,7 @@ double SwUserFieldType::GetValue( SwCalc& rCalc )
return 0;
}
nValue = rCalc.Calculate( aContent ).GetDouble();
- rCalc.Pop( this );
+ rCalc.Pop();
if( !rCalc.IsCalcError() )
bValidValue = sal_True;