sc/source/ui/inc/viewfunc.hxx  |    3 ++-
 sc/source/ui/view/formatsh.cxx |    9 +++++----
 sc/source/ui/view/viewfunc.cxx |   10 +++++++---
 3 files changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 45703bc898da1f1449103b5019fbcf1e0dc048a9
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Mar 17 19:40:03 2025 +0500
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Mar 18 08:42:32 2025 +0100

    tdf#144151: do not adjust row height for font / style preview
    
    In commit bcc51fb2ebdf77a1cc089857775fd742085b45b6 (add support for
    in-place style preview, 2013-08-29), a feature of live preview was
    introduced, to see the effect of not-yet-applied font currently
    hovered in the font list. While doing this, it could recalculate
    row heights (e.g., for auto-wrapped cells).
    
    For large selection, this recalculation may take several seconds.
    Also, this may mark document modified, and also result in following
    UI operations slowdown.
    
    This change prevents this recalculation for the preview. The cost
    is that now the preview could be not 100% correct, but hopefully
    this is much less problematic, than the problems it resolves.
    SID_ATTR_CHAR_FONTHEIGHT (.uno:CharFontName) does the height adjust
    anyway.
    
    Change-Id: If347aa7222cb700d8969dd546727ae437f787d14
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183034
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 950cbe4ccf2a95981e40f2a9589b22a403784557)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183045
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index a49941e7052e..22b97957b3ea 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -339,7 +339,8 @@ public:
                                     SCROW nEndRow , SCCOL nEndCol ,
                                     
std::vector<std::unique_ptr<ScDataFormFragment>>& rEdits,
                                     sal_uInt16 aColLength);
-    void            UpdateSelectionArea( const ScMarkData& rSel, 
ScPatternAttr* pAttr = nullptr );
+    void UpdateSelectionArea(const ScMarkData& rSel, ScPatternAttr* pAttr = 
nullptr,
+                             bool adjustHeight = true);
 
     void            OnLOKInsertDeleteColumn(SCCOL nStartCol, tools::Long 
nOffset);
     void            OnLOKInsertDeleteRow(SCROW nStartRow, tools::Long nOffset);
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 8381209e7c72..539f2f08df16 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -196,7 +196,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
                 rNewSet.Put( aItemSet, false );
 
                 rDoc.ApplySelectionPattern( aNewAttrs, 
rDoc.GetPreviewSelection() );
-                pTabViewShell->UpdateSelectionArea( aFuncMark, &aAttr );
+                pTabViewShell->UpdateSelectionArea(aFuncMark, &aAttr, 
/*adjustHeight*/ false);
             }
         }
         else
@@ -218,7 +218,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
                 SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
                 rNewSet.Put( aItemSet, false );
                 rDoc.ApplySelectionPattern( aNewAttrs, aPreviewMark );
-                pTabViewShell->UpdateSelectionArea( aPreviewMark, &aAttr );
+                pTabViewShell->UpdateSelectionArea(aPreviewMark, &aAttr, 
/*adjustHeight*/ false);
             }
         }
     }
@@ -945,7 +945,8 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
             case SID_ATTR_CHAR_ENDPREVIEW_FONT:
             {
                 rDoc.SetPreviewFont(nullptr);
-                pTabViewShell->UpdateSelectionArea( rDoc.GetPreviewSelection() 
);
+                pTabViewShell->UpdateSelectionArea(rDoc.GetPreviewSelection(), 
nullptr,
+                                                   /*adjustHeight*/ false);
                 break;
             }
             case SID_ATTR_CHAR_COLOR:
@@ -1026,7 +1027,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
                     aFuncMark.SetMarkArea( aRange );
                 }
                 rDoc.SetPreviewSelection( aFuncMark );
-                pTabViewShell->UpdateSelectionArea( aFuncMark );
+                pTabViewShell->UpdateSelectionArea(aFuncMark, nullptr, 
/*adjustHeight*/ false);
                 break;
             }
             case SID_ATTR_CHAR_OVERLINE:
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 20f3795400b9..7c2b221ba5e7 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -3247,7 +3247,8 @@ void ScViewFunc::InsertNameList()
         pDocSh->UpdateOle(GetViewData());
 }
 
-void ScViewFunc::UpdateSelectionArea( const ScMarkData& rSel, ScPatternAttr* 
pAttr  )
+void ScViewFunc::UpdateSelectionArea(const ScMarkData& rSel, ScPatternAttr* 
pAttr,
+                                     bool adjustHeight)
 {
     ScDocShell* pDocShell = GetViewData().GetDocShell();
     ScRange aMarkRange;
@@ -3281,8 +3282,11 @@ void ScViewFunc::UpdateSelectionArea( const ScMarkData& 
rSel, ScPatternAttr* pAt
     pDocShell->PostPaint( nStartCol, nStartRow, nStartTab,
         nEndCol,   nEndRow,   nEndTab,
         PaintPartFlags::Grid, nExtFlags | SC_PF_TESTMERGE );
-    ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
-    pTabViewShell->AdjustBlockHeight(false, const_cast<ScMarkData*>(&rSel));
+    if (adjustHeight)
+    {
+        ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
+        pTabViewShell->AdjustBlockHeight(false, 
const_cast<ScMarkData*>(&rSel));
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to