diff options
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/address.hxx | 1 | ||||
-rw-r--r-- | sc/inc/colcontainer.hxx | 6 | ||||
-rw-r--r-- | sc/inc/dociter.hxx | 8 | ||||
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/inc/table.hxx | 17 |
5 files changed, 22 insertions, 12 deletions
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index 766135d614f9..e04e0d50f5d9 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -67,6 +67,7 @@ const SCSIZE SCSIZE_MAX = ::std::numeric_limits<SCSIZE>::max(); // Count values const SCROW MAXROWCOUNT = MAXROWCOUNT_DEFINE; const SCCOL MAXCOLCOUNT = MAXCOLCOUNT_DEFINE; +const SCCOL INITIALCOLCOUNT = 64; /// limiting to 10000 for now, problem with 32 bit builds for now const SCTAB MAXTABCOUNT = 10000; const SCCOLROW MAXCOLROWCOUNT = MAXROWCOUNT; diff --git a/sc/inc/colcontainer.hxx b/sc/inc/colcontainer.hxx index e6dbf0e22731..c7b72e082a96 100644 --- a/sc/inc/colcontainer.hxx +++ b/sc/inc/colcontainer.hxx @@ -28,10 +28,9 @@ class ScColContainer { +public: typedef std::vector<std::unique_ptr<ScColumn>> ScColumnVector; - ScColumnVector aCols; -public: ScColContainer( const size_t nSize ); ~ScColContainer() COVERITY_NOEXCEPT_FALSE; @@ -73,6 +72,9 @@ public: ScColumnVector::const_iterator begin() const { return aCols.begin(); } ScColumnVector::const_iterator end() const { return aCols.end(); } + +private: + ScColumnVector aCols; }; diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index 5bb957059b03..8604abcdd453 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -370,7 +370,7 @@ class ScDocAttrIterator // all attribute areas private: ScDocument* pDoc; SCTAB nTab; - SCCOL const nEndCol; + SCCOL nEndCol; SCROW const nStartRow; SCROW const nEndRow; SCCOL nCol; @@ -391,7 +391,7 @@ class ScAttrRectIterator // all attribute areas, including areas stre private: ScDocument* pDoc; SCTAB nTab; - SCCOL const nEndCol; + SCCOL nEndCol; SCROW const nStartRow; SCROW const nEndRow; SCCOL nIterStartCol; @@ -423,7 +423,7 @@ class ScHorizontalCellIterator // walk through all non empty cells in an ar ScDocument* pDoc; SCTAB mnTab; SCCOL const nStartCol; - SCCOL const nEndCol; + SCCOL nEndCol; SCROW const nStartRow; SCROW const nEndRow; SCCOL mnCol; @@ -482,7 +482,7 @@ private: SCTAB nTab; SCCOL const nStartCol; SCROW const nStartRow; - SCCOL const nEndCol; + SCCOL nEndCol; SCROW const nEndRow; std::unique_ptr<SCROW[]> pNextEnd; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index c587229c6ce6..7d050666f19f 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -786,6 +786,8 @@ public: ScRangePairListRef& GetColNameRangesRef() { return xColNameRanges; } ScRangePairListRef& GetRowNameRangesRef() { return xRowNameRanges; } + SC_DLLPUBLIC SCCOL ClampToAllocatedColumns(SCTAB nTab, SCCOL nCol) const; + SC_DLLPUBLIC ScDBCollection* GetDBCollection() const { return pDBCollection.get();} void SetDBCollection( std::unique_ptr<ScDBCollection> pNewDBCollection, bool bRemoveAutoFilter = false ); 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: |