sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 10 +++---- sw/source/uibase/dochdl/gloshdl.cxx | 10 +++---- sw/source/uibase/misc/glosdoc.cxx | 4 +-- sw/source/uibase/shells/basesh.cxx | 6 ++-- sw/source/uibase/sidebar/PageColumnControl.cxx | 6 ++-- sw/source/uibase/sidebar/PageMarginControl.cxx | 25 ++++++++----------- sw/source/uibase/sidebar/PageSizeControl.cxx | 6 ++-- sw/source/uibase/uiview/view0.cxx | 2 - sw/source/uibase/utlui/glbltree.cxx | 22 ++++++++-------- 9 files changed, 44 insertions(+), 47 deletions(-)
New commits: commit baa666654327425ceb3cf93ad2dc27fd7bcb8abd Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri May 28 09:21:28 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri May 28 14:30:00 2021 +0200 no need to allocate these on the heap Change-Id: I5ed00fe80e96e9d07d56eb7841a66ba98f328a91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116318 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index c5a0f8edca30..bf3e24cb00a9 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -761,16 +761,16 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh) aTmpOutliner.SetPaperSize( pTextObj->GetLogicRect().GetSize() ); aTmpOutliner.SetSpeller( xSpell ); - std::unique_ptr<OutlinerView> pOutlView( new OutlinerView( &aTmpOutliner, &(rView.GetEditWin()) ) ); - pOutlView->GetOutliner()->SetRefDevice( rSh.getIDocumentDeviceAccess().getPrinter( false ) ); - aTmpOutliner.InsertView( pOutlView.get() ); + OutlinerView aOutlView( &aTmpOutliner, &(rView.GetEditWin()) ); + aOutlView.GetOutliner()->SetRefDevice( rSh.getIDocumentDeviceAccess().getPrinter( false ) ); + aTmpOutliner.InsertView( &aOutlView ); Size aSize(1,1); tools::Rectangle aRect( Point(), aSize ); - pOutlView->SetOutputArea( aRect ); + aOutlView.SetOutputArea( aRect ); aTmpOutliner.SetText( *pParaObj ); aTmpOutliner.ClearModifyFlag(); bHasSpellError = EESpellState::Ok != aTmpOutliner.HasSpellErrors(); - aTmpOutliner.RemoveView( pOutlView.get() ); + aTmpOutliner.RemoveView( &aOutlView ); } if(bHasSpellError) { diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index 1540d3e4207c..4c2bc57a192b 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -670,18 +670,18 @@ bool SwGlossaryHdl::ImportGlossaries( const OUString& rName ) if( !rName.isEmpty() ) { std::shared_ptr<const SfxFilter> pFilter; - std::unique_ptr<SfxMedium> pMed(new SfxMedium( rName, StreamMode::READ, nullptr, nullptr )); + SfxMedium aMed( rName, StreamMode::READ, nullptr, nullptr ); SfxFilterMatcher aMatcher( "swriter" ); - pMed->UseInteractionHandler( true ); - if (!aMatcher.GuessFilter(*pMed, pFilter, SfxFilterFlags::NONE)) + aMed.UseInteractionHandler( true ); + if (!aMatcher.GuessFilter(aMed, pFilter, SfxFilterFlags::NONE)) { SwTextBlocks *pGlossary = nullptr; - pMed->SetFilter( pFilter ); + aMed.SetFilter( pFilter ); Reader* pR = SwReaderWriter::GetReader( pFilter->GetUserData() ); if( pR && nullptr != ( pGlossary = pCurGrp ? pCurGrp.get() : rStatGlossaries.GetGroupDoc(aCurGrp).release()) ) { - SwReader aReader( *pMed, rName ); + SwReader aReader( aMed, rName ); if( aReader.HasGlossaries( *pR ) ) { const SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get(); diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index 12b082e94b27..273c5c0ae870 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -237,8 +237,8 @@ bool SwGlossaries::RenameGroupDoc( m_GlosArr.push_back(rNewGroup); } - std::unique_ptr<SwTextBlocks> pNewBlock(new SwTextBlocks( sNewFileURL )); - pNewBlock->SetName(rNewTitle); + SwTextBlocks aNewBlock( sNewFileURL ); + aNewBlock.SetName(rNewTitle); return true; } diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 760f32a59e53..df3d6da3976a 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -159,14 +159,14 @@ static void lcl_UpdateIMapDlg( SwWrtShell& rSh ) GraphicType nGrfType = aGrf.GetType(); void* pEditObj = GraphicType::NONE != nGrfType && GraphicType::Default != nGrfType ? rSh.GetIMapInventor() : nullptr; - std::unique_ptr<TargetList> pList(new TargetList); - SfxFrame::GetDefaultTargetList(*pList); + TargetList aList; + SfxFrame::GetDefaultTargetList(aList); SfxItemSet aSet( rSh.GetAttrPool(), svl::Items<RES_URL, RES_URL>{} ); rSh.GetFlyFrameAttr( aSet ); const SwFormatURL &rURL = aSet.Get( RES_URL ); SvxIMapDlgChildWindow::UpdateIMapDlg( - aGrf, rURL.GetMap(), pList.get(), pEditObj ); + aGrf, rURL.GetMap(), &aList, pEditObj ); } static bool lcl_UpdateContourDlg( SwWrtShell &rSh, SelectionType nSel ) diff --git a/sw/source/uibase/sidebar/PageColumnControl.cxx b/sw/source/uibase/sidebar/PageColumnControl.cxx index 8b979af19668..adf10c4af58e 100644 --- a/sw/source/uibase/sidebar/PageColumnControl.cxx +++ b/sw/source/uibase/sidebar/PageColumnControl.cxx @@ -87,11 +87,11 @@ PageColumnControl::~PageColumnControl() void PageColumnControl::ExecuteColumnChange( const sal_uInt16 nColumnType ) { - std::unique_ptr<SfxInt16Item> mpPageColumnTypeItem( new SfxInt16Item(SID_ATTR_PAGE_COLUMN) ); - mpPageColumnTypeItem->SetValue( nColumnType ); + SfxInt16Item aPageColumnTypeItem(SID_ATTR_PAGE_COLUMN); + aPageColumnTypeItem.SetValue( nColumnType ); if ( SfxViewFrame::Current() ) SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList(SID_ATTR_PAGE_COLUMN, - SfxCallMode::RECORD, { mpPageColumnTypeItem.get() }); + SfxCallMode::RECORD, { &aPageColumnTypeItem }); } IMPL_LINK( PageColumnControl, ColumnButtonClickHdl_Impl, weld::Button&, rButton, void ) diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx b/sw/source/uibase/sidebar/PageMarginControl.cxx index 5f40751cda2e..3dfd61a1f6fa 100644 --- a/sw/source/uibase/sidebar/PageMarginControl.cxx +++ b/sw/source/uibase/sidebar/PageMarginControl.cxx @@ -425,12 +425,11 @@ void PageMarginControl::ExecuteMarginLRChange( { if ( SfxViewFrame::Current() ) { - std::unique_ptr<SvxLongLRSpaceItem> pPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) ); - pPageLRMarginItem->SetLeft( nPageLeftMargin ); - pPageLRMarginItem->SetRight( nPageRightMargin ); + SvxLongLRSpaceItem aPageLRMarginItem( 0, 0, SID_ATTR_PAGE_LRSPACE ); + aPageLRMarginItem.SetLeft( nPageLeftMargin ); + aPageLRMarginItem.SetRight( nPageRightMargin ); SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_LRSPACE, - SfxCallMode::RECORD, { pPageLRMarginItem.get() } ); - pPageLRMarginItem.reset(); + SfxCallMode::RECORD, { &aPageLRMarginItem } ); } } @@ -440,12 +439,11 @@ void PageMarginControl::ExecuteMarginULChange( { if ( SfxViewFrame::Current() ) { - std::unique_ptr<SvxLongULSpaceItem> pPageULMarginItem( new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ) ); - pPageULMarginItem->SetUpper( nPageTopMargin ); - pPageULMarginItem->SetLower( nPageBottomMargin ); + SvxLongULSpaceItem aPageULMarginItem( 0, 0, SID_ATTR_PAGE_ULSPACE ); + aPageULMarginItem.SetUpper( nPageTopMargin ); + aPageULMarginItem.SetLower( nPageBottomMargin ); SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_ULSPACE, - SfxCallMode::RECORD, { pPageULMarginItem.get() } ); - pPageULMarginItem.reset(); + SfxCallMode::RECORD, { &aPageULMarginItem } ); } } @@ -453,11 +451,10 @@ void PageMarginControl::ExecutePageLayoutChange( const bool bMirrored ) { if ( SfxViewFrame::Current() ) { - std::unique_ptr<SvxPageItem> pPageItem( new SvxPageItem( SID_ATTR_PAGE ) ); - pPageItem->SetPageUsage( bMirrored ? SvxPageUsage::Mirror : SvxPageUsage::All ); + SvxPageItem aPageItem( SID_ATTR_PAGE ); + aPageItem.SetPageUsage( bMirrored ? SvxPageUsage::Mirror : SvxPageUsage::All ); SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE, - SfxCallMode::RECORD, { pPageItem.get() } ); - pPageItem.reset(); + SfxCallMode::RECORD, { &aPageItem } ); } } diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx b/sw/source/uibase/sidebar/PageSizeControl.cxx index 7fa49f4f75c3..76761edcdc1d 100644 --- a/sw/source/uibase/sidebar/PageSizeControl.cxx +++ b/sw/source/uibase/sidebar/PageSizeControl.cxx @@ -203,16 +203,16 @@ void PageSizeControl::ExecuteSizeChange( const Paper ePaper ) SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE, pItem ); bLandscape = static_cast<const SvxPageItem*>(pItem)->IsLandscape(); - std::unique_ptr<SvxSizeItem> pPageSizeItem( new SvxSizeItem(SID_ATTR_PAGE_SIZE) ); + SvxSizeItem aPageSizeItem(SID_ATTR_PAGE_SIZE); Size aPageSize = SvxPaperInfo::GetPaperSize( ePaper, eUnit ); if ( bLandscape ) { Swap( aPageSize ); } - pPageSizeItem->SetSize( aPageSize ); + aPageSizeItem.SetSize( aPageSize ); SfxViewFrame::Current()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_SIZE, - SfxCallMode::RECORD, { pPageSizeItem.get() }); + SfxCallMode::RECORD, { &aPageSizeItem }); } diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 01bed0a3f35b..82ee7b2b83cb 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -360,7 +360,7 @@ void SwView::StateViewOptions(SfxItemSet &rSet) void SwView::ExecViewOptions(SfxRequest &rReq) { - std::unique_ptr<SwViewOption> pOpt(new SwViewOption( *GetWrtShell().GetViewOptions() )); + std::optional<SwViewOption> pOpt( *GetWrtShell().GetViewOptions() ); bool bModified = GetWrtShell().IsModified(); int eState = STATE_TOGGLE; diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 0ff3ca871b48..4225633077a4 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -184,7 +184,7 @@ sal_Int8 SwGlobalTreeDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt ) if( aData.HasFormat( SotClipboardFormatId::FILE_LIST )) { nRet = rEvt.mnAction; - std::unique_ptr<SwGlblDocContents> pTempContents(new SwGlblDocContents); + SwGlblDocContents aTempContents; int nAbsContPos = xDropEntry ? rWidget.get_iter_index_in_parent(*xDropEntry): - 1; @@ -201,14 +201,14 @@ sal_Int8 SwGlobalTreeDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt ) // to not work on an old content. if(n) { - m_rTreeView.GetActiveWrtShell()->GetGlobalDocContent(*pTempContents); + m_rTreeView.GetActiveWrtShell()->GetGlobalDocContent(aTempContents); // If the file was successfully inserted, // then the next content must also be fetched. - if(nEntryCount < pTempContents->size()) + if(nEntryCount < aTempContents.size()) { nEntryCount++; nAbsContPos++; - pCnt = (*pTempContents)[ nAbsContPos ].get(); + pCnt = aTempContents[ nAbsContPos ].get(); } } } @@ -867,20 +867,20 @@ bool SwGlobalTree::Update(bool bHard) else { bool bCopy = false; - std::unique_ptr<SwGlblDocContents> pTempContents(new SwGlblDocContents); - m_pActiveShell->GetGlobalDocContent(*pTempContents); + SwGlblDocContents aTempContents; + m_pActiveShell->GetGlobalDocContent(aTempContents); size_t nChildren = m_xTreeView->n_children(); - if (pTempContents->size() != m_pSwGlblDocContents->size() || - pTempContents->size() != nChildren) + if (aTempContents.size() != m_pSwGlblDocContents->size() || + aTempContents.size() != nChildren) { bRet = true; bCopy = true; } else { - for(size_t i = 0; i < pTempContents->size() && !bCopy; i++) + for(size_t i = 0; i < aTempContents.size() && !bCopy; i++) { - SwGlblDocContent* pLeft = (*pTempContents)[i].get(); + SwGlblDocContent* pLeft = aTempContents[i].get(); SwGlblDocContent* pRight = (*m_pSwGlblDocContents)[i].get(); GlobalDocContentType eType = pLeft->GetType(); OUString sTemp = m_xTreeView->get_text(i); @@ -902,7 +902,7 @@ bool SwGlobalTree::Update(bool bHard) } if (bCopy || bHard) { - *m_pSwGlblDocContents = std::move( *pTempContents ); + *m_pSwGlblDocContents = std::move( aTempContents ); bRet = true; } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits