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 | |
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')
-rw-r--r-- | sw/source/core/doc/DocumentDeviceManager.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/edit/autofmt.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbinsdlg.cxx | 6 | ||||
-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 |
8 files changed, 23 insertions, 21 deletions
diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx index 0aa41350c235..251007bde7a6 100644 --- a/sw/source/core/doc/DocumentDeviceManager.cxx +++ b/sw/source/core/doc/DocumentDeviceManager.cxx @@ -312,7 +312,7 @@ void DocumentDeviceManager::PrtDataChanged() OSL_ENSURE( m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::USE_VIRTUAL_DEVICE) || nullptr != getPrinter( false ), "PrtDataChanged will be called recursively!" ); SwRootFrame* pTmpRoot = m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout(); - std::unique_ptr<SwWait> pWait; + std::optional<SwWait> oWait; bool bEndAction = false; if( m_rDoc.GetDocShell() ) @@ -327,7 +327,7 @@ void DocumentDeviceManager::PrtDataChanged() pSh->GetViewOptions()->IsPrtFormat()) ) { if ( m_rDoc.GetDocShell() ) - pWait.reset(new SwWait( *m_rDoc.GetDocShell(), true )); + oWait.emplace( *m_rDoc.GetDocShell(), true ); pTmpRoot->StartAllAction(); bEndAction = true; diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 9708065c4a28..32d450579898 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -2696,7 +2696,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags aFlags, void SwEditShell::AutoFormat( const SvxSwAutoFormatFlags* pAFlags ) { - std::unique_ptr<SwWait> pWait; + std::optional<SwWait> oWait; CurrShell aCurr( this ); StartAllAction(); @@ -2707,7 +2707,7 @@ void SwEditShell::AutoFormat( const SvxSwAutoFormatFlags* pAFlags ) { aAFFlags = *pAFlags; if( !aAFFlags.bAFormatByInput ) - pWait.reset(new SwWait( *GetDoc()->GetDocShell(), true )); + oWait.emplace( *GetDoc()->GetDocShell(), true ); } SwPaM* pCursor = GetCursor(); diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 151f74b949c8..d56ee3feaf79 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -940,7 +940,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, if( rSh.HasSelection() ) rSh.DelRight(); - std::unique_ptr<SwWait> pWait; + std::optional<SwWait> oWait; Reference< XColumnsSupplier > xColsSupp( xResultSet, UNO_QUERY ); Reference <XNameAccess> xCols = xColsSupp->getColumns(); @@ -1123,7 +1123,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, break; if( 10 == i ) - pWait.reset(new SwWait( *pView->GetDocShell(), true )); + oWait.emplace( *pView->GetDocShell(), true ); } rSh.MoveTable( GotoCurrTable, fnTableStart ); @@ -1347,7 +1347,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, rSh.SwEditShell::SplitNode(); if( 10 == i ) - pWait.reset(new SwWait( *pView->GetDocShell(), true )); + oWait.emplace( *pView->GetDocShell(), true ); } if( !bSetCursor && pMark != nullptr) 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) { |