summaryrefslogtreecommitdiff
path: root/sw/source/uibase
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
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')
-rw-r--r--sw/source/uibase/shells/basesh.cxx6
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx17
2 files changed, 11 insertions, 12 deletions
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() )
{