sc/source/core/data/attarray.cxx |    1 +
 sc/source/ui/view/viewfunc.cxx   |    1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fd1f76d1f45329d45ec22eff63e05f43c95fec83
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sat Dec 30 18:37:58 2023 +0600
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Jan 8 09:51:17 2024 +0100

    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.kagan...@collabora.com>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit 46b06663ae767d3423f2135fa91800cfa304877b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161422
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 7124e78be37e..4c31fb86e3cc 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -410,6 +410,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 0b8b0865f0fc..25633cae38f7 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1252,7 +1252,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;

Reply via email to