diff options
author | Noel Grandin <noel@peralex.com> | 2012-07-19 14:03:42 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-07-26 14:30:09 +0200 |
commit | deaa69b1558ef76f5338a714fdedaeccf9394096 (patch) | |
tree | aca62c2ec074c3418aefa4046cf9b1a935ddda3f /sw/source/core/doc | |
parent | 5c47e5f63a79a9e72ec4a100786b1bbf65137ed4 (diff) |
Convert SV_DECL_PTRARR_SORT(SwSelBoxes) to o3tl::sorted_vector
Change-Id: I4af9e86257a9e40b91351fd34ac70fe053d02367
Diffstat (limited to 'sw/source/core/doc')
-rw-r--r-- | sw/source/core/doc/doclay.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/docsort.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/tblcpy.cxx | 18 | ||||
-rw-r--r-- | sw/source/core/doc/tblrwcl.cxx | 71 |
4 files changed, 48 insertions, 49 deletions
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 18bd0c2c4e50..d6193e260d57 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -784,7 +784,7 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, SwPosition aPos( aIndex ); aPos.nContent.Assign( pNode, 0 ); - if( pSelBoxes && pSelBoxes->Count() ) + if( pSelBoxes && !pSelBoxes->empty() ) { // Table selection // Copy parts of a table: create a table with the same width as the @@ -799,7 +799,7 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, SwTable& rTbl = pTblNd->GetTable(); // Did we select the whole table? - if( pSelBoxes->Count() == rTbl.GetTabSortBoxes().size() ) + if( pSelBoxes->size() == rTbl.GetTabSortBoxes().size() ) { // move the whole table SwNodeRange aRg( *pTblNd, 0, *pTblNd->EndOfSectionNode(), 1 ); diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 5f2ce443c5e2..fea5026f5028 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -492,7 +492,7 @@ sal_Bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) sal_Bool SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) { // Via SwDoc for Undo! - OSL_ENSURE( rBoxes.Count(), "no valid Box list" ); + OSL_ENSURE( !rBoxes.empty(), "no valid Box list" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return sal_False; @@ -561,7 +561,7 @@ sal_Bool SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) if (GetIDocumentUndoRedo().DoesUndo()) { pUndoSort = new SwUndoSort( rBoxes[0]->GetSttIdx(), - rBoxes[rBoxes.Count()-1]->GetSttIdx(), + rBoxes.back()->GetSttIdx(), *pTblNd, rOpt, aFlatBox.HasItemSets() ); GetIDocumentUndoRedo().AppendUndo(pUndoSort); } diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index ede8835d5681..590740ade181 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -192,7 +192,7 @@ namespace { if( !rFndBox.GetLines().empty() ) { - bool bNoSelection = rSelBoxes.Count() < 2; + bool bNoSelection = rSelBoxes.size() < 2; _FndLines &rFndLines = rFndBox.GetLines(); maCols.push_front(0); const SwTableLine* pLine = rFndLines.front().GetLine(); @@ -317,13 +317,13 @@ namespace { BoxSpanInfo aInfo; if( pSelBoxes && - USHRT_MAX != pSelBoxes->GetPos( pBox ) ) + pSelBoxes->end() != pSelBoxes->find( pBox ) ) { aInfo.mbSelected = true; if( mnStartCol == USHRT_MAX ) { mnStartCol = (sal_uInt16)maLines[nLine].size(); - if( pSelBoxes->Count() < 2 ) + if( pSelBoxes->size() < 2 ) { pSelBoxes = 0; aInfo.mbSelected = false; @@ -690,7 +690,7 @@ sal_Bool SwTable::InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBox if( aTarget.mnAddLine && IsNewModel() ) { SwSelBoxes aBoxes; - aBoxes.Insert( GetTabLines().back()->GetTabBoxes().front() ); + aBoxes.insert( GetTabLines().back()->GetTabBoxes().front() ); if( pUndo ) pUndo->InsertRow( *this, aBoxes, aTarget.mnAddLine ); else @@ -817,7 +817,7 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwNodeIndex& rSttBox, sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, SwUndoTblCpyTbl* pUndo ) { - OSL_ENSURE( rSelBoxes.Count(), "Missing selection" ); + OSL_ENSURE( !rSelBoxes.empty(), "Missing selection" ); SetHTMLTableLayout( 0 ); // Delete HTML Layout @@ -869,7 +869,7 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, // If we don't have enough Lines, then see if we can insert // new ones to reach our goal. But only if the SSelection // contains a Box! - if( 1 < rSelBoxes.Count() ) + if( 1 < rSelBoxes.size() ) return sal_False; sal_uInt16 nNewLns = rCpyTbl.GetTabLines().size() - @@ -1011,7 +1011,7 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, if( 1 == rCpyTbl.GetTabSortBoxes().size() ) { SwTableBox *pTmpBx = rCpyTbl.GetTabSortBoxes()[0]; - for( sal_uInt16 n = 0; n < rSelBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rSelBoxes.size(); ++n ) lcl_CpyBox( rCpyTbl, pTmpBx, *this, (SwTableBox*)rSelBoxes[n], sal_True, pUndo ); } @@ -1042,7 +1042,7 @@ static void _FndCntntBox( const SwTableBox* pBox, SwSelBoxes* pPara ) BOOST_FOREACH( const SwTableLine* pLine, pBox->GetTabLines() ) _FndCntntLine( pLine, pPara ); else - pPara->Insert( (SwTableBox*)pBox ); + pPara->insert( (SwTableBox*)pBox ); } static void _FndCntntLine( const SwTableLine* pLine, SwSelBoxes* pPara ) @@ -1061,7 +1061,7 @@ SwSelBoxes& SwTable::SelLineFromBox( const SwTableBox* pBox, pLine = pLine->GetUpper()->GetUpper(); // Delete all old ones - rBoxes.Remove( sal_uInt16(0), rBoxes.Count() ); + rBoxes.clear(); for( SwTableBoxes::iterator it = pLine->GetTabBoxes().begin(); it != pLine->GetTabBoxes().end(); ++it) _FndCntntBox(*it, &rBoxes ); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 0bbab2e27377..37e618383e6e 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -519,7 +519,7 @@ SwRowFrm* GetRowFrm( SwTableLine& rLine ) sal_Bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind ) { - OSL_ENSURE( rBoxes.Count() && nCnt, "No valid Box List" ); + OSL_ENSURE( !rBoxes.empty() && nCnt, "No valid Box List" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return sal_False; @@ -575,7 +575,7 @@ sal_Bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 n sal_Bool SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind ) { - OSL_ENSURE( pDoc && rBoxes.Count() && nCnt, "No valid Box List" ); + OSL_ENSURE( pDoc && !rBoxes.empty() && nCnt, "No valid Box List" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return sal_False; @@ -977,16 +977,17 @@ SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns, else if( pAllDelBoxes ) { // If the predecessor will also be deleted, there's nothing to do - sal_uInt16 nFndPos; - if( !pAllDelBoxes->Seek_Entry( pFndBox, &nFndPos ) ) + SwSelBoxes::const_iterator aFndIt = pAllDelBoxes->find( pFndBox); + if( aFndIt == pAllDelBoxes->end() ) break; + sal_uInt16 nFndPos = aFndIt - pAllDelBoxes->begin() ; // else, we keep on searching. // We do not need to recheck the Box, however pFndBox = 0; if( nFndPos <= *pCurPos ) --*pCurPos; - pAllDelBoxes->Remove( nFndPos ); + pAllDelBoxes->erase( pAllDelBoxes->begin() + nFndPos ); } } while( bNxt ? ( nLinePos + 1 < (sal_uInt16)rTblLns.size() ) : nLinePos ); return pFndBox; @@ -1074,7 +1075,7 @@ sal_Bool SwTable::DeleteSel( { OSL_ENSURE( pDoc, "No doc?" ); SwTableNode* pTblNd = 0; - if( rBoxes.Count() ) + if( !rBoxes.empty() ) { pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) @@ -1087,9 +1088,9 @@ sal_Bool SwTable::DeleteSel( _FndBox aFndBox( 0, 0 ); if ( bDelMakeFrms ) { - if( pMerged && pMerged->Count() ) + if( pMerged && !pMerged->empty() ) aFndBox.SetTableLines( *pMerged, *this ); - else if( rBoxes.Count() ) + else if( !rBoxes.empty() ) aFndBox.SetTableLines( rBoxes, *this ); aFndBox.DelFrms( *this ); } @@ -1099,9 +1100,8 @@ sal_Bool SwTable::DeleteSel( // First switch the Border, then delete if( bCorrBorder ) { - SwSelBoxes aBoxes; - aBoxes.Insert( &rBoxes ); - for( sal_uInt16 n = 0; n < aBoxes.Count(); ++n ) + SwSelBoxes aBoxes( rBoxes ); + for( sal_uInt16 n = 0; n < aBoxes.size(); ++n ) ::lcl_SaveUpperLowerBorder( *this, *rBoxes[ n ], aShareFmts, &aBoxes, &n ); } @@ -1110,9 +1110,9 @@ sal_Bool SwTable::DeleteSel( SwChartDataProvider *pPCD = pDoc->GetChartDataProvider(); // Delete boxes from last to first - for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.size(); ++n ) { - sal_uInt16 nIdx = rBoxes.Count() - 1 - n; + sal_uInt16 nIdx = rBoxes.size() - 1 - n; // First adapt the data-sequence for chart if necessary // (needed to move the implementation cursor properly to it's new @@ -1142,7 +1142,7 @@ sal_Bool SwTable::DeleteSel( sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bSameHeight ) { - OSL_ENSURE( pDoc && rBoxes.Count() && nCnt, "No valid values" ); + OSL_ENSURE( pDoc && !rBoxes.empty() && nCnt, "No valid values" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return sal_False; @@ -1159,10 +1159,10 @@ sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 long* pRowHeights = 0; if ( bSameHeight ) { - pRowHeights = new long[ rBoxes.Count() ]; - for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) + pRowHeights = new long[ rBoxes.size() ]; + for( sal_uInt16 n = 0; n < rBoxes.size(); ++n ) { - SwTableBox* pSelBox = *( rBoxes.GetData() + n ); + SwTableBox* pSelBox = rBoxes[n]; const SwRowFrm* pRow = GetRowFrm( *pSelBox->GetUpper() ); OSL_ENSURE( pRow, "Where is the SwTableLine's Frame?" ); SWRECTFN( pRow ) @@ -1175,9 +1175,9 @@ sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 aFndBox.SetTableLines( rBoxes, *this ); aFndBox.DelFrms( *this ); - for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.size(); ++n ) { - SwTableBox* pSelBox = *( rBoxes.GetData() + n ); + SwTableBox* pSelBox = rBoxes[n]; OSL_ENSURE( pSelBox, "Box is not within the Table" ); // Insert nCnt new Lines into the Box @@ -1284,7 +1284,7 @@ sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt ) { - OSL_ENSURE( pDoc && rBoxes.Count() && nCnt, "No valid values" ); + OSL_ENSURE( pDoc && !rBoxes.empty() && nCnt, "No valid values" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return sal_False; @@ -1295,8 +1295,7 @@ sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nC pDoc->CreateChartInternalDataProviders( this ); SetHTMLTableLayout( 0 ); // Delete HTML Layout - SwSelBoxes aSelBoxes; - aSelBoxes.Insert(rBoxes.GetData(), rBoxes.Count()); + SwSelBoxes aSelBoxes(rBoxes); ExpandSelection( aSelBoxes ); // Find Lines for the Layout update @@ -1307,9 +1306,9 @@ sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nC _CpyTabFrms aFrmArr; std::vector<SwTableBoxFmt*> aLastBoxArr; sal_uInt16 nFndPos; - for( sal_uInt16 n = 0; n < aSelBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < aSelBoxes.size(); ++n ) { - SwTableBox* pSelBox = *( aSelBoxes.GetData() + n ); + SwTableBox* pSelBox = aSelBoxes[n]; OSL_ENSURE( pSelBox, "Box steht nicht in der Tabelle" ); // We don't want to split small table cells into very very small cells @@ -1728,7 +1727,7 @@ static void lcl_BoxSetHeadCondColl( const SwTableBox* pBox ); sal_Bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, SwTableBox* pMergeBox, SwUndoTblMerge* pUndo ) { - OSL_ENSURE( rBoxes.Count() && pMergeBox, "no valid values" ); + OSL_ENSURE( !rBoxes.empty() && pMergeBox, "no valid values" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return sal_False; @@ -2763,7 +2762,7 @@ sal_Bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, return sal_False; if( pBox->GetSttNd() ) - rParam.aBoxes.Insert( pBox ); + rParam.aBoxes.insert( pBox ); break; } @@ -3158,7 +3157,7 @@ sal_Bool lcl_DeleteBox_Rekursiv( CR_SetBoxWidth& rParam, SwTableBox& rBox, else { SwTableBox* pBox = &rBox; - rParam.aBoxes.Insert( pBox ); + rParam.aBoxes.insert( pBox ); } } else @@ -3505,7 +3504,7 @@ _FndBox* lcl_SaveInsDelData( CR_SetBoxWidth& rParam, SwUndo** ppUndo, // Find all Boxes/Lines SwTable& rTbl = rParam.pTblNd->GetTable(); - if( !rParam.aBoxes.Count() ) + if( rParam.aBoxes.empty() ) { // Get the Boxes if( rParam.bBigger ) @@ -3517,7 +3516,7 @@ _FndBox* lcl_SaveInsDelData( CR_SetBoxWidth& rParam, SwUndo** ppUndo, } // Prevent deleting the whole Table - if( rParam.bBigger && rParam.aBoxes.Count() == rTbl.GetTabSortBoxes().size() ) + if( rParam.bBigger && rParam.aBoxes.size() == rTbl.GetTabSortBoxes().size() ) return 0; _FndBox* pFndBox = new _FndBox( 0, 0 ); @@ -3659,7 +3658,7 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, { pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo, aTmpLst, nDistStt ); - if( aParam.bBigger && aParam.aBoxes.Count() == + if( aParam.bBigger && aParam.aBoxes.size() == aSortCntBoxes.size() ) { // This whole Table is to be deleted! @@ -4040,10 +4039,10 @@ _FndBox* lcl_SaveInsDelData( CR_SetLineHeight& rParam, SwUndo** ppUndo, // Find all Boxes/Lines SwTable& rTbl = rParam.pTblNd->GetTable(); - OSL_ENSURE( rParam.aBoxes.Count(), "We can't go on without Boxes!" ); + OSL_ENSURE( !rParam.aBoxes.empty(), "We can't go on without Boxes!" ); // Prevent deleting the whole Table - if( !rParam.bBigger && rParam.aBoxes.Count() == rTbl.GetTabSortBoxes().size() ) + if( !rParam.bBigger && rParam.aBoxes.size() == rTbl.GetTabSortBoxes().size() ) return 0; _FndBox* pFndBox = new _FndBox( 0, 0 ); @@ -4261,7 +4260,7 @@ sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, return sal_False; if( pBox->GetSttNd() ) - rParam.aBoxes.Insert( pBox ); + rParam.aBoxes.insert( pBox ); else { for( sal_uInt16 i = pBox->GetTabLines().size(); i; ) @@ -4354,7 +4353,7 @@ sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType, { if( bInsDel ) { - if( !aParam.aBoxes.Count() ) + if( aParam.aBoxes.empty() ) ::lcl_InsDelSelLine( (*pLines)[ nBaseLinePos ], aParam, 0, sal_True ); @@ -4362,7 +4361,7 @@ sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType, // delete complete table when last row is deleted if( !bBigger && - aParam.aBoxes.Count() == aSortCntBoxes.size() ) + aParam.aBoxes.size() == aSortCntBoxes.size() ) { GetFrmFmt()->GetDoc()->DeleteRowCol( aParam.aBoxes ); return sal_False; @@ -4440,7 +4439,7 @@ sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType, // Adjust if( bInsDel ) { - if( !aParam.aBoxes.Count() ) + if( aParam.aBoxes.empty() ) ::lcl_InsDelSelLine( (*pLines)[ nBaseLinePos ], aParam, 0, sal_True ); pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo, aTmpLst ); |