diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2017-02-28 02:48:32 +0100 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2017-03-07 21:59:21 +0000 |
commit | e1e2defb2cd9b572747b964e5ec97d289029af8c (patch) | |
tree | 829ba713e18c1cb29c46215c299004ac972b2bae | |
parent | bb7073abf58d2b4334bb5508e4d392b96bcca9de (diff) |
tdf#50916 Simplify and refactor source code
Change-Id: Ibcb3068318180f2adfdc41aac5d75299c1ffaffc
Reviewed-on: https://gerrit.libreoffice.org/34711
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
-rw-r--r-- | sc/inc/attarray.hxx | 2 | ||||
-rw-r--r-- | sc/inc/table.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/attarray.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/data/column.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/table1.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 6 |
6 files changed, 16 insertions, 15 deletions
diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx index 49626ea9e124..a78d77497541 100644 --- a/sc/inc/attarray.hxx +++ b/sc/inc/attarray.hxx @@ -106,7 +106,7 @@ friend class ScHorizontalAttrIterator; ScAttrArray& operator=(const ScAttrArray&) = delete; public: - ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttrArray* pNextColAttrArray = nullptr, bool bCreateEmpty = false ); + ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttrArray* pNextColAttrArray = nullptr ); ~ScAttrArray(); void SetTab(SCTAB nNewTab) { nTab = nNewTab; } diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 0358a760c702..12517c6014e3 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -207,7 +207,8 @@ private: bool mbPageBreaksValid:1; bool mbForceBreaks:1; - ScAttrArray aNextColAttrArray; + // Default attributes for the unallocated columns. + ScAttrArray aDefaultColAttrArray; friend class ScDocument; // for FillInfo friend class ScColumn; diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index eb530ed75442..cfbb1c0e133d 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -49,7 +49,7 @@ using ::editeng::SvxBorderLine; -ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttrArray* pNextColAttrArray, bool bCreateEmpty ) : +ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttrArray* pDefaultColAttrArray ) : nCol( nNewCol ), nTab( nNewTab ), pDocument( pDoc ), @@ -57,10 +57,10 @@ ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttr nLimit(0), pData(nullptr) { - if ( nCol != -1 && !bCreateEmpty && pNextColAttrArray ) + if ( nCol != -1 && pDefaultColAttrArray ) { - nCount = pNextColAttrArray->nCount; - nLimit = pNextColAttrArray->nCount; + nCount = pDefaultColAttrArray->nCount; + nLimit = pDefaultColAttrArray->nCount; if ( nCount ) { bool bNumFormatChanged; @@ -69,8 +69,8 @@ ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttr pData = new ScAttrEntry[nCount]; for ( size_t nIdx = 0; nIdx < nCount; ++nIdx ) { - pData[nIdx].nRow = pNextColAttrArray->pData[nIdx].nRow; - ScPatternAttr aNewPattern( *(pNextColAttrArray->pData[nIdx].pPattern) ); + pData[nIdx].nRow = pDefaultColAttrArray->pData[nIdx].nRow; + ScPatternAttr aNewPattern( *(pDefaultColAttrArray->pData[nIdx].pPattern) ); pData[nIdx].pPattern = static_cast<const ScPatternAttr*>( &pDocument->GetPool()->Put( aNewPattern ) ); bNumFormatChanged = false; if ( ScGlobal::CheckWidthInvalidate( bNumFormatChanged, diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index af35e8ccfe8a..bb8d3783c122 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -108,10 +108,10 @@ void ScColumn::Init(SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, bool bEmptyA nCol = nNewCol; nTab = nNewTab; pDocument = pDoc; - if ( !bEmptyAttrArray ) - pAttrArray = new ScAttrArray( nCol, nTab, pDocument, &pDocument->maTabs[nTab]->aNextColAttrArray, bEmptyAttrArray ); + if ( bEmptyAttrArray ) + pAttrArray = new ScAttrArray( nCol, nTab, pDocument, nullptr ); else - pAttrArray = new ScAttrArray( nCol, nTab, pDocument, nullptr, true ); + pAttrArray = new ScAttrArray( nCol, nTab, pDocument, &pDocument->maTabs[nTab]->aDefaultColAttrArray ); } SCsROW ScColumn::GetNextUnprotected( SCROW nRow, bool bUp ) const diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index b2ff54d3e3d3..8eb464865c8a 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -288,7 +288,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName, bActiveScenario(false), mbPageBreaksValid(false), mbForceBreaks(false), - aNextColAttrArray(static_cast<SCCOL>(-1), nNewTab, pDoc, nullptr, true) + aDefaultColAttrArray(static_cast<SCCOL>(-1), nNewTab, pDoc, nullptr) { if (bColInfo) diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index ae86b15c09b1..7d7ed84dad15 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2527,12 +2527,12 @@ void ScTable::ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, S nEndCol = aCol.size() - 1; for (SCCOL i = nStartCol; i <= nEndCol; i++) aCol[i].ApplyStyleArea(nStartRow, nEndRow, rStyle); - aNextColAttrArray.ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>( &rStyle ) ); + aDefaultColAttrArray.ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>( &rStyle ) ); } else { CreateColumnIfNotExists( nStartCol - 1 ); - aNextColAttrArray.ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>( &rStyle ) ); + aDefaultColAttrArray.ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>( &rStyle ) ); } } else @@ -2567,7 +2567,7 @@ const ScStyleSheet* ScTable::GetStyle( SCCOL nCol, SCROW nRow ) const if ( nCol < aCol.size() ) return aCol[nCol].GetStyle( nRow ); else - return aNextColAttrArray.GetPattern( nRow )->GetStyleSheet(); + return aDefaultColAttrArray.GetPattern( nRow )->GetStyleSheet(); } const ScStyleSheet* ScTable::GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const |