summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-08-06 15:40:43 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-08-12 19:46:26 -0400
commit01bc4976a058628a40337f8041c0daedfa63da97 (patch)
treeb736d6ade8b55e1237fbf73db15d772415940055
parent492f0ad5347ed640c3a12b61e22d279b29becb88 (diff)
Const correctness at ScFormulaCell side.
Though I had to use const_cast in some places... Change-Id: I22830bf291179efafc1b400f33a520072b7fab0f
-rw-r--r--sc/inc/formulacell.hxx3
-rw-r--r--sc/source/core/data/column3.cxx2
-rw-r--r--sc/source/core/data/formulacell.cxx28
-rw-r--r--sc/source/filter/excel/xestream.cxx7
-rw-r--r--sc/source/filter/inc/xestream.hxx2
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx2
6 files changed, 33 insertions, 11 deletions
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 3d702009820b..0d258a062a99 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -248,7 +248,8 @@ public:
sal_uInt16 GetRawError(); // don't interpret, just return code or result error
bool GetErrorOrValue( sal_uInt16& rErr, double& rVal );
sal_uInt8 GetMatrixFlag() const;
- ScTokenArray* GetCode() const;
+ ScTokenArray* GetCode();
+ const ScTokenArray* GetCode() const;
bool IsRunning() const;
void SetRunning( bool bVal );
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 25af317f5d7b..c4276d99ffc5 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -978,7 +978,7 @@ void lcl_AddCode( ScTokenArray& rArr, const ScFormulaCell* pCell )
{
rArr.AddOpCode(ocOpen);
- ScTokenArray* pCode = pCell->GetCode();
+ ScTokenArray* pCode = const_cast<ScFormulaCell*>(pCell)->GetCode();
if (pCode)
{
const formula::FormulaToken* pToken = pCode->First();
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 485d45ccb781..c3ab5cd24039 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2987,10 +2987,30 @@ void ScFormulaCell::SetChanged(bool b)
bChanged = b;
}
-sal_uInt8 ScFormulaCell::GetMatrixFlag() const { return cMatrixFlag; }
-ScTokenArray* ScFormulaCell::GetCode() const { return pCode; }
-bool ScFormulaCell::IsRunning() const { return bRunning; }
-void ScFormulaCell::SetRunning( bool bVal ) { bRunning = bVal; }
+sal_uInt8 ScFormulaCell::GetMatrixFlag() const
+{
+ return cMatrixFlag;
+}
+
+ScTokenArray* ScFormulaCell::GetCode()
+{
+ return pCode;
+}
+
+const ScTokenArray* ScFormulaCell::GetCode() const
+{
+ return pCode;
+}
+
+bool ScFormulaCell::IsRunning() const
+{
+ return bRunning;
+}
+
+void ScFormulaCell::SetRunning( bool bVal )
+{
+ bRunning = bVal;
+}
void ScFormulaCell::CompileDBFormula()
{
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index de764b209c44..c90719a9d41b 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -845,10 +845,11 @@ OUString XclXmlUtils::ToOUString( const String& s )
return OUString( s.GetBuffer(), s.Len() );
}
-OUString XclXmlUtils::ToOUString( ScDocument& rDocument, const ScAddress& rAddress,
- ScTokenArray* pTokenArray, const FormulaCompiler::OpCodeMapPtr & xOpCodeMap )
+OUString XclXmlUtils::ToOUString(
+ ScDocument& rDocument, const ScAddress& rAddress, const ScTokenArray* pTokenArray,
+ const FormulaCompiler::OpCodeMapPtr & xOpCodeMap )
{
- ScCompiler aCompiler( &rDocument, rAddress, *pTokenArray);
+ ScCompiler aCompiler( &rDocument, rAddress, const_cast<ScTokenArray&>(*pTokenArray));
if (xOpCodeMap)
{
aCompiler.SetFormulaLanguage( xOpCodeMap );
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index 4b37a68e3707..ba759ae35ef1 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -288,7 +288,7 @@ public:
static OUString ToOUString( const ScfUInt16Vec& rBuffer, sal_Int32 nStart = 0, sal_Int32 nLength = -1 );
static OUString ToOUString( const String& s );
static OUString ToOUString( ScDocument& rDocument, const ScAddress& rAddress,
- ScTokenArray* pTokenArray, const ScCompiler::OpCodeMapPtr & xOpCodeMap );
+ const ScTokenArray* pTokenArray, const ScCompiler::OpCodeMapPtr & xOpCodeMap );
static OUString ToOUString( const XclExpString& s );
static const char* ToPsz( bool b );
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 51a9b8d72030..528cc9e3103b 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -5176,7 +5176,7 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellRangeObj::getArrayTokens() thr
{
if (aStart1 == aStart2)
{
- ScTokenArray* pTokenArray = pFCell1->GetCode();
+ const ScTokenArray* pTokenArray = pFCell1->GetCode();
if (pTokenArray)
(void)ScTokenConversion::ConvertToTokenSequence(*pDoc, aSequence, *pTokenArray);
}