diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-08 12:36:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-10 12:02:44 +0200 |
commit | 366d08f2f6d4de922f6099c62bb81b49d89e0a68 (patch) | |
tree | b232884af6e844c2f0994859e4b42efbc1ce654c /writerfilter/source/rtftok | |
parent | 75a2257a5bd716a9f937abe5e53f305c983afd5d (diff) |
new loplugin:simplifypointertobool
Change-Id: Iff68e8f379614a6ab6a6e0d1bad18e70bc76d76a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91907
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'writerfilter/source/rtftok')
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchvalue.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 22 |
3 files changed, 15 insertions, 17 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index 54886fb81d9e..ff13dedcf5fa 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -331,7 +331,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) if (pCols) { RTFValue::Pointer_t pNum = pCols->getAttributes().find(NS_ooxml::LN_CT_Columns_num); - if (pNum.get() && pNum->getInt() > 1) + if (pNum && pNum->getInt() > 1) bColumns = true; } checkFirstRun(); @@ -365,11 +365,11 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) // Unless we're on a title page. RTFValue::Pointer_t pTitlePg = m_aStates.top().getSectionSprms().find(NS_ooxml::LN_EG_SectPrContents_titlePg); - if (((pBreak.get() + if (((pBreak && pBreak->getInt() == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous)) || m_nResetBreakOnSectBreak == RTF_SBKNONE) - && !(pTitlePg.get() && pTitlePg->getInt())) + && !(pTitlePg && pTitlePg->getInt())) { if (m_bWasInFrame) { diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index 227fba3c24fa..2738e96b403f 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -390,11 +390,11 @@ bool RTFDocumentImpl::dispatchTableValue(RTFKeyword nKeyword, int nParam) // If there is a negative left margin, then the first cellx is relative to that. RTFValue::Pointer_t pTblInd = m_aStates.top().getTableRowSprms().find(NS_ooxml::LN_CT_TblPrBase_tblInd); - if (rCurrentCellX == 0 && pTblInd.get()) + if (rCurrentCellX == 0 && pTblInd) { RTFValue::Pointer_t pWidth = pTblInd->getAttributes().find(NS_ooxml::LN_CT_TblWidth_w); - if (pWidth.get() && pWidth->getInt() < 0) + if (pWidth && pWidth->getInt() < 0) nCellX = -1 * (pWidth->getInt() - nParam); } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 3de574e75c12..e174a0973bd8 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -89,7 +89,7 @@ void putNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId, const RTFValue::Po RTFOverwrite eOverwrite, bool bAttribute) { RTFValue::Pointer_t pParent = rSprms.find(nParent, /*bFirst=*/true, /*bForWrite=*/true); - if (!pParent.get()) + if (!pParent) { RTFSprms aAttributes; if (nParent == NS_ooxml::LN_CT_TcPrBase_shd) @@ -133,7 +133,7 @@ RTFValue::Pointer_t getNestedSprm(RTFSprms& rSprms, Id nParent, Id nId) bool eraseNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId) { RTFValue::Pointer_t pParent = rSprms.find(nParent); - if (!pParent.get()) + if (!pParent) // It doesn't even have a parent, we're done. return false; RTFSprms& rAttributes = pParent->getAttributes(); @@ -143,7 +143,7 @@ bool eraseNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId) RTFSprms& getLastAttributes(RTFSprms& rSprms, Id nId) { RTFValue::Pointer_t p = rSprms.find(nId); - if (p.get() && !p->getSprms().empty()) + if (p && !p->getSprms().empty()) return p->getSprms().back().second->getAttributes(); SAL_WARN("writerfilter.rtf", "trying to set property when no type is defined"); @@ -555,10 +555,8 @@ void RTFDocumentImpl::checkNeedPap() // Writer will ignore a page break before a text frame, so guard it with empty paragraphs bool hasBreakBeforeFrame = m_aStates.top().getFrame().hasProperties() - && m_aStates.top() - .getParagraphSprms() - .find(NS_ooxml::LN_CT_PPrBase_pageBreakBefore) - .get(); + && m_aStates.top().getParagraphSprms().find( + NS_ooxml::LN_CT_PPrBase_pageBreakBefore); if (hasBreakBeforeFrame) { dispatchSymbol(RTF_PAR); @@ -649,7 +647,7 @@ void RTFDocumentImpl::sectBreak(bool bFinal) RTFValue::Pointer_t pBreak = m_aStates.top().getSectionSprms().find(NS_ooxml::LN_EG_SectPrContents_type); bool bContinuous - = pBreak.get() + = pBreak && pBreak->getInt() == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous); // If there is no paragraph in this section, then insert a dummy one, as required by Writer, @@ -1483,7 +1481,7 @@ void RTFDocumentImpl::text(OUString& rString) } // Are we in the middle of the table definition? (No cell defs yet, but we already have some cell props.) - if (m_aStates.top().getTableCellSprms().find(NS_ooxml::LN_CT_TcPrBase_vAlign).get() + if (m_aStates.top().getTableCellSprms().find(NS_ooxml::LN_CT_TcPrBase_vAlign) && m_nTopLevelCells == 0) { m_aTableBufferStack.back().emplace_back( @@ -1553,7 +1551,7 @@ void RTFDocumentImpl::prepareProperties( // Table width. RTFValue::Pointer_t const pTableWidthProps = rState.getTableRowSprms().find(NS_ooxml::LN_CT_TblPrBase_tblW); - if (!pTableWidthProps.get()) + if (!pTableWidthProps) { auto pUnitValue = new RTFValue(3); putNestedAttribute(rState.getTableRowSprms(), NS_ooxml::LN_CT_TblPrBase_tblW, @@ -1568,7 +1566,7 @@ void RTFDocumentImpl::prepareProperties( RTFValue::Pointer_t const pCellMar = rState.getTableRowSprms().find(NS_ooxml::LN_CT_TblPrBase_tblCellMar); - if (!pCellMar.get()) + if (!pCellMar) { // If no cell margins are defined, the default left/right margin is 0 in Word, but not in Writer. RTFSprms aAttributes; @@ -3182,7 +3180,7 @@ void RTFDocumentImpl::afterPopState(RTFParserState& rState) { RTFValue::Pointer_t pIdValue = rState.getTableAttributes().find(NS_ooxml::LN_CT_AbstractNum_nsid); - if (pIdValue.get() && !m_aStates.empty()) + if (pIdValue && !m_aStates.empty()) { // Abstract numbering RTFSprms aLeveltextAttributes; |