diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-05-15 13:13:31 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-05-16 12:34:51 +0200 |
commit | 6f810e3d7dafcd7d0101173a501786226f4d8886 (patch) | |
tree | 17b048023c746f719b754505b4cd0ff8bcccea10 /sc/source/core/data/column.cxx | |
parent | ace16e500c92797bb47ad580cf535de0702137bd (diff) |
optimize ScHTMLExport::WriteTables() with large columns
Again, unless given a hint, mdds always starts a search from the beginning
of the container, so iterating over a column becomes quadratic.
Shows when selecting (the title of) a large column with different value types,
e.g. in tdf#120558, which triggers setting the selection from
VclQt5Clipboard::setContents(), which calls this.
Change-Id: Ida009c5ddf18ccdc8dff88c15530cc7e33ce80e7
Reviewed-on: https://gerrit.libreoffice.org/72366
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc/source/core/data/column.cxx')
-rw-r--r-- | sc/source/core/data/column.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 70ee70b8e1f4..548e6403cc8b 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -726,6 +726,16 @@ ScRefCellValue ScColumn::GetCellValue( SCROW nRow ) const return GetCellValue(aPos.first, aPos.second); } +ScRefCellValue ScColumn::GetCellValue( sc::ColumnBlockPosition& rBlockPos, SCROW nRow ) +{ + std::pair<sc::CellStoreType::iterator,size_t> aPos = maCells.position(rBlockPos.miCellPos, nRow); + if (aPos.first == maCells.end()) + return ScRefCellValue(); + + rBlockPos.miCellPos = aPos.first; // Store this for next call. + return GetCellValue(aPos.first, aPos.second); +} + ScRefCellValue ScColumn::GetCellValue( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const { std::pair<sc::CellStoreType::const_iterator,size_t> aPos = maCells.position(rBlockPos.miCellPos, nRow); |