summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-12-30 18:37:58 +0600
committerMike Kaganski <mike.kaganski@collabora.com>2023-12-30 17:45:12 +0100
commit46b06663ae767d3423f2135fa91800cfa304877b (patch)
tree86360d116905d7f5509cd041ea90e2d8cbd8317b /sc
parent427d8f61d7bc4087a9408ba7f0b8a718943f4240 (diff)
tdf#158254: don't shrink to data area when applying to entire sheet
Commit ac859a4c6a7fce4efee9cdd45821a0c9e40e9e9a (tdf#147842 shrink selection to data area when applying to entire sheet, 2022-10-18) tried to workaround the problem of applying to the massive amount of columns. This caused regressions, where it was impossible to pre- format entire rows. This change removes the call to ShrinkToDataArea from ScViewFunc::ApplySelectionPattern (it is used elsewhere, so the commit is not reverted completely). Instead, it addresses the bottleneck in the bugdoc in tdf#147842, which is ScAttrArray::RemoveCellCharAttribs: since the document had hidden rows, selecting all made multi-selection split into separate stripes, and the fulction was called repeatedly, and itself called ScEditUtil::RemoveCharAttribs for every cell in ~ 1000 columns * 1000000 rows, even though most of the cells in that range were empty - so no char attribs could exist. Asking for the last used row (the same as done in ShrinkToDataArea) makes the operation fast again, and keeps assigning the format to the entire range. Change-Id: I9635ea1a392b3a1e048c0888f4786a3628675fc9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161442 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/attarray.cxx1
-rw-r--r--sc/source/ui/view/viewfunc.cxx1
2 files changed, 1 insertions, 1 deletions
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 4b9bbc7a4e2c..fcdb0be9da5e 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -404,6 +404,7 @@ void ScAttrArray::RemoveCellCharAttribs( SCROW nStartRow, SCROW nEndRow,
// cache mdds position, this doesn't modify the mdds container, just EditTextObject's
sc::ColumnBlockPosition blockPos;
rDocument.InitColumnBlockPosition( blockPos, nTab, nCol );
+ nEndRow = rDocument.GetLastDataRow(nTab, nCol, nCol, nEndRow);
for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow)
{
ScAddress aPos(nCol, nRow, nTab);
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 2958f13cd2eb..97d7338ece91 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1253,7 +1253,6 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor
ScDocShell* pDocSh = rViewData.GetDocShell();
ScDocument& rDoc = pDocSh->GetDocument();
ScMarkData aFuncMark( rViewData.GetMarkData() ); // local copy for UnmarkFiltered
- ShrinkToDataArea( aFuncMark, rDoc );
ScViewUtil::UnmarkFiltered( aFuncMark, rDoc );
bool bRecord = true;