diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-16 15:23:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-17 08:25:47 +0200 |
commit | ccb2a1f650bc505f8a4f1abebf8ce4f9396562a8 (patch) | |
tree | 2ee2fd4f300ae95cf23bade1f242e02f9b276c07 /sw/source/core/undo | |
parent | da5c3a1ee43dd1a07cbd1b8005488bf05432593d (diff) |
clang-tidy readability-redundant-smartptr-get
redundant get() call on smart pointer
Change-Id: Icb5a03bbc15e79a30d3d135a507d22914d15c2bd
Reviewed-on: https://gerrit.libreoffice.org/61837
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/undo')
-rw-r--r-- | sw/source/core/undo/rolbck.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/undo/unattr.cxx | 19 | ||||
-rw-r--r-- | sw/source/core/undo/unsect.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/undo/untbl.cxx | 4 |
4 files changed, 29 insertions, 24 deletions
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index df199cd5a472..b8048539f459 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -220,7 +220,7 @@ SwHistorySetText::~SwHistorySetText() void SwHistorySetText::SetInDoc( SwDoc* pDoc, bool ) { - if ( !m_pAttr.get() ) + if (!m_pAttr) return; if ( RES_TXTATR_CHARFMT == m_pAttr->Which() ) @@ -283,7 +283,7 @@ SwHistorySetTextField::~SwHistorySetTextField() void SwHistorySetTextField::SetInDoc( SwDoc* pDoc, bool ) { - if ( !m_pField.get() ) + if (!m_pField) return; SwFieldType* pNewFieldType = m_pFieldType.get(); @@ -461,7 +461,7 @@ void SwHistorySetFootnote::SetInDoc( SwDoc* pDoc, bool ) if ( !pTextNd ) return; - if ( m_pUndo.get() ) + if (m_pUndo) { // set the footnote in the TextNode SwFormatFootnote aTemp( m_bEndNote ); @@ -622,7 +622,7 @@ void SwHistoryBookmark::SetInDoc( SwDoc* pDoc, bool ) "<SwHistoryBookmark::SetInDoc(..)>" " - wrong node for a mark"); - if(pPam.get() != nullptr && pContentNd) + if (pPam != nullptr && pContentNd) { pPam->SetMark(); pPam->GetMark()->nNode = m_nOtherNode; @@ -640,7 +640,7 @@ void SwHistoryBookmark::SetInDoc( SwDoc* pDoc, bool ) *pPam->GetMark() = pMark->GetOtherMarkPos(); } - if(pPam.get()) + if (pPam) { if ( pMark != nullptr ) { diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index 514e4aaa1d13..d3b88108a725 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -161,7 +161,7 @@ void SwUndoFormatAttr::UndoImpl(::sw::UndoRedoContext & rContext) // OD 2004-10-26 #i35443# // Important note: <Undo(..)> also called by <ReDo(..)> - if ( !m_pOldSet.get() || !m_pFormat || !IsFormatInDoc( &rContext.GetDoc() )) + if (!m_pOldSet || !m_pFormat || !IsFormatInDoc(&rContext.GetDoc())) return; // #i35443# - If anchor attribute has been successful @@ -290,7 +290,7 @@ void SwUndoFormatAttr::RedoImpl(::sw::UndoRedoContext & rContext) void SwUndoFormatAttr::RepeatImpl(::sw::RepeatContext & rContext) { - if ( !m_pOldSet.get() ) + if (!m_pOldSet) return; SwDoc & rDoc(rContext.GetDoc()); @@ -535,14 +535,16 @@ SwUndoFormatResetAttr::~SwUndoFormatResetAttr() void SwUndoFormatResetAttr::UndoImpl(::sw::UndoRedoContext &) { - if ( m_pOldItem.get() ) { + if (m_pOldItem) + { m_pChangedFormat->SetFormatAttr( *m_pOldItem ); } } void SwUndoFormatResetAttr::RedoImpl(::sw::UndoRedoContext &) { - if ( m_pOldItem.get() ) { + if (m_pOldItem) + { m_pChangedFormat->ResetFormatAttr( m_nWhichId ); } } @@ -726,7 +728,8 @@ void SwUndoAttr::UndoImpl(::sw::UndoRedoContext & rContext) // remove all format redlines, will be recreated if needed SetPaM(aPam); pDoc->getIDocumentRedlineAccess().DeleteRedline(aPam, false, nsRedlineType_t::REDLINE_FORMAT); - if ( m_pRedlineSaveData.get() ) { + if (m_pRedlineSaveData) + { SetSaveData( *pDoc, *m_pRedlineSaveData ); } } @@ -849,7 +852,8 @@ SwUndoDefaultAttr::~SwUndoDefaultAttr() void SwUndoDefaultAttr::UndoImpl(::sw::UndoRedoContext & rContext) { SwDoc & rDoc = rContext.GetDoc(); - if ( m_pOldSet.get() ) { + if (m_pOldSet) + { SwUndoFormatAttrHelper aTmp( *rDoc.GetDfltTextFormatColl() ); rDoc.SetDefault( *m_pOldSet ); @@ -859,7 +863,8 @@ void SwUndoDefaultAttr::UndoImpl(::sw::UndoRedoContext & rContext) m_pOldSet = std::move(aTmp.GetUndo()->m_pOldSet); } } - if ( m_pTabStop.get() ) { + if (m_pTabStop) + { SvxTabStopItem* pOld = static_cast<SvxTabStopItem*>( rDoc.GetDefault( RES_PARATR_TABSTOP ).Clone() ); rDoc.SetDefault( *m_pTabStop ); diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index de7fa973ca9e..8f59781ae009 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -148,7 +148,7 @@ void SwUndoInsSection::UndoImpl(::sw::UndoRedoContext & rContext) Join( rDoc, nEndNode ); } - if (m_pHistory.get()) + if (m_pHistory) { m_pHistory->TmpRollback( &rDoc, 0, false ); } @@ -160,7 +160,7 @@ void SwUndoInsSection::UndoImpl(::sw::UndoRedoContext & rContext) AddUndoRedoPaM(rContext); - if( m_pRedlineSaveData.get()) + if (m_pRedlineSaveData) SetSaveData( rDoc, *m_pRedlineSaveData ); } @@ -170,7 +170,7 @@ void SwUndoInsSection::RedoImpl(::sw::UndoRedoContext & rContext) SwPaM & rPam( AddUndoRedoPaM(rContext) ); const SwTOXBaseSection* pUpdateTOX = nullptr; - if (m_pTOXBase.get()) + if (m_pTOXBase) { pUpdateTOX = rDoc.InsertTableOf( *rPam.GetPoint(), *m_pTOXBase, m_pAttrSet.get(), true); @@ -180,7 +180,7 @@ void SwUndoInsSection::RedoImpl(::sw::UndoRedoContext & rContext) rDoc.InsertSwSection(rPam, *m_pSectionData, nullptr, m_pAttrSet.get()); } - if (m_pHistory.get()) + if (m_pHistory) { m_pHistory->SetTmpEnd( m_pHistory->Count() ); } @@ -219,7 +219,7 @@ void SwUndoInsSection::RedoImpl(::sw::UndoRedoContext & rContext) void SwUndoInsSection::RepeatImpl(::sw::RepeatContext & rContext) { SwDoc & rDoc = rContext.GetDoc(); - if (m_pTOXBase.get()) + if (m_pTOXBase) { rDoc.InsertTableOf(*rContext.GetRepeatPaM().GetPoint(), *m_pTOXBase, m_pAttrSet.get(), true); @@ -244,7 +244,7 @@ void SwUndoInsSection::Join( SwDoc& rDoc, sal_uLong nNode ) } pTextNd->JoinNext(); - if (m_pHistory.get()) + if (m_pHistory) { SwIndex aCntIdx( pTextNd, 0 ); pTextNd->RstTextAttr( aCntIdx, pTextNd->Len(), 0, nullptr, true ); @@ -256,7 +256,7 @@ SwUndoInsSection::SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart) { if( pTextNd->GetpSwpHints() ) { - if (!m_pHistory.get()) + if (!m_pHistory) { m_pHistory.reset( new SwHistory ); } @@ -318,7 +318,7 @@ void SwUndoDelSection::UndoImpl(::sw::UndoRedoContext & rContext) { SwDoc & rDoc = rContext.GetDoc(); - if (m_pTOXBase.get()) + if (m_pTOXBase) { rDoc.InsertTableOf(m_nStartNode, m_nEndNode-2, *m_pTOXBase, m_pAttrSet.get()); @@ -328,7 +328,7 @@ void SwUndoDelSection::UndoImpl(::sw::UndoRedoContext & rContext) SwNodeIndex aStt( rDoc.GetNodes(), m_nStartNode ); SwNodeIndex aEnd( rDoc.GetNodes(), m_nEndNode-2 ); SwSectionFormat* pFormat = rDoc.MakeSectionFormat(); - if (m_pAttrSet.get()) + if (m_pAttrSet) { pFormat->SetFormatAttr( *m_pAttrSet ); } @@ -424,7 +424,7 @@ void SwUndoUpdateSection::UndoImpl(::sw::UndoRedoContext & rContext) SwFormat* pFormat = rNdSect.GetFormat(); SfxItemSet* pCur = ::lcl_GetAttrSet( rNdSect ); - if (m_pAttrSet.get()) + if (m_pAttrSet) { // The Content and Protect items must persist const SfxPoolItem* pItem; diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index c772f6c40da9..aa4ff1cfdcf4 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -1651,7 +1651,7 @@ void SwUndoTableNdsChg::SaveNewBoxes( const SwTableNode& rTableNd, void SwUndoTableNdsChg::SaveSection( SwStartNode* pSttNd ) { OSL_ENSURE( IsDelBox(), "wrong Action" ); - if (m_pDelSects.get() == nullptr) + if (m_pDelSects == nullptr) m_pDelSects.reset(new SwUndoSaveSections); SwTableNode* pTableNd = pSttNd->FindTableNode(); @@ -3161,7 +3161,7 @@ void SwUndoTableStyleMake::UndoImpl(::sw::UndoRedoContext & rContext) void SwUndoTableStyleMake::RedoImpl(::sw::UndoRedoContext & rContext) { - if (m_pAutoFormat.get()) + if (m_pAutoFormat) { SwTableAutoFormat* pFormat = rContext.GetDoc().MakeTableStyle(m_sName, true); if (pFormat) |