sc/inc/editutil.hxx                           |    8 ++--
 sc/source/core/data/column2.cxx               |   14 +++----
 sc/source/core/data/documen2.cxx              |    6 +--
 sc/source/core/data/documen8.cxx              |    8 ++--
 sc/source/core/tool/editutil.cxx              |   52 +++++++++++++-------------
 sc/source/filter/excel/xehelper.cxx           |    6 +--
 sc/source/filter/excel/xlroot.cxx             |   12 +++---
 sc/source/ui/Accessibility/AccessibleText.cxx |   14 +++----
 sc/source/ui/app/inputwin.cxx                 |   22 +++++------
 sc/source/ui/dbgui/csvgrid.cxx                |   32 ++++++++--------
 sc/source/ui/pagedlg/tphfedit.cxx             |   16 ++++----
 sc/source/ui/unoobj/textuno.cxx               |   24 ++++++------
 sc/source/ui/view/gridwin.cxx                 |    8 ++--
 sc/source/ui/view/gridwin4.cxx                |    8 ++--
 sc/source/ui/view/output2.cxx                 |   24 ++++++------
 sc/source/ui/view/preview.cxx                 |    8 ++--
 sc/source/ui/view/viewfun4.cxx                |    6 +--
 17 files changed, 134 insertions(+), 134 deletions(-)

New commits:
commit 371ae67b37c6aebd5a7c2214a6285cd5abe9e6c8
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Wed Apr 9 22:03:30 2025 +0200
Commit:     Noel Grandin <noelgran...@gmail.com>
CommitDate: Thu Apr 10 10:00:25 2025 +0200

    tdf#162126 reduce allocation in hot path
    
    Change-Id: Ib4184d496dc07ea2a0790b9c5ecdd269f7c84cb7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183954
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx
index 0173b4aa7f26..7bd593d34a5a 100644
--- a/sc/inc/editutil.hxx
+++ b/sc/inc/editutil.hxx
@@ -109,7 +109,7 @@ class ScEnginePoolHelper
 {
 protected:
     rtl::Reference<SfxItemPool> m_pEnginePool;
-    std::unique_ptr<SfxItemSet> m_pDefaults;
+    std::optional<SfxItemSet> m_oDefaults;
     bool            m_bDeleteEnginePool;
 
                     ScEnginePoolHelper( SfxItemPool* pEnginePool, bool 
bDeleteEnginePool );
@@ -134,7 +134,7 @@ public:
     void            SetDefaults( const SfxItemSet& rDefaults );
 
                     /// Becomes the owner of the SfxItemSet
-    void            SetDefaults( std::unique_ptr<SfxItemSet> pDefaults );
+    void            SetDefaults( SfxItemSet&& aDefaults );
 
                     /// Set the item in the default ItemSet which is created
                     /// if it doesn't exist yet.
@@ -148,7 +148,7 @@ public:
     void            SetTextCurrentDefaults( const EditTextObject& rTextObject 
);
                     /// Current defaults are not applied, new defaults are 
applied
     void            SetTextNewDefaults( const EditTextObject& rTextObject,
-                        std::unique_ptr<SfxItemSet> pDefaults );
+                        SfxItemSet&& aDefaults );
                     /// New defaults are applied, but not stored
     void            SetTextTempDefaults( const EditTextObject& rTextObject,
                         const SfxItemSet& rDefaults );
@@ -156,7 +156,7 @@ public:
                     /// SetText and apply defaults already set
     void            SetTextCurrentDefaults( const OUString& rText );
                     /// Current defaults are not applied, new defaults are 
applied
-    void            SetTextNewDefaults( const OUString& rText, 
std::unique_ptr<SfxItemSet> pDefaults );
+    void            SetTextNewDefaults( const OUString& rText, SfxItemSet&& 
aDefaults );
 
                     /// Paragraph attributes that are not defaults are copied 
to
                     /// character attributes and all paragraph attributes reset
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 37db657fb552..b32e48b14e9d 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -421,22 +421,22 @@ tools::Long ScColumn::GetNeededSize(
         pDev->SetMapMode( aHMMMode );
         pEngine->SetRefDevice( pDev );
         rDocument.ApplyAsianEditSettings( *pEngine );
-        auto pSet = std::make_unique<SfxItemSet>(pEngine->GetEmptyItemSet());
+        SfxItemSet aSet(pEngine->GetEmptyItemSet());
         if ( ScStyleSheet* pPreviewStyle = rDocument.GetPreviewCellStyle( 
nCol, nRow, nTab ) )
         {
             ScPatternAttr aPreviewPattern( *pPattern );
             aPreviewPattern.SetStyleSheet(pPreviewStyle);
-            aPreviewPattern.FillEditItemSet(pSet.get(), pCondSet);
+            aPreviewPattern.FillEditItemSet(&aSet, pCondSet);
         }
         else
         {
             SfxItemSet* pFontSet = rDocument.GetPreviewFont( nCol, nRow, nTab 
);
-            pPattern->FillEditItemSet(pSet.get(), pFontSet ? pFontSet : 
pCondSet);
+            pPattern->FillEditItemSet(&aSet, pFontSet ? pFontSet : pCondSet);
         }
 //          no longer needed, are set with the text (is faster)
 //          pEngine->SetDefaults( pSet );
 
-        if ( pSet->Get(EE_PARA_HYPHENATE).GetValue() ) {
+        if ( aSet.Get(EE_PARA_HYPHENATE).GetValue() ) {
 
             css::uno::Reference<css::linguistic2::XHyphenator> xXHyphenator( 
LinguMgr::GetHyphenator() );
             pEngine->SetHyphenator( xXHyphenator );
@@ -489,7 +489,7 @@ tools::Long ScColumn::GetNeededSize(
 
         if (aCell.getType() == CELLTYPE_EDIT)
         {
-            pEngine->SetTextNewDefaults(*aCell.getEditText(), std::move(pSet));
+            pEngine->SetTextNewDefaults(*aCell.getEditText(), std::move(aSet));
         }
         else
         {
@@ -499,9 +499,9 @@ tools::Long ScColumn::GetNeededSize(
                 rOptions.bFormula);
 
             if (!aString.isEmpty())
-                pEngine->SetTextNewDefaults(aString, std::move(pSet));
+                pEngine->SetTextNewDefaults(aString, std::move(aSet));
             else
-                pEngine->SetDefaults(std::move(pSet));
+                pEngine->SetDefaults(std::move(aSet));
         }
 
         bool bEngineVertical = pEngine->IsEffectivelyVertical();
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 3890a5194e85..b60a4cd1d6d1 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -519,9 +519,9 @@ ScNoteEditEngine& ScDocument::GetNoteEngine()
         mpNoteEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM));
         ApplyAsianEditSettings( *mpNoteEngine );
         const SfxItemSet& 
rItemSet(getCellAttributeHelper().getDefaultCellAttribute().GetItemSet());
-        auto pEEItemSet = 
std::make_unique<SfxItemSet>(mpNoteEngine->GetEmptyItemSet());
-        ScPatternAttr::FillToEditItemSet(*pEEItemSet, rItemSet);
-        mpNoteEngine->SetDefaults(std::move(pEEItemSet)); // edit engine takes 
ownership
+        SfxItemSet aEEItemSet(mpNoteEngine->GetEmptyItemSet());
+        ScPatternAttr::FillToEditItemSet(aEEItemSet, rItemSet);
+        mpNoteEngine->SetDefaults(std::move(aEEItemSet)); // edit engine takes 
ownership
     }
     return *mpNoteEngine;
 }
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index a7f35e47e04b..9ef1045a3a63 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -1245,19 +1245,19 @@ void ScDocument::TransliterateText( const ScMarkData& 
rMultiMark, Transliteratio
 
                     // defaults from cell attributes must be set so right 
language is used
                     const ScPatternAttr* pPattern = GetPattern( nCol, nRow, 
nTab );
-                    auto pDefaults = std::make_unique<SfxItemSet>( 
pEngine->GetEmptyItemSet() );
+                    SfxItemSet aDefaults( pEngine->GetEmptyItemSet() );
                     if ( ScStyleSheet* pPreviewStyle = GetPreviewCellStyle( 
nCol, nRow, nTab ) )
                     {
                         ScPatternAttr aPreviewPattern( *pPattern );
                         aPreviewPattern.SetStyleSheet(pPreviewStyle);
-                        aPreviewPattern.FillEditItemSet(pDefaults.get());
+                        aPreviewPattern.FillEditItemSet(&aDefaults);
                     }
                     else
                     {
                         SfxItemSet* pFontSet = GetPreviewFont( nCol, nRow, 
nTab );
-                        pPattern->FillEditItemSet(pDefaults.get(), pFontSet);
+                        pPattern->FillEditItemSet(&aDefaults, pFontSet);
                     }
-                    pEngine->SetDefaults(std::move(pDefaults));
+                    pEngine->SetDefaults(std::move(aDefaults));
                     if (aCell.getType() == CELLTYPE_STRING)
                         
pEngine->SetTextCurrentDefaults(aCell.getSharedString()->getString());
                     else if (aCell.getEditText())
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index d72235516d01..45972774b836 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -579,51 +579,51 @@ void ScEditEngineDefaulter::ApplyDefaults(const 
SfxItemSet& rNewSet)
 
 void ScEditEngineDefaulter::SetDefaults(const SfxItemSet& rSet)
 {
-    SetDefaults(std::make_unique<SfxItemSet>(rSet));
+    m_oDefaults.emplace(rSet);
+    ApplyDefaults(*m_oDefaults);
 }
 
-void ScEditEngineDefaulter::SetDefaults( std::unique_ptr<SfxItemSet> pSet )
+void ScEditEngineDefaulter::SetDefaults( SfxItemSet&& aSet )
 {
-    m_pDefaults = std::move(pSet);
-    if ( m_pDefaults )
-        ApplyDefaults(*m_pDefaults);
+    m_oDefaults.emplace(std::move(aSet));
+    ApplyDefaults(*m_oDefaults);
 }
 
 void ScEditEngineDefaulter::SetDefaultItem( const SfxPoolItem& rItem )
 {
-    if ( !m_pDefaults )
+    if ( !m_oDefaults )
     {
-        m_pDefaults = std::make_unique<SfxItemSet>( GetEmptyItemSet() );
+        m_oDefaults.emplace( GetEmptyItemSet() );
     }
-    m_pDefaults->Put( rItem );
-    ApplyDefaults(*m_pDefaults);
+    m_oDefaults->Put( rItem );
+    ApplyDefaults(*m_oDefaults);
 }
 
 const SfxItemSet& ScEditEngineDefaulter::GetDefaults()
 {
-    if ( !m_pDefaults )
+    if ( !m_oDefaults )
     {
-        m_pDefaults = std::make_unique<SfxItemSet>( GetEmptyItemSet() );
+        m_oDefaults.emplace( GetEmptyItemSet() );
     }
-    return *m_pDefaults;
+    return *m_oDefaults;
 }
 
 void ScEditEngineDefaulter::SetTextCurrentDefaults( const EditTextObject& 
rTextObject )
 {
     bool bUpdateMode = SetUpdateLayout( false );
     SetText( rTextObject );
-    if ( m_pDefaults )
-        ApplyDefaults(*m_pDefaults);
+    if ( m_oDefaults )
+        ApplyDefaults(*m_oDefaults);
     if ( bUpdateMode )
         SetUpdateLayout( true );
 }
 
 void ScEditEngineDefaulter::SetTextNewDefaults(const EditTextObject& 
rTextObject,
-                                               std::unique_ptr<SfxItemSet> 
pDefaults)
+                                               SfxItemSet&& aDefaults)
 {
     bool bUpdateMode = SetUpdateLayout( false );
     SetText( rTextObject );
-    SetDefaults(std::move(pDefaults));
+    SetDefaults(std::move(aDefaults));
     if ( bUpdateMode )
         SetUpdateLayout( true );
 }
@@ -642,29 +642,29 @@ void ScEditEngineDefaulter::SetTextCurrentDefaults( const 
OUString& rText )
 {
     bool bUpdateMode = SetUpdateLayout( false );
     SetText( rText );
-    if ( m_pDefaults )
-        ApplyDefaults(*m_pDefaults);
+    if ( m_oDefaults )
+        ApplyDefaults(*m_oDefaults);
     if ( bUpdateMode )
         SetUpdateLayout( true );
 }
 
 void ScEditEngineDefaulter::SetTextNewDefaults( const OUString& rText,
-                                                std::unique_ptr<SfxItemSet> 
pDefaults )
+                                                SfxItemSet&& aDefaults )
 {
     bool bUpdateMode = SetUpdateLayout( false );
     SetText( rText );
-    SetDefaults(std::move(pDefaults));
+    SetDefaults(std::move(aDefaults));
     if ( bUpdateMode )
         SetUpdateLayout( true );
 }
 
 void ScEditEngineDefaulter::RepeatDefaults()
 {
-    if ( m_pDefaults )
+    if ( m_oDefaults )
     {
         sal_Int32 nPara = GetParagraphCount();
         for ( sal_Int32 j=0; j<nPara; j++ )
-            SetParaAttribs( j, *m_pDefaults );
+            SetParaAttribs( j, *m_oDefaults );
     }
 }
 
@@ -683,7 +683,7 @@ void ScEditEngineDefaulter::RemoveParaAttribs()
             if ( rParaAttribs.GetItemState( nWhich, false, &pParaItem ) == 
SfxItemState::SET )
             {
                 //  if defaults are set, use only items that are different 
from default
-                if ( !m_pDefaults || *pParaItem != m_pDefaults->Get(nWhich) )
+                if ( !m_oDefaults || *pParaItem != m_oDefaults->Get(nWhich) )
                 {
                     if (!pCharItems)
                         pCharItems.emplace( GetEmptyItemSet() );
@@ -758,9 +758,9 @@ ScTabEditEngine::ScTabEditEngine( const ScPatternAttr& 
rPattern,
 void ScTabEditEngine::Init( const ScPatternAttr& rPattern )
 {
     SetRefMapMode(MapMode(MapUnit::Map100thMM));
-    auto pEditDefaults = std::make_unique<SfxItemSet>( GetEmptyItemSet() );
-    rPattern.FillEditItemSet( pEditDefaults.get() );
-    SetDefaults( std::move(pEditDefaults) );
+    SfxItemSet aEditDefaults( GetEmptyItemSet() );
+    rPattern.FillEditItemSet( &aEditDefaults );
+    SetDefaults( std::move(aEditDefaults) );
     // we have no StyleSheets for text
     SetControlWord( GetControlWord() & ~EEControlBits::RTFSTYLESHEETS );
 }
diff --git a/sc/source/filter/excel/xehelper.cxx 
b/sc/source/filter/excel/xehelper.cxx
index ee3d7544e5e5..7ba3fb58c02d 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -597,9 +597,9 @@ XclExpStringRef XclExpStringHelper::CreateCellString(
     const SfxItemSet& rItemSet = pCellAttr ?
         pCellAttr->GetItemSet() :
         
rRoot.GetDoc().getCellAttributeHelper().getDefaultCellAttribute().GetItemSet();
-    auto pEEItemSet = std::make_unique<SfxItemSet>( rEE.GetEmptyItemSet() );
-    ScPatternAttr::FillToEditItemSet( *pEEItemSet, rItemSet );
-    rEE.SetDefaults( std::move(pEEItemSet) );      // edit engine takes 
ownership
+    SfxItemSet aEEItemSet( rEE.GetEmptyItemSet() );
+    ScPatternAttr::FillToEditItemSet( aEEItemSet, rItemSet );
+    rEE.SetDefaults( std::move(aEEItemSet) );      // edit engine takes 
ownership
 
     // create the string
     rEE.SetTextCurrentDefaults(rEditText);
diff --git a/sc/source/filter/excel/xlroot.cxx 
b/sc/source/filter/excel/xlroot.cxx
index 4ee2b155c8d7..783d9c98e532 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -388,14 +388,14 @@ ScHeaderEditEngine& XclRoot::GetHFEditEngine() const
         rEE.SetControlWord( rEE.GetControlWord() & 
~EEControlBits::ALLOWBIGOBJS );
 
         // set Calc header/footer defaults
-        auto pEditSet = std::make_unique<SfxItemSet>( rEE.GetEmptyItemSet() );
+        SfxItemSet aEditSet( rEE.GetEmptyItemSet() );
         SfxItemSetFixed<ATTR_PATTERN_START, ATTR_PATTERN_END> aItemSet( 
*GetDoc().GetPool() );
-        ScPatternAttr::FillToEditItemSet( *pEditSet, aItemSet );
+        ScPatternAttr::FillToEditItemSet( aEditSet, aItemSet );
         // FillToEditItemSet() adjusts font height to 1/100th mm, we need twips
-        pEditSet->Put( aItemSet.Get( ATTR_FONT_HEIGHT 
).CloneSetWhich(EE_CHAR_FONTHEIGHT) );
-        pEditSet->Put( aItemSet.Get( ATTR_CJK_FONT_HEIGHT 
).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) );
-        pEditSet->Put( aItemSet.Get( ATTR_CTL_FONT_HEIGHT 
).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) );
-        rEE.SetDefaults( std::move(pEditSet) );    // takes ownership
+        aEditSet.Put( aItemSet.Get( ATTR_FONT_HEIGHT 
).CloneSetWhich(EE_CHAR_FONTHEIGHT) );
+        aEditSet.Put( aItemSet.Get( ATTR_CJK_FONT_HEIGHT 
).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) );
+        aEditSet.Put( aItemSet.Get( ATTR_CTL_FONT_HEIGHT 
).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) );
+        rEE.SetDefaults( std::move(aEditSet) );    // takes ownership
     }
     return *mrData.mxHFEditEngine;
 }
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx 
b/sc/source/ui/Accessibility/AccessibleText.cxx
index cea5fd635b7a..3df9a2d0bcbb 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -1143,15 +1143,15 @@ SvxTextForwarder* 
ScAccessibleHeaderTextData::GetTextForwarder()
             pCellAttributeDefault = &pTmp->getDefaultCellAttribute();
         }
 
-        auto pDefaults = 
std::make_unique<SfxItemSet>(pHdrEngine->GetEmptyItemSet());
-        pCellAttributeDefault->FillEditItemSet(pDefaults.get());
+        SfxItemSet aDefaults(pHdrEngine->GetEmptyItemSet());
+        pCellAttributeDefault->FillEditItemSet(&aDefaults);
         //  FillEditItemSet adjusts font height to 1/100th mm,
         //  but for header/footer twips is needed, as in the PatternAttr:
-        pDefaults->Put( 
pCellAttributeDefault->GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT)
 );
-        pDefaults->Put( 
pCellAttributeDefault->GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK)
 );
-        pDefaults->Put( 
pCellAttributeDefault->GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL)
 );
-        pDefaults->Put( SvxAdjustItem( meAdjust, EE_PARA_JUST ) );
-        pHdrEngine->SetDefaults(std::move(pDefaults));
+        aDefaults.Put( 
pCellAttributeDefault->GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT)
 );
+        aDefaults.Put( 
pCellAttributeDefault->GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK)
 );
+        aDefaults.Put( 
pCellAttributeDefault->GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL)
 );
+        aDefaults.Put( SvxAdjustItem( meAdjust, EE_PARA_JUST ) );
+        pHdrEngine->SetDefaults(std::move(aDefaults));
 
         ScHeaderFieldData aData;
         if (mpViewShell)
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 9ee7648a7a3c..d170f1fdb821 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1553,14 +1553,14 @@ void ScTextWnd::InitEditEngine()
     UpdateAutoCorrFlag();
 
     {
-        auto pSet = std::make_unique<SfxItemSet>( 
m_xEditEngine->GetEmptyItemSet() );
-        EditEngine::SetFontInfoInItemSet( *pSet, aTextFont );
-        lcl_ExtendEditFontAttribs( *pSet );
+        SfxItemSet aSet( m_xEditEngine->GetEmptyItemSet() );
+        EditEngine::SetFontInfoInItemSet( aSet, aTextFont );
+        lcl_ExtendEditFontAttribs( aSet );
         // turn off script spacing to match DrawText output
-        pSet->Put( SvxScriptSpaceItem( false, EE_PARA_ASIANCJKSPACING ) );
+        aSet.Put( SvxScriptSpaceItem( false, EE_PARA_ASIANCJKSPACING ) );
         if ( bIsRTL )
-            lcl_ModifyRTLDefaults( *pSet );
-        static_cast<ScEditEngineDefaulter*>(m_xEditEngine.get())->SetDefaults( 
std::move(pSet) );
+            lcl_ModifyRTLDefaults( aSet );
+        static_cast<ScEditEngineDefaulter*>(m_xEditEngine.get())->SetDefaults( 
std::move(aSet) );
     }
 
     // If the Cell contains URLFields, they need to be taken over into the 
entry row,
@@ -2117,12 +2117,12 @@ void ScTextWnd::MakeDialogEditView()
     m_xEditEngine->SetWordDelimiters( m_xEditEngine->GetWordDelimiters() + "=" 
);
     m_xEditEngine->SetPaperSize( Size( bIsRTL ? USHRT_MAX : THESIZE, 300 ) );
 
-    auto pSet = std::make_unique<SfxItemSet>( m_xEditEngine->GetEmptyItemSet() 
);
-    EditEngine::SetFontInfoInItemSet( *pSet, aTextFont );
-    lcl_ExtendEditFontAttribs( *pSet );
+    SfxItemSet aSet( m_xEditEngine->GetEmptyItemSet() );
+    EditEngine::SetFontInfoInItemSet( aSet, aTextFont );
+    lcl_ExtendEditFontAttribs( aSet );
     if ( bIsRTL )
-        lcl_ModifyRTLDefaults( *pSet );
-    static_cast<ScEditEngineDefaulter*>(m_xEditEngine.get())->SetDefaults( 
std::move(pSet) );
+        lcl_ModifyRTLDefaults( aSet );
+    static_cast<ScEditEngineDefaulter*>(m_xEditEngine.get())->SetDefaults( 
std::move(aSet) );
     m_xEditEngine->SetUpdateLayout( bPrevUpdateLayout );
 
     m_xEditView = std::make_unique<EditView>(m_xEditEngine.get(), nullptr);
diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx
index 1066a7deb281..7e7375a964fc 100644
--- a/sc/source/ui/dbgui/csvgrid.cxx
+++ b/sc/source/ui/dbgui/csvgrid.cxx
@@ -285,37 +285,37 @@ void ScCsvGrid::InitFonts()
     ::GetDefaultFonts( aLatinItem, aAsianItem, aComplexItem );
 
     // create item set for defaults
-    auto pDefSet = 
std::make_unique<SfxItemSet>(mpEditEngine->GetEmptyItemSet());
-    EditEngine::SetFontInfoInItemSet(*pDefSet, maMonoFont);
-    pDefSet->Put(aAsianItem);
-    pDefSet->Put(aComplexItem);
+    SfxItemSet aDefSet(mpEditEngine->GetEmptyItemSet());
+    EditEngine::SetFontInfoInItemSet(aDefSet, maMonoFont);
+    aDefSet.Put(aAsianItem);
+    aDefSet.Put(aComplexItem);
 
     // set Asian/Complex font size to height of character in Latin font
     sal_uLong nFontHt = static_cast< sal_uLong >( 
maMonoFont.GetFontSize().Height() );
-    pDefSet->Put(SvxFontHeightItem(nFontHt, 100, EE_CHAR_FONTHEIGHT_CJK));
-    pDefSet->Put(SvxFontHeightItem(nFontHt, 100, EE_CHAR_FONTHEIGHT_CTL));
+    aDefSet.Put(SvxFontHeightItem(nFontHt, 100, EE_CHAR_FONTHEIGHT_CJK));
+    aDefSet.Put(SvxFontHeightItem(nFontHt, 100, EE_CHAR_FONTHEIGHT_CTL));
 
     // copy other items from default font
-    const SfxPoolItem& rWeightItem = pDefSet->Get(EE_CHAR_WEIGHT);
+    const SfxPoolItem& rWeightItem = aDefSet.Get(EE_CHAR_WEIGHT);
     std::unique_ptr<SfxPoolItem> pNewItem(rWeightItem.Clone());
     pNewItem->SetWhich(EE_CHAR_WEIGHT_CJK);
-    pDefSet->Put(*pNewItem);
+    aDefSet.Put(*pNewItem);
     pNewItem->SetWhich(EE_CHAR_WEIGHT_CTL);
-    pDefSet->Put(*pNewItem);
-    const SfxPoolItem& rItalicItem = pDefSet->Get(EE_CHAR_ITALIC);
+    aDefSet.Put(*pNewItem);
+    const SfxPoolItem& rItalicItem = aDefSet.Get(EE_CHAR_ITALIC);
     pNewItem.reset(rItalicItem.Clone());
     pNewItem->SetWhich(EE_CHAR_ITALIC_CJK);
-    pDefSet->Put(*pNewItem);
+    aDefSet.Put(*pNewItem);
     pNewItem->SetWhich(EE_CHAR_ITALIC_CTL);
-    pDefSet->Put(*pNewItem);
-    const SfxPoolItem& rLangItem = pDefSet->Get(EE_CHAR_LANGUAGE);
+    aDefSet.Put(*pNewItem);
+    const SfxPoolItem& rLangItem = aDefSet.Get(EE_CHAR_LANGUAGE);
     pNewItem.reset(rLangItem.Clone());
     pNewItem->SetWhich(EE_CHAR_LANGUAGE_CJK);
-    pDefSet->Put(*pNewItem);
+    aDefSet.Put(*pNewItem);
     pNewItem->SetWhich(EE_CHAR_LANGUAGE_CTL);
-    pDefSet->Put(*pNewItem);
+    aDefSet.Put(*pNewItem);
 
-    mpEditEngine->SetDefaults(std::move(pDefSet));
+    mpEditEngine->SetDefaults(std::move(aDefSet));
     InvalidateGfx();
 }
 
diff --git a/sc/source/ui/pagedlg/tphfedit.cxx 
b/sc/source/ui/pagedlg/tphfedit.cxx
index 617f2208a9f9..5a98e65dd3fd 100644
--- a/sc/source/ui/pagedlg/tphfedit.cxx
+++ b/sc/source/ui/pagedlg/tphfedit.cxx
@@ -144,23 +144,23 @@ std::unique_ptr<EditTextObject> 
ScEditWindow::CreateTextObject()
 
 void ScEditWindow::SetFont( const ScPatternAttr& rPattern )
 {
-    auto pSet = std::make_unique<SfxItemSet>( m_xEditEngine->GetEmptyItemSet() 
);
-    rPattern.FillEditItemSet( pSet.get() );
+    SfxItemSet aSet( m_xEditEngine->GetEmptyItemSet() );
+    rPattern.FillEditItemSet( &aSet );
     //  FillEditItemSet adjusts font height to 1/100th mm,
     //  but for header/footer twips is needed, as in the PatternAttr:
-    pSet->Put( 
rPattern.GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT) );
-    pSet->Put( 
rPattern.GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) );
-    pSet->Put( 
rPattern.GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) );
+    aSet.Put( 
rPattern.GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT) );
+    aSet.Put( 
rPattern.GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) );
+    aSet.Put( 
rPattern.GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) );
     // font color used, suitable header/footer background color set in 
ScEditWindow::SetDrawingArea
     Color aFgColor = svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR, 
false).nColor;
     if (aFgColor == COL_AUTO) {
         Color aBgColor = 
svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
         aFgColor = aBgColor.IsDark() ? COL_WHITE : COL_BLACK;
     }
-    pSet->Put(SvxColorItem(aFgColor, EE_CHAR_COLOR));
+    aSet.Put(SvxColorItem(aFgColor, EE_CHAR_COLOR));
     if (mbRTL)
-        pSet->Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
-    GetEditEngine()->SetDefaults( std::move(pSet) );
+        aSet.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
+    GetEditEngine()->SetDefaults( std::move(aSet) );
 }
 
 void ScEditWindow::SetText( const EditTextObject& rTextObject )
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 4e4070502dc2..8fd8c0813ad5 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -190,14 +190,14 @@ SvxTextForwarder* 
ScHeaderFooterTextData::GetTextForwarder()
             pCellAttributeDefault = &pTmp->getDefaultCellAttribute();
         }
 
-        auto pDefaults = 
std::make_unique<SfxItemSet>(pHdrEngine->GetEmptyItemSet());
-        pCellAttributeDefault->FillEditItemSet(pDefaults.get());
+        SfxItemSet aDefaults(pHdrEngine->GetEmptyItemSet());
+        pCellAttributeDefault->FillEditItemSet(&aDefaults);
         //  FillEditItemSet adjusts font height to 1/100th mm,
         //  but for header/footer twips is needed, as in the PatternAttr:
-        pDefaults->Put( 
pCellAttributeDefault->GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT)
 );
-        pDefaults->Put( 
pCellAttributeDefault->GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK)
 ) ;
-        pDefaults->Put( 
pCellAttributeDefault->GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL)
 );
-        pHdrEngine->SetDefaults(std::move(pDefaults));
+        aDefaults.Put( 
pCellAttributeDefault->GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT)
 );
+        aDefaults.Put( 
pCellAttributeDefault->GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK)
 ) ;
+        aDefaults.Put( 
pCellAttributeDefault->GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL)
 );
+        pHdrEngine->SetDefaults(std::move(aDefaults));
 
         ScHeaderFieldData aData;
         ScHeaderFooterTextObj::FillDummyFieldData( aData );
@@ -792,19 +792,19 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder()
     {
         ScDocument& rDoc = pDocShell->GetDocument();
 
-        auto pDefaults = 
std::make_unique<SfxItemSet>(pEditEngine->GetEmptyItemSet());
+        SfxItemSet aDefaults(pEditEngine->GetEmptyItemSet());
         if( const ScPatternAttr* pPattern =
                 rDoc.GetPattern( aCellPos.Col(), aCellPos.Row(), 
aCellPos.Tab() ) )
         {
-            pPattern->FillEditItemSet(pDefaults.get());
-            pPattern->FillEditParaItems(pDefaults.get()); // including 
alignment etc. (for reading)
+            pPattern->FillEditItemSet(&aDefaults);
+            pPattern->FillEditParaItems(&aDefaults); // including alignment 
etc. (for reading)
         }
 
         ScRefCellValue aCell(rDoc, aCellPos);
         if (aCell.getType() == CELLTYPE_EDIT)
         {
             const EditTextObject* pObj = aCell.getEditText();
-            pEditEngine->SetTextNewDefaults(*pObj, std::move(pDefaults));
+            pEditEngine->SetTextNewDefaults(*pObj, std::move(aDefaults));
         }
         else
         {
@@ -819,9 +819,9 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder()
             // pEditEngine->SetTextNewDefaults() is passed an empty string
             // and pEditEngine->GetText() is empty string.
             if (!aText.isEmpty() || pEditEngine->HasText())
-                pEditEngine->SetTextNewDefaults(aText, std::move(pDefaults));
+                pEditEngine->SetTextNewDefaults(aText, std::move(aDefaults));
             else
-                pEditEngine->SetDefaults(std::move(pDefaults));
+                pEditEngine->SetDefaults(std::move(aDefaults));
         }
     }
 
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index dba7a7165152..998fd794fa6e 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5786,10 +5786,10 @@ std::shared_ptr<ScFieldEditEngine> createEditEngine( 
ScDocShell* pDocSh, const S
     ScSizeDeviceProvider aProv(pDocSh);
     pEngine->SetRefDevice(aProv.GetDevice());
     pEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM));
-    auto pDefault = std::make_unique<SfxItemSet>(pEngine->GetEmptyItemSet());
-    rPat.FillEditItemSet(pDefault.get());
-    pDefault->Put(SvxAdjustItem(toSvxAdjust(rPat), EE_PARA_JUST));
-    pEngine->SetDefaults(std::move(pDefault));
+    SfxItemSet aDefault(pEngine->GetEmptyItemSet());
+    rPat.FillEditItemSet(&aDefault);
+    aDefault.Put(SvxAdjustItem(toSvxAdjust(rPat), EE_PARA_JUST));
+    pEngine->SetDefaults(std::move(aDefault));
 
     return pEngine;
 }
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 69fc57fce967..7b7d05a58779 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1914,10 +1914,10 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW 
nY1, SCCOL nX2, SCROW nY2,
         //  use EditEngine to draw mixed-script string
         pEditEng.reset(new ScEditEngineDefaulter( 
EditEngine::CreatePool().get(), true ));
         pEditEng->SetRefMapMode(rRenderContext.GetMapMode());
-        auto pEditDefaults = std::make_unique<SfxItemSet>( 
pEditEng->GetEmptyItemSet() );
-        rDefPattern.FillEditItemSet( pEditDefaults.get() );
-        pEditDefaults->Put( SvxColorItem( COL_LIGHTGRAY, EE_CHAR_COLOR ) );
-        pEditEng->SetDefaults( std::move(pEditDefaults) );
+        SfxItemSet aEditDefaults( pEditEng->GetEmptyItemSet() );
+        rDefPattern.FillEditItemSet( &aEditDefaults );
+        aEditDefaults.Put( SvxColorItem( COL_LIGHTGRAY, EE_CHAR_COLOR ) );
+        pEditEng->SetDefaults( std::move(aEditDefaults) );
     }
 
     sal_uInt16 nCount = sal::static_int_cast<sal_uInt16>( 
pPageData->GetCount() );
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 866ac2eb6cbb..7123c47d986f 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -2558,28 +2558,28 @@ void 
ScOutputData::DrawEditParam::setPatternToEngine(bool bUseStyleColor)
     bool bCellContrast = bUseStyleColor &&
             
Application::GetSettings().GetStyleSettings().GetHighContrastMode();
 
-    auto pSet = std::make_unique<SfxItemSet>( mpEngine->GetEmptyItemSet() );
-    mpPattern->FillEditItemSet( pSet.get(), mpCondSet );
+    SfxItemSet aSet( mpEngine->GetEmptyItemSet() );
+    mpPattern->FillEditItemSet( &aSet, mpCondSet );
     if ( mpPreviewFontSet )
     {
         if ( const SvxFontItem* pItem = mpPreviewFontSet->GetItemIfSet( 
ATTR_FONT ) )
         {
             // tdf#125054 adapt WhichID
-            pSet->PutAsTargetWhich(*pItem, EE_CHAR_FONTINFO);
+            aSet.PutAsTargetWhich(*pItem, EE_CHAR_FONTINFO);
         }
         if ( const SvxFontItem* pItem = mpPreviewFontSet->GetItemIfSet( 
ATTR_CJK_FONT ) )
         {
             // tdf#125054 adapt WhichID
-            pSet->PutAsTargetWhich(*pItem, EE_CHAR_FONTINFO_CJK);
+            aSet.PutAsTargetWhich(*pItem, EE_CHAR_FONTINFO_CJK);
         }
         if ( const SvxFontItem* pItem = mpPreviewFontSet->GetItemIfSet( 
ATTR_CTL_FONT ) )
         {
             // tdf#125054 adapt WhichID
-            pSet->PutAsTargetWhich(*pItem, EE_CHAR_FONTINFO_CTL);
+            aSet.PutAsTargetWhich(*pItem, EE_CHAR_FONTINFO_CTL);
         }
     }
-    bool bParaHyphenate = pSet->Get(EE_PARA_HYPHENATE).GetValue();
-    mpEngine->SetDefaults( std::move(pSet) );
+    bool bParaHyphenate = aSet.Get(EE_PARA_HYPHENATE).GetValue();
+    mpEngine->SetDefaults( std::move(aSet) );
     mpOldPattern = mpPattern;
     mpOldCondSet = mpCondSet;
     mpOldPreviewFontSet = mpPreviewFontSet;
@@ -4777,18 +4777,18 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
                             // StringDiffer doesn't look at hyphenate, 
language items
                             if ( !ScPatternAttr::areSame(pPattern, 
pOldPattern) || pCondSet != pOldCondSet )
                             {
-                                auto pSet = std::make_unique<SfxItemSet>( 
mxOutputEditEngine->GetEmptyItemSet() );
-                                pPattern->FillEditItemSet( pSet.get(), 
pCondSet );
+                                SfxItemSet aSet( 
mxOutputEditEngine->GetEmptyItemSet() );
+                                pPattern->FillEditItemSet( &aSet, pCondSet );
 
                                                                     // 
adjustment for EditEngine
                                 SvxAdjust eSvxAdjust = SvxAdjust::Left;
                                 if (eOrient==SvxCellOrientation::Stacked)
                                     eSvxAdjust = SvxAdjust::Center;
                                 // adjustment for bBreak is omitted here
-                                pSet->Put( SvxAdjustItem( eSvxAdjust, 
EE_PARA_JUST ) );
+                                aSet.Put( SvxAdjustItem( eSvxAdjust, 
EE_PARA_JUST ) );
 
-                                bool bParaHyphenate = 
pSet->Get(EE_PARA_HYPHENATE).GetValue();
-                                mxOutputEditEngine->SetDefaults( 
std::move(pSet) );
+                                bool bParaHyphenate = 
aSet.Get(EE_PARA_HYPHENATE).GetValue();
+                                mxOutputEditEngine->SetDefaults( 
std::move(aSet) );
                                 pOldPattern = pPattern;
                                 pOldCondSet = pCondSet;
 
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index 33e26e2718a6..34670acab451 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -498,10 +498,10 @@ void ScPreview::DoPrint( ScPreviewLocationData* 
pFillLocation )
             new ScEditEngineDefaulter(EditEngine::CreatePool().get(), true));
 
         pEditEng->SetRefMapMode(aMMMode);
-        auto pEditDefaults = std::make_unique<SfxItemSet>( 
pEditEng->GetEmptyItemSet() );
-        rDefPattern.FillEditItemSet(pEditDefaults.get());
-        pEditDefaults->Put(SvxColorItem(COL_LIGHTGRAY, EE_CHAR_COLOR));
-        pEditEng->SetDefaults(std::move(pEditDefaults));
+        SfxItemSet aEditDefaults( pEditEng->GetEmptyItemSet() );
+        rDefPattern.FillEditItemSet(&aEditDefaults);
+        aEditDefaults.Put(SvxColorItem(COL_LIGHTGRAY, EE_CHAR_COLOR));
+        pEditEng->SetDefaults(std::move(aEditDefaults));
 
         OUString aEmptyMsg;
         if (mbHasEmptyRangeTable)
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index d4b7ea83d9a8..129e13cfbf3b 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -365,9 +365,9 @@ void ScViewFunc::DoThesaurus()
     const ScPatternAttr* pPattern = rDoc.GetPattern(nCol, nRow, nTab);
     if (pPattern)
     {
-        auto pEditDefaults = 
std::make_unique<SfxItemSet>(pThesaurusEngine->GetEmptyItemSet());
-        pPattern->FillEditItemSet(pEditDefaults.get());
-        pThesaurusEngine->SetDefaults(std::move(pEditDefaults));
+        SfxItemSet aEditDefaults(pThesaurusEngine->GetEmptyItemSet());
+        pPattern->FillEditItemSet(&aEditDefaults);
+        pThesaurusEngine->SetDefaults(std::move(aEditDefaults));
     }
 
     if (aOldText.getType() == CELLTYPE_EDIT)

Reply via email to