diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-24 13:21:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-24 20:40:37 +0100 |
commit | 9b8013b20d20a3946146d5287e8d8f8b9ddf694d (patch) | |
tree | 7bcfb26045aad3dc0f54dfaba4cd08d619a12a47 | |
parent | 3bbc0cf67cd5aa0ec5a1997794d21a87830bc618 (diff) |
loplugin:makeshared in sw
Change-Id: I6b297b84edda441c4ec6ea9f89ed553a50783bf5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87356
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
40 files changed, 87 insertions, 88 deletions
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 3a707437f2f9..ac03070f20d0 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -774,7 +774,7 @@ void SwFormat::GetGrabBagItem(uno::Any& rVal) const void SwFormat::SetGrabBagItem(const uno::Any& rVal) { if (!m_pGrabBagItem.get()) - m_pGrabBagItem.reset(new SfxGrabBagItem); + m_pGrabBagItem = std::make_shared<SfxGrabBagItem>(); m_pGrabBagItem->PutValue(rVal, 0); } diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 22d2b85ed977..cc58624de54c 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1777,8 +1777,8 @@ namespace { Comparators aComparisons; //compare main text - aComparisons.emplace_back(CompareDataPtr(new CompareMainText(rSrcDoc)), - CompareDataPtr(new CompareMainText(rDestDoc))); + aComparisons.emplace_back(std::make_shared<CompareMainText>(rSrcDoc), + std::make_shared<CompareMainText>(rDestDoc)); //if we have the same number of frames then try to compare within them const SwFrameFormats *pSrcFrameFormats = rSrcDoc.GetSpzFrameFormats(); @@ -1806,8 +1806,8 @@ namespace { continue; // tdf#125660 don't redline GrfNode/OLENode } - aComparisons.emplace_back(CompareDataPtr(new CompareFrameFormatText(rSrcDoc, *pSrcIdx)), - CompareDataPtr(new CompareFrameFormatText(rDestDoc, *pDestIdx))); + aComparisons.emplace_back(std::make_shared<CompareFrameFormatText>(rSrcDoc, *pSrcIdx), + std::make_shared<CompareFrameFormatText>(rDestDoc, *pDestIdx)); } } return aComparisons; diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 4ab6e48b3785..9fa258c5676f 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -1043,7 +1043,7 @@ void SwNumRule::GetGrabBagItem(uno::Any& rVal) const void SwNumRule::SetGrabBagItem(const uno::Any& rVal) { if (!mpGrabBagItem.get()) - mpGrabBagItem.reset(new SfxGrabBagItem); + mpGrabBagItem = std::make_shared<SfxGrabBagItem>(); mpGrabBagItem->PutValue(rVal, 0); } diff --git a/sw/source/core/docnode/threadmanager.cxx b/sw/source/core/docnode/threadmanager.cxx index 6e73f31168a9..c2e7c46ed4a2 100644 --- a/sw/source/core/docnode/threadmanager.cxx +++ b/sw/source/core/docnode/threadmanager.cxx @@ -49,7 +49,7 @@ ThreadManager::ThreadManager( uno::Reference< util::XJobManager > const & rThrea void ThreadManager::Init() { - mpThreadListener.reset( new ThreadListener( *this ) ); + mpThreadListener = std::make_shared<ThreadListener>( *this ); maStartNewThreadIdle.SetPriority( TaskPriority::LOWEST ); maStartNewThreadIdle.SetInvokeHandler( LINK( this, ThreadManager, TryToStartNewThread ) ); diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index a2d5249daab3..a9b4a502209b 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -182,12 +182,12 @@ bool SwEditShell::Copy( SwEditShell* pDestShell ) SwCursor aCursor( *pPos, nullptr); if (aCursor.UpDown(false, nMove, nullptr, 0, *GetLayout())) { - pInsertPos.reset( new SwPosition( *aCursor.GetPoint() ) ); + pInsertPos = std::make_shared<SwPosition>( *aCursor.GetPoint() ); aInsertList.push_back( pInsertPos ); } } else - pInsertPos.reset( new SwPosition( *pPos ) ); + pInsertPos = std::make_shared<SwPosition>( *pPos ); ++nMove; } SwPosition *pTmp = IsBlockMode() ? pInsertPos.get() : pPos; diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 9f5710cbc4f5..b1553c36bcd5 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -3518,7 +3518,7 @@ drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFrameFormat::getSdrAllF // create FillAttributes on demand if(!maFillAttributes.get()) { - const_cast< SwFrameFormat* >(this)->maFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(GetAttrSet())); + const_cast< SwFrameFormat* >(this)->maFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(GetAttrSet()); } } else diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 72b65395cdf3..54da14443856 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -6256,14 +6256,14 @@ void SwFrame::PaintSwFrameBackground( const SwRect &rRect, const SwPageFrame *pP pTmpBackBrush.reset(new SvxBrushItem( COL_WHITE, RES_BACKGROUND )); //UUU - aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(COL_WHITE)); + aFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(COL_WHITE); } else { pTmpBackBrush.reset(new SvxBrushItem( aGlobalRetoucheColor, RES_BACKGROUND)); //UUU - aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aGlobalRetoucheColor)); + aFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aGlobalRetoucheColor); } pItem = pTmpBackBrush.get(); @@ -6321,7 +6321,7 @@ void SwFrame::PaintSwFrameBackground( const SwRect &rRect, const SwPageFrame *pP { pNewItem.reset(new SvxBrushItem( *pCol, RES_BACKGROUND )); pItem = pNewItem.get(); - aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pCol)); + aFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(*pCol); } SwRegionRects aRegion( aRect ); @@ -7244,9 +7244,9 @@ bool SwFrame::GetBackgroundBrush( if (pObject) { // Work with the fill attributes of the shape of the fly frame. - rFillAttributes.reset( - new drawinglayer::attribute::SdrAllFillAttributesHelper( - pObject->GetMergedItemSet())); + rFillAttributes = + std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>( + pObject->GetMergedItemSet()); bHandledTextBox = true; } } diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 135586eb6493..485bc87d64bf 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -116,7 +116,7 @@ void SAL_CALL SwOLEListener_Impl::stateChanged( const lang::EventObject&, ::sal_ if ( mpObj && nOldState == embed::EmbedStates::LOADED && nNewState == embed::EmbedStates::RUNNING ) { if (!g_pOLELRU_Cache) - g_pOLELRU_Cache.reset(new SwOLELRUCache); + g_pOLELRU_Cache = std::make_shared<SwOLELRUCache>(); g_pOLELRU_Cache->InsertObj( *mpObj ); } else if ( mpObj && nNewState == embed::EmbedStates::LOADED && nOldState == embed::EmbedStates::RUNNING ) @@ -954,7 +954,7 @@ uno::Reference < embed::XEmbeddedObject > const & SwOLEObj::GetOleRef() { // move object to first position in cache if (!g_pOLELRU_Cache) - g_pOLELRU_Cache.reset(new SwOLELRUCache); + g_pOLELRU_Cache = std::make_shared<SwOLELRUCache>(); g_pOLELRU_Cache->InsertObj( *this ); } diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx index 67887904e891..42f947d4d868 100644 --- a/sw/source/core/tox/ToxTextGenerator.cxx +++ b/sw/source/core/tox/ToxTextGenerator.cxx @@ -104,7 +104,7 @@ ToxTextGenerator::GetNumStringOfFirstNode(const SwTOXSortTabBase& rBase, ToxTextGenerator::ToxTextGenerator(const SwForm& toxForm, std::shared_ptr<ToxTabStopTokenHandler> const & tabStopHandler) : mToxForm(toxForm), - mLinkProcessor(new ToxLinkProcessor()), + mLinkProcessor(std::make_shared<ToxLinkProcessor>()), mTabStopTokenHandler(tabStopHandler) {} diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index c7587c328a85..3bc232ece517 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -512,10 +512,10 @@ void SwTextField::GetPamForTextField( const SwTextNode& rTextNode = rTextField.GetTextNode(); - rPamForTextField.reset( new SwPaM( rTextNode, + rPamForTextField = std::make_shared<SwPaM>( rTextNode, (rTextField.End() != nullptr) ? *(rTextField.End()) : ( rTextField.GetStart() + 1 ), rTextNode, - rTextField.GetStart() ) ); + rTextField.GetStart() ); } diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index 77ee06fcd7d7..e825a99a856c 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -613,7 +613,7 @@ void SwFormatMeta::DoCopy(::sw::MetaFieldManager & i_rTargetDocManager, const std::shared_ptr< ::sw::Meta> pOriginal( m_pMeta ); if (RES_TXTATR_META == Which()) { - m_pMeta.reset( new ::sw::Meta(this) ); + m_pMeta = std::make_shared<::sw::Meta>(this); } else { diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 9b2095a27e55..be604ee78542 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -5335,7 +5335,7 @@ drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwTextNode::getSdrAllFill // create SdrAllFillAttributesHelper on demand if(!maFillAttributes.get()) { - const_cast< SwTextNode* >(this)->maFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(GetSwAttrSet())); + const_cast< SwTextNode* >(this)->maFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(GetSwAttrSet()); } return maFillAttributes; diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 8c212feb8962..8a53a7d9ed8f 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -1298,8 +1298,8 @@ void SaveBox::SaveContentAttrs( SwDoc* pDoc ) std::shared_ptr<SfxItemSet> pSet; if( pCNd->HasSwAttrSet() ) { - pSet.reset( new SfxItemSet( pDoc->GetAttrPool(), - aSave_BoxContentSet ) ); + pSet = std::make_shared<SfxItemSet>( pDoc->GetAttrPool(), + aSave_BoxContentSet ); pSet->Put( *pCNd->GetpSwAttrSet() ); } diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 38dc1c997c00..4254b3fa42c6 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -2120,7 +2120,7 @@ SwXTextField::getAnchor() { if ((*ppMark)->GetName() == pPostItField->GetName()) { - pPamForTextField.reset(new SwPaM((*ppMark)->GetMarkStart(), (*ppMark)->GetMarkEnd())); + pPamForTextField = std::make_shared<SwPaM>((*ppMark)->GetMarkStart(), (*ppMark)->GetMarkEnd()); break; } } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 3e3838c270ec..4ca49fee3864 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -4654,7 +4654,7 @@ SwXTextCellStyle::SwXTextCellStyle(SwDocShell* pDocShell, SwBoxAutoFormat* pBoxA SwXTextCellStyle::SwXTextCellStyle(SwDocShell* pDocShell, const OUString& sName) : m_pDocShell(pDocShell), - m_pBoxAutoFormat_Impl(new SwBoxAutoFormat()), + m_pBoxAutoFormat_Impl(std::make_shared<SwBoxAutoFormat>()), m_sName(sName), m_bPhysical(false) { diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index 523d8a585172..78c0bc0e0020 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -444,7 +444,7 @@ void SwViewShellImp::InvalidateAccessiblePreviewSelection( sal_uInt16 nSelPage ) SwAccessibleMap *SwViewShellImp::CreateAccessibleMap() { assert(!m_pAccessibleMap); - m_pAccessibleMap.reset(new SwAccessibleMap(GetShell())); + m_pAccessibleMap = std::make_shared<SwAccessibleMap>(GetShell()); return m_pAccessibleMap.get(); } diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx index 48a270b80862..5ed9cf0427ff 100644 --- a/sw/source/filter/html/htmlctxt.cxx +++ b/sw/source/filter/html/htmlctxt.cxx @@ -101,7 +101,7 @@ std::shared_ptr<HTMLAttrTable> const & HTMLAttrContext_SaveDoc::GetAttrTab( bool { if (!xAttrTab && bCreate) { - xAttrTab.reset(new HTMLAttrTable); + xAttrTab = std::make_shared<HTMLAttrTable>(); memset(xAttrTab.get(), 0, sizeof(HTMLAttrTable)); } return xAttrTab; diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index dc9c5a7e9180..e0926eb9dbb9 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -143,7 +143,7 @@ public: bRestartPRE( false ), bRestartXMP( false ), bRestartListing( false ), - xAttrTab(new HTMLAttrTable) + xAttrTab(std::make_shared<HTMLAttrTable>()) { memset(xAttrTab.get(), 0, sizeof(HTMLAttrTable)); } @@ -691,7 +691,7 @@ const std::shared_ptr<SwHTMLTableLayoutCnts>& HTMLTableCnts::CreateLayoutInfo() std::shared_ptr<SwHTMLTableLayout> xTableInfo; if (m_xTable) xTableInfo = m_xTable->CreateLayoutInfo(); - m_xLayoutInfo.reset(new SwHTMLTableLayoutCnts(m_pStartNode, xTableInfo, m_bNoBreak, xNextInfo)); + m_xLayoutInfo = std::make_shared<SwHTMLTableLayoutCnts>(m_pStartNode, xTableInfo, m_bNoBreak, xNextInfo); } return m_xLayoutInfo; @@ -750,7 +750,7 @@ void HTMLTableCell::SetProtected() // Copy background color if (m_xBGBrush) - m_xBGBrush.reset(new SvxBrushItem(*m_xBGBrush)); + m_xBGBrush = std::make_shared<SvxBrushItem>(*m_xBGBrush); m_nRowSpan = 1; m_nColSpan = 1; @@ -1096,13 +1096,13 @@ const std::shared_ptr<SwHTMLTableLayout>& HTMLTable::CreateLayoutInfo() sal_uInt16 nRightBorderWidth = m_bRightBorder ? GetBorderWidth( m_aRightBorderLine, true ) : 0; - m_xLayoutInfo.reset(new SwHTMLTableLayout( + m_xLayoutInfo = std::make_shared<SwHTMLTableLayout>( m_pSwTable, m_nRows, m_nCols, m_bFixedCols, m_bColSpec, nW, m_bPercentWidth, m_nBorder, m_nCellPadding, m_nCellSpacing, m_eTableAdjust, m_nLeftMargin, m_nRightMargin, - nBorderWidth, nLeftBorderWidth, nRightBorderWidth)); + nBorderWidth, nLeftBorderWidth, nRightBorderWidth); bool bExportable = true; sal_uInt16 i; @@ -4488,7 +4488,7 @@ public: CaptionSaveStruct( SwHTMLParser& rParser, const SwPosition& rPos ) : SectionSaveStruct( rParser ), aSavePos( rPos ), - xAttrTab(new HTMLAttrTable) + xAttrTab(std::make_shared<HTMLAttrTable>()) { rParser.SaveAttrTab(xAttrTab); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 845ca782f394..c67078f24619 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -261,7 +261,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn, : SfxHTMLParser( rIn, bReadNewDoc, pMed ), m_aPathToFile( rPath ), m_sBaseURL( rBaseURL ), - m_xAttrTab(new HTMLAttrTable), + m_xAttrTab(std::make_shared<HTMLAttrTable>()), m_pNumRuleInfo( new SwHTMLNumRuleInfo ), m_xDoc( pD ), m_pActionViewShell( nullptr ), diff --git a/sw/source/filter/ww8/WW8Sttbf.hxx b/sw/source/filter/ww8/WW8Sttbf.hxx index afd4e696780d..89ec4113b308 100644 --- a/sw/source/filter/ww8/WW8Sttbf.hxx +++ b/sw/source/filter/ww8/WW8Sttbf.hxx @@ -105,7 +105,7 @@ namespace ww8 if (ncbExtra > 0) { - ExtraPointer_t pExtra(new T(this, nOffset, ncbExtra)); + ExtraPointer_t pExtra = std::make_shared<T>(this, nOffset, ncbExtra); m_Extras.push_back(pExtra); nOffset += ncbExtra; diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index b0227b75813e..81fa51e5d5e4 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -131,7 +131,7 @@ const SwNode * WW8TableNodeInfoInner::getNode() const TableBoxVectorPtr WW8TableNodeInfoInner::getTableBoxesOfRow() const { - TableBoxVectorPtr pResult(new TableBoxVector); + TableBoxVectorPtr pResult = std::make_shared<TableBoxVector>(); WW8TableCellGrid::Pointer_t pCellGrid = mpParent->getParent()->getCellGridForTable(getTable(), false); @@ -157,7 +157,7 @@ TableBoxVectorPtr WW8TableNodeInfoInner::getTableBoxesOfRow() const GridColsPtr WW8TableNodeInfoInner::getGridColsOfRow(AttributeOutputBase & rBase, bool calculateColumnsFromAllRows) { - GridColsPtr pResult(new GridCols); + GridColsPtr pResult = std::make_shared<GridCols>(); WidthsPtr pWidths; // Check which columns should be checked - only the current row, @@ -235,7 +235,7 @@ WidthsPtr WW8TableNodeInfoInner::getColumnWidthsBasedOnAllRows() const // Go over all the rows - and for each row - calculate where // there is a separator between columns - WidthsPtr pSeparators(new Widths); + WidthsPtr pSeparators = std::make_shared<Widths>(); for ( size_t nLineIndex = 0; nLineIndex < nNumOfLines; ++nLineIndex ) { const SwTableLine *pCurrentLine = rTableLines[nLineIndex]; @@ -312,7 +312,7 @@ WidthsPtr WW8TableNodeInfoInner::getWidthsOfRow() const RowSpansPtr WW8TableNodeInfoInner::getRowSpansOfRow() const { - RowSpansPtr pResult(new RowSpans); + RowSpansPtr pResult = std::make_shared<RowSpans>(); WW8TableCellGrid::Pointer_t pCellGrid = mpParent->getParent()->getCellGridForTable(getTable(), false); @@ -1100,7 +1100,7 @@ void WW8TableCellGrid::addShadowCells() CellInfoMultiSet::const_iterator aCellIt = getCellsBegin(*aTopsIt); CellInfoMultiSet::const_iterator aCellEndIt = getCellsEnd(*aTopsIt); - RowSpansPtr pRowSpans(new RowSpans); + RowSpansPtr pRowSpans = std::make_shared<RowSpans>(); bool bBeginningOfCell = true; bool bVertMerge = false; @@ -1173,8 +1173,8 @@ WW8TableNodeInfo * WW8TableCellGrid::connectCells(RowEndInners_t &rLastRowEnds) { CellInfoMultiSet::const_iterator aCellIt = getCellsBegin(*aTopsIt); CellInfoMultiSet::const_iterator aCellEndIt = getCellsEnd(*aTopsIt); - GridColsPtr pWidths(new Widths); - TableBoxVectorPtr pTableBoxes(new TableBoxVector); + GridColsPtr pWidths = std::make_shared<Widths>(); + TableBoxVectorPtr pTableBoxes = std::make_shared<TableBoxVector>(); sal_uInt32 nShadows = 0; sal_uInt32 nCell = 0; @@ -1401,7 +1401,7 @@ RowSpansPtr WW8TableCellGrid::getRowSpansOfRow } WW8TableCellGridRow::WW8TableCellGridRow() -: m_pCellInfos(new CellInfoMultiSet) +: m_pCellInfos(std::make_shared<CellInfoMultiSet>()) { } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index cef9035c15e9..bab586264976 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -700,8 +700,7 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT } else { - std::shared_ptr<ww8::Frame> pFramePr; - pFramePr.reset(new ww8::Frame(aFrame)); + std::shared_ptr<ww8::Frame> pFramePr = std::make_shared<ww8::Frame>(aFrame); aFramePrTextbox.push_back(pFramePr); } } @@ -9179,7 +9178,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, const FSHelperPtr m_nextFontId( 1 ), m_tableReference(new TableReference()), m_bIgnoreNextFill(false), - m_pTableStyleExport(new DocxTableStyleExport(rExport.m_pDoc, pSerializer)), + m_pTableStyleExport(std::make_shared<DocxTableStyleExport>(rExport.m_pDoc, pSerializer)), m_bParaBeforeAutoSpacing(false), m_bParaAfterAutoSpacing(false), m_nParaBeforeSpacing(0), diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index b01944d89467..24d5204383ac 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1507,7 +1507,7 @@ SwEscherExGlobal::~SwEscherExGlobal() SvStream* SwEscherExGlobal::ImplQueryPictureStream() { // this function will be called exactly once - mxPicStrm.reset( new SvMemoryStream ); + mxPicStrm = std::make_shared<SvMemoryStream>(); mxPicStrm->SetEndian(SvStreamEndian::LITTLE); return mxPicStrm.get(); } diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 1b251d6b569f..5815d7cb72b8 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3652,7 +3652,7 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, std::shared_ptr<SwUnoCurso , m_pTopNodeOfHdFtPage(nullptr) , m_pBkmks(nullptr) , m_pRedlAuthors(nullptr) - , m_pTableInfo(new ww8::WW8TableInfo()) + , m_pTableInfo(std::make_shared<ww8::WW8TableInfo>()) , m_nCharFormatStart(0) , m_nFormatCollStart(0) , m_nStyleBeforeFly(0) @@ -4152,7 +4152,7 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer if (nShadowsBefore > 0) { ww8::WW8TableNodeInfoInner::Pointer_t - pTmpNodeInfoInner(new ww8::WW8TableNodeInfoInner(nullptr)); + pTmpNodeInfoInner = std::make_shared<ww8::WW8TableNodeInfoInner>(nullptr); pTmpNodeInfoInner->setDepth(pNodeInfoInner->getDepth()); pTmpNodeInfoInner->setEndOfCell(true); @@ -4187,7 +4187,7 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer if (nShadowsAfter > 0) { ww8::WW8TableNodeInfoInner::Pointer_t - pTmpNodeInfoInner(new ww8::WW8TableNodeInfoInner(nullptr)); + pTmpNodeInfoInner= std::make_shared<ww8::WW8TableNodeInfoInner>(nullptr); pTmpNodeInfoInner->setDepth(pNodeInfoInner->getDepth()); pTmpNodeInfoInner->setEndOfCell(true); @@ -4272,7 +4272,7 @@ const NfKeywordTable & MSWordExportBase::GetNfKeywordTable() { if (m_pKeyMap == nullptr) { - m_pKeyMap.reset(new NfKeywordTable); + m_pKeyMap = std::make_shared<NfKeywordTable>(); NfKeywordTable & rKeywordTable = *m_pKeyMap; rKeywordTable[NF_KEY_D] = "d"; rKeywordTable[NF_KEY_DD] = "dd"; diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index cb23b4ac8d41..a60cfb202ad4 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -49,7 +49,7 @@ WW8Glossary::WW8Glossary(tools::SvRef<SotStorageStream> &refStrm, sal_uInt8 nVer if (xTableStream.is() && ERRCODE_NONE == xTableStream->GetError()) { xTableStream->SetEndian(SvStreamEndian::LITTLE); - xGlossary.reset(new WW8GlossaryFib(*refStrm, nVersion, aWwFib)); + xGlossary = std::make_shared<WW8GlossaryFib>(*refStrm, nVersion, aWwFib); } } } diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index e4c84d297b8b..9e93aef7c14a 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -600,7 +600,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp, paragraph mark as part of the paragraph text. */ WW8ReaderSave aSave(this); - m_xPlcxMan.reset(new WW8PLCFMan(m_xSBase.get(), eType, nStartCp, true)); + m_xPlcxMan = std::make_shared<WW8PLCFMan>(m_xSBase.get(), eType, nStartCp, true); WW8_CP nStart = m_xPlcxMan->Where(); WW8_CP nNext, nStartReplace=0; diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index ac1ad3c0bb1b..92aa8e00c2e8 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2037,8 +2037,8 @@ WW8ReaderSave::WW8ReaderSave(SwWW8ImplReader* pRdr ,WW8_CP nStartCp) : if (nStartCp != -1) { - pRdr->m_xPlcxMan.reset(new WW8PLCFMan(pRdr->m_xSBase.get(), - mxOldPlcxMan->GetManType(), nStartCp)); + pRdr->m_xPlcxMan = std::make_shared<WW8PLCFMan>(pRdr->m_xSBase.get(), + mxOldPlcxMan->GetManType(), nStartCp); } maOldApos.push_back(false); @@ -4048,7 +4048,7 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType) m_bSpec = false; m_bPgSecBreak = false; - m_xPlcxMan.reset(new WW8PLCFMan(m_xSBase.get(), nType, nStartCp)); + m_xPlcxMan = std::make_shared<WW8PLCFMan>(m_xSBase.get(), nType, nStartCp); long nCpOfs = m_xPlcxMan->GetCpOfs(); // Offset for Header/Footer, Footnote WW8_CP nNext = m_xPlcxMan->Where(); @@ -5007,7 +5007,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss) m_rDoc.getIDocumentExternalData().setExternalData(::sw::tExternalDataType::FIB, pExternalFibData); ::sw::tExternalDataPointer pSttbfAsoc - (new ::ww8::WW8Sttb<ww8::WW8Struct>(*m_pTableStream, m_xWwFib->m_fcSttbfAssoc, m_xWwFib->m_lcbSttbfAssoc)); + = std::make_shared<::ww8::WW8Sttb<ww8::WW8Struct>>(*m_pTableStream, m_xWwFib->m_fcSttbfAssoc, m_xWwFib->m_lcbSttbfAssoc); m_rDoc.getIDocumentExternalData().setExternalData(::sw::tExternalDataType::STTBF_ASSOC, pSttbfAsoc); @@ -5755,7 +5755,7 @@ ErrCode SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) if (pGloss) m_xWwFib = pGloss->GetFib(); else - m_xWwFib.reset(new WW8Fib(*m_pStrm, m_nWantedVersion)); + m_xWwFib = std::make_shared<WW8Fib>(*m_pStrm, m_nWantedVersion); if (m_xWwFib->m_nFibError) nErrRet = ERR_SWG_READ_ERROR; @@ -5926,7 +5926,7 @@ ErrCode SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) { m_pStrm = &aDecryptMain; - m_xWwFib.reset(new WW8Fib(*m_pStrm, m_nWantedVersion)); + m_xWwFib = std::make_shared<WW8Fib>(*m_pStrm, m_nWantedVersion); if (m_xWwFib->m_nFibError) nErrRet = ERR_SWG_READ_ERROR; } diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 4577a4e08fc4..53069581d400 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -3840,7 +3840,7 @@ bool WW8RStyle::PrepareStyle(SwWW8StyInf &rSI, ww::sti eSti, sal_uInt16 nThisSty rSI.m_bParaAutoAfter = pj->m_bParaAutoAfter; if (pj->m_xWWFly) - rSI.m_xWWFly.reset(new WW8FlyPara(mpIo->m_bVer67, pj->m_xWWFly.get())); + rSI.m_xWWFly = std::make_shared<WW8FlyPara>(mpIo->m_bVer67, pj->m_xWWFly.get()); } } else if( mpIo->m_bNewDoc && bStyExist ) diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index fc6a45e129dd..bb435b9a6485 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -5193,7 +5193,7 @@ void SwWW8ImplReader::Read_ApoPPC( sal_uInt16, const sal_uInt8* pData, short ) { SwWW8StyInf& rSI = m_vColl[m_nCurrentColl]; if (!rSI.m_xWWFly) - rSI.m_xWWFly.reset(new WW8FlyPara(m_bVer67)); + rSI.m_xWWFly = std::make_shared<WW8FlyPara>(m_bVer67); rSI.m_xWWFly->Read(*pData, m_xStyles.get()); if (rSI.m_xWWFly->IsEmpty()) { diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx index a6387e6d81db..e4909b83da01 100644 --- a/sw/source/filter/ww8/ww8toolbar.cxx +++ b/sw/source/filter/ww8/ww8toolbar.cxx @@ -241,7 +241,7 @@ bool Customization::Read( SvStream &rS) } else { - customizationDataCTB.reset( new SwCTB() ); + customizationDataCTB = std::make_shared<SwCTB>(); if ( !customizationDataCTB->Read( rS ) ) return false; } @@ -489,13 +489,13 @@ bool SwTBC::Read( SvStream &rS ) return false; if ( tbch.getTcID() != 0x1 && tbch.getTcID() != 0x1051 ) { - cid.reset( new sal_uInt32 ); + cid = std::make_shared<sal_uInt32>(); rS.ReadUInt32( *cid ); } // MUST exist if tbch.tct is not equal to 0x16 if ( tbch.getTct() != 0x16 ) { - tbcd.reset( new TBCData( tbch ) ); + tbcd = std::make_shared<TBCData>( tbch ); if ( !tbcd->Read( rS ) ) return false; } diff --git a/sw/source/ui/vba/vbadocumentproperties.cxx b/sw/source/ui/vba/vbadocumentproperties.cxx index cb6f6ea800be..ca803eaf8e80 100644 --- a/sw/source/ui/vba/vbadocumentproperties.cxx +++ b/sw/source/ui/vba/vbadocumentproperties.cxx @@ -807,7 +807,7 @@ public: CustomPropertiesImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : m_xParent( xParent ), m_xContext( xContext ), m_xModel( xModel ) { // suck in the document( custom ) properties - mpPropGetSetHelper.reset( new CustomPropertyGetSetHelper( m_xModel ) ); + mpPropGetSetHelper = std::make_shared<CustomPropertyGetSetHelper>( m_xModel ); mxUserDefinedProp.set(mpPropGetSetHelper->getUserDefinedProperties(), uno::UNO_SET_THROW); }; diff --git a/sw/source/ui/vba/vbalisttemplate.cxx b/sw/source/ui/vba/vbalisttemplate.cxx index b58ff029c0e5..36bf1f5913c4 100644 --- a/sw/source/ui/vba/vbalisttemplate.cxx +++ b/sw/source/ui/vba/vbalisttemplate.cxx @@ -27,7 +27,7 @@ using namespace ::com::sun::star; SwVbaListTemplate::SwVbaListTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) : SwVbaListTemplate_BASE( rParent, rContext ) { - pListHelper.reset( new SwVbaListHelper( xTextDoc, nGalleryType, nTemplateType ) ); + pListHelper = std::make_shared<SwVbaListHelper>( xTextDoc, nGalleryType, nTemplateType ); } SwVbaListTemplate::~SwVbaListTemplate() diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 5f13b7c034c8..073b9d4a911a 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -257,7 +257,7 @@ std::shared_ptr<SwMailMergeConfigItem> SwView::EnsureMailMergeConfigItem(const S std::shared_ptr<SwMailMergeConfigItem> xMMConfig = GetMailMergeConfigItem(); if (!xMMConfig) { - xMMConfig.reset(new SwMailMergeConfigItem); + xMMConfig = std::make_shared<SwMailMergeConfigItem>(); xMMConfig->SetSourceView(this); //set the first used database as default source on the config item diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 249b549dcb0e..6e242317c0d7 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -896,7 +896,7 @@ void SwDocShell::Edit( std::shared_ptr<SfxRequest> pRequest; if (pReq) { - pRequest.reset(new SfxRequest(*pReq)); + pRequest = std::make_shared<SfxRequest>(*pReq); pReq->Ignore(); // the 'old' request is not relevant any more } diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 1365e32b5aae..0fd0ffc46cf5 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1225,10 +1225,10 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, // construct the process dialog pSourceWindow = &pSourceShell->GetView().GetEditWin(); if (!bMT_PRINTER) - xProgressDlg.reset(new CreateMonitor(pSourceWindow->GetFrameWeld())); + xProgressDlg = std::make_shared<CreateMonitor>(pSourceWindow->GetFrameWeld()); else { - xProgressDlg.reset(new PrintMonitor(pSourceWindow->GetFrameWeld())); + xProgressDlg = std::make_shared<PrintMonitor>(pSourceWindow->GetFrameWeld()); static_cast<PrintMonitor*>(xProgressDlg.get())->set_title( pSourceDocSh->GetTitle(22)); } diff --git a/sw/source/uibase/docvw/FrameControlsManager.cxx b/sw/source/uibase/docvw/FrameControlsManager.cxx index 14808d2efe33..9d68bc950435 100644 --- a/sw/source/uibase/docvw/FrameControlsManager.cxx +++ b/sw/source/uibase/docvw/FrameControlsManager.cxx @@ -90,9 +90,9 @@ void SwFrameControlsManager::SetHeaderFooterControl( const SwPageFrame* pPageFra pControl = lb->second; else { - SwFrameControlPtr pNewControl( - new SwFrameControl( VclPtr<SwHeaderFooterWin>::Create( - m_pEditWin, pPageFrame, bHeader ).get() ) ); + SwFrameControlPtr pNewControl = + std::make_shared<SwFrameControl>( VclPtr<SwHeaderFooterWin>::Create( + m_pEditWin, pPageFrame, bHeader ).get() ); const SwViewOption* pViewOpt = m_pEditWin->GetView().GetWrtShell().GetViewOptions(); pNewControl->SetReadonly( pViewOpt->IsReadonly() ); rControls.insert(lb, make_pair(pPageFrame, pNewControl)); @@ -122,8 +122,8 @@ void SwFrameControlsManager::SetPageBreakControl( const SwPageFrame* pPageFrame pControl = lb->second; else { - SwFrameControlPtr pNewControl( new SwFrameControl( - VclPtr<SwPageBreakWin>::Create( m_pEditWin, pPageFrame ).get() ) ); + SwFrameControlPtr pNewControl = std::make_shared<SwFrameControl>( + VclPtr<SwPageBreakWin>::Create( m_pEditWin, pPageFrame ).get() ); const SwViewOption* pViewOpt = m_pEditWin->GetView().GetWrtShell().GetViewOptions(); pNewControl->SetReadonly( pViewOpt->IsReadonly() ); @@ -156,8 +156,8 @@ void SwFrameControlsManager::SetUnfloatTableButton( const SwFlyFrame* pFlyFrame, return; else { - SwFrameControlPtr pNewControl( new SwFrameControl( - VclPtr<UnfloatTableButton>::Create( m_pEditWin, pFlyFrame ).get() ) ); + SwFrameControlPtr pNewControl = std::make_shared<SwFrameControl>( + VclPtr<UnfloatTableButton>::Create( m_pEditWin, pFlyFrame ).get() ); const SwViewOption* pViewOpt = m_pEditWin->GetView().GetWrtShell().GetViewOptions(); pNewControl->SetReadonly( pViewOpt->IsReadonly() ); diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index 28853f47fd97..51ca56a971e9 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -372,9 +372,9 @@ void SwHeaderFooterWin::Paint(vcl::RenderContext& rRenderContext, const ::tools: drawinglayer::primitive2d::Primitive2DContainer aGhostedSeq(1); double nFadeRate = double(m_nFadeRate) / 100.0; - const basegfx::BColorModifierSharedPtr aBColorModifier( - new basegfx::BColorModifier_interpolate(COL_WHITE.getBColor(), - 1.0 - nFadeRate)); + const basegfx::BColorModifierSharedPtr aBColorModifier = + std::make_shared<basegfx::BColorModifier_interpolate>(COL_WHITE.getBColor(), + 1.0 - nFadeRate); aGhostedSeq[0] = drawinglayer::primitive2d::Primitive2DReference( new drawinglayer::primitive2d::ModifiedColorPrimitive2D(aSeq, aBColorModifier)); diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx index 39d1f848c05c..9bae7b6f2b84 100644 --- a/sw/source/uibase/docvw/PageBreakWin.cxx +++ b/sw/source/uibase/docvw/PageBreakWin.cxx @@ -200,9 +200,9 @@ void SwPageBreakWin::Paint(vcl::RenderContext& rRenderContext, const ::tools::Re drawinglayer::primitive2d::Primitive2DContainer aGhostedSeq(1); double nFadeRate = double(m_nFadeRate) / 100.0; - const basegfx::BColorModifierSharedPtr aBColorModifier( - new basegfx::BColorModifier_interpolate(COL_WHITE.getBColor(), - 1.0 - nFadeRate)); + const basegfx::BColorModifierSharedPtr aBColorModifier = + std::make_shared<basegfx::BColorModifier_interpolate>(COL_WHITE.getBColor(), + 1.0 - nFadeRate); aGhostedSeq[0].set( new drawinglayer::primitive2d::ModifiedColorPrimitive2D( aSeq, aBColorModifier)); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 252d432e8558..b3373d2cd85c 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -375,8 +375,8 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq) case SID_PASTE_SPECIAL: { - std::shared_ptr<TransferableDataHelper> aDataHelper; - aDataHelper.reset(new TransferableDataHelper(TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()))); + std::shared_ptr<TransferableDataHelper> aDataHelper = + std::make_shared<TransferableDataHelper>(TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin())); if( aDataHelper->GetXTransferable().is() && SwTransferable::IsPaste( rSh, *aDataHelper ) diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index ee09143f510e..17b15bdf87da 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -178,7 +178,7 @@ static void sw_CharDialog(SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot, std::shared_ptr<SfxRequest> pRequest; if (pReq) { - pRequest.reset(new SfxRequest(*pReq)); + pRequest = std::make_shared<SfxRequest>(*pReq); pReq->Ignore(); // the 'old' request is not relevant any more } pDlg->StartExecuteAsync([pDlg, &rWrtSh, pCoreSet, bSel, bSelectionPut, pRequest](sal_Int32 nResult){ |