diff options
author | Noel Grandin <noel@peralex.com> | 2012-04-25 11:55:03 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-04-25 12:35:32 +0200 |
commit | 4dcc1b650e4e2451e9e39f971ddfc49309203f25 (patch) | |
tree | 0f9f42e5182704f38569d41d32cf78bb95e6968b /sw | |
parent | Remove data structures there dead i.e. not doing any actual work (diff) | |
download | core-4dcc1b650e4e2451e9e39f971ddfc49309203f25.tar.gz core-4dcc1b650e4e2451e9e39f971ddfc49309203f25.zip |
Convert SV_DECL_PTRARR_DEL(SwSelUnions) to boost::ptr_vector
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/tblsel.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl1.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/frmedt/tblsel.cxx | 48 | ||||
-rw-r--r-- | sw/source/core/layout/trvlfrm.cxx | 4 |
4 files changed, 40 insertions, 42 deletions
diff --git a/sw/inc/tblsel.hxx b/sw/inc/tblsel.hxx index 6621d556d59f..d75a18daf8f9 100644 --- a/sw/inc/tblsel.hxx +++ b/sw/inc/tblsel.hxx @@ -172,7 +172,9 @@ public: SwTabFrm *GetTable() { return pTable; } }; -SV_DECL_PTRARR_DEL( SwSelUnions, SwSelUnion*, 10 ) +// Determines tables affected by a table selection and union rectangles +// of the selection (also for split tables) +typedef boost::ptr_vector<SwSelUnion> SwSelUnions; // Gets the tables involved in a table selection and the union-rectangles of the selections // - also for split tables. diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 38e16422590a..da40f248358a 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -595,7 +595,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) SwSelUnions aUnions; ::MakeSelUnions( aUnions, pStart, pEnd ); - if( aUnions.Count() ) + if( !aUnions.empty() ) { SwTable& rTable = pTblNd->GetTable(); if (GetIDocumentUndoRedo().DoesUndo()) @@ -651,12 +651,12 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) } sal_Bool bFirst = sal_True; - for ( sal_uInt16 i = 0; i < aUnions.Count(); ++i ) + for ( sal_uInt16 i = 0; i < aUnions.size(); ++i ) { - SwSelUnion *pUnion = aUnions[i]; + SwSelUnion *pUnion = &aUnions[i]; SwTabFrm *pTab = pUnion->GetTable(); const SwRect &rUnion = pUnion->GetUnion(); - const sal_Bool bLast = i == aUnions.Count() - 1 ? sal_True : sal_False; + const sal_Bool bLast = i == aUnions.size() - 1 ? sal_True : sal_False; SvPtrarr aCellArr( 255 ); ::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab ); @@ -842,7 +842,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, SwSelUnions aUnions; ::MakeSelUnions( aUnions, pStart, pEnd ); - if( aUnions.Count() ) + if( !aUnions.empty() ) { SwTable& rTable = pTblNd->GetTable(); if (GetIDocumentUndoRedo().DoesUndo()) @@ -850,9 +850,9 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd)); } - for( sal_uInt16 i = 0; i < aUnions.Count(); ++i ) + for( sal_uInt16 i = 0; i < aUnions.size(); ++i ) { - SwSelUnion *pUnion = aUnions[i]; + SwSelUnion *pUnion = &aUnions[i]; SwTabFrm *pTab = pUnion->GetTable(); SvPtrarr aCellArr( 255 ); ::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab ); @@ -917,7 +917,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const SwSelUnions aUnions; ::MakeSelUnions( aUnions, pStart, pEnd ); - if( aUnions.Count() ) + if( !aUnions.empty() ) { SvxBoxItem aSetBox ((const SvxBoxItem &) rSet.Get(RES_BOX )); SvxBoxInfoItem aSetBoxInfo((const SvxBoxInfoItem&) rSet.Get(SID_ATTR_BORDER_INNER)); @@ -932,13 +932,13 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const aSetBoxInfo.ResetFlags(); - for ( sal_uInt16 i = 0; i < aUnions.Count(); ++i ) + for ( sal_uInt16 i = 0; i < aUnions.size(); ++i ) { - SwSelUnion *pUnion = aUnions[i]; + SwSelUnion *pUnion = &aUnions[i]; const SwTabFrm *pTab = pUnion->GetTable(); const SwRect &rUnion = pUnion->GetUnion(); const sal_Bool bFirst = i == 0 ? sal_True : sal_False; - const sal_Bool bLast = i == aUnions.Count() - 1 ? sal_True : sal_False; + const sal_Bool bLast = i == aUnions.size() - 1 ? sal_True : sal_False; SvPtrarr aCellArr( 255 ); ::lcl_CollectCells( aCellArr, rUnion, (SwTabFrm*)pTab ); @@ -1375,9 +1375,9 @@ void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols &rCols ::MakeSelUnions( aUnions, pStart, pEnd, bWishValues ? nsSwTblSearchType::TBLSEARCH_NONE : nsSwTblSearchType::TBLSEARCH_COL ); - for ( sal_uInt16 i2 = 0; i2 < aUnions.Count(); ++i2 ) + for ( sal_uInt16 i2 = 0; i2 < aUnions.size(); ++i2 ) { - SwSelUnion *pSelUnion = aUnions[i2]; + SwSelUnion *pSelUnion = &aUnions[i2]; const SwTabFrm *pTab = pSelUnion->GetTable(); const SwRect &rUnion = pSelUnion->GetUnion(); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 6e7cce20eecc..9e5253e7b1d5 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -293,9 +293,9 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, const SwCellFrm* pCurrentBottomRightFrm = 0; // Now find boxes for each entry and emit - for( i = 0; i < aUnions.Count() && bTblIsValid; ++i ) + for( i = 0; i < aUnions.size() && bTblIsValid; ++i ) { - SwSelUnion *pUnion = aUnions[i]; + SwSelUnion *pUnion = &aUnions[i]; const SwTabFrm *pTable = pUnion->GetTable(); if( !pTable->IsValid() && nLoopMax ) { @@ -408,7 +408,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, SwDeletionChecker aDelCheck( pStart ); // otherwise quickly "calculate" the table layout and start over - SwTabFrm *pTable = aUnions[0]->GetTable(); + SwTabFrm *pTable = aUnions.front().GetTable(); while( pTable ) { if( pTable->IsValid() ) @@ -492,10 +492,10 @@ sal_Bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) ::MakeSelUnions( aUnions, pStart, pEnd, nsSwTblSearchType::TBLSEARCH_NO_UNION_CORRECT ); // find boxes for each entry and emit - for( i = 0; i < aUnions.Count() && bTblIsValid && + for( i = 0; i < aUnions.size() && bTblIsValid && bValidChartSel; ++i ) { - SwSelUnion *pUnion = aUnions[i]; + SwSelUnion *pUnion = &aUnions[i]; const SwTabFrm *pTable = pUnion->GetTable(); SWRECTFN( pTable ) @@ -650,8 +650,8 @@ sal_Bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) break; // otherwise quickly "calculate" table layout and start over - SwTabFrm *pTable = aUnions[0]->GetTable(); - for( i = 0; i < aUnions.Count(); ++i ) + SwTabFrm *pTable = aUnions.front().GetTable(); + for( i = 0; i < aUnions.size(); ++i ) { if( pTable->IsValid() ) pTable->InvalidatePos(); @@ -718,9 +718,9 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) sal_uInt16 i; // 1. check if box above contains value/formula - for( i = 0; i < aUnions.Count(); ++i ) + for( i = 0; i < aUnions.size(); ++i ) { - SwSelUnion *pUnion = aUnions[i]; + SwSelUnion *pUnion = &aUnions[i]; const SwTabFrm *pTable = pUnion->GetTable(); // Skip any repeated headlines in the follow: @@ -771,7 +771,7 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) } if( bFound ) { - i = aUnions.Count(); + i = aUnions.size(); break; } pRow = (const SwLayoutFrm*)pRow->GetNext(); @@ -785,12 +785,12 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) bFound = sal_False; rBoxes.clear(); - aUnions.DeleteAndDestroy( 0, aUnions.Count() ); + aUnions.clear(); ::MakeSelUnions( aUnions, pStart, pEnd, nsSwTblSearchType::TBLSEARCH_ROW ); - for( i = 0; i < aUnions.Count(); ++i ) + for( i = 0; i < aUnions.size(); ++i ) { - SwSelUnion *pUnion = aUnions[i]; + SwSelUnion *pUnion = &aUnions[i]; const SwTabFrm *pTable = pUnion->GetTable(); // Skip any repeated headlines in the follow: @@ -839,7 +839,7 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) } if( !bTstRow ) { - i = aUnions.Count(); + i = aUnions.size(); break; } @@ -947,10 +947,10 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, // First, compute tables and rectangles SwSelUnions aUnions; ::MakeSelUnions( aUnions, pStart, pEnd ); - if( !aUnions.Count() ) + if( aUnions.empty() ) return; - const SwTable *pTable = aUnions[0]->GetTable()->GetTable(); + const SwTable *pTable = aUnions.front().GetTable()->GetTable(); SwDoc* pDoc = (SwDoc*)pStart->GetFmt()->GetDoc(); SwTableNode* pTblNd = (SwTableNode*)pTable->GetTabSortBoxes()[ 0 ]-> GetSttNd()->FindTableNode(); @@ -961,11 +961,11 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, SWRECTFN( pStart->GetUpper() ) - for ( sal_uInt16 i = 0; i < aUnions.Count(); ++i ) + for ( sal_uInt16 i = 0; i < aUnions.size(); ++i ) { - const SwTabFrm *pTabFrm = aUnions[i]->GetTable(); + const SwTabFrm *pTabFrm = aUnions[i].GetTable(); - SwRect &rUnion = aUnions[i]->GetUnion(); + SwRect &rUnion = aUnions[i].GetUnion(); // Skip any repeated headlines in the follow: const SwLayoutFrm* pRow = pTabFrm->IsFollow() ? @@ -1511,10 +1511,6 @@ sal_uInt16 CheckMergeSel( const SwSelBoxes& rBoxes ) return eRet; } -// Determines tables affected by a table selection and union rectangles -// of the selection (also for split tables) -SV_IMPL_PTRARR( SwSelUnions, SwSelUnion* ); - SwTwips lcl_CalcWish( const SwLayoutFrm *pCell, long nWish, const long nAct ) { @@ -1955,7 +1951,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrm *pStart, if( (aUnion.*fnRect->fnGetWidth)() ) { SwSelUnion *pTmp = new SwSelUnion( aUnion, (SwTabFrm*)pTable ); - rUnions.C40_INSERT( SwSelUnion, pTmp, rUnions.Count() ); + rUnions.push_back( pTmp ); } pTable = pTable->GetFollow(); @@ -2005,9 +2001,9 @@ sal_Bool CheckSplitCells( const SwCursor& rCrsr, sal_uInt16 nDiv, ::MakeSelUnions( aUnions, pStart, pEnd, eSearchType ); // now search boxes for each entry and emit - for ( sal_uInt16 i = 0; i < aUnions.Count(); ++i ) + for ( sal_uInt16 i = 0; i < aUnions.size(); ++i ) { - SwSelUnion *pUnion = aUnions[i]; + SwSelUnion *pUnion = &aUnions[i]; const SwTabFrm *pTable = pUnion->GetTable(); // Skip any repeated headlines in the follow: diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index d2c3d4ea8eec..00b496036c5f 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -1922,9 +1922,9 @@ bool SwRootFrm::MakeTblCrsrs( SwTableCursor& rTblCrsr ) const sal_Bool bReadOnlyAvailable = rTblCrsr.IsReadOnlyAvailable(); - for ( sal_uInt16 i = 0; i < aUnions.Count(); ++i ) + for ( sal_uInt16 i = 0; i < aUnions.size(); ++i ) { - SwSelUnion *pUnion = aUnions[i]; + SwSelUnion *pUnion = &aUnions[i]; const SwTabFrm *pTable = pUnion->GetTable(); // Skip any repeated headlines in the follow: |