diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-20 13:03:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-21 07:58:14 +0200 |
commit | c757117afb398277a46e79ba22066c5bbf2c9f72 (patch) | |
tree | 0c27216e2364d8e8f0c27caf7accda36bfbc2ab2 /sc/source/core/data/column.cxx | |
parent | eb5606511fac2a8ee1af7cc03c12d6c5b16f7c96 (diff) |
tdf#81765 slow loading of .ods with >1000 of conditional formats, part 2
This takes the loading time from 15s to 14s.
Reduce unnecessary allocation/copying by passing down ownership of the
newly created ScPatternAttr to the item pool
Change-Id: Iec38bbff572d10ff8d86f5e65fbe9a96b6a5a706
Reviewed-on: https://gerrit.libreoffice.org/71010
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/core/data/column.cxx')
-rw-r--r-- | sc/source/core/data/column.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 7e606ea2a6d6..b5e3577c35a4 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -553,7 +553,7 @@ void ScColumn::ApplyStyle( SCROW nRow, const ScStyleSheet* rStyle ) const ScPatternAttr* pPattern = pAttrArray->GetPattern(nRow); std::unique_ptr<ScPatternAttr> pNewPattern(new ScPatternAttr(*pPattern)); pNewPattern->SetStyleSheet(const_cast<ScStyleSheet*>(rStyle)); - pAttrArray->SetPattern(nRow, pNewPattern.get(), true); + pAttrArray->SetPattern(nRow, std::move(pNewPattern), true); } void ScColumn::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle ) @@ -683,12 +683,23 @@ void ScColumn::ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWh pAttrArray->ClearItems( nStartRow, nEndRow, pWhich ); } +const ScPatternAttr* ScColumn::SetPattern( SCROW nRow, std::unique_ptr<ScPatternAttr> pPatAttr ) +{ + return pAttrArray->SetPattern( nRow, std::move(pPatAttr), true/*bPutToPool*/ ); +} + void ScColumn::SetPattern( SCROW nRow, const ScPatternAttr& rPatAttr ) { pAttrArray->SetPattern( nRow, &rPatAttr, true/*bPutToPool*/ ); } void ScColumn::SetPatternArea( SCROW nStartRow, SCROW nEndRow, + std::unique_ptr<ScPatternAttr> pPatAttr ) +{ + pAttrArray->SetPatternArea( nStartRow, nEndRow, std::move(pPatAttr), true/*bPutToPool*/ ); +} + +void ScColumn::SetPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr ) { pAttrArray->SetPatternArea( nStartRow, nEndRow, &rPatAttr, true/*bPutToPool*/ ); @@ -1692,7 +1703,7 @@ void ScColumn::CopyToColumn( const ScPatternAttr* pPattern = pAttrArray->GetPattern( nRow ); std::unique_ptr<ScPatternAttr> pNewPattern(new ScPatternAttr( *pPattern )); pNewPattern->SetStyleSheet( const_cast<ScStyleSheet*>(pStyle) ); - rColumn.pAttrArray->SetPattern( nRow, pNewPattern.get(), true ); + rColumn.pAttrArray->SetPattern( nRow, std::move(pNewPattern), true ); } } else |