diff options
author | Noel Grandin <noel@peralex.com> | 2012-05-10 17:42:10 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-05-14 19:49:15 +0200 |
commit | b8ace0f986769cc952718ab5e262808d899d5549 (patch) | |
tree | de7a7ee9ba280585506a4429a57af862aa79c938 /sw | |
parent | 5031e17d4b11181be94448702b1026bd38e0b3c4 (diff) |
Convert SV_DECL_PTRARR_DEL(SwTableBoxes) to std::vector
I added a GetPos() method because quite a lot of code used that
method and the existing code is quite tied to the precise
return values of that method.
Change-Id: I9af6b923d978abe758b63d835f228495c020455a
Diffstat (limited to 'sw')
32 files changed, 458 insertions, 432 deletions
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index ba67780a1762..29c779a51ed2 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -37,6 +37,8 @@ #include <memory> #include <boost/noncopyable.hpp> +#include <vector> +#include <algorithm> class SwStartNode; class SwFmt; @@ -72,7 +74,16 @@ SV_DECL_REF( SwServerObject ) #endif SV_DECL_PTRARR_DEL(SwTableLines, SwTableLine*, 10) -SV_DECL_PTRARR_DEL(SwTableBoxes, SwTableBox*, 25) + +class SwTableBoxes : public std::vector<SwTableBox*> { +public: + // return USHRT_MAX if not found, else index of position + sal_uInt16 GetPos(const SwTableBox* pBox) const + { + const_iterator it = std::find(begin(), end(), pBox); + return it == end() ? USHRT_MAX : it - begin(); + } +}; // Save content-bearing box-pointers additionally in a sorted array // (for calculation in table). diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx index 92df35686130..427164c946dd 100644 --- a/sw/source/core/doc/docchart.cxx +++ b/sw/source/core/doc/docchart.cxx @@ -83,19 +83,19 @@ sal_Bool SwTable::IsTblComplexForChart( const String& rSelection ) const else { const SwTableLines* pLns = &GetTabLines(); - pSttBox = (*pLns)[ 0 ]->GetTabBoxes()[ 0 ]; + pSttBox = (*pLns)[ 0 ]->GetTabBoxes().front(); while( !pSttBox->GetSttNd() ) // Until the Content Box! - pSttBox = pSttBox->GetTabLines()[ 0 ]->GetTabBoxes()[ 0 ]; + pSttBox = pSttBox->GetTabLines()[ 0 ]->GetTabBoxes().front(); const SwTableBoxes* pBoxes = &(*pLns)[ pLns->Count()-1 ]->GetTabBoxes(); - pEndBox = (*pBoxes)[ pBoxes->Count()-1 ]; + pEndBox = pBoxes->back(); while( !pEndBox->GetSttNd() ) { // Until the Content Box! pLns = &pEndBox->GetTabLines(); pBoxes = &(*pLns)[ pLns->Count()-1 ]->GetTabBoxes(); - pEndBox = (*pBoxes)[ pBoxes->Count()-1 ]; + pEndBox = pBoxes->back(); } } diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx index d61151cf26f9..5507c54a36cb 100644 --- a/sw/source/core/doc/gctable.cxx +++ b/sw/source/core/doc/gctable.cxx @@ -32,6 +32,7 @@ #include <editeng/boxitem.hxx> #include <tblrwcl.hxx> #include <swtblfmt.hxx> +#include <algorithm> using namespace ::editeng; @@ -83,22 +84,23 @@ sal_Bool lcl_GCBorder_ChkBoxBrd_B( const SwTableBox*& rpBox, void* pPara ) return bRet; } +static void lcl_GCBorder_GetLastBox_B( const SwTableBox* pBox, SwTableBoxes* pPara ); + sal_Bool lcl_GCBorder_GetLastBox_L( const SwTableLine*& rpLine, void* pPara ) { const SwTableBoxes& rBoxes = rpLine->GetTabBoxes(); - const SwTableBox* pBox = rBoxes[ rBoxes.Count()-1 ]; - ::lcl_GCBorder_GetLastBox_B( pBox, pPara ); + const SwTableBox* pBox = rBoxes.back(); + lcl_GCBorder_GetLastBox_B( pBox, (SwTableBoxes*)pPara ); return sal_True; } -sal_Bool lcl_GCBorder_GetLastBox_B( const SwTableBox*& rpBox, void* pPara ) +static void lcl_GCBorder_GetLastBox_B( const SwTableBox* pBox, SwTableBoxes* pPara ) { - SwTableLines& rLines = (SwTableLines&)rpBox->GetTabLines(); + SwTableLines& rLines = (SwTableLines&)pBox->GetTabLines(); if( rLines.Count() ) rLines.ForEach( &lcl_GCBorder_GetLastBox_L, pPara ); else - ((SwTableBoxes*)pPara)->Insert( rpBox, ((SwTableBoxes*)pPara)->Count() ); - return sal_True; + pPara->push_back( (SwTableBox*)pBox ); } // Find the "end" of the passed BorderLine. Returns the "Layout"Pos! @@ -168,6 +170,7 @@ void lcl_GCBorder_DelBorder( const SwCollectTblLineBoxes& rCollTLB, } while( sal_True ); } +static sal_Bool lcl_GC_Box_Border( SwTableBox* pBox, _SwGCLineBorder* pPara ); sal_Bool lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) { @@ -179,19 +182,19 @@ sal_Bool lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) const SvxBorderLine* pBrd; const SfxPoolItem* pItem; const SwTableBoxes& rBoxes = rpLine->GetTabBoxes(); - for( sal_uInt16 n = 0, nBoxes = rBoxes.Count() - 1; n < nBoxes; ++n ) + for( sal_uInt16 n = 0, nBoxes = rBoxes.size() - 1; n < nBoxes; ++n ) { SwTableBoxes aBoxes; { - const SwTableBox* pBox = rBoxes[ n ]; + SwTableBox* pBox = rBoxes[ n ]; if( pBox->GetSttNd() ) - aBoxes.Insert( pBox, 0 ); + aBoxes.insert( aBoxes.begin(), pBox ); else lcl_GCBorder_GetLastBox_B( pBox, &aBoxes ); } SwTableBox* pBox; - for( sal_uInt16 i = aBoxes.Count(); i; ) + for( sal_uInt16 i = aBoxes.size(); i; ) if( SFX_ITEM_SET == (pBox = aBoxes[ --i ])->GetFrmFmt()-> GetItemState( RES_BOX, sal_True, &pItem ) && 0 != ( pBrd = ((SvxBoxItem*)pItem)->GetRight() ) ) @@ -210,7 +213,7 @@ sal_Bool lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) } } - aBoxes.Remove( 0, aBoxes.Count() ); + aBoxes.clear(); } } @@ -308,20 +311,22 @@ sal_Bool lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) } while( sal_True ); } - ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_GC_Box_Border, pPara ); + for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); + it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) + lcl_GC_Box_Border(*it, (_SwGCLineBorder*)pPara ); ++pGCPara->nLinePos; return sal_True; } -sal_Bool lcl_GC_Box_Border( const SwTableBox*& rpBox, void* pPara ) +static sal_Bool lcl_GC_Box_Border( SwTableBox* pBox, _SwGCLineBorder* pPara ) { - if( rpBox->GetTabLines().Count() ) + if( pBox->GetTabLines().Count() ) { - _SwGCLineBorder aPara( *rpBox ); - aPara.pShareFmts = ((_SwGCLineBorder*)pPara)->pShareFmts; - ((SwTableBox*)rpBox)->GetTabLines().ForEach( &lcl_GC_Line_Border, &aPara ); + _SwGCLineBorder aPara( *pBox ); + aPara.pShareFmts = pPara->pShareFmts; + pBox->GetTabLines().ForEach( &lcl_GC_Line_Border, &aPara ); } return sal_True; } @@ -338,33 +343,33 @@ struct _GCLinePara static bool lcl_MergeGCLine(const SwTableLine*& rpLine, void*const pPara); -static bool lcl_MergeGCBox(const SwTableBox*& rpTblBox, void*const pPara) +static bool lcl_MergeGCBox(SwTableBox* pTblBox, void*const pPara) { - SwTableBox*& rpBox = (SwTableBox*&)rpTblBox; - sal_uInt16 n, nLen = rpBox->GetTabLines().Count(); + sal_uInt16 n, nLen = pTblBox->GetTabLines().Count(); if( nLen ) { // ATTENTION: The Line count can change! - _GCLinePara aPara( rpBox->GetTabLines(), (_GCLinePara*)pPara ); - for( n = 0; n < rpBox->GetTabLines().Count() && - lcl_MergeGCLine( *(rpBox->GetTabLines().GetData() + n), &aPara ); + _GCLinePara aPara( pTblBox->GetTabLines(), (_GCLinePara*)pPara ); + for( n = 0; n < pTblBox->GetTabLines().Count() && + lcl_MergeGCLine( *(pTblBox->GetTabLines().GetData() + n), &aPara ); ++n ) ; - if( 1 == rpBox->GetTabLines().Count() ) + if( 1 == pTblBox->GetTabLines().Count() ) { // Box with a Line, then move all the Line's Boxes after this Box // into the parent Line and delete this Box - SwTableLine* pInsLine = rpBox->GetUpper(); - SwTableLine* pCpyLine = rpBox->GetTabLines()[0]; - sal_uInt16 nInsPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, rpBox ); - for( n = 0; n < pCpyLine->GetTabBoxes().Count(); ++n ) + SwTableLine* pInsLine = pTblBox->GetUpper(); + SwTableLine* pCpyLine = pTblBox->GetTabLines()[0]; + SwTableBoxes::iterator it = std::find( pInsLine->GetTabBoxes().begin(), pInsLine->GetTabBoxes().end(), pTblBox ); + for( n = 0; n < pCpyLine->GetTabBoxes().size(); ++n ) pCpyLine->GetTabBoxes()[n]->SetUpper( pInsLine ); - pInsLine->GetTabBoxes().Insert( &pCpyLine->GetTabBoxes(), nInsPos+1 ); - pCpyLine->GetTabBoxes().Remove( 0, n ); + pInsLine->GetTabBoxes().insert( it + 1, pCpyLine->GetTabBoxes().begin(), pCpyLine->GetTabBoxes().end()); + pCpyLine->GetTabBoxes().clear(); // Delete the old Box with the Line - pInsLine->GetTabBoxes().DeleteAndDestroy( nInsPos ); + delete *it; + pInsLine->GetTabBoxes().erase( it ); return false; // set up anew } @@ -375,14 +380,14 @@ static bool lcl_MergeGCBox(const SwTableBox*& rpTblBox, void*const pPara) static bool lcl_MergeGCLine(const SwTableLine*& rpLine, void *const pPara) { SwTableLine* pLn = (SwTableLine*)rpLine; - sal_uInt16 nLen = pLn->GetTabBoxes().Count(); + 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()[0]; + SwTableBox* pBox = pLn->GetTabBoxes().front(); if( !pBox->GetTabLines().Count() ) break; @@ -425,12 +430,12 @@ static bool lcl_MergeGCLine(const SwTableLine*& rpLine, void *const pPara) rLns[ nInsPos++ ]->SetUpper( pUpper ); pLn = pLine; // and set up anew - nLen = pLn->GetTabBoxes().Count(); + nLen = pLn->GetTabBoxes().size(); } // ATTENTION: The number of boxes can change! - for( nLen = 0; nLen < pLn->GetTabBoxes().Count(); ++nLen ) - if( !lcl_MergeGCBox( *(pLn->GetTabBoxes().GetData() + nLen ), pPara )) + for( nLen = 0; nLen < pLn->GetTabBoxes().size(); ++nLen ) + if( !lcl_MergeGCBox( pLn->GetTabBoxes()[nLen], pPara )) --nLen; } return true; diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index befc7d567853..890a1c8c35ce 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -419,7 +419,7 @@ const SwStartNode *SwHTMLTableLayout::GetAnyBoxStartNode() const { OSL_ENSURE( pBox->GetTabLines().Count() > 0, "Box without start node and lines" ); - OSL_ENSURE( pBox->GetTabLines()[0]->GetTabBoxes().Count() > 0, + OSL_ENSURE( pBox->GetTabLines()[0]->GetTabBoxes().size() > 0, "Line without boxes" ); pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0]; } @@ -1537,20 +1537,18 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv static sal_Bool lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara ); -static sal_Bool lcl_ResizeBox( const SwTableBox*& rpBox, void* pPara ) +static sal_Bool lcl_ResizeBox( SwTableBox* pBox, sal_uInt16* pWidth ) { - sal_uInt16 *pWidth = (sal_uInt16 *)pPara; - - if( !rpBox->GetSttNd() ) + if( !pBox->GetSttNd() ) { sal_uInt16 nWidth = 0; - ((SwTableBox *)rpBox)->GetTabLines().ForEach( &lcl_ResizeLine, &nWidth ); - rpBox->GetFrmFmt()->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth, 0 )); + pBox->GetTabLines().ForEach( &lcl_ResizeLine, &nWidth ); + pBox->GetFrmFmt()->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth, 0 )); *pWidth = *pWidth + nWidth; } else { - *pWidth = *pWidth + (sal_uInt16)rpBox->GetFrmFmt()->GetFrmSize().GetSize().Width(); + *pWidth = *pWidth + (sal_uInt16)pBox->GetFrmFmt()->GetFrmSize().GetSize().Width(); } return sal_True; @@ -1563,7 +1561,9 @@ static sal_Bool lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara ) sal_uInt16 nOldWidth = *pWidth; #endif *pWidth = 0; - ((SwTableLine *)rpLine)->GetTabBoxes().ForEach( &lcl_ResizeBox, pWidth ); + for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); + it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) + lcl_ResizeBox(*it, pWidth ); #if OSL_DEBUG_LEVEL > 0 OSL_ENSURE( !nOldWidth || Abs(*pWidth-nOldWidth) < COLFUZZY, diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index 8c3e96096830..60cbd5fb9628 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -163,7 +163,7 @@ namespace SubTable::iterator pMax = pStartLn; ++pMax; SubTable::difference_type nMax = 1; - for( sal_uInt16 nBox = 0; nBox < rLine.GetTabBoxes().Count(); ++nBox ) + for( sal_uInt16 nBox = 0; nBox < rLine.GetTabBoxes().size(); ++nBox ) { SubTable::iterator pTmp = insertSubBox( rSubTable, *rLine.GetTabBoxes()[nBox], pStartLn, pMax ); @@ -262,7 +262,7 @@ namespace { bool bComplex = false; if( !bNewModel ) - for( sal_uInt16 nBox = 0; !bComplex && nBox < rBoxes.Count(); ++nBox ) + for( sal_uInt16 nBox = 0; !bComplex && nBox < rBoxes.size(); ++nBox ) bComplex = rBoxes[nBox]->GetTabLines().Count() > 0; if( bComplex ) { @@ -271,7 +271,7 @@ namespace aSubTable.push_back( aSubLine ); SubTable::iterator pStartLn = aSubTable.begin(); SubTable::iterator pEndLn = aSubTable.end(); - for( sal_uInt16 nBox = 0; nBox < rBoxes.Count(); ++nBox ) + for( sal_uInt16 nBox = 0; nBox < rBoxes.size(); ++nBox ) insertSubBox( aSubTable, *rBoxes[nBox], pStartLn, pEndLn ); SubTable::size_type nSize = aSubTable.size(); if( nSize ) @@ -303,10 +303,10 @@ namespace bool bSelected = false; sal_uLong nBorder = 0; sal_uInt16 nCol = 0; - maLines[rLine].reserve( rBoxes.Count() ); + maLines[rLine].reserve( rBoxes.size() ); ColumnStructure::iterator pCol = maCols.begin(); BoxStructure::iterator pSel = maLines[rLine].end(); - for( sal_uInt16 nBox = 0; nBox < rBoxes.Count(); ++nBox ) + for( sal_uInt16 nBox = 0; nBox < rBoxes.size(); ++nBox ) addBox( rLine, pSelBoxes, rBoxes[nBox], nBorder, nCol, pCol, pSel, bSelected, false ); ++rLine; @@ -829,7 +829,7 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, OSL_ENSURE( !rCpyTbl.IsTblComplex(), "Table too complex" ); - SwDoc* pDoc = GetFrmFmt()->GetDoc(); + SwDoc* pDoc = GetFrmFmt()->GetDoc(); SwDoc* pCpyDoc = rCpyTbl.GetFrmFmt()->GetDoc(); SwTblNumFmtMerge aTNFM( *pCpyDoc, *pDoc ); @@ -850,7 +850,6 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, if( 1 != rCpyTbl.GetTabSortBoxes().Count() ) { SwTableLine* pSttLine = pSttBox->GetUpper(); - sal_uInt16 nSttBox = pSttLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSttBox ); sal_uInt16 nSttLine = GetTabLines().C40_GETPOS( SwTableLine, pSttLine ); _FndBox* pFndBox; @@ -883,19 +882,19 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, SwTableLine* pLastLn = GetTabLines()[ GetTabLines().Count()-1 ]; pSttBox = pFLine->GetBoxes()[0].GetBox(); - nSttBox = pFLine->GetLine()->GetTabBoxes().C40_GETPOS( SwTableBox, pSttBox ); + sal_uInt16 nSttBox = pFLine->GetLine()->GetTabBoxes().GetPos( pSttBox ); for( sal_uInt16 n = rCpyTbl.GetTabLines().Count() - nNewLns; n < rCpyTbl.GetTabLines().Count(); ++n ) { SwTableLine* pCpyLn = rCpyTbl.GetTabLines()[ n ]; - if( pLastLn->GetTabBoxes().Count() < nSttBox || - ( pLastLn->GetTabBoxes().Count() - nSttBox ) < - pCpyLn->GetTabBoxes().Count() ) + if( pLastLn->GetTabBoxes().size() < nSttBox || + ( pLastLn->GetTabBoxes().size() - nSttBox ) < + pCpyLn->GetTabBoxes().size() ) return sal_False; // Test for nesting - for( nBx = 0; nBx < pCpyLn->GetTabBoxes().Count(); ++nBx ) + for( nBx = 0; nBx < pCpyLn->GetTabBoxes().size(); ++nBx ) if( !( pTmpBox = pLastLn->GetTabBoxes()[ nSttBox + nBx ]) ->GetSttNd() ) return sal_False; @@ -928,7 +927,7 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, pFLine = &aFndBox.GetLines()[ nLn % nFndCnt ]; SwTableLine* pLine = pFLine->GetLine(); pSttBox = pFLine->GetBoxes()[0].GetBox(); - nSttBox = pLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSttBox ); + sal_uInt16 nSttBox = pLine->GetTabBoxes().GetPos( pSttBox ); if( nLn >= nFndCnt ) { // We have more rows in the ClipBoard than we have selected @@ -943,9 +942,9 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, if( pInsFLine ) { // We insert a new row into the FndBox - if( pLine->GetTabBoxes().Count() < nSttBox || + if( pLine->GetTabBoxes().size() < nSttBox || sal::static_int_cast< sal_uInt16 >( - pLine->GetTabBoxes().Count() - nSttBox ) < + pLine->GetTabBoxes().size() - nSttBox ) < pFLine->GetBoxes().size() ) return sal_False; @@ -963,13 +962,13 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, } else if( pFLine->GetBoxes().size() == 1 ) { - if( pLine->GetTabBoxes().Count() < nSttBox || - ( pLine->GetTabBoxes().Count() - nSttBox ) < - pCpyLn->GetTabBoxes().Count() ) + if( pLine->GetTabBoxes().size() < nSttBox || + ( pLine->GetTabBoxes().size() - nSttBox ) < + pCpyLn->GetTabBoxes().size() ) return sal_False; // Test for nesting - for( nBx = 0; nBx < pCpyLn->GetTabBoxes().Count(); ++nBx ) + for( nBx = 0; nBx < pCpyLn->GetTabBoxes().size(); ++nBx ) { if( !( pTmpBox = pLine->GetTabBoxes()[ nSttBox + nBx ]) ->GetSttNd() ) @@ -987,7 +986,7 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, // Match the selected Boxes with the ones in the Clipboard // (n times) if( 0 != ( pFLine->GetBoxes().size() % - pCpyLn->GetTabBoxes().Count() )) + pCpyLn->GetTabBoxes().size() )) return sal_False; // Test for nesting @@ -1029,7 +1028,7 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, { // Copy the pCpyBox into pMyBox lcl_CpyBox( rCpyTbl, pCpyLn->GetTabBoxes()[ - nBx % pCpyLn->GetTabBoxes().Count() ], + nBx % pCpyLn->GetTabBoxes().size() ], *this, pFLine->GetBoxes()[nBx].GetBox(), sal_True, pUndo ); } } @@ -1038,10 +1037,9 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, return sal_True; } -sal_Bool _FndCntntBox( const SwTableBox*& rpBox, void* pPara ) +static sal_Bool _FndCntntBox( SwTableBox* pBox, void* pPara ) { - SwTableBox* pBox = (SwTableBox*)rpBox; - if( rpBox->GetTabLines().Count() ) + if( pBox->GetTabLines().Count() ) pBox->GetTabLines().ForEach( &_FndCntntLine, pPara ); else ((SwSelBoxes*)pPara)->Insert( pBox ); @@ -1050,7 +1048,9 @@ sal_Bool _FndCntntBox( const SwTableBox*& rpBox, void* pPara ) sal_Bool _FndCntntLine( const SwTableLine*& rpLine, void* pPara ) { - ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &_FndCntntBox, pPara ); + for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); + it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) + _FndCntntBox(*it, pPara ); return sal_True; } @@ -1065,7 +1065,9 @@ SwSelBoxes& SwTable::SelLineFromBox( const SwTableBox* pBox, // Delete all old ones rBoxes.Remove( sal_uInt16(0), rBoxes.Count() ); - pLine->GetTabBoxes().ForEach( &_FndCntntBox, &rBoxes ); + for( SwTableBoxes::iterator it = pLine->GetTabBoxes().begin(); + it != pLine->GetTabBoxes().end(); ++it) + _FndCntntBox(*it, &rBoxes ); return rBoxes; } diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index dfad7a4fa0d6..43f172abcc44 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -348,7 +348,7 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) if( pBox->GetTabLines().Count() ) { pCmpLine = &rFndBox.GetLines().front(); - if ( pCmpLine->GetBoxes().size() != pCmpLine->GetLine()->GetTabBoxes().Count() ) + if ( pCmpLine->GetBoxes().size() != pCmpLine->GetLine()->GetTabBoxes().size() ) bDiffCount = true; } @@ -403,7 +403,7 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) { pBox = new SwTableBox( aFindFrm.pNewFrmFmt, rFndBox.GetLines().size(), pCpyPara->pInsLine ); - pCpyPara->pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, pCpyPara->nInsPos++); + pCpyPara->pInsLine->GetTabBoxes().insert( pCpyPara->pInsLine->GetTabBoxes().begin() + pCpyPara->nInsPos++, pBox ); _CpyPara aPara( *pCpyPara, pBox ); aPara.nDelBorderFlag &= 7; @@ -496,7 +496,7 @@ void lcl_InsCol( _FndLine* pFndLn, _CpyPara& rCpyPara, sal_uInt16 nCpyCnt, rCpyPara.pInsLine = pFndLn->GetLine(); SwTableBox* pBox = pFndLn->GetBoxes()[ bBehind ? pFndLn->GetBoxes().size()-1 : 0 ].GetBox(); - rCpyPara.nInsPos = pFndLn->GetLine()->GetTabBoxes().C40_GETPOS( SwTableBox, pBox ); + rCpyPara.nInsPos = pFndLn->GetLine()->GetTabBoxes().GetPos( pBox ); if( bBehind ) ++rCpyPara.nInsPos; @@ -681,11 +681,10 @@ sal_Bool SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_Bool _FndBoxAppendRowLine( const SwTableLine*& rpLine, void* pPara ); -sal_Bool _FndBoxAppendRowBox( const SwTableBox*& rpBox, void* pPara ) +static void _FndBoxAppendRowBox( SwTableBox* pBox, _FndPara* pFndPara ) { - _FndPara* pFndPara = (_FndPara*)pPara; - _FndBox* pFndBox = new _FndBox( (SwTableBox*)rpBox, pFndPara->pFndLine ); - if( rpBox->GetTabLines().Count() ) + _FndBox* pFndBox = new _FndBox( pBox, pFndPara->pFndLine ); + if( pBox->GetTabLines().Count() ) { _FndPara aPara( *pFndPara, pFndBox ); pFndBox->GetBox()->GetTabLines().ForEach( &_FndBoxAppendRowLine, &aPara ); @@ -694,7 +693,6 @@ sal_Bool _FndBoxAppendRowBox( const SwTableBox*& rpBox, void* pPara ) } else pFndPara->pFndLine->GetBoxes().push_back( pFndBox ); - return sal_True; } sal_Bool _FndBoxAppendRowLine( const SwTableLine*& rpLine, void* pPara ) @@ -702,7 +700,9 @@ sal_Bool _FndBoxAppendRowLine( const SwTableLine*& rpLine, void* pPara ) _FndPara* pFndPara = (_FndPara*)pPara; _FndLine* pFndLine = new _FndLine( (SwTableLine*)rpLine, pFndPara->pFndBox ); _FndPara aPara( *pFndPara, pFndLine ); - pFndLine->GetLine()->GetTabBoxes().ForEach( &_FndBoxAppendRowBox, &aPara ); + for( SwTableBoxes::iterator it = pFndLine->GetLine()->GetTabBoxes().begin(); + it != pFndLine->GetLine()->GetTabBoxes().end(); ++it) + _FndBoxAppendRowBox(*it, &aPara ); if( pFndLine->GetBoxes().size() ) { pFndPara->pFndBox->GetLines().push_back( pFndLine ); @@ -786,7 +786,7 @@ void lcl_LastBoxSetWidthLine( SwTableLines &rLines, const long nOffset, void lcl_LastBoxSetWidth( SwTableBoxes &rBoxes, const long nOffset, sal_Bool bFirst, SwShareBoxFmts& rShareFmts ) { - SwTableBox& rBox = *rBoxes[ bFirst ? 0 : rBoxes.Count() - 1 ]; + SwTableBox& rBox = *(bFirst ? rBoxes.front() : rBoxes.back()); if( !rBox.GetSttNd() ) ::lcl_LastBoxSetWidthLine( rBox.GetTabLines(), nOffset, bFirst, rShareFmts ); @@ -819,11 +819,11 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, pBox->GetFrmFmt()->GetFrmSize().GetWidth() : 0; SwTableLine* pLine = pBox->GetUpper(); SwTableBoxes& rTblBoxes = pLine->GetTabBoxes(); - sal_uInt16 nDelPos = rTblBoxes.C40_GETPOS( SwTableBox, pBox ); + sal_uInt16 nDelPos = rTblBoxes.GetPos( pBox ); SwTableBox* pUpperBox = pBox->GetUpper()->GetUpper(); // Special treatment for the border: - if( bCorrBorder && 1 < rTblBoxes.Count() ) + if( bCorrBorder && 1 < rTblBoxes.size() ) { sal_Bool bChgd = sal_False; const SvxBoxItem& rBoxItem = pBox->GetFrmFmt()->GetBox(); @@ -832,7 +832,7 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, { // JP 02.04.97: 1st part for Bug 36271 // First the left/right edges - if( nDelPos + 1 < rTblBoxes.Count() ) + if( nDelPos + 1 < (sal_uInt16)rTblBoxes.size() ) { SwTableBox* pNxtBox = rTblBoxes[ nDelPos + 1 ]; const SvxBoxItem& rNxtBoxItem = pNxtBox->GetFrmFmt()->GetBox(); @@ -858,7 +858,7 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, SwTableBox* pPrvBox = rTblBoxes[ nDelPos - 1 ]; const SvxBoxItem& rPrvBoxItem = pPrvBox->GetFrmFmt()->GetBox(); - SwTableBox* pNxtBox = nDelPos + 1 < rTblBoxes.Count() + SwTableBox* pNxtBox = nDelPos + 1 < (sal_uInt16)rTblBoxes.size() ? rTblBoxes[ nDelPos + 1 ] : 0; if( pPrvBox->GetSttNd() && !rPrvBoxItem.GetRight() && @@ -882,7 +882,8 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, SwStartNode* pSttNd = (SwStartNode*)pBox->GetSttNd(); if( pShareFmts ) pShareFmts->RemoveFormat( *rTblBoxes[ nDelPos ]->GetFrmFmt() ); - rTblBoxes.DeleteAndDestroy( nDelPos ); + delete rTblBoxes[nDelPos]; + rTblBoxes.erase( rTblBoxes.begin() + nDelPos ); if( pSttNd ) { @@ -894,10 +895,10 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, } // Also delete the Line? - if( rTblBoxes.Count() ) + if( !rTblBoxes.empty() ) { // Then adapt the Frame-SSize - sal_Bool bLastBox = nDelPos == rTblBoxes.Count(); + sal_Bool bLastBox = nDelPos == rTblBoxes.size(); if( bLastBox ) --nDelPos; pBox = rTblBoxes[nDelPos]; @@ -956,7 +957,7 @@ SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns, SwTableLine* pLine = rTblLns[ nLinePos ]; SwTwips nFndBoxWidth = 0; SwTwips nFndWidth = nBoxStt + nBoxWidth; - sal_uInt16 nBoxCnt = pLine->GetTabBoxes().Count(); + sal_uInt16 nBoxCnt = pLine->GetTabBoxes().size(); pFndBox = pLine->GetTabBoxes()[ 0 ]; for( sal_uInt16 n = 0; 0 < nFndWidth && n < nBoxCnt; ++n ) @@ -1007,7 +1008,7 @@ void lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox, const SwTableLine* pLine = rBox.GetUpper(); const SwTableBoxes& rTblBoxes = pLine->GetTabBoxes(); const SwTableBox* pUpperBox = &rBox; - sal_uInt16 nDelPos = rTblBoxes.C40_GETPOS( SwTableBox, pUpperBox ); + sal_uInt16 nDelPos = rTblBoxes.GetPos( pUpperBox ); pUpperBox = rBox.GetUpper()->GetUpper(); const SvxBoxItem& rBoxItem = rBox.GetFrmFmt()->GetBox(); @@ -1200,9 +1201,8 @@ sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 (nCnt + 1) ); SwTableBox* pNewBox = new SwTableBox( pFrmFmt, nCnt, pInsLine ); - sal_uInt16 nBoxPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSelBox ); - pInsLine->GetTabBoxes().Remove( nBoxPos ); // delete old ones - pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pNewBox, nBoxPos ); + sal_uInt16 nBoxPos = pInsLine->GetTabBoxes().GetPos( pSelBox ); + pInsLine->GetTabBoxes()[nBoxPos] = pNewBox; // overwrite old one // Delete background/border attribute SwTableBox* pLastBox = pSelBox; // To distribute the TextNodes! @@ -1240,7 +1240,7 @@ sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 if( !i ) // hang up the original Box { pSelBox->SetUpper( pNewLine ); - pNewLine->GetTabBoxes().C40_INSERT( SwTableBox, pSelBox, 0 ); + pNewLine->GetTabBoxes().insert( pNewLine->GetTabBoxes().begin(), pSelBox ); } else { @@ -1324,7 +1324,7 @@ sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nC // Then split the nCnt Box up into nCnt Boxes SwTableLine* pInsLine = pSelBox->GetUpper(); - sal_uInt16 nBoxPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSelBox ); + sal_uInt16 nBoxPos = pInsLine->GetTabBoxes().GetPos( pSelBox ); // Find the Frame Format in the Frame Format Array SwTableBoxFmt* pLastBoxFmt; @@ -1433,9 +1433,10 @@ void lcl_CpyBoxes( sal_uInt16 nStt, sal_uInt16 nEnd, for( sal_uInt16 n = nStt; n < nEnd; ++n ) rBoxes[n]->SetUpper( pInsLine ); if( USHRT_MAX == nPos ) - nPos = pInsLine->GetTabBoxes().Count(); - pInsLine->GetTabBoxes().Insert( &rBoxes, nPos, nStt, nEnd ); - rBoxes.Remove( nStt, nEnd - nStt ); + nPos = pInsLine->GetTabBoxes().size(); + pInsLine->GetTabBoxes().insert( pInsLine->GetTabBoxes().begin() + nPos, + rBoxes.begin() + nStt, rBoxes.begin() + nEnd ); + rBoxes.erase( rBoxes.begin() + nStt, rBoxes.begin() + nEnd ); } void lcl_CalcWidth( SwTableBox* pBox ) @@ -1448,7 +1449,7 @@ void lcl_CalcWidth( SwTableBox* pBox ) OSL_ENSURE( pLine, "Box is not within a Line" ); long nWidth = 0; - for( sal_uInt16 n = 0; n < pLine->GetTabBoxes().Count(); ++n ) + for( sal_uInt16 n = 0; n < pLine->GetTabBoxes().size(); ++n ) nWidth += pLine->GetTabBoxes()[n]->GetFrmFmt()->GetFrmSize().GetWidth(); pFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth, 0 )); @@ -1503,15 +1504,15 @@ static void lcl_Merge_MoveBox(_FndBox & rFndBox, _InsULPara *const pULPara) if( pULPara->bUL ) // Left ? { // if there are Boxes before it, move them - if( 0 != ( nPos = pBoxes->C40_GETPOS( SwTableBox, pFndTableBox )) ) + if( 0 != ( nPos = pBoxes->GetPos( pFndTableBox ) ) ) lcl_CpyBoxes( 0, nPos, *pBoxes, pULPara->pInsLine ); } else // Right // if there are Boxes behind it, move them - if( (nPos = pBoxes->C40_GETPOS( SwTableBox, pFndTableBox )) +1 < pBoxes->Count() ) + if( (nPos = pBoxes->GetPos( pFndTableBox )) +1 < (sal_uInt16)pBoxes->size() ) { - nInsPos = pULPara->pInsLine->GetTabBoxes().Count(); - lcl_CpyBoxes( nPos+1, pBoxes->Count(), + nInsPos = pULPara->pInsLine->GetTabBoxes().size(); + lcl_CpyBoxes( nPos+1, pBoxes->size(), *pBoxes, pULPara->pInsLine ); } } @@ -1541,8 +1542,8 @@ static void lcl_Merge_MoveBox(_FndBox & rFndBox, _InsULPara *const pULPara) if( pBox->GetTabLines().Count() ) { if( USHRT_MAX == nInsPos ) - nInsPos = pBoxes->Count(); - pBoxes->C40_INSERT( SwTableBox, pBox, nInsPos ); + nInsPos = pBoxes->size(); + pBoxes->insert( pBoxes->begin() + nInsPos, pBox ); lcl_CalcWidth( pBox ); // calculate the Box's width } else @@ -1566,10 +1567,10 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) SwTableBox* pLBx = rFndLine.GetBoxes().front().GetBox(); SwTableBox* pRBx = rFndLine.GetBoxes().back().GetBox(); - sal_uInt16 nLeft = pFndLn->GetTabBoxes().C40_GETPOS( SwTableBox, pLBx ); - sal_uInt16 nRight = pFndLn->GetTabBoxes().C40_GETPOS( SwTableBox, pRBx ); + sal_uInt16 nLeft = pFndLn->GetTabBoxes().GetPos( pLBx ); + sal_uInt16 nRight = pFndLn->GetTabBoxes().GetPos( pRBx ); - if( !nLeft || nRight == pFndLn->GetTabBoxes().Count() ) + if( !nLeft || nRight == pFndLn->GetTabBoxes().size() ) { if( pULPara->bUL ) // Upper ? { @@ -1603,7 +1604,7 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) lcl_CpyBoxes( 0, 2, pInsLine->GetTabBoxes(), pLMLn ); - pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pLMBox, 0 ); + pInsLine->GetTabBoxes().insert( pInsLine->GetTabBoxes().begin(), pLMBox ); if( pULPara->bUL ) // Upper ? { @@ -1618,7 +1619,7 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) pLMBox ); lcl_CalcWidth( pLMBox ); // calculate the Box's width } - else if( nRight+1 < pFndLn->GetTabBoxes().Count() ) + else if( nRight+1 < (sal_uInt16)pFndLn->GetTabBoxes().size() ) { // There are still Boxes on the right, so put the Right- // and Merge-Box into one Box and Line, insert before/after @@ -1637,14 +1638,14 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) lcl_CpyBoxes( 1, 3, pInsLine->GetTabBoxes(), pRMLn ); - pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pRMBox, 0 ); + pInsLine->GetTabBoxes().insert( pInsLine->GetTabBoxes().begin(), pRMBox ); } else { // Left and Merge have been merged, so also move Right into the Line pInsLine = pULPara->pLeftBox->GetUpper(); - sal_uInt16 nMvPos = pULPara->pRightBox->GetUpper()->GetTabBoxes(). - C40_GETPOS( SwTableBox, pULPara->pRightBox ); + sal_uInt16 nMvPos = pULPara->pRightBox->GetUpper()->GetTabBoxes().GetPos( + pULPara->pRightBox ); lcl_CpyBoxes( nMvPos, nMvPos+1, pULPara->pRightBox->GetUpper()->GetTabBoxes(), pInsLine ); @@ -1662,7 +1663,7 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) pRMBox->GetTabLines().C40_INSERT( SwTableLine, pNewLn, pULPara->bUL ? nMvPos : nMvPos+1 ); pRMBox = new SwTableBox( (SwTableBoxFmt*)pRMBox->GetFrmFmt(), 0, pNewLn ); - pNewLn->GetTabBoxes().C40_INSERT( SwTableBox, pRMBox, 0 ); + pNewLn->GetTabBoxes().insert( pNewLn->GetTabBoxes().begin(), pRMBox ); sal_uInt16 nPos1, nPos2; if( pULPara->bUL ) @@ -1677,8 +1678,7 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) lcl_CalcWidth( pRMBox ); // calculate the Box's width pRMBox = new SwTableBox( (SwTableBoxFmt*)pRMBox->GetFrmFmt(), 0, pNewLn ); - pNewLn->GetTabBoxes().C40_INSERT( SwTableBox, pRMBox, - pNewLn->GetTabBoxes().Count() ); + pNewLn->GetTabBoxes().push_back( pRMBox ); } } if( pULPara->bUL ) // Upper ? @@ -1718,7 +1718,7 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) lcl_Merge_MoveBox(*it, &aPara); } - if( pNewLine->GetTabBoxes().Count() ) + if( !pNewLine->GetTabBoxes().empty() ) { if( USHRT_MAX == nInsPos ) nInsPos = pLines->Count(); @@ -1728,6 +1728,8 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) delete pNewLine; } +static sal_Bool lcl_BoxSetHeadCondColl( SwTableBox* pBox ); + sal_Bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, SwTableBox* pMergeBox, SwUndoTblMerge* pUndo ) { @@ -1782,10 +1784,10 @@ sal_Bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, SwTableBox* pLeftBox = new SwTableBox( (SwTableBoxFmt*)pMergeBox->GetFrmFmt(), 0, pInsLine ); SwTableBox* pRightBox = new SwTableBox( (SwTableBoxFmt*)pMergeBox->GetFrmFmt(), 0, pInsLine ); pMergeBox->SetUpper( pInsLine ); - pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pLeftBox, 0 ); + pInsLine->GetTabBoxes().insert( pInsLine->GetTabBoxes().begin(), pLeftBox ); pLeftBox->ClaimFrmFmt(); - pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pMergeBox, 1 ); - pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pRightBox, 2 ); + pInsLine->GetTabBoxes().insert( pInsLine->GetTabBoxes().begin() + 1, pMergeBox); + pInsLine->GetTabBoxes().insert( pInsLine->GetTabBoxes().begin() + 2, pRightBox ); pRightBox->ClaimFrmFmt(); // This contains all Lines that are above the selected Area, @@ -1837,7 +1839,9 @@ sal_Bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, // Clean up this Line's structure once again, generally all of them GCLines(); - GetTabLines()[0]->GetTabBoxes().ForEach( &lcl_BoxSetHeadCondColl, 0 ); + for( SwTableBoxes::iterator it = GetTabLines()[0]->GetTabBoxes().begin(); + it != GetTabLines()[0]->GetTabBoxes().end(); ++it) + lcl_BoxSetHeadCondColl(*it); aFndBox.MakeFrms( *this ); @@ -1855,7 +1859,7 @@ void lcl_CheckRowSpan( SwTable &rTbl ) while( nMaxSpan ) { SwTableLine* pLine = rTbl.GetTabLines()[ nLineCount - nMaxSpan ]; - for( sal_uInt16 nBox = 0; nBox < pLine->GetTabBoxes().Count(); ++nBox ) + for( sal_uInt16 nBox = 0; nBox < pLine->GetTabBoxes().size(); ++nBox ) { SwTableBox* pBox = pLine->GetTabBoxes()[nBox]; long nRowSpan = pBox->getRowSpan(); @@ -1917,9 +1921,9 @@ void lcl_CalcNewWidths( const _FndLines& rFndLines, _CpyPara& rPara ) if( pFndLine && pFndLine->GetBoxes().size() ) { const SwTableLine *pLine = pFndLine->GetLine(); - if( pLine && pLine->GetTabBoxes().Count() ) + if( pLine && !pLine->GetTabBoxes().empty() ) { - sal_uInt16 nBoxCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nBoxCount = pLine->GetTabBoxes().size(); sal_uLong nPos = 0; // The first selected box... const SwTableBox *const pSel = @@ -2042,7 +2046,7 @@ static void lcl_CopyBoxToDoc(_FndBox const& rFndBox, _CpyPara *const pCpyPara) { pBox = new SwTableBox( aFindFrm.pNewFrmFmt, rFndBox.GetLines().size(), pCpyPara->pInsLine ); - pCpyPara->pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, pCpyPara->nInsPos++ ); + pCpyPara->pInsLine->GetTabBoxes().insert( pCpyPara->pInsLine->GetTabBoxes().begin() + pCpyPara->nInsPos++, pBox ); _CpyPara aPara( *pCpyPara, pBox ); aPara.nNewSize = nSize; // get the size BOOST_FOREACH(_FndLine const& rFndLine, rFndBox.GetLines()) @@ -2146,7 +2150,7 @@ lcl_CopyLineToDoc(const _FndLine& rFndLine, _CpyPara *const pCpyPara) aPara.nBoxIdx = 1; } else if( rFndLine.GetBoxes().size() == - rFndLine.GetLine()->GetTabBoxes().Count() ) + rFndLine.GetLine()->GetTabBoxes().size() ) { // Get the Parent's size const SwFrmFmt* pFmt; @@ -2206,7 +2210,7 @@ sal_Bool SwTable::CopyHeadlineIntoTable( SwTableNode& rTblNd ) if( rTblNd.GetTable().IsNewModel() ) { // The copied line must not contain any row span attributes > 1 SwTableLine* pLine = rTblNd.GetTable().GetTabLines()[0]; - sal_uInt16 nColCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nColCount = pLine->GetTabBoxes().size(); OSL_ENSURE( nColCount, "Empty Table Line" ); for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) { @@ -2310,14 +2314,18 @@ sal_Bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, SwCollectTblLineBoxes aLnPara( sal_False, HEADLINE_BORDERCOPY ); pLn = GetTabLines()[ nLnPos - 1 ]; - pLn->GetTabBoxes().ForEach( &lcl_Box_CollectBox, &aLnPara ); + for( SwTableBoxes::iterator it = pLn->GetTabBoxes().begin(); + it != pLn->GetTabBoxes().end(); ++it) + lcl_Box_CollectBox( *it, &aLnPara ); if( aLnPara.Resize( lcl_GetBoxOffset( aFndBox ), lcl_GetLineWidth( *pFndLn )) ) { aLnPara.SetValues( sal_True ); pLn = pNewTbl->GetTabLines()[ 0 ]; - pLn->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, &aLnPara ); + for( SwTableBoxes::iterator it = pLn->GetTabBoxes().begin(); + it != pLn->GetTabBoxes().end(); ++it) + lcl_BoxSetSplitBoxFmts(*it, &aLnPara ); } } @@ -2331,14 +2339,18 @@ sal_Bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, SwCollectTblLineBoxes aLnPara( sal_True, HEADLINE_BORDERCOPY ); pLn = GetTabLines()[ nLnPos + 1 ]; - pLn->GetTabBoxes().ForEach( &lcl_Box_CollectBox, &aLnPara ); + for( SwTableBoxes::iterator it = pLn->GetTabBoxes().begin(); + it != pLn->GetTabBoxes().end(); ++it) + lcl_Box_CollectBox( *it, &aLnPara ); if( aLnPara.Resize( lcl_GetBoxOffset( aFndBox ), lcl_GetLineWidth( *pFndLn )) ) { aLnPara.SetValues( sal_False ); pLn = pNewTbl->GetTabLines()[ pNewTbl->GetTabLines().Count()-1 ]; - pLn->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, &aLnPara ); + for( SwTableBoxes::iterator it = pLn->GetTabBoxes().begin(); + it != pLn->GetTabBoxes().end(); ++it) + lcl_BoxSetSplitBoxFmts(*it, &aLnPara ); } } } @@ -2367,9 +2379,9 @@ SwTableBox* SwTableLine::FindNextBox( const SwTable& rTbl, const SwTableLine* pLine = this; // for M800 SwTableBox* pBox; sal_uInt16 nFndPos; - if( GetTabBoxes().Count() && pSrchBox && + if( !GetTabBoxes().empty() && pSrchBox && USHRT_MAX != ( nFndPos = GetTabBoxes().GetPos( pSrchBox )) && - nFndPos + 1 != GetTabBoxes().Count() ) + nFndPos + 1 != (sal_uInt16)GetTabBoxes().size() ) { pBox = GetTabBoxes()[ nFndPos + 1 ]; while( pBox->GetTabLines().Count() ) @@ -2398,11 +2410,11 @@ SwTableBox* SwTableLine::FindNextBox( const SwTable& rTbl, else return 0; - if( pLine->GetTabBoxes().Count() ) + if( !pLine->GetTabBoxes().empty() ) { - pBox = pLine->GetTabBoxes()[0]; + pBox = pLine->GetTabBoxes().front(); while( pBox->GetTabLines().Count() ) - pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0]; + pBox = pBox->GetTabLines()[0]->GetTabBoxes().front(); return pBox; } return pLine->FindNextBox( rTbl, 0, bOvrTblLns ); @@ -2415,7 +2427,7 @@ SwTableBox* SwTableLine::FindPreviousBox( const SwTable& rTbl, const SwTableLine* pLine = this; // for M800 SwTableBox* pBox; sal_uInt16 nFndPos; - if( GetTabBoxes().Count() && pSrchBox && + if( !GetTabBoxes().empty() && pSrchBox && USHRT_MAX != ( nFndPos = GetTabBoxes().GetPos( pSrchBox )) && nFndPos ) { @@ -2423,7 +2435,7 @@ SwTableBox* SwTableLine::FindPreviousBox( const SwTable& rTbl, while( pBox->GetTabLines().Count() ) { pLine = pBox->GetTabLines()[pBox->GetTabLines().Count()-1]; - pBox = pLine->GetTabBoxes()[pLine->GetTabBoxes().Count()-1]; + pBox = pLine->GetTabBoxes().back(); } return pBox; } @@ -2449,13 +2461,13 @@ SwTableBox* SwTableLine::FindPreviousBox( const SwTable& rTbl, else return 0; - if( pLine->GetTabBoxes().Count() ) + if( !pLine->GetTabBoxes().empty() ) { - pBox = pLine->GetTabBoxes()[pLine->GetTabBoxes().Count()-1]; + pBox = pLine->GetTabBoxes().back(); while( pBox->GetTabLines().Count() ) { pLine = pBox->GetTabLines()[pBox->GetTabLines().Count()-1]; - pBox = pLine->GetTabBoxes()[pLine->GetTabBoxes().Count()-1]; + pBox = pLine->GetTabBoxes().back(); } return pBox; } @@ -2483,20 +2495,22 @@ SwTableBox* SwTableBox::FindPreviousBox( const SwTable& rTbl, bOvrTblLns ); } -sal_Bool lcl_BoxSetHeadCondColl( const SwTableBox*& rpBox, void* ) +static sal_Bool lcl_BoxSetHeadCondColl( SwTableBox* pBox ) { // We need to adapt the paragraphs with conditional templates in the HeadLine - const SwStartNode* pSttNd = rpBox->GetSttNd(); + const SwStartNode* pSttNd = pBox->GetSttNd(); if( pSttNd ) pSttNd->CheckSectionCondColl(); else - ((SwTableBox*)rpBox)->GetTabLines().ForEach( &lcl_LineSetHeadCondColl, 0 ); + pBox->GetTabLines().ForEach( &lcl_LineSetHeadCondColl, 0 ); return sal_True; } sal_Bool lcl_LineSetHeadCondColl( const SwTableLine*& rpLine, void* ) { - ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_BoxSetHeadCondColl, 0 ); + for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); + it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) + lcl_BoxSetHeadCondColl(*it); return sal_True; } @@ -2507,7 +2521,7 @@ SwTwips lcl_GetDistance( SwTableBox* pBox, sal_Bool bLeft ) SwTableLine* pLine; while( pBox && 0 != ( pLine = pBox->GetUpper() ) ) { - sal_uInt16 nStt = 0, nPos = pLine->GetTabBoxes().C40_GETPOS( SwTableBox, pBox ); + sal_uInt16 nStt = 0, nPos = pLine->GetTabBoxes().GetPos( pBox ); if( bFirst && !bLeft ) ++nPos; @@ -2525,7 +2539,7 @@ sal_Bool lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, SwTwips nDist, sal_Bool bCheck ) { SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.size(); ++n ) { SwTableBox* pBox = rBoxes[ n ]; SwFrmFmt* pFmt = pBox->GetFrmFmt(); @@ -2626,7 +2640,7 @@ sal_Bool lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, SwTwips nDist, sal_Bool bCheck ) { SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.size(); ++n ) { SwTableBox* pBox = rBoxes[ n ]; SwFrmFmt* pFmt = pBox->GetFrmFmt(); @@ -2721,7 +2735,7 @@ sal_Bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, { SwTableBoxes& rBoxes = pLine->GetTabBoxes(); sal_uInt16 n, nCmp; - for( n = 0; n < rBoxes.Count(); ++n ) + for( n = 0; n < rBoxes.size(); ++n ) { SwTableBox* pBox = rBoxes[ n ]; SwTableBoxFmt* pFmt = (SwTableBoxFmt*)pBox->GetFrmFmt(); @@ -2865,7 +2879,7 @@ sal_Bool lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, // Find the right width to which the relative width adjustment // corresponds to SwTwips nTmpDist = nDist; - for( n = 0; n < rBoxes.Count(); ++n ) + for( n = 0; n < rBoxes.size(); ++n ) { SwTwips nWidth = rBoxes[ n ]->GetFrmFmt()->GetFrmSize().GetWidth(); if( (nTmpDist + nWidth / 2 ) > rParam.nSide ) @@ -2879,7 +2893,7 @@ sal_Bool lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, } } - for( n = 0; n < rBoxes.Count(); ++n ) + for( n = 0; n < rBoxes.size(); ++n ) { SwTableBox* pBox = rBoxes[ n ]; SwFrmFmt* pFmt = pBox->GetFrmFmt(); @@ -2896,7 +2910,7 @@ sal_Bool lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( rParam.bLeft ? ((nDist + nWidth / 2 ) <= rParam.nSide && (TBLFIX_CHGABS != rParam.nMode || - (n < rBoxes.Count() && + (n < rBoxes.size() && (nDist + nWidth + rBoxes[ n+1 ]-> GetFrmFmt()->GetFrmSize().GetWidth() / 2) > rParam.nSide) )) @@ -2960,7 +2974,7 @@ sal_Bool lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( nLowerDiff || (rParam.bLeft ? ((nDist + nWidth / 2 ) <= rParam.nSide && (TBLFIX_CHGABS != rParam.nMode || - (n < rBoxes.Count() && + (n < rBoxes.size() && (nDist + nWidth + rBoxes[ n+1 ]-> GetFrmFmt()->GetFrmSize().GetWidth() / 2) > rParam.nSide) )) @@ -3050,13 +3064,13 @@ void lcl_DelSelBox_CorrLowers( SwTableLine& rLine, CR_SetBoxWidth& rParam, SwTwips nBoxWidth = 0; sal_uInt16 n; - for( n = rBoxes.Count(); n; ) + for( n = rBoxes.size(); n; ) nBoxWidth += rBoxes[ --n ]->GetFrmFmt()->GetFrmSize().GetWidth(); if( COLFUZZY < Abs( nWidth - nBoxWidth )) { // Thus, they need to be adjusted - for( n = rBoxes.Count(); n; ) + for( n = rBoxes.size(); n; ) { SwTableBox* pBox = rBoxes[ --n ]; SwFmtFrmSize aNew( pBox->GetFrmFmt()->GetFrmSize() ); @@ -3164,7 +3178,7 @@ sal_Bool lcl_DeleteBox_Rekursiv( CR_SetBoxWidth& rParam, SwTableBox& rBox, for( sal_uInt16 i = rBox.GetTabLines().Count(); i; ) { SwTableLine& rLine = *rBox.GetTabLines()[ --i ]; - for( sal_uInt16 n = rLine.GetTabBoxes().Count(); n; ) + for( sal_uInt16 n = rLine.GetTabBoxes().size(); n; ) if( !::lcl_DeleteBox_Rekursiv( rParam, *rLine.GetTabBoxes()[ --n ], bCheck )) return sal_False; @@ -3180,7 +3194,7 @@ sal_Bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, sal_uInt16 n, nCntEnd, nBoxChkStt, nBoxChkEnd, nDelWidth = 0; if( rParam.bLeft ) { - n = rBoxes.Count(); + n = rBoxes.size(); nCntEnd = 0; nBoxChkStt = (sal_uInt16)rParam.nSide; nBoxChkEnd = static_cast<sal_uInt16>(rParam.nSide + rParam.nBoxWidth); @@ -3188,7 +3202,7 @@ sal_Bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, else { n = 0; - nCntEnd = rBoxes.Count(); + nCntEnd = rBoxes.size(); nBoxChkStt = static_cast<sal_uInt16>(rParam.nSide - rParam.nBoxWidth); nBoxChkEnd = (sal_uInt16)rParam.nSide; } @@ -3325,7 +3339,7 @@ sal_Bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, return sal_False; // Do the Box and its Lines still exist? - if( n < rBoxes.Count() && + if( n < rBoxes.size() && pBox == rBoxes[ rParam.bLeft ? n : n-1 ] && i < pBox->GetTabLines().Count() && pLine == pBox->GetTabLines()[ i ] ) @@ -3355,7 +3369,7 @@ sal_Bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, if( !bCheck ) { // Has the Box already been removed? - if( n > rBoxes.Count() || + if( n > rBoxes.size() || pBox != rBoxes[ ( rParam.bLeft ? n : n-1 ) ] ) { // Then change the loop variable when deleting to the right @@ -3451,7 +3465,7 @@ sal_Bool lcl_DelOtherBox( SwTableLine* , CR_SetBoxWidth& , SwTwips , sal_Bool ) void lcl_AjustLines( SwTableLine* pLine, CR_SetBoxWidth& rParam ) { SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.size(); ++n ) { SwTableBox* pBox = rBoxes[ n ]; @@ -3912,8 +3926,8 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, SwTableLine* pLine = rAktBox.GetUpper(); while( pLine->GetUpper() ) { - sal_uInt16 nPos = pLine->GetTabBoxes().C40_GETPOS( SwTableBox, pBox ); - if( bLeft ? nPos : nPos + 1 != pLine->GetTabBoxes().Count() ) + sal_uInt16 nPos = pLine->GetTabBoxes().GetPos( pBox ); + if( bLeft ? nPos : nPos + 1 != (sal_uInt16)pLine->GetTabBoxes().size() ) break; pBox = pLine->GetUpper(); @@ -4089,7 +4103,7 @@ void SetLineHeight( SwTableLine& rLine, SwTwips nOldHeight, SwTwips nNewHeight, // First adapt all internal ones SwTableBoxes& rBoxes = rLine.GetTabBoxes(); - for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.size(); ++n ) { SwTableBox& rBox = *rBoxes[ n ]; for( sal_uInt16 i = 0; i < rBox.GetTabLines().Count(); ++i ) @@ -4181,11 +4195,11 @@ sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, { sal_uInt16 n; - for( n = rBoxes.Count(); n; ) + for( n = rBoxes.size(); n; ) ::lcl_SaveUpperLowerBorder( rParam.pTblNd->GetTable(), *rBoxes[ --n ], rParam.aShareFmts ); - for( n = rBoxes.Count(); n; ) + for( n = rBoxes.size(); n; ) ::_DeleteBox( rParam.pTblNd->GetTable(), rBoxes[ --n ], rParam.pUndo, sal_False, sal_False, &rParam.aShareFmts ); @@ -4194,7 +4208,7 @@ sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, { // Insert Line SwTableLine* pNewLine = new SwTableLine( (SwTableLineFmt*)pLine->GetFrmFmt(), - rBoxes.Count(), pLine->GetUpper() ); + rBoxes.size(), pLine->GetUpper() ); SwTableLines* pLines; if( pLine->GetUpper() ) pLines = &pLine->GetUpper()->GetTabLines(); @@ -4210,7 +4224,7 @@ sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, // And once again calculate the Box count SwTableBoxes& rNewBoxes = pNewLine->GetTabBoxes(); - for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.size(); ++n ) { SwTwips nWidth = 0; SwTableBox* pOld = rBoxes[ n ]; @@ -4246,7 +4260,7 @@ sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, { // Collect Boxes! SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - for( sal_uInt16 n = rBoxes.Count(); n; ) + for( sal_uInt16 n = rBoxes.size(); n; ) { SwTableBox* pBox = rBoxes[ --n ]; if( pBox->GetFrmFmt()->GetProtect().IsCntntProtected() ) diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 9b1ec4ce0d53..a698cd6a2e1c 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -324,17 +324,13 @@ struct _CopyTable {} }; -sal_Bool lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara ); - sal_Bool lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara ); -sal_Bool lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara ) +static void lcl_CopyTblBox( SwTableBox* pBox, _CopyTable* pCT ) { - _CopyTable* pCT = reinterpret_cast< _CopyTable* >(pPara); - - SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rpBox->GetFrmFmt(); + SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)pBox->GetFrmFmt(); pCT->rMapArr.ForEach( lcl_SrchNew, &pBoxFmt ); - if( pBoxFmt == rpBox->GetFrmFmt() ) // ein neues anlegen ?? + if( pBoxFmt == pBox->GetFrmFmt() ) // ein neues anlegen ?? { const SfxPoolItem* pItem; if( SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_FORMULA, sal_False, @@ -344,9 +340,9 @@ sal_Bool lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara ) } pBoxFmt = pCT->pDoc->MakeTableBoxFmt(); - pBoxFmt->CopyAttrs( *rpBox->GetFrmFmt() ); + pBoxFmt->CopyAttrs( *pBox->GetFrmFmt() ); - if( rpBox->GetSttIdx() ) + if( pBox->GetSttIdx() ) { SvNumberFormatter* pN = pCT->pDoc->GetNumberFormatter( sal_False ); if( pN && pN->HasMergeFmtTbl() && SFX_ITEM_SET == pBoxFmt-> @@ -360,36 +356,34 @@ sal_Bool lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara ) } } - pCT->rMapArr.Insert( _MapTblFrmFmt( rpBox->GetFrmFmt(), pBoxFmt ), + pCT->rMapArr.Insert( _MapTblFrmFmt( pBox->GetFrmFmt(), pBoxFmt ), pCT->rMapArr.Count() ); } - sal_uInt16 nLines = rpBox->GetTabLines().Count(); + sal_uInt16 nLines = pBox->GetTabLines().Count(); SwTableBox* pNewBox; if( nLines ) pNewBox = new SwTableBox( pBoxFmt, nLines, pCT->pInsLine ); else { SwNodeIndex aNewIdx( *pCT->pTblNd, - rpBox->GetSttIdx() - pCT->nOldTblSttIdx ); + pBox->GetSttIdx() - pCT->nOldTblSttIdx ); OSL_ENSURE( aNewIdx.GetNode().IsStartNode(), "Index nicht auf einem StartNode" ); pNewBox = new SwTableBox( pBoxFmt, aNewIdx, pCT->pInsLine ); - pNewBox->setRowSpan( rpBox->getRowSpan() ); + pNewBox->setRowSpan( pBox->getRowSpan() ); } - pCT->pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pNewBox, - pCT->pInsLine->GetTabBoxes().Count() ); + pCT->pInsLine->GetTabBoxes().push_back( pNewBox ); if( nLines ) { _CopyTable aPara( *pCT ); aPara.pInsBox = pNewBox; - ((SwTableBox*)rpBox)->GetTabLines().ForEach( &lcl_CopyTblLine, &aPara ); + pBox->GetTabLines().ForEach( &lcl_CopyTblLine, &aPara ); } else if( pNewBox->IsInHeadline( &pCT->pTblNd->GetTable() )) // in der HeadLine sind die Absaetze mit BedingtenVorlage anzupassen pNewBox->GetSttNd()->CheckSectionCondColl(); - return sal_True; } sal_Bool lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara ) @@ -405,7 +399,7 @@ sal_Bool lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara ) pCT->rMapArr.Count()); } SwTableLine* pNewLine = new SwTableLine( pLineFmt, - rpLine->GetTabBoxes().Count(), pCT->pInsBox ); + rpLine->GetTabBoxes().size(), pCT->pInsBox ); // die neue Zeile in die Tabelle eintragen if( pCT->pInsBox ) { @@ -418,7 +412,9 @@ sal_Bool lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara ) pCT->pTblNd->GetTable().GetTabLines().Count() ); } pCT->pInsLine = pNewLine; - ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_CopyTblBox, pCT ); + for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); + it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) + lcl_CopyTblBox(*it, pCT ); return sal_True; } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 2d231455f7cb..a6efdba97ea6 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -250,9 +250,9 @@ sal_Bool SwNodes::InsBoxen( SwTableNode* pTblNd, // Index hinter die letzte Box der Line sal_uLong nIdxPos = 0; SwTableBox *pPrvBox = 0, *pNxtBox = 0; - if( pLine->GetTabBoxes().Count() ) + if( !pLine->GetTabBoxes().empty() ) { - if( nInsPos < pLine->GetTabBoxes().Count() ) + if( nInsPos < pLine->GetTabBoxes().size() ) { if( 0 == (pPrvBox = pLine->FindPreviousBox( pTblNd->GetTable(), pLine->GetTabBoxes()[ nInsPos ] ))) @@ -261,7 +261,7 @@ sal_Bool SwNodes::InsBoxen( SwTableNode* pTblNd, else { if( 0 == (pNxtBox = pLine->FindNextBox( pTblNd->GetTable(), - pLine->GetTabBoxes()[ pLine->GetTabBoxes().Count()-1 ] ))) + pLine->GetTabBoxes().back() ))) pNxtBox = pLine->FindNextBox( pTblNd->GetTable() ); } } @@ -307,10 +307,10 @@ sal_Bool SwNodes::InsBoxen( SwTableNode* pTblNd, SwTableBoxes & rTabBoxes = pLine->GetTabBoxes(); sal_uInt16 nRealInsPos = nInsPos + n; - if (nRealInsPos > rTabBoxes.Count()) - nRealInsPos = rTabBoxes.Count(); + if (nRealInsPos > rTabBoxes.size()) + nRealInsPos = rTabBoxes.size(); - rTabBoxes.C40_INSERT( SwTableBox, pPrvBox, nRealInsPos ); + rTabBoxes.insert( rTabBoxes.begin() + nRealInsPos, pPrvBox ); if( ! pTxtColl->IsAssignedToListLevelOfOutlineStyle()//<-end,zhaojianwei //FEATURE::CONDCOLL @@ -544,7 +544,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, } SwTableBox *pBox = new SwTableBox( pBoxF, aNdIdx, pLine); - rBoxes.C40_INSERT( SwTableBox, pBox, i ); + rBoxes.insert( rBoxes.begin() + i, pBox ); aNdIdx += 3; // StartNode, TextNode, EndNode == 3 Nodes } } @@ -775,7 +775,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, for( sal_uInt16 n = 0; n < nRows; ++n ) { SwTableBoxes& rBoxes = rLines[ n ]->GetTabBoxes(); - sal_uInt16 nCols = rBoxes.Count(); + sal_uInt16 nCols = rBoxes.size(); for( sal_uInt16 i = 0; i < nCols; ++i ) { SwTableBox* pBox = rBoxes[ i ]; @@ -1007,7 +1007,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, // Section der Box zuweisen pBox = new SwTableBox( pBoxFmt, *pSttNd, pLine ); - pLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, nBoxes++ ); + pLine->GetTabBoxes().insert( pLine->GetTabBoxes().begin() + nBoxes++, pBox ); } // und jetzt den letzten Teil-String @@ -1021,7 +1021,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, pTxtNd->pStartOfSection = pSttNd; pBox = new SwTableBox( pBoxFmt, *pSttNd, pLine ); - pLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, nBoxes++ ); + pLine->GetTabBoxes().insert( pLine->GetTabBoxes().begin() + nBoxes++, pBox ); if( nMaxBoxes < nBoxes ) nMaxBoxes = nBoxes; } @@ -1032,7 +1032,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, for( n = 0; n < pTable->GetTabLines().Count(); ++n ) { SwTableLine* pCurrLine = pTable->GetTabLines()[ n ]; - if( nMaxBoxes != ( nBoxes = pCurrLine->GetTabBoxes().Count() )) + if( nMaxBoxes != ( nBoxes = pCurrLine->GetTabBoxes().size() )) { InsBoxen( pTblNd, pCurrLine, pBoxFmt, pTxtColl, 0, nBoxes, nMaxBoxes - nBoxes ); @@ -1366,7 +1366,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, // Section der Box zuweisen pBox = new SwTableBox( pBoxFmt, *pSttNd, pLine ); - pLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, nBoxes++ ); + pLine->GetTabBoxes().insert( pLine->GetTabBoxes().begin() + nBoxes++, pBox ); } if( nMaxBoxes < nBoxes ) nMaxBoxes = nBoxes; @@ -1468,13 +1468,15 @@ struct _DelTabPara // forward deklarieren damit sich die Lines und Boxen rekursiv aufrufen // koennen. -sal_Bool lcl_DelBox( const SwTableBox*&, void *pPara ); +static void lcl_DelBox( SwTableBox* pBox, _DelTabPara* pDelPara ); sal_Bool lcl_DelLine( const SwTableLine*& rpLine, void* pPara ) { OSL_ENSURE( pPara, "die Parameter fehlen" ); _DelTabPara aPara( *(_DelTabPara*)pPara ); - ((SwTableLine*&)rpLine)->GetTabBoxes().ForEach( &lcl_DelBox, &aPara ); + for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); + it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) + lcl_DelBox(*it, &aPara ); if( rpLine->GetUpper() ) // gibt es noch eine uebergeordnete Box ?? // dann gebe den letzten TextNode zurueck ((_DelTabPara*)pPara)->pLastNd = aPara.pLastNd; @@ -1482,19 +1484,18 @@ sal_Bool lcl_DelLine( const SwTableLine*& rpLine, void* pPara ) } -sal_Bool lcl_DelBox( const SwTableBox*& rpBox, void* pPara ) +static void lcl_DelBox( SwTableBox* pBox, _DelTabPara* pDelPara ) { - OSL_ENSURE( pPara, "die Parameter fehlen" ); + OSL_ENSURE( pDelPara, "die Parameter fehlen" ); // loesche erstmal die Lines der Box - _DelTabPara* pDelPara = (_DelTabPara*)pPara; - if( rpBox->GetTabLines().Count() ) - ((SwTableBox*&)rpBox)->GetTabLines().ForEach( &lcl_DelLine, pDelPara ); + if( pBox->GetTabLines().Count() ) + pBox->GetTabLines().ForEach( &lcl_DelLine, pDelPara ); else { SwDoc* pDoc = pDelPara->rNds.GetDoc(); - SwNodeRange aDelRg( *rpBox->GetSttNd(), 0, - *rpBox->GetSttNd()->EndOfSectionNode() ); + SwNodeRange aDelRg( *pBox->GetSttNd(), 0, + *pBox->GetSttNd()->EndOfSectionNode() ); // loesche die Section pDelPara->rNds.SectionUp( &aDelRg ); const SwTxtNode* pCurTxtNd; @@ -1542,7 +1543,6 @@ sal_Bool lcl_DelBox( const SwTableBox*& rpBox, void* pPara ) if( pDelPara->pLastNd && pDelPara->pLastNd->HasSwAttrSet() ) pDelPara->pLastNd->ResetAttr( RES_PARATR_ADJUST ); } - return sal_True; } @@ -1841,13 +1841,12 @@ sal_Bool SwDoc::DeleteRow( const SwCursor& rCursor ) } SwTableLine* pDelLine = pFndBox->GetLines().back().GetLine(); - SwTableBox* pDelBox = pDelLine->GetTabBoxes()[ - pDelLine->GetTabBoxes().Count() - 1 ]; + SwTableBox* pDelBox = pDelLine->GetTabBoxes().back(); while( !pDelBox->GetSttNd() ) { SwTableLine* pLn = pDelBox->GetTabLines()[ pDelBox->GetTabLines().Count()-1 ]; - pDelBox = pLn->GetTabBoxes()[ pLn->GetTabBoxes().Count() - 1 ]; + pDelBox = pLn->GetTabBoxes().back(); } SwTableBox* pNextBox = pDelLine->FindNextBox( pTblNd->GetTable(), pDelBox, sal_True ); @@ -3007,16 +3006,19 @@ sal_Bool lcl_Line_CollectBox( const SwTableLine*& rpLine, void* pPara ) { SwCollectTblLineBoxes* pSplPara = (SwCollectTblLineBoxes*)pPara; if( pSplPara->IsGetValues() ) - ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_Box_CollectBox, pPara ); + for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); + it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) + lcl_Box_CollectBox(*it, pSplPara ); else - ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, pPara ); + for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); + it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) + lcl_BoxSetSplitBoxFmts(*it, pSplPara ); return sal_True; } -sal_Bool lcl_Box_CollectBox( const SwTableBox*& rpBox, void* pPara ) +void lcl_Box_CollectBox( const SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara ) { - SwCollectTblLineBoxes* pSplPara = (SwCollectTblLineBoxes*)pPara; - sal_uInt16 nLen = rpBox->GetTabLines().Count(); + sal_uInt16 nLen = pBox->GetTabLines().Count(); if( nLen ) { // dann mit der richtigen Line weitermachen @@ -3025,18 +3027,16 @@ sal_Bool lcl_Box_CollectBox( const SwTableBox*& rpBox, void* pPara ) else --nLen; - const SwTableLine* pLn = rpBox->GetTabLines()[ nLen ]; - lcl_Line_CollectBox( pLn, pPara ); + const SwTableLine* pLn = pBox->GetTabLines()[ nLen ]; + lcl_Line_CollectBox( pLn, pSplPara ); } else - pSplPara->AddBox( *rpBox ); - return sal_True; + pSplPara->AddBox( *pBox ); } -sal_Bool lcl_BoxSetSplitBoxFmts( const SwTableBox*& rpBox, void* pPara ) +void lcl_BoxSetSplitBoxFmts( SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara ) { - SwCollectTblLineBoxes* pSplPara = (SwCollectTblLineBoxes*)pPara; - sal_uInt16 nLen = rpBox->GetTabLines().Count(); + sal_uInt16 nLen = pBox->GetTabLines().Count(); if( nLen ) { // dann mit der richtigen Line weitermachen @@ -3045,14 +3045,13 @@ sal_Bool lcl_BoxSetSplitBoxFmts( const SwTableBox*& rpBox, void* pPara ) else --nLen; - const SwTableLine* pLn = rpBox->GetTabLines()[ nLen ]; - lcl_Line_CollectBox( pLn, pPara ); + const SwTableLine* pLn = pBox->GetTabLines()[ nLen ]; + lcl_Line_CollectBox( pLn, pSplPara ); } else { - const SwTableBox* pSrcBox = pSplPara->GetBoxOfPos( *rpBox ); + const SwTableBox* pSrcBox = pSplPara->GetBoxOfPos( *pBox ); SwFrmFmt* pFmt = pSrcBox->GetFrmFmt(); - SwTableBox* pBox = (SwTableBox*)rpBox; if( HEADLINE_BORDERCOPY == pSplPara->GetMode() ) { @@ -3101,7 +3100,6 @@ sal_uInt16 aTableSplitBoxSetRange[] = { pBox->GetSttNd()->CheckSectionCondColl(); } } - return sal_True; } @@ -3177,11 +3175,15 @@ sal_Bool SwDoc::SplitTable( const SwPosition& rPos, sal_uInt16 eHdlnMode, SwCollectTblLineBoxes aPara( sal_False, eHdlnMode ); SwTableLine* pLn = rTbl.GetTabLines()[ rTbl.GetTabLines().Count() - 1 ]; - pLn->GetTabBoxes().ForEach( &lcl_Box_CollectBox, &aPara ); + for( SwTableBoxes::iterator it = pLn->GetTabBoxes().begin(); + it != pLn->GetTabBoxes().end(); ++it) + lcl_Box_CollectBox(*it, &aPara ); aPara.SetValues( sal_True ); pLn = pNew->GetTable().GetTabLines()[ 0 ]; - pLn->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, &aPara ); + for( SwTableBoxes::iterator it = pLn->GetTabBoxes().begin(); + it != pLn->GetTabBoxes().end(); ++it) + lcl_BoxSetSplitBoxFmts(*it, &aPara ); // Kopfzeile wiederholen abschalten pNew->GetTable().SetRowsToRepeat( 0 ); @@ -3198,11 +3200,15 @@ sal_Bool SwDoc::SplitTable( const SwPosition& rPos, sal_uInt16 eHdlnMode, SwCollectTblLineBoxes aPara( sal_True, eHdlnMode, pHst ); SwTableLine* pLn = rTbl.GetTabLines()[ 0 ]; - pLn->GetTabBoxes().ForEach( &lcl_Box_CollectBox, &aPara ); + for( SwTableBoxes::iterator it = pLn->GetTabBoxes().begin(); + it != pLn->GetTabBoxes().end(); ++it) + lcl_Box_CollectBox(*it, &aPara ); aPara.SetValues( sal_True ); pLn = pNew->GetTable().GetTabLines()[ 0 ]; - pLn->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, &aPara ); + for( SwTableBoxes::iterator it = pLn->GetTabBoxes().begin(); + it != pLn->GetTabBoxes().end(); ++it) + lcl_BoxSetSplitBoxFmts(*it, &aPara ); } break; @@ -3260,7 +3266,7 @@ sal_Bool lcl_ChgTblSize( SwTable& rTbl ) { SwTwips nMaxLnWidth = 0; SwTableBoxes& rBoxes = rLns[ nLns ]->GetTabBoxes(); - for( sal_uInt16 nBox = 0; nBox < rBoxes.Count(); ++nBox ) + for( sal_uInt16 nBox = 0; nBox < rBoxes.size(); ++nBox ) nMaxLnWidth += rBoxes[nBox]->GetFrmFmt()->GetFrmSize().GetWidth(); if( nMaxLnWidth > aTblMaxSz.GetWidth() ) @@ -3303,7 +3309,7 @@ public: }; -sal_Bool lcl_SplitTable_CpyBox( const SwTableBox*& rpBox, void* pPara ); +static void lcl_SplitTable_CpyBox( SwTableBox* pBox, _SplitTable_Para* pPara ); sal_Bool lcl_SplitTable_CpyLine( const SwTableLine*& rpLine, void* pPara ) { @@ -3320,30 +3326,28 @@ sal_Bool lcl_SplitTable_CpyLine( const SwTableLine*& rpLine, void* pPara ) else pLn->ChgFrmFmt( (SwTableLineFmt*)rPara.DestFmt_Get( nPos ) ); - pLn->GetTabBoxes().ForEach( &lcl_SplitTable_CpyBox, pPara ); + for( SwTableBoxes::iterator it = pLn->GetTabBoxes().begin(); + it != pLn->GetTabBoxes().end(); ++it) + lcl_SplitTable_CpyBox(*it, (_SplitTable_Para*)pPara ); return sal_True; } -sal_Bool lcl_SplitTable_CpyBox( const SwTableBox*& rpBox, void* pPara ) +static void lcl_SplitTable_CpyBox( SwTableBox* pBox, _SplitTable_Para* pPara ) { - SwTableBox* pBox = (SwTableBox*)rpBox; - _SplitTable_Para& rPara = *(_SplitTable_Para*)pPara; - SwFrmFmt *pSrcFmt = pBox->GetFrmFmt(); - sal_uInt16 nPos = rPara.SrcFmt_GetPos( pSrcFmt ); + sal_uInt16 nPos = pPara->SrcFmt_GetPos( pSrcFmt ); if( USHRT_MAX == nPos ) { - rPara.DestFmt_Insert( pBox->ClaimFrmFmt() ); - rPara.SrcFmt_Insert( pSrcFmt ); + pPara->DestFmt_Insert( pBox->ClaimFrmFmt() ); + pPara->SrcFmt_Insert( pSrcFmt ); } else - pBox->ChgFrmFmt( (SwTableBoxFmt*)rPara.DestFmt_Get( nPos ) ); + pBox->ChgFrmFmt( (SwTableBoxFmt*)pPara->DestFmt_Get( nPos ) ); if( pBox->GetSttNd() ) - rPara.ChgBox( pBox ); + pPara->ChgBox( pBox ); else pBox->GetTabLines().ForEach( &lcl_SplitTable_CpyLine, pPara ); - return sal_True; } SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, sal_Bool bAfter, @@ -3415,7 +3419,7 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, sal_Bool bAfter, for (sal_uInt16 k = nLinePos; k < rTbl.GetTabLines().Count(); ++k) { sal_uInt16 nLineIdx = (rTbl.GetTabLines().Count() - 1) - k + nLinePos; - sal_uInt16 nBoxCnt = rTbl.GetTabLines()[ nLineIdx ]->GetTabBoxes().Count(); + sal_uInt16 nBoxCnt = rTbl.GetTabLines()[ nLineIdx ]->GetTabBoxes().size(); for (sal_uInt16 j = 0; j < nBoxCnt; ++j) { sal_uInt16 nIdx = nBoxCnt - 1 - j; diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 7f8b5936a15c..9da8c064435c 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -307,7 +307,7 @@ void lcl_ProcessRowSize( SvPtrarr &rFmtCmp, SwTableLine *pLine, const SwFmtFrmSi { lcl_ProcessRowAttr( rFmtCmp, pLine, rNew ); SwTableBoxes &rBoxes = pLine->GetTabBoxes(); - for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rBoxes.size(); ++i ) ::lcl_ProcessBoxSize( rFmtCmp, rBoxes[i], rNew ); } diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index 700de059c237..097fb663fad5 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -276,7 +276,7 @@ sal_Bool SwTblCalcPara::CalcWithStackOverflow() SwTableBox* pBox = (SwTableBox*)pLastTblBox; nStackCnt = 0; rCalc.SetCalcError( CALC_NOERR ); - aStackOverFlows.C40_INSERT( SwTableBox, pBox, nCnt++ ); + aStackOverFlows.insert( aStackOverFlows.begin() + nCnt++, pBox ); pBoxStk->Remove( pBox ); pBox->GetValue( *this ); @@ -297,7 +297,7 @@ sal_Bool SwTblCalcPara::CalcWithStackOverflow() } nMaxSize = nSaveMaxSize; - aStackOverFlows.Remove( 0, aStackOverFlows.Count() ); + aStackOverFlows.clear(); return !rCalc.IsCalcError(); } @@ -786,7 +786,7 @@ const SwTableBox* lcl_RelToBox( const SwTable& rTbl, // dann suche die Box pBoxes = &pLine->GetTabBoxes(); - if( nBoxOffset >= long(pBoxes->Count()) ) + if( nBoxOffset >= long(pBoxes->size()) ) return 0; pBox = (*pBoxes)[ sal_uInt16(nBoxOffset) ]; @@ -806,7 +806,7 @@ const SwTableBox* lcl_RelToBox( const SwTable& rTbl, // bestimme die Box pBoxes = &pLine->GetTabBoxes(); - if( nSttBox >= pBoxes->Count() ) + if( nSttBox >= pBoxes->size() ) break; pBox = (*pBoxes)[ nSttBox ]; } diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index c186a3848f13..f13f79f8e653 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -128,7 +128,7 @@ void SwDDETable::ChangeContent() { String aLine = aExpand.GetToken( n, '\n' ); SwTableLine* pLine = aLines[ n ]; - for( sal_uInt16 i = 0; i < pLine->GetTabBoxes().Count(); ++i ) + for( sal_uInt16 i = 0; i < pLine->GetTabBoxes().size(); ++i ) { SwTableBox* pBox = pLine->GetTabBoxes()[ i ]; OSL_ENSURE( pBox->GetSttIdx(), "keine InhaltsBox" ); diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 28938d00a1b9..73387b05f35e 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -399,13 +399,12 @@ sal_Bool SwFEShell::DeleteRow() } SwTableLine* pDelLine = pFndBox->GetLines().back().GetLine(); - SwTableBox* pDelBox = pDelLine->GetTabBoxes()[ - pDelLine->GetTabBoxes().Count() - 1 ]; + SwTableBox* pDelBox = pDelLine->GetTabBoxes().back(); while( !pDelBox->GetSttNd() ) { SwTableLine* pLn = pDelBox->GetTabLines()[ pDelBox->GetTabLines().Count()-1 ]; - pDelBox = pLn->GetTabBoxes()[ pLn->GetTabBoxes().Count() - 1 ]; + pDelBox = pLn->GetTabBoxes().back(); } SwTableBox* pNextBox = pDelLine->FindNextBox( pTblNd->GetTable(), pDelBox, sal_True ); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index ade24da77b65..ed442cd68b9f 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -258,7 +258,7 @@ void GetTblSel( const SwCursor& rCrsr, SwSelBoxes& rBoxes, for( ; nSttPos <= nEndPos; ++nSttPos ) { pLine = rLines[ nSttPos ]; - for( sal_uInt16 n = pLine->GetTabBoxes().Count(); n ; ) + for( sal_uInt16 n = pLine->GetTabBoxes().size(); n ; ) { SwTableBox* pBox = pLine->GetTabBoxes()[ --n ]; // check for cell protection?? @@ -955,7 +955,6 @@ sal_Bool IsEmptyBox( const SwTableBox& rBox, SwPaM& rPam ) return bRet; } - void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, SwTableBox** ppMergeBox, SwUndoTblMerge* pUndo ) { @@ -1027,7 +1026,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, if( ( rUnion.Right() + COLFUZZY ) < pCell->Frm().Right() ) { sal_uInt16 nInsPos = pBox->GetUpper()-> - GetTabBoxes().C40_GETPOS( SwTableBox, pBox )+1; + GetTabBoxes().GetPos( pBox )+1; lcl_InsTblBox( pTblNd, pDoc, pBox, nInsPos ); pBox->ClaimFrmFmt(); SwFmtFrmSize aNew( @@ -1070,8 +1069,8 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, else if( ( rUnion.Left() - COLFUZZY ) >= pCell->Frm().Left() && ( rUnion.Right() + COLFUZZY ) < pCell->Frm().Right() ) { - sal_uInt16 nInsPos = pBox->GetUpper()->GetTabBoxes(). - C40_GETPOS( SwTableBox, pBox )+1; + sal_uInt16 nInsPos = pBox->GetUpper()->GetTabBoxes().GetPos( + pBox )+1; lcl_InsTblBox( pTblNd, pDoc, pBox, nInsPos, 2 ); pBox->ClaimFrmFmt(); SwFmtFrmSize aNew( @@ -1127,8 +1126,8 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, ( pCell->Frm().Left() + COLFUZZY ) < rUnion.Left() ) { // then we should insert a new box and adjust the widths - sal_uInt16 nInsPos = pBox->GetUpper()->GetTabBoxes(). - C40_GETPOS( SwTableBox, pBox )+1; + sal_uInt16 nInsPos = pBox->GetUpper()->GetTabBoxes().GetPos( + pBox )+1; lcl_InsTblBox( pTblNd, pDoc, pBox, nInsPos, 1 ); SwFmtFrmSize aNew(pBox->GetFrmFmt()->GetFrmSize() ); @@ -1362,11 +1361,11 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, { SwTableBox* pTmpBox = rBoxes[0]; SwTableLine* pInsLine = pTmpBox->GetUpper(); - sal_uInt16 nInsPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, pTmpBox ); + sal_uInt16 nInsPos = pInsLine->GetTabBoxes().GetPos( pTmpBox ); lcl_InsTblBox( pTblNd, pDoc, pTmpBox, nInsPos ); (*ppMergeBox) = pInsLine->GetTabBoxes()[ nInsPos ]; - pInsLine->GetTabBoxes().Remove( nInsPos ); // remove again + pInsLine->GetTabBoxes().erase( pInsLine->GetTabBoxes().begin() + nInsPos ); // remove again (*ppMergeBox)->SetUpper( 0 ); (*ppMergeBox)->ClaimFrmFmt(); @@ -2099,32 +2098,29 @@ void lcl_InsertRow( SwTableLine &rLine, SwLayoutFrm *pUpper, SwFrm *pSibling ) } -sal_Bool _FndBoxCopyCol( const SwTableBox*& rpBox, void* pPara ) +static void _FndBoxCopyCol( SwTableBox* pBox, _FndPara* pFndPara ) { - _FndPara* pFndPara = (_FndPara*)pPara; - _FndBox* pFndBox = new _FndBox( (SwTableBox*)rpBox, pFndPara->pFndLine ); - if( rpBox->GetTabLines().Count() ) + _FndBox* pFndBox = new _FndBox( pBox, pFndPara->pFndLine ); + if( pBox->GetTabLines().Count() ) { _FndPara aPara( *pFndPara, pFndBox ); pFndBox->GetBox()->GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); if( pFndBox->GetLines().empty() ) { delete pFndBox; - return sal_True; + return; } } else { - SwTableBoxPtr pSrch = (SwTableBoxPtr)rpBox; sal_uInt16 nFndPos; - if( !pFndPara->rBoxes.Seek_Entry( pSrch, &nFndPos )) + if( !pFndPara->rBoxes.Seek_Entry( pBox, &nFndPos )) { delete pFndBox; - return sal_True; + return; } } pFndPara->pFndLine->GetBoxes().push_back( pFndBox ); - return sal_True; } sal_Bool _FndLineCopyCol( const SwTableLine*& rpLine, void* pPara ) @@ -2132,7 +2128,9 @@ sal_Bool _FndLineCopyCol( const SwTableLine*& rpLine, void* pPara ) _FndPara* pFndPara = (_FndPara*)pPara; _FndLine* pFndLine = new _FndLine( (SwTableLine*)rpLine, pFndPara->pFndBox ); _FndPara aPara( *pFndPara, pFndLine ); - pFndLine->GetLine()->GetTabBoxes().ForEach( &_FndBoxCopyCol, &aPara ); + for( SwTableBoxes::iterator it = pFndLine->GetLine()->GetTabBoxes().begin(); + it != pFndLine->GetLine()->GetTabBoxes().end(); ++it) + _FndBoxCopyCol(*it, &aPara ); if( pFndLine->GetBoxes().size() ) { pFndPara->pFndBox->GetLines().push_back( pFndLine ); diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx index 5623e95725c4..6f11e225282a 100644 --- a/sw/source/core/inc/tblrwcl.hxx +++ b/sw/source/core/inc/tblrwcl.hxx @@ -50,7 +50,6 @@ class SwFmtFrmSize; struct _CpyPara; struct _InsULPara; -sal_Bool lcl_BoxSetHeadCondColl( const SwTableBox*& rpBox, void* pPara ); sal_Bool lcl_LineSetHeadCondColl( const SwTableLine*& rpLine, void* pPara ); @@ -111,10 +110,10 @@ public: sal_Bool Resize( sal_uInt16 nOffset, sal_uInt16 nWidth ); }; -sal_Bool lcl_Box_CollectBox( const SwTableBox*& rpBox, void* pPara ); +void lcl_Box_CollectBox( const SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara ); sal_Bool lcl_Line_CollectBox( const SwTableLine*& rpLine, void* pPara ); -sal_Bool lcl_BoxSetSplitBoxFmts( const SwTableBox*& rpBox, void* pPara ); +void lcl_BoxSetSplitBoxFmts( SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara ); // This structure is needed by Undo to restore row span attributes // when a table has been splitted into two tables @@ -157,13 +156,11 @@ public: }; sal_Bool lcl_GC_Line_Border( const SwTableLine*& , void* pPara ); -sal_Bool lcl_GC_Box_Border( const SwTableBox*& , 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 ); -sal_Bool lcl_GCBorder_GetLastBox_B( const SwTableBox*& , void* pPara ); class SwShareBoxFmt diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index e08182f4ab2c..27d8ffdb9173 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -3676,10 +3676,10 @@ SwRowFrm::SwRowFrm( const SwTableLine &rLine, SwFrm* pSib, bool bInsertContent ) nType = FRMC_ROW; //Create the boxes and insert them. - const SwTableBoxes &rBoxes = rLine.GetTabBoxes(); + const SwTableBoxes &rBoxes = rLine.GetTabBoxes(); SwFrm *pTmpPrev = 0; - for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i ) - { + for ( sal_uInt16 i = 0; i < rBoxes.size(); ++i ) + { SwCellFrm *pNew = new SwCellFrm( *rBoxes[i], this, bInsertContent ); pNew->InsertBehind( this, pTmpPrev ); pTmpPrev = pNew; diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index 80e8bbaaa094..8f59ac297479 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -128,10 +128,10 @@ if bSet is true, rMin and rMax will be set to the left and right border of the b void lcl_CheckMinMax( long& rMin, long& rMax, const SwTableLine& rLine, sal_uInt16 nCheck, bool bSet ) { ++nCheck; - if( rLine.GetTabBoxes().Count() < nCheck ) + if( rLine.GetTabBoxes().size() < nCheck ) { // robust OSL_FAIL( "Box out of table line" ); - nCheck = rLine.GetTabBoxes().Count(); + nCheck = rLine.GetTabBoxes().size(); } long nNew = 0; // will be the right border of the current box @@ -169,7 +169,7 @@ long lcl_Box2LeftBorder( const SwTableBox& rBox ) return 0; long nLeft = 0; const SwTableLine &rLine = *rBox.GetUpper(); - sal_uInt16 nCount = rLine.GetTabBoxes().Count(); + sal_uInt16 nCount = rLine.GetTabBoxes().size(); for( sal_uInt16 nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) { SwTableBox* pBox = rLine.GetTabBoxes()[nCurrBox]; @@ -203,7 +203,7 @@ SwTableBox* lcl_LeftBorder2Box( long nLeft, const SwTableLine* pLine ) if( !pLine ) return 0; long nCurrLeft = 0; - sal_uInt16 nCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nCount = pLine->GetTabBoxes().size(); for( sal_uInt16 nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox]; @@ -267,7 +267,7 @@ void lcl_ChangeRowSpan( const SwTable& rTable, const long nDiff, bGoOn = false; // will be set to true if we found a non-master cell // which has to be manipulated => we have to chekc the previous row, too. const SwTableLine* pLine = rTable.GetTabLines()[ nRowIdx ]; - sal_uInt16 nBoxCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nBoxCount = pLine->GetTabBoxes().size(); for( sal_uInt16 nCurrBox = 0; nCurrBox < nBoxCount; ++nCurrBox ) { long nRowSpan = pLine->GetTabBoxes()[nCurrBox]->getRowSpan(); @@ -338,7 +338,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const { SwTableLine* pLine = aLines[nRow]; OSL_ENSURE( pLine, "Missing table line" ); - sal_uInt16 nCols = pLine->GetTabBoxes().Count(); + sal_uInt16 nCols = pLine->GetTabBoxes().size(); for( sal_uInt16 nCol = 0; nCol < nCols; ++nCol ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCol]; @@ -382,7 +382,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const long nLeft = 0; long nRight = 0; long nRowSpan = 1; - sal_uInt16 nCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nCount = pLine->GetTabBoxes().size(); for( sal_uInt16 nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox]; @@ -616,7 +616,7 @@ long lcl_InsertPosition( SwTable &rTable, std::vector<sal_uInt16>& rInsPos, SwTableLine* pLine = pBox->GetUpper(); long nWidth = rBoxes[j]->GetFrmFmt()->GetFrmSize().GetWidth(); nAddWidth += nWidth; - sal_uInt16 nCurrBox = pLine->GetTabBoxes().C40_GETPOS(SwTableBox, pBox ); + sal_uInt16 nCurrBox = pLine->GetTabBoxes().GetPos( pBox ); sal_uInt16 nCurrLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pLine ); OSL_ENSURE( nCurrLine != USHRT_MAX, "Time to say Good-Bye.." ); if( rInsPos[ nCurrLine ] == USHRT_MAX ) @@ -662,7 +662,7 @@ sal_Bool SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, std::vector< sal_uInt16 > aInsPos( aLines.Count(), 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().Count(); ++i ) + for( sal_uInt16 i = 0; i < aLines[0]->GetTabBoxes().size(); ++i ) nTableWidth += aLines[0]->GetTabBoxes()[i]->GetFrmFmt()->GetFrmSize().GetWidth(); // Fill the vector of insert positions and the (average) width to insert @@ -773,7 +773,7 @@ sal_Bool SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, { const SwTableBoxes &rTabBoxes = aLines[0]->GetTabBoxes(); long nNewWidth = 0; - for( sal_uInt16 i = 0; i < rTabBoxes.Count(); ++i ) + for( sal_uInt16 i = 0; i < rTabBoxes.size(); ++i ) nNewWidth += rTabBoxes[i]->GetFrmFmt()->GetFrmSize().GetWidth(); OSL_ENSURE( nNewWidth > 0, "Very small" ); } @@ -983,7 +983,7 @@ void SwTable::_FindSuperfluousRows( SwSelBoxes& rBoxes, { SwTableLine* pLine = aLines[nRow]; OSL_ENSURE( pLine, "Missing table line" ); - sal_uInt16 nCols = pLine->GetTabBoxes().Count(); + sal_uInt16 nCols = pLine->GetTabBoxes().size(); bool bSuperfl = true; for( sal_uInt16 nCol = 0; nCol < nCols; ++nCol ) { @@ -1142,7 +1142,7 @@ void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, sal_uInt16 nCnt, void lcl_FillSelBoxes( SwSelBoxes &rBoxes, SwTableLine &rLine ) { - sal_uInt16 nBoxCount = rLine.GetTabBoxes().Count(); + sal_uInt16 nBoxCount = rLine.GetTabBoxes().size(); sal_uInt16 nCurrBox; for( nCurrBox = 0; nCurrBox < nBoxCount; ++nCurrBox ) rBoxes.Insert( rLine.GetTabBoxes()[nCurrBox] ); @@ -1170,7 +1170,7 @@ void SwTable::InsertSpannedRow( SwDoc* pDoc, sal_uInt16 nRowIdx, sal_uInt16 nCnt pFrmFmt->SetFmtAttr( aFSz ); } _InsertRow( pDoc, aBoxes, nCnt, sal_True ); - sal_uInt16 nBoxCount = rLine.GetTabBoxes().Count(); + sal_uInt16 nBoxCount = rLine.GetTabBoxes().size(); for( sal_uInt16 n = 0; n < nCnt; ++n ) { SwTableLine *pNewLine = GetTabLines()[ nRowIdx + nCnt - n ]; @@ -1501,7 +1501,7 @@ sal_Bool SwTable::InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, SwSelBoxes aLineBoxes; lcl_FillSelBoxes( aLineBoxes, *pLine ); _InsertRow( pDoc, aLineBoxes, nCnt, bBehind ); - sal_uInt16 nBoxCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nBoxCount = pLine->GetTabBoxes().size(); sal_uInt16 nOfs = bBehind ? 0 : 1; for( sal_uInt16 n = 0; n < nCnt; ++n ) { @@ -1608,7 +1608,7 @@ void lcl_SearchSelBox( const SwTable &rTable, SwSelBoxes& rBoxes, long nMin, lon long nLeft = 0; long nRight = 0; long nMid = ( nMax + nMin )/ 2; - sal_uInt16 nCount = rLine.GetTabBoxes().Count(); + sal_uInt16 nCount = rLine.GetTabBoxes().size(); for( sal_uInt16 nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) { SwTableBox* pBox = rLine.GetTabBoxes()[nCurrBox]; @@ -1690,7 +1690,7 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd, { SwTableLine* pLine = aLines[nRow]; OSL_ENSURE( pLine, "Missing table line" ); - sal_uInt16 nCols = pLine->GetTabBoxes().Count(); + sal_uInt16 nCols = pLine->GetTabBoxes().size(); for( sal_uInt16 nCol = 0; nCol < nCols; ++nCol ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCol]; @@ -1735,7 +1735,7 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd, { SwTableLine* pLine = aLines[nRow]; OSL_ENSURE( pLine, "Missing table line" ); - sal_uInt16 nCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nCount = pLine->GetTabBoxes().size(); for( sal_uInt16 nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox]; @@ -1814,7 +1814,7 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax { SwTableLine* pLine = aLines[nRow]; OSL_ENSURE( pLine, "Missing table line" ); - sal_uInt16 nCols = pLine->GetTabBoxes().Count(); + sal_uInt16 nCols = pLine->GetTabBoxes().size(); for( sal_uInt16 nCol = 0; nCol < nCols; ++nCol ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCol]; @@ -1831,7 +1831,7 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax for( sal_uInt16 nRow = 0; nRow < nLineCnt; ++nRow ) { SwTableLine* pLine = aLines[nRow]; - sal_uInt16 nCols = pLine->GetTabBoxes().Count(); + sal_uInt16 nCols = pLine->GetTabBoxes().size(); long nLeft = 0; long nRight = 0; for( sal_uInt16 nCurrBox = 0; nCurrBox < nCols; ++nCurrBox ) @@ -1861,7 +1861,7 @@ void SwTable::PrepareDeleteCol( long nMin, long nMax ) for( sal_uInt16 nRow = 0; nRow < nLineCnt; ++nRow ) { SwTableLine* pLine = aLines[nRow]; - sal_uInt16 nCols = pLine->GetTabBoxes().Count(); + sal_uInt16 nCols = pLine->GetTabBoxes().size(); long nLeft = 0; long nRight = 0; for( sal_uInt16 nCurrBox = 0; nCurrBox < nCols; ++nCurrBox ) @@ -1931,7 +1931,7 @@ void SwTable::CheckRowSpan( SwTableLinePtr &rpLine, bool bUp ) const { bChange = false; rpLine = GetTabLines()[ nLineIdx ]; - sal_uInt16 nCols = rpLine->GetTabBoxes().Count(); + sal_uInt16 nCols = rpLine->GetTabBoxes().size(); for( sal_uInt16 nCol = 0; !bChange && nCol < nCols; ++nCol ) { SwTableBox* pBox = rpLine->GetTabBoxes()[nCol]; @@ -1957,7 +1957,7 @@ void SwTable::CheckRowSpan( SwTableLinePtr &rpLine, bool bUp ) const { bChange = false; rpLine = GetTabLines()[ nLineIdx ]; - sal_uInt16 nCols = rpLine->GetTabBoxes().Count(); + sal_uInt16 nCols = rpLine->GetTabBoxes().size(); for( sal_uInt16 nCol = 0; !bChange && nCol < nCols; ++nCol ) { SwTableBox* pBox = rpLine->GetTabBoxes()[nCol]; @@ -1985,7 +1985,7 @@ SwSaveRowSpan::SwSaveRowSpan( SwTableBoxes& rBoxes, sal_uInt16 nSplitLn ) : mnSplitLine( nSplitLn ) { bool bDontSave = true; // nothing changed, nothing to save - sal_uInt16 nColCount = rBoxes.Count(); + sal_uInt16 nColCount = rBoxes.size(); OSL_ENSURE( nColCount, "Empty Table Line" ); mnRowSpans.resize( nColCount ); for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) @@ -2016,7 +2016,7 @@ void SwTable::RestoreRowSpan( const SwSaveRowSpan& rSave ) if( rSave.mnSplitLine < nLineCount ) { SwTableLine* pLine = GetTabLines()[rSave.mnSplitLine]; - sal_uInt16 nColCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nColCount = pLine->GetTabBoxes().size(); OSL_ENSURE( nColCount, "Empty Table Line" ); OSL_ENSURE( nColCount == rSave.mnRowSpans.size(), "Wrong row span store" ); if( nColCount == rSave.mnRowSpans.size() ) @@ -2081,7 +2081,7 @@ void SwTable::CleanUpBottomRowSpan( sal_uInt16 nDelLines ) return; sal_uInt16 nLastLine = GetTabLines().Count()-1; SwTableLine* pLine = GetTabLines()[nLastLine]; - sal_uInt16 nColCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nColCount = pLine->GetTabBoxes().size(); OSL_ENSURE( nColCount, "Empty Table Line" ); for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) { @@ -2121,7 +2121,7 @@ void SwTable::CheckConsistency() const SwTwips nWidth = 0; SwTableLine* pLine = GetTabLines()[nCurrLine]; SAL_WARN_IF( !pLine, "sw", "Missing Table Line" ); - sal_uInt16 nColCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nColCount = pLine->GetTabBoxes().size(); SAL_WARN_IF( !nColCount, "sw", "Empty Table Line" ); for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) { diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index cd8a389026e4..722a7fb5f74b 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -83,7 +83,6 @@ TYPEINIT1( SwTableBoxFmt, SwFrmFmt ); TYPEINIT1( SwTableLineFmt, SwFrmFmt ); SV_IMPL_PTRARR(SwTableLines,SwTableLine*); -SV_IMPL_PTRARR(SwTableBoxes,SwTableBox*); SV_IMPL_PTRARR_SORT(SwTableSortBoxes,SwTableBoxPtr); SV_IMPL_REF( SwServerObject ) @@ -359,7 +358,7 @@ void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld, { sal_uInt64 nSum = 0; // To avoid rounding errors we summarize all box widths sal_uInt64 nOriginalSum = 0; // Sum of original widths - for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rBoxes.size(); ++i ) { SwTableBox &rBox = *rBoxes[i]; if ( rBox.GetTabLines().Count() ) @@ -432,7 +431,7 @@ void SwTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) void SwTable::AdjustWidths( const long nOld, const long nNew ) { - SvPtrarr aFmtArr( (sal_uInt8)aLines[0]->GetTabBoxes().Count() ); + SvPtrarr aFmtArr( (sal_uInt8)aLines[0]->GetTabBoxes().size() ); ::lcl_ModifyLines( aLines, nOld, nNew, aFmtArr, true ); } @@ -472,7 +471,7 @@ void lcl_SortedTabColInsert( SwTabCols &rToFill, const SwTableBox *pBox, while ( pLine ) { const SwTableBoxes &rBoxes = pLine->GetTabBoxes(); - for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rBoxes.size(); ++i ) { SwTwips nWidth = rBoxes[i]->GetFrmFmt()->GetFrmSize().GetWidth(); nSum = (sal_uInt16)(nSum + nWidth); @@ -571,7 +570,7 @@ void lcl_ProcessBoxGet( const SwTableBox *pBox, SwTabCols &rToFill, const SwTableLines &rLines = pBox->GetTabLines(); for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) { const SwTableBoxes &rBoxes = rLines[i]->GetTabBoxes(); - for ( sal_uInt16 j = 0; j < rBoxes.Count(); ++j ) + for ( sal_uInt16 j = 0; j < rBoxes.size(); ++j ) ::lcl_ProcessBoxGet( rBoxes[j], rToFill, pTabFmt, bRefreshHidden); } } @@ -582,7 +581,7 @@ void lcl_ProcessBoxGet( const SwTableBox *pBox, SwTabCols &rToFill, void lcl_ProcessLineGet( const SwTableLine *pLine, SwTabCols &rToFill, const SwFrmFmt *pTabFmt ) { - for ( sal_uInt16 i = 0; i < pLine->GetTabBoxes().Count(); ++i ) + for ( sal_uInt16 i = 0; i < pLine->GetTabBoxes().size(); ++i ) { const SwTableBox *pBox = pLine->GetTabBoxes()[i]; if ( pBox->GetSttNd() ) @@ -643,7 +642,7 @@ void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart, const SwTableBoxes &rBoxes = pStart->GetUpper()->GetTabBoxes(); sal_uInt16 i; - for ( i = 0; i < rBoxes.Count(); ++i ) + for ( i = 0; i < rBoxes.size(); ++i ) ::lcl_ProcessBoxGet( rBoxes[i], rToFill, pTabFmt, bRefreshHidden ); //2. und 3. @@ -652,7 +651,7 @@ void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart, while ( pLine ) { const SwTableBoxes &rBoxes2 = pLine->GetTabBoxes(); - for ( sal_uInt16 k = 0; k < rBoxes2.Count(); ++k ) + for ( sal_uInt16 k = 0; k < rBoxes2.size(); ++k ) ::lcl_SortedTabColInsert( rToFill, rBoxes2[k], pTabFmt, sal_False, bRefreshHidden ); pLine = pLine->GetUpper() ? pLine->GetUpper()->GetUpper() : 0; @@ -714,7 +713,7 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ); void lcl_ProcessLine( SwTableLine *pLine, Parm &rParm ) { SwTableBoxes &rBoxes = pLine->GetTabBoxes(); - for ( int i = rBoxes.Count()-1; i >= 0; --i ) + for ( int i = rBoxes.size()-1; i >= 0; --i ) ::lcl_ProcessBoxSet( rBoxes[ static_cast< sal_uInt16 >(i) ], rParm ); } @@ -744,7 +743,7 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) while ( pLine ) { const SwTableBoxes &rBoxes = pLine->GetTabBoxes(); - for ( sal_uInt16 i = 0; (i < rBoxes.Count()) && (rBoxes[i] != pCur); ++i) + for ( sal_uInt16 i = 0; (i < rBoxes.size()) && (rBoxes[i] != pCur); ++i) { sal_uInt64 nWidth = rBoxes[i]->GetFrmFmt()-> GetFrmSize().GetWidth(); @@ -809,10 +808,10 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) if( pBox->getRowSpan() == 1 ) { SwTableBoxes& rTblBoxes = pBox->GetUpper()->GetTabBoxes(); - sal_uInt16 nPos = rTblBoxes.C40_GETPOS( SwTableBox, pBox ); + sal_uInt16 nPos = rTblBoxes.GetPos( pBox ); if( nPos && rTblBoxes[ nPos - 1 ]->getRowSpan() != 1 ) nLeftDiff = 0; - if( nPos + 1 < rTblBoxes.Count() && + if( nPos + 1 < (sal_uInt16)rTblBoxes.size() && rTblBoxes[ nPos + 1 ]->getRowSpan() != 1 ) nRightDiff = 0; } @@ -852,11 +851,10 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) else { // Middle cell check: - if ( pBox != pBox->GetUpper()->GetTabBoxes()[0] ) + if ( pBox != pBox->GetUpper()->GetTabBoxes().front() ) nDiff = nRightDiff; - if ( pBox != pBox->GetUpper()->GetTabBoxes() - [pBox->GetUpper()->GetTabBoxes().Count()-1] ) + if ( pBox != pBox->GetUpper()->GetTabBoxes().back() ) nDiff -= nRightDiff; pBox = nDiff ? pBox->GetUpper()->GetUpper() : 0; @@ -875,7 +873,7 @@ void lcl_ProcessBoxPtr( SwTableBox *pBox, SvPtrarr &rBoxArr, for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) { const SwTableBoxes &rBoxes = rLines[i]->GetTabBoxes(); - for ( sal_uInt16 j = 0; j < rBoxes.Count(); ++j ) + for ( sal_uInt16 j = 0; j < rBoxes.size(); ++j ) ::lcl_ProcessBoxPtr( rBoxes[j], rBoxArr, bBefore ); } } @@ -892,7 +890,7 @@ void lcl_AdjustLines( SwTableLines &rLines, const long nDiff, Parm &rParm ) for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) { SwTableBox *pBox = rLines[i]->GetTabBoxes() - [rLines[i]->GetTabBoxes().Count()-1]; + [rLines[i]->GetTabBoxes().size()-1]; lcl_AdjustBox( pBox, nDiff, rParm ); } } @@ -1016,7 +1014,7 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, //entsprechenden Boxen in einem PtrArray vorzumerken. const SwTableBoxes &rBoxes = pStart->GetUpper()->GetTabBoxes(); - for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rBoxes.size(); ++i ) ::lcl_ProcessBoxPtr( rBoxes[i], aParm.aBoxArr, sal_False ); const SwTableLine *pLine = pStart->GetUpper()->GetUpper() ? @@ -1026,7 +1024,7 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, { const SwTableBoxes &rBoxes2 = pLine->GetTabBoxes(); sal_Bool bBefore = sal_True; - for ( sal_uInt16 i = 0; i < rBoxes2.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rBoxes2.size(); ++i ) { if ( rBoxes2[i] != pExcl ) ::lcl_ProcessBoxPtr( rBoxes2[i], aParm.aBoxArr, bBefore ); @@ -1078,7 +1076,7 @@ static void lcl_AdjustWidthsInLine( SwTableLine* pLine, ChangeList& rOldNew, ChangeList::iterator pCurr = rOldNew.begin(); if( pCurr == rOldNew.end() ) return; - sal_uInt16 nCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nCount = pLine->GetTabBoxes().size(); sal_uInt16 i = 0; SwTwips nBorder = 0; SwTwips nRest = 0; @@ -1144,7 +1142,7 @@ static void lcl_CalcNewWidths( std::list<sal_uInt16> &rSpanPos, ChangeList& rCha sal_uInt16 nOrgSum = 0; bool bRowSpan = false; sal_uInt16 nRowSpanCount = 0; - sal_uInt16 nCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nCount = pLine->GetTabBoxes().size(); for( sal_uInt16 nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox]; @@ -1467,7 +1465,7 @@ const SwTableBox* SwTable::GetTblBox( const String& rName, // bestimme die Box pBoxes = &pLine->GetTabBoxes(); - if( nBox >= pBoxes->Count() ) + if( nBox >= pBoxes->size() ) return 0; pBox = (*pBoxes)[ nBox ]; } @@ -1555,9 +1553,10 @@ sal_Bool SwTable::IsTblComplex() const SwTableLine::SwTableLine( SwTableLineFmt *pFmt, sal_uInt16 nBoxes, SwTableBox *pUp ) : SwClient( pFmt ), - aBoxes( (sal_uInt8)nBoxes ), + aBoxes(), pUpper( pUp ) { + aBoxes.reserve( (sal_uInt8)nBoxes ); } SwTableLine::~SwTableLine() diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 6c7c08bb8259..f55b4879be31 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -636,7 +636,7 @@ SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd, } SwTableBox* pBox = new SwTableBox( pBoxFmt, *pSttNd, pLine ); - pLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, 0 ); + pLine->GetTabBoxes().insert( pLine->GetTabBoxes().begin(), pBox ); } return pTblNd; } @@ -1066,7 +1066,7 @@ void _SaveTable::CreateNew( SwTable& rTbl, sal_Bool bCreateFrms, // TL_CHART2: notify chart about boxes to be removed const SwTableBoxes &rBoxes = pOld->GetTabBoxes(); - sal_uInt16 nBoxes = rBoxes.Count(); + sal_uInt16 nBoxes = rBoxes.size(); for (sal_uInt16 k = 0; k < nBoxes; ++k) { SwTableBox *pBox = rBoxes[k]; @@ -1088,7 +1088,7 @@ void _SaveTable::CreateNew( SwTable& rTbl, sal_Bool bCreateFrms, for (sal_uInt16 k1 = 0; k1 < nOldLines - n; ++k1) { const SwTableBoxes &rBoxes = rTbl.GetTabLines()[n + k1]->GetTabBoxes(); - sal_uInt16 nBoxes = rBoxes.Count(); + sal_uInt16 nBoxes = rBoxes.size(); for (sal_uInt16 k2 = 0; k2 < nBoxes; ++k2) { SwTableBox *pBox = rBoxes[k2]; @@ -1177,7 +1177,7 @@ _SaveLine::_SaveLine( _SaveLine* pPrev, const SwTableLine& rLine, _SaveTable& rS pBox = new _SaveBox( 0, *rLine.GetTabBoxes()[ 0 ], rSTbl ); _SaveBox* pBx = pBox; - for( sal_uInt16 n = 1; n < rLine.GetTabBoxes().Count(); ++n ) + for( sal_uInt16 n = 1; n < rLine.GetTabBoxes().size(); ++n ) pBx = new _SaveBox( pBx, *rLine.GetTabBoxes()[ n ], rSTbl ); } @@ -1194,7 +1194,7 @@ void _SaveLine::RestoreAttr( SwTableLine& rLine, _SaveTable& rSTbl ) rSTbl.NewFrmFmt( &rLine, 0, nItemSet, rLine.GetFrmFmt() ); _SaveBox* pBx = pBox; - for( sal_uInt16 n = 0; n < rLine.GetTabBoxes().Count(); ++n, pBx = pBx->pNext ) + for( sal_uInt16 n = 0; n < rLine.GetTabBoxes().size(); ++n, pBx = pBx->pNext ) { if( !pBx ) { @@ -1387,7 +1387,7 @@ void _SaveBox::CreateNew( SwTable& rTbl, SwTableLine& rParent, _SaveTable& rSTbl if( ULONG_MAX == nSttNode ) // keine EndBox { SwTableBox* pNew = new SwTableBox( pFmt, 1, &rParent ); - rParent.GetTabBoxes().C40_INSERT( SwTableBox, pNew, rParent.GetTabBoxes().Count() ); + rParent.GetTabBoxes().push_back( pNew ); Ptrs.pLine->CreateNew( rTbl, *pNew, rSTbl ); } @@ -1405,11 +1405,11 @@ void _SaveBox::CreateNew( SwTable& rTbl, SwTableLine& rParent, _SaveTable& rSTbl pBox->setRowSpan( nRowSpan ); SwTableBoxes* pTBoxes = &pBox->GetUpper()->GetTabBoxes(); - pTBoxes->Remove( pTBoxes->C40_GETPOS( SwTableBox, pBox ) ); + pTBoxes->erase( std::find( pTBoxes->begin(), pTBoxes->end(), pBox ) ); pBox->SetUpper( &rParent ); pTBoxes = &rParent.GetTabBoxes(); - pTBoxes->C40_INSERT( SwTableBox, pBox, pTBoxes->Count() ); + pTBoxes->push_back( pBox ); } if( pNext ) @@ -1775,7 +1775,7 @@ void SwUndoTblNdsChg::UndoImpl(::sw::UndoRedoContext & rContext) pSave->GetHistory()->Rollback( &rDoc ); SwTableBox* pBox = new SwTableBox( (SwTableBoxFmt*)pCpyBox->GetFrmFmt(), aIdx, pCpyBox->GetUpper() ); - rLnBoxes.C40_INSERT( SwTableBox, pBox, rLnBoxes.Count() ); + rLnBoxes.push_back( pBox ); } pDelSects->clear(); } @@ -1843,7 +1843,7 @@ void SwUndoTblNdsChg::UndoImpl(::sw::UndoRedoContext & rContext) { SwTableBox* pCurrBox = aDelBoxes[n]; SwTableBoxes* pTBoxes = &pCurrBox->GetUpper()->GetTabBoxes(); - pTBoxes->Remove( pTBoxes->C40_GETPOS( SwTableBox, pCurrBox ) ); + pTBoxes->erase( std::find( pTBoxes->begin(), pTBoxes->end(), pCurrBox ) ); delete pCurrBox; } @@ -2027,7 +2027,7 @@ CHECKTABLE(pTblNd->GetTable()) SwTableBoxStartNode, pColl ); pBox = new SwTableBox( (SwTableBoxFmt*)pCpyBox->GetFrmFmt(), *pSttNd, pCpyBox->GetUpper() ); - rLnBoxes.C40_INSERT( SwTableBox, pBox, rLnBoxes.Count() ); + rLnBoxes.push_back( pBox ); aSelBoxes.Insert( pBox ); } @@ -2101,7 +2101,7 @@ CHECKTABLE(pTblNd->GetTable()) pPCD->DeleteBox( &pTblNd->GetTable(), *pBox ); SwTableBoxes* pTBoxes = &pBox->GetUpper()->GetTabBoxes(); - pTBoxes->Remove( pTBoxes->C40_GETPOS( SwTableBox, pBox ) ); + pTBoxes->erase( std::find(pTBoxes->begin(), pTBoxes->end(), pBox ) ); // Indizies aus dem Bereich loeschen diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index c4b799dd1c3e..5fb3f302dcd6 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -720,7 +720,7 @@ 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().Count(); + sal_Int32 nCols = pTable->GetTabLines().GetObject(0)->GetTabBoxes().size(); std::vector< std::vector< sal_Char > > aMap( nRows ); for (sal_Int32 i = 0; i < nRows; ++i) aMap[i].resize( nCols ); @@ -1206,7 +1206,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArgume if (!pTable || pTable->IsTblComplex()) return aResult; // failed -> return empty property sequence nTableRows = pTable->GetTabLines().Count(); - nTableCols = pTable->GetTabLines().GetObject(0)->GetTabBoxes().Count(); + nTableCols = pTable->GetTabLines().GetObject(0)->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 da7dacec0112..e05143e92032 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -500,8 +500,8 @@ const SwTableBox* lcl_FindCornerTableBox(const SwTableLines& rTableLines, const const SwTableLine* pLine(rLines[i_bTopLeft ? 0 : rLines.Count() - 1]); OSL_ASSERT(pLine); const SwTableBoxes& rBoxes(pLine->GetTabBoxes()); - OSL_ASSERT(rBoxes.Count() != 0); - pBox = rBoxes[i_bTopLeft ? 0 : rBoxes.Count() - 1]; + OSL_ASSERT(rBoxes.size() != 0); + pBox = i_bTopLeft ? rBoxes.front() : rBoxes.back(); OSL_ASSERT(pBox); } else @@ -567,7 +567,7 @@ void lcl_InspectLines(SwTableLines& rLines, std::vector<String*>& rAllNames) { SwTableLine* pLine = rLines[i]; SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - for(sal_uInt16 j = 0; j < rBoxes.Count(); j++) + for(sal_uInt16 j = 0; j < rBoxes.size(); j++) { SwTableBox* pBox = rBoxes[j]; if(pBox->GetName().Len() && pBox->getRowSpan() > 0 ) @@ -3148,9 +3148,9 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, { SwTableLine* pLine = rLines.GetObject(i); SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - for(sal_uInt16 k = 0; k < rBoxes.Count(); k++) + for(sal_uInt16 k = 0; k < rBoxes.size(); k++) { - SwTableBox* pBox = rBoxes.GetObject(k); + SwTableBox* pBox = rBoxes[k]; const SwFrmFmt* pBoxFmt = pBox->GetFrmFmt(); const SvxBoxItem& rBox = pBoxFmt->GetBox(); if( @@ -3319,9 +3319,9 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( be { const SwTableLine* pLine = rLines.GetObject(i); const SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - for(sal_uInt16 k = 0; k < rBoxes.Count(); k++) + for(sal_uInt16 k = 0; k < rBoxes.size(); k++) { - const SwTableBox* pBox = rBoxes.GetObject(k); + const SwTableBox* pBox = rBoxes[k]; SwFrmFmt* pBoxFmt = pBox->GetFrmFmt(); const SvxBoxItem& rBox = pBoxFmt->GetBox(); if( bFirst ) @@ -3537,7 +3537,7 @@ sal_uInt16 SwXTextTable::getColumnCount(void) { SwTableLines& rLines = pTable->GetTabLines(); SwTableLine* pLine = rLines.GetObject(0); - nRet = pLine->GetTabBoxes().Count(); + nRet = pLine->GetTabBoxes().size(); } } return nRet; @@ -4710,7 +4710,7 @@ void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno: SwTableLines& rLines = pTable->GetTabLines(); SwTableLine* pLine = rLines.GetObject(rLines.Count() -1); SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - pTLBox = rBoxes.GetObject(0); + pTLBox = rBoxes.front(); } if(pTLBox) { @@ -4844,7 +4844,7 @@ sal_Int32 SwXTableColumns::getCount(void) throw( uno::RuntimeException ) { SwTableLines& rLines = pTable->GetTabLines(); SwTableLine* pLine = rLines.GetObject(0); - nRet = pLine->GetTabBoxes().Count(); + nRet = pLine->GetTabBoxes().size(); } } return nRet; @@ -4866,7 +4866,7 @@ uno::Any SwXTableColumns::getByIndex(sal_Int32 nIndex) { SwTableLines& rLines = pTable->GetTabLines(); SwTableLine* pLine = rLines.GetObject(0); - nCount = pLine->GetTabBoxes().Count(); + nCount = pLine->GetTabBoxes().size(); } if(nCount <= nIndex || nIndex < 0) throw lang::IndexOutOfBoundsException(); @@ -4904,7 +4904,7 @@ void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( u { SwTableLines& rLines = pTable->GetTabLines(); SwTableLine* pLine = rLines.GetObject(0); - sal_uInt16 nColCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nColCount = pLine->GetTabBoxes().size(); if (nCount <= 0 || !(0 <= nIndex && nIndex <= nColCount)) { uno::RuntimeException aExcept; @@ -4920,7 +4920,7 @@ void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( u bAppend = sal_True; // am Ende anfuegen, dazu muss der Cursor in die letzte Spalte! SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - pTLBox = rBoxes.GetObject(rBoxes.Count() - 1); + pTLBox = rBoxes.back(); } if(pTLBox) { diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 796406c685b2..583b167a05b2 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -1806,7 +1806,7 @@ SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper, OSL_ENSURE( pBox, "Colspan trouble" ); if( pBox ) - rBoxes.C40_INSERT( SwTableBox, pBox, rBoxes.Count() ); + rBoxes.push_back( pBox ); } nCol++; } @@ -1880,8 +1880,7 @@ SwTableBox *HTMLTable::MakeTableBox( SwTableLine *pUpper, pCnts->SetTableBox( pCntBox ); FixFrameFmt( pCntBox, nTopRow, nLeftCol, nRowSpan, nColSpan, bFirstPara, 0==pCnts->Next() ); - pLine->GetTabBoxes().C40_INSERT( SwTableBox, pCntBox, - pLine->GetTabBoxes().Count() ); + pLine->GetTabBoxes().push_back( pCntBox ); rLines.C40_INSERT( SwTableLine, pLine, rLines.Count() ); } @@ -2587,7 +2586,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail, // die erste Box merken und aus der ersten Zeile ausketten SwTableLine *pLine1 = (pSwTable->GetTabLines())[0]; pBox1 = (pLine1->GetTabBoxes())[0]; - pLine1->GetTabBoxes().Remove(0); + pLine1->GetTabBoxes().erase(pLine1->GetTabBoxes().begin()); pLineFmt = (SwTableLineFmt*)pLine1->GetFrmFmt(); pBoxFmt = (SwTableBoxFmt*)pBox1->GetFrmFmt(); @@ -2635,14 +2634,14 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail, pPrevStNd = pParser->InsertTableSection( pPrevStNd ); pNewBox = NewTableBox( pPrevStNd, pLine ); - rBoxes.C40_INSERT( SwTableBox, pNewBox, rBoxes.Count() ); + rBoxes.push_back( pNewBox ); FixFillerFrameFmt( pNewBox, sal_False ); pLayoutInfo->SetLeftFillerBox( pNewBox ); } // jetzt die Tabelle bearbeiten pNewBox = new SwTableBox( pBoxFmt, 0, pLine ); - rBoxes.C40_INSERT( SwTableBox, pNewBox, rBoxes.Count() ); + rBoxes.push_back( pNewBox ); SwFrmFmt *pFrmFmt = pNewBox->ClaimFrmFmt(); pFrmFmt->ResetFmtAttr( RES_BOX ); @@ -2661,7 +2660,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail, pStNd = pParser->InsertTableSection( pStNd ); pNewBox = NewTableBox( pStNd, pLine ); - rBoxes.C40_INSERT( SwTableBox, pNewBox, rBoxes.Count() ); + rBoxes.push_back( pNewBox ); FixFillerFrameFmt( pNewBox, sal_True ); pLayoutInfo->SetRightFillerBox( pNewBox ); diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index af2b2f4b1b6e..41ce795ea7e9 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -192,7 +192,7 @@ sal_Bool SwHTMLWrtTable::HasTabBackground( const SwTableLine& rLine, if( !bRet ) { const SwTableBoxes& rBoxes = rLine.GetTabBoxes(); - sal_uInt16 nCount = rBoxes.Count(); + sal_uInt16 nCount = rBoxes.size(); sal_Bool bTopBottom = bTop || bBottom; for( sal_uInt16 i=0; !bRet && i<nCount; i++ ) { @@ -206,23 +206,22 @@ sal_Bool SwHTMLWrtTable::HasTabBackground( const SwTableLine& rLine, return bRet; } -sal_Bool lcl_WrtHTMLTbl_HasTabBorders( const SwTableLine*& rpLine, void* pPara ); +static sal_Bool lcl_TableLine_HasTabBorders( const SwTableLine*& rpLine, void* pPara ); -sal_Bool lcl_WrtHTMLTbl_HasTabBorders( const SwTableBox*& rpBox, void* pPara ) +static sal_Bool lcl_TableBox_HasTabBorders( const SwTableBox* pBox, sal_Bool *pBorders ) { - sal_Bool *pBorders = (sal_Bool *)pPara; if( *pBorders ) return sal_False; - if( !rpBox->GetSttNd() ) + if( !pBox->GetSttNd() ) { - ((SwTableBox *)rpBox)->GetTabLines().ForEach( - &lcl_WrtHTMLTbl_HasTabBorders, pPara ); + ((SwTableBox *)pBox)->GetTabLines().ForEach( + &lcl_TableLine_HasTabBorders, (void*)pBorders ); } else { const SvxBoxItem& rBoxItem = - (const SvxBoxItem&)rpBox->GetFrmFmt()->GetFmtAttr( RES_BOX ); + (const SvxBoxItem&)pBox->GetFrmFmt()->GetFmtAttr( RES_BOX ); *pBorders = rBoxItem.GetTop() || rBoxItem.GetBottom() || rBoxItem.GetLeft() || rBoxItem.GetRight(); @@ -231,14 +230,18 @@ sal_Bool lcl_WrtHTMLTbl_HasTabBorders( const SwTableBox*& rpBox, void* pPara ) return !*pBorders; } -sal_Bool lcl_WrtHTMLTbl_HasTabBorders( const SwTableLine*& rpLine, void* pPara ) +static sal_Bool lcl_TableLine_HasTabBorders( const SwTableLine*& rpLine, void* pPara ) { sal_Bool *pBorders = (sal_Bool *)pPara; if( *pBorders ) return sal_False; - ((SwTableLine *)rpLine)->GetTabBoxes().ForEach( - &lcl_WrtHTMLTbl_HasTabBorders, pPara ); + for( SwTableBoxes::const_iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); + it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) + { + if ( lcl_TableBox_HasTabBorders( *it, (sal_Bool*)pPara ) ) + break; + } return !*pBorders; } @@ -253,7 +256,7 @@ sal_Bool SwHTMLWrtTable::ShouldExpandSub( const SwTableBox *pBox, // MIB 30.6.97: Wenn schon eine Box expandiert wurde, wird eine // weitere nur expandiert, wenn sie Umrandungen besitzt. sal_Bool bBorders = sal_False; - lcl_WrtHTMLTbl_HasTabBorders( pBox, &bBorders ); + lcl_TableBox_HasTabBorders( pBox, &bBorders ); if( !bBorders ) bBorders = HasTabBackground( *pBox, sal_True, sal_True, sal_True, sal_True ); bExpand = bBorders; diff --git a/sw/source/filter/rtf/rtftbl.cxx b/sw/source/filter/rtf/rtftbl.cxx index 677710cfe6a7..86c315424dea 100644 --- a/sw/source/filter/rtf/rtftbl.cxx +++ b/sw/source/filter/rtf/rtftbl.cxx @@ -187,8 +187,8 @@ void SwRTFParser::ReadTable( int nToken ) if( pLine ) { sal_uInt16 nTmpBox = m_nCurrentBox; - if( nTmpBox > pLine->GetTabBoxes().Count() ) - nTmpBox = pLine->GetTabBoxes().Count(); + if( nTmpBox > pLine->GetTabBoxes().size() ) + nTmpBox = pLine->GetTabBoxes().size(); for (sal_uInt16 n = nTmpBox; n; ) { @@ -548,7 +548,7 @@ void SwRTFParser::ReadTable( int nToken ) pNewLine = (*pLns)[ pLns->Count() - 1 ]; // jetzt die Boxen abgleichen - sal_uInt16 nBoxes = Min( pNewLine->GetTabBoxes().Count(), (sal_uInt16)aBoxFmts.size() ); + sal_uInt16 nBoxes = Min( pNewLine->GetTabBoxes().size(), aBoxFmts.size() ); sal_uInt16 n; for( n = 0; n < nBoxes; ++n ) @@ -567,7 +567,7 @@ void SwRTFParser::ReadTable( int nToken ) { // remove ContentIndex of other Bound pPam->SetMark(); pPam->DeleteMark(); - while( n < pNewLine->GetTabBoxes().Count() ) + while( n < pNewLine->GetTabBoxes().size() ) _DeleteBox( pTableNode->GetTable(), pNewLine->GetTabBoxes()[ n ], 0, sal_False, sal_False ); } @@ -747,7 +747,7 @@ void SwRTFParser::ReadTable( int nToken ) if (pNewLine) { SwTableBoxes &rBoxes = pNewLine->GetTabBoxes(); - if (SwTableBox* pBox = ((m_nCurrentBox < rBoxes.Count()) + if (SwTableBox* pBox = ((m_nCurrentBox < rBoxes.size()) ? rBoxes[m_nCurrentBox] : 0)) { if (const SwStartNode *pStart = pBox->GetSttNd()) @@ -816,7 +816,7 @@ void SwRTFParser::GotoNextBox() SwTableLines& rLns = pTableNode->GetTable().GetTabLines(); SwTableLine* pLine = rLns[ rLns.Count()-1 ]; SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - SwTableBox* pBox = rBoxes[ rBoxes.Count()-1 ]; + SwTableBox* pBox = rBoxes.back(); if( ++m_nCurrentBox >= aMergeBoxes.size() ) m_nCurrentBox = aMergeBoxes.size()-1; @@ -831,7 +831,7 @@ void SwRTFParser::GotoNextBox() if( !aMergeBoxes[ nTmp ] ) ++nRealBox; - if( nRealBox < rBoxes.Count() ) + if( nRealBox < rBoxes.size() ) { pPam->GetPoint()->nNode = *rBoxes[ nRealBox ]->GetSttNd()->EndOfSectionNode(); pPam->Move( fnMoveBackward, fnGoCntnt ); @@ -870,7 +870,7 @@ void SwRTFParser::NewTblLine() SwTableLines* pLns = &pTableNode->GetTable().GetTabLines(); SwTableLine* pLine = (*pLns)[ pLns->Count()-1 ]; SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - SwTableBox* pBox = rBoxes[ rBoxes.Count()-1 ]; + SwTableBox* pBox = rBoxes.back(); if(nRowsToRepeat>0) pTableNode->GetTable().SetRowsToRepeat( nRowsToRepeat ); @@ -919,7 +919,7 @@ void SwRTFParser::NewTblLine() pPam->SetMark(); pLine = (*pLns)[ pLns->Count()-1 ]; - pBox = pLine->GetTabBoxes()[ pLine->GetTabBoxes().Count() -1 ]; + pBox = pLine->GetTabBoxes().back(); pPam->GetPoint()->nNode = *pBox->GetSttNd()->EndOfSectionNode(); pPam->Move( fnMoveBackward ); pDoc->SetTxtFmtColl( *pPam, pColl ); diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index ccc8124e8e3b..221b512248bf 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -1785,7 +1785,7 @@ void SwRTFParser::NextToken( int nToken ) const SwTableBox* pBox = pTblNd->GetTable().GetTblBox( pBoxStt->GetIndex() ); const SwTableLine* pLn = pBox->GetUpper(); - pBox = pLn->GetTabBoxes()[ pLn->GetTabBoxes().Count() - 1 ]; + pBox = pLn->GetTabBoxes().back(); rIdx = *pBox->GetSttNd()->EndOfSectionNode(); pPam->Move( fnMoveForward, fnGoNode ); } diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx index 1818bd498f77..e0a5fb716a31 100644 --- a/sw/source/filter/writer/wrtswtbl.cxx +++ b/sw/source/filter/writer/wrtswtbl.cxx @@ -135,7 +135,7 @@ long SwWriteTable::GetLineHeight( const SwTableLine *pLine ) } const SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - sal_uInt16 nBoxes = rBoxes.Count(); + sal_uInt16 nBoxes = rBoxes.size(); for( sal_uInt16 nBox=0; nBox<nBoxes; nBox++ ) { @@ -479,7 +479,7 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, // Fuer alle Boxen der Zeile ggf. eine Spalte einfuegen const SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - sal_uInt16 nBoxes = rBoxes.Count(); + sal_uInt16 nBoxes = rBoxes.size(); sal_uInt32 nCPos = nStartCPos; for( sal_uInt16 nBox=0; nBox<nBoxes; nBox++ ) @@ -648,7 +648,7 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow, pBrushItem = 0; } - sal_uInt16 nBoxes = rBoxes.Count(); + sal_uInt16 nBoxes = rBoxes.size(); sal_uInt32 nCPos = nStartCPos; sal_uInt16 nCol = nStartCol; diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index 84060378e84a..51e0a65ab885 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -1446,9 +1446,9 @@ SwTableBox* SwFltOutDoc::GetBox(sal_uInt16 ny, sal_uInt16 nx /*= USHRT_MAX */) OSL_FAIL("SwFltOutDoc:GetBox:pTableBoxes"); return 0; } - if( nx >= pTableBoxes->Count() ){ // Notbremse + if( nx >= pTableBoxes->size() ){ // Notbremse OSL_FAIL("SwFltOutDoc:GetBox:nx >= Count()"); - nx = pTableBoxes->Count() - 1; + nx = pTableBoxes->size() - 1; } SwTableBox* pTableBox = (*pTableBoxes)[nx]; @@ -1471,14 +1471,14 @@ void SwFltOutDoc::NextTableCell() return; //#pragma message(__FILE__ "(?) : Sw's const problem") // insert cells: - if (++usTableX >= pTableBoxes->Count()) + if (++usTableX >= pTableBoxes->size()) GetDoc().GetNodes().InsBoxen( GetDoc().IsIdxInTbl(pPaM->GetPoint()->nNode), pTableLine, (SwTableBoxFmt*)pTableBox->GetFrmFmt(), GetDoc().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false ), 0, - pTableBoxes->Count()); + pTableBoxes->size()); SeekCell(usTableY, usTableX, sal_True); pTableBox = (*pTableBoxes)[usTableX]; OSL_ENSURE(pTableBox != 0, "SwFltOutDoc:pTableBox"); @@ -1671,7 +1671,7 @@ sal_Bool SwFltOutDoc::SeekCell(short nRow, short nCol, sal_Bool bPam) } pTableLine = (*pTableLines)[nRow]; pTableBoxes = &pTableLine->GetTabBoxes(); - if (nCol >= pTableBoxes->Count()) + if (nCol >= (short)pTableBoxes->size()) return sal_False; pTableBox = (*pTableBoxes)[nCol]; if( !pTableBox->GetSttNd() ) diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index 7df6abc30693..c7bd2261a14f 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -186,7 +186,7 @@ TableBoxVectorPtr WW8TableNodeInfoInner::getTableBoxesOfRow() const SwTableLine * pTabLine = getTableBox()->GetUpper(); const SwTableBoxes & rTblBoxes = pTabLine->GetTabBoxes(); - sal_uInt8 nBoxes = rTblBoxes.Count(); + sal_uInt8 nBoxes = rTblBoxes.size(); for ( sal_uInt8 n = 0; n < nBoxes; n++ ) { pResult->push_back(rTblBoxes[n]); @@ -249,7 +249,7 @@ WidthsPtr WW8TableNodeInfoInner::getWidthsOfRow() pWidths = WidthsPtr(new Widths); // number of cell written - sal_uInt32 nBoxes = rTabBoxes.Count(); + sal_uInt32 nBoxes = rTabBoxes.size(); if ( nBoxes > MAXTABLECELLS ) nBoxes = MAXTABLECELLS; @@ -280,7 +280,7 @@ RowSpansPtr WW8TableNodeInfoInner::getRowSpansOfRow() const SwTableLine * pTabLine = pTabBox->GetUpper(); const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes(); - sal_uInt32 nBoxes = rTabBoxes.Count(); + sal_uInt32 nBoxes = rTabBoxes.size(); if (nBoxes > MAXTABLECELLS) nBoxes = MAXTABLECELLS; @@ -680,11 +680,11 @@ WW8TableInfo::processTableLine(const SwTable * pTable, WW8TableNodeInfo::Pointer_t pTextNodeInfo; - for (sal_uInt16 n = 0; n < rBoxes.Count(); n++) + for (sal_uInt16 n = 0; n < rBoxes.size(); n++) { const SwTableBox * pBox = rBoxes[n]; - pPrev = processTableBox(pTable, pBox, nRow, n, nDepth, n == rBoxes.Count() - 1, pPrev); + pPrev = processTableBox(pTable, pBox, nRow, n, nDepth, n == rBoxes.size() - 1, pPrev); } #ifdef DBG_UTIL @@ -717,7 +717,7 @@ WW8TableInfo::processTableBoxLines(const SwTableBox * pBox, const SwTableLine * pLine = rLines[n]; const SwTableBoxes & rBoxes = pLine->GetTabBoxes(); - for (sal_uInt16 nBox = 0; nBox < rBoxes.Count(); nBox++) + for (sal_uInt16 nBox = 0; nBox < rBoxes.size(); nBox++) pNodeInfo = processTableBoxLines(rBoxes[nBox], pTable, pBoxToSet, nRow, nCell, nDepth); } } diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 4ae0392552e1..73d432f47939 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1890,7 +1890,7 @@ void WW8AttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_ const SwTableLine * pTabLine = pTabBox->GetUpper(); const SwTableBoxes & rTblBoxes = pTabLine->GetTabBoxes(); - sal_uInt8 nBoxes = rTblBoxes.Count(); + sal_uInt8 nBoxes = rTblBoxes.size(); for ( sal_uInt8 n = 0; n < nBoxes; n++ ) { const SwTableBox * pTabBox1 = rTblBoxes[n]; @@ -2282,7 +2282,7 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t const SwTableLine * pTabLine = pTabBox->GetUpper(); const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes(); - sal_uInt8 nBoxes = rTabBoxes.Count(); + sal_uInt8 nBoxes = rTabBoxes.size(); if ( m_rWW8Export.bWrtWW8 ) m_rWW8Export.InsUInt16( NS_sprm::LN_TDefTableShd ); else @@ -2311,7 +2311,7 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t if ( m_rWW8Export.bWrtWW8 ) { sal_uInt32 aSprmIds[] = {NS_sprm::LN_TCellShd, NS_sprm::LN_TCellShadow}; - sal_uInt8 nBoxes0 = rTabBoxes.Count(); + sal_uInt8 nBoxes0 = rTabBoxes.size(); if (nBoxes0 > 21) nBoxes0 = 21; diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index e53a528d8fe4..1b5bd7588a0b 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -2577,9 +2577,9 @@ void WW8TabDesc::MergeCells() sal_uInt16 nCol = pActBand->nTransCell[ i ]; if (!pActBand->bExist[i]) continue; - OSL_ENSURE(nCol < pTabBoxes->Count(), + OSL_ENSURE(nCol < pTabBoxes->size(), "Too few columns, table ended early"); - if (nCol >= pTabBoxes->Count()) + if (nCol >= pTabBoxes->size()) return; pTabBox = (*pTabBoxes)[nCol]; WW8_TCell& rCell = pActBand->pTCs[ i ]; @@ -2683,7 +2683,7 @@ void WW8TabDesc::ParkPaM() if (SwTableLine *pLine = (*pTabLines)[nRow]) { SwTableBoxes &rBoxes = pLine->GetTabBoxes(); - pTabBox2 = rBoxes.Count() ? rBoxes[0] : 0; + pTabBox2 = rBoxes.empty() ? 0 : rBoxes.front(); } } @@ -2880,7 +2880,7 @@ bool WW8TabDesc::SetPamInCell(short nWwCol, bool bPam) pTabLine = (*pTabLines)[nAktRow]; pTabBoxes = &pTabLine->GetTabBoxes(); - if (nCol >= pTabBoxes->Count()) + if (nCol >= pTabBoxes->size()) { if (bPam) { @@ -2974,7 +2974,7 @@ void WW8TabDesc::InsertCells( short nIns ) pTabBox = (*pTabBoxes)[0]; pIo->rDoc.GetNodes().InsBoxen( pTblNd, pTabLine, (SwTableBoxFmt*)pTabBox->GetFrmFmt(), - (SwTxtFmtColl*)pIo->pDfltTxtFmtColl, 0, pTabBoxes->Count(), nIns ); + (SwTxtFmtColl*)pIo->pDfltTxtFmtColl, 0, pTabBoxes->size(), nIns ); // mit dem Dritten Parameter wird das FrmFmt der Boxen angegeben. // hier kann man auch noch optimieren, um FrmFmts zu sparen } @@ -3130,7 +3130,7 @@ void WW8TabDesc::AdjustNewBand() InsertCells( pActBand->nSwCols - nDefaultSwCols ); SetPamInCell( 0, false); - OSL_ENSURE( pTabBoxes && pTabBoxes->Count() == (sal_uInt16)pActBand->nSwCols, + OSL_ENSURE( pTabBoxes && pTabBoxes->size() == (sal_uInt16)pActBand->nSwCols, "Falsche Spaltenzahl in Tabelle" ); if( bClaimLineFmt ) diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index 64b051f9fadf..ba8d4a9e5223 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -144,7 +144,7 @@ SwXMLTableLines_Impl::SwXMLTableLines_Impl( const SwTableLines& rLines ) : { const SwTableLine *pLine = rLines[nLine]; const SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - sal_uInt16 nBoxes = rBoxes.Count(); + sal_uInt16 nBoxes = rBoxes.size(); sal_uInt32 nCPos = 0U; for( sal_uInt16 nBox=0U; nBox<nBoxes; nBox++ ) @@ -666,7 +666,7 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines, ExportFmt( *pFrmFmt, XML_TABLE_ROW ); const SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - sal_uInt16 nBoxes = rBoxes.Count(); + sal_uInt16 nBoxes = rBoxes.size(); sal_uInt32 nCPos = 0U; sal_uInt16 nCol = 0U; @@ -944,7 +944,7 @@ void SwXMLExport::ExportTableLine( const SwTableLine& rLine, SvXMLElementExport aElem( *this, XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True, sal_True ); const SwTableBoxes& rBoxes = rLine.GetTabBoxes(); - sal_uInt16 nBoxes = rBoxes.Count(); + sal_uInt16 nBoxes = rBoxes.size(); sal_uInt32 nCPos = 0U; sal_uInt16 nCol = 0U; @@ -1105,27 +1105,26 @@ void SwXMLExport::ExportTableLines( const SwTableLines& rLines, sal_Bool lcl_xmltble_ClearName_Line( const SwTableLine*& rpLine, void* ); -sal_Bool lcl_xmltble_ClearName_Box( const SwTableBox*& rpBox, void* ) +static void lcl_xmltble_ClearName_Box( SwTableBox* pBox ) { - if( !rpBox->GetSttNd() ) + if( !pBox->GetSttNd() ) { - ((SwTableBox *)rpBox)->GetTabLines().ForEach( + ((SwTableBox *)pBox)->GetTabLines().ForEach( &lcl_xmltble_ClearName_Line, 0 ); } else { - SwFrmFmt *pFrmFmt = ((SwTableBox *)rpBox)->GetFrmFmt(); + SwFrmFmt *pFrmFmt = pBox->GetFrmFmt(); if( pFrmFmt && pFrmFmt->GetName().Len() ) pFrmFmt->SetName( aEmptyStr ); } - - return sal_True; } sal_Bool lcl_xmltble_ClearName_Line( const SwTableLine*& rpLine, void* ) { - ((SwTableLine *)rpLine)->GetTabBoxes().ForEach( - &lcl_xmltble_ClearName_Box, 0 ); + for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin(); + it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it) + lcl_xmltble_ClearName_Box( *it ); return sal_True; } diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index b5d3f37eaec0..a70a559cfe3c 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -2395,7 +2395,7 @@ SwTableLine *SwXMLTableContext::MakeTableLine( SwTableBox *pUpper, OSL_ENSURE( bHasSubTables || pBox, "Colspan trouble" ); if( pBox ) - rBoxes.C40_INSERT( SwTableBox, pBox, rBoxes.Count() ); + rBoxes.push_back( pBox ); } nCol++; } @@ -2795,7 +2795,7 @@ void SwXMLTableContext::MakeTable() OSL_ENSURE( pBox1 == pLine1->GetTabBoxes()[0U], "Why is box 1 change?" ); pBox1->pSttNd = pSttNd1; - pLine1->GetTabBoxes().Remove(0U); + pLine1->GetTabBoxes().erase( pLine1->GetTabBoxes().begin() ); pLineFmt = (SwTableLineFmt*)pLine1->GetFrmFmt(); pBoxFmt = (SwTableBoxFmt*)pBox1->GetFrmFmt(); diff --git a/sw/source/ui/vba/vbatablehelper.cxx b/sw/source/ui/vba/vbatablehelper.cxx index d07225b08e61..a7d624b66b43 100644 --- a/sw/source/ui/vba/vbatablehelper.cxx +++ b/sw/source/ui/vba/vbatablehelper.cxx @@ -62,7 +62,7 @@ sal_Int32 SwVbaTableHelper::getTabColumnsCount( sal_Int32 nRowIndex ) throw (uno { SwTableLines& rLines = pTable->GetTabLines(); SwTableLine* pLine = rLines.GetObject( nRowIndex ); - nRet = pLine->GetTabBoxes().Count(); + nRet = pLine->GetTabBoxes().size(); } return nRet; } @@ -155,7 +155,7 @@ SwTableBox* SwVbaTableHelper::GetTabBox( sal_Int32 nCol, sal_Int32 nRow ) throw SwTableBox* pStart = NULL; SwTableLine* pLine = rLines.GetObject( nRow ); - if( pLine->GetTabBoxes().Count() < nCol ) + if( (sal_Int32)pLine->GetTabBoxes().size() < nCol ) throw uno::RuntimeException(); pStart = pLine->GetTabBoxes()[ nCol ]; |