diff options
Diffstat (limited to 'sw/source/core/table/swnewtable.cxx')
-rw-r--r-- | sw/source/core/table/swnewtable.cxx | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index 5fa237713931..ed0c47ecef50 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -610,7 +610,7 @@ long lcl_InsertPosition( SwTable &rTable, std::vector<sal_uInt16>& rInsPos, { sal_Int32 nAddWidth = 0; long nCount = 0; - for( sal_uInt16 j = 0; j < rBoxes.size(); ++j ) + for (size_t j = 0; j < rBoxes.size(); ++j) { SwTableBox *pBox = rBoxes[j]; SwTableLine* pLine = pBox->GetUpper(); @@ -852,9 +852,9 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes, { // The selected boxes in the current line const SwSelBoxes* pBoxes = pSel->aBoxes[ nCurrLine ]; - sal_uInt16 nColCount = pBoxes->size(); + size_t nColCount = pBoxes->size(); // Iteration over the selected cell in the current row - for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) + for (size_t nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol) { SwTableBox* pBox = (*pBoxes)[nCurrCol]; rMerged.insert( pBox ); @@ -930,8 +930,8 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes, for( sal_uInt16 nCurrLine = 0; nCurrLine < nLineCount; ++nCurrLine ) { const SwSelBoxes* pBoxes = pSel->aBoxes[ nCurrLine ]; - sal_uInt16 nColCount = pBoxes->size(); - for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) + size_t nColCount = pBoxes->size(); + for (size_t nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol) { SwTableBox* pBox = (*pBoxes)[nCurrCol]; if( nCurrCol ) @@ -1087,22 +1087,22 @@ void lcl_getAllMergedBoxes( const SwTable& rTable, SwSelBoxes& rBoxes, SwTableBo and its overlapped cells to split them into several pieces. */ -void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, sal_uInt16 nCnt, +void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, size_t nCnt, sal_Bool bSameHeight ) { SwSelBoxes aBoxes; lcl_getAllMergedBoxes( rTable, aBoxes, rBox ); - sal_uInt16 nCount = aBoxes.size(); + size_t const nCount = aBoxes.size(); if( nCount < 2 ) return; if( nCnt > nCount ) nCnt = nCount; - sal_uInt16 *pSplitIdx = new sal_uInt16[ nCnt ]; + size_t *const pSplitIdx = new size_t[ nCnt ]; if( bSameHeight ) { SwTwips *pHeights = new SwTwips[ nCount ]; SwTwips nHeight = 0; - for( sal_uInt16 i = 0; i < nCount; ++i ) + for (size_t i = 0; i < nCount; ++i) { SwTableLine* pLine = aBoxes[ i ]->GetUpper(); SwFrmFmt *pRowFmt = pLine->GetFrmFmt(); @@ -1110,8 +1110,8 @@ void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, sal_uInt16 nCnt, nHeight += pHeights[ i ]; } SwTwips nSumH = 0; - sal_uInt16 nIdx = 0; - for( sal_uInt16 i = 1; i <= nCnt; ++i ) + size_t nIdx = 0; + for (size_t i = 1; i <= nCnt; ++i) { SwTwips nSplit = ( i * nHeight ) / nCnt; while( nSumH < nSplit && nIdx < nCount ) @@ -1122,13 +1122,15 @@ void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, sal_uInt16 nCnt, } else { - for( long i = 1; i <= nCnt; ++i ) - pSplitIdx[ i - 1 ] = (sal_uInt16)( ( i * nCount ) / nCnt ); + for (size_t i = 1; i <= nCnt; ++i) + { + pSplitIdx[ i - 1 ] = ( i * nCount ) / nCnt; + } } - sal_uInt16 nIdx = 0; - for( long i = 0; i < nCnt; ++i ) + size_t nIdx = 0; + for (size_t i = 0; i < nCnt; ++i) { - sal_uInt16 nNextIdx = pSplitIdx[ i ]; + size_t nNextIdx = pSplitIdx[ i ]; aBoxes[ nIdx ]->setRowSpan( nNextIdx - nIdx ); lcl_InvalidateCellFrm( *aBoxes[ nIdx ] ); while( ++nIdx < nNextIdx ) @@ -1206,7 +1208,7 @@ void lcl_SophisticatedFillLineIndices( SwLineOffsetArray &rArr, { std::list< SwLineOffset > aBoxes; SwLineOffset aLnOfs( USHRT_MAX, USHRT_MAX ); - for( sal_uInt16 i = 0; i < rBoxes.size(); ++i ) + for (size_t i = 0; i < rBoxes.size(); ++i) { // Collect all end line indices and the row spans const SwTableBox &rBox = rBoxes[ i ]->FindStartOfRowSpan( rTable ); OSL_ENSURE( rBox.getRowSpan() > 0, "Didn't I say 'StartOfRowSpan' ??" ); @@ -1305,7 +1307,7 @@ sal_uInt16 lcl_CalculateSplitLineHeights( SwSplitLines &rCurr, SwSplitLines &rNe SwLineOffset aLnOfs( USHRT_MAX, USHRT_MAX ); sal_uInt16 nFirst = USHRT_MAX; // becomes the index of the first line sal_uInt16 nLast = 0; // becomes the index of the last line of the splitting - for( sal_uInt16 i = 0; i < rBoxes.size(); ++i ) + for (size_t i = 0; i < rBoxes.size(); ++i) { // Collect all pairs (start+end) of line indices to split const SwTableBox &rBox = rBoxes[ i ]->FindStartOfRowSpan( rTable ); OSL_ENSURE( rBox.getRowSpan() > 0, "Didn't I say 'StartOfRowSpan' ??" ); @@ -1362,7 +1364,7 @@ sal_uInt16 lcl_LineIndex( const SwTable& rTable, const SwSelBoxes& rBoxes, { sal_uInt16 nDirect = USHRT_MAX; sal_uInt16 nSpan = USHRT_MAX; - for( sal_uInt16 i = 0; i < rBoxes.size(); ++i ) + for (size_t i = 0; i < rBoxes.size(); ++i) { SwTableBox *pBox = rBoxes[i]; const SwTableLine* pLine = rBoxes[i]->GetUpper(); @@ -1458,15 +1460,15 @@ sal_Bool SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 } } - std::set< sal_uInt16> aIndices; - for( sal_uInt16 i = 0; i < rBoxes.size(); ++i ) + std::set<size_t> aIndices; + for (size_t i = 0; i < rBoxes.size(); ++i) { OSL_ENSURE( rBoxes[i]->getRowSpan() != 1, "Forgot to split?" ); if( rBoxes[i]->getRowSpan() > 1 ) aIndices.insert( i ); } - std::set< sal_uInt16 >::iterator pCurrBox = aIndices.begin(); + std::set<size_t>::iterator pCurrBox = aIndices.begin(); while( pCurrBox != aIndices.end() ) lcl_UnMerge( *this, *rBoxes[*pCurrBox++], nCnt, bSameHeight ); @@ -1547,7 +1549,7 @@ void SwTable::PrepareDelBoxes( const SwSelBoxes& rBoxes ) { if( IsNewModel() ) { - for( sal_uInt16 i = 0; i < rBoxes.size(); ++i ) + for (size_t i = 0; i < rBoxes.size(); ++i) { SwTableBox* pBox = rBoxes[i]; long nRowSpan = pBox->getRowSpan(); @@ -1627,7 +1629,7 @@ void lcl_SearchSelBox( const SwTable &rTable, SwSelBoxes& rBoxes, long nMin, lon ( !bChkProtected || !pBox->GetFrmFmt()->GetProtect().IsCntntProtected() ) ) { - sal_uInt16 nOldCnt = rBoxes.size(); + size_t const nOldCnt = rBoxes.size(); rBoxes.insert( pBox ); if( bColumn && nRowSpan != 1 && nOldCnt < rBoxes.size() ) { @@ -1802,8 +1804,8 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax return; sal_uInt16 nLineCnt = aLines.size(); - sal_uInt16 nBoxCnt = rBoxes.size(); - sal_uInt16 nBox = 0; + size_t const nBoxCnt = rBoxes.size(); + size_t nBox = 0; for( sal_uInt16 nRow = 0; nRow < nLineCnt && nBox < nBoxCnt; ++nRow ) { SwTableLine* pLine = aLines[nRow]; @@ -1821,7 +1823,6 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax } } } - nBox = 0; for( sal_uInt16 nRow = 0; nRow < nLineCnt; ++nRow ) { SwTableLine* pLine = aLines[nRow]; @@ -1896,7 +1897,7 @@ void SwTable::PrepareDeleteCol( long nMin, long nMax ) void SwTable::ExpandSelection( SwSelBoxes& rBoxes ) const { - for( sal_uInt16 i = 0; i < rBoxes.size(); ++i ) + for (size_t i = 0; i < rBoxes.size(); ++i) { SwTableBox *pBox = rBoxes[i]; long nRowSpan = pBox->getRowSpan(); |