summaryrefslogtreecommitdiff
path: root/sc/inc/table.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/inc/table.hxx')
-rw-r--r--sc/inc/table.hxx17
1 files changed, 11 insertions, 6 deletions
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index a4dd113a0cd9..e9b1e3f54c65 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -20,6 +20,7 @@
#ifndef INCLUDED_SC_INC_TABLE_HXX
#define INCLUDED_SC_INC_TABLE_HXX
+#include <algorithm>
#include <vector>
#include <tools/gen.hxx>
#include <tools/color.hxx>
@@ -151,7 +152,7 @@ class ScTable
private:
typedef ::std::vector< ScRange > ScRangeVec;
- ScColContainer aCol;
+ mutable ScColContainer aCol;
OUString aName;
OUString aCodeName;
@@ -273,14 +274,14 @@ public:
ScOutlineTable* GetOutlineTable() { return pOutlineTable.get(); }
- ScColumn& CreateColumnIfNotExists( const SCCOL nScCol )
+ ScColumn& CreateColumnIfNotExists( const SCCOL nScCol ) const
{
if ( nScCol >= aCol.size() )
CreateColumnIfNotExistsImpl(nScCol);
return aCol[nScCol];
}
// out-of-line the cold part of the function
- void CreateColumnIfNotExistsImpl( const SCCOL nScCol );
+ void CreateColumnIfNotExistsImpl( const SCCOL nScCol ) const;
sal_uLong GetCellCount() const;
sal_uLong GetWeightedCount() const;
sal_uLong GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const;
@@ -443,9 +444,11 @@ public:
CellType GetCellType( const ScAddress& rPos ) const
{
- return ValidColRow(rPos.Col(),rPos.Row()) ?
- aCol[rPos.Col()].GetCellType( rPos.Row() ) :
- CELLTYPE_NONE;
+ if (!ValidColRow(rPos.Col(),rPos.Row()))
+ return CELLTYPE_NONE;
+ if (rPos.Col() >= aCol.size())
+ return CELLTYPE_NONE;
+ return aCol[rPos.Col()].GetCellType( rPos.Row() );
}
CellType GetCellType( SCCOL nCol, SCROW nRow ) const;
ScRefCellValue GetCellValue( SCCOL nCol, SCROW nRow ) const;
@@ -1072,6 +1075,8 @@ public:
static void UpdateSearchItemAddressForReplace( const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow );
ScColumnsRange GetColumnsRange(SCCOL begin, SCCOL end) const;
+ SCCOL ClampToAllocatedColumns(SCCOL nCol) const { return std::min(nCol, static_cast<SCCOL>(aCol.size() - 1)); }
+ SCCOL GetAllocatedColumnsCount() const { return aCol.size(); }
private: