diff options
Diffstat (limited to 'sw')
36 files changed, 550 insertions, 539 deletions
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index 29c779a51ed2..8a6624eb2c1d 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -73,7 +73,18 @@ struct Parm; SV_DECL_REF( SwServerObject ) #endif -SV_DECL_PTRARR_DEL(SwTableLines, SwTableLine*, 10) +class SwTableLines : public std::vector<SwTableLine*> { +public: + // free's any remaining child objects + ~SwTableLines(); + + // return USHRT_MAX if not found, else index of position + sal_uInt16 GetPos(const SwTableLine* pBox) const + { + const_iterator it = std::find(begin(), end(), pBox); + return it == end() ? USHRT_MAX : it - begin(); + } +}; class SwTableBoxes : public std::vector<SwTableBox*> { public: @@ -89,7 +100,6 @@ public: // (for calculation in table). typedef SwTableBox* SwTableBoxPtr; SV_DECL_PTRARR_SORT( SwTableSortBoxes, SwTableBoxPtr, 25 ) -typedef SwTableLine* SwTableLinePtr; class SW_DLLPUBLIC SwTable: public SwClient //Client of FrmFmt. { @@ -176,7 +186,7 @@ public: void SetTableModel( sal_Bool bNew ){ bNewModel = bNew; } sal_Bool IsNewModel() const { return bNewModel; } - sal_uInt16 GetRowsToRepeat() const { return Min( GetTabLines().Count(), nRowsToRepeat ); } + sal_uInt16 GetRowsToRepeat() const { return Min( (sal_uInt16)GetTabLines().size(), nRowsToRepeat ); } sal_uInt16 _GetRowsToRepeat() const { return nRowsToRepeat; } void SetRowsToRepeat( sal_uInt16 nNumOfRows ) { nRowsToRepeat = nNumOfRows; } @@ -252,7 +262,7 @@ public: void FindSuperfluousRows( SwSelBoxes& rBoxes ) { _FindSuperfluousRows( rBoxes, 0, 0 ); } - void CheckRowSpan( SwTableLinePtr &rpLine, bool bUp ) const; + void CheckRowSpan( SwTableLine* &rpLine, bool bUp ) const; SwTableSortBoxes& GetTabSortBoxes() { return aSortCntBoxes; } const SwTableSortBoxes& GetTabSortBoxes() const { return aSortCntBoxes; } diff --git a/sw/inc/tblsel.hxx b/sw/inc/tblsel.hxx index a4b772883fa0..63fa38a0a469 100644 --- a/sw/inc/tblsel.hxx +++ b/sw/inc/tblsel.hxx @@ -221,8 +221,8 @@ struct _FndPara : rBoxes(rPara.rBoxes), pFndLine(pFL), pFndBox(rPara.pFndBox) {} }; -sal_Bool _FndBoxCopyCol( const SwTableBox*& rpBox, void* pPara ); -SW_DLLPUBLIC sal_Bool _FndLineCopyCol( const SwTableLine*& rpLine, void* pPara ); +SW_DLLPUBLIC void ForEach_FndLineCopyCol(SwTableLines& rLines, _FndPara* pFndPara ); + #endif // _TBLSEL_HXX diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx index f48fab46734d..ae2307935674 100644 --- a/sw/source/core/doc/docchart.cxx +++ b/sw/source/core/doc/docchart.cxx @@ -84,15 +84,15 @@ sal_Bool SwTable::IsTblComplexForChart( const String& rSelection ) const pSttBox = (*pLns)[ 0 ]->GetTabBoxes().front(); while( !pSttBox->GetSttNd() ) // Until the Content Box! - pSttBox = pSttBox->GetTabLines()[ 0 ]->GetTabBoxes().front(); + pSttBox = pSttBox->GetTabLines().front()->GetTabBoxes().front(); - const SwTableBoxes* pBoxes = &(*pLns)[ pLns->Count()-1 ]->GetTabBoxes(); + const SwTableBoxes* pBoxes = &pLns->back()->GetTabBoxes(); pEndBox = pBoxes->back(); while( !pEndBox->GetSttNd() ) { // Until the Content Box! pLns = &pEndBox->GetTabLines(); - pBoxes = &(*pLns)[ pLns->Count()-1 ]->GetTabBoxes(); + pBoxes = &pLns->back()->GetTabBoxes(); pEndBox = pBoxes->back(); } } diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 29284de06325..f9ce363821a3 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -502,7 +502,7 @@ sal_Bool SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) _FndBox aFndBox( 0, 0 ); { _FndPara aPara( rBoxes, &aFndBox ); - pTblNd->GetTable().GetTabLines().ForEach( &_FndLineCopyCol, &aPara );; + ForEach_FndLineCopyCol( pTblNd->GetTable().GetTabLines(), &aPara ); } if(aFndBox.GetLines().empty()) diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx index cd629f2aa71c..0694be341fbd 100644 --- a/sw/source/core/doc/gctable.cxx +++ b/sw/source/core/doc/gctable.cxx @@ -31,6 +31,7 @@ #include <tblrwcl.hxx> #include <swtblfmt.hxx> #include <algorithm> +#include <boost/foreach.hpp> using namespace ::editeng; @@ -55,48 +56,48 @@ sal_Bool _SwGCBorder_BoxBrd::CheckLeftBorderOfFormat( const SwFrmFmt& rFmt ) } +static bool lcl_GCBorder_ChkBoxBrd_B( const SwTableBox* pBox, _SwGCBorder_BoxBrd* pPara ); -sal_Bool lcl_GCBorder_ChkBoxBrd_L( const SwTableLine*& rpLine, void* pPara ) +static bool lcl_GCBorder_ChkBoxBrd_L( const SwTableLine* pLine, _SwGCBorder_BoxBrd* pPara ) { - const SwTableBox* pBox = rpLine->GetTabBoxes()[ 0 ]; + const SwTableBox* pBox = pLine->GetTabBoxes().front(); return lcl_GCBorder_ChkBoxBrd_B( pBox, pPara ); } -sal_Bool lcl_GCBorder_ChkBoxBrd_B( const SwTableBox*& rpBox, void* pPara ) +static bool lcl_GCBorder_ChkBoxBrd_B( const SwTableBox* pBox, _SwGCBorder_BoxBrd* pPara ) { - sal_Bool bRet = sal_True; - if( rpBox->GetTabLines().Count() ) + bool bRet = true; + if( !pBox->GetTabLines().empty() ) { - for( sal_uInt16 n = 0, nLines = rpBox->GetTabLines().Count(); + for( sal_uInt16 n = 0, nLines = pBox->GetTabLines().size(); n < nLines && bRet; ++n ) { - const SwTableLine* pLine = rpBox->GetTabLines()[ n ]; + const SwTableLine* pLine = pBox->GetTabLines()[ n ]; bRet = lcl_GCBorder_ChkBoxBrd_L( pLine, pPara ); } } else { - _SwGCBorder_BoxBrd* pBPara = (_SwGCBorder_BoxBrd*)pPara; - bRet = pBPara->CheckLeftBorderOfFormat( *rpBox->GetFrmFmt() ); + bRet = pPara->CheckLeftBorderOfFormat( *pBox->GetFrmFmt() ); } return bRet; } static void lcl_GCBorder_GetLastBox_B( const SwTableBox* pBox, SwTableBoxes* pPara ); -sal_Bool lcl_GCBorder_GetLastBox_L( const SwTableLine*& rpLine, void* pPara ) +static void lcl_GCBorder_GetLastBox_L( const SwTableLine* pLine, SwTableBoxes* pPara ) { - const SwTableBoxes& rBoxes = rpLine->GetTabBoxes(); - const SwTableBox* pBox = rBoxes.back(); - lcl_GCBorder_GetLastBox_B( pBox, (SwTableBoxes*)pPara ); - return sal_True; + const SwTableBoxes& rBoxes = pLine->GetTabBoxes(); + SwTableBox* pBox = rBoxes.back(); + lcl_GCBorder_GetLastBox_B( pBox, pPara ); } static void lcl_GCBorder_GetLastBox_B( const SwTableBox* pBox, SwTableBoxes* pPara ) { - SwTableLines& rLines = (SwTableLines&)pBox->GetTabLines(); - if( rLines.Count() ) - rLines.ForEach( &lcl_GCBorder_GetLastBox_L, pPara ); + const SwTableLines& rLines = pBox->GetTabLines(); + if( !rLines.empty() ) + BOOST_FOREACH( const SwTableLine* pLine, rLines ) + lcl_GCBorder_GetLastBox_L( pLine, pPara ); else pPara->push_back( (SwTableBox*)pBox ); } @@ -168,18 +169,16 @@ void lcl_GCBorder_DelBorder( const SwCollectTblLineBoxes& rCollTLB, } while( sal_True ); } -static sal_Bool lcl_GC_Box_Border( SwTableBox* pBox, _SwGCLineBorder* pPara ); +static void lcl_GC_Box_Border( const SwTableBox* pBox, _SwGCLineBorder* pPara ); -sal_Bool lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) +void lcl_GC_Line_Border( const SwTableLine* pLine, _SwGCLineBorder* pGCPara ) { - _SwGCLineBorder* pGCPara = (_SwGCLineBorder*)pPara; - // First the right edge with the left edge of the succeeding Box within this Line { _SwGCBorder_BoxBrd aBPara; const SvxBorderLine* pBrd; const SfxPoolItem* pItem; - const SwTableBoxes& rBoxes = rpLine->GetTabBoxes(); + const SwTableBoxes& rBoxes = pLine->GetTabBoxes(); for( sal_uInt16 n = 0, nBoxes = rBoxes.size() - 1; n < nBoxes; ++n ) { SwTableBoxes aBoxes; @@ -221,7 +220,7 @@ sal_Bool lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) SwCollectTblLineBoxes aBottom( sal_False ); SwCollectTblLineBoxes aTop( sal_True ); - ::lcl_Line_CollectBox( rpLine, &aBottom ); + ::lcl_Line_CollectBox( pLine, &aBottom ); const SwTableLine* pNextLine = (*pGCPara->pLines)[ pGCPara->nLinePos+1 ]; ::lcl_Line_CollectBox( pNextLine, &aTop ); @@ -309,24 +308,22 @@ sal_Bool lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) } while( sal_True ); } - for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); - it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) - lcl_GC_Box_Border(*it, (_SwGCLineBorder*)pPara ); + for( SwTableBoxes::const_iterator it = pLine->GetTabBoxes().begin(); + it != pLine->GetTabBoxes().end(); ++it) + lcl_GC_Box_Border(*it, pGCPara ); ++pGCPara->nLinePos; - - return sal_True; } -static sal_Bool lcl_GC_Box_Border( SwTableBox* pBox, _SwGCLineBorder* pPara ) +static void lcl_GC_Box_Border( const SwTableBox* pBox, _SwGCLineBorder* pPara ) { - if( pBox->GetTabLines().Count() ) + if( !pBox->GetTabLines().empty() ) { _SwGCLineBorder aPara( *pBox ); aPara.pShareFmts = pPara->pShareFmts; - pBox->GetTabLines().ForEach( &lcl_GC_Line_Border, &aPara ); + BOOST_FOREACH( const SwTableLine* pLine, pBox->GetTabLines() ) + lcl_GC_Line_Border( pLine, &aPara ); } - return sal_True; } struct _GCLinePara @@ -339,21 +336,21 @@ struct _GCLinePara {} }; -static bool lcl_MergeGCLine(const SwTableLine*& rpLine, void*const pPara); +static bool lcl_MergeGCLine(SwTableLine* pLine, _GCLinePara* pPara); -static bool lcl_MergeGCBox(SwTableBox* pTblBox, void*const pPara) +static bool lcl_MergeGCBox(SwTableBox* pTblBox, _GCLinePara* pPara) { - sal_uInt16 n, nLen = pTblBox->GetTabLines().Count(); + sal_uInt16 n, nLen = pTblBox->GetTabLines().size(); if( nLen ) { // ATTENTION: The Line count can change! - _GCLinePara aPara( pTblBox->GetTabLines(), (_GCLinePara*)pPara ); - for( n = 0; n < pTblBox->GetTabLines().Count() && - lcl_MergeGCLine( *(pTblBox->GetTabLines().GetData() + n), &aPara ); + _GCLinePara aPara( pTblBox->GetTabLines(), pPara ); + for( n = 0; n < pTblBox->GetTabLines().size() && + lcl_MergeGCLine( pTblBox->GetTabLines()[n], &aPara ); ++n ) ; - if( 1 == pTblBox->GetTabLines().Count() ) + if( 1 == pTblBox->GetTabLines().size() ) { // Box with a Line, then move all the Line's Boxes after this Box // into the parent Line and delete this Box @@ -375,18 +372,16 @@ static bool lcl_MergeGCBox(SwTableBox* pTblBox, void*const pPara) return true; } -static bool lcl_MergeGCLine(const SwTableLine*& rpLine, void *const pPara) +static bool lcl_MergeGCLine(SwTableLine* pLn, _GCLinePara* pGCPara) { - SwTableLine* pLn = (SwTableLine*)rpLine; sal_uInt16 nLen = pLn->GetTabBoxes().size(); if( nLen ) { - _GCLinePara* pGCPara = (_GCLinePara*)pPara; while( 1 == nLen ) { // We have a Box with Lines SwTableBox* pBox = pLn->GetTabBoxes().front(); - if( !pBox->GetTabLines().Count() ) + if( pBox->GetTabLines().empty() ) break; SwTableLine* pLine = pBox->GetTabLines()[0]; @@ -394,17 +389,16 @@ static bool lcl_MergeGCLine(const SwTableLine*& rpLine, void *const pPara) // pLine turns into the current Line (that is rpLine), the rest is moved // into the LinesArray past the current one. // The LinesArray is in pPara! - nLen = pBox->GetTabLines().Count(); + nLen = pBox->GetTabLines().size(); SwTableLines& rLns = *pGCPara->pLns; - const SwTableLine* pTmp = pLn; - sal_uInt16 nInsPos = rLns.GetPos( pTmp ); + sal_uInt16 nInsPos = rLns.GetPos( pLn ); OSL_ENSURE( USHRT_MAX != nInsPos, "Could not find Line!" ); SwTableBox* pUpper = pLn->GetUpper(); - rLns.Remove( nInsPos, 1 ); // remove the Line from the array - rLns.Insert( &pBox->GetTabLines(), nInsPos ); + rLns.erase( rLns.begin() + nInsPos ); // remove the Line from the array + rLns.insert( rLns.begin() + nInsPos, pBox->GetTabLines().begin(), pBox->GetTabLines().end() ); // JP 31.03.99: Bug 60000 // Pass the attributes of the to-be-deleted Lines to the "inserted" one @@ -419,7 +413,7 @@ static bool lcl_MergeGCLine(const SwTableLine*& rpLine, void *const pPara) pGCPara->pShareFmts->SetAttr( *rBoxLns[ nLns ], *pItem ); } - pBox->GetTabLines().Remove( 0, nLen ); // Remove Lines from the array + pBox->GetTabLines().erase( pBox->GetTabLines().begin(), pBox->GetTabLines().begin() + nLen ); // Remove Lines from the array delete pLn; @@ -433,7 +427,7 @@ static bool lcl_MergeGCLine(const SwTableLine*& rpLine, void *const pPara) // ATTENTION: The number of boxes can change! for( nLen = 0; nLen < pLn->GetTabBoxes().size(); ++nLen ) - if( !lcl_MergeGCBox( pLn->GetTabBoxes()[nLen], pPara )) + if( !lcl_MergeGCBox( pLn->GetTabBoxes()[nLen], pGCPara )) --nLen; } return true; @@ -446,8 +440,8 @@ void SwTable::GCLines() _GCLinePara aPara( GetTabLines() ); SwShareBoxFmts aShareFmts; aPara.pShareFmts = &aShareFmts; - for( sal_uInt16 n = 0; n < GetTabLines().Count() && - lcl_MergeGCLine( *(GetTabLines().GetData() + n ), &aPara ); ++n ) + for( sal_uInt16 n = 0; n < GetTabLines().size() && + lcl_MergeGCLine( GetTabLines()[n], &aPara ); ++n ) ; } diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index 890a1c8c35ce..835e0cfafa06 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -48,6 +48,7 @@ #include "htmltbl.hxx" #include "ndindex.hxx" #include "switerator.hxx" +#include <boost/foreach.hpp> using namespace ::com::sun::star; @@ -417,11 +418,11 @@ const SwStartNode *SwHTMLTableLayout::GetAnyBoxStartNode() const const SwTableBox* pBox = pSwTable->GetTabLines()[0]->GetTabBoxes()[0]; while( 0 == (pBoxSttNd = pBox->GetSttNd()) ) { - OSL_ENSURE( pBox->GetTabLines().Count() > 0, + OSL_ENSURE( pBox->GetTabLines().size() > 0, "Box without start node and lines" ); - OSL_ENSURE( pBox->GetTabLines()[0]->GetTabBoxes().size() > 0, + OSL_ENSURE( pBox->GetTabLines().front()->GetTabBoxes().size() > 0, "Line without boxes" ); - pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0]; + pBox = pBox->GetTabLines().front()->GetTabBoxes().front(); } return pBoxSttNd; @@ -1535,14 +1536,15 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv } } -static sal_Bool lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara ); +static void lcl_ResizeLine( const SwTableLine* pLine, sal_uInt16 *pWidth ); -static sal_Bool lcl_ResizeBox( SwTableBox* pBox, sal_uInt16* pWidth ) +static void lcl_ResizeBox( const SwTableBox* pBox, sal_uInt16* pWidth ) { if( !pBox->GetSttNd() ) { sal_uInt16 nWidth = 0; - pBox->GetTabLines().ForEach( &lcl_ResizeLine, &nWidth ); + BOOST_FOREACH( const SwTableLine *pLine, pBox->GetTabLines() ) + lcl_ResizeLine( pLine, &nWidth ); pBox->GetFrmFmt()->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth, 0 )); *pWidth = *pWidth + nWidth; } @@ -1550,27 +1552,21 @@ static sal_Bool lcl_ResizeBox( SwTableBox* pBox, sal_uInt16* pWidth ) { *pWidth = *pWidth + (sal_uInt16)pBox->GetFrmFmt()->GetFrmSize().GetSize().Width(); } - - return sal_True; } -static sal_Bool lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara ) +static void lcl_ResizeLine( const SwTableLine* pLine, sal_uInt16 *pWidth ) { - sal_uInt16 *pWidth = (sal_uInt16 *)pPara; #if OSL_DEBUG_LEVEL > 0 sal_uInt16 nOldWidth = *pWidth; #endif *pWidth = 0; - for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); - it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) - lcl_ResizeBox(*it, pWidth ); + BOOST_FOREACH( const SwTableBox* pBox, pLine->GetTabBoxes() ) + lcl_ResizeBox(pBox, pWidth ); #if OSL_DEBUG_LEVEL > 0 OSL_ENSURE( !nOldWidth || Abs(*pWidth-nOldWidth) < COLFUZZY, "A box's rows have all a different length." ); #endif - - return sal_True; } void SwHTMLTableLayout::SetWidths( sal_Bool bCallPass2, sal_uInt16 nAbsAvail, @@ -1637,8 +1633,8 @@ void SwHTMLTableLayout::SetWidths( sal_Bool bCallPass2, sal_uInt16 nAbsAvail, if( IsTopTable() ) { sal_uInt16 nCalcTabWidth = 0; - ((SwTable *)pSwTable)->GetTabLines().ForEach( &lcl_ResizeLine, - &nCalcTabWidth ); + BOOST_FOREACH( const SwTableLine *pLine, pSwTable->GetTabLines() ) + lcl_ResizeLine( pLine, &nCalcTabWidth ); OSL_ENSURE( Abs( nRelTabWidth-nCalcTabWidth ) < COLFUZZY, "Table width is not equal to the row width." ); diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index 582370dca267..e325c265ff3c 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -49,9 +49,8 @@ #include <redline.hxx> #include <fmtfsize.hxx> #include <list> +#include <boost/foreach.hpp> -sal_Bool _FndCntntLine( const SwTableLine*& rpLine, void* pPara ); -sal_Bool _FndCntntBox( const SwTableBox*& rpBox, void* pPara ); void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, SwTable& rDstTbl, SwTableBox* pDstBox, sal_Bool bDelCntnt, SwUndoTblCpyTbl* pUndo ); @@ -114,10 +113,10 @@ namespace SubTable::iterator insertSubBox( SubTable& rSubTable, SwTableBox& rBox, SubTable::iterator pStartLn, SubTable::iterator pEndLn ) { - if( rBox.GetTabLines().Count() ) + if( !rBox.GetTabLines().empty() ) { SubTable::difference_type nSize = std::distance( pStartLn, pEndLn ); - if( nSize < rBox.GetTabLines().Count() ) + if( nSize < (sal_uInt16)rBox.GetTabLines().size() ) { SubLine aSubLine; SubLine::iterator pBox = pStartLn->begin(); @@ -133,9 +132,9 @@ namespace do { rSubTable.insert( pEndLn, aSubLine ); - } while( ++nSize < rBox.GetTabLines().Count() ); + } while( ++nSize < (sal_uInt16)rBox.GetTabLines().size() ); } - for( sal_uInt16 nLine = 0; nLine < rBox.GetTabLines().Count(); ++nLine ) + for( sal_uInt16 nLine = 0; nLine < rBox.GetTabLines().size(); ++nLine ) pStartLn = insertSubLine( rSubTable, *rBox.GetTabLines()[nLine], pStartLn ); OSL_ENSURE( pStartLn == pEndLn, "Sub line confusion" ); @@ -176,13 +175,13 @@ namespace } TableStructure::TableStructure( const SwTable& rTable ) : - maLines( rTable.GetTabLines().Count() ), mnStartCol(USHRT_MAX), + maLines( rTable.GetTabLines().size() ), mnStartCol(USHRT_MAX), mnAddLine(0) { maCols.push_front(0); const SwTableLines &rLines = rTable.GetTabLines(); sal_uInt16 nCnt = 0; - for( sal_uInt16 nLine = 0; nLine < rLines.Count(); ++nLine ) + for( sal_uInt16 nLine = 0; nLine < rLines.size(); ++nLine ) addLine( nCnt, rLines[nLine]->GetTabBoxes(), 0, rTable.IsNewModel() ); } @@ -211,10 +210,10 @@ namespace (sal_uInt16)nMinSize > nEndLn - nStartLn + 1 ) { sal_uInt16 nNewEndLn = nStartLn + (sal_uInt16)nMinSize - 1; - if( nNewEndLn >= rLines.Count() ) + if( nNewEndLn >= rLines.size() ) { - mnAddLine = nNewEndLn - rLines.Count() + 1; - nNewEndLn = rLines.Count() - 1; + mnAddLine = nNewEndLn - rLines.size() + 1; + nNewEndLn = rLines.size() - 1; } while( nEndLn < nNewEndLn ) { @@ -261,7 +260,7 @@ namespace bool bComplex = false; if( !bNewModel ) for( sal_uInt16 nBox = 0; !bComplex && nBox < rBoxes.size(); ++nBox ) - bComplex = rBoxes[nBox]->GetTabLines().Count() > 0; + bComplex = !rBoxes[nBox]->GetTabLines().empty(); if( bComplex ) { SubTable aSubTable; @@ -374,7 +373,7 @@ namespace if( mnAddLine ) { const SwTableLines &rLines = rTable.GetTabLines(); - sal_uInt16 nLineCount = rLines.Count(); + sal_uInt16 nLineCount = rLines.size(); if( nLineCount < mnAddLine ) mnAddLine = nLineCount; sal_uInt16 nLine = (sal_uInt16)maLines.size(); @@ -586,8 +585,8 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, // If DestBox is a Headline Box and has Table style set, then // DO NOT automatically set the TableHeadline style! - if( 1 < rDstTbl.GetTabLines().Count() && - pLine == rDstTbl.GetTabLines()[0] ) + if( 1 < rDstTbl.GetTabLines().size() && + pLine == rDstTbl.GetTabLines().front() ) { SwCntntNode* pCNd = aInsIdx.GetNode().GetCntntNode(); if( !pCNd ) @@ -615,8 +614,8 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, { sal_uInt16 nPoolId = pTxtNd->GetTxtColl()->GetPoolFmtId(); if( bReplaceColl && - (( 1 < rDstTbl.GetTabLines().Count() && - pLine == rDstTbl.GetTabLines()[0] ) + (( 1 < rDstTbl.GetTabLines().size() && + pLine == rDstTbl.GetTabLines().front() ) // Is the Table's content sill valid? ? RES_POOLCOLL_TABLE == nPoolId : RES_POOLCOLL_TABLE_HDLN == nPoolId ) ) @@ -683,7 +682,7 @@ sal_Bool SwTable::InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBox _FndBox aFndBox( 0, 0 ); { // get all boxes/lines _FndPara aPara( rSelBoxes, &aFndBox ); - GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( GetTabLines(), &aPara ); } TableStructure aTarget( *this, aFndBox, rSelBoxes, aCopyStruct.getLineCount() ); @@ -691,7 +690,7 @@ sal_Bool SwTable::InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBox if( aTarget.mnAddLine && IsNewModel() ) { SwSelBoxes aBoxes; - aBoxes.Insert( GetTabLines()[ GetTabLines().Count()-1 ]->GetTabBoxes()[0] ); + aBoxes.Insert( GetTabLines().back()->GetTabBoxes().front() ); if( pUndo ) pUndo->InsertRow( *this, aBoxes, aTarget.mnAddLine ); else @@ -768,13 +767,13 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwNodeIndex& rSttBox, sal_Bool bDelCntnt = sal_True; const SwTableBox* pTmp; - for( sal_uInt16 nLines = 0; nLines < rCpyTbl.GetTabLines().Count(); ++nLines ) + for( sal_uInt16 nLines = 0; nLines < rCpyTbl.GetTabLines().size(); ++nLines ) { // Get the first from the CopyLine const SwTableBox* pCpyBox = rCpyTbl.GetTabLines()[nLines] - ->GetTabBoxes()[0]; - while( pCpyBox->GetTabLines().Count() ) - pCpyBox = pCpyBox->GetTabLines()[0]->GetTabBoxes()[0]; + ->GetTabBoxes().front(); + while( !pCpyBox->GetTabLines().empty() ) + pCpyBox = pCpyBox->GetTabLines().front()->GetTabBoxes().front(); do { // First copy the new content and then delete the old one. @@ -798,15 +797,15 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwNodeIndex& rSttBox, pNxtLine = pNxtLine->GetUpper()->GetUpper(); sal_uInt16 nPos = GetTabLines().C40_GETPOS( SwTableLine, pNxtLine ); // Is there a next? - if( nPos + 1 >= GetTabLines().Count() ) + if( nPos + 1 >= (sal_uInt16)GetTabLines().size() ) bDelCntnt = sal_False; // there is none, all goes into the last Box else { // Find the next Box with content pNxtLine = GetTabLines()[ nPos+1 ]; - pMyBox = pNxtLine->GetTabBoxes()[0]; - while( pMyBox->GetTabLines().Count() ) - pMyBox = pMyBox->GetTabLines()[0]->GetTabBoxes()[0]; + pMyBox = pNxtLine->GetTabBoxes().front(); + while( !pMyBox->GetTabLines().empty() ) + pMyBox = pMyBox->GetTabLines().front()->GetTabBoxes().front(); bDelCntnt = sal_True; } } @@ -840,7 +839,7 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, // Find all Boxes/Lines { _FndPara aPara( rSelBoxes, &aFndBox ); - ((SwTableLines&)GetTabLines()).ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( GetTabLines(), &aPara ); } // Special case: If a Box is located in a Table, copy it to all selected @@ -864,8 +863,8 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, if( 1 == nFndCnt ) { // Is there still enough space in the Table? - if( (GetTabLines().Count() - nSttLine ) < - rCpyTbl.GetTabLines().Count() ) + if( (GetTabLines().size() - nSttLine ) < + rCpyTbl.GetTabLines().size() ) { // If we don't have enough Lines, then see if we can insert // new ones to reach our goal. But only if the SSelection @@ -873,16 +872,16 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, if( 1 < rSelBoxes.Count() ) return sal_False; - sal_uInt16 nNewLns = rCpyTbl.GetTabLines().Count() - - (GetTabLines().Count() - nSttLine ); + sal_uInt16 nNewLns = rCpyTbl.GetTabLines().size() - + (GetTabLines().size() - nSttLine ); // See if the Box count is high enough for the Lines - SwTableLine* pLastLn = GetTabLines()[ GetTabLines().Count()-1 ]; + SwTableLine* pLastLn = GetTabLines().back(); pSttBox = pFLine->GetBoxes()[0].GetBox(); sal_uInt16 nSttBox = pFLine->GetLine()->GetTabBoxes().GetPos( pSttBox ); - for( sal_uInt16 n = rCpyTbl.GetTabLines().Count() - nNewLns; - n < rCpyTbl.GetTabLines().Count(); ++n ) + for( sal_uInt16 n = rCpyTbl.GetTabLines().size() - nNewLns; + n < rCpyTbl.GetTabLines().size(); ++n ) { SwTableLine* pCpyLn = rCpyTbl.GetTabLines()[ n ]; @@ -912,9 +911,9 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, return sal_False; } - nTstLns = rCpyTbl.GetTabLines().Count(); // copy this many + nTstLns = rCpyTbl.GetTabLines().size(); // copy this many } - else if( 0 == (nFndCnt % rCpyTbl.GetTabLines().Count()) ) + else if( 0 == (nFndCnt % rCpyTbl.GetTabLines().size()) ) nTstLns = nFndCnt; else return sal_False; // not enough space for the rows @@ -934,7 +933,7 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, pLine = pInsFLine->GetLine(); } SwTableLine* pCpyLn = rCpyTbl.GetTabLines()[ nLn % - rCpyTbl.GetTabLines().Count() ]; + rCpyTbl.GetTabLines().size() ]; // Selected too few rows? if( pInsFLine ) @@ -1021,7 +1020,7 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, { pFLine = &aFndBox.GetLines()[ nLn ]; SwTableLine* pCpyLn = rCpyTbl.GetTabLines()[ - nLn % rCpyTbl.GetTabLines().Count() ]; + nLn % rCpyTbl.GetTabLines().size() ]; for( nBx = 0; nBx < pFLine->GetBoxes().size(); ++nBx ) { // Copy the pCpyBox into pMyBox @@ -1035,21 +1034,21 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, return sal_True; } -static sal_Bool _FndCntntBox( SwTableBox* pBox, void* pPara ) +static void _FndCntntLine( const SwTableLine* pLine, SwSelBoxes* pPara ); + +static void _FndCntntBox( const SwTableBox* pBox, SwSelBoxes* pPara ) { - if( pBox->GetTabLines().Count() ) - pBox->GetTabLines().ForEach( &_FndCntntLine, pPara ); + if( !pBox->GetTabLines().empty() ) + BOOST_FOREACH( const SwTableLine* pLine, pBox->GetTabLines() ) + _FndCntntLine( pLine, pPara ); else - ((SwSelBoxes*)pPara)->Insert( pBox ); - return sal_True; + pPara->Insert( (SwTableBox*)pBox ); } -sal_Bool _FndCntntLine( const SwTableLine*& rpLine, void* pPara ) +static void _FndCntntLine( const SwTableLine* pLine, SwSelBoxes* pPara ) { - for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); - it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) - _FndCntntBox(*it, pPara ); - return sal_True; + BOOST_FOREACH( const SwTableBox* pBox, pLine->GetTabBoxes() ) + _FndCntntBox(pBox, pPara ); } // Find all Boxes with content in this Box diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index b07088d1c5eb..8b1cb3d2dad9 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -202,7 +202,7 @@ void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize ); #define CHECKTABLELAYOUT \ { \ - for ( sal_uInt16 i = 0; i < GetTabLines().Count(); ++i ) \ + for ( sal_uInt16 i = 0; i < GetTabLines().size(); ++i ) \ { \ SwFrmFmt* pFmt = GetTabLines()[i]->GetFrmFmt(); \ SwIterator<SwRowFrm,SwFmt> aIter( *pFmt ); \ @@ -345,7 +345,7 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) SwFmtFrmSize aFrmSz( pNewFmt->GetFrmSize() ); bool bDiffCount = false; - if( pBox->GetTabLines().Count() ) + if( pBox->GetTabLines().size() ) { pCmpLine = &rFndBox.GetLines().front(); if ( pCmpLine->GetBoxes().size() != pCmpLine->GetLine()->GetTabBoxes().size() ) @@ -461,12 +461,13 @@ static void lcl_CopyRow(_FndLine& rFndLine, _CpyPara *const pCpyPara) rFndLine.GetBoxes().size(), pCpyPara->pInsBox ); if( pCpyPara->pInsBox ) { - pCpyPara->pInsBox->GetTabLines().C40_INSERT( SwTableLine, pNewLine, pCpyPara->nInsPos++ ); + SwTableLines& rLines = pCpyPara->pInsBox->GetTabLines(); + rLines.insert( rLines.begin() + pCpyPara->nInsPos++, pNewLine ); } else { - pCpyPara->pTblNd->GetTable().GetTabLines().C40_INSERT( SwTableLine, pNewLine, - pCpyPara->nInsPos++ ); + SwTableLines& rLines = pCpyPara->pTblNd->GetTable().GetTabLines(); + rLines.insert( rLines.begin() + pCpyPara->nInsPos++, pNewLine ); } _CpyPara aPara( *pCpyPara, pNewLine ); @@ -540,7 +541,7 @@ sal_Bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 n _FndBox aFndBox( 0, 0 ); { _FndPara aPara( rBoxes, &aFndBox ); - GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( GetTabLines(), &aPara ); } if( aFndBox.GetLines().empty() ) return sal_False; @@ -591,7 +592,7 @@ sal_Bool SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, _FndBox aFndBox( 0, 0 ); { _FndPara aPara( rBoxes, &aFndBox ); - GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( GetTabLines(), &aPara ); } if( aFndBox.GetLines().empty() ) return sal_False; @@ -632,11 +633,11 @@ sal_Bool SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, SwTableLine* pLine = pFndBox->GetLines()[ bBehind ? pFndBox->GetLines().size()-1 : 0 ].GetLine(); if( &aFndBox == pFndBox ) - aCpyPara.nInsPos = GetTabLines().C40_GETPOS( SwTableLine, pLine ); + aCpyPara.nInsPos = GetTabLines().GetPos( pLine ); else { aCpyPara.pInsBox = pFndBox->GetBox(); - aCpyPara.nInsPos = pFndBox->GetBox()->GetTabLines().C40_GETPOS( SwTableLine, pLine ); + aCpyPara.nInsPos = pFndBox->GetBox()->GetTabLines().GetPos( pLine ); } if( bBehind ) @@ -679,15 +680,16 @@ sal_Bool SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, return sal_True; } -sal_Bool _FndBoxAppendRowLine( const SwTableLine*& rpLine, void* pPara ); +void _FndBoxAppendRowLine( SwTableLine* pLine, _FndPara* pFndPara ); static void _FndBoxAppendRowBox( SwTableBox* pBox, _FndPara* pFndPara ) { _FndBox* pFndBox = new _FndBox( pBox, pFndPara->pFndLine ); - if( pBox->GetTabLines().Count() ) + if( pBox->GetTabLines().size() ) { _FndPara aPara( *pFndPara, pFndBox ); - pFndBox->GetBox()->GetTabLines().ForEach( &_FndBoxAppendRowLine, &aPara ); + BOOST_FOREACH( SwTableLine* pLine, pFndBox->GetBox()->GetTabLines() ) + _FndBoxAppendRowLine( pLine, &aPara ); if( pFndBox->GetLines().empty() ) delete pFndBox; } @@ -695,10 +697,9 @@ static void _FndBoxAppendRowBox( SwTableBox* pBox, _FndPara* pFndPara ) pFndPara->pFndLine->GetBoxes().push_back( pFndBox ); } -sal_Bool _FndBoxAppendRowLine( const SwTableLine*& rpLine, void* pPara ) +void _FndBoxAppendRowLine( SwTableLine* pLine, _FndPara* pFndPara ) { - _FndPara* pFndPara = (_FndPara*)pPara; - _FndLine* pFndLine = new _FndLine( (SwTableLine*)rpLine, pFndPara->pFndBox ); + _FndLine* pFndLine = new _FndLine( pLine, pFndPara->pFndBox ); _FndPara aPara( *pFndPara, pFndLine ); for( SwTableBoxes::iterator it = pFndLine->GetLine()->GetTabBoxes().begin(); it != pFndLine->GetLine()->GetTabBoxes().end(); ++it) @@ -709,7 +710,6 @@ sal_Bool _FndBoxAppendRowLine( const SwTableLine*& rpLine, void* pPara ) } else delete pFndLine; - return sal_True; } sal_Bool SwTable::AppendRow( SwDoc* pDoc, sal_uInt16 nCnt ) @@ -721,12 +721,12 @@ sal_Bool SwTable::AppendRow( SwDoc* pDoc, sal_uInt16 nCnt ) // Find all Boxes/Lines _FndBox aFndBox( 0, 0 ); { - const SwTableLine* pLLine = GetTabLines()[ GetTabLines().Count()-1 ]; + const SwTableLine* pLLine = GetTabLines().back(); const SwSelBoxes* pBxs = 0; // Dummy!!! _FndPara aPara( *pBxs, &aFndBox ); - _FndBoxAppendRowLine( pLLine, &aPara ); + _FndBoxAppendRowLine( (SwTableLine*)pLLine, &aPara ); } if( aFndBox.GetLines().empty() ) return sal_False; @@ -744,7 +744,7 @@ sal_Bool SwTable::AppendRow( SwDoc* pDoc, sal_uInt16 nCnt ) _CpyTabFrms aTabFrmArr; _CpyPara aCpyPara( pTblNd, 0, aTabFrmArr ); - aCpyPara.nInsPos = GetTabLines().Count(); + aCpyPara.nInsPos = GetTabLines().size(); aCpyPara.nDelBorderFlag = 1; for( sal_uInt16 nCpyCnt = 0; nCpyCnt < nCnt; ++nCpyCnt ) @@ -778,7 +778,7 @@ void lcl_LastBoxSetWidth( SwTableBoxes &rBoxes, const long nOffset, void lcl_LastBoxSetWidthLine( SwTableLines &rLines, const long nOffset, sal_Bool bFirst, SwShareBoxFmts& rShareFmts ) { - for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.size(); ++i ) ::lcl_LastBoxSetWidth( rLines[i]->GetTabBoxes(), nOffset, bFirst, rShareFmts ); } @@ -927,20 +927,22 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, if( !pUpperBox ) { // Also delete the Line from the Table - nDelPos = rTbl.GetTabLines().C40_GETPOS( SwTableLine, pLine ); + nDelPos = rTbl.GetTabLines().GetPos( pLine ); if( pShareFmts ) pShareFmts->RemoveFormat( *rTbl.GetTabLines()[ nDelPos ]->GetFrmFmt() ); - rTbl.GetTabLines().DeleteAndDestroy( nDelPos ); + delete rTbl.GetTabLines()[ nDelPos ]; + rTbl.GetTabLines().erase( rTbl.GetTabLines().begin() + nDelPos ); break; // we cannot delete more } // finally also delete the Line pBox = pUpperBox; - nDelPos = pBox->GetTabLines().C40_GETPOS( SwTableLine, pLine ); + nDelPos = pBox->GetTabLines().GetPos( pLine ); if( pShareFmts ) pShareFmts->RemoveFormat( *pBox->GetTabLines()[ nDelPos ]->GetFrmFmt() ); - pBox->GetTabLines().DeleteAndDestroy( nDelPos ); - } while( !pBox->GetTabLines().Count() ); + delete pBox->GetTabLines()[ nDelPos ]; + pBox->GetTabLines().erase( pBox->GetTabLines().begin() + nDelPos ); + } while( pBox->GetTabLines().empty() ); } SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns, @@ -972,9 +974,9 @@ SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns, { const SwTableLines& rLowLns = pFndBox->GetTabLines(); if( bNxt ) - pFndBox = rLowLns[ 0 ]->GetTabBoxes()[ 0 ]; + pFndBox = rLowLns.front()->GetTabBoxes().front(); else - pFndBox = rLowLns[ rLowLns.Count() - 1 ]->GetTabBoxes()[ 0 ]; + pFndBox = rLowLns.back()->GetTabBoxes().front(); } if( Abs( nFndWidth ) > COLFUZZY || @@ -994,7 +996,7 @@ SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns, --*pCurPos; pAllDelBoxes->Remove( nFndPos ); } - } while( bNxt ? ( nLinePos + 1 < rTblLns.Count() ) : nLinePos ); + } while( bNxt ? ( nLinePos + 1 < (sal_uInt16)rTblLns.size() ) : nLinePos ); return pFndBox; } @@ -1036,7 +1038,7 @@ void lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox, pPrvBox = ::lcl_FndNxtPrvDelBox( *pTblLns, nBoxStt, nBoxWidth, nLnPos, sal_False, pAllDelBoxes, pCurPos ); - if( nLnPos + 1 < pTblLns->Count() ) // Successor? + if( nLnPos + 1 < (sal_uInt16)pTblLns->size() ) // Successor? pNxtBox = ::lcl_FndNxtPrvDelBox( *pTblLns, nBoxStt, nBoxWidth, nLnPos, sal_True, pAllDelBoxes, pCurPos ); @@ -1235,7 +1237,7 @@ sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 pNewLine->ClaimFrmFmt()->SetFmtAttr( aFSz ); } - pNewBox->GetTabLines().C40_INSERT( SwTableLine, pNewLine, i ); + pNewBox->GetTabLines().insert( pNewBox->GetTabLines().begin() + i, pNewLine ); // then a new Box in the Line if( !i ) // hang up the original Box { @@ -1420,9 +1422,10 @@ void lcl_CpyLines( sal_uInt16 nStt, sal_uInt16 nEnd, for( sal_uInt16 n = nStt; n < nEnd; ++n ) rLines[n]->SetUpper( pInsBox ); if( USHRT_MAX == nPos ) - nPos = pInsBox->GetTabLines().Count(); - pInsBox->GetTabLines().Insert( &rLines, nPos, nStt, nEnd ); - rLines.Remove( nStt, nEnd - nStt ); + nPos = pInsBox->GetTabLines().size(); + pInsBox->GetTabLines().insert( pInsBox->GetTabLines().begin() + nPos, + rLines.begin() + nStt, rLines.begin() + nEnd ); + rLines.erase( rLines.begin() + nStt, rLines.begin() + nEnd ); } void lcl_CpyBoxes( sal_uInt16 nStt, sal_uInt16 nEnd, @@ -1443,7 +1446,7 @@ void lcl_CalcWidth( SwTableBox* pBox ) { // Assertion: Every Line in the Box is as large SwFrmFmt* pFmt = pBox->ClaimFrmFmt(); - OSL_ENSURE( pBox->GetTabLines().Count(), "Box does not have any Lines" ); + OSL_ENSURE( pBox->GetTabLines().size(), "Box does not have any Lines" ); SwTableLine* pLine = pBox->GetTabLines()[0]; OSL_ENSURE( pLine, "Box is not within a Line" ); @@ -1527,7 +1530,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().Count()) + if (rFndBox.GetBox()->GetTabLines().size()) { SwTableBox* pBox = new SwTableBox( static_cast<SwTableBoxFmt*>(rFndBox.GetBox()->GetFrmFmt()), @@ -1539,7 +1542,7 @@ static void lcl_Merge_MoveBox(_FndBox & rFndBox, _InsULPara *const pULPara) { lcl_Merge_MoveLine(*it, &aPara ); } - if( pBox->GetTabLines().Count() ) + if( pBox->GetTabLines().size() ) { if( USHRT_MAX == nInsPos ) nInsPos = pBoxes->size(); @@ -1575,15 +1578,15 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) if( pULPara->bUL ) // Upper ? { // If there are Lines before it, move them - if( 0 != ( nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) ) + if( 0 != ( nPos = pLines->GetPos( pFndLn )) ) lcl_CpyLines( 0, nPos, *pLines, pULPara->pInsBox ); } else // If there are Lines after it, move them - if( (nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) +1 < pLines->Count() ) + if( (nPos = pLines->GetPos( pFndLn )) + 1 < (sal_uInt16)pLines->size() ) { - nInsPos = pULPara->pInsBox->GetTabLines().Count(); - lcl_CpyLines( nPos+1, pLines->Count(), *pLines, + nInsPos = pULPara->pInsBox->GetTabLines().size(); + lcl_CpyLines( nPos+1, pLines->size(), *pLines, pULPara->pInsBox ); } } @@ -1600,7 +1603,7 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) (SwTableLineFmt*)pInsLine->GetFrmFmt(), 2, pLMBox ); pLMLn->ClaimFrmFmt()->ResetFmtAttr( RES_FRM_SIZE ); - pLMBox->GetTabLines().C40_INSERT( SwTableLine, pLMLn, 0 ); + pLMBox->GetTabLines().insert( pLMBox->GetTabLines().begin(), pLMLn ); lcl_CpyBoxes( 0, 2, pInsLine->GetTabBoxes(), pLMLn ); @@ -1609,13 +1612,13 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) if( pULPara->bUL ) // Upper ? { // If there are Lines before it, move them - if( 0 != ( nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) ) + if( 0 != ( nPos = pLines->GetPos( pFndLn )) ) lcl_CpyLines( 0, nPos, *pLines, pLMBox, 0 ); } else // If there are Lines after it, move them - if( (nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) +1 < pLines->Count() ) - lcl_CpyLines( nPos+1, pLines->Count(), *pLines, + if( (nPos = pLines->GetPos( pFndLn )) + 1 < (sal_uInt16)pLines->size() ) + lcl_CpyLines( nPos+1, pLines->size(), *pLines, pLMBox ); lcl_CalcWidth( pLMBox ); // calculate the Box's width } @@ -1634,7 +1637,7 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) SwTableLine* pRMLn = new SwTableLine( (SwTableLineFmt*)pInsLine->GetFrmFmt(), 2, pRMBox ); pRMLn->ClaimFrmFmt()->ResetFmtAttr( RES_FRM_SIZE ); - pRMBox->GetTabLines().C40_INSERT( SwTableLine, pRMLn, 0 ); + pRMBox->GetTabLines().insert( pRMBox->GetTabLines().begin(), pRMLn ); lcl_CpyBoxes( 1, 3, pInsLine->GetTabBoxes(), pRMLn ); @@ -1652,16 +1655,17 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) pRMBox = pInsLine->GetUpper(); // If there are already Lines, then these need to go into a new Line and Box - nMvPos = pRMBox->GetTabLines().C40_GETPOS( SwTableLine, pInsLine ); + nMvPos = pRMBox->GetTabLines().GetPos( pInsLine ); if( pULPara->bUL ? nMvPos - : nMvPos+1 < pRMBox->GetTabLines().Count() ) + : nMvPos+1 < (sal_uInt16)pRMBox->GetTabLines().size() ) { // Merge all Lines into a new Line and Box SwTableLine* pNewLn = new SwTableLine( (SwTableLineFmt*)pInsLine->GetFrmFmt(), 1, pRMBox ); pNewLn->ClaimFrmFmt()->ResetFmtAttr( RES_FRM_SIZE ); - pRMBox->GetTabLines().C40_INSERT( SwTableLine, pNewLn, - pULPara->bUL ? nMvPos : nMvPos+1 ); + pRMBox->GetTabLines().insert( + pRMBox->GetTabLines().begin() + (pULPara->bUL ? nMvPos : nMvPos+1), + pNewLn ); pRMBox = new SwTableBox( (SwTableBoxFmt*)pRMBox->GetFrmFmt(), 0, pNewLn ); pNewLn->GetTabBoxes().insert( pNewLn->GetTabBoxes().begin(), pRMBox ); @@ -1671,7 +1675,7 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) nPos2 = nMvPos; else nPos1 = nMvPos+2, - nPos2 = pNewLn->GetUpper()->GetTabLines().Count(); + nPos2 = pNewLn->GetUpper()->GetTabLines().size(); lcl_CpyLines( nPos1, nPos2, pNewLn->GetUpper()->GetTabLines(), pRMBox ); @@ -1684,13 +1688,13 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) if( pULPara->bUL ) // Upper ? { // If there are Lines before it, move them - if( 0 != ( nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) ) + if( 0 != ( nPos = pLines->GetPos( pFndLn )) ) lcl_CpyLines( 0, nPos, *pLines, pRMBox, 0 ); } else // If there are Lines after it, move them - if( (nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) +1 < pLines->Count() ) - lcl_CpyLines( nPos+1, pLines->Count(), *pLines, + if( (nPos = pLines->GetPos( pFndLn )) + 1 < (sal_uInt16)pLines->size() ) + lcl_CpyLines( nPos+1, pLines->size(), *pLines, pRMBox ); lcl_CalcWidth( pRMBox ); // calculate the Box's width } @@ -1721,14 +1725,14 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) if( !pNewLine->GetTabBoxes().empty() ) { if( USHRT_MAX == nInsPos ) - nInsPos = pLines->Count(); - pLines->C40_INSERT( SwTableLine, pNewLine, nInsPos ); + nInsPos = pLines->size(); + pLines->insert( pLines->begin() + nInsPos, pNewLine ); } else delete pNewLine; } -static sal_Bool lcl_BoxSetHeadCondColl( SwTableBox* pBox ); +static void lcl_BoxSetHeadCondColl( const SwTableBox* pBox ); sal_Bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, SwTableBox* pMergeBox, SwUndoTblMerge* pUndo ) @@ -1742,7 +1746,7 @@ sal_Bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, _FndBox aFndBox( 0, 0 ); { _FndPara aPara( rBoxes, &aFndBox ); - GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( GetTabLines(), &aPara ); } if( aFndBox.GetLines().empty() ) return sal_False; @@ -1778,8 +1782,8 @@ sal_Bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, &pFndBox->GetBox()->GetTabLines() : &GetTabLines(); SwTableLine* pNewLine = pFndBox->GetLines().front().GetLine(); - sal_uInt16 nInsPos = pLines->C40_GETPOS( SwTableLine, pNewLine ); - pLines->C40_INSERT( SwTableLine, pInsLine, nInsPos ); + sal_uInt16 nInsPos = pLines->GetPos( pNewLine ); + pLines->insert( pLines->begin() + nInsPos, pInsLine ); SwTableBox* pLeftBox = new SwTableBox( (SwTableBoxFmt*)pMergeBox->GetFrmFmt(), 0, pInsLine ); SwTableBox* pRightBox = new SwTableBox( (SwTableBoxFmt*)pMergeBox->GetFrmFmt(), 0, pInsLine ); @@ -1817,7 +1821,7 @@ sal_Bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, BOOST_FOREACH(_FndLine& rFndLine, pFndBox->GetLines() ) lcl_Merge_MoveLine( rFndLine, &aPara ); - if( !pLeftBox->GetTabLines().Count() ) + if( pLeftBox->GetTabLines().empty() ) _DeleteBox( *this, pLeftBox, 0, sal_False, sal_False ); else { @@ -1825,7 +1829,7 @@ sal_Bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, if( pUndo && pLeftBox->GetSttNd() ) pUndo->AddNewBox( pLeftBox->GetSttIdx() ); } - if( !pRightBox->GetTabLines().Count() ) + if( pRightBox->GetTabLines().empty() ) _DeleteBox( *this, pRightBox, 0, sal_False, sal_False ); else { @@ -1853,7 +1857,7 @@ sal_Bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, void lcl_CheckRowSpan( SwTable &rTbl ) { - sal_uInt16 nLineCount = rTbl.GetTabLines().Count(); + sal_uInt16 nLineCount = rTbl.GetTabLines().size(); sal_uInt16 nMaxSpan = nLineCount; long nMinSpan = 1; while( nMaxSpan ) @@ -2134,12 +2138,13 @@ lcl_CopyLineToDoc(const _FndLine& rFndLine, _CpyPara *const pCpyPara) rFndLine.GetBoxes().size(), pCpyPara->pInsBox ); if( pCpyPara->pInsBox ) { - pCpyPara->pInsBox->GetTabLines().C40_INSERT( SwTableLine, pNewLine, pCpyPara->nInsPos++ ); + SwTableLines& rLines = pCpyPara->pInsBox->GetTabLines(); + rLines.insert( rLines.begin() + pCpyPara->nInsPos++, pNewLine ); } else { - pCpyPara->pTblNd->GetTable().GetTabLines().C40_INSERT( SwTableLine, pNewLine, - pCpyPara->nInsPos++ ); + SwTableLines& rLines = pCpyPara->pTblNd->GetTable().GetTabLines(); + rLines.insert( rLines.begin() + pCpyPara->nInsPos++, pNewLine); } _CpyPara aPara( *pCpyPara, pNewLine ); @@ -2187,7 +2192,7 @@ sal_Bool SwTable::CopyHeadlineIntoTable( SwTableNode& rTblNd ) _FndBox aFndBox( 0, 0 ); { _FndPara aPara( aSelBoxes, &aFndBox ); - ((SwTableLines&)GetTabLines()).ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( GetTabLines(), &aPara ); } if( aFndBox.GetLines().empty() ) return sal_False; @@ -2231,7 +2236,7 @@ sal_Bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, _FndBox aFndBox( 0, 0 ); { _FndPara aPara( rSelBoxes, &aFndBox ); - ((SwTableLines&)GetTabLines()).ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( (SwTableLines&)GetTabLines(), &aPara ); } if( aFndBox.GetLines().empty() ) return sal_False; @@ -2333,7 +2338,7 @@ sal_Bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, pLn = pFndLn->GetLine(); pTmp = pLn; nLnPos = GetTabLines().GetPos( pTmp ); - if( nLnPos < GetTabLines().Count() - 1 ) + if( nLnPos < GetTabLines().size() - 1 ) { // There is a Line following it SwCollectTblLineBoxes aLnPara( sal_True, HEADLINE_BORDERCOPY ); @@ -2347,7 +2352,7 @@ sal_Bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, lcl_GetLineWidth( *pFndLn )) ) { aLnPara.SetValues( sal_False ); - pLn = pNewTbl->GetTabLines()[ pNewTbl->GetTabLines().Count()-1 ]; + pLn = pNewTbl->GetTabLines().back(); for( SwTableBoxes::iterator it = pLn->GetTabBoxes().begin(); it != pLn->GetTabBoxes().end(); ++it) lcl_BoxSetSplitBoxFmts(*it, &aLnPara ); @@ -2356,8 +2361,7 @@ sal_Bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, } // We need to delete the initial Box - _DeleteBox( *pNewTbl, pNewTbl->GetTabLines()[ - pNewTbl->GetTabLines().Count() - 1 ]->GetTabBoxes()[0], + _DeleteBox( *pNewTbl, pNewTbl->GetTabLines().back()->GetTabBoxes()[0], 0, sal_False, sal_False ); if( pNewTbl->IsNewModel() ) @@ -2384,8 +2388,8 @@ SwTableBox* SwTableLine::FindNextBox( const SwTable& rTbl, nFndPos + 1 != (sal_uInt16)GetTabBoxes().size() ) { pBox = GetTabBoxes()[ nFndPos + 1 ]; - while( pBox->GetTabLines().Count() ) - pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0]; + while( !pBox->GetTabLines().empty() ) + pBox = pBox->GetTabLines().front()->GetTabBoxes()[0]; return pBox; } @@ -2394,7 +2398,7 @@ SwTableBox* SwTableLine::FindNextBox( const SwTable& rTbl, nFndPos = GetUpper()->GetTabLines().GetPos( pLine ); OSL_ENSURE( USHRT_MAX != nFndPos, "Line is not in the Table" ); // Is there another Line? - if( nFndPos+1 >= GetUpper()->GetTabLines().Count() ) + if( nFndPos+1 >= (sal_uInt16)GetUpper()->GetTabLines().size() ) return GetUpper()->GetUpper()->FindNextBox( rTbl, GetUpper(), bOvrTblLns ); pLine = GetUpper()->GetTabLines()[nFndPos+1]; } @@ -2402,7 +2406,7 @@ SwTableBox* SwTableLine::FindNextBox( const SwTable& rTbl, { // Search for the next Line in the Table nFndPos = rTbl.GetTabLines().GetPos( pLine ); - if( nFndPos + 1 >= rTbl.GetTabLines().Count() ) + if( nFndPos + 1 >= (sal_uInt16)rTbl.GetTabLines().size() ) return 0; // there are no more Boxes pLine = rTbl.GetTabLines()[ nFndPos+1 ]; @@ -2413,8 +2417,8 @@ SwTableBox* SwTableLine::FindNextBox( const SwTable& rTbl, if( !pLine->GetTabBoxes().empty() ) { pBox = pLine->GetTabBoxes().front(); - while( pBox->GetTabLines().Count() ) - pBox = pBox->GetTabLines()[0]->GetTabBoxes().front(); + while( !pBox->GetTabLines().empty() ) + pBox = pBox->GetTabLines().front()->GetTabBoxes().front(); return pBox; } return pLine->FindNextBox( rTbl, 0, bOvrTblLns ); @@ -2432,9 +2436,9 @@ SwTableBox* SwTableLine::FindPreviousBox( const SwTable& rTbl, nFndPos ) { pBox = GetTabBoxes()[ nFndPos - 1 ]; - while( pBox->GetTabLines().Count() ) + while( !pBox->GetTabLines().empty() ) { - pLine = pBox->GetTabLines()[pBox->GetTabLines().Count()-1]; + pLine = pBox->GetTabLines().back(); pBox = pLine->GetTabBoxes().back(); } return pBox; @@ -2464,9 +2468,9 @@ SwTableBox* SwTableLine::FindPreviousBox( const SwTable& rTbl, if( !pLine->GetTabBoxes().empty() ) { pBox = pLine->GetTabBoxes().back(); - while( pBox->GetTabLines().Count() ) + while( !pBox->GetTabLines().empty() ) { - pLine = pBox->GetTabLines()[pBox->GetTabLines().Count()-1]; + pLine = pBox->GetTabLines().back(); pBox = pLine->GetTabBoxes().back(); } return pBox; @@ -2478,7 +2482,7 @@ SwTableBox* SwTableLine::FindPreviousBox( const SwTable& rTbl, SwTableBox* SwTableBox::FindNextBox( const SwTable& rTbl, const SwTableBox* pSrchBox, sal_Bool bOvrTblLns ) const { - if( !pSrchBox && !GetTabLines().Count() ) + if( !pSrchBox && GetTabLines().empty() ) return (SwTableBox*)this; return GetUpper()->FindNextBox( rTbl, pSrchBox ? pSrchBox : this, bOvrTblLns ); @@ -2489,29 +2493,27 @@ SwTableBox* SwTableBox::FindNextBox( const SwTable& rTbl, SwTableBox* SwTableBox::FindPreviousBox( const SwTable& rTbl, const SwTableBox* pSrchBox, sal_Bool bOvrTblLns ) const { - if( !pSrchBox && !GetTabLines().Count() ) + if( !pSrchBox && GetTabLines().empty() ) return (SwTableBox*)this; return GetUpper()->FindPreviousBox( rTbl, pSrchBox ? pSrchBox : this, bOvrTblLns ); } -static sal_Bool lcl_BoxSetHeadCondColl( SwTableBox* pBox ) +static void lcl_BoxSetHeadCondColl( const SwTableBox* pBox ) { // We need to adapt the paragraphs with conditional templates in the HeadLine const SwStartNode* pSttNd = pBox->GetSttNd(); if( pSttNd ) pSttNd->CheckSectionCondColl(); else - pBox->GetTabLines().ForEach( &lcl_LineSetHeadCondColl, 0 ); - return sal_True; + BOOST_FOREACH( const SwTableLine* pLine, pBox->GetTabLines() ) + lcl_LineSetHeadCondColl( pLine ); } -sal_Bool lcl_LineSetHeadCondColl( const SwTableLine*& rpLine, void* ) +void lcl_LineSetHeadCondColl( const SwTableLine* pLine ) { - for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); - it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) - lcl_BoxSetHeadCondColl(*it); - return sal_True; + BOOST_FOREACH( const SwTableBox* pBox, pLine->GetTabBoxes() ) + lcl_BoxSetHeadCondColl(pBox); } SwTwips lcl_GetDistance( SwTableBox* pBox, sal_Bool bLeft ) @@ -2549,7 +2551,7 @@ sal_Bool lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( bCheck ) { - for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().size(); ++i ) if( !::lcl_SetSelBoxWidth( pBox->GetTabLines()[ i ], rParam, nDist, sal_True )) return sal_False; @@ -2578,7 +2580,7 @@ sal_Bool lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, else { SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff; - for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().size(); ++i ) { rParam.nLowerDiff = 0; lcl_SetSelBoxWidth( pBox->GetTabLines()[ i ], rParam, nDist, sal_False ); @@ -2649,7 +2651,7 @@ sal_Bool lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( bCheck ) { - for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().size(); ++i ) if( !::lcl_SetOtherBoxWidth( pBox->GetTabLines()[ i ], rParam, nDist, sal_True )) return sal_False; @@ -2678,7 +2680,7 @@ sal_Bool lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, else { SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff; - for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().size(); ++i ) { rParam.nLowerDiff = 0; lcl_SetOtherBoxWidth( pBox->GetTabLines()[ i ], rParam, @@ -2744,7 +2746,7 @@ sal_Bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( bCheck ) { - for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().size(); ++i ) if( !::lcl_InsSelBox( pBox->GetTabLines()[ i ], rParam, nDist, sal_True )) return sal_False; @@ -2778,7 +2780,7 @@ sal_Bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, else { SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff; - for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().size(); ++i ) { rParam.nLowerDiff = 0; lcl_InsSelBox( pBox->GetTabLines()[ i ], rParam, nDist, sal_False ); @@ -2902,7 +2904,7 @@ sal_Bool lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( bCheck ) { - for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().size(); ++i ) if( !::lcl_InsOtherBox( pBox->GetTabLines()[ i ], rParam, nDist, sal_True )) return sal_False; @@ -2960,7 +2962,7 @@ sal_Bool lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, else { SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff; - for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().size(); ++i ) { rParam.nLowerDiff = 0; lcl_InsOtherBox( pBox->GetTabLines()[ i ], rParam, @@ -3084,7 +3086,7 @@ void lcl_DelSelBox_CorrLowers( SwTableLine& rLine, CR_SetBoxWidth& rParam, if( !pBox->GetSttNd() ) { // Has Lower itself, so also adjust that - for( sal_uInt16 i = pBox->GetTabLines().Count(); i; ) + for( sal_uInt16 i = pBox->GetTabLines().size(); i; ) ::lcl_DelSelBox_CorrLowers( *pBox->GetTabLines()[ --i ], rParam, nDiff ); } @@ -3145,7 +3147,7 @@ void lcl_ChgBoxSize( SwTableBox& rBox, CR_SetBoxWidth& rParam, rParam.aShareFmts.SetSize( rBox, aNew ); // Change the Lower once again - for( sal_uInt16 i = rBox.GetTabLines().Count(); i; ) + for( sal_uInt16 i = rBox.GetTabLines().size(); i; ) ::lcl_DelSelBox_CorrLowers( *rBox.GetTabLines()[ --i ], rParam, aNew.GetWidth() ); } @@ -3175,7 +3177,7 @@ sal_Bool lcl_DeleteBox_Rekursiv( CR_SetBoxWidth& rParam, SwTableBox& rBox, else { // We need to delete these sequentially via the ContentBoxes - for( sal_uInt16 i = rBox.GetTabLines().Count(); i; ) + for( sal_uInt16 i = rBox.GetTabLines().size(); i; ) { SwTableLine& rLine = *rBox.GetTabLines()[ --i ]; for( sal_uInt16 n = rLine.GetTabBoxes().size(); n; ) @@ -3330,7 +3332,7 @@ sal_Bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, sal_uInt16 nOldRemain = rParam.nRemainWidth; sal_uInt16 i; - for( i = pBox->GetTabLines().Count(); i; ) + for( i = pBox->GetTabLines().size(); i; ) { rParam.nLowerDiff = nDelWidth + nOldLower; rParam.nRemainWidth = nOldRemain; @@ -3341,7 +3343,7 @@ sal_Bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, // Do the Box and its Lines still exist? if( n < rBoxes.size() && pBox == rBoxes[ rParam.bLeft ? n : n-1 ] && - i < pBox->GetTabLines().Count() && + i < pBox->GetTabLines().size() && pLine == pBox->GetTabLines()[ i ] ) { if( !bFirst && !bCorrLowers && @@ -3439,7 +3441,7 @@ sal_Bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, if( bCorrLowers ) { // Adapt the Lower once again - for( i = pBox->GetTabLines().Count(); i; ) + for( i = pBox->GetTabLines().size(); i; ) ::lcl_DelSelBox_CorrLowers( *pBox-> GetTabLines()[ --i ], rParam, aNew.GetWidth() ); } @@ -3476,7 +3478,7 @@ void lcl_AjustLines( SwTableLine* pLine, CR_SetBoxWidth& rParam ) aSz.SetWidth( nWidth ); rParam.aShareFmts.SetSize( *pBox, aSz ); - for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().size(); ++i ) ::lcl_AjustLines( pBox->GetTabLines()[ i ], rParam ); } } @@ -3494,7 +3496,7 @@ void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize ) const SwTwips nBoxW = pBox->GetFrmFmt()->GetFrmSize().GetWidth(); nAktSize += nBoxW; - for( sal_uInt16 j = 0; j < pBox->GetTabLines().Count(); ++j ) + for( sal_uInt16 j = 0; j < pBox->GetTabLines().size(); ++j ) _CheckBoxWidth( *pBox->GetTabLines()[ j ], nBoxW ); } @@ -3516,10 +3518,10 @@ _FndBox* lcl_SaveInsDelData( CR_SetBoxWidth& rParam, SwUndo** ppUndo, { // Get the Boxes if( rParam.bBigger ) - for( sal_uInt16 n = 0; n < rTbl.GetTabLines().Count(); ++n ) + for( sal_uInt16 n = 0; n < rTbl.GetTabLines().size(); ++n ) ::lcl_DelSelBox( rTbl.GetTabLines()[ n ], rParam, nDistStt, sal_True ); else - for( sal_uInt16 n = 0; n < rTbl.GetTabLines().Count(); ++n ) + for( sal_uInt16 n = 0; n < rTbl.GetTabLines().size(); ++n ) ::lcl_InsSelBox( rTbl.GetTabLines()[ n ], rParam, nDistStt, sal_True ); } @@ -3533,7 +3535,7 @@ _FndBox* lcl_SaveInsDelData( CR_SetBoxWidth& rParam, SwUndo** ppUndo, else { _FndPara aPara( rParam.aBoxes, pFndBox ); - rTbl.GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( rTbl.GetTabLines(), &aPara ); OSL_ENSURE( pFndBox->GetLines().size(), "Where are the Boxes" ); pFndBox->SetTableLines( rTbl ); @@ -3649,7 +3651,7 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, else { bRet = sal_True; - for( n = 0; n < aLines.Count(); ++n ) + for( n = 0; n < aLines.size(); ++n ) { aParam.LoopClear(); if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_True )) @@ -3694,7 +3696,7 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, // Break down to USHRT_MAX / 2 CR_SetBoxWidth aTmpPara( 0, aSz.GetWidth() / 2, 0, aSz.GetWidth(), aSz.GetWidth(), aParam.pTblNd ); - for( sal_uInt16 nLn = 0; nLn < aLines.Count(); ++nLn ) + for( sal_uInt16 nLn = 0; nLn < aLines.size(); ++nLn ) ::lcl_AjustLines( aLines[ nLn ], aTmpPara ); aSz.SetWidth( aSz.GetWidth() / 2 ); aParam.nDiff = nRelDiff /= 2; @@ -3756,7 +3758,7 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, UnlockModify(); - for( n = aLines.Count(); n; ) + for( n = aLines.size(); n; ) { --n; aParam.LoopClear(); @@ -3786,7 +3788,7 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, { if( aParam.bBigger ) { - for( n = 0; n < aLines.Count(); ++n ) + for( n = 0; n < aLines.size(); ++n ) { aParam.LoopClear(); if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_True )) @@ -3801,7 +3803,7 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, if( 0 != ( bRet = bLeft ? nDist != 0 : ( rSz.GetWidth() - nDist ) > COLFUZZY ) ) { - for( n = 0; n < aLines.Count(); ++n ) + for( n = 0; n < aLines.size(); ++n ) { aParam.LoopClear(); if( !(*fnOtherBox)( aLines[ n ], aParam, 0, sal_True )) @@ -3823,7 +3825,7 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, // We also need to test this! bRet = sal_True; - for( n = 0; n < aLines.Count(); ++n ) + for( n = 0; n < aLines.size(); ++n ) { aParam.LoopClear(); if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_True )) @@ -3837,7 +3839,7 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, } else if( aParam.bBigger ) { - for( n = 0; n < aLines.Count(); ++n ) + for( n = 0; n < aLines.size(); ++n ) { aParam.LoopClear(); if( !(*fnOtherBox)( aLines[ n ], aParam, 0, sal_True )) @@ -3849,7 +3851,7 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, } else { - for( n = 0; n < aLines.Count(); ++n ) + for( n = 0; n < aLines.size(); ++n ) { aParam.LoopClear(); if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_True )) @@ -3881,7 +3883,7 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, ? ( TBLFIX_CHGABS == eTblChgMode ? bLeft : bLeft ) : ( TBLFIX_CHGABS != eTblChgMode && bLeft ) ) { - for( n = aLines.Count(); n; ) + for( n = aLines.size(); n; ) { --n; aParam.LoopClear(); @@ -3891,7 +3893,7 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, } } else - for( n = aLines.Count(); n; ) + for( n = aLines.size(); n; ) { --n; aParam.LoopClear(); @@ -4059,7 +4061,7 @@ _FndBox* lcl_SaveInsDelData( CR_SetLineHeight& rParam, SwUndo** ppUndo, else { _FndPara aPara( rParam.aBoxes, pFndBox ); - rTbl.GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( rTbl.GetTabLines(), &aPara ); OSL_ENSURE( pFndBox->GetLines().size(), "Where are the Boxes?" ); pFndBox->SetTableLines( rTbl ); @@ -4107,7 +4109,7 @@ void SetLineHeight( SwTableLine& rLine, SwTwips nOldHeight, SwTwips nNewHeight, for( sal_uInt16 n = 0; n < rBoxes.size(); ++n ) { SwTableBox& rBox = *rBoxes[ n ]; - for( sal_uInt16 i = 0; i < rBox.GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < rBox.GetTabLines().size(); ++i ) SetLineHeight( *rBox.GetTabLines()[ i ], nMyOldH, nMyNewH, bMinSize ); } } @@ -4215,10 +4217,10 @@ sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, pLines = &pLine->GetUpper()->GetTabLines(); else pLines = &rParam.pTblNd->GetTable().GetTabLines(); - sal_uInt16 nPos = pLines->C40_GETPOS( SwTableLine, pLine ); + sal_uInt16 nPos = pLines->GetPos( pLine ); if( !rParam.bTop ) ++nPos; - pLines->C40_INSERT( SwTableLine, pNewLine, nPos ); + pLines->insert( pLines->begin() + nPos, pNewLine ); SwFrmFmt* pNewFmt = pNewLine->ClaimFrmFmt(); pNewFmt->SetFmtAttr( SwFmtFrmSize( ATT_MIN_SIZE, 0, nDist ) ); @@ -4271,7 +4273,7 @@ sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, rParam.aBoxes.Insert( pBox ); else { - for( sal_uInt16 i = pBox->GetTabLines().Count(); i; ) + for( sal_uInt16 i = pBox->GetTabLines().size(); i; ) lcl_InsDelSelLine( pBox->GetTabLines()[ --i ], rParam, 0, sal_True ); } @@ -4296,7 +4298,7 @@ sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType, bTop = nsTblChgWidthHeightType::WH_ROW_TOP == ( eType & 0xff ) || nsTblChgWidthHeightType::WH_CELL_TOP == ( eType & 0xff ), bInsDel = 0 != (eType & nsTblChgWidthHeightType::WH_FLAG_INSDEL ); - sal_uInt16 n, nBaseLinePos = GetTabLines().C40_GETPOS( SwTableLine, pBaseLine ); + sal_uInt16 n, nBaseLinePos = GetTabLines().GetPos( pBaseLine ); sal_uLong nBoxIdx = rAktBox.GetSttIdx(); CR_SetLineHeight aParam( eType, @@ -4321,7 +4323,7 @@ sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType, // Is a nested Line (Box!) pLines = &pLine->GetUpper()->GetTabLines(); - nBaseLinePos = pLines->C40_GETPOS( SwTableLine, pLine ); + nBaseLinePos = pLines->GetPos( pLine ); pBaseLine = pLine; // no break! @@ -4395,7 +4397,7 @@ sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType, if( bTop ) nStt = 0, nEnd = nBaseLinePos; else - nStt = nBaseLinePos + 1, nEnd = pLines->Count(); + nStt = nBaseLinePos + 1, nEnd = pLines->size(); // Get the current Lines' height if( TBLFIX_CHGPROP == eTblChgMode ) diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index c94534c1fecc..e768ec55562f 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -55,6 +55,7 @@ #include <SwNodeNum.hxx> #include <set> #include <vector> +#include <boost/foreach.hpp> #ifdef DBG_UTIL #define CHECK_TABLE(t) (t).CheckConsistency(); @@ -324,7 +325,7 @@ struct _CopyTable {} }; -sal_Bool lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara ); +static void lcl_CopyTblLine( const SwTableLine* pLine, _CopyTable* pCT ); static void lcl_CopyTblBox( SwTableBox* pBox, _CopyTable* pCT ) { @@ -360,7 +361,7 @@ static void lcl_CopyTblBox( SwTableBox* pBox, _CopyTable* pCT ) pCT->rMapArr.Count() ); } - sal_uInt16 nLines = pBox->GetTabLines().Count(); + sal_uInt16 nLines = pBox->GetTabLines().size(); SwTableBox* pNewBox; if( nLines ) pNewBox = new SwTableBox( pBoxFmt, nLines, pCT->pInsLine ); @@ -379,43 +380,40 @@ static void lcl_CopyTblBox( SwTableBox* pBox, _CopyTable* pCT ) { _CopyTable aPara( *pCT ); aPara.pInsBox = pNewBox; - pBox->GetTabLines().ForEach( &lcl_CopyTblLine, &aPara ); + BOOST_FOREACH( const SwTableLine* pLine, pBox->GetTabLines() ) + lcl_CopyTblLine( pLine, &aPara ); } else if( pNewBox->IsInHeadline( &pCT->pTblNd->GetTable() )) // in der HeadLine sind die Absaetze mit BedingtenVorlage anzupassen pNewBox->GetSttNd()->CheckSectionCondColl(); } -sal_Bool lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara ) +static void lcl_CopyTblLine( const SwTableLine* pLine, _CopyTable* pCT ) { - _CopyTable* pCT = reinterpret_cast< _CopyTable* >(pPara); - SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rpLine->GetFrmFmt(); + SwTableLineFmt* pLineFmt = (SwTableLineFmt*)pLine->GetFrmFmt(); pCT->rMapArr.ForEach( lcl_SrchNew, &pLineFmt ); - if( pLineFmt == rpLine->GetFrmFmt() ) // ein neues anlegen ?? + if( pLineFmt == pLine->GetFrmFmt() ) // ein neues anlegen ?? { pLineFmt = pCT->pDoc->MakeTableLineFmt(); - pLineFmt->CopyAttrs( *rpLine->GetFrmFmt() ); - pCT->rMapArr.Insert( _MapTblFrmFmt( rpLine->GetFrmFmt(), pLineFmt ), + pLineFmt->CopyAttrs( *pLine->GetFrmFmt() ); + pCT->rMapArr.Insert( _MapTblFrmFmt( pLine->GetFrmFmt(), pLineFmt ), pCT->rMapArr.Count()); } SwTableLine* pNewLine = new SwTableLine( pLineFmt, - rpLine->GetTabBoxes().size(), pCT->pInsBox ); + pLine->GetTabBoxes().size(), pCT->pInsBox ); // die neue Zeile in die Tabelle eintragen if( pCT->pInsBox ) { - pCT->pInsBox->GetTabLines().C40_INSERT( SwTableLine, pNewLine, - pCT->pInsBox->GetTabLines().Count() ); + pCT->pInsBox->GetTabLines().push_back( pNewLine ); } else { - pCT->pTblNd->GetTable().GetTabLines().C40_INSERT( SwTableLine, pNewLine, - pCT->pTblNd->GetTable().GetTabLines().Count() ); + pCT->pTblNd->GetTable().GetTabLines().push_back( pNewLine ); } pCT->pInsLine = pNewLine; - for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); - it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) + for( SwTableBoxes::iterator it = ((SwTableLine*)pLine)->GetTabBoxes().begin(); + it != ((SwTableLine*)pLine)->GetTabBoxes().end(); ++it) lcl_CopyTblBox(*it, pCT ); - return sal_True; } SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const @@ -499,7 +497,8 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const _MapTblFrmFmts aMapArr; _CopyTable aPara( pDoc, aMapArr, GetIndex(), *pTblNd, &GetTable() ); - ((SwTable&)GetTable()).GetTabLines().ForEach( &lcl_CopyTblLine, &aPara ); + BOOST_FOREACH(const SwTableLine* pLine, GetTable().GetTabLines() ) + lcl_CopyTblLine( pLine, &aPara ); if( pDDEType ) pDDEType->IncRefCnt(); diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 5822c63010e4..c5dacc13a38b 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -95,6 +95,7 @@ #include <fldupde.hxx> #include <switerator.hxx> #include <boost/foreach.hpp> + #ifdef DBG_UTIL #define CHECK_TABLE(t) (t).CheckConsistency(); #else @@ -271,7 +272,7 @@ sal_Bool SwNodes::InsBoxen( SwTableNode* pTblNd, if( !pPrvBox && !pNxtBox ) { sal_Bool bSetIdxPos = sal_True; - if( pTblNd->GetTable().GetTabLines().Count() && !nInsPos ) + if( pTblNd->GetTable().GetTabLines().size() && !nInsPos ) { const SwTableLine* pTblLn = pLine; while( pTblLn->GetUpper() ) @@ -280,7 +281,7 @@ sal_Bool SwNodes::InsBoxen( SwTableNode* pTblNd, if( pTblNd->GetTable().GetTabLines()[ 0 ] == pTblLn ) { // also vor die erste Box der Tabelle - while( ( pNxtBox = pLine->GetTabBoxes()[0])->GetTabLines().Count() ) + while( ( pNxtBox = pLine->GetTabBoxes()[0])->GetTabLines().size() ) pLine = pNxtBox->GetTabLines()[0]; nIdxPos = pNxtBox->GetSttIdx(); bSetIdxPos = sal_False; @@ -492,7 +493,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, for( sal_uInt16 n = 0; n < nRows; ++n ) { SwTableLine* pLine = new SwTableLine( pLineFmt, nCols, 0 ); - rLines.C40_INSERT( SwTableLine, pLine, n ); + rLines.insert( rLines.begin() + n, pLine ); SwTableBoxes& rBoxes = pLine->GetTabBoxes(); for( sal_uInt16 i = 0; i < nCols; ++i ) { @@ -771,7 +772,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, SwTableBoxFmt *pBoxF = 0; SwTableLines& rLines = pNdTbl->GetTabLines(); - sal_uInt16 nRows = rLines.Count(); + sal_uInt16 nRows = rLines.size(); for( sal_uInt16 n = 0; n < nRows; ++n ) { SwTableBoxes& rBoxes = rLines[ n ]->GetTabBoxes(); @@ -970,7 +971,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, pTxtNd->pStartOfSection = pTblNd; pLine = new SwTableLine( pLineFmt, 1, 0 ); - pTable->GetTabLines().C40_INSERT( SwTableLine, pLine, nLines ); + pTable->GetTabLines().insert( pTable->GetTabLines().begin() + nLines, pLine ); SwStartNode* pSttNd; SwPosition aCntPos( aSttIdx, SwIndex( pTxtNd )); @@ -1029,7 +1030,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, // die Tabelle ausgleichen, leere Sections einfuegen sal_uInt16 n; - for( n = 0; n < pTable->GetTabLines().Count(); ++n ) + for( n = 0; n < pTable->GetTabLines().size(); ++n ) { SwTableLine* pCurrLine = pTable->GetTabLines()[ n ]; if( nMaxBoxes != ( nBoxes = pCurrLine->GetTabBoxes().size() )) @@ -1057,7 +1058,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, SwTableBoxFmt *pNewFmt = pDoc->MakeTableBoxFmt(); pNewFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, aPosArr[ n ] - nLastPos )); - for( sal_uInt16 nTmpLine = 0; nTmpLine < rLns.Count(); ++nTmpLine ) + for( sal_uInt16 nTmpLine = 0; nTmpLine < rLns.size(); ++nTmpLine ) //JP 24.06.98: hier muss ein Add erfolgen, da das BoxFormat // von der rufenden Methode noch gebraucht wird! pNewFmt->Add( rLns[ nTmpLine ]->GetTabBoxes()[ n ] ); @@ -1341,7 +1342,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, ++aRowIter, nLines++, nBoxes = 0 ) { pLine = new SwTableLine( pLineFmt, 1, 0 ); - pTable->GetTabLines().C40_INSERT( SwTableLine, pLine, nLines ); + pTable->GetTabLines().insert( pTable->GetTabLines().begin() + nLines, pLine ); std::vector< SwNodeRange >::const_iterator aCellIter = aRowIter->begin(); @@ -1384,7 +1385,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, SwTableBoxFmt *pNewFmt = pDoc->MakeTableBoxFmt(); pNewFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, aPosArr[ n ] - nLastPos )); - for( sal_uInt16 nLines2 = 0; nLines2 < rLns.Count(); ++nLines2 ) + for( sal_uInt16 nLines2 = 0; nLines2 < rLns.size(); ++nLines2 ) //JP 24.06.98: hier muss ein Add erfolgen, da das BoxFormat // von der rufenden Methode noch gebraucht wird! pNewFmt->Add( rLns[ nLines2 ]->GetTabBoxes()[ n ] ); @@ -1470,17 +1471,16 @@ struct _DelTabPara // koennen. static void lcl_DelBox( SwTableBox* pBox, _DelTabPara* pDelPara ); -sal_Bool lcl_DelLine( const SwTableLine*& rpLine, void* pPara ) +static void lcl_DelLine( SwTableLine* pLine, _DelTabPara* pPara ) { OSL_ENSURE( pPara, "die Parameter fehlen" ); - _DelTabPara aPara( *(_DelTabPara*)pPara ); - for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); - it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) + _DelTabPara aPara( *pPara ); + for( SwTableBoxes::iterator it = pLine->GetTabBoxes().begin(); + it != pLine->GetTabBoxes().end(); ++it) lcl_DelBox(*it, &aPara ); - if( rpLine->GetUpper() ) // gibt es noch eine uebergeordnete Box ?? + if( pLine->GetUpper() ) // gibt es noch eine uebergeordnete Box ?? // dann gebe den letzten TextNode zurueck - ((_DelTabPara*)pPara)->pLastNd = aPara.pLastNd; - return sal_True; + pPara->pLastNd = aPara.pLastNd; } @@ -1489,8 +1489,9 @@ static void lcl_DelBox( SwTableBox* pBox, _DelTabPara* pDelPara ) OSL_ENSURE( pDelPara, "die Parameter fehlen" ); // loesche erstmal die Lines der Box - if( pBox->GetTabLines().Count() ) - pBox->GetTabLines().ForEach( &lcl_DelLine, pDelPara ); + if( !pBox->GetTabLines().empty() ) + BOOST_FOREACH( SwTableLine* pLine, pBox->GetTabLines() ) + lcl_DelLine( pLine, pDelPara ); else { SwDoc* pDoc = pDelPara->rNds.GetDoc(); @@ -1570,7 +1571,8 @@ sal_Bool SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh, // dann "loeschen" die Tabellen und fasse alle Lines/Boxen zusammen _DelTabPara aDelPara( *this, cCh, pUndo ); - pTblNd->pTable->GetTabLines().ForEach( &lcl_DelLine, &aDelPara ); + BOOST_FOREACH( SwTableLine *pLine, pTblNd->pTable->GetTabLines() ) + lcl_DelLine( pLine, &aDelPara ); // jetzt ist aus jeder TableLine ein TextNode mit dem entsprechenden // Trenner erzeugt worden. Es braucht nur noch die Table-Section @@ -1817,7 +1819,7 @@ sal_Bool SwDoc::DeleteRow( const SwCursor& rCursor ) _FndBox aFndBox( 0, 0 ); { _FndPara aPara( aBoxes, &aFndBox ); - pTblNd->GetTable().GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( pTblNd->GetTable().GetTabLines(), &aPara ); } if( !aFndBox.GetLines().size() ) @@ -1845,7 +1847,7 @@ sal_Bool SwDoc::DeleteRow( const SwCursor& rCursor ) while( !pDelBox->GetSttNd() ) { SwTableLine* pLn = pDelBox->GetTabLines()[ - pDelBox->GetTabLines().Count()-1 ]; + pDelBox->GetTabLines().size()-1 ]; pDelBox = pLn->GetTabBoxes().back(); } SwTableBox* pNextBox = pDelLine->FindNextBox( pTblNd->GetTable(), @@ -3018,7 +3020,7 @@ sal_Bool lcl_Line_CollectBox( const SwTableLine*& rpLine, void* pPara ) void lcl_Box_CollectBox( const SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara ) { - sal_uInt16 nLen = pBox->GetTabLines().Count(); + sal_uInt16 nLen = pBox->GetTabLines().size(); if( nLen ) { // dann mit der richtigen Line weitermachen @@ -3036,7 +3038,7 @@ void lcl_Box_CollectBox( const SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara void lcl_BoxSetSplitBoxFmts( SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara ) { - sal_uInt16 nLen = pBox->GetTabLines().Count(); + sal_uInt16 nLen = pBox->GetTabLines().size(); if( nLen ) { // dann mit der richtigen Line weitermachen @@ -3155,7 +3157,7 @@ sal_Bool SwDoc::SplitTable( const SwPosition& rPos, sal_uInt16 eHdlnMode, if( pNew ) { - SwSaveRowSpan* pSaveRowSp = pNew->GetTable().CleanUpTopRowSpan( rTbl.GetTabLines().Count() ); + SwSaveRowSpan* pSaveRowSp = pNew->GetTable().CleanUpTopRowSpan( rTbl.GetTabLines().size() ); SwUndoSplitTbl* pUndo = 0; if (GetIDocumentUndoRedo().DoesUndo()) { @@ -3174,7 +3176,7 @@ sal_Bool SwDoc::SplitTable( const SwPosition& rPos, sal_uInt16 eHdlnMode, { SwCollectTblLineBoxes aPara( sal_False, eHdlnMode ); SwTableLine* pLn = rTbl.GetTabLines()[ - rTbl.GetTabLines().Count() - 1 ]; + rTbl.GetTabLines().size() - 1 ]; for( SwTableBoxes::iterator it = pLn->GetTabBoxes().begin(); it != pLn->GetTabBoxes().end(); ++it) lcl_Box_CollectBox(*it, &aPara ); @@ -3262,7 +3264,7 @@ sal_Bool lcl_ChgTblSize( SwTable& rTbl ) aTblMaxSz.SetWidth( 0 ); SwTableLines& rLns = rTbl.GetTabLines(); - for( sal_uInt16 nLns = 0; nLns < rLns.Count(); ++nLns ) + for( sal_uInt16 nLns = 0; nLns < rLns.size(); ++nLns ) { SwTwips nMaxLnWidth = 0; SwTableBoxes& rBoxes = rLns[ nLns ]->GetTabBoxes(); @@ -3311,25 +3313,21 @@ public: static void lcl_SplitTable_CpyBox( SwTableBox* pBox, _SplitTable_Para* pPara ); -sal_Bool lcl_SplitTable_CpyLine( const SwTableLine*& rpLine, void* pPara ) +static void lcl_SplitTable_CpyLine( SwTableLine* pLn, _SplitTable_Para* pPara ) { - SwTableLine* pLn = (SwTableLine*)rpLine; - _SplitTable_Para& rPara = *(_SplitTable_Para*)pPara; - SwFrmFmt *pSrcFmt = pLn->GetFrmFmt(); - sal_uInt16 nPos = rPara.SrcFmt_GetPos( pSrcFmt ); + sal_uInt16 nPos = pPara->SrcFmt_GetPos( pSrcFmt ); if( USHRT_MAX == nPos ) { - rPara.DestFmt_Insert( pLn->ClaimFrmFmt() ); - rPara.SrcFmt_Insert( pSrcFmt ); + pPara->DestFmt_Insert( pLn->ClaimFrmFmt() ); + pPara->SrcFmt_Insert( pSrcFmt ); } else - pLn->ChgFrmFmt( (SwTableLineFmt*)rPara.DestFmt_Get( nPos ) ); + pLn->ChgFrmFmt( (SwTableLineFmt*)pPara->DestFmt_Get( nPos ) ); for( SwTableBoxes::iterator it = pLn->GetTabBoxes().begin(); it != pLn->GetTabBoxes().end(); ++it) - lcl_SplitTable_CpyBox(*it, (_SplitTable_Para*)pPara ); - return sal_True; + lcl_SplitTable_CpyBox(*it, pPara ); } static void lcl_SplitTable_CpyBox( SwTableBox* pBox, _SplitTable_Para* pPara ) @@ -3347,7 +3345,8 @@ static void lcl_SplitTable_CpyBox( SwTableBox* pBox, _SplitTable_Para* pPara ) if( pBox->GetSttNd() ) pPara->ChgBox( pBox ); else - pBox->GetTabLines().ForEach( &lcl_SplitTable_CpyLine, pPara ); + BOOST_FOREACH( SwTableLine* pLine, pBox->GetTabLines() ) + lcl_SplitTable_CpyLine( pLine, pPara ); } SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, sal_Bool bAfter, @@ -3373,7 +3372,7 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, sal_Bool bAfter, // in pLine steht jetzt die GrundLine. sal_uInt16 nLinePos = rTbl.GetTabLines().C40_GETPOS( SwTableLine, pLine ); if( USHRT_MAX == nLinePos || - ( bAfter ? ++nLinePos >= rTbl.GetTabLines().Count() : !nLinePos )) + ( bAfter ? ++nLinePos >= rTbl.GetTabLines().size() : !nLinePos )) return 0; // nicht gefunden oder letze Line !! // Suche jetzt die 1. Box der nachfolgenden Line @@ -3407,7 +3406,8 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, sal_Bool bAfter, { // die Lines ruebermoven... SwTable& rNewTbl = pNewTblNd->GetTable(); - rNewTbl.GetTabLines().Insert( &rTbl.GetTabLines(), 0, nLinePos ); + rNewTbl.GetTabLines().insert( rNewTbl.GetTabLines().begin(), + rTbl.GetTabLines().begin() + nLinePos, rTbl.GetTabLines().end() ); // // von hinten (unten-rechts) nach vorn (oben-links) alle Boxen // beim chart data provider austragen (das modified event wird dann @@ -3416,9 +3416,9 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, sal_Bool bAfter, SwChartDataProvider *pPCD = rTbl.GetFrmFmt()->getIDocumentChartDataProviderAccess()->GetChartDataProvider(); if( pPCD ) { - for (sal_uInt16 k = nLinePos; k < rTbl.GetTabLines().Count(); ++k) + for (sal_uInt16 k = nLinePos; k < rTbl.GetTabLines().size(); ++k) { - sal_uInt16 nLineIdx = (rTbl.GetTabLines().Count() - 1) - k + nLinePos; + sal_uInt16 nLineIdx = (rTbl.GetTabLines().size() - 1) - k + nLinePos; sal_uInt16 nBoxCnt = rTbl.GetTabLines()[ nLineIdx ]->GetTabBoxes().size(); for (sal_uInt16 j = 0; j < nBoxCnt; ++j) { @@ -3429,13 +3429,14 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, sal_Bool bAfter, } // // ...und loeschen - sal_uInt16 nDeleted = rTbl.GetTabLines().Count() - nLinePos; - rTbl.GetTabLines().Remove( nLinePos, nDeleted ); + sal_uInt16 nDeleted = rTbl.GetTabLines().size() - nLinePos; + rTbl.GetTabLines().erase( rTbl.GetTabLines().begin() + nLinePos, rTbl.GetTabLines().end() ); // und die betr. Boxen verschieben. Dabei die Formate eindeutig // machen und die StartNodes korrigieren _SplitTable_Para aPara( pNewTblNd, rTbl ); - rNewTbl.GetTabLines().ForEach( &lcl_SplitTable_CpyLine, &aPara ); + BOOST_FOREACH( SwTableLine* pNewLine, rNewTbl.GetTabLines() ) + lcl_SplitTable_CpyLine( pNewLine, &aPara ); rTbl.CleanUpBottomRowSpan( nDeleted ); } @@ -3584,9 +3585,10 @@ sal_Bool SwNodes::MergeTable( const SwNodeIndex& rPos, sal_Bool bWithPrev, } // die Lines und Boxen ruebermoven - sal_uInt16 nOldSize = rTbl.GetTabLines().Count(); - rTbl.GetTabLines().Insert( &rDelTbl.GetTabLines(), nOldSize ); - rDelTbl.GetTabLines().Remove( 0, rDelTbl.GetTabLines().Count() ); + sal_uInt16 nOldSize = rTbl.GetTabLines().size(); + rTbl.GetTabLines().insert( rTbl.GetTabLines().begin() + nOldSize, + rDelTbl.GetTabLines().begin(), rDelTbl.GetTabLines().end() ); + rDelTbl.GetTabLines().clear(); rTbl.GetTabSortBoxes().Insert( &rDelTbl.GetTabSortBoxes() ); rDelTbl.GetTabSortBoxes().Remove( (sal_uInt16)0, rDelTbl.GetTabSortBoxes().Count() ); @@ -3615,7 +3617,7 @@ sal_Bool SwNodes::MergeTable( const SwNodeIndex& rPos, sal_Bool bWithPrev, // Header-Vorlagen in der Zeile setzen // und ggfs. in der History speichern fuers Undo!!! } - lcl_LineSetHeadCondColl( pFirstLn, 0 ); + lcl_LineSetHeadCondColl( pFirstLn ); // und die Borders "aufrauemen" if( nOldSize ) @@ -3731,7 +3733,7 @@ sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& _FndBox aFndBox( 0, 0 ); { _FndPara aPara( rBoxes, &aFndBox ); - pTblNd->GetTable().GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( pTblNd->GetTable().GetTabLines(), &aPara ); } if( aFndBox.GetLines().empty() ) return sal_False; @@ -3818,7 +3820,7 @@ sal_Bool SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet _FndBox aFndBox( 0, 0 ); { _FndPara aPara( rBoxes, &aFndBox ); - pTblNd->GetTable().GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( pTblNd->GetTable().GetTabLines(), &aPara ); } if( aFndBox.GetLines().empty() ) return sal_False; diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 9da8c064435c..ba2f350321e9 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -215,9 +215,9 @@ sal_Bool _FindBox( _FndBox & rBox, LinesAndTable* pPara ) const SwTableLines &rLines = (rBox.GetBox()) ? rBox.GetBox()->GetTabLines() : pPara->rTable.GetTabLines(); - if (rBox.GetLines().size() == rLines.Count()) + if (rBox.GetLines().size() == rLines.size()) { - for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.size(); ++i ) ::InsertLine( pPara->rLines, (SwTableLine*)rLines[i] ); } @@ -256,7 +256,7 @@ void lcl_CollectLines( SvPtrarr &rArr, const SwCursor& rCursor, bool bRemoveLine _FndBox aFndBox( 0, 0 ); { _FndPara aTmpPara( aBoxes, &aFndBox ); - ((SwTableLines&)rTable.GetTabLines()).ForEach( &_FndLineCopyCol, &aTmpPara ); + ForEach_FndLineCopyCol( (SwTableLines&)rTable.GetTabLines(), &aTmpPara ); } //Diejenigen Lines einsammeln, die nur selektierte Boxen enthalten. @@ -316,11 +316,11 @@ void lcl_ProcessRowSize( SvPtrarr &rFmtCmp, SwTableLine *pLine, const SwFmtFrmSi void lcl_ProcessBoxSize( SvPtrarr &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize &rNew ) { SwTableLines &rLines = pBox->GetTabLines(); - if ( rLines.Count() ) + if ( !rLines.empty() ) { SwFmtFrmSize aSz( rNew ); - aSz.SetHeight( rNew.GetHeight() ? rNew.GetHeight() / rLines.Count() : 0 ); - for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) + aSz.SetHeight( rNew.GetHeight() ? rNew.GetHeight() / rLines.size() : 0 ); + for ( sal_uInt16 i = 0; i < rLines.size(); ++i ) ::lcl_ProcessRowSize( rFmtCmp, rLines[i], aSz ); } } diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index 01090714cffe..9ca66e19747c 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -777,7 +777,7 @@ const SwTableBox* lcl_RelToBox( const SwTable& rTbl, nLineOffset < 0 || nLineOffset >= USHRT_MAX ) return 0; - if( nLineOffset >= long(pLines->Count()) ) + if( nLineOffset >= long(pLines->size()) ) return 0; pLine = (*pLines)[ sal_uInt16(nLineOffset) ]; @@ -798,7 +798,7 @@ const SwTableBox* lcl_RelToBox( const SwTable& rTbl, nSttLine = SwTable::_GetBoxNum( sGetName ); // bestimme die Line - if( !nSttLine || nSttLine > pLines->Count() ) + if( !nSttLine || nSttLine > pLines->size() ) break; pLine = (*pLines)[ nSttLine-1 ]; @@ -813,8 +813,8 @@ const SwTableBox* lcl_RelToBox( const SwTable& rTbl, { if( !pBox->GetSttNd() ) // "herunterfallen lassen" bis zur ersten Box - while( pBox->GetTabLines().Count() ) - pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0]; + while( !pBox->GetTabLines().empty() ) + pBox = pBox->GetTabLines().front()->GetTabBoxes().front(); } } else diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index f13f79f8e653..aa1f3d0af122 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -53,10 +53,11 @@ SwDDETable::SwDDETable( SwTable& rTable, SwDDEFieldType* pDDEType, rTable.GetTabSortBoxes().Count() ); // move die Inh. Boxen rTable.GetTabSortBoxes().Remove( (sal_uInt16)0, rTable.GetTabSortBoxes().Count() ); - aLines.Insert( &rTable.GetTabLines(),0 ); // move die Lines - rTable.GetTabLines().Remove( 0, rTable.GetTabLines().Count() ); + aLines.insert( aLines.begin(), + rTable.GetTabLines().begin(), rTable.GetTabLines().end() ); // move die Lines + rTable.GetTabLines().clear(); - if( aLines.Count() ) + if( !aLines.empty() ) { const SwNode& rNd = *GetTabSortBoxes()[0]->GetSttNd(); if( rNd.GetNodes().IsDocNodes() ) @@ -80,7 +81,7 @@ SwDDETable::~SwDDETable() { SwDDEFieldType* pFldTyp = (SwDDEFieldType*)aDepend.GetRegisteredIn(); SwDoc* pDoc = GetFrmFmt()->GetDoc(); - if( !pDoc->IsInDtor() && aLines.Count() && + if( !pDoc->IsInDtor() && !aLines.empty() && GetTabSortBoxes()[0]->GetSttNd()->GetNodes().IsDocNodes() ) pFldTyp->DecRefCnt(); @@ -113,7 +114,7 @@ void SwDDETable::ChangeContent() OSL_ENSURE( GetFrmFmt(), "Kein FrameFormat" ); // Stehen wir im richtigen NodesArray (Wegen UNDO) - if( !aLines.Count() ) + if( aLines.empty() ) return; OSL_ENSURE( GetTabSortBoxes().Count(), "Tabelle ohne Inhalt?" ); if( !GetTabSortBoxes()[0]->GetSttNd()->GetNodes().IsDocNodes() ) @@ -124,7 +125,7 @@ void SwDDETable::ChangeContent() String aExpand = comphelper::string::remove(pDDEType->GetExpansion(), '\r'); - for( sal_uInt16 n = 0; n < aLines.Count(); ++n ) + for( sal_uInt16 n = 0; n < aLines.size(); ++n ) { String aLine = aExpand.GetToken( n, '\n' ); SwTableLine* pLine = aLines[ n ]; @@ -164,7 +165,7 @@ sal_Bool SwDDETable::NoDDETable() SwDoc* pDoc = GetFrmFmt()->GetDoc(); // Stehen wir im richtigen NodesArray (Wegen UNDO) - if( !aLines.Count() ) + if( aLines.empty() ) return sal_False; OSL_ENSURE( GetTabSortBoxes().Count(), "Tabelle ohne Inhalt?" ); SwNode* pNd = (SwNode*)GetTabSortBoxes()[0]->GetSttNd(); @@ -181,8 +182,9 @@ sal_Bool SwDDETable::NoDDETable() GetTabSortBoxes().Count() ); // move die Inh. Boxen GetTabSortBoxes().Remove( (sal_uInt16)0, GetTabSortBoxes().Count() ); - pNewTbl->GetTabLines().Insert( &GetTabLines(),0 ); // move die Lines - GetTabLines().Remove( 0, GetTabLines().Count() ); + pNewTbl->GetTabLines().insert( pNewTbl->GetTabLines().begin(), + GetTabLines().begin(), GetTabLines().end() ); // move die Lines + GetTabLines().clear(); if( pDoc->GetCurrentViewShell() ) //swmod 071108//swmod 071225 ((SwDDEFieldType*)aDepend.GetRegisteredIn())->DecRefCnt(); diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index ffe4f47e1c6d..65f67e4125b6 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -103,7 +103,7 @@ TblWait::TblWait( sal_uInt16 nCnt, SwFrm *pFrm, SwDocShell &rDocShell, sal_uInt1 pWait( 0 ) { sal_Bool bWait = 20 < nCnt || 20 < nCnt2 || (pFrm && - 20 < pFrm->ImplFindTabFrm()->GetTable()->GetTabLines().Count()); + 20 < pFrm->ImplFindTabFrm()->GetTable()->GetTabLines().size()); if( bWait ) pWait = new SwWait( rDocShell, sal_True ); } @@ -375,7 +375,7 @@ sal_Bool SwFEShell::DeleteRow() _FndBox aFndBox( 0, 0 ); { _FndPara aPara( aBoxes, &aFndBox ); - pTblNd->GetTable().GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( pTblNd->GetTable().GetTabLines(), &aPara ); } if( aFndBox.GetLines().empty() ) @@ -400,8 +400,7 @@ sal_Bool SwFEShell::DeleteRow() SwTableBox* pDelBox = pDelLine->GetTabBoxes().back(); while( !pDelBox->GetSttNd() ) { - SwTableLine* pLn = pDelBox->GetTabLines()[ - pDelBox->GetTabLines().Count()-1 ]; + SwTableLine* pLn = pDelBox->GetTabLines().back(); pDelBox = pLn->GetTabBoxes().back(); } SwTableBox* pNextBox = pDelLine->FindNextBox( pTblNd->GetTable(), @@ -480,7 +479,7 @@ sal_uInt16 SwFEShell::MergeTab() StartAllAction(); TblWait( pTableCrsr->GetBoxesCount(), 0, *GetDoc()->GetDocShell(), - pTblNd->GetTable().GetTabLines().Count() ); + pTblNd->GetTable().GetTabLines().size() ); nRet = GetDoc()->MergeTbl( *pTableCrsr ); @@ -1128,7 +1127,7 @@ sal_uInt16 lcl_GetRowNumber( const SwPosition& rPos ) const SwTableLine* pTabLine = static_cast<const SwRowFrm*>(pRow)->GetTabLine(); sal_uInt16 nI = 0; - while ( nI < pTabFrm->GetTable()->GetTabLines().Count() ) + while ( nI < pTabFrm->GetTable()->GetTabLines().size() ) { if ( pTabFrm->GetTable()->GetTabLines()[ nI ] == pTabLine ) { diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 52d0fc275dd4..1730e3761d81 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1469,7 +1469,7 @@ static sal_Bool lcl_CheckCol( _FndBox const& rFndBox, sal_Bool* pPara ) if (!rFndBox.GetBox()->GetSttNd()) { if (rFndBox.GetLines().size() != - rFndBox.GetBox()->GetTabLines().Count()) + rFndBox.GetBox()->GetTabLines().size()) { *pPara = sal_False; } @@ -1512,8 +1512,7 @@ sal_uInt16 CheckMergeSel( const SwSelBoxes& rBoxes ) _FndBox aFndBox( 0, 0 ); _FndPara aPara( rBoxes, &aFndBox ); const SwTableNode* pTblNd = aPara.rBoxes[0]->GetSttNd()->FindTableNode(); - ((SwTable&)pTblNd->GetTable()).GetTabLines().ForEach( - &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( (SwTableLines&)pTblNd->GetTable().GetTabLines(), &aPara ); if( !aFndBox.GetLines().empty() ) { sal_Bool bMergeSelOk = sal_True; @@ -1617,7 +1616,7 @@ void lcl_FindStartEndRow( const SwLayoutFrm *&rpStart, const SwTableLines& rLns = pCellFrm-> GetTabBox()->GetTabLines(); if( rLns[ 0 ] == ((SwRowFrm*)aSttArr[ n ])->GetTabLine() && - rLns[ rLns.Count() - 1 ] == + rLns[ rLns.size() - 1 ] == ((SwRowFrm*)aEndArr[ n ])->GetTabLine() ) { rpStart = rpEnd = pCellFrm; @@ -2101,10 +2100,10 @@ void lcl_InsertRow( SwTableLine &rLine, SwLayoutFrm *pUpper, SwFrm *pSibling ) static void _FndBoxCopyCol( SwTableBox* pBox, _FndPara* pFndPara ) { _FndBox* pFndBox = new _FndBox( pBox, pFndPara->pFndLine ); - if( pBox->GetTabLines().Count() ) + if( pBox->GetTabLines().size() ) { _FndPara aPara( *pFndPara, pFndBox ); - pFndBox->GetBox()->GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( pFndBox->GetBox()->GetTabLines(), &aPara ); if( pFndBox->GetLines().empty() ) { delete pFndBox; @@ -2123,10 +2122,9 @@ static void _FndBoxCopyCol( SwTableBox* pBox, _FndPara* pFndPara ) pFndPara->pFndLine->GetBoxes().push_back( pFndBox ); } -sal_Bool _FndLineCopyCol( const SwTableLine*& rpLine, void* pPara ) +static void _FndLineCopyCol( SwTableLine* pLine, _FndPara* pFndPara ) { - _FndPara* pFndPara = (_FndPara*)pPara; - _FndLine* pFndLine = new _FndLine( (SwTableLine*)rpLine, pFndPara->pFndBox ); + _FndLine* pFndLine = new _FndLine( pLine, pFndPara->pFndBox ); _FndPara aPara( *pFndPara, pFndLine ); for( SwTableBoxes::iterator it = pFndLine->GetLine()->GetTabBoxes().begin(); it != pFndLine->GetLine()->GetTabBoxes().end(); ++it) @@ -2137,7 +2135,12 @@ sal_Bool _FndLineCopyCol( const SwTableLine*& rpLine, void* pPara ) } else delete pFndLine; - return sal_True; +} + +void ForEach_FndLineCopyCol(SwTableLines& rLines, _FndPara* pFndPara ) +{ + for( SwTableLines::iterator it = rLines.begin(); it != rLines.end(); ++it ) + _FndLineCopyCol( *it, pFndPara ); } void _FndBox::SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable ) @@ -2169,7 +2172,7 @@ void _FndBox::SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable ) } if ( nStPos > 1 ) pLineBefore = rTable.GetTabLines()[nStPos - 2]; - if ( nEndPos < rTable.GetTabLines().Count() ) + if ( nEndPos < rTable.GetTabLines().size() ) pLineBehind = rTable.GetTabLines()[nEndPos]; } @@ -2193,7 +2196,7 @@ void _FndBox::SetTableLines( const SwTable &rTable ) pTmpLine = GetLines().back().GetLine(); nPos = rTable.GetTabLines().C40_GETPOS( SwTableLine, pTmpLine ); OSL_ENSURE( USHRT_MAX != nPos, "Line steht nicht in der Tabelle" ); - if( ++nPos < rTable.GetTabLines().Count() ) + if( ++nPos < rTable.GetTabLines().size() ) pLineBehind = rTable.GetTabLines()[nPos]; } @@ -2211,7 +2214,7 @@ void _FndBox::DelFrms( SwTable &rTable ) // Always a TabFrm should remain. sal_uInt16 nStPos = 0; - sal_uInt16 nEndPos= rTable.GetTabLines().Count() - 1; + sal_uInt16 nEndPos= rTable.GetTabLines().size() - 1; if( rTable.IsNewModel() && pLineBefore ) rTable.CheckRowSpan( pLineBefore, true ); if ( pLineBefore ) @@ -2371,7 +2374,7 @@ void _FndBox::MakeFrms( SwTable &rTable ) // All lines between pLineBefore and pLineBehind should be re-generated in layout. // And this for all instances of a table (for example in header/footer). sal_uInt16 nStPos = 0; - sal_uInt16 nEndPos= rTable.GetTabLines().Count() - 1; + sal_uInt16 nEndPos= rTable.GetTabLines().size() - 1; if ( pLineBefore ) { nStPos = rTable.GetTabLines().GetPos( @@ -2396,7 +2399,7 @@ void _FndBox::MakeFrms( SwTable &rTable ) SwRowFrm *pSibling = 0; SwFrm *pUpperFrm = 0; int i; - for ( i = rTable.GetTabLines().Count()-1; + for ( i = rTable.GetTabLines().size()-1; i >= 0 && !pSibling; --i ) { SwTableLine *pLine = pLineBehind ? pLineBehind : @@ -2456,7 +2459,7 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const sal_uInt16 nNumber, //nCnt: how many were inserted nNumber times const sal_uInt16 nCnt = - ((nBhPos != USHRT_MAX ? nBhPos : rTable.GetTabLines().Count()) - + ((nBhPos != USHRT_MAX ? nBhPos : rTable.GetTabLines().size()) - (nBfPos != USHRT_MAX ? nBfPos + 1 : 0)) / (nNumber + 1); // search the Master-TabFrm @@ -2496,7 +2499,7 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const sal_uInt16 nNumber, pUpperFrm = pTable; } const sal_uInt16 nMax = nBhPos != USHRT_MAX ? - nBhPos : rTable.GetTabLines().Count(); + nBhPos : rTable.GetTabLines().size(); sal_uInt16 i = nBfPos != USHRT_MAX ? nBfPos + 1 + nCnt : nCnt; @@ -2544,7 +2547,7 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const sal_uInt16 nNumber, sal_uInt16 nMax = nBhPos != USHRT_MAX ? nBhPos - nCnt : - rTable.GetTabLines().Count() - nCnt; + rTable.GetTabLines().size() - nCnt; i = nBfPos != USHRT_MAX ? nBfPos + 1 : 0; for ( ; i < nMax; ++i ) @@ -2583,7 +2586,7 @@ sal_Bool _FndBox::AreLinesToRestore( const SwTable &rTable ) const { // Should we call MakeFrms here? - if ( !pLineBefore && !pLineBehind && rTable.GetTabLines().Count() ) + if ( !pLineBefore && !pLineBehind && rTable.GetTabLines().size() ) return sal_True; sal_uInt16 nBfPos; @@ -2629,7 +2632,7 @@ sal_Bool _FndBox::AreLinesToRestore( const SwTable &rTable ) const return sal_False; // Some adjacent lines at the end of the table have been deleted: - if ( nBhPos == USHRT_MAX && nBfPos == (rTable.GetTabLines().Count() - 1) ) + if ( nBhPos == USHRT_MAX && nBfPos == (rTable.GetTabLines().size() - 1) ) return sal_False; // Some adjacent lines in the middle of the table have been deleted: diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx index 54eadef3d2c9..a7884e1d0d4c 100644 --- a/sw/source/core/inc/tblrwcl.hxx +++ b/sw/source/core/inc/tblrwcl.hxx @@ -48,7 +48,7 @@ class SwFmtFrmSize; struct _CpyPara; struct _InsULPara; -sal_Bool lcl_LineSetHeadCondColl( const SwTableLine*& rpLine, void* pPara ); +void lcl_LineSetHeadCondColl( const SwTableLine* pLine ); #ifdef DBG_UTIL @@ -133,7 +133,7 @@ struct _SwGCLineBorder _SwGCLineBorder( const SwTableBox& rBox ) : pLines( &rBox.GetTabLines() ), pShareFmts(0), nLinePos( 0 ) {} - sal_Bool IsLastLine() const { return nLinePos + 1 >= pLines->Count(); } + sal_Bool IsLastLine() const { return nLinePos + 1 >= (sal_uInt16)pLines->size(); } }; class _SwGCBorder_BoxBrd @@ -153,12 +153,7 @@ public: sal_Bool IsAnyBorderFound() const { return bAnyBorderFnd; } }; -sal_Bool lcl_GC_Line_Border( const SwTableLine*& , void* pPara ); - -sal_Bool lcl_GCBorder_ChkBoxBrd_L( const SwTableLine*& , void* pPara ); -sal_Bool lcl_GCBorder_ChkBoxBrd_B( const SwTableBox*& , void* pPara ); - -sal_Bool lcl_GCBorder_GetLastBox_L( const SwTableLine*& , void* pPara ); +void lcl_GC_Line_Border( const SwTableLine* pLine, _SwGCLineBorder* pGCPara ); class SwShareBoxFmt diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index cf0099df2b33..417181e6c045 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -102,7 +102,7 @@ SwTabFrm::SwTabFrm( SwTable &rTab, SwFrm* pSib ): //Create the lines and insert them. const SwTableLines &rLines = rTab.GetTabLines(); SwFrm *pTmpPrev = 0; - for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.size(); ++i ) { SwRowFrm *pNew = new SwRowFrm( *rLines[i], this ); if( pNew->Lower() ) @@ -4654,7 +4654,7 @@ SwCellFrm::SwCellFrm( const SwTableBox &rBox, SwFrm* pSib, bool bInsertContent ) { const SwTableLines &rLines = rBox.GetTabLines(); SwFrm *pTmpPrev = 0; - for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.size(); ++i ) { SwRowFrm *pNew = new SwRowFrm( *rLines[i], this, bInsertContent ); pNew->InsertBehind( this, pTmpPrev ); diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index 8f59ac297479..644b38c1b6f1 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -251,7 +251,7 @@ false is also needed for deleted rows void lcl_ChangeRowSpan( const SwTable& rTable, const long nDiff, sal_uInt16 nRowIdx, const bool bSingle ) { - if( !nDiff || nRowIdx >= rTable.GetTabLines().Count() ) + if( !nDiff || nRowIdx >= rTable.GetTabLines().size() ) return; OSL_ENSURE( !bSingle || nDiff > 0, "Don't set bSingle when deleting lines!" ); bool bGoOn; @@ -323,14 +323,14 @@ void lcl_ChangeRowSpan( const SwTable& rTable, const long nDiff, SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const { OSL_ENSURE( bNewModel, "Don't call me for old tables" ); - if( !aLines.Count() ) + if( aLines.empty() ) return 0; const SwNode* pStartNd = rPam.Start()->nNode.GetNode().FindTableBoxStartNode(); const SwNode* pEndNd = rPam.End()->nNode.GetNode().FindTableBoxStartNode(); if( !pStartNd || !pEndNd || pStartNd == pEndNd ) return 0; - sal_uInt16 nLines = aLines.Count(); + sal_uInt16 nLines = aLines.size(); sal_uInt16 nTop = 0, nBottom = 0; long nMin = 0, nMax = 0; int nFound = 0; @@ -654,12 +654,12 @@ insertion behind (true) or before (false) the selected boxes sal_Bool SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind ) { - if( !aLines.Count() || !nCnt ) + if( aLines.empty() || !nCnt ) return sal_False; CHECK_TABLE( *this ) long nNewBoxWidth = 0; - std::vector< sal_uInt16 > aInsPos( aLines.Count(), USHRT_MAX ); + std::vector< sal_uInt16 > aInsPos( aLines.size(), USHRT_MAX ); { // Calculation of the insert positions and the width of the new boxes sal_uInt64 nTableWidth = 0; for( sal_uInt16 i = 0; i < aLines[0]->GetTabBoxes().size(); ++i ) @@ -695,7 +695,7 @@ sal_Bool SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nLastLine = USHRT_MAX; long nLastRowSpan = 1; - for( sal_uInt16 i = 0; i < aLines.Count(); ++i ) + for( sal_uInt16 i = 0; i < aLines.size(); ++i ) { SwTableLine* pLine = aLines[ i ]; sal_uInt16 nInsPos = aInsPos[i]; @@ -1019,7 +1019,7 @@ SwTableBox& SwTableBox::FindStartOfRowSpan( const SwTable& rTable, sal_uInt16 nM SwTableBox* pBox = this; const SwTableLine* pMyUpper = GetUpper(); sal_uInt16 nLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pMyUpper ); - if( nLine && nLine < rTable.GetTabLines().Count() ) + if( nLine && nLine < rTable.GetTabLines().size() ) { SwTableBox* pNext; do @@ -1050,8 +1050,8 @@ SwTableBox& SwTableBox::FindEndOfRowSpan( const SwTable& rTable, sal_uInt16 nMax const SwTableLine* pMyUpper = GetUpper(); sal_uInt16 nLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pMyUpper ); nMaxStep = nLine + nMaxStep; - if( nMaxStep >= rTable.GetTabLines().Count() ) - nMaxStep = rTable.GetTabLines().Count() - 1; + if( nMaxStep >= rTable.GetTabLines().size() ) + nMaxStep = rTable.GetTabLines().size() - 1; long nLeftBorder = lcl_Box2LeftBorder( *this ); SwTableBox* pBox = lcl_LeftBorder2Box( nLeftBorder, rTable.GetTabLines()[ nMaxStep ] ); @@ -1074,7 +1074,7 @@ void lcl_getAllMergedBoxes( const SwTable& rTable, SwSelBoxes& rBoxes, SwTableBo const SwTableLine* pMyUpper = pBox->GetUpper(); sal_uInt16 nLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pMyUpper ); long nLeftBorder = lcl_Box2LeftBorder( *pBox ); - sal_uInt16 nCount = rTable.GetTabLines().Count(); + sal_uInt16 nCount = rTable.GetTabLines().size(); while( ++nLine < nCount && pBox && pBox->getRowSpan() != -1 ) { pBox = lcl_LeftBorder2Box( nLeftBorder, rTable.GetTabLines()[nLine] ); @@ -1155,7 +1155,7 @@ void lcl_FillSelBoxes( SwSelBoxes &rBoxes, SwTableLine &rLine ) void SwTable::InsertSpannedRow( SwDoc* pDoc, sal_uInt16 nRowIdx, sal_uInt16 nCnt ) { CHECK_TABLE( *this ) - OSL_ENSURE( nCnt && nRowIdx < GetTabLines().Count(), "Wrong call of InsertSpannedRow" ); + OSL_ENSURE( nCnt && nRowIdx < GetTabLines().size(), "Wrong call of InsertSpannedRow" ); SwSelBoxes aBoxes; SwTableLine& rLine = *GetTabLines()[ nRowIdx ]; lcl_FillSelBoxes( aBoxes, rLine ); @@ -1560,7 +1560,7 @@ void SwTable::PrepareDelBoxes( const SwSelBoxes& rBoxes ) OSL_ENSURE( nLinePos < USHRT_MAX, "Box/table mismatch" ); if( nRowSpan > 1 ) { - if( ++nLinePos < GetTabLines().Count() ) + if( ++nLinePos < GetTabLines().size() ) { pLine = GetTabLines()[ nLinePos ]; pBox = lcl_LeftBorder2Box( nLeft, pLine ); @@ -1652,7 +1652,7 @@ void SwTable::CreateSelection( const SwPaM& rPam, SwSelBoxes& rBoxes, const SearchType eSearch, bool bChkProtected ) const { OSL_ENSURE( bNewModel, "Don't call me for old tables" ); - if( !aLines.Count() ) + if( aLines.empty() ) return; const SwNode* pStartNd = rPam.GetPoint()->nNode.GetNode().FindTableBoxStartNode(); const SwNode* pEndNd = rPam.GetMark()->nNode.GetNode().FindTableBoxStartNode(); @@ -1674,7 +1674,7 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd, rBoxes.Remove( sal_uInt16(0), rBoxes.Count() ); } // Looking for start and end of the selection given by SwNode-pointer - sal_uInt16 nLines = aLines.Count(); + sal_uInt16 nLines = aLines.size(); // nTop becomes the line number of the upper box // nBottom becomes the line number of the lower box sal_uInt16 nTop = 0, nBottom = 0; @@ -1804,10 +1804,10 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax OSL_ENSURE( bNewModel, "Don't call me for old tables" ); rMin = 0; rMax = 0; - if( !aLines.Count() || !rBoxes.Count() ) + if( aLines.empty() || !rBoxes.Count() ) return; - sal_uInt16 nLineCnt = aLines.Count(); + sal_uInt16 nLineCnt = aLines.size(); sal_uInt16 nBoxCnt = rBoxes.Count(); sal_uInt16 nBox = 0; for( sal_uInt16 nRow = 0; nRow < nLineCnt && nBox < nBoxCnt; ++nRow ) @@ -1851,13 +1851,13 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax void SwTable::PrepareDeleteCol( long nMin, long nMax ) { OSL_ENSURE( bNewModel, "Don't call me for old tables" ); - if( !aLines.Count() || nMax < nMin ) + if( aLines.empty() || nMax < nMin ) return; long nMid = nMin ? ( nMin + nMax ) / 2 : 0; const SwTwips nTabSize = GetFrmFmt()->GetFrmSize().GetWidth(); if( nTabSize == nMax ) nMid = nMax; - sal_uInt16 nLineCnt = aLines.Count(); + sal_uInt16 nLineCnt = aLines.size(); for( sal_uInt16 nRow = 0; nRow < nLineCnt; ++nRow ) { SwTableLine* pLine = aLines[nRow]; @@ -1919,11 +1919,11 @@ void SwTable::ExpandSelection( SwSelBoxes& rBoxes ) const the previous line. */ -void SwTable::CheckRowSpan( SwTableLinePtr &rpLine, bool bUp ) const +void SwTable::CheckRowSpan( SwTableLine* &rpLine, bool bUp ) const { OSL_ENSURE( IsNewModel(), "Don't call me for old tables" ); - sal_uInt16 nLineIdx = GetTabLines().C40_GETPOS( SwTableLine, rpLine ); - OSL_ENSURE( nLineIdx < GetTabLines().Count(), "Start line out of range" ); + sal_uInt16 nLineIdx = GetTabLines().GetPos( rpLine ); + OSL_ENSURE( nLineIdx < GetTabLines().size(), "Start line out of range" ); bool bChange = true; if( bUp ) { @@ -1952,7 +1952,7 @@ void SwTable::CheckRowSpan( SwTableLinePtr &rpLine, bool bUp ) const } else { - sal_uInt16 nMaxLine = GetTabLines().Count(); + sal_uInt16 nMaxLine = GetTabLines().size(); while( bChange ) { bChange = false; @@ -2011,7 +2011,7 @@ void SwTable::RestoreRowSpan( const SwSaveRowSpan& rSave ) { if( !IsNewModel() ) // for new model only return; - sal_uInt16 nLineCount = GetTabLines().Count(); + sal_uInt16 nLineCount = GetTabLines().size(); OSL_ENSURE( rSave.mnSplitLine < nLineCount, "Restore behind last line?" ); if( rSave.mnSplitLine < nLineCount ) { @@ -2079,7 +2079,7 @@ void SwTable::CleanUpBottomRowSpan( sal_uInt16 nDelLines ) { if( !IsNewModel() ) return; - sal_uInt16 nLastLine = GetTabLines().Count()-1; + sal_uInt16 nLastLine = GetTabLines().size()-1; SwTableLine* pLine = GetTabLines()[nLastLine]; sal_uInt16 nColCount = pLine->GetTabBoxes().size(); OSL_ENSURE( nColCount, "Empty Table Line" ); @@ -2111,7 +2111,7 @@ void SwTable::CheckConsistency() const { if( !IsNewModel() ) return; - sal_uInt16 nLineCount = GetTabLines().Count(); + sal_uInt16 nLineCount = GetTabLines().size(); const SwTwips nTabSize = GetFrmFmt()->GetFrmSize().GetWidth(); SwTwips nLineWidth = 0; std::list< RowSpanCheck > aRowSpanCells; diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 3a57a7586b4f..277efde8a6d5 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -82,7 +82,6 @@ TYPEINIT1( SwTableFmt, SwFrmFmt ); TYPEINIT1( SwTableBoxFmt, SwFrmFmt ); TYPEINIT1( SwTableLineFmt, SwFrmFmt ); -SV_IMPL_PTRARR(SwTableLines,SwTableLine*); SV_IMPL_PTRARR_SORT(SwTableSortBoxes,SwTableBoxPtr); SV_IMPL_REF( SwServerObject ) @@ -335,7 +334,7 @@ void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld, void lcl_ModifyLines( SwTableLines &rLines, const long nOld, const long nNew, SvPtrarr& rFmtArr, const bool bCheckSum ) { - for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.size(); ++i ) ::lcl_ModifyBoxes( rLines[i]->GetTabBoxes(), nOld, nNew, rFmtArr ); if( bCheckSum ) { @@ -361,7 +360,7 @@ void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld, for ( sal_uInt16 i = 0; i < rBoxes.size(); ++i ) { SwTableBox &rBox = *rBoxes[i]; - if ( rBox.GetTabLines().Count() ) + if ( !rBox.GetTabLines().empty() ) { // For SubTables the rounding problem will not be solved :-( ::lcl_ModifyLines( rBox.GetTabLines(), nOld, nNew, rFmtArr, false ); @@ -565,10 +564,10 @@ void lcl_SortedTabColInsert( SwTabCols &rToFill, const SwTableBox *pBox, void lcl_ProcessBoxGet( const SwTableBox *pBox, SwTabCols &rToFill, const SwFrmFmt *pTabFmt, bool bRefreshHidden ) { - if ( pBox->GetTabLines().Count() ) + if ( !pBox->GetTabLines().empty() ) { const SwTableLines &rLines = pBox->GetTabLines(); - for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.size(); ++i ) { const SwTableBoxes &rBoxes = rLines[i]->GetTabBoxes(); for ( sal_uInt16 j = 0; j < rBoxes.size(); ++j ) ::lcl_ProcessBoxGet( rBoxes[j], rToFill, pTabFmt, bRefreshHidden); @@ -587,7 +586,7 @@ void lcl_ProcessLineGet( const SwTableLine *pLine, SwTabCols &rToFill, if ( pBox->GetSttNd() ) ::lcl_SortedTabColInsert( rToFill, pBox, pTabFmt, sal_True, sal_False ); else - for ( sal_uInt16 j = 0; j < pBox->GetTabLines().Count(); ++j ) + for ( sal_uInt16 j = 0; j < pBox->GetTabLines().size(); ++j ) ::lcl_ProcessLineGet( pBox->GetTabLines()[j], rToFill, pTabFmt ); } } @@ -662,7 +661,7 @@ void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart, //4. if ( !bCurRowOnly ) { - for ( i = 0; i < aLines.Count(); ++i ) + for ( i = 0; i < aLines.size(); ++i ) ::lcl_ProcessLineGet( aLines[i], rToFill, pTabFmt ); } @@ -719,9 +718,9 @@ void lcl_ProcessLine( SwTableLine *pLine, Parm &rParm ) void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) { - if ( pBox->GetTabLines().Count() ) + if ( !pBox->GetTabLines().empty() ) { SwTableLines &rLines = pBox->GetTabLines(); - for ( int i = rLines.Count()-1; i >= 0; --i ) + for ( int i = rLines.size()-1; i >= 0; --i ) lcl_ProcessLine( rLines[ static_cast< sal_uInt16 >(i) ], rParm ); } else @@ -843,8 +842,7 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) // The outer cells of the last row are responsible to adjust a surrounding cell. // Last line check: if ( pBox->GetUpper()->GetUpper() && - pBox->GetUpper() != pBox->GetUpper()->GetUpper()->GetTabLines() - [pBox->GetUpper()->GetUpper()->GetTabLines().Count()-1]) + pBox->GetUpper() != pBox->GetUpper()->GetUpper()->GetTabLines().back()) { pBox = 0; } @@ -867,10 +865,10 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) void lcl_ProcessBoxPtr( SwTableBox *pBox, SvPtrarr &rBoxArr, sal_Bool bBefore ) { - if ( pBox->GetTabLines().Count() ) + if ( !pBox->GetTabLines().empty() ) { const SwTableLines &rLines = pBox->GetTabLines(); - for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.size(); ++i ) { const SwTableBoxes &rBoxes = rLines[i]->GetTabBoxes(); for ( sal_uInt16 j = 0; j < rBoxes.size(); ++j ) @@ -887,7 +885,7 @@ void lcl_AdjustBox( SwTableBox *pBox, const long nDiff, Parm &rParm ); void lcl_AdjustLines( SwTableLines &rLines, const long nDiff, Parm &rParm ) { - for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.size(); ++i ) { SwTableBox *pBox = rLines[i]->GetTabBoxes() [rLines[i]->GetTabBoxes().size()-1]; @@ -897,7 +895,7 @@ void lcl_AdjustLines( SwTableLines &rLines, const long nDiff, Parm &rParm ) void lcl_AdjustBox( SwTableBox *pBox, const long nDiff, Parm &rParm ) { - if ( pBox->GetTabLines().Count() ) + if ( !pBox->GetTabLines().empty() ) ::lcl_AdjustLines( pBox->GetTabLines(), nDiff, rParm ); //Groesse der Box anpassen. @@ -1050,7 +1048,7 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, //Um uns nicht selbst hereinzulegen muss natuerlich rueckwaerst //gearbeitet werden! SwTableLines &rLines = GetTabLines(); - for ( int i = rLines.Count()-1; i >= 0; --i ) + for ( int i = rLines.size()-1; i >= 0; --i ) ::lcl_ProcessLine( rLines[ static_cast< sal_uInt16 >(i) ], aParm ); } } @@ -1331,7 +1329,7 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, }; aRowSpanPos.clear(); } - if( nCurr+1 < rLines.Count() ) + if( nCurr+1 < (sal_uInt16)rLines.size() ) { ChangeList aCopy; ChangeList::iterator pCop = aOldNew.begin(); @@ -1351,12 +1349,12 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[++j], rParm.nOldWish, nOldWidth, false ); lcl_AdjustWidthsInLine( rLines[j], aCopy, rParm, 0 ); - bGoOn = !aRowSpanPos.empty() && j+1 < rLines.Count(); + bGoOn = !aRowSpanPos.empty() && j+1 < (sal_uInt16)rLines.size(); }; } ::lcl_AdjustWidthsInLine( rLines[nCurr], aOldNew, rParm, COLFUZZY ); } - else for( sal_uInt16 i = 0; i < rLines.Count(); ++i ) + else for( sal_uInt16 i = 0; i < rLines.size(); ++i ) ::lcl_AdjustWidthsInLine( rLines[i], aOldNew, rParm, COLFUZZY ); CHECK_TABLE( *this ) } @@ -1459,7 +1457,7 @@ const SwTableBox* SwTable::GetTblBox( const String& rName, nLine = SwTable::_GetBoxNum( aNm, sal_False, bPerformValidCheck ); // bestimme die Line - if( !nLine || nLine > pLines->Count() ) + if( !nLine || nLine > pLines->size() ) return 0; pLine = (*pLines)[ nLine-1 ]; @@ -1476,8 +1474,8 @@ const SwTableBox* SwTable::GetTblBox( const String& rName, { OSL_FAIL( "Box ohne Inhalt, suche die naechste !!" ); // "herunterfallen lassen" bis zur ersten Box - while( pBox->GetTabLines().Count() ) - pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0]; + while( !pBox->GetTabLines().empty() ) + pBox = pBox->GetTabLines().front()->GetTabBoxes().front(); } return pBox; } @@ -1701,18 +1699,19 @@ SwTwips SwTableLine::GetTableLineHeight( bool& bLayoutAvailable ) const |*************************************************************************/ SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, sal_uInt16 nLines, SwTableLine *pUp ) : SwClient( 0 ), - aLines( (sal_uInt8)nLines ), + aLines(), pSttNd( 0 ), pUpper( pUp ), pImpl( 0 ) { + aLines.reserve( (sal_uInt8)nLines ); CheckBoxFmt( pFmt )->Add( this ); } SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, const SwNodeIndex &rIdx, SwTableLine *pUp ) : SwClient( 0 ), - aLines( 0 ), + aLines(), pUpper( pUp ), pImpl( 0 ) { @@ -1731,7 +1730,7 @@ SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, const SwNodeIndex &rIdx, SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, const SwStartNode& rSttNd, SwTableLine *pUp ) : SwClient( 0 ), - aLines( 0 ), + aLines(), pSttNd( &rSttNd ), pUpper( pUp ), pImpl( 0 ) @@ -2826,4 +2825,11 @@ void SwTableBox::ForgetFrmFmt() GetRegisteredInNonConst()->Remove(this); } +// free's any remaining child objects +SwTableLines::~SwTableLines() +{ + for ( const_iterator it = begin(); it != end(); ++it ) + delete *it; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 95b15f3e6ce9..1c88e0fbfda5 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -549,7 +549,7 @@ SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd, SwTableBoxFmt* pBoxFmt = GetDoc()->MakeTableBoxFmt(); SwTableLineFmt* pLineFmt = GetDoc()->MakeTableLineFmt(); SwTableLine* pLine = new SwTableLine( pLineFmt, rSavedData.size(), 0 ); - pTblNd->GetTable().GetTabLines().C40_INSERT( SwTableLine, pLine, 0 ); + pTblNd->GetTable().GetTabLines().insert( pTblNd->GetTable().GetTabLines().begin(), pLine ); std::vector<sal_uLong> aBkmkArr; for( sal_uInt16 n = rSavedData.size(); n; ) @@ -885,7 +885,7 @@ _SaveTable::_SaveTable( const SwTable& rTbl, sal_uInt16 nLnCnt, sal_Bool bSaveFm _SaveLine* pLn = pLine; if( USHRT_MAX == nLnCnt ) - nLnCnt = rTbl.GetTabLines().Count(); + nLnCnt = rTbl.GetTabLines().size(); for( sal_uInt16 n = 1; n < nLnCnt; ++n ) pLn = new _SaveLine( pLn, *rTbl.GetTabLines()[ n ], *this ); @@ -964,7 +964,7 @@ void _SaveTable::RestoreAttr( SwTable& rTbl, sal_Bool bMdfyBox ) sal_uInt16 nLnCnt = nLineCount; if( USHRT_MAX == nLnCnt ) - nLnCnt = rTbl.GetTabLines().Count(); + nLnCnt = rTbl.GetTabLines().size(); _SaveLine* pLn = pLine; for( n = 0; n < nLnCnt; ++n, pLn = pLn->pNext ) @@ -1008,7 +1008,7 @@ void _SaveTable::CreateNew( SwTable& rTbl, sal_Bool bCreateFrms, } // SwTableBox must have a format - SwTableBox aParent( (SwTableBoxFmt*)pFmt, rTbl.GetTabLines().Count(), 0 ); + SwTableBox aParent( (SwTableBoxFmt*)pFmt, rTbl.GetTabLines().size(), 0 ); // fill FrmFmts with defaults (0) pFmt = 0; @@ -1021,11 +1021,11 @@ void _SaveTable::CreateNew( SwTable& rTbl, sal_Bool bCreateFrms, // add new lines, delete old ones sal_uInt16 nOldLines = nLineCount; if( USHRT_MAX == nLineCount ) - nOldLines = rTbl.GetTabLines().Count(); + nOldLines = rTbl.GetTabLines().size(); SwDoc *pDoc = rTbl.GetFrmFmt()->GetDoc(); SwChartDataProvider *pPCD = pDoc->GetChartDataProvider(); - for( n = 0; n < aParent.GetTabLines().Count(); ++n ) + for( n = 0; n < aParent.GetTabLines().size(); ++n ) { SwTableLine* pLn = aParent.GetTabLines()[ n ]; pLn->SetUpper( 0 ); @@ -1043,11 +1043,11 @@ void _SaveTable::CreateNew( SwTable& rTbl, sal_Bool bCreateFrms, pPCD->DeleteBox( &rTbl, *pBox ); } - rTbl.GetTabLines().C40_REPLACE( SwTableLine, pLn, n ); + rTbl.GetTabLines()[n] = pLn; delete pOld; } else - rTbl.GetTabLines().C40_INSERT( SwTableLine, pLn, n ); + rTbl.GetTabLines().insert( rTbl.GetTabLines().begin() + n, pLn ); } if( n < nOldLines ) @@ -1066,10 +1066,13 @@ void _SaveTable::CreateNew( SwTable& rTbl, sal_Bool bCreateFrms, } } - rTbl.GetTabLines().DeleteAndDestroy( n, nOldLines - n ); + for( SwTableLines::const_iterator it = rTbl.GetTabLines().begin() + n; + it != rTbl.GetTabLines().begin() + nOldLines; ++it ) + delete *it; + rTbl.GetTabLines().erase( rTbl.GetTabLines().begin() + n, rTbl.GetTabLines().begin() + nOldLines ); } - aParent.GetTabLines().Remove( 0, n ); + aParent.GetTabLines().erase( aParent.GetTabLines().begin(), aParent.GetTabLines().begin() + n ); if( bCreateFrms ) aTmpBox.MakeFrms( rTbl ); @@ -1187,7 +1190,7 @@ void _SaveLine::CreateNew( SwTable& rTbl, SwTableBox& rParent, _SaveTable& rSTbl } SwTableLine* pNew = new SwTableLine( pFmt, 1, &rParent ); - rParent.GetTabLines().C40_INSERT( SwTableLine, pNew, rParent.GetTabLines().Count() ); + rParent.GetTabLines().push_back( pNew ); // HB, #127868# robustness: in some cases - which I // cannot reproduce nor see from the code - pNew seems @@ -1223,7 +1226,7 @@ _SaveBox::_SaveBox( _SaveBox* pPrev, const SwTableBox& rBox, _SaveTable& rSTbl ) Ptrs.pLine = new _SaveLine( 0, *rBox.GetTabLines()[ 0 ], rSTbl ); _SaveLine* pLn = Ptrs.pLine; - for( sal_uInt16 n = 1; n < rBox.GetTabLines().Count(); ++n ) + for( sal_uInt16 n = 1; n < rBox.GetTabLines().size(); ++n ) pLn = new _SaveLine( pLn, *rBox.GetTabLines()[ n ], rSTbl ); } } @@ -1243,14 +1246,14 @@ void _SaveBox::RestoreAttr( SwTableBox& rBox, _SaveTable& rSTbl ) if( ULONG_MAX == nSttNode ) // no EndBox { - if( !rBox.GetTabLines().Count() ) + if( !rBox.GetTabLines().size() ) { OSL_ENSURE( !this, "Number of lines changed" ); } else { _SaveLine* pLn = Ptrs.pLine; - for( sal_uInt16 n = 0; n < rBox.GetTabLines().Count(); ++n, pLn = pLn->pNext ) + for( sal_uInt16 n = 0; n < rBox.GetTabLines().size(); ++n, pLn = pLn->pNext ) { if( !pLn ) { diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index e64ccfeadd55..82b7468b8234 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -720,8 +720,8 @@ uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createData { // get a character map in the size of the table to mark // all the ranges to use in - sal_Int32 nRows = pTable->GetTabLines().Count(); - sal_Int32 nCols = pTable->GetTabLines().GetObject(0)->GetTabBoxes().size(); + sal_Int32 nRows = pTable->GetTabLines().size(); + sal_Int32 nCols = pTable->GetTabLines().front()->GetTabBoxes().size(); std::vector< std::vector< sal_Char > > aMap( nRows ); for (sal_Int32 i = 0; i < nRows; ++i) aMap[i].resize( nCols ); @@ -1206,8 +1206,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArgume GetTableByName( *pDoc, aTableName, &pTableFmt, &pTable ); if (!pTable || pTable->IsTblComplex()) return aResult; // failed -> return empty property sequence - nTableRows = pTable->GetTabLines().Count(); - nTableCols = pTable->GetTabLines().GetObject(0)->GetTabBoxes().size(); + nTableRows = pTable->GetTabLines().size(); + nTableCols = pTable->GetTabLines().front()->GetTabBoxes().size(); aMap.resize( nTableRows ); for (sal_Int32 i = 0; i < nTableRows; ++i) aMap[i].resize( nTableCols ); diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 1de094b9872b..27064efb4d4a 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -495,10 +495,10 @@ const SwTableBox* lcl_FindCornerTableBox(const SwTableLines& rTableLines, const { const SwTableLines& rLines(bFirst ? rTableLines : pBox->GetTabLines()); bFirst = false; - OSL_ASSERT(rLines.Count() != 0); - if (rLines.Count() != 0) + OSL_ASSERT(rLines.size() != 0); + if (!rLines.empty()) { - const SwTableLine* pLine(rLines[i_bTopLeft ? 0 : rLines.Count() - 1]); + const SwTableLine* pLine(i_bTopLeft ? rLines.front() : rLines.back()); OSL_ASSERT(pLine); const SwTableBoxes& rBoxes(pLine->GetTabBoxes()); OSL_ASSERT(rBoxes.size() != 0); @@ -564,7 +564,7 @@ SwXCell* lcl_CreateXCell(SwFrmFmt* pFmt, sal_Int32 nColumn, sal_Int32 nRow) void lcl_InspectLines(SwTableLines& rLines, std::vector<String*>& rAllNames) { - for( sal_uInt16 i = 0; i < rLines.Count(); i++ ) + for( sal_uInt16 i = 0; i < rLines.size(); i++ ) { SwTableLine* pLine = rLines[i]; SwTableBoxes& rBoxes = pLine->GetTabBoxes(); @@ -574,7 +574,7 @@ void lcl_InspectLines(SwTableLines& rLines, std::vector<String*>& rAllNames) if(pBox->GetName().Len() && pBox->getRowSpan() > 0 ) rAllNames.push_back( new String(pBox->GetName()) ); SwTableLines& rBoxLines = pBox->GetTabLines(); - if(rBoxLines.Count()) + if(!rBoxLines.empty()) { lcl_InspectLines(rBoxLines, rAllNames); } @@ -1465,8 +1465,8 @@ SwTableLine* SwXTextTableRow::FindLine(SwTable* pTable, SwTableLine* pLine) { SwTableLine* pRet = 0; SwTableLines &rLines = pTable->GetTabLines(); - for(sal_uInt16 i = 0; i < rLines.Count(); i++) - if(rLines.GetObject(i) == pLine) + for(sal_uInt16 i = 0; i < rLines.size(); i++) + if(rLines[i] == pLine) { pRet = pLine; break; @@ -3145,9 +3145,9 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, SwTable* pTable = SwTable::FindTable( pFmt ); SwTableLines &rLines = pTable->GetTabLines(); pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_START, NULL); - for(sal_uInt16 i = 0; i < rLines.Count(); i++) + for(sal_uInt16 i = 0; i < rLines.size(); i++) { - SwTableLine* pLine = rLines.GetObject(i); + SwTableLine* pLine = rLines[i]; SwTableBoxes& rBoxes = pLine->GetTabBoxes(); for(sal_uInt16 k = 0; k < rBoxes.size(); k++) { @@ -3316,9 +3316,9 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( be sal_uInt16 nTopDistance = 0; sal_uInt16 nBottomDistance = 0; - for(sal_uInt16 i = 0; i < rLines.Count(); i++) + for(sal_uInt16 i = 0; i < rLines.size(); i++) { - const SwTableLine* pLine = rLines.GetObject(i); + const SwTableLine* pLine = rLines[i]; const SwTableBoxes& rBoxes = pLine->GetTabBoxes(); for(sal_uInt16 k = 0; k < rBoxes.size(); k++) { @@ -3520,7 +3520,7 @@ sal_uInt16 SwXTextTable::getRowCount(void) SwTable* pTable = SwTable::FindTable( pFmt ); if(!pTable->IsTblComplex()) { - nRet = pTable->GetTabLines().Count(); + nRet = pTable->GetTabLines().size(); } } return nRet; @@ -3537,7 +3537,7 @@ sal_uInt16 SwXTextTable::getColumnCount(void) if(!pTable->IsTblComplex()) { SwTableLines& rLines = pTable->GetTabLines(); - SwTableLine* pLine = rLines.GetObject(0); + SwTableLine* pLine = rLines.front(); nRet = pLine->GetTabBoxes().size(); } } @@ -4624,7 +4624,7 @@ sal_Int32 SwXTableRows::getCount(void) throw( uno::RuntimeException ) else { SwTable* pTable = SwTable::FindTable( pFrmFmt ); - nRet = pTable->GetTabLines().Count(); + nRet = pTable->GetTabLines().size(); } return nRet; } @@ -4640,9 +4640,9 @@ uno::Any SwXTableRows::getByIndex(sal_Int32 nIndex) else { SwTable* pTable = SwTable::FindTable( pFrmFmt ); - if(pTable->GetTabLines().Count() > nIndex) + if( (sal_uInt16)pTable->GetTabLines().size() > nIndex) { - SwTableLine* pLine = pTable->GetTabLines().GetObject((sal_uInt16)nIndex); + SwTableLine* pLine = pTable->GetTabLines()[(sal_uInt16)nIndex]; SwIterator<SwXTextTableRow,SwFmt> aIter( *pFrmFmt ); SwXTextTableRow* pXRow = aIter.First(); while( pXRow ) @@ -4693,7 +4693,7 @@ void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno: SwTable* pTable = SwTable::FindTable( pFrmFmt ); if(!pTable->IsTblComplex()) { - sal_uInt16 nRowCount = pTable->GetTabLines().Count(); + sal_uInt16 nRowCount = pTable->GetTabLines().size(); if (nCount <= 0 || !(0 <= nIndex && nIndex <= nRowCount)) { uno::RuntimeException aExcept; @@ -4709,7 +4709,7 @@ void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno: bAppend = sal_True; // am Ende anfuegen, dazu muss der Cursor in die letzte Zeile! SwTableLines& rLines = pTable->GetTabLines(); - SwTableLine* pLine = rLines.GetObject(rLines.Count() -1); + SwTableLine* pLine = rLines.back(); SwTableBoxes& rBoxes = pLine->GetTabBoxes(); pTLBox = rBoxes.front(); } @@ -4844,7 +4844,7 @@ sal_Int32 SwXTableColumns::getCount(void) throw( uno::RuntimeException ) if(!pTable->IsTblComplex()) { SwTableLines& rLines = pTable->GetTabLines(); - SwTableLine* pLine = rLines.GetObject(0); + SwTableLine* pLine = rLines.front(); nRet = pLine->GetTabBoxes().size(); } } @@ -4866,7 +4866,7 @@ uno::Any SwXTableColumns::getByIndex(sal_Int32 nIndex) if(!pTable->IsTblComplex()) { SwTableLines& rLines = pTable->GetTabLines(); - SwTableLine* pLine = rLines.GetObject(0); + SwTableLine* pLine = rLines.front(); nCount = pLine->GetTabBoxes().size(); } if(nCount <= nIndex || nIndex < 0) @@ -4904,7 +4904,7 @@ void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( u if(!pTable->IsTblComplex()) { SwTableLines& rLines = pTable->GetTabLines(); - SwTableLine* pLine = rLines.GetObject(0); + SwTableLine* pLine = rLines.front(); sal_uInt16 nColCount = pLine->GetTabBoxes().size(); if (nCount <= 0 || !(0 <= nIndex && nIndex <= nColCount)) { diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 583b167a05b2..04ffd12434f9 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -1882,7 +1882,7 @@ SwTableBox *HTMLTable::MakeTableBox( SwTableLine *pUpper, bFirstPara, 0==pCnts->Next() ); pLine->GetTabBoxes().push_back( pCntBox ); - rLines.C40_INSERT( SwTableLine, pLine, rLines.Count() ); + rLines.push_back( pLine ); } else { @@ -2423,7 +2423,7 @@ void HTMLTable::_MakeTable( SwTableBox *pBox ) { SwTableLine *pLine = MakeTableLine( pBox, i, 0, i+1, nCols ); if( pBox || i > 0 ) - rLines.C40_INSERT( SwTableLine, pLine, rLines.Count() ); + rLines.push_back( pLine ); } } @@ -2611,7 +2611,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail, SwTableLine *pLine = new SwTableLine( pLineFrmFmtNoHeight ? pLineFrmFmtNoHeight : pLineFmt, 0, pBox ); - rLines.C40_INSERT( SwTableLine, pLine, rLines.Count() ); + rLines.push_back( pLine ); // Sicherstellen, dass wie ein Format ohne Hoehe erwischt haben if( !pLineFrmFmtNoHeight ) @@ -2675,7 +2675,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail, // Top-Level-Tabelle durch if( this==pTopTable ) { - if( 1==nRows && nHeight && 1==pSwTable->GetTabLines().Count() ) + if( 1==nRows && nHeight && 1==pSwTable->GetTabLines().size() ) { // Hoehe einer einzeiligen Tabelle als Mindesthoehe der // Zeile setzen. (War mal fixe Hoehe, aber das gibt manchmal diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index e2e1903ddafe..16ad4f2c7324 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -160,7 +160,7 @@ sal_Bool SwHTMLWrtTable::HasTabBackground( const SwTableBox& rBox, else { const SwTableLines& rLines = rBox.GetTabLines(); - sal_uInt16 nCount = rLines.Count(); + sal_uInt16 nCount = rLines.size(); sal_Bool bLeftRight = bLeft || bRight; for( sal_uInt16 i=0; !bRet && i<nCount; i++ ) { @@ -204,7 +204,7 @@ sal_Bool SwHTMLWrtTable::HasTabBackground( const SwTableLine& rLine, return bRet; } -static sal_Bool lcl_TableLine_HasTabBorders( const SwTableLine*& rpLine, void* pPara ); +static sal_Bool lcl_TableLine_HasTabBorders( const SwTableLine* pLine, sal_Bool *pBorders ); static sal_Bool lcl_TableBox_HasTabBorders( const SwTableBox* pBox, sal_Bool *pBorders ) { @@ -213,8 +213,12 @@ static sal_Bool lcl_TableBox_HasTabBorders( const SwTableBox* pBox, sal_Bool *pB if( !pBox->GetSttNd() ) { - ((SwTableBox *)pBox)->GetTabLines().ForEach( - &lcl_TableLine_HasTabBorders, (void*)pBorders ); + for( SwTableLines::const_iterator it = pBox->GetTabLines().begin(); + it != pBox->GetTabLines().end(); ++it) + { + if ( lcl_TableLine_HasTabBorders( *it, pBorders ) ) + break; + } } else { @@ -228,16 +232,15 @@ static sal_Bool lcl_TableBox_HasTabBorders( const SwTableBox* pBox, sal_Bool *pB return !*pBorders; } -static sal_Bool lcl_TableLine_HasTabBorders( const SwTableLine*& rpLine, void* pPara ) +static sal_Bool lcl_TableLine_HasTabBorders( const SwTableLine* pLine, sal_Bool *pBorders ) { - sal_Bool *pBorders = (sal_Bool *)pPara; if( *pBorders ) return sal_False; - for( SwTableBoxes::const_iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); - it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) + for( SwTableBoxes::const_iterator it = pLine->GetTabBoxes().begin(); + it != pLine->GetTabBoxes().end(); ++it) { - if ( lcl_TableBox_HasTabBorders( *it, (sal_Bool*)pPara ) ) + if ( lcl_TableBox_HasTabBorders( *it, pBorders ) ) break; } return !*pBorders; diff --git a/sw/source/filter/rtf/rtftbl.cxx b/sw/source/filter/rtf/rtftbl.cxx index 1aa7071765e0..73947baca04d 100644 --- a/sw/source/filter/rtf/rtftbl.cxx +++ b/sw/source/filter/rtf/rtftbl.cxx @@ -161,7 +161,7 @@ void SwRTFParser::ReadTable( int nToken ) { bReadNewCell = sal_True; SwTableLines& rLns = pTableNode->GetTable().GetTabLines(); - SwTableLine* pLine = rLns[ rLns.Count()-1 ]; + SwTableLine* pLine = rLns.back(); // very robust to avoid crashes like bug 127425 + crash reports 118743 if( pLine ) { @@ -278,7 +278,7 @@ void SwRTFParser::ReadTable( int nToken ) if( bReadNewCell && aBoxFmts.empty() ) { SwTableLines& rLns = pTableNode->GetTable().GetTabLines(); - SwTableLine* pLine = rLns[ rLns.Count()-1 ]; + SwTableLine* pLine = rLns.back(); if (m_nCurrentBox != 0) { --m_nCurrentBox; @@ -464,7 +464,7 @@ void SwRTFParser::ReadTable( int nToken ) const SwTableLines* pLns = &pTableNode->GetTable().GetTabLines(); - if( 1 == pLns->Count() ) + if( 1 == pLns->size() ) { if( eAdjust != rHoriz.GetHoriOrient() ) { @@ -487,7 +487,7 @@ void SwRTFParser::ReadTable( int nToken ) } else if ( - 1 < pLns->Count() && + 1 < pLns->size() && ( rTblSz.GetWidth() != nTblSz || rHoriz.GetHoriOrient() != eAdjust || @@ -501,10 +501,10 @@ void SwRTFParser::ReadTable( int nToken ) { // Tabelle ab der PaM-Position splitten // die vorherige Line! - pNewLine = (*pLns)[ pLns->Count() - 2 ]; - SwTableBox* pBox = pNewLine->GetTabBoxes()[ 0 ]; - while( ( pLns = &pBox->GetTabLines() )->Count() ) - pBox = (*pLns)[ 0 ]->GetTabBoxes()[ 0 ]; + pNewLine = (*pLns)[ pLns->size() - 2 ]; + SwTableBox* pBox = pNewLine->GetTabBoxes().front(); + while( ( pLns = &pBox->GetTabLines() )->size() ) + pBox = pLns->front()->GetTabBoxes().front(); SwNodeIndex aTmpIdx( *pBox->GetSttNd() ); pDoc->GetNodes().SplitTable( aTmpIdx, HEADLINE_NONE, sal_False ); @@ -524,7 +524,7 @@ void SwRTFParser::ReadTable( int nToken ) } pLns = &pTableNode->GetTable().GetTabLines(); - pNewLine = (*pLns)[ pLns->Count() - 1 ]; + pNewLine = pLns->back(); // jetzt die Boxen abgleichen sal_uInt16 nBoxes = Min( pNewLine->GetTabBoxes().size(), aBoxFmts.size() ); @@ -603,15 +603,15 @@ void SwRTFParser::ReadTable( int nToken ) SwTableLines& rLns = pTableNode->GetTable().GetTabLines(); if( bReadNewCell ) - pNewLine = rLns[ rLns.Count()-1 ]; + pNewLine = rLns.back(); else { pNewLine = new SwTableLine( - (SwTableLineFmt*)rLns[ rLns.Count()-1 ]->GetFrmFmt(), + (SwTableLineFmt*)rLns.back()->GetFrmFmt(), aBoxFmts.size(), 0 ); pNewLine->ClaimFrmFmt(); pNewLine->GetFrmFmt()->ResetFmtAttr( RES_FRM_SIZE ); - rLns.C40_INSERT( SwTableLine, pNewLine, rLns.Count() ); + rLns.push_back( pNewLine ); } bNewTbl = sal_False; } @@ -637,7 +637,7 @@ void SwRTFParser::ReadTable( int nToken ) } SwTableLines& rLns = pTableNode->GetTable().GetTabLines(); - pNewLine = rLns[ rLns.Count()-1 ]; + pNewLine = rLns.back(); SwFrmFmt* pFmt = pTableNode->GetTable().GetFrmFmt(); SwFmtFrmSize aSz( pFmt->GetFrmSize() ); @@ -793,7 +793,7 @@ void SwRTFParser::GotoNextBox() return; SwTableLines& rLns = pTableNode->GetTable().GetTabLines(); - SwTableLine* pLine = rLns[ rLns.Count()-1 ]; + SwTableLine* pLine = rLns.back(); SwTableBoxes& rBoxes = pLine->GetTabBoxes(); SwTableBox* pBox = rBoxes.back(); @@ -847,7 +847,7 @@ void SwRTFParser::NewTblLine() pTableNode = (SwTableNode*)pNd; SwTableLines* pLns = &pTableNode->GetTable().GetTabLines(); - SwTableLine* pLine = (*pLns)[ pLns->Count()-1 ]; + SwTableLine* pLine = pLns->back(); SwTableBoxes& rBoxes = pLine->GetTabBoxes(); SwTableBox* pBox = rBoxes.back(); @@ -878,7 +878,7 @@ void SwRTFParser::NewTblLine() else pTableNode->GetTable().AppendRow( pDoc ); - pBox = (*pLns)[ pLns->Count()-1 ]->GetTabBoxes()[0]; + pBox = pLns->back()->GetTabBoxes().front(); sal_uLong nOldPos = pPam->GetPoint()->nNode.GetIndex(); pPam->GetPoint()->nNode = *pBox->GetSttNd(); @@ -897,7 +897,7 @@ void SwRTFParser::NewTblLine() pPam->SetMark(); - pLine = (*pLns)[ pLns->Count()-1 ]; + pLine = pLns->back(); pBox = pLine->GetTabBoxes().back(); pPam->GetPoint()->nNode = *pBox->GetSttNd()->EndOfSectionNode(); pPam->Move( fnMoveBackward ); diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx index e0a5fb716a31..c82eb772ab78 100644 --- a/sw/source/filter/writer/wrtswtbl.cxx +++ b/sw/source/filter/writer/wrtswtbl.cxx @@ -149,7 +149,7 @@ long SwWriteTable::GetLineHeight( const SwTableLine *pLine ) { long nTmp = 0; const SwTableLines &rLines = pBox->GetTabLines(); - for( sal_uInt16 nLine=0; nLine<rLines.Count(); nLine++ ) + for( sal_uInt16 nLine=0; nLine<rLines.size(); nLine++ ) { nTmp += GetLineHeight( rLines[nLine] ); } @@ -423,7 +423,7 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, sal_uInt16 nDepth ) { sal_Bool bSubExpanded = sal_False; - sal_uInt16 nLines = rLines.Count(); + sal_uInt16 nLines = rLines.size(); #if OSL_DEBUG_LEVEL > 0 sal_uInt32 nEndCPos = 0; @@ -555,7 +555,7 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow, sal_uInt16 nDepth, sal_uInt16 nNumOfHeaderRows ) { - sal_uInt16 nLines = rLines.Count(); + sal_uInt16 nLines = rLines.size(); sal_Bool bSubExpanded = sal_False; // Festlegen der Umrandung diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index 51e0a65ab885..4e155642067b 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -1432,9 +1432,9 @@ SwTableBox* SwFltOutDoc::GetBox(sal_uInt16 ny, sal_uInt16 nx /*= USHRT_MAX */) OSL_FAIL("SwFltOutDoc:GetBox:pTableLines"); return 0; } - if( ny >= pTableLines->Count() ){ // Notbremse + if( ny >= pTableLines->size() ){ // Notbremse OSL_FAIL( "SwFltOutDoc:GetBox:ny >= Count()"); - ny = pTableLines->Count() - 1; + ny = pTableLines->size() - 1; } SwTableLine* pTableLine = (*pTableLines)[ny]; if(!pTableLine){ @@ -1664,9 +1664,9 @@ sal_Bool SwFltOutDoc::SeekCell(short nRow, short nCol, sal_Bool bPam) SwTableBoxes* pTableBoxes = &pTableLine->GetTabBoxes(); SwTableBox* pTableBox = (*pTableBoxes)[usTableX]; - if ((sal_uInt16)nRow >= pTableLines->Count()) + if ((sal_uInt16)nRow >= pTableLines->size()) { - OSL_ENSURE((sal_uInt16)nRow >= pTableLines->Count(), "SwFltOutDoc"); + OSL_ENSURE((sal_uInt16)nRow >= pTableLines->size(), "SwFltOutDoc"); return sal_False; } pTableLine = (*pTableLines)[nRow]; diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index c7bd2261a14f..41920e67193f 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -644,7 +644,7 @@ void WW8TableInfo::processSwTable(const SwTable * pTable) { const SwTableLines & rLines = pTable->GetTabLines(); - for (sal_uInt16 n = 0; n < rLines.Count(); n++) + for (sal_uInt16 n = 0; n < rLines.size(); n++) { const SwTableLine * pLine = rLines[n]; @@ -710,9 +710,9 @@ WW8TableInfo::processTableBoxLines(const SwTableBox * pBox, const SwTableLines & rLines = pBox->GetTabLines(); WW8TableNodeInfo::Pointer_t pNodeInfo; - if (rLines.Count() > 0) + if (!rLines.empty()) { - for (sal_uInt32 n = 0; n < rLines.Count(); n++) + for (sal_uInt32 n = 0; n < rLines.size(); n++) { const SwTableLine * pLine = rLines[n]; const SwTableBoxes & rBoxes = pLine->GetTabBoxes(); @@ -768,14 +768,14 @@ WW8TableInfo::processTableBox(const SwTable * pTable, const SwStartNode * pSttNd = pBox->GetSttNd(); WW8TableNodeInfo::Pointer_t pEndOfCellInfo; - if (rLines.Count() > 0) + if (!rLines.empty()) { pNodeInfo = processTableBoxLines(pBox, pTable, pBox, nRow, nCell, nDepth); pNodeInfo->setEndOfCell(true); if (bEndOfLine) pNodeInfo->setEndOfLine(true); - for (sal_uInt32 n = 0; n < rLines.Count(); n++) + for (sal_uInt32 n = 0; n < rLines.size(); n++) { const SwTableLine * pLine = rLines[n]; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index ba5046354318..17d67edb613e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -327,7 +327,7 @@ void DocxAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointe const SwTable *pTable = pInner->getTable( ); const SwTableLines& rLines = pTable->GetTabLines( ); - sal_uInt16 nLinesCount = rLines.Count( ); + sal_uInt16 nLinesCount = rLines.size( ); // HACK // msoffice seems to have an internal limitation of 63 columns for tables // and refuses to load .docx with more, even though the spec seems to allow that; diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index c8efc8270c2a..b3d44ed97eaa 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1024,7 +1024,7 @@ void RtfAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointer const SwTable *pTable = pInner->getTable( ); const SwTableLines& rLines = pTable->GetTabLines( ); - sal_uInt16 nLinesCount = rLines.Count( ); + sal_uInt16 nLinesCount = rLines.size( ); if ( pInner->isEndOfCell() ) EndTableCell(); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 988c3d0efece..2874d4445fa9 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2297,7 +2297,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) else if ( bDontSplit ) { // check if pLine isn't last line in table - if ( rTable.GetTabLines().Count() - rTable.GetTabLines().GetPos( pLine ) != 1 ) + if ( rTable.GetTabLines().size() - rTable.GetTabLines().GetPos( pLine ) != 1 ) bSetAtPara = true; } diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 1b5bd7588a0b..345347f25ef6 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -2567,9 +2567,9 @@ void WW8TabDesc::MergeCells() // // ggfs. eine neue Merge-Gruppe beginnen // - OSL_ENSURE(nRow < pTabLines->Count(), + OSL_ENSURE(nRow < (sal_uInt16)pTabLines->size(), "Too few lines, table ended early"); - if (nRow >= pTabLines->Count()) + if (nRow >= (sal_uInt16)pTabLines->size()) return; pTabLine = (*pTabLines)[ nRow ]; pTabBoxes = &pTabLine->GetTabBoxes(); @@ -2678,7 +2678,7 @@ void WW8TabDesc::ParkPaM() { SwTableBox *pTabBox2 = 0; short nRow = nAktRow + 1; - if (nRow < pTabLines->Count()) + if (nRow < (sal_uInt16)pTabLines->size()) { if (SwTableLine *pLine = (*pTabLines)[nRow]) { @@ -2825,7 +2825,7 @@ bool WW8TabDesc::IsValidCell(short nCol) const { return (static_cast<size_t>(nCol) < SAL_N_ELEMENTS(pActBand->bExist)) && pActBand->bExist[nCol] && - (sal_uInt16)nAktRow < pTabLines->Count(); + (sal_uInt16)nAktRow < pTabLines->size(); } bool WW8TabDesc::InFirstParaInCell() const @@ -2869,7 +2869,7 @@ bool WW8TabDesc::SetPamInCell(short nWwCol, bool bPam) sal_uInt16 nCol = pActBand->transCell(nWwCol); - if ((sal_uInt16)nAktRow >= pTabLines->Count()) + if ((sal_uInt16)nAktRow >= pTabLines->size()) { OSL_ENSURE(!this, "Actual row bigger than expected." ); if (bPam) diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index ba8d4a9e5223..2763c97b0de4 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -59,6 +59,7 @@ #include "unotbl.hxx" #include "xmltexte.hxx" #include "xmlexp.hxx" +#include <boost/foreach.hpp> using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -138,7 +139,7 @@ SwXMLTableLines_Impl::SwXMLTableLines_Impl( const SwTableLines& rLines ) : #if OSL_DEBUG_LEVEL > 0 sal_uInt32 nEndCPos = 0U; #endif - sal_uInt16 nLines = rLines.Count(); + sal_uInt16 nLines = rLines.size(); sal_uInt16 nLine; for( nLine=0U; nLine<nLines; nLine++ ) { @@ -656,7 +657,7 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines, } // pass 3: export line/rows - sal_uInt16 nLines = rLines.Count(); + sal_uInt16 nLines = rLines.size(); for( sal_uInt16 nLine=0U; nLine<nLines; nLine++ ) { SwTableLine *pLine = rLines[nLine]; @@ -1083,7 +1084,7 @@ void SwXMLExport::ExportTableLines( const SwTableLines& rLines, } // pass 3: export line/rows - sal_uInt16 nLines = rLines.Count(); + sal_uInt16 nLines = rLines.size(); // export header rows, if present if( nHeaderRows > 0 ) { @@ -1103,14 +1104,14 @@ void SwXMLExport::ExportTableLines( const SwTableLines& rLines, delete pLines; } -sal_Bool lcl_xmltble_ClearName_Line( const SwTableLine*& rpLine, void* ); +static void lcl_xmltble_ClearName_Line( SwTableLine* pLine ); static void lcl_xmltble_ClearName_Box( SwTableBox* pBox ) { if( !pBox->GetSttNd() ) { - ((SwTableBox *)pBox)->GetTabLines().ForEach( - &lcl_xmltble_ClearName_Line, 0 ); + BOOST_FOREACH( SwTableLine* pLine, pBox->GetTabLines() ) + lcl_xmltble_ClearName_Line( pLine ); } else { @@ -1120,13 +1121,10 @@ static void lcl_xmltble_ClearName_Box( SwTableBox* pBox ) } } -sal_Bool lcl_xmltble_ClearName_Line( const SwTableLine*& rpLine, void* ) +void lcl_xmltble_ClearName_Line( SwTableLine* pLine ) { - for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); - it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) - lcl_xmltble_ClearName_Box( *it ); - - return sal_True; + BOOST_FOREACH( SwTableBox* pBox, pLine->GetTabBoxes() ) + lcl_xmltble_ClearName_Box( pBox ); } void SwXMLExport::ExportTable( const SwTableNode& rTblNd ) @@ -1179,8 +1177,8 @@ void SwXMLExport::ExportTable( const SwTableNode& rTblNd ) SwXMLTableInfo_Impl aTblInfo( &rTbl ); ExportTableLines( rTbl.GetTabLines(), aTblInfo, rTbl.GetRowsToRepeat() ); - ((SwTable &)rTbl).GetTabLines().ForEach( &lcl_xmltble_ClearName_Line, - 0 ); + BOOST_FOREACH( SwTableLine *pLine, ((SwTable &)rTbl).GetTabLines() ) + lcl_xmltble_ClearName_Line( pLine ); } } diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 302c688dea1a..7ab5756ac084 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1988,7 +1988,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox( SwTableLine *pUpper, MakeTableLine( pBox, nStartRow, nLeftCol, i+1UL, nRightCol ); - rLines.C40_INSERT( SwTableLine, pLine, rLines.Count() ); + rLines.push_back( pLine ); nStartRow = i+1UL; bSplitted = sal_True; @@ -2655,7 +2655,7 @@ void SwXMLTableContext::_MakeTable( SwTableBox *pBox ) SwTableLine *pLine = MakeTableLine( pBox, nStartRow, 0UL, i+1UL, nCols ); if( pBox || nStartRow>0UL ) - rLines.C40_INSERT( SwTableLine, pLine, rLines.Count() ); + rLines.push_back( pLine ); nStartRow = i+1UL; } } diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index 2e5640a019b3..59936afce4ae 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -106,7 +106,7 @@ sal_Bool lcl_GetSelTbl( SwWrtShell &rSh, sal_uInt16& rX, sal_uInt16& rY ) ::GetTblSel( rSh, aSelBoxes ); _FndPara aPara( aSelBoxes, &aFndBox ); const SwTable& rTbl = pTblNd->GetTable(); - ((SwTableLines&)rTbl.GetTabLines()).ForEach( &_FndLineCopyCol, &aPara ); + ForEach_FndLineCopyCol( (SwTableLines&)rTbl.GetTabLines(), &aPara ); } rX = aFndBox.GetLines().size(); if( !rX ) diff --git a/sw/source/ui/vba/vbatablehelper.cxx b/sw/source/ui/vba/vbatablehelper.cxx index a7d624b66b43..3a8921879d92 100644 --- a/sw/source/ui/vba/vbatablehelper.cxx +++ b/sw/source/ui/vba/vbatablehelper.cxx @@ -61,7 +61,7 @@ sal_Int32 SwVbaTableHelper::getTabColumnsCount( sal_Int32 nRowIndex ) throw (uno if(!pTable->IsTblComplex()) { SwTableLines& rLines = pTable->GetTabLines(); - SwTableLine* pLine = rLines.GetObject( nRowIndex ); + SwTableLine* pLine = rLines[ nRowIndex ]; nRet = pLine->GetTabBoxes().size(); } return nRet; @@ -71,7 +71,7 @@ sal_Int32 SwVbaTableHelper::getTabColumnsMaxCount( ) throw (uno::RuntimeExceptio { sal_Int32 nRet = 0; //sal_Int32 nRowCount = mxTextTable->getRows()->getCount(); - sal_Int32 nRowCount = pTable->GetTabLines().Count(); + sal_Int32 nRowCount = pTable->GetTabLines().size(); for( sal_Int32 index = 0; index < nRowCount; index++ ) { sal_Int32 nColCount = getTabColumnsCount( index ); @@ -149,12 +149,12 @@ sal_Int32 SwVbaTableHelper::getTableWidth( ) throw (uno::RuntimeException) SwTableBox* SwVbaTableHelper::GetTabBox( sal_Int32 nCol, sal_Int32 nRow ) throw (css::uno::RuntimeException) { SwTableLines& rLines = pTable->GetTabLines(); - sal_Int32 nRowCount = rLines.Count(); + sal_Int32 nRowCount = rLines.size(); if( nRowCount < nRow ) throw uno::RuntimeException(); SwTableBox* pStart = NULL; - SwTableLine* pLine = rLines.GetObject( nRow ); + SwTableLine* pLine = rLines[ nRow ]; if( (sal_Int32)pLine->GetTabBoxes().size() < nCol ) throw uno::RuntimeException(); |