diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-18 11:42:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-18 13:19:35 +0200 |
commit | 326534372ee5436d2f6e972de46fc01bb635e9d9 (patch) | |
tree | 7bccb0f28e56cd32104b7b532fbad42f825ae7ed /sw/source/uibase | |
parent | a6535669f9532b61ee5906d4b1339bc9af4b0882 (diff) |
no need to allocate these on the heap
Change-Id: Ia5eec87a4b36ac2dd15c3369bd7c630277a177c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138473
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/lingu/hyp.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/misc/redlndlg.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewsrch.cxx | 8 |
5 files changed, 16 insertions, 14 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 6e8881d2d186..cd435fb841cd 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -588,7 +588,7 @@ void SwDBManager::ImportFromConnection( SwWrtShell* pSh ) if( pSh->HasSelection() ) pSh->DelRight(); - std::unique_ptr<SwWait> pWait; + std::optional<SwWait> oWait; { sal_uLong i = 0; @@ -596,7 +596,7 @@ void SwDBManager::ImportFromConnection( SwWrtShell* pSh ) ImportDBEntry(pSh); if( 10 == ++i ) - pWait.reset(new SwWait( *pSh->GetView().GetDocShell(), true)); + oWait.emplace( *pSh->GetView().GetDocShell(), true); } while(ToNextMergeRecord()); } diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 6f25dd4bde44..c4a172e73c62 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -898,10 +898,10 @@ static void DeleteDDEMarks(SwDoc & rDest) void SwTransferable::PrepareForCopyTextRange(SwPaM & rPaM) { - std::unique_ptr<SwWait> pWait; + std::optional<SwWait> oWait; if (m_pWrtShell->ShouldWait()) { - pWait.reset(new SwWait( *m_pWrtShell->GetView().GetDocShell(), true )); + oWait.emplace( *m_pWrtShell->GetView().GetDocShell(), true ); } m_pClpDocFac.reset(new SwDocFac); @@ -1042,9 +1042,9 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) else if ( m_pWrtShell->IsSelection() || m_pWrtShell->IsFrameSelected() || m_pWrtShell->IsObjSelected() ) { - std::unique_ptr<SwWait> pWait; + std::optional<SwWait> oWait; if( m_pWrtShell->ShouldWait() ) - pWait.reset(new SwWait( *m_pWrtShell->GetView().GetDocShell(), true )); + oWait.emplace( *m_pWrtShell->GetView().GetDocShell(), true ); m_pClpDocFac.reset(new SwDocFac); diff --git a/sw/source/uibase/lingu/hyp.cxx b/sw/source/uibase/lingu/hyp.cxx index 7a9a21b9ca82..caf235bf793d 100644 --- a/sw/source/uibase/lingu/hyp.cxx +++ b/sw/source/uibase/lingu/hyp.cxx @@ -64,11 +64,11 @@ void SwHyphWrapper::SpellStart( SvxSpellArea eSpell ) void SwHyphWrapper::SpellContinue() { // for automatic separation, make actions visible only at the end - std::unique_ptr<SwWait> pWait; + std::optional<SwWait> oWait; if( m_bAutomatic ) { PSH->StartAllAction(); - pWait.reset(new SwWait( *m_pView->GetDocShell(), true )); + oWait.emplace( *m_pView->GetDocShell(), true ); } uno::Reference< uno::XInterface > xHyphWord = m_bInSelection ? @@ -80,7 +80,7 @@ void SwHyphWrapper::SpellContinue() if( m_bAutomatic ) { PSH->EndAllAction(); - pWait.reset(); + oWait.reset(); } } diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 8d23639aefb3..0f05ba9e0977 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -209,7 +209,9 @@ SwRedlineAcceptDlg::~SwRedlineAcceptDlg() void SwRedlineAcceptDlg::Init(SwRedlineTable::size_type nStart) { SwView *pView = ::GetActiveView(); - std::unique_ptr<SwWait> xWait(pView ? new SwWait(*pView->GetDocShell(), false) : nullptr); + std::optional<SwWait> oWait; + if (pView) + oWait.emplace(*pView->GetDocShell(), false); weld::TreeView& rTreeView = m_pTable->GetWidget(); m_aUsedSeqNo.clear(); diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index 0ca7c9028310..7dd4ec1063f2 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -492,7 +492,7 @@ bool SwView::SearchAndWrap(bool bApi) if (!s_pSrchItem->GetSelection()) m_pWrtShell->KillSelection(nullptr, false); - std::unique_ptr<SwWait> pWait(new SwWait( *GetDocShell(), true )); + std::optional<SwWait> oWait( std::in_place, *GetDocShell(), true ); if( FUNC_Search( aOpts ) ) { s_bFound = true; @@ -505,7 +505,7 @@ bool SwView::SearchAndWrap(bool bApi) m_pWrtShell->EndAllAction(); return true; } - pWait.reset(); + oWait.reset(); // Search in the specialized areas when no search is present in selections. // When searching selections will already searched in these special areas. @@ -545,7 +545,7 @@ bool SwView::SearchAndWrap(bool bApi) m_pWrtShell->StartAllAction(); m_pWrtShell->Pop(SwCursorShell::PopMode::DeleteCurrent); - pWait.reset(new SwWait( *GetDocShell(), true )); + oWait.emplace( *GetDocShell(), true ); bool bSrchBkwrd = SwDocPositions::Start == aOpts.eEnd; @@ -576,7 +576,7 @@ bool SwView::SearchAndWrap(bool bApi) } m_pWrtShell->EndAllAction(); - pWait.reset(); + oWait.reset(); #if HAVE_FEATURE_DESKTOP if (s_bFound) { |