summaryrefslogtreecommitdiff
path: root/sw/source/uibase/uiview/viewsrch.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-01 10:10:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-01 16:11:06 +0200
commit608f273e9da412e7a2d884f2603756cb4ff4c8af (patch)
tree11b279b98062d17ee69f722ccb1532107a615789 /sw/source/uibase/uiview/viewsrch.cxx
parentcc948b84b8550ba728b3dfbc40a9785b928910e9 (diff)
can allocate these SfxItemSet on the stack
Change-Id: Ib2b89613ad3e8f2bcdd51bee10bab3559a64fce4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118208 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/uiview/viewsrch.cxx')
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx17
1 files changed, 8 insertions, 9 deletions
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() )
{