diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-01 15:15:16 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-05 13:43:52 +0200 |
commit | 7282014e362a1529a36c88eb308df8ed359c2cfa (patch) | |
tree | 2776ad9601f494330076ac58c08554e719c6ab3a /sc/inc/table.hxx | |
parent | df30a4515b1303b0891baa53754fa9b3e47e0c02 (diff) |
tdf#50916 Makes numbers of columns dynamic.
With this commit we are making numbers of columns
dynamic, but the number of maximum supported
columns will be the same (1024).
Such approach will allow us to check issues
(eg. performance, LO format etc.), and improve it.
Increasing number of maximum columns, will be done
in separate commit.
Change-Id: Ibac4101e9ffc05e3548eca1c198f6319ac7ff9aa
Reviewed-on: https://gerrit.libreoffice.org/44802
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'sc/inc/table.hxx')
-rw-r--r-- | sc/inc/table.hxx | 17 |
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: |