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: ...@@ -172,7 +172,9 @@ public:
SwTabFrm *GetTable() { return pTable; } 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 // Gets the tables involved in a table selection and the union-rectangles of the selections
// - also for split tables. // - also for split tables.
......
...@@ -595,7 +595,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) ...@@ -595,7 +595,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
SwSelUnions aUnions; SwSelUnions aUnions;
::MakeSelUnions( aUnions, pStart, pEnd ); ::MakeSelUnions( aUnions, pStart, pEnd );
if( aUnions.Count() ) if( !aUnions.empty() )
{ {
SwTable& rTable = pTblNd->GetTable(); SwTable& rTable = pTblNd->GetTable();
if (GetIDocumentUndoRedo().DoesUndo()) if (GetIDocumentUndoRedo().DoesUndo())
...@@ -651,12 +651,12 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) ...@@ -651,12 +651,12 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
} }
sal_Bool bFirst = sal_True; 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(); SwTabFrm *pTab = pUnion->GetTable();
const SwRect &rUnion = pUnion->GetUnion(); 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 ); SvPtrarr aCellArr( 255 );
::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab ); ::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab );
...@@ -842,7 +842,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, ...@@ -842,7 +842,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
SwSelUnions aUnions; SwSelUnions aUnions;
::MakeSelUnions( aUnions, pStart, pEnd ); ::MakeSelUnions( aUnions, pStart, pEnd );
if( aUnions.Count() ) if( !aUnions.empty() )
{ {
SwTable& rTable = pTblNd->GetTable(); SwTable& rTable = pTblNd->GetTable();
if (GetIDocumentUndoRedo().DoesUndo()) if (GetIDocumentUndoRedo().DoesUndo())
...@@ -850,9 +850,9 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, ...@@ -850,9 +850,9 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd)); 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(); SwTabFrm *pTab = pUnion->GetTable();
SvPtrarr aCellArr( 255 ); SvPtrarr aCellArr( 255 );
::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab ); ::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab );
...@@ -917,7 +917,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const ...@@ -917,7 +917,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
SwSelUnions aUnions; SwSelUnions aUnions;
::MakeSelUnions( aUnions, pStart, pEnd ); ::MakeSelUnions( aUnions, pStart, pEnd );
if( aUnions.Count() ) if( !aUnions.empty() )
{ {
SvxBoxItem aSetBox ((const SvxBoxItem &) rSet.Get(RES_BOX )); SvxBoxItem aSetBox ((const SvxBoxItem &) rSet.Get(RES_BOX ));
SvxBoxInfoItem aSetBoxInfo((const SvxBoxInfoItem&) rSet.Get(SID_ATTR_BORDER_INNER)); SvxBoxInfoItem aSetBoxInfo((const SvxBoxInfoItem&) rSet.Get(SID_ATTR_BORDER_INNER));
...@@ -932,13 +932,13 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const ...@@ -932,13 +932,13 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
aSetBoxInfo.ResetFlags(); 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 SwTabFrm *pTab = pUnion->GetTable();
const SwRect &rUnion = pUnion->GetUnion(); const SwRect &rUnion = pUnion->GetUnion();
const sal_Bool bFirst = i == 0 ? sal_True : sal_False; 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 ); SvPtrarr aCellArr( 255 );
::lcl_CollectCells( aCellArr, rUnion, (SwTabFrm*)pTab ); ::lcl_CollectCells( aCellArr, rUnion, (SwTabFrm*)pTab );
...@@ -1375,9 +1375,9 @@ void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols &rCols ...@@ -1375,9 +1375,9 @@ void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols &rCols
::MakeSelUnions( aUnions, pStart, pEnd, ::MakeSelUnions( aUnions, pStart, pEnd,
bWishValues ? nsSwTblSearchType::TBLSEARCH_NONE : nsSwTblSearchType::TBLSEARCH_COL ); 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 SwTabFrm *pTab = pSelUnion->GetTable();
const SwRect &rUnion = pSelUnion->GetUnion(); const SwRect &rUnion = pSelUnion->GetUnion();
......
...@@ -293,9 +293,9 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, ...@@ -293,9 +293,9 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd,
const SwCellFrm* pCurrentBottomRightFrm = 0; const SwCellFrm* pCurrentBottomRightFrm = 0;
// Now find boxes for each entry and emit // 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(); const SwTabFrm *pTable = pUnion->GetTable();
if( !pTable->IsValid() && nLoopMax ) if( !pTable->IsValid() && nLoopMax )
{ {
...@@ -408,7 +408,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, ...@@ -408,7 +408,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd,
SwDeletionChecker aDelCheck( pStart ); SwDeletionChecker aDelCheck( pStart );
// otherwise quickly "calculate" the table layout and start over // otherwise quickly "calculate" the table layout and start over
SwTabFrm *pTable = aUnions[0]->GetTable(); SwTabFrm *pTable = aUnions.front().GetTable();
while( pTable ) while( pTable )
{ {
if( pTable->IsValid() ) if( pTable->IsValid() )
...@@ -492,10 +492,10 @@ sal_Bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) ...@@ -492,10 +492,10 @@ sal_Bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd )
::MakeSelUnions( aUnions, pStart, pEnd, nsSwTblSearchType::TBLSEARCH_NO_UNION_CORRECT ); ::MakeSelUnions( aUnions, pStart, pEnd, nsSwTblSearchType::TBLSEARCH_NO_UNION_CORRECT );
// find boxes for each entry and emit // find boxes for each entry and emit
for( i = 0; i < aUnions.Count() && bTblIsValid && for( i = 0; i < aUnions.size() && bTblIsValid &&
bValidChartSel; ++i ) bValidChartSel; ++i )
{ {
SwSelUnion *pUnion = aUnions[i]; SwSelUnion *pUnion = &aUnions[i];
const SwTabFrm *pTable = pUnion->GetTable(); const SwTabFrm *pTable = pUnion->GetTable();
SWRECTFN( pTable ) SWRECTFN( pTable )
...@@ -650,8 +650,8 @@ sal_Bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) ...@@ -650,8 +650,8 @@ sal_Bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd )
break; break;
// otherwise quickly "calculate" table layout and start over // otherwise quickly "calculate" table layout and start over
SwTabFrm *pTable = aUnions[0]->GetTable(); SwTabFrm *pTable = aUnions.front().GetTable();
for( i = 0; i < aUnions.Count(); ++i ) for( i = 0; i < aUnions.size(); ++i )
{ {
if( pTable->IsValid() ) if( pTable->IsValid() )
pTable->InvalidatePos(); pTable->InvalidatePos();
...@@ -718,9 +718,9 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) ...@@ -718,9 +718,9 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes )
sal_uInt16 i; sal_uInt16 i;
// 1. check if box above contains value/formula // 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(); const SwTabFrm *pTable = pUnion->GetTable();
// Skip any repeated headlines in the follow: // Skip any repeated headlines in the follow:
...@@ -771,7 +771,7 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) ...@@ -771,7 +771,7 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes )
} }
if( bFound ) if( bFound )
{ {
i = aUnions.Count(); i = aUnions.size();
break; break;
} }
pRow = (const SwLayoutFrm*)pRow->GetNext(); pRow = (const SwLayoutFrm*)pRow->GetNext();
...@@ -785,12 +785,12 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) ...@@ -785,12 +785,12 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes )
bFound = sal_False; bFound = sal_False;
rBoxes.clear(); rBoxes.clear();
aUnions.DeleteAndDestroy( 0, aUnions.Count() ); aUnions.clear();
::MakeSelUnions( aUnions, pStart, pEnd, nsSwTblSearchType::TBLSEARCH_ROW ); ::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(); const SwTabFrm *pTable = pUnion->GetTable();
// Skip any repeated headlines in the follow: // Skip any repeated headlines in the follow:
...@@ -839,7 +839,7 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) ...@@ -839,7 +839,7 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes )
} }
if( !bTstRow ) if( !bTstRow )
{ {
i = aUnions.Count(); i = aUnions.size();
break; break;
} }
...@@ -947,10 +947,10 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, ...@@ -947,10 +947,10 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
// First, compute tables and rectangles // First, compute tables and rectangles
SwSelUnions aUnions; SwSelUnions aUnions;
::MakeSelUnions( aUnions, pStart, pEnd ); ::MakeSelUnions( aUnions, pStart, pEnd );
if( !aUnions.Count() ) if( aUnions.empty() )
return; return;
const SwTable *pTable = aUnions[0]->GetTable()->GetTable(); const SwTable *pTable = aUnions.front().GetTable()->GetTable();
SwDoc* pDoc = (SwDoc*)pStart->GetFmt()->GetDoc(); SwDoc* pDoc = (SwDoc*)pStart->GetFmt()->GetDoc();
SwTableNode* pTblNd = (SwTableNode*)pTable->GetTabSortBoxes()[ 0 ]-> SwTableNode* pTblNd = (SwTableNode*)pTable->GetTabSortBoxes()[ 0 ]->
GetSttNd()->FindTableNode(); GetSttNd()->FindTableNode();
...@@ -961,11 +961,11 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, ...@@ -961,11 +961,11 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
SWRECTFN( pStart->GetUpper() ) 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: // Skip any repeated headlines in the follow:
const SwLayoutFrm* pRow = pTabFrm->IsFollow() ? const SwLayoutFrm* pRow = pTabFrm->IsFollow() ?
...@@ -1511,10 +1511,6 @@ sal_uInt16 CheckMergeSel( const SwSelBoxes& rBoxes ) ...@@ -1511,10 +1511,6 @@ sal_uInt16 CheckMergeSel( const SwSelBoxes& rBoxes )
return eRet; 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, SwTwips lcl_CalcWish( const SwLayoutFrm *pCell, long nWish,
const long nAct ) const long nAct )
{ {
...@@ -1955,7 +1951,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrm *pStart, ...@@ -1955,7 +1951,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrm *pStart,
if( (aUnion.*fnRect->fnGetWidth)() ) if( (aUnion.*fnRect->fnGetWidth)() )
{ {
SwSelUnion *pTmp = new SwSelUnion( aUnion, (SwTabFrm*)pTable ); SwSelUnion *pTmp = new SwSelUnion( aUnion, (SwTabFrm*)pTable );
rUnions.C40_INSERT( SwSelUnion, pTmp, rUnions.Count() ); rUnions.push_back( pTmp );
} }
pTable = pTable->GetFollow(); pTable = pTable->GetFollow();
...@@ -2005,9 +2001,9 @@ sal_Bool CheckSplitCells( const SwCursor& rCrsr, sal_uInt16 nDiv, ...@@ -2005,9 +2001,9 @@ sal_Bool CheckSplitCells( const SwCursor& rCrsr, sal_uInt16 nDiv,
::MakeSelUnions( aUnions, pStart, pEnd, eSearchType ); ::MakeSelUnions( aUnions, pStart, pEnd, eSearchType );
// now search boxes for each entry and emit // 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(); const SwTabFrm *pTable = pUnion->GetTable();
// Skip any repeated headlines in the follow: // Skip any repeated headlines in the follow:
......
...@@ -1922,9 +1922,9 @@ bool SwRootFrm::MakeTblCrsrs( SwTableCursor& rTblCrsr ) ...@@ -1922,9 +1922,9 @@ bool SwRootFrm::MakeTblCrsrs( SwTableCursor& rTblCrsr )
const sal_Bool bReadOnlyAvailable = rTblCrsr.IsReadOnlyAvailable(); 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(); const SwTabFrm *pTable = pUnion->GetTable();
// Skip any repeated headlines in the follow: // 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