Kaydet (Commit) 4dcc1b65 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Convert SV_DECL_PTRARR_DEL(SwSelUnions) to boost::ptr_vector

üst 7cd899bc
......@@ -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.
......
......@@ -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();
......
......@@ -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:
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment