diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-19 08:12:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-19 10:02:39 +0200 |
commit | 2c1b7e8d6a7fa22cb91919238418816671c3a497 (patch) | |
tree | 6f356017d24dffcd25261295ab25a21b738dc835 /sw/source | |
parent | ad18bb24d51e4f735085d50c496d28bd637dbb0b (diff) |
clang-tidy readability-container-size-empty
Change-Id: I1df70b7dff5ebb6048f7fc618789faa15ca5d422
Reviewed-on: https://gerrit.libreoffice.org/61967
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
42 files changed, 61 insertions, 61 deletions
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx index fcd6a2b80c99..8cb98e35b5c6 100644 --- a/sw/source/core/access/accdoc.cxx +++ b/sw/source/core/access/accdoc.cxx @@ -858,7 +858,7 @@ css::uno::Sequence< css::uno::Any > while( _pStartCursor && ( (_pStartCursor = _pStartCursor->GetNext()) != _pStartCursor2) ); - if ( vFrameList.size() ) + if ( !vFrameList.empty() ) { uno::Sequence< uno::Any > aRet(vFrameList.size()); std::vector<SwFrame*>::iterator aIter = vFrameList.begin(); diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx index 0d9bd2460819..a5236330f46e 100644 --- a/sw/source/core/access/accportions.cxx +++ b/sw/source/core/access/accportions.cxx @@ -717,7 +717,7 @@ bool SwAccessiblePortionData::IsValidCorePosition( sal_Int32 nPos ) const bool SwAccessiblePortionData::IsZeroCorePositionData() { - if( m_aModelPositions.size() < 1 ) return true; + if( m_aModelPositions.empty() ) return true; return m_aModelPositions[0] == 0 && m_aModelPositions[m_aModelPositions.size()-1] == 0; } diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index b93ab75d4718..956efc128f1a 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -1014,7 +1014,7 @@ bool SwCursorShell::GotoNextOutline() { const SwNodes& rNds = GetDoc()->GetNodes(); - if ( rNds.GetOutLineNds().size() == 0 ) + if ( rNds.GetOutLineNds().empty() ) { SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound ); return false; @@ -1053,7 +1053,7 @@ bool SwCursorShell::GotoPrevOutline() { const SwNodes& rNds = GetDoc()->GetNodes(); - if ( rNds.GetOutLineNds().size() == 0 ) + if ( rNds.GetOutLineNds().empty() ) { SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound ); return false; @@ -1446,7 +1446,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, std::vector<SwTextAttr *> const marks( pTextNd->GetTextAttrsAt( aPos.nContent.GetIndex(), RES_TXTATR_TOXMARK)); - if (marks.size()) + if (!marks.empty()) { // hmm... can only return 1 here pTextAttr = *marks.begin(); } @@ -1458,7 +1458,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, std::vector<SwTextAttr *> const marks( pTextNd->GetTextAttrsAt( aPos.nContent.GetIndex(), RES_TXTATR_REFMARK)); - if (marks.size()) + if (!marks.empty()) { // hmm... can only return 1 here pTextAttr = *marks.begin(); } diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx index 6115e918be4f..4de4450e54f2 100644 --- a/sw/source/core/crsr/trvlfnfl.cxx +++ b/sw/source/core/crsr/trvlfnfl.cxx @@ -191,7 +191,7 @@ bool SwCursor::GotoNextFootnoteAnchor() const SwTextFootnote* pTextFootnote = nullptr; size_t nPos = 0; - if( !rFootnoteArr.size() ) + if( rFootnoteArr.empty() ) { SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound ); return false; @@ -264,7 +264,7 @@ bool SwCursor::GotoPrevFootnoteAnchor() const SwTextFootnote* pTextFootnote = nullptr; size_t nPos = 0; - if( !rFootnoteArr.size() ) + if( rFootnoteArr.empty() ) { SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound ); return false; diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index f8d802cf95fa..9593f326d149 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -444,7 +444,7 @@ void SwSelPaintRects::HighlightInputField() } } - if ( aInputFieldRanges.size() > 0 ) + if ( !aInputFieldRanges.empty() ) { if (m_pTextInputFieldOverlay != nullptr) { diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 679fd7d1f098..1b40c8605e49 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -4090,7 +4090,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt } else { - if( !m_rDoc.getIDocumentRedlineAccess().IsIgnoreRedline() && m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size() ) + if( !m_rDoc.getIDocumentRedlineAccess().IsIgnoreRedline() && !m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() ) m_rDoc.getIDocumentRedlineAccess().DeleteRedline( aDelPam, true, USHRT_MAX ); SwUndoReplace* pUndoRpl = nullptr; diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 076428024811..4e203e565108 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -2540,7 +2540,7 @@ void DocumentRedlineManager::AcceptAllRedline(bool bAccept) rUndoMgr.StartUndo(bAccept ? SwUndoId::ACCEPT_REDLINE : SwUndoId::REJECT_REDLINE, &aRewriter); } - while (mpRedlineTable->size() > 0) + while (!mpRedlineTable->empty()) { if (bAccept) AcceptRedline(mpRedlineTable->size() - 1, true); diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index 18f59510ed43..9eb49b95a44b 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -366,7 +366,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndo>(pUndo)); } - while ( pFormatsAndObjs[i].size() > 0 ) + while ( !pFormatsAndObjs[i].empty() ) { SwDrawFrameFormat* pFormat( pFormatsAndObjs[i].back().first ); SdrObject* pObj( pFormatsAndObjs[i].back().second ); diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 92a49b7c5205..28d5cd766aea 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1141,7 +1141,7 @@ bool SwDoc::ReplaceNumRule( const SwPosition& rPos, SwNumRule::tTextNodeList aTextNodeList; pOldRule->GetTextNodeList( aTextNodeList ); - if ( aTextNodeList.size() > 0 ) + if ( !aTextNodeList.empty() ) { SwRegHistory aRegH( pUndo ? pUndo->GetHistory() : nullptr ); sal_uInt16 nChgFormatLevel = 0; diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index d5cc122cc9f0..70633e0eada5 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -849,7 +849,7 @@ sal_uInt16 FlatFndBox::GetRowCount(const FndBox_& rBox) sal_uInt16 nLn = 1; for (const auto &rpB : rBoxes) { - if (rpB->GetLines().size()) + if (!rpB->GetLines().empty()) { // Iterate recursively over the Lines nLn = std::max(GetRowCount(*rpB), nLn); } diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index f82d8bb706d3..da0135abd966 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -392,9 +392,9 @@ const SwStartNode *SwHTMLTableLayout::GetAnyBoxStartNode() const const SwTableBox* pBox = m_pSwTable->GetTabLines()[0]->GetTabBoxes()[0]; while( nullptr == (pBoxSttNd = pBox->GetSttNd()) ) { - OSL_ENSURE( pBox->GetTabLines().size() > 0, + OSL_ENSURE( !pBox->GetTabLines().empty(), "Box without start node and lines" ); - OSL_ENSURE( pBox->GetTabLines().front()->GetTabBoxes().size() > 0, + OSL_ENSURE( !pBox->GetTabLines().front()->GetTabBoxes().empty(), "Line without boxes" ); pBox = pBox->GetTabLines().front()->GetTabBoxes().front(); } diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 710b693bfb7b..ee0050226efe 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -297,7 +297,7 @@ static void lcl_CopyCol( FndBox_ & rFndBox, CpyPara *const pCpyPara) SwFormatFrameSize aFrameSz( pNewFormat->GetFrameSize() ); bool bDiffCount = false; - if( pBox->GetTabLines().size() ) + if( !pBox->GetTabLines().empty() ) { pCmpLine = rFndBox.GetLines().front().get(); if ( pCmpLine->GetBoxes().size() != pCmpLine->GetLine()->GetTabBoxes().size() ) @@ -1411,7 +1411,7 @@ static void lcl_Merge_MoveBox(FndBox_ & rFndBox, InsULPara *const pULPara) pBoxes = &pULPara->pInsLine->GetTabBoxes(); // Is there still a level to step down to? - if (rFndBox.GetBox()->GetTabLines().size()) + if (!rFndBox.GetBox()->GetTabLines().empty()) { SwTableBox* pBox = new SwTableBox( static_cast<SwTableBoxFormat*>(rFndBox.GetBox()->GetFrameFormat()), @@ -1423,7 +1423,7 @@ static void lcl_Merge_MoveBox(FndBox_ & rFndBox, InsULPara *const pULPara) { lcl_Merge_MoveLine(**it, &aPara); } - if( pBox->GetTabLines().size() ) + if( !pBox->GetTabLines().empty() ) { if( USHRT_MAX == nInsPos ) nInsPos = pBoxes->size(); @@ -1730,7 +1730,7 @@ static void lcl_CalcNewWidths(const FndLines_t& rFndLines, CpyPara& rPara) { std::vector< sal_uLong > &rWidth = (*rPara.pWidths.get())[ nLine ]; const FndLine_ *pFndLine = rFndLines[ nLine ].get(); - if( pFndLine && pFndLine->GetBoxes().size() ) + if( pFndLine && !pFndLine->GetBoxes().empty() ) { const SwTableLine *pLine = pFndLine->GetLine(); if( pLine && !pLine->GetTabBoxes().empty() ) diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 28ec60d97d43..09ac4f83f61d 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -350,7 +350,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, } bool bUpdateFootnote = false; - if( GetFootnoteIdxs().size() && pAttr ) + if( !GetFootnoteIdxs().empty() && pAttr ) { sal_uInt16 nVal = pAttr->Get( RES_FTN_AT_TXTEND ).GetValue(); if( ( FTNEND_ATTXTEND_OWNNUMSEQ == nVal || @@ -748,7 +748,7 @@ void SwDoc::UpdateSection( size_t const nPos, SwSectionData & rNewData, void sw_DeleteFootnote( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd ) { SwFootnoteIdxs& rFootnoteArr = pNd->GetDoc()->GetFootnoteIdxs(); - if( rFootnoteArr.size() ) + if( !rFootnoteArr.empty() ) { size_t nPos = 0; rFootnoteArr.SeekEntry( SwNodeIndex( *pNd ), &nPos ); diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index d59d39a820c2..9c36a1fadff7 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1703,7 +1703,7 @@ bool SwContentNode::GetAttr( SfxItemSet& rSet ) const sal_uInt16 SwContentNode::ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds ) { sal_uInt16 nRet = 0; - if ( 0 == rWhichIds.size() ) + if ( rWhichIds.empty() ) return nRet; OSL_ENSURE( GetpSwAttrSet(), "no item set" ); diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index 2953fdb9d567..e7dd6788a979 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -1074,12 +1074,12 @@ void SwEditShell::ApplyChangedSentence(const svx::SpellPortions& rNewPortions, b OSL_ENSURE( g_pSpellIter, "SpellIter missing" ); if (!g_pSpellIter || - g_pSpellIter->GetLastPortions().size() <= 0) // no portions -> no text to be changed + g_pSpellIter->GetLastPortions().empty()) // no portions -> no text to be changed return; const SpellPortions& rLastPortions = g_pSpellIter->GetLastPortions(); const SpellContentPositions rLastPositions = g_pSpellIter->GetLastPositions(); - OSL_ENSURE(rLastPortions.size() > 0 && + OSL_ENSURE(!rLastPortions.empty() && rLastPortions.size() == rLastPositions.size(), "last vectors of spelling results are not set or not equal"); diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index f4dfc7994637..74e1eeb9584f 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -892,7 +892,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc ) break; // exit the "while-loop" } else if( *aCpyPam.GetPoint() == *aCpyPam.GetMark() && - pClpDoc->GetSpzFrameFormats()->size() ) + !pClpDoc->GetSpzFrameFormats()->empty() ) { // we need a DrawView if( !Imp()->GetDrawView() ) @@ -1154,7 +1154,7 @@ void SwFEShell::PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt1 } // now the page bound objects // additionally copy page bound frames - if( GetDoc()->GetSpzFrameFormats()->size() ) + if( !GetDoc()->GetSpzFrameFormats()->empty() ) { // create a draw view if necessary if( !rToFill.Imp()->GetDrawView() ) diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 43e8a4219bfe..c56986b7ea6c 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -1877,7 +1877,7 @@ void SwFEShell::GetConnectableFrameFormats(SwFrameFormat & rFormat, } - if (aTmpSpzArray.size() > 0) + if (!aTmpSpzArray.empty()) { aPrevPageVec.clear(); aThisPageVec.clear(); diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index ece9442cc5d4..61001866b042 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -203,7 +203,7 @@ void SwFEShell::InsertRow( sal_uInt16 nCnt, bool bBehind ) TableWait aWait( nCnt, pFrame, *GetDoc()->GetDocShell(), aBoxes.size() ); - if ( aBoxes.size() ) + if ( !aBoxes.empty() ) GetDoc()->InsertRow( aBoxes, nCnt, bBehind ); EndAllActionAndCall(); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 06dd1cf815cd..6f17da290939 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -2060,7 +2060,7 @@ static void lcl_InsertRow( SwTableLine const &rLine, SwLayoutFrame *pUpper, SwFr static void FndBoxCopyCol( SwTableBox* pBox, FndPara* pFndPara ) { std::unique_ptr<FndBox_> pFndBox(new FndBox_( pBox, pFndPara->pFndLine )); - if( pBox->GetTabLines().size() ) + if( !pBox->GetTabLines().empty() ) { FndPara aPara( *pFndPara, pFndBox.get() ); ForEach_FndLineCopyCol( pFndBox->GetBox()->GetTabLines(), &aPara ); @@ -2086,7 +2086,7 @@ static void FndLineCopyCol( SwTableLine* pLine, FndPara* pFndPara ) for( SwTableBoxes::iterator it = pFndLine->GetLine()->GetTabBoxes().begin(); it != pFndLine->GetLine()->GetTabBoxes().end(); ++it) FndBoxCopyCol(*it, &aPara ); - if( pFndLine->GetBoxes().size() ) + if( !pFndLine->GetBoxes().empty() ) { pFndPara->pFndBox->GetLines().push_back( std::move(pFndLine) ); } @@ -2538,7 +2538,7 @@ bool FndBox_::AreLinesToRestore( const SwTable &rTable ) const { // Should we call MakeFrames here? - if ( !m_pLineBefore && !m_pLineBehind && rTable.GetTabLines().size() ) + if ( !m_pLineBefore && !m_pLineBehind && !rTable.GetTabLines().empty() ) return true; sal_uInt16 nBfPos; diff --git a/sw/source/core/layout/objstmpconsiderwrapinfl.cxx b/sw/source/core/layout/objstmpconsiderwrapinfl.cxx index 9c5a2240eeac..e35336b9fc3c 100644 --- a/sw/source/core/layout/objstmpconsiderwrapinfl.cxx +++ b/sw/source/core/layout/objstmpconsiderwrapinfl.cxx @@ -47,7 +47,7 @@ void SwObjsMarkedAsTmpConsiderWrapInfluence::Remove( SwAnchoredObject& _rAnchore void SwObjsMarkedAsTmpConsiderWrapInfluence::Clear() { - while ( maObjsTmpConsiderWrapInfl.size() ) + while ( !maObjsTmpConsiderWrapInfl.empty() ) { SwAnchoredObject* pAnchoredObj = maObjsTmpConsiderWrapInfl.back(); pAnchoredObj->SetTmpConsiderWrapInfluence( false ); diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 3c621722b3f5..f16cde1fc091 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1731,7 +1731,7 @@ bool DrawFillAttributes( aPaintRange, aDefineRange); - if(rSequence.size()) + if(!rSequence.empty()) { drawinglayer::primitive2d::Primitive2DContainer const* pPrimitives(&rSequence); diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 3e659366264d..c0dfeaba837a 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -839,7 +839,7 @@ namespace sw { { m_First = false; rpNode = m_pMerged - ? m_pMerged->extents.size() + ? !m_pMerged->extents.empty() ? m_pMerged->extents[0].pNode : m_pMerged->pFirstNode : m_pNode; diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index 65107e295e2f..424f1acb59d6 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -223,7 +223,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext) } } - if (m_FlyUndos.size()) + if (!m_FlyUndos.empty()) { sal_uLong nTmp = rPam.GetPoint()->nNode.GetIndex(); for (size_t n = m_FlyUndos.size(); 0 < n; --n) diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 5a93eaedf06c..da1facfad0ab 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -475,7 +475,7 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry marks = rPam.GetNode().GetTextNode()->GetTextAttrsAt( rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_TOXMARK); } - if (marks.size()) + if (!marks.empty()) { if( pAny ) { // hmm... can only return 1 here @@ -644,7 +644,7 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry marks = rPam.GetNode().GetTextNode()->GetTextAttrsAt( rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_REFMARK); } - if (marks.size()) + if (!marks.empty()) { if( pAny ) { // hmm... can only return 1 here diff --git a/sw/source/core/unocore/unoredlines.cxx b/sw/source/core/unocore/unoredlines.cxx index d75670160bf0..0f5b5d8a0d4b 100644 --- a/sw/source/core/unocore/unoredlines.cxx +++ b/sw/source/core/unocore/unoredlines.cxx @@ -86,7 +86,7 @@ sal_Bool SwXRedlines::hasElements( ) if(!IsValid()) throw uno::RuntimeException(); const SwRedlineTable& rRedTable = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable(); - return rRedTable.size() > 0; + return !rRedTable.empty(); } OUString SwXRedlines::getImplementationName() diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index 605e106105f0..bb6d8f770ee1 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -1016,7 +1016,7 @@ bool SwPagePreviewLayout::Paint(vcl::RenderContext& rRenderContext, const tools: OutputDevice* pOutputDev = &rRenderContext; // prepare paint - if ( maPreviewPages.size() > 0 ) + if ( !maPreviewPages.empty() ) { mrParentViewShell.Imp()->m_bFirstPageInvalid = false; mrParentViewShell.Imp()->m_pFirstVisiblePage = @@ -1166,7 +1166,7 @@ void SwPagePreviewLayout::Repaint( const tools::Rectangle& rInvalidCoreRect ) co // environment and parameter ok // prepare paint - if ( maPreviewPages.size() > 0 ) + if ( !maPreviewPages.empty() ) { mrParentViewShell.Imp()->m_bFirstPageInvalid = false; mrParentViewShell.Imp()->m_pFirstVisiblePage = diff --git a/sw/source/filter/ascii/wrtasc.cxx b/sw/source/filter/ascii/wrtasc.cxx index d17027aab832..b8964aaadd8b 100644 --- a/sw/source/filter/ascii/wrtasc.cxx +++ b/sw/source/filter/ascii/wrtasc.cxx @@ -126,7 +126,7 @@ ErrCode SwASCWriter::WriteStream() if( bTstFly && m_bWriteAll && pNd->GetText().isEmpty() && // Frame exists - m_pDoc->GetSpzFrameFormats()->size() && + !m_pDoc->GetSpzFrameFormats()->empty() && // Only one node in the array m_pDoc->GetNodes().GetEndOfExtras().GetIndex() + 3 == m_pDoc->GetNodes().GetEndOfContent().GetIndex() && diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 836e7db42cfa..e655dd34e569 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -3049,7 +3049,7 @@ static Writer& OutHTML_SwFormatINetFormat( Writer& rWrt, const SfxPoolItem& rHt if( rHTMLWrt.m_bTagOn ) { // if necessary, temporarily close an attribute that is still open - if( rHTMLWrt.m_aINetFormats.size() ) + if( !rHTMLWrt.m_aINetFormats.empty() ) { SwFormatINetFormat *pINetFormat = rHTMLWrt.m_aINetFormats.back(); @@ -3068,7 +3068,7 @@ static Writer& OutHTML_SwFormatINetFormat( Writer& rWrt, const SfxPoolItem& rHt OutHTML_INetFormat( rWrt, rINetFormat, false ); OSL_ENSURE( rHTMLWrt.m_aINetFormats.size(), "there must be a URL attribute missing" ); - if( rHTMLWrt.m_aINetFormats.size() ) + if( !rHTMLWrt.m_aINetFormats.empty() ) { // get its own attribute from the stack SwFormatINetFormat *pINetFormat = rHTMLWrt.m_aINetFormats.back(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 8dc33bfd8b71..a759adc24d1a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3321,7 +3321,7 @@ void DocxAttributeOutput::EndTable() // We closed the table; if it is a nested table, the cell that contains it // still continues // set to true only if we were in a nested table, not otherwise. - if( 0 != tableFirstCells.size() ) + if( !tableFirstCells.empty() ) m_tableReference->m_bTableCellOpen = true; // Cleans the table helper diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 533f787393a6..36555f31f96e 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1905,7 +1905,7 @@ bool MSWordExportBase::GetBookmarks( const SwTextNode& rNd, sal_Int32 nStt, } } } - return ( rArr.size() > 0 ); + return ( !rArr.empty() ); } bool MSWordExportBase::GetAnnotationMarks( const SwTextNode& rNd, sal_Int32 nStt, @@ -1941,7 +1941,7 @@ bool MSWordExportBase::GetAnnotationMarks( const SwTextNode& rNd, sal_Int32 nStt } } } - return ( rArr.size() > 0 ); + return ( !rArr.empty() ); } class CompareMarksEnd diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index c92a5f9b1957..a2d8856733fb 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -2224,7 +2224,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp, rFib.m_lcbGrpStAtnOwners = nFcStart - rFib.m_fcGrpStAtnOwners; // Commented text ranges - if( aRangeStartPos.size() > 0 ) + if( !aRangeStartPos.empty() ) { // Commented text ranges starting positions (Plcfbkf.aCP) rFib.m_fcPlcfAtnbkf = nFcStart; diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index db8f3cac3c08..54bf8e6aeaa7 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3928,7 +3928,7 @@ bool SwWW8ImplReader::IsParaEndInCPs(sal_Int32 nStart, sal_Int32 nEnd,bool bSdOD //Clear the para end position recorded in reader intermittently for the least impact on loading performance void SwWW8ImplReader::ClearParaEndPosition() { - if ( m_aEndParaPos.size() > 0 ) + if ( !m_aEndParaPos.empty() ) m_aEndParaPos.clear(); } diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 87e3ee83c78c..58257f01830c 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -4445,7 +4445,7 @@ void WW8RStyle::ImportOldFormatStyles() ImportSprms(aPAPXOffsets[stcp].mnOffset, aPAPXOffsets[stcp].mnSize, true); - if (aConvertedChpx[stcp].size() > 0) + if (!aConvertedChpx[stcp].empty()) ImportSprms(&(aConvertedChpx[stcp][0]), static_cast< short >(aConvertedChpx[stcp].size()), false); diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 736c9adc0321..ad8452df3e5d 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -135,7 +135,7 @@ void SwAddressControl_Impl::SetData(SwCSVData& rDBData) { m_pData = &rDBData; //when the address data is updated then remove the controls an build again - if(m_aFixedTexts.size()) + if(!m_aFixedTexts.empty()) { for(auto aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter) aTextIter->disposeAndClear(); @@ -233,7 +233,7 @@ void SwAddressControl_Impl::SetData(SwCSVData& rDBData) } // Even if no items in m_aEdits, the scrollbar will still exist; // we might as well disable it. - if (m_aEdits.size() < 1) { + if (m_aEdits.empty()) { m_pScrollBar->DoScroll(0); m_pScrollBar->SetThumbPos(0); m_pScrollBar->Enable(false); @@ -377,7 +377,7 @@ void SwAddressControl_Impl::Resize() m_pWindow->SetSizePixel(Size(aSize.Width() - nScrollBarWidth, m_pWindow->GetOutputSizePixel().Height())); m_pScrollBar->SetPosPixel(Point(aSize.Width() - nScrollBarWidth, 0)); - if(m_aEdits.size()) + if(!m_aEdits.empty()) { long nNewEditSize = aSize.Width() - (*m_aEdits.begin())->GetPosPixel().X() - nScrollBarWidth - 6; diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index ae0171148c8a..86f0a1a1dac1 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -552,7 +552,7 @@ void SwSendMailDialog::UpdateTransferStatus() sStatus = m_sErrorStatus.replaceFirst("%1", OUString::number(m_nErrorCount) ); m_pErrorStatus->SetText(sStatus); - if (m_pImpl->aDescriptors.size()) + if (!m_pImpl->aDescriptors.empty()) { assert(m_nExpectedCount && "div-by-zero"); m_pProgressBar->SetValue(static_cast<sal_uInt16>(m_nSendCount * 100 / m_nExpectedCount)); diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 1ccc19651629..b6ec409f14e1 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -1141,7 +1141,7 @@ void SwDocShell::GetState(SfxItemSet& rSet) case FN_REDLINE_ACCEPT_ALL: case FN_REDLINE_REJECT_ALL: { - if (GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().size() == 0) + if (GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().empty()) rSet.DisableItem(nWhich); } break; diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 71e0c8b7ae77..31548a502b15 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -3315,7 +3315,7 @@ std::shared_ptr<SwMailMergeConfigItem> SwDBManager::PerformMailMerge(SwView cons void SwDBManager::RevokeLastRegistrations() { - if (m_aUncommitedRegistrations.size()) + if (!m_aUncommitedRegistrations.empty()) { SwView* pView = ( m_pDoc && m_pDoc->GetDocShell() ) ? m_pDoc->GetDocShell()->GetView() : nullptr; if (pView) diff --git a/sw/source/uibase/dbui/maildispatcher.cxx b/sw/source/uibase/dbui/maildispatcher.cxx index 5b1a1d80708d..bdb4a91b9cdf 100644 --- a/sw/source/uibase/dbui/maildispatcher.cxx +++ b/sw/source/uibase/dbui/maildispatcher.cxx @@ -252,7 +252,7 @@ void MailDispatcher::run() ::osl::ClearableMutexGuard message_container_guard( m_aMessageContainerMutex ); - if ( m_aXMessageList.size() ) + if ( !m_aXMessageList.empty() ) { thread_status_guard.clear(); uno::Reference<mail::XMailMessage> message = m_aXMessageList.front(); diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 1d778cc4910c..ffa1ffe4f069 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -690,7 +690,7 @@ void SwPostItMgr::LayoutPostIts() for (std::unique_ptr<SwPostItPageItem>& pPage : mPages) { // only layout if there are notes on this page - if (pPage->mvSidebarItems.size()>0) + if (!pPage->mvSidebarItems.empty()) { std::vector<SwAnnotationWin*> aVisiblePostItList; unsigned long lNeededHeight = 0; diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index 30365661e9be..c0286c30dfe8 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -373,7 +373,7 @@ void SwGlossaries::UpdateGlosPath(bool bFull) INetURLObject(), m_aPath.getToken(0, SVT_SEARCHPATH_DELIMITER, nIndex), URIHelper::GetMaybeFileHdl()); - if (aDirArr.size() && + if (!aDirArr.empty() && std::find(aDirArr.begin(), aDirArr.end(), sPth) != aDirArr.end()) { continue; diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index d996777be209..d6ba87cc6598 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -71,7 +71,7 @@ static void lcl_FillSvxColumn(const SwFormatCol& rCol, { const SwColumns& rCols = rCol.GetColumns(); - bool bOrtho = rCol.IsOrtho() && rCols.size(); + bool bOrtho = rCol.IsOrtho() && !rCols.empty(); long nInnerWidth = 0; if( bOrtho ) { diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 1348a5fde2bf..f1c9b72afcaa 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -294,7 +294,7 @@ sal_Bool SwXTextView::select(const uno::Any& aInterface) // sdrObjects handled below } bool bRet(false); - if (sdrObjects.size()) + if (!sdrObjects.empty()) { SdrView *const pDrawView = rSh.GetDrawView(); |