diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-17 13:09:11 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-18 06:58:44 +0000 |
commit | d96c114171dada05caffd9a50f870809ebd0c450 (patch) | |
tree | 2ef1572fce732c39557b3f2f944aef86f17aa703 /sw | |
parent | 70aa5799336de6cbd1d964e2e9a176b44d438db2 (diff) |
clang-tidy modernize-make-shared
Change-Id: I3fa866bfb3093fc876474a9d9db29fe05dc2af3a
Reviewed-on: https://gerrit.libreoffice.org/25056
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/doclay.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/tblrwcl.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/frmedt/fecopy.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj2.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unoportenum.cxx | 23 | ||||
-rw-r--r-- | sw/source/core/unocore/unorefmk.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/WW8TableInfo.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexport.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfsdrexport.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/frmdlg/colex.cxx | 19 |
12 files changed, 40 insertions, 46 deletions
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 3b0aff2f1a34..10b218a25586 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -529,7 +529,7 @@ SwPosFlyFrames SwDoc::GetAllFlyFormats( const SwPaM* pCmpRange, bool bDrawAlso, if( pCmpRange && !lcl_TstFlyRange( pCmpRange, pAPos, rAnchor.GetAnchorId() )) continue; // not a valid FlyFrame - aRetval.insert(SwPosFlyFramePtr(new SwPosFlyFrame(pAPos->nNode, pFly, aRetval.size()))); + aRetval.insert(std::make_shared<SwPosFlyFrame>(pAPos->nNode, pFly, aRetval.size())); } } } @@ -578,7 +578,7 @@ SwPosFlyFrames SwDoc::GetAllFlyFormats( const SwPaM* pCmpRange, bool bDrawAlso, if ( pContentFrame ) { SwNodeIndex aIdx( *pContentFrame->GetNode() ); - aRetval.insert(SwPosFlyFramePtr(new SwPosFlyFrame(aIdx, pFly, aRetval.size()))); + aRetval.insert(std::make_shared<SwPosFlyFrame>(aIdx, pFly, aRetval.size())); } } } diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 404167e22410..566457ea02ca 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -1736,8 +1736,8 @@ static void lcl_CalcNewWidths(const FndLines_t& rFndLines, CpyPara& rPara) const size_t nLineCount = rFndLines.size(); if( nLineCount ) { - rPara.pWidths = std::shared_ptr< std::vector< std::vector< sal_uLong > > > - ( new std::vector< std::vector< sal_uLong > >( nLineCount )); + rPara.pWidths = std::make_shared< std::vector< std::vector< sal_uLong > > > + ( nLineCount ); // First we collect information about the left/right borders of all // selected cells for( size_t nLine = 0; nLine < nLineCount; ++nLine ) diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index cf9aa55a9a44..5506cb9b8e58 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -753,8 +753,8 @@ bool SwFEShell::Paste( SwDoc* pClpDoc ) OSL_ENSURE( aIdx.GetNode().GetContentNode(), "Who filled the clipboard?!" ); if( aIdx.GetNode().GetContentNode() ) // robust { - Insertion aInsertion( PaMPtr( new SwPaM( aIdx ) ), - PositionPtr( new SwPosition( aInsertPos ) ) ); + Insertion aInsertion( std::make_shared<SwPaM>( aIdx ), + std::make_shared<SwPosition>( aInsertPos ) ); ++aIdx; aInsertion.first->SetMark(); if( pStartCursor == pCurrCursor->GetNext() ) diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 60c3a29497cf..71619b352d6b 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1661,7 +1661,7 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl( } else if (pFormat) { - m_vFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFormat))); + m_vFrames.push_back(std::make_shared<sw::FrameClient>(pFormat)); } else if ((PARAFRAME_PORTION_CHAR == eParaFrameMode) || (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode)) @@ -1672,7 +1672,7 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl( for(const auto& pFlyFrame : rPaM.GetDoc()->GetAllFlyFormats(&GetCursor(), false, true)) { const auto pFrameFormat = const_cast<SwFrameFormat*>(&pFlyFrame->GetFormat()); - m_vFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat))); + m_vFrames.push_back(std::make_shared<sw::FrameClient>(pFrameFormat)); } } FillFrame(); @@ -1692,7 +1692,7 @@ void SwXParaFrameEnumerationImpl::FillFrame() return; const SwFormatFlyCnt& rFlyCnt = pTextAttr->GetFlyCnt(); SwFrameFormat* const pFrameFormat = rFlyCnt.GetFrameFormat(); - m_vFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat))); + m_vFrames.push_back(std::make_shared<sw::FrameClient>(pFrameFormat)); } bool SwXParaFrameEnumerationImpl::CreateNextObject() diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 918d1f7b7722..1f0db3dfda0c 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -142,10 +142,9 @@ namespace ::sw::mark::CrossRefBookmark *const pCrossRefMark(dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk)); sal_uInt8 const nType = (hasOther || pCrossRefMark) ? BKM_TYPE_START : BKM_TYPE_START_END; - rBkmArr.insert(SwXBookmarkPortion_ImplSharedPtr( - new SwXBookmarkPortion_Impl( + rBkmArr.insert(std::make_shared<SwXBookmarkPortion_Impl>( SwXBookmark::CreateXBookmark(rDoc, pBkmk), - nType, rStartPos))); + nType, rStartPos)); } const SwPosition& rEndPos = pBkmk->GetMarkEnd(); @@ -167,10 +166,9 @@ namespace } if(pEndPos) { - rBkmArr.insert(SwXBookmarkPortion_ImplSharedPtr( - new SwXBookmarkPortion_Impl( + rBkmArr.insert(std::make_shared<SwXBookmarkPortion_Impl>( SwXBookmark::CreateXBookmark(rDoc, pBkmk), - BKM_TYPE_END, *pEndPos))); + BKM_TYPE_END, *pEndPos)); } } } @@ -302,11 +300,10 @@ namespace if ( pAnnotationFormatField != nullptr ) { rAnnotationStartArr.insert( - SwAnnotationStartPortion_ImplSharedPtr( - new SwAnnotationStartPortion_Impl( + std::make_shared<SwAnnotationStartPortion_Impl>( SwXTextField::CreateXTextField(&rDoc, pAnnotationFormatField), - rStartPos))); + rStartPos)); } } } @@ -1073,11 +1070,11 @@ static void lcl_FillRedlineArray( const SwPosition* pRedStart = pRedline->Start(); const SwNodeIndex nRedNode = pRedStart->nNode; if ( nOwnNode == nRedNode ) - rRedArr.insert( SwXRedlinePortion_ImplSharedPtr ( - new SwXRedlinePortion_Impl ( pRedline, true ) ) ); + rRedArr.insert( std::make_shared<SwXRedlinePortion_Impl>( + pRedline, true ) ); if( pRedline->HasMark() && pRedline->End()->nNode == nOwnNode ) - rRedArr.insert( SwXRedlinePortion_ImplSharedPtr ( - new SwXRedlinePortion_Impl ( pRedline, false) ) ); + rRedArr.insert( std::make_shared<SwXRedlinePortion_Impl>( + pRedline, false ) ); } } } diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx index 0d538d2cd95f..bcf505bac471 100644 --- a/sw/source/core/unocore/unorefmk.cxx +++ b/sw/source/core/unocore/unorefmk.cxx @@ -1031,7 +1031,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) : SetAttrMode::DONTEXPAND ); const std::shared_ptr< ::sw::Meta> pMeta( (RES_TXTATR_META == i_nWhich) - ? std::shared_ptr< ::sw::Meta>( new ::sw::Meta() ) + ? std::make_shared< ::sw::Meta>( ) : std::shared_ptr< ::sw::Meta>( pDoc->GetMetaFieldManager().makeMetaField()) ); SwFormatMeta meta(pMeta, i_nWhich); // this is cloned by Insert! diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index 870077a2dcfd..ba2f094e5135 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -265,7 +265,7 @@ WidthsPtr WW8TableNodeInfoInner::getColumnWidthsBasedOnAllRows() // Calculate the widths based on the position of the unique & sorted // column separators - pWidths = WidthsPtr(new Widths); + pWidths = std::make_shared<Widths>(); sal_uInt32 nPreviousWidth = 0; Widths::const_iterator aItEnd2 = pSeparators->end(); for (Widths::const_iterator aIt2 = pSeparators->begin(); aIt2 != aItEnd2; ++aIt2) @@ -296,7 +296,7 @@ WidthsPtr WW8TableNodeInfoInner::getWidthsOfRow() const SwTableLine * pTabLine = pTabBox->GetUpper(); const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes(); - pWidths = WidthsPtr(new Widths); + pWidths = std::make_shared<Widths>(); // number of cell written sal_uInt32 nBoxes = rTabBoxes.size(); if (nBoxes > MAXTABLECELLS) @@ -417,7 +417,7 @@ void WW8TableNodeInfo::setDepth(sal_uInt32 nDepth) Inners_t::iterator aIt = mInners.find(mnDepth); if (aIt == mInners.end()) - mInners[mnDepth] = WW8TableNodeInfoInner::Pointer_t(new WW8TableNodeInfoInner(this)); + mInners[mnDepth] = std::make_shared<ww8::WW8TableNodeInfoInner>(this); mInners[mnDepth]->setDepth(mnDepth); } @@ -856,7 +856,7 @@ WW8TableNodeInfo::Pointer_t WW8TableInfo::insertTableNodeInfo if (pNodeInfo.get() == nullptr) { pNodeInfo = - WW8TableNodeInfo::Pointer_t(new WW8TableNodeInfo(this, pNode)); + std::make_shared<ww8::WW8TableNodeInfo>(this, pNode); mMap.insert(Map_t::value_type(pNode, pNodeInfo)); } @@ -902,7 +902,7 @@ WW8TableCellGrid::Pointer_t WW8TableInfo::getCellGridForTable { if (bCreate) { - pResult = WW8TableCellGrid::Pointer_t(new WW8TableCellGrid); + pResult = std::make_shared<ww8::WW8TableCellGrid>(); mCellGridMap[pTable] = pResult; } } @@ -1056,7 +1056,7 @@ WW8TableCellGridRow::Pointer_t WW8TableCellGrid::getRow(long nTop, bool bCreate) { if (bCreate) { - pResult = WW8TableCellGridRow::Pointer_t(new WW8TableCellGridRow); + pResult = std::make_shared<ww8::WW8TableCellGridRow>(); m_aRows[nTop] = pResult; m_aRowTops.insert(nTop); } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 9eba299b355b..1678188120aa 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -494,7 +494,7 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT */ ww8::WW8TableInfo::Pointer_t pOldTableInfo = m_rExport.m_pTableInfo; //Reset the table infos after saving. - m_rExport.m_pTableInfo = ww8::WW8TableInfo::Pointer_t(new ww8::WW8TableInfo()); + m_rExport.m_pTableInfo = std::make_shared<ww8::WW8TableInfo>(); /** FDO#71834 : Save the table reference attributes before calling WriteDMLTextFrame, @@ -511,7 +511,7 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT // Reset table infos, otherwise the depth of the cells will be incorrect, // in case the text frame had table(s) and we try to export the // same table second time. - m_rExport.m_pTableInfo = ww8::WW8TableInfo::Pointer_t(new ww8::WW8TableInfo()); + m_rExport.m_pTableInfo = std::make_shared<ww8::WW8TableInfo>(); //reset the tableReference. m_pSerializer->startElementNS(XML_mc, XML_Fallback, FSEND); @@ -5117,7 +5117,7 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj) void DocxAttributeOutput::pushToTableExportContext(DocxTableExportContext& rContext) { rContext.m_pTableInfo = m_rExport.m_pTableInfo; - m_rExport.m_pTableInfo = ww8::WW8TableInfo::Pointer_t(new ww8::WW8TableInfo()); + m_rExport.m_pTableInfo = std::make_shared<ww8::WW8TableInfo>(); rContext.m_bTableCellOpen = m_tableReference->m_bTableCellOpen; m_tableReference->m_bTableCellOpen = false; diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 2aa0cf676a3b..b6eebc9f6d17 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1790,7 +1790,7 @@ void RtfAttributeOutput::writeTextFrame(const ww8::Frame& rFrame, bool bTextBox) { // Save table state, in case the inner text also contains a table. ww8::WW8TableInfo::Pointer_t pTableInfoOrig = m_rExport.m_pTableInfo; - m_rExport.m_pTableInfo = ww8::WW8TableInfo::Pointer_t(new ww8::WW8TableInfo()); + m_rExport.m_pTableInfo = std::make_shared<ww8::WW8TableInfo>(); std::unique_ptr<SwWriteTable> pTableWrt(m_pTableWrt.release()); sal_uInt32 nTableDepth = m_nTableDepth; diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 729ce243b66c..2cd959a8643c 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -565,7 +565,7 @@ void RtfExport::WritePageDescTable() // reset table infos, otherwise the depth of the cells will be incorrect, // in case the page style (header or footer) had tables - m_pTableInfo = ww8::WW8TableInfo::Pointer_t(new ww8::WW8TableInfo()); + m_pTableInfo = std::make_shared<ww8::WW8TableInfo>(); } void RtfExport::ExportDocument_Impl() diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx index 96a2bd4f1f6a..77d4645db57e 100644 --- a/sw/source/filter/ww8/rtfsdrexport.cxx +++ b/sw/source/filter/ww8/rtfsdrexport.cxx @@ -32,7 +32,7 @@ using namespace css; RtfSdrExport::RtfSdrExport(RtfExport& rExport) - : EscherEx(EscherExGlobalRef(new EscherExGlobal), nullptr), + : EscherEx(std::make_shared<EscherExGlobal>(), nullptr), m_rExport(rExport), m_rAttrOutput(static_cast<RtfAttributeOutput&>(m_rExport.AttrOutput())), m_pSdrObject(nullptr), diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx index 0da911b0ae84..4a42b146c3ad 100644 --- a/sw/source/uibase/frmdlg/colex.cxx +++ b/sw/source/uibase/frmdlg/colex.cxx @@ -135,9 +135,8 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); setHeaderFillAttributes( - drawinglayer::attribute::SdrAllFillAttributesHelperPtr( - new drawinglayer::attribute::SdrAllFillAttributesHelper( - aTempSet))); + std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>( + aTempSet)); } if ( rHeaderSet.GetItemState( RES_BOX ) == SfxItemState::SET ) @@ -182,9 +181,8 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); setFooterFillAttributes( - drawinglayer::attribute::SdrAllFillAttributesHelperPtr( - new drawinglayer::attribute::SdrAllFillAttributesHelper( - aTempSet))); + std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>( + aTempSet)); } if( rFooterSet.GetItemState( RES_BOX ) == SfxItemState::SET ) @@ -206,9 +204,8 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); setPageFillAttributes( - drawinglayer::attribute::SdrAllFillAttributesHelperPtr( - new drawinglayer::attribute::SdrAllFillAttributesHelper( - aTempSet))); + std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>( + aTempSet)); } Invalidate(); @@ -255,8 +252,8 @@ void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOr const Color& rFieldColor = rStyleSettings.GetFieldColor(); setPageFillAttributes( - drawinglayer::attribute::SdrAllFillAttributesHelperPtr( - new drawinglayer::attribute::SdrAllFillAttributesHelper(rFieldColor))); + std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>( + rFieldColor)); } // #97495# make sure that the automatic column width's are always equal |