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 /sw/source/filter | |
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>
Diffstat (limited to 'sw/source/filter')
-rw-r--r-- | sw/source/filter/html/htmlctxt.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/html/htmltab.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/html/swhtml.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/WW8Sttbf.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/WW8TableInfo.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8glsy.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8toolbar.cxx | 6 |
14 files changed, 37 insertions, 38 deletions
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; } |