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

New commits:
commit 15fd6de056a1389702a1d3be9ffd3fdd5a0795de
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sat Dec 30 18:37:58 2023 +0600
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Dec 31 13:06:24 2023 +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/+/161412
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 406525e862c8..c799bf8c7530 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -400,6 +400,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 15076f04a958..86ec365d2a2b 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1230,7 +1230,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