[Libreoffice-commits] core.git: cui/source dbaccess/source reportdesign/source sc/source sd/source sfx2/source svx/source sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri May 28 10:18:55 UTC 2021


 cui/source/dialogs/hltpbase.cxx                    |   10 +-
 dbaccess/source/ui/misc/UITools.cxx                |    4 
 reportdesign/source/ui/misc/UITools.cxx            |   12 +-
 reportdesign/source/ui/report/ReportController.cxx |   24 ++---
 sc/source/ui/drawfunc/drawsh.cxx                   |    8 -
 sc/source/ui/view/formatsh.cxx                     |   42 +++-----
 sc/source/ui/view/spelleng.cxx                     |    6 -
 sc/source/ui/view/viewfun2.cxx                     |   30 ++----
 sd/source/ui/func/fuline.cxx                       |    6 -
 sd/source/ui/view/drviews9.cxx                     |  100 ++++++++++-----------
 sfx2/source/control/unoctitm.cxx                   |    4 
 sfx2/source/doc/sfxbasemodel.cxx                   |   10 +-
 svx/source/dialog/ClassificationDialog.cxx         |    6 -
 svx/source/dialog/ClassificationEditView.cxx       |    8 -
 svx/source/form/fmtextcontrolshell.cxx             |    4 
 sw/source/filter/ww8/ww8graf.cxx                   |    5 -
 16 files changed, 137 insertions(+), 142 deletions(-)

New commits:
commit 83fb7db6911aa77d713f3da0391b680e55563181
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu May 27 20:47:06 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri May 28 12:18:03 2021 +0200

    no need to allocate these SfxItemSet on the heap
    
    use std::optional where the code needs to control the lifetime of the
    object explicitly
    
    Change-Id: Ia550ce051360f68911abc68c945a97d62a637b06
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116291
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index 9515443e67d7..b636c94ecb0f 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -341,14 +341,14 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, weld::Button&, voi
         aItem.SetMacroTable( *pMacroTbl );
 
     // create empty itemset for macro-dlg
-    std::unique_ptr<SfxItemSet> pItemSet( new SfxItemSet(SfxGetpApp()->GetPool(),
-                                          svl::Items<SID_ATTR_MACROITEM,
-                                          SID_ATTR_MACROITEM>{} ) );
-    pItemSet->Put ( aItem );
+    SfxItemSet aItemSet( SfxGetpApp()->GetPool(),
+                         svl::Items<SID_ATTR_MACROITEM,
+                                    SID_ATTR_MACROITEM>{} );
+    aItemSet.Put ( aItem );
 
     DisableClose( true );
 
-    SfxMacroAssignDlg aDlg(mpDialog->getDialog(), mxDocumentFrame, *pItemSet);
+    SfxMacroAssignDlg aDlg(mpDialog->getDialog(), mxDocumentFrame, aItemSet);
 
     // add events
     SfxMacroTabPage *pMacroPage = aDlg.GetTabPage();
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index fe28821bed62..03ad7038fc75 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -792,7 +792,7 @@ bool callColumnFormatDialog(weld::Widget* _pParent,
     pPool->SetDefaultMetric( MapUnit::MapTwip );    // ripped, don't understand why
     pPool->FreezeIdRanges();                        // the same
 
-    std::unique_ptr<SfxItemSet> pFormatDescriptor(new SfxItemSet(*pPool, aAttrMap));
+    std::optional<SfxItemSet> pFormatDescriptor(SfxItemSet(*pPool, aAttrMap));
     // fill it
     pFormatDescriptor->Put(SvxHorJustifyItem(_eJustify, SBA_ATTR_ALIGN_HOR_JUSTIFY));
     bool bText = false;
@@ -818,7 +818,7 @@ bool callColumnFormatDialog(weld::Widget* _pParent,
     }
 
     {   // want the dialog to be destroyed before our set
-        SbaSbAttrDlg aDlg(_pParent, pFormatDescriptor.get(), _pFormatter, _bHasFormat);
+        SbaSbAttrDlg aDlg(_pParent, &*pFormatDescriptor, _pFormatter, _bHasFormat);
         if (RET_OK == aDlg.run())
         {
             // ItemSet->UNO
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 2b806af28aeb..2cf762e48f8c 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -733,11 +733,11 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep
     bool bSuccess = false;
     try
     {
-        ::std::unique_ptr<SfxItemSet> pDescriptor( new SfxItemSet( *pPool, pRanges ) );
-        lcl_CharPropertiesToItems( _rxReportControlFormat, *pDescriptor );
+        SfxItemSet aDescriptor( *pPool, pRanges );
+        lcl_CharPropertiesToItems( _rxReportControlFormat, aDescriptor );
 
         {   // want the dialog to be destroyed before our set
-            ORptPageDialog aDlg(Application::GetFrameWeld(_rxParentWindow), pDescriptor.get(), "CharDialog");
+            ORptPageDialog aDlg(Application::GetFrameWeld(_rxParentWindow), &aDescriptor, "CharDialog");
             uno::Reference< report::XShape > xShape( _rxReportControlFormat, uno::UNO_QUERY );
             if ( xShape.is() )
                 aDlg.RemoveTabPage("background");
@@ -776,12 +776,12 @@ bool openAreaDialog( const uno::Reference<report::XShape >& _xShape,const uno::R
     try
     {
         SfxItemPool& rItemPool = pModel->GetItemPool();
-        ::std::unique_ptr<SfxItemSet> pDescriptor( new SfxItemSet( rItemPool, {{rItemPool.GetFirstWhich(),rItemPool.GetLastWhich()}} ) );
-        lcl_fillShapeToItems(_xShape,*pDescriptor);
+        SfxItemSet aDescriptor( rItemPool, {{rItemPool.GetFirstWhich(),rItemPool.GetLastWhich()}} );
+        lcl_fillShapeToItems(_xShape, aDescriptor);
 
         {   // want the dialog to be destroyed before our set
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-            ScopedVclPtr<AbstractSvxAreaTabDialog> pDialog(pFact->CreateSvxAreaTabDialog(pParent, pDescriptor.get(), pModel.get(), true));
+            ScopedVclPtr<AbstractSvxAreaTabDialog> pDialog(pFact->CreateSvxAreaTabDialog(pParent, &aDescriptor, pModel.get(), true));
             if ( RET_OK == pDialog->Execute() )
             {
                 bSuccess = true;
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 03bfb73160a1..e08bc607b6ca 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -2418,18 +2418,18 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
 
     try
     {
-        ::std::unique_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges));
+        SfxItemSet aDescriptor(*pPool, pRanges);
         // fill it
         if ( _xSection.is() )
-            pDescriptor->Put(SvxBrushItem(::Color(ColorTransparency, _xSection->getBackColor()),RPTUI_ID_BRUSH));
+            aDescriptor.Put(SvxBrushItem(::Color(ColorTransparency, _xSection->getBackColor()),RPTUI_ID_BRUSH));
         else
         {
-            pDescriptor->Put(SvxSizeItem(RPTUI_ID_SIZE,VCLSize(getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE))));
-            pDescriptor->Put(SvxLRSpaceItem(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN)
+            aDescriptor.Put(SvxSizeItem(RPTUI_ID_SIZE,VCLSize(getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE))));
+            aDescriptor.Put(SvxLRSpaceItem(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN)
                                             ,getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN),0,0,RPTUI_ID_LRSPACE));
-            pDescriptor->Put(SvxULSpaceItem(static_cast<sal_uInt16>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_TOPMARGIN))
+            aDescriptor.Put(SvxULSpaceItem(static_cast<sal_uInt16>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_TOPMARGIN))
                                             ,static_cast<sal_uInt16>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BOTTOMMARGIN)),RPTUI_ID_ULSPACE));
-            pDescriptor->Put(SfxUInt16Item(SID_ATTR_METRIC,static_cast<sal_uInt16>(eUserMetric)));
+            aDescriptor.Put(SfxUInt16Item(SID_ATTR_METRIC,static_cast<sal_uInt16>(eUserMetric)));
 
             uno::Reference< style::XStyle> xPageStyle(getUsedStyle(m_xReportDefinition));
             if ( xPageStyle.is() )
@@ -2440,14 +2440,14 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
                 aPageItem.PutValue(xProp->getPropertyValue(PROPERTY_PAGESTYLELAYOUT),MID_PAGE_LAYOUT);
                 aPageItem.SetLandscape(getStyleProperty<bool>(m_xReportDefinition,PROPERTY_ISLANDSCAPE));
                 aPageItem.SetNumType(static_cast<SvxNumType>(getStyleProperty<sal_Int16>(m_xReportDefinition,PROPERTY_NUMBERINGTYPE)));
-                pDescriptor->Put(aPageItem);
-                pDescriptor->Put(SvxBrushItem(::Color(ColorTransparency, getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BACKCOLOR)),RPTUI_ID_BRUSH));
+                aDescriptor.Put(aPageItem);
+                aDescriptor.Put(SvxBrushItem(::Color(ColorTransparency, getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BACKCOLOR)),RPTUI_ID_BRUSH));
             }
         }
 
         {   // want the dialog to be destroyed before our set
             ORptPageDialog aDlg(
-                getFrameWeld(), pDescriptor.get(),_xSection.is()
+                getFrameWeld(), &aDescriptor,_xSection.is()
                            ? OUString("BackgroundDialog")
                            : OUString("PageDialog"));
             if (aDlg.run() == RET_OK)
@@ -4223,13 +4223,13 @@ void OReportController::openZoomDialog()
     pPool->FreezeIdRanges();                        // the same
     try
     {
-        ::std::unique_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges));
+        SfxItemSet aDescriptor(*pPool, pRanges);
         // fill it
         SvxZoomItem aZoomItem( m_eZoomType, m_nZoomValue, SID_ATTR_ZOOM );
         aZoomItem.SetValueSet(SvxZoomEnableFlags::N100|SvxZoomEnableFlags::WHOLEPAGE|SvxZoomEnableFlags::PAGEWIDTH);
-        pDescriptor->Put(aZoomItem);
+        aDescriptor.Put(aZoomItem);
 
-        ScopedVclPtr<AbstractSvxZoomDialog> pDlg(pFact->CreateSvxZoomDialog(nullptr, *pDescriptor));
+        ScopedVclPtr<AbstractSvxZoomDialog> pDlg(pFact->CreateSvxZoomDialog(nullptr, aDescriptor));
         pDlg->SetLimits( 20, 400 );
         bool bCancel = ( RET_CANCEL == pDlg->Execute() );
 
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 4a46f3d69c90..f60fba27b4d2 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -440,19 +440,19 @@ void ScDrawShell::ExecuteMacroAssign(SdrObject* pObj, weld::Window* pWin)
     }
 
     // create empty itemset for macro-dlg
-    std::unique_ptr<SfxItemSet> pItemSet(new SfxItemSet(SfxGetpApp()->GetPool(), svl::Items<SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG>{} ));
-    pItemSet->Put ( aItem );
+    SfxItemSet aItemSet(SfxGetpApp()->GetPool(), svl::Items<SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG>{} );
+    aItemSet.Put ( aItem );
 
     SfxEventNamesItem aNamesItem(SID_EVENTCONFIG);
     aNamesItem.AddEvent( ScResId(RID_SCSTR_ONCLICK), OUString(), SvMacroItemId::OnClick );
-    pItemSet->Put( aNamesItem );
+    aItemSet.Put( aNamesItem );
 
     css::uno::Reference < css::frame::XFrame > xFrame;
     if (GetViewShell())
         xFrame = GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface();
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-    ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog( pWin, *pItemSet, xFrame ));
+    ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog( pWin, aItemSet, xFrame ));
     if ( pMacroDlg->Execute() != RET_OK )
         return;
 
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 865b129c6610..a418f3185c8a 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1393,7 +1393,7 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq )
     const ScPatternAttr*    pAttrs      = pTabViewShell->GetSelectionPattern();
     const SfxItemSet*       pSet        = rReq.GetArgs();
     sal_uInt16                  nSlot       = rReq.GetSlot();
-    std::unique_ptr<SfxAllItemSet> pNewSet;
+    std::optional<SfxAllItemSet> pNewSet;
 
     pTabViewShell->HideListBox();                   // Autofilter-DropDown-Listbox
 
@@ -1405,7 +1405,7 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq )
         ||(nSlot == SID_ULINE_VAL_DOUBLE)
         ||(nSlot == SID_ULINE_VAL_DOTTED) )
     {
-        pNewSet.reset(new SfxAllItemSet( GetPool() ));
+        pNewSet.emplace( GetPool() );
 
         switch ( nSlot )
         {
@@ -1897,16 +1897,12 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
                 {
                     ::editeng::SvxBorderLine*          pDefLine = pTabViewShell->GetDefaultFrameLine();
                     const ScPatternAttr*    pOldAttrs = pTabViewShell->GetSelectionPattern();
-                    std::unique_ptr<SfxItemSet> pOldSet(
-                                                new SfxItemSet(
-                                                        *rDoc.GetPool(),
-                                                        svl::Items<ATTR_PATTERN_START,
-                                                        ATTR_PATTERN_END>{} ));
-                    std::unique_ptr<SfxItemSet> pNewSet(
-                                                new SfxItemSet(
-                                                        *rDoc.GetPool(),
-                                                        svl::Items<ATTR_PATTERN_START,
-                                                        ATTR_PATTERN_END>{} ));
+                    SfxItemSet aOldSet( *rDoc.GetPool(),
+                                        svl::Items<ATTR_PATTERN_START,
+                                                    ATTR_PATTERN_END>{} );
+                    SfxItemSet aNewSet( *rDoc.GetPool(),
+                                        svl::Items<ATTR_PATTERN_START,
+                                                    ATTR_PATTERN_END>{} );
                     const SfxPoolItem&      rBorderAttr =
                                                 pOldAttrs->GetItemSet().
                                                     Get( ATTR_BORDER );
@@ -1931,7 +1927,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
                             aBoxItem.SetLine( pDefLine, SvxBoxItemLine::LEFT );
                         if ( aBoxItem.GetRight() && aBoxItem.GetRight()->GetOutWidth() == 0 )
                             aBoxItem.SetLine( pDefLine, SvxBoxItemLine::RIGHT );
-                        pNewSet->Put( aBoxItem );
+                        aNewSet.Put( aBoxItem );
                         rReq.AppendItem( aBoxItem );
                     }
 
@@ -1943,7 +1939,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
                             aBoxInfoItem.SetLine( pDefLine, SvxBoxInfoItemLine::HORI );
                         if ( aBoxInfoItem.GetVert() && aBoxInfoItem.GetVert()->GetOutWidth() == 0 )
                             aBoxInfoItem.SetLine( pDefLine, SvxBoxInfoItemLine::VERT );
-                        pNewSet->Put( aBoxInfoItem );
+                        aNewSet.Put( aBoxInfoItem );
                         rReq.AppendItem( aBoxInfoItem );
                     }
                     else
@@ -1951,11 +1947,11 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
                         SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER );
                         aBoxInfoItem.SetLine( nullptr, SvxBoxInfoItemLine::HORI );
                         aBoxInfoItem.SetLine( nullptr, SvxBoxInfoItemLine::VERT );
-                        pNewSet->Put( aBoxInfoItem );
+                        aNewSet.Put( aBoxInfoItem );
                     }
 
-                    pOldSet->Put( rBorderAttr );
-                    pTabViewShell->ApplyAttributes( pNewSet.get(), pOldSet.get() );
+                    aOldSet.Put( rBorderAttr );
+                    pTabViewShell->ApplyAttributes( &aNewSet, &aOldSet );
                 }
                 break;
 
@@ -1963,8 +1959,8 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
             case SID_ATTR_BORDER_DIAG_BLTR:
                 {
                     const ScPatternAttr* pOldAttrs = pTabViewShell->GetSelectionPattern();
-                    std::unique_ptr<SfxItemSet> pOldSet(new SfxItemSet(pOldAttrs->GetItemSet()));
-                    std::unique_ptr<SfxItemSet> pNewSet(new SfxItemSet(pOldAttrs->GetItemSet()));
+                    SfxItemSet aOldSet(pOldAttrs->GetItemSet());
+                    SfxItemSet aNewSet(pOldAttrs->GetItemSet());
                     const SfxPoolItem* pItem = nullptr;
 
                     if(SID_ATTR_BORDER_DIAG_TLBR == nSlot)
@@ -1973,9 +1969,9 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
                         {
                             SvxLineItem aItem(ATTR_BORDER_TLBR);
                             aItem.SetLine(pNewAttrs->Get(ATTR_BORDER_TLBR).GetLine());
-                            pNewSet->Put(aItem);
+                            aNewSet.Put(aItem);
                             rReq.AppendItem(aItem);
-                            pTabViewShell->ApplyAttributes(pNewSet.get(), pOldSet.get());
+                            pTabViewShell->ApplyAttributes(&aNewSet, &aOldSet);
                         }
                     }
                     else // if( nSlot == SID_ATTR_BORDER_DIAG_BLTR )
@@ -1984,9 +1980,9 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
                         {
                             SvxLineItem aItem(ATTR_BORDER_BLTR);
                             aItem.SetLine(pNewAttrs->Get(ATTR_BORDER_BLTR).GetLine());
-                            pNewSet->Put(aItem);
+                            aNewSet.Put(aItem);
                             rReq.AppendItem(aItem);
-                            pTabViewShell->ApplyAttributes(pNewSet.get(), pOldSet.get());
+                            pTabViewShell->ApplyAttributes(&aNewSet, &aOldSet);
                         }
                     }
 
diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index c9285866485a..39107879287c 100644
--- a/sc/source/ui/view/spelleng.cxx
+++ b/sc/source/ui/view/spelleng.cxx
@@ -83,7 +83,7 @@ bool ScConversionEngineBase::FindNextConversionCell()
     const ScPatternAttr* pPattern = nullptr;
     const ScPatternAttr* pLastPattern = nullptr;
 
-    std::unique_ptr<SfxItemSet> pEditDefaults(new SfxItemSet(GetEmptyItemSet()));
+    SfxItemSet aEditDefaults(GetEmptyItemSet());
 
     if( IsModified() )
     {
@@ -183,8 +183,8 @@ bool ScConversionEngineBase::FindNextConversionCell()
                 pPattern = mrDoc.GetPattern( nNewCol, nNewRow, mnStartTab );
                 if( pPattern && (pPattern != pLastPattern) )
                 {
-                    pPattern->FillEditItemSet( pEditDefaults.get() );
-                    SetDefaults( *pEditDefaults );
+                    pPattern->FillEditItemSet( &aEditDefaults );
+                    SetDefaults( aEditDefaults );
                     pLastPattern = pPattern;
                 }
 
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index b3febf088c8d..fe9778297853 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -3332,14 +3332,12 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine,
     // none of the lines don't care?
     if( (eItemState != SfxItemState::DONTCARE) && (eTLBRState != SfxItemState::DONTCARE) && (eBLTRState != SfxItemState::DONTCARE) )
     {
-        std::unique_ptr<SfxItemSet> pOldSet(new SfxItemSet(
-                                        *rDoc.GetPool(),
-                                        svl::Items<ATTR_PATTERN_START,
-                                        ATTR_PATTERN_END>{} ));
-        std::unique_ptr<SfxItemSet> pNewSet(new SfxItemSet(
-                                        *rDoc.GetPool(),
-                                        svl::Items<ATTR_PATTERN_START,
-                                        ATTR_PATTERN_END>{} ));
+        SfxItemSet aOldSet( *rDoc.GetPool(),
+                            svl::Items<ATTR_PATTERN_START,
+                                        ATTR_PATTERN_END>{} );
+        SfxItemSet aNewSet(*rDoc.GetPool(),
+                            svl::Items<ATTR_PATTERN_START,
+                                        ATTR_PATTERN_END>{} );
 
         SvxBorderLine           aLine;
 
@@ -3359,9 +3357,9 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine,
             aBoxInfoItem.SetLine( aBoxItem.GetLeft(), SvxBoxInfoItemLine::VERT );
             aBoxInfoItem.ResetFlags(); // set Lines to Valid
 
-            pOldSet->Put( *pBorderAttr );
-            pNewSet->Put( aBoxItem );
-            pNewSet->Put( aBoxInfoItem );
+            aOldSet.Put( *pBorderAttr );
+            aNewSet.Put( aBoxItem );
+            aNewSet.Put( aBoxInfoItem );
         }
 
         if( pTLBRItem && static_cast<const SvxLineItem*>(pTLBRItem)->GetLine() )
@@ -3369,8 +3367,8 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine,
             SvxLineItem aTLBRItem( *static_cast<const SvxLineItem*>(pTLBRItem) );
             UpdateLineAttrs( aLine, aTLBRItem.GetLine(), pLine, bColorOnly );
             aTLBRItem.SetLine( &aLine );
-            pOldSet->Put( *pTLBRItem );
-            pNewSet->Put( aTLBRItem );
+            aOldSet.Put( *pTLBRItem );
+            aNewSet.Put( aTLBRItem );
         }
 
         if( pBLTRItem && static_cast<const SvxLineItem*>(pBLTRItem)->GetLine() )
@@ -3378,11 +3376,11 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine,
             SvxLineItem aBLTRItem( *static_cast<const SvxLineItem*>(pBLTRItem) );
             UpdateLineAttrs( aLine, aBLTRItem.GetLine(), pLine, bColorOnly );
             aBLTRItem.SetLine( &aLine );
-            pOldSet->Put( *pBLTRItem );
-            pNewSet->Put( aBLTRItem );
+            aOldSet.Put( *pBLTRItem );
+            aNewSet.Put( aBLTRItem );
         }
 
-        ApplyAttributes( pNewSet.get(), pOldSet.get() );
+        ApplyAttributes( &aNewSet, &aOldSet );
     }
     else // if ( eItemState == SfxItemState::DONTCARE )
     {
diff --git a/sd/source/ui/func/fuline.cxx b/sd/source/ui/func/fuline.cxx
index 7908505d2326..245b9ed64be4 100644
--- a/sd/source/ui/func/fuline.cxx
+++ b/sd/source/ui/func/fuline.cxx
@@ -62,12 +62,12 @@ void FuLine::DoExecute( SfxRequest& rReq )
     if( rMarkList.GetMarkCount() == 1 )
         pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
 
-    std::unique_ptr<SfxItemSet> pNewAttr(new SfxItemSet( mpDoc->GetPool() ));
-    mpView->GetAttributes( *pNewAttr );
+    SfxItemSet aNewAttr( mpDoc->GetPool() );
+    mpView->GetAttributes( aNewAttr );
 
     bool bHasMarked = mpView->AreObjectsMarked();
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-    VclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSvxLineTabDialog(mpViewShell->GetFrameWeld(), pNewAttr.get(), mpDoc, pObj, bHasMarked) );
+    VclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSvxLineTabDialog(mpViewShell->GetFrameWeld(), &aNewAttr, mpDoc, pObj, bHasMarked) );
 
     pDlg->StartExecuteAsync([pDlg, this](sal_Int32 nResult){
         if (nResult == RET_OK)
diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx
index aa4ef5f36a2f..0909d8536fcd 100644
--- a/sd/source/ui/view/drviews9.cxx
+++ b/sd/source/ui/view/drviews9.cxx
@@ -204,9 +204,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
     CheckLineTo (rReq);
 
     SfxBindings&    rBindings = GetViewFrame()->GetBindings();
-    std::unique_ptr<SfxItemSet> pAttr(new SfxItemSet ( GetDoc()->GetPool() ));
+    SfxItemSet aAttr( GetDoc()->GetPool() );
 
-    GetView()->GetAttributes( *pAttr );
+    GetView()->GetAttributes( aAttr );
     const SfxItemSet* pArgs = rReq.GetArgs();
 
     switch (rReq.GetSlot ())
@@ -218,10 +218,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
                 const SfxUInt32Item* pFillStyle = rReq.GetArg<SfxUInt32Item>(ID_VAL_STYLE);
                 if (CHECK_RANGE (drawing::FillStyle_NONE, static_cast<drawing::FillStyle>(pFillStyle->GetValue ()), drawing::FillStyle_BITMAP))
                 {
-                    pAttr->ClearItem (XATTR_FILLSTYLE);
+                    aAttr.ClearItem (XATTR_FILLSTYLE);
                     XFillStyleItem aStyleItem(static_cast<drawing::FillStyle>(pFillStyle->GetValue ()));
                     aStyleItem.SetWhich(XATTR_FILLSTYLE);
-                    pAttr->Put (aStyleItem);
+                    aAttr.Put (aStyleItem);
                     rBindings.Invalidate (SID_ATTR_FILL_STYLE);
                     rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
                 }
@@ -242,10 +242,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
                 const SfxUInt32Item* pLineStyle = rReq.GetArg<SfxUInt32Item>(ID_VAL_STYLE);
                 if (CHECK_RANGE (sal_Int32(drawing::LineStyle_NONE), static_cast<sal_Int32>(pLineStyle->GetValue()), sal_Int32(drawing::LineStyle_DASH)))
                 {
-                    pAttr->ClearItem (XATTR_LINESTYLE);
+                    aAttr.ClearItem (XATTR_LINESTYLE);
                     XLineStyleItem aStyleItem(static_cast<drawing::LineStyle>(pLineStyle->GetValue()));
                     aStyleItem.SetWhich(XATTR_LINESTYLE);
-                    pAttr->Put(aStyleItem);
+                    aAttr.Put(aStyleItem);
                     rBindings.Invalidate (SID_ATTR_LINE_STYLE);
                 }
 #if HAVE_FEATURE_SCRIPTING
@@ -263,10 +263,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
             if (pArgs && pArgs->Count () == 1)
             {
                 const SfxUInt32Item* pLineWidth = rReq.GetArg<SfxUInt32Item>(ID_VAL_WIDTH);
-                pAttr->ClearItem (XATTR_LINEWIDTH);
+                aAttr.ClearItem (XATTR_LINEWIDTH);
                 XLineWidthItem aWidthItem(pLineWidth->GetValue());
                 aWidthItem.SetWhich(XATTR_LINEWIDTH);
-                pAttr->Put(aWidthItem);
+                aAttr.Put(aWidthItem);
                 rBindings.Invalidate (SID_ATTR_LINE_WIDTH);
                 break;
             }
@@ -282,13 +282,13 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
                 const SfxUInt32Item* pGreen = rReq.GetArg<SfxUInt32Item>(ID_VAL_GREEN);
                 const SfxUInt32Item* pBlue = rReq.GetArg<SfxUInt32Item>(ID_VAL_BLUE);
 
-                pAttr->ClearItem (XATTR_FILLCOLOR);
-                pAttr->ClearItem (XATTR_FILLSTYLE);
+                aAttr.ClearItem (XATTR_FILLCOLOR);
+                aAttr.ClearItem (XATTR_FILLSTYLE);
                 XFillColorItem aColorItem(-1, Color (static_cast<sal_uInt8>(pRed->GetValue ()),
                                                        static_cast<sal_uInt8>(pGreen->GetValue ()),
                                                        static_cast<sal_uInt8>(pBlue->GetValue ())));
                 aColorItem.SetWhich(XATTR_FILLCOLOR);
-                pAttr->Put(aColorItem);
+                aAttr.Put(aColorItem);
                 rBindings.Invalidate (SID_ATTR_FILL_COLOR);
                 rBindings.Invalidate (SID_ATTR_PAGE_COLOR);
                 rBindings.Invalidate (SID_ATTR_FILL_STYLE);
@@ -307,12 +307,12 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
                 const SfxUInt32Item* pGreen = rReq.GetArg<SfxUInt32Item>(ID_VAL_GREEN);
                 const SfxUInt32Item* pBlue = rReq.GetArg<SfxUInt32Item>(ID_VAL_BLUE);
 
-                pAttr->ClearItem (XATTR_LINECOLOR);
+                aAttr.ClearItem (XATTR_LINECOLOR);
                 XLineColorItem aColorItem(-1, Color(static_cast<sal_uInt8>(pRed->GetValue()),
                                                     static_cast<sal_uInt8>(pGreen->GetValue()),
                                                     static_cast<sal_uInt8>(pBlue->GetValue())));
                 aColorItem.SetWhich(XATTR_LINECOLOR);
-                pAttr->Put(aColorItem);
+                aAttr.Put(aColorItem);
                 rBindings.Invalidate (SID_ATTR_LINE_COLOR);
                 break;
             }
@@ -337,8 +337,8 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
                                       static_cast<sal_uInt8>(pBlue->GetValue ()));
                 ::tools::Long i;
 
-                pAttr->ClearItem (XATTR_FILLGRADIENT);
-                pAttr->ClearItem (XATTR_FILLSTYLE);
+                aAttr.ClearItem (XATTR_FILLGRADIENT);
+                aAttr.ClearItem (XATTR_FILLSTYLE);
 
                 for ( i = 0; i < nCounts; i ++)
                 {
@@ -353,10 +353,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
 
                         XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
                         aStyleItem.SetWhich(XATTR_FILLSTYLE);
-                        pAttr->Put(aStyleItem);
+                        aAttr.Put(aStyleItem);
                         XFillGradientItem aGradientItem(pName->GetValue (), aGradient);
                         aGradientItem.SetWhich(XATTR_FILLGRADIENT);
-                        pAttr->Put(aGradientItem);
+                        aAttr.Put(aGradientItem);
                         break;
                     }
                 }
@@ -375,10 +375,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
 
                     XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
                     aStyleItem.SetWhich(XATTR_FILLSTYLE);
-                    pAttr->Put(aStyleItem);
+                    aAttr.Put(aStyleItem);
                     XFillGradientItem aGradientItem(pName->GetValue(), aGradient);
                     aGradientItem.SetWhich(XATTR_FILLGRADIENT);
-                    pAttr->Put(aGradientItem);
+                    aAttr.Put(aGradientItem);
                 }
 
                 rBindings.Invalidate (SID_ATTR_FILL_STYLE);
@@ -407,8 +407,8 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
                                    static_cast<sal_uInt8>(pBlue->GetValue ()));
                 ::tools::Long i;
 
-                pAttr->ClearItem (XATTR_FILLHATCH);
-                pAttr->ClearItem (XATTR_FILLSTYLE);
+                aAttr.ClearItem (XATTR_FILLHATCH);
+                aAttr.ClearItem (XATTR_FILLSTYLE);
 
                 for ( i = 0; i < nCounts; i ++)
                 {
@@ -422,10 +422,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
 
                         XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
                         aStyleItem.SetWhich(XATTR_FILLSTYLE);
-                        pAttr->Put(aStyleItem);
+                        aAttr.Put(aStyleItem);
                         XFillHatchItem aHatchItem(pName->GetValue(), aHatch);
                         aHatchItem.SetWhich(XATTR_FILLHATCH);
-                        pAttr->Put(aHatchItem);
+                        aAttr.Put(aHatchItem);
                         break;
                     }
                 }
@@ -438,10 +438,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
 
                     XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
                     aStyleItem.SetWhich(XATTR_FILLSTYLE);
-                    pAttr->Put(aStyleItem);
+                    aAttr.Put(aStyleItem);
                     XFillHatchItem aHatchItem(pName->GetValue (), aHatch);
                     aHatchItem.SetWhich(XATTR_FILLHATCH);
-                    pAttr->Put(aHatchItem);
+                    aAttr.Put(aHatchItem);
                 }
 
                 rBindings.Invalidate (SID_ATTR_FILL_HATCH);
@@ -472,8 +472,8 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
                     XDash aNewDash (static_cast<css::drawing::DashStyle>(pStyle->GetValue ()), static_cast<short>(pDots->GetValue ()), pDotLen->GetValue (),
                                     static_cast<short>(pDashes->GetValue ()), pDashLen->GetValue (), pDistance->GetValue ());
 
-                    pAttr->ClearItem (XATTR_LINEDASH);
-                    pAttr->ClearItem (XATTR_LINESTYLE);
+                    aAttr.ClearItem (XATTR_LINEDASH);
+                    aAttr.ClearItem (XATTR_LINESTYLE);
 
                     XDashListRef pDashList = GetDoc()->GetDashList();
                     ::tools::Long       nCounts    = pDashList->Count ();
@@ -491,10 +491,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
 
                     XLineDashItem aDashItem(pName->GetValue(), aNewDash);
                     aDashItem.SetWhich(XATTR_LINEDASH);
-                    pAttr->Put(aDashItem);
+                    aAttr.Put(aDashItem);
                     XLineStyleItem aStyleItem(drawing::LineStyle_DASH);
                     aStyleItem.SetWhich(XATTR_LINESTYLE);
-                    pAttr->Put(aStyleItem);
+                    aAttr.Put(aStyleItem);
                     rBindings.Invalidate (SID_ATTR_LINE_DASH);
                     rBindings.Invalidate (SID_ATTR_FILL_STYLE);
                 }
@@ -529,8 +529,8 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
                     CHECK_RANGE (0, static_cast<sal_Int32>(pStart->GetValue ()), 100) &&
                     CHECK_RANGE (0, static_cast<sal_Int32>(pEnd->GetValue ()), 100))
                 {
-                    pAttr->ClearItem (XATTR_FILLGRADIENT);
-                    pAttr->ClearItem (XATTR_FILLSTYLE);
+                    aAttr.ClearItem (XATTR_FILLGRADIENT);
+                    aAttr.ClearItem (XATTR_FILLSTYLE);
 
                     XGradientListRef pGradientList = GetDoc()->GetGradientList ();
                     ::tools::Long           nCounts        = pGradientList->Count ();
@@ -554,10 +554,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
 
                             XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
                             aStyleItem.SetWhich(XATTR_FILLSTYLE);
-                            pAttr->Put(aStyleItem);
+                            aAttr.Put(aStyleItem);
                             XFillGradientItem aGradientItem(pName->GetValue (), aGradient);
                             aGradientItem.SetWhich(XATTR_FILLGRADIENT);
-                            pAttr->Put(aGradientItem);
+                            aAttr.Put(aGradientItem);
                             break;
                         }
                     }
@@ -573,10 +573,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
                         pGradientList->Insert(std::make_unique<XGradientEntry>(aGradient, pName->GetValue()));
                         XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
                         aStyleItem.SetWhich(XATTR_FILLSTYLE);
-                        pAttr->Put(aStyleItem);
+                        aAttr.Put(aStyleItem);
                         XFillGradientItem aGradientItem(pName->GetValue (), aGradient);
                         aGradientItem.SetWhich(XATTR_FILLGRADIENT);
-                        pAttr->Put(aGradientItem);
+                        aAttr.Put(aGradientItem);
                     }
 
                     rBindings.Invalidate (SID_ATTR_FILL_GRADIENT);
@@ -606,8 +606,8 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
                 if (CHECK_RANGE (sal_Int32(css::drawing::HatchStyle_SINGLE), static_cast<sal_Int32>(pStyle->GetValue()), sal_Int32(css::drawing::HatchStyle_TRIPLE)) &&
                     CHECK_RANGE (0, static_cast<sal_Int32>(pAngle->GetValue ()), 360))
                 {
-                    pAttr->ClearItem (XATTR_FILLHATCH);
-                    pAttr->ClearItem (XATTR_FILLSTYLE);
+                    aAttr.ClearItem (XATTR_FILLHATCH);
+                    aAttr.ClearItem (XATTR_FILLSTYLE);
 
                     XHatchListRef pHatchList = GetDoc()->GetHatchList ();
                     ::tools::Long       nCounts     = pHatchList->Count ();
@@ -627,10 +627,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
 
                             XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
                             aStyleItem.SetWhich(XATTR_FILLSTYLE);
-                            pAttr->Put(aStyleItem);
+                            aAttr.Put(aStyleItem);
                             XFillHatchItem aHatchItem(pName->GetValue (), aHatch);
                             aHatchItem.SetWhich(XATTR_FILLHATCH);
-                            pAttr->Put(aHatchItem);
+                            aAttr.Put(aHatchItem);
                             break;
                         }
                     }
@@ -643,10 +643,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
                         pHatchList->Insert(std::make_unique<XHatchEntry>(aHatch, pName->GetValue()));
                         XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
                         aStyleItem.SetWhich(XATTR_FILLSTYLE);
-                        pAttr->Put(aStyleItem);
+                        aAttr.Put(aStyleItem);
                         XFillHatchItem aHatchItem(pName->GetValue (), aHatch);
                         aHatchItem.SetWhich(XATTR_FILLHATCH);
-                        pAttr->Put(aHatchItem);
+                        aAttr.Put(aHatchItem);
                     }
 
                     rBindings.Invalidate (SID_ATTR_FILL_HATCH);
@@ -676,14 +676,14 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
 
                     if (pEntry->GetName () == pName->GetValue ())
                     {
-                        pAttr->ClearItem (XATTR_FILLGRADIENT);
-                        pAttr->ClearItem (XATTR_FILLSTYLE);
+                        aAttr.ClearItem (XATTR_FILLGRADIENT);
+                        aAttr.ClearItem (XATTR_FILLSTYLE);
                         XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
                         aStyleItem.SetWhich(XATTR_FILLSTYLE);
-                        pAttr->Put(aStyleItem);
+                        aAttr.Put(aStyleItem);
                         XFillGradientItem aGradientItem(pName->GetValue (), pEntry->GetGradient ());
                         aGradientItem.SetWhich(XATTR_FILLGRADIENT);
-                        pAttr->Put(aGradientItem);
+                        aAttr.Put(aGradientItem);
                         rBindings.Invalidate (SID_ATTR_FILL_GRADIENT);
                         rBindings.Invalidate (SID_ATTR_PAGE_GRADIENT);
                         rBindings.Invalidate (SID_ATTR_FILL_STYLE);
@@ -713,14 +713,14 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
 
                     if (pEntry->GetName () == pName->GetValue ())
                     {
-                        pAttr->ClearItem (XATTR_FILLHATCH);
-                        pAttr->ClearItem (XATTR_FILLSTYLE);
+                        aAttr.ClearItem (XATTR_FILLHATCH);
+                        aAttr.ClearItem (XATTR_FILLSTYLE);
                         XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
                         aStyleItem.SetWhich(XATTR_FILLSTYLE);
-                        pAttr->Put(aStyleItem);
+                        aAttr.Put(aStyleItem);
                         XFillHatchItem aHatchItem(pName->GetValue (), pEntry->GetHatch ());
                         aHatchItem.SetWhich(XATTR_FILLHATCH);
-                        pAttr->Put(aHatchItem);
+                        aAttr.Put(aHatchItem);
 
                         rBindings.Invalidate (SID_ATTR_FILL_HATCH);
                         rBindings.Invalidate (SID_ATTR_PAGE_HATCH);
@@ -774,7 +774,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
             ;
     }
 
-    mpDrawView->SetAttributes (*const_cast<const SfxItemSet *>(pAttr.get()));
+    mpDrawView->SetAttributes (const_cast<const SfxItemSet &>(aAttr));
     rReq.Ignore ();
 }
 
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index a7e4346c0d48..6228266abeb6 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -730,12 +730,12 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL,
                     }
 
                     eMapUnit = GetCoreMetric( pShell->GetPool(), GetId() );
-                    std::unique_ptr<SfxAllItemSet> xSet(new SfxAllItemSet(pShell->GetPool()));
+                    std::optional<SfxAllItemSet> xSet(pShell->GetPool());
                     TransformParameters(GetId(), lNewArgs, *xSet, pSlot);
                     if (xSet->Count())
                     {
                         // execute with arguments - call directly
-                        pItem = pDispatcher->Execute(GetId(), nCall, xSet.get(), &aInternalSet, nModifier);
+                        pItem = pDispatcher->Execute(GetId(), nCall, &*xSet, &aInternalSet, nModifier);
                         if ( pItem != nullptr )
                         {
                             if (const SfxBoolItem* pBoolItem = dynamic_cast<const SfxBoolItem*>(pItem))
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 0af671f6ae0a..5ef7e7829da5 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1617,7 +1617,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const    Sequence< beans::PropertyValue >
             [](const beans::PropertyValue& rProp) { return rProp.Name != "CheckIn"; });
     }
 
-    std::unique_ptr<SfxAllItemSet> pParams(new SfxAllItemSet( SfxGetpApp()->GetPool() ));
+    std::optional<SfxAllItemSet> pParams(SfxGetpApp()->GetPool() );
     TransformParameters( nSlotId, aArgs, *pParams );
 
     SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::SaveDoc, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOC), m_pData->m_pObjectShell.get() ) );
@@ -1639,7 +1639,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const    Sequence< beans::PropertyValue >
         }
         else
         {
-            bRet = m_pData->m_pObjectShell->Save_Impl( pParams.get() );
+            bRet = m_pData->m_pObjectShell->Save_Impl( &*pParams );
         }
     }
     else
@@ -1648,9 +1648,9 @@ void SAL_CALL SfxBaseModel::storeSelf( const    Sequence< beans::PropertyValue >
         m_pData->m_pObjectShell->GetMedium( )->SetInCheckIn( nSlotId == SID_CHECKIN );
         if (bOnMainThread)
             bRet = vcl::solarthread::syncExecute(
-                [this, &pParams] { return m_pData->m_pObjectShell->Save_Impl(pParams.get()); });
+                [this, &pParams] { return m_pData->m_pObjectShell->Save_Impl(&*pParams); });
         else
-            bRet = m_pData->m_pObjectShell->Save_Impl(pParams.get());
+            bRet = m_pData->m_pObjectShell->Save_Impl(&*pParams);
         m_pData->m_pObjectShell->GetMedium( )->SetInCheckIn( nSlotId != SID_CHECKIN );
     }
 
@@ -3056,7 +3056,7 @@ void SfxBaseModel::impl_store(  const   OUString&                   sURL
     SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SfxEventHintId::SaveToDoc : SfxEventHintId::SaveAsDoc, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOC : GlobalEventId::SAVEASDOC ),
                                             m_pData->m_pObjectShell.get() ) );
 
-    std::unique_ptr<SfxAllItemSet> pItemSet(new SfxAllItemSet(SfxGetpApp()->GetPool()));
+    std::optional<SfxAllItemSet> pItemSet(SfxGetpApp()->GetPool());
     pItemSet->Put(SfxStringItem(SID_FILE_NAME, sURL));
     if ( bSaveTo )
         pItemSet->Put(SfxBoolItem(SID_SAVETO, true));
diff --git a/svx/source/dialog/ClassificationDialog.cxx b/svx/source/dialog/ClassificationDialog.cxx
index 27f972a1d658..501e891d8d83 100644
--- a/svx/source/dialog/ClassificationDialog.cxx
+++ b/svx/source/dialog/ClassificationDialog.cxx
@@ -466,9 +466,9 @@ void ClassificationDialog::readIn(std::vector<ClassificationResult> const & rInp
                 FontWeight eWeight = (rClassificationResult.msName == "BOLD") ? WEIGHT_BOLD : WEIGHT_NORMAL;
 
                 ClassificationEditEngine& rEdEngine = m_xEditWindow->getEditEngine();
-                std::unique_ptr<SfxItemSet> pSet(new SfxItemSet(rEdEngine.GetParaAttribs(nParagraph)));
-                pSet->Put(SvxWeightItem(eWeight, EE_CHAR_WEIGHT));
-                rEdEngine.SetParaAttribs(nParagraph, *pSet);
+                SfxItemSet aSet(rEdEngine.GetParaAttribs(nParagraph));
+                aSet.Put(SvxWeightItem(eWeight, EE_CHAR_WEIGHT));
+                rEdEngine.SetParaAttribs(nParagraph, aSet);
             }
             break;
 
diff --git a/svx/source/dialog/ClassificationEditView.cxx b/svx/source/dialog/ClassificationEditView.cxx
index ba404982f685..2381762ee411 100644
--- a/svx/source/dialog/ClassificationEditView.cxx
+++ b/svx/source/dialog/ClassificationEditView.cxx
@@ -61,16 +61,16 @@ void ClassificationEditView::InvertSelectionWeight()
     {
         FontWeight eFontWeight = WEIGHT_BOLD;
 
-        std::unique_ptr<SfxItemSet> pSet(new SfxItemSet(m_xEditEngine->GetParaAttribs(nParagraph)));
-        if (const SfxPoolItem* pItem = pSet->GetItem(EE_CHAR_WEIGHT, false))
+        SfxItemSet aSet(m_xEditEngine->GetParaAttribs(nParagraph));
+        if (const SfxPoolItem* pItem = aSet.GetItem(EE_CHAR_WEIGHT, false))
         {
             const SvxWeightItem* pWeightItem = dynamic_cast<const SvxWeightItem*>(pItem);
             if (pWeightItem && pWeightItem->GetWeight() == WEIGHT_BOLD)
                 eFontWeight = WEIGHT_NORMAL;
         }
         SvxWeightItem aWeight(eFontWeight, EE_CHAR_WEIGHT);
-        pSet->Put(aWeight);
-        m_xEditEngine->SetParaAttribs(nParagraph, *pSet);
+        aSet.Put(aWeight);
+        m_xEditEngine->SetParaAttribs(nParagraph, aSet);
     }
 
     m_xEditView->Invalidate();
diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx
index a17edcefaa88..bf6d8fffcdca 100644
--- a/svx/source/form/fmtextcontrolshell.cxx
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -623,10 +623,10 @@ namespace svx
 
         rtl::Reference<SfxItemPool> pPool(EditEngine::CreatePool());
         pPool->FreezeIdRanges();
-        std::unique_ptr< SfxItemSet > xPureItems( new SfxItemSet( *pPool ) );
+        std::optional< SfxItemSet > xPureItems(( SfxItemSet( *pPool ) ));
 
         // put the current states of the items into the set
-        std::unique_ptr<SfxAllItemSet> xCurrentItems( new SfxAllItemSet( *xPureItems ) );
+        std::optional<SfxAllItemSet> xCurrentItems(( SfxAllItemSet( *xPureItems ) ));
         transferFeatureStatesToItemSet( m_aControlFeatures, *xCurrentItems, false );
 
         // additional items, which we are not responsible for at the SfxShell level,
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index a97b985b058f..5054f1d9b6bf 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -98,6 +98,7 @@
 #include <o3tl/enumrange.hxx>
 #include <o3tl/safeint.hxx>
 #include <memory>
+#include <optional>
 #include <filter/msfilter/escherex.hxx>
 #include "sprmids.hxx"
 
@@ -608,7 +609,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp,
     bool bDoingSymbol = false;
     sal_Unicode cReplaceSymbol = m_cSymbol;
 
-    std::unique_ptr<SfxItemSet> pS(new SfxItemSet(m_pDrawEditEngine->GetEmptyItemSet()));
+    std::optional<SfxItemSet> pS(m_pDrawEditEngine->GetEmptyItemSet());
     WW8PLCFManResult aRes;
 
     std::deque<Chunk> aChunks;
@@ -738,7 +739,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp,
             {
                 m_pDrawEditEngine->QuickSetAttribs( *pS,
                     GetESelection(*m_pDrawEditEngine, nTextStart - nStartCp, nEnd - nStartCp ) );
-                pS.reset( new SfxItemSet(m_pDrawEditEngine->GetEmptyItemSet()) );
+                pS.emplace(m_pDrawEditEngine->GetEmptyItemSet());
             }
         }
         nStart = nNext;


More information about the Libreoffice-commits mailing list