summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-04-29 17:15:32 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-04-30 13:10:42 -0400
commitc678409ef3c9e97b61b582bfc747931933059ebe (patch)
tree3aeba4d2a094a668be2bdb37638564591c78b179 /sc
parentee289aaf451ddec8f3b997aae5cf9f95750ee277 (diff)
Pass formula group context to FetchDoubleArray. Not yet used.
In the future I'll use it to store temporary double array buffer here, in case the requested row span is over multiple arrays. Change-Id: Id4260ec4ced4c8c1ee718106f37a7374c62b204c
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/column.hxx6
-rw-r--r--sc/inc/document.hxx6
-rw-r--r--sc/inc/formulagroup.hxx30
-rw-r--r--sc/inc/table.hxx7
-rw-r--r--sc/source/core/data/column2.cxx5
-rw-r--r--sc/source/core/data/document.cxx5
-rw-r--r--sc/source/core/data/formulacell.cxx5
-rw-r--r--sc/source/core/data/table1.cxx5
8 files changed, 60 insertions, 9 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 9b6e614de024..e70f108e70f2 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -45,6 +45,10 @@
namespace editeng { class SvxBorderLine; }
+namespace sc {
+ struct FormulaGroupContext;
+}
+
class Fraction;
class OutputDevice;
class SfxItemPoolCache;
@@ -460,7 +464,7 @@ public:
ScFormulaVectorState GetFormulaVectorState( SCROW nRow ) const;
formula::FormulaTokenRef ResolveStaticReference( SCROW nRow );
bool ResolveStaticReference( ScMatrix& rMat, SCCOL nMatCol, SCROW nRow1, SCROW nRow2 );
- const double* FetchDoubleArray( SCROW nRow1, SCROW nRow2 ) const;
+ const double* FetchDoubleArray( sc::FormulaGroupContext& rCxt, SCROW nRow1, SCROW nRow2 ) const;
ScRefCellValue GetRefCellValue( SCROW );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 876c9d764eb0..0920dd5e71ba 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -47,6 +47,9 @@
#include <boost/scoped_ptr.hpp>
namespace editeng { class SvxBorderLine; }
+namespace sc {
+ struct FormulaGroupContext;
+}
class SvxFontItem;
class KeyEvent;
@@ -1944,7 +1947,8 @@ public:
formula::FormulaTokenRef ResolveStaticReference( const ScAddress& rPos );
formula::FormulaTokenRef ResolveStaticReference( const ScRange& rRange );
- const double* FetchDoubleArray( const ScAddress& rPos, SCROW nLength ) const;
+ const double* FetchDoubleArray(
+ sc::FormulaGroupContext& rCxt, const ScAddress& rPos, SCROW nLength ) const;
private: // CLOOK-Impl-methods
diff --git a/sc/inc/formulagroup.hxx b/sc/inc/formulagroup.hxx
new file mode 100644
index 000000000000..0a8e3f7aa7c1
--- /dev/null
+++ b/sc/inc/formulagroup.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef SC_FORMULAGROUP_HXX
+#define SC_FORMULAGROUP_HXX
+
+#include <boost/noncopyable.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+
+namespace sc {
+
+struct FormulaGroupContext : boost::noncopyable
+{
+ typedef std::vector<double> DoubleArrayType;
+ typedef boost::ptr_vector<DoubleArrayType> ArrayStoreType;
+
+ ArrayStoreType maArrays;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 7c45a578274c..c090f8bb313f 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -47,6 +47,10 @@ namespace com { namespace sun { namespace star {
}
} } }
+namespace sc {
+ struct FormulaGroupContext;
+}
+
class SfxItemSet;
class SfxStyleSheetBase;
class SvxBoxInfoItem;
@@ -822,7 +826,8 @@ public:
ScFormulaVectorState GetFormulaVectorState( SCCOL nCol, SCROW nRow ) const;
formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol, SCROW nRow );
formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
- const double* FetchDoubleArray( SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const;
+ const double* FetchDoubleArray(
+ sc::FormulaGroupContext& rCxt, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const;
ScRefCellValue GetRefCellValue( SCCOL nCol, SCROW nRow );
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 434edad81474..2e20d0f1d53a 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -57,6 +57,7 @@
#include "cellvalue.hxx"
#include "tokenarray.hxx"
#include "globalnames.hxx"
+#include "formulagroup.hxx"
#include <math.h>
@@ -1661,8 +1662,10 @@ bool ScColumn::ResolveStaticReference( ScMatrix& rMat, SCCOL nMatCol, SCROW nRow
return true;
}
-const double* ScColumn::FetchDoubleArray( SCROW nRow1, SCROW nRow2 ) const
+const double* ScColumn::FetchDoubleArray( sc::FormulaGroupContext& /*rCxt*/, SCROW nRow1, SCROW nRow2 ) const
{
+ // TODO: I'll use the context object later.
+
if (nRow1 > nRow2)
return NULL;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index c4f93c6e0e97..3a07d3fc05c9 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1593,13 +1593,14 @@ formula::FormulaTokenRef ScDocument::ResolveStaticReference( const ScRange& rRan
rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row());
}
-const double* ScDocument::FetchDoubleArray( const ScAddress& rPos, SCROW nLength ) const
+const double* ScDocument::FetchDoubleArray(
+ sc::FormulaGroupContext& rCxt, const ScAddress& rPos, SCROW nLength ) const
{
SCTAB nTab = rPos.Tab();
if (!TableExists(nTab))
return NULL;
- return maTabs[nTab]->FetchDoubleArray(rPos.Col(), rPos.Row(), rPos.Row()+nLength-1);
+ return maTabs[nTab]->FetchDoubleArray(rCxt, rPos.Col(), rPos.Row(), rPos.Row()+nLength-1);
}
bool ScDocument::CanFitBlock( const ScRange& rOld, const ScRange& rNew )
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 278a299b385e..236474d4e866 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -43,6 +43,7 @@
#include "formula/vectortoken.hxx"
#include "svl/intitem.hxx"
#include "rtl/strbuf.hxx"
+#include "formulagroup.hxx"
#include <boost/bind.hpp>
@@ -2968,6 +2969,8 @@ bool ScFormulaCell::InterpretFormulaGroup()
if (xGroup->mbInvariant)
return InterpretInvariantFormulaGroup();
+ sc::FormulaGroupContext aCxt;
+
ScTokenArray aCode;
pCode->Reset();
for (const formula::FormulaToken* p = pCode->First(); p; p = pCode->Next())
@@ -2990,7 +2993,7 @@ bool ScFormulaCell::InterpretFormulaGroup()
// Fetch double array guarantees that the length of the
// returned array equals or greater than the requested
// length.
- const double* pArray = pDocument->FetchDoubleArray(aRefPos, xGroup->mnLength);
+ const double* pArray = pDocument->FetchDoubleArray(aCxt, aRefPos, xGroup->mnLength);
if (!pArray)
return false;
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index a6c60425328f..34be0d1f7b5e 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -2140,7 +2140,8 @@ formula::FormulaTokenRef ScTable::ResolveStaticReference( SCCOL nCol1, SCROW nRo
return formula::FormulaTokenRef(new ScMatrixToken(pMat));
}
-const double* ScTable::FetchDoubleArray( SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const
+const double* ScTable::FetchDoubleArray(
+ sc::FormulaGroupContext& rCxt, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const
{
if (nRow2 < nRow1)
return NULL;
@@ -2148,7 +2149,7 @@ const double* ScTable::FetchDoubleArray( SCCOL nCol, SCROW nRow1, SCROW nRow2 )
if (!ValidCol(nCol) || !ValidRow(nRow1) || !ValidRow(nRow2))
return NULL;
- return aCol[nCol].FetchDoubleArray(nRow1, nRow1);
+ return aCol[nCol].FetchDoubleArray(rCxt, nRow1, nRow1);
}
ScRefCellValue ScTable::GetRefCellValue( SCCOL nCol, SCROW nRow )