summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfx2/source/view/viewfrm.cxx14
-rw-r--r--svl/source/items/stylepool.cxx5
-rw-r--r--svx/source/sdr/properties/textproperties.cxx4
-rw-r--r--sw/source/core/access/accpara.cxx26
-rw-r--r--sw/source/core/attr/swatrset.cxx8
-rw-r--r--sw/source/core/docnode/node.cxx8
-rw-r--r--sw/source/core/text/txtfld.cxx14
-rw-r--r--sw/source/core/unocore/unoframe.cxx6
-rw-r--r--sw/source/filter/ww8/ww8par4.cxx14
-rw-r--r--sw/source/ui/misc/pgfnote.cxx6
-rw-r--r--sw/source/uibase/shells/basesh.cxx6
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx17
12 files changed, 62 insertions, 66 deletions
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index b7fa742cabe8..844851c53d3f 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -673,11 +673,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
xOldObj->Get_Impl()->pReloadTimer.reset();
- std::unique_ptr<SfxItemSet> pNewSet;
+ std::optional<SfxAllItemSet> pNewSet;
std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter();
if( pURLItem )
{
- pNewSet.reset(new SfxAllItemSet( pApp->GetPool() ));
+ pNewSet.emplace( pApp->GetPool() );
pNewSet->Put( *pURLItem );
// Filter Detection
@@ -694,7 +694,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
}
else
{
- pNewSet.reset(new SfxAllItemSet( *pMedium->GetItemSet() ));
+ pNewSet.emplace( *pMedium->GetItemSet() );
pNewSet->ClearItem( SID_VIEW_ID );
pNewSet->ClearItem( SID_STREAM );
pNewSet->ClearItem( SID_INPUTSTREAM );
@@ -714,7 +714,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
// If a salvaged file is present, do not enclose the OrigURL
// again, since the Template is invalid after reload.
- const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(pNewSet.get(), SID_DOC_SALVAGE, false);
+ const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(&*pNewSet, SID_DOC_SALVAGE, false);
if( pSalvageItem )
{
pNewSet->ClearItem( SID_DOC_SALVAGE );
@@ -737,9 +737,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
if ( pSilentItem && pSilentItem->GetValue() )
pNewSet->Put( SfxBoolItem( SID_SILENT, true ) );
- const SfxUnoAnyItem* pInteractionItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pNewSet.get(), SID_INTERACTIONHANDLER, false);
- const SfxUInt16Item* pMacroExecItem = SfxItemSet::GetItem<SfxUInt16Item>(pNewSet.get(), SID_MACROEXECMODE, false);
- const SfxUInt16Item* pDocTemplateItem = SfxItemSet::GetItem<SfxUInt16Item>(pNewSet.get(), SID_UPDATEDOCMODE, false);
+ const SfxUnoAnyItem* pInteractionItem = SfxItemSet::GetItem<SfxUnoAnyItem>(&*pNewSet, SID_INTERACTIONHANDLER, false);
+ const SfxUInt16Item* pMacroExecItem = SfxItemSet::GetItem<SfxUInt16Item>(&*pNewSet, SID_MACROEXECMODE, false);
+ const SfxUInt16Item* pDocTemplateItem = SfxItemSet::GetItem<SfxUInt16Item>(&*pNewSet, SID_UPDATEDOCMODE, false);
if (!pInteractionItem)
{
diff --git a/svl/source/items/stylepool.cxx b/svl/source/items/stylepool.cxx
index ea3efeaeb5f0..c241e61e85a1 100644
--- a/svl/source/items/stylepool.cxx
+++ b/svl/source/items/stylepool.cxx
@@ -24,6 +24,7 @@
#include <algorithm>
#include <map>
#include <memory>
+#include <optional>
#include <vector>
namespace {
@@ -385,10 +386,10 @@ std::shared_ptr<SfxItemSet> StylePoolImpl::insertItemSet( const SfxItemSet& rSet
// Every SfxPoolItem in the SfxItemSet causes a step deeper into the tree,
// a complete empty SfxItemSet would stay at the root node.
// #i86923# insert ignorable items to the tree leaves.
- std::unique_ptr<SfxItemSet> xFoundIgnorableItems;
+ std::optional<SfxItemSet> xFoundIgnorableItems;
if ( mpIgnorableItems )
{
- xFoundIgnorableItems.reset( new SfxItemSet( *mpIgnorableItems ) );
+ xFoundIgnorableItems.emplace( *mpIgnorableItems );
}
while( pItem )
{
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index de5c6765de75..9161cbde2f52 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -269,13 +269,13 @@ namespace sdr::properties
{
for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
{
- std::unique_ptr<SfxItemSet> pTempSet;
+ std::optional<SfxItemSet> pTempSet;
// since setting the stylesheet removes all para attributes
if(bDontRemoveHardAttr)
{
// we need to remember them if we want to keep them
- pTempSet.reset(new SfxItemSet(rOutliner.GetParaAttribs(nPara)));
+ pTempSet.emplace(rOutliner.GetParaAttribs(nPara));
}
if(GetStyleSheet())
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index ff2afb3aecc5..8ae0e98f6bf8 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1445,18 +1445,18 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
// retrieve default attributes
SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(GetFrame()));
const SwTextNode *const pTextNode(pFrame->GetTextNodeForParaProps());
- std::unique_ptr<SfxItemSet> pSet;
+ std::optional<SfxItemSet> pSet;
if ( !bOnlyCharAttrs )
{
- pSet.reset( new SfxItemSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
+ pSet.emplace( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
RES_PARATR_BEGIN, RES_PARATR_END - 1,
- RES_FRMATR_BEGIN, RES_FRMATR_END - 1>{} ) );
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1>{} );
}
else
{
- pSet.reset( new SfxItemSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
- svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END - 1>{} ) );
+ pSet.emplace( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
+ svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END - 1>{} );
}
// #i82637# - From the perspective of the a11y API the default character
// attributes are the character attributes, which are set at the paragraph style
@@ -1753,24 +1753,22 @@ void SwAccessibleParagraph::_getSupplementalAttributesImpl(
{
SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(GetFrame()));
const SwTextNode *const pTextNode(pFrame->GetTextNodeForParaProps());
- std::unique_ptr<SfxItemSet> pSet;
- pSet.reset(
- new SfxItemSet(
+ SfxItemSet aSet(
const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
svl::Items<
RES_PARATR_LINESPACING, RES_PARATR_ADJUST,
RES_PARATR_TABSTOP, RES_PARATR_TABSTOP,
RES_PARATR_NUMRULE, RES_PARATR_NUMRULE,
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
- RES_LR_SPACE, RES_UL_SPACE>{}));
+ RES_LR_SPACE, RES_UL_SPACE>{});
if ( pTextNode->HasBullet() || pTextNode->HasNumber() )
{
- pSet->Put( pTextNode->GetAttr(RES_PARATR_LIST_LEVEL) );
+ aSet.Put( pTextNode->GetAttr(RES_PARATR_LIST_LEVEL) );
}
- pSet->Put( pTextNode->SwContentNode::GetAttr(RES_UL_SPACE) );
- pSet->Put( pTextNode->SwContentNode::GetAttr(RES_LR_SPACE) );
- pSet->Put( pTextNode->SwContentNode::GetAttr(RES_PARATR_ADJUST) );
+ aSet.Put( pTextNode->SwContentNode::GetAttr(RES_UL_SPACE) );
+ aSet.Put( pTextNode->SwContentNode::GetAttr(RES_LR_SPACE) );
+ aSet.Put( pTextNode->SwContentNode::GetAttr(RES_PARATR_ADJUST) );
tAccParaPropValMap aSupplementalAttrSeq;
{
@@ -1778,7 +1776,7 @@ void SwAccessibleParagraph::_getSupplementalAttributesImpl(
aSwMapProvider.GetPropertyMapEntries( PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE ) );
while ( !pPropMap->aName.isEmpty() )
{
- const SfxPoolItem* pItem = pSet->GetItem( pPropMap->nWID );
+ const SfxPoolItem* pItem = aSet.GetItem( pPropMap->nWID );
if ( pItem )
{
uno::Any aVal;
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index 1ec1d93323e1..b72e65222a31 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -330,7 +330,7 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod ) const
}
}
- std::unique_ptr< SfxItemSet > tmpSet;
+ std::optional< SfxItemSet > tmpSet;
if( pSrcDoc != pDstDoc && SfxItemState::SET == GetItemState(
RES_PAGEDESC, false, &pItem ))
@@ -338,7 +338,7 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod ) const
const SwPageDesc* pPgDesc = pItem->StaticWhichCast(RES_PAGEDESC).GetPageDesc();
if( pPgDesc )
{
- tmpSet.reset(new SfxItemSet(*this));
+ tmpSet.emplace(*this);
SwPageDesc* pDstPgDesc = pDstDoc->FindPageDesc(pPgDesc->GetName());
if( !pDstPgDesc )
@@ -356,7 +356,7 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod ) const
&& pItem->StaticWhichCast(RES_ANCHOR).GetContentAnchor() != nullptr )
{
if( !tmpSet )
- tmpSet.reset( new SfxItemSet( *this ));
+ tmpSet.emplace( *this );
// Anchors at any node position cannot be copied to another document, because the SwPosition
// would still point to the old document. It needs to be fixed up explicitly.
tmpSet->ClearItem( RES_ANCHOR );
@@ -382,7 +382,7 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod ) const
item.SetStyleHandle(pNewSet);
if (!tmpSet)
{
- tmpSet.reset(new SfxItemSet(*this));
+ tmpSet.emplace(*this);
}
tmpSet->Put(item);
}
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index b8f946bc2871..8979184c729d 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -154,10 +154,10 @@ static bool Put( std::shared_ptr<const SfxItemSet>& rpAttrSet, const SwContentNo
SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
// #i76273# Robust
- std::unique_ptr<SfxItemSet> pStyleNames;
+ std::optional<SfxItemSet> pStyleNames;
if ( SfxItemState::SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, false ) )
{
- pStyleNames.reset(new SfxItemSet( *aNewSet.GetPool(), svl::Items<RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME>{} ));
+ pStyleNames.emplace( *aNewSet.GetPool(), svl::Items<RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME>{} );
pStyleNames->Put( aNewSet );
}
@@ -201,10 +201,10 @@ static bool Put_BC( std::shared_ptr<const SfxItemSet>& rpAttrSet,
SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
// #i76273# Robust
- std::unique_ptr<SfxItemSet> pStyleNames;
+ std::optional<SfxItemSet> pStyleNames;
if ( SfxItemState::SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, false ) )
{
- pStyleNames.reset(new SfxItemSet( *aNewSet.GetPool(), svl::Items<RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME>{} ));
+ pStyleNames.emplace( *aNewSet.GetPool(), svl::Items<RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME>{} );
pStyleNames->Put( aNewSet );
}
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index c1375b52fe09..81db29607371 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -567,26 +567,24 @@ static void lcl_setRedlineAttr( SwTextFormatInfo &rInf, const SwTextNode& rTextN
if (!pRedlineNum)
return;
- std::unique_ptr<SfxItemSet> pSet;
-
SwAttrPool& rPool = rInf.GetVsh()->GetDoc()->GetAttrPool();
- pSet = std::make_unique<SfxItemSet>(rPool, svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END-1>{});
+ SfxItemSet aSet(rPool, svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END-1>{});
std::size_t aAuthor = (1 < pRedlineNum->GetStackCount())
? pRedlineNum->GetAuthor( 1 )
: pRedlineNum->GetAuthor();
if ( RedlineType::Delete == pRedlineNum->GetType() )
- SW_MOD()->GetDeletedAuthorAttr(aAuthor, *pSet);
+ SW_MOD()->GetDeletedAuthorAttr(aAuthor, aSet);
else
- SW_MOD()->GetInsertAuthorAttr(aAuthor, *pSet);
+ SW_MOD()->GetInsertAuthorAttr(aAuthor, aSet);
const SfxPoolItem* pItem = nullptr;
- if (SfxItemState::SET == pSet->GetItemState(RES_CHRATR_COLOR, true, &pItem))
+ if (SfxItemState::SET == aSet.GetItemState(RES_CHRATR_COLOR, true, &pItem))
pNumFnt->SetColor(static_cast<const SvxColorItem*>(pItem)->GetValue());
- if (SfxItemState::SET == pSet->GetItemState(RES_CHRATR_UNDERLINE, true, &pItem))
+ if (SfxItemState::SET == aSet.GetItemState(RES_CHRATR_UNDERLINE, true, &pItem))
pNumFnt->SetUnderline(static_cast<const SvxUnderlineItem*>(pItem)->GetLineStyle());
- if (SfxItemState::SET == pSet->GetItemState(RES_CHRATR_CROSSEDOUT, true, &pItem))
+ if (SfxItemState::SET == aSet.GetItemState(RES_CHRATR_CROSSEDOUT, true, &pItem))
pNumFnt->SetStrikeout( static_cast<const SvxCrossedOutItem*>(pItem)->GetStrikeout() );
}
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index a430d92f5b7f..fd4f07a73390 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1548,7 +1548,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
UnoActionContext aAction(pFormat->GetDoc());
- std::unique_ptr<SfxItemSet> pSet;
+ std::optional<SfxItemSet> pSet;
// #i31771#, #i25798# - No adjustment of
// anchor ( no call of method <sw_ChkAndSetNewAnchor(..)> ),
// if document is currently in reading mode.
@@ -1563,7 +1563,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
const ::SfxPoolItem* pItem;
if( SfxItemState::SET == pFrameFormat->GetItemState( RES_ANCHOR, false, &pItem ))
{
- pSet.reset(new SfxItemSet( pDoc->GetAttrPool(), aFrameFormatSetRange ));
+ pSet.emplace( pDoc->GetAttrPool(), aFrameFormatSetRange );
pSet->Put( *pItem );
if ( pFormat->GetDoc()->GetEditShell() != nullptr
&& !sw_ChkAndSetNewAnchor( *pFly, *pSet ) )
@@ -1574,7 +1574,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
}
}
- pFormat->GetDoc()->SetFrameFormatToFly( *pFormat, *pFrameFormat, pSet.get() );
+ pFormat->GetDoc()->SetFrameFormatToFly( *pFormat, *pFrameFormat, pSet ? &*pSet : nullptr );
}
else if (FN_UNO_GRAPHIC_FILTER == pEntry->nWID)
{
diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx
index e7e559d586a4..f999ea840ce9 100644
--- a/sw/source/filter/ww8/ww8par4.cxx
+++ b/sw/source/filter/ww8/ww8par4.cxx
@@ -203,7 +203,7 @@ SwFlyFrameFormat* SwWW8ImplReader::InsertOle(SdrOle2Obj &rObject,
SwFlyFrameFormat *pRet = nullptr;
- std::unique_ptr<SfxItemSet> pMathFlySet;
+ std::optional<SfxItemSet> pMathFlySet;
uno::Reference < embed::XClassifiedObject > xClass = rObject.GetObjRef();
if( xClass.is() )
{
@@ -212,7 +212,7 @@ SwFlyFrameFormat* SwWW8ImplReader::InsertOle(SdrOle2Obj &rObject,
{
// StarMath sets it own fixed size, so its counter productive to use
// the size Word says it is. i.e. Don't attempt to override its size.
- pMathFlySet.reset(new SfxItemSet(rFlySet));
+ pMathFlySet.emplace(rFlySet);
pMathFlySet->ClearItem(RES_FRM_SIZE);
}
}
@@ -231,7 +231,7 @@ SwFlyFrameFormat* SwWW8ImplReader::InsertOle(SdrOle2Obj &rObject,
OSL_ENSURE(bSuccess, "Insert OLE failed");
if (bSuccess)
{
- const SfxItemSet *pFlySet = pMathFlySet ? pMathFlySet.get() : &rFlySet;
+ const SfxItemSet *pFlySet = pMathFlySet ? &*pMathFlySet : &rFlySet;
pRet = m_rDoc.getIDocumentContentOperations().InsertOLE(*m_pPaM, sNewName, rObject.GetAspect(), pFlySet, rGrfSet);
}
return pRet;
@@ -249,13 +249,13 @@ SwFrameFormat* SwWW8ImplReader::ImportOle(const Graphic* pGrf,
SdrObject* pRet = ImportOleBase(aGraph, pGrf, pFlySet, aVisArea );
// create flyset
- std::unique_ptr<SfxItemSet> pTempSet;
+ std::optional<SfxItemSet> pTempSet;
if( !pFlySet )
{
- pTempSet.reset( new SfxItemSet( m_rDoc.GetAttrPool(), svl::Items<RES_FRMATR_BEGIN,
- RES_FRMATR_END-1>{}) );
+ pTempSet.emplace( m_rDoc.GetAttrPool(), svl::Items<RES_FRMATR_BEGIN,
+ RES_FRMATR_END-1>{} );
- pFlySet = pTempSet.get();
+ pFlySet = &*pTempSet;
// Remove distance/borders
Reader::ResetFrameFormatAttrs( *pTempSet );
diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
index 608f54492b45..8292d1b35c7b 100644
--- a/sw/source/ui/misc/pgfnote.cxx
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -135,7 +135,7 @@ std::unique_ptr<SfxTabPage> SwFootNotePage::Create(weld::Container* pPage, weld:
void SwFootNotePage::Reset(const SfxItemSet *rSet)
{
// if no example exists, otherwise Init here in Activate
- std::unique_ptr<SwPageFootnoteInfo> pDefFootnoteInfo;
+ std::optional<SwPageFootnoteInfo> pDefFootnoteInfo;
const SwPageFootnoteInfo* pFootnoteInfo;
const SfxPoolItem* pItem = SfxTabPage::GetItem(*rSet, FN_PARAM_FTN_INFO);
if( pItem )
@@ -146,8 +146,8 @@ void SwFootNotePage::Reset(const SfxItemSet *rSet)
{
// when "standard" is being activated the footnote item is deleted,
// that's why a footnote structure has to be created here
- pDefFootnoteInfo.reset(new SwPageFootnoteInfo());
- pFootnoteInfo = pDefFootnoteInfo.get();
+ pDefFootnoteInfo.emplace();
+ pFootnoteInfo = &*pDefFootnoteInfo;
}
// footnote area's height
SwTwips lHeight = pFootnoteInfo->GetHeight();
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index a81ae435829c..91c4a05758d4 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -2261,7 +2261,7 @@ void SwBaseShell::GetTextFontCtrlState( SfxItemSet& rSet )
{
SwWrtShell &rSh = GetShell();
bool bFirst = true;
- std::unique_ptr<SfxItemSet> pFntCoreSet;
+ std::optional<SfxItemSet> pFntCoreSet;
SvtScriptType nScriptType = SvtScriptType::LATIN;
SfxWhichIter aIter( rSet );
sal_uInt16 nWhich = aIter.FirstWhich();
@@ -2276,8 +2276,8 @@ void SwBaseShell::GetTextFontCtrlState( SfxItemSet& rSet )
{
if( !pFntCoreSet )
{
- pFntCoreSet.reset(new SfxItemSet( *rSet.GetPool(),
- svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END-1>{} ));
+ pFntCoreSet.emplace( *rSet.GetPool(),
+ svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END-1>{} );
rSh.GetCurAttr( *pFntCoreSet );
nScriptType = rSh.GetScriptType();
// #i42732# input language should be preferred over
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index 911d2cedd1eb..a68d90c08207 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -756,18 +756,17 @@ sal_uLong SwView::FUNC_Search( const SwSearchOptions& rOptions )
::SfxToSwPageDescAttr( *m_pWrtShell, aSrchSet );
}
- std::unique_ptr<SfxItemSet> pReplSet;
+ std::optional<SfxItemSet> xReplSet;
if( bDoReplace && s_xReplaceList && s_xReplaceList->Count() )
{
- pReplSet.reset( new SfxItemSet( m_pWrtShell->GetAttrPool(),
- aSearchAttrRange ) );
- s_xReplaceList->Get( *pReplSet );
+ xReplSet.emplace( m_pWrtShell->GetAttrPool(), aSearchAttrRange );
+ s_xReplaceList->Get( *xReplSet );
// -- Page break with page template
- ::SfxToSwPageDescAttr( *m_pWrtShell, *pReplSet );
+ ::SfxToSwPageDescAttr( *m_pWrtShell, *xReplSet );
- if( !pReplSet->Count() ) // too bad, we don't know
- pReplSet.reset(); // the attributes
+ if( !xReplSet->Count() ) // too bad, we don't know
+ xReplSet.reset(); // the attributes
}
// build SearchOptions to be used
@@ -778,7 +777,7 @@ sal_uLong SwView::FUNC_Search( const SwSearchOptions& rOptions )
aSearchOpt.replaceString.clear();
sal_uLong nFound;
- if( aSrchSet.Count() || ( pReplSet && pReplSet->Count() ))
+ if( aSrchSet.Count() || ( xReplSet && xReplSet->Count() ))
{
nFound = m_pWrtShell->SearchAttr(
aSrchSet,
@@ -787,7 +786,7 @@ sal_uLong SwView::FUNC_Search( const SwSearchOptions& rOptions )
rOptions.eEnd,
eRanges,
!s_pSrchItem->GetSearchString().isEmpty() ? &aSearchOpt : nullptr,
- pReplSet.get() );
+ xReplSet ? &*xReplSet : nullptr );
}
else if( s_pSrchItem->GetPattern() )
{