editeng/source/editeng/impedit5.cxx |   14 ++++++++------
 sc/source/core/tool/editutil.cxx    |    2 ++
 2 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 512357eafd80d7b1942f59170b4267ce76a46e16
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Jul 23 11:06:30 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Jul 23 12:26:50 2024 +0200

    improve ImpEditEngine::SetParaAttribs a little
    
    avoid doing GetItemState if we don't have a wrong list (the common case)
    
    Change-Id: I3a1a22da657835ae37e8025d8ce21ad14d4e2c39
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170890
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/editeng/source/editeng/impedit5.cxx 
b/editeng/source/editeng/impedit5.cxx
index 7606a8e7c574..5a1a9bb66d48 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -728,14 +728,16 @@ void ImpEditEngine::SetParaAttribs( sal_Int32 nPara, 
const SfxItemSet& rSet )
         }
     }
 
-    bool bCheckLanguage = ( rSet.GetItemState( EE_CHAR_LANGUAGE ) == 
SfxItemState::SET ) ||
-                     ( rSet.GetItemState( EE_CHAR_LANGUAGE_CJK ) == 
SfxItemState::SET ) ||
-                     ( rSet.GetItemState( EE_CHAR_LANGUAGE_CTL ) == 
SfxItemState::SET );
-
     pNode->GetContentAttribs().GetItems().Set( rSet );
 
-    if ( bCheckLanguage && pNode->GetWrongList() )
-        pNode->GetWrongList()->ResetInvalidRange(0, pNode->Len());
+    if ( auto pWrongList = pNode->GetWrongList() )
+    {
+        bool bCheckLanguage = ( rSet.GetItemState( EE_CHAR_LANGUAGE ) == 
SfxItemState::SET ) ||
+                     ( rSet.GetItemState( EE_CHAR_LANGUAGE_CJK ) == 
SfxItemState::SET ) ||
+                     ( rSet.GetItemState( EE_CHAR_LANGUAGE_CTL ) == 
SfxItemState::SET );
+        if (bCheckLanguage)
+            pWrongList->ResetInvalidRange(0, pNode->Len());
+    }
 
     if (maStatus.UseCharAttribs())
         pNode->CreateDefFont();
commit 23f268d0772cd9ad024d6747ed4e65068a31e17e
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Jul 23 11:05:59 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Jul 23 12:26:42 2024 +0200

    avoid OUString construction in lcl_GetDelimitedString
    
    for the common case of having no paragraphs
    
    Change-Id: I56ad9b5069021690954730188e406c133894dbee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170889
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index 6737c947ea14..40acbca390af 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -93,6 +93,8 @@ static OUString lcl_GetDelimitedString( const EditEngine& 
rEngine, const char c
 static OUString lcl_GetDelimitedString( const EditTextObject& rEdit, const 
char c )
 {
     sal_Int32 nParCount = rEdit.GetParagraphCount();
+    if (nParCount == 0)
+        return u""_ustr;
     OUStringBuffer aRet( nParCount * 80 );
     for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
     {

Reply via email to