summaryrefslogtreecommitdiff
path: root/sw/source/core/table/swnewtable.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/table/swnewtable.cxx')
-rw-r--r--sw/source/core/table/swnewtable.cxx372
1 files changed, 186 insertions, 186 deletions
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index de76b856cda7..d0cda1e923c4 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -91,18 +91,18 @@ the boxes to remove
@param pUndo
the undo object to notify, maybe empty
-@return TRUE for compatibility reasons with OldMerge(..)
+@return sal_True for compatibility reasons with OldMerge(..)
*/
-BOOL SwTable::NewMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes,
+sal_Bool SwTable::NewMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes,
const SwSelBoxes& rMerged, SwTableBox*, SwUndoTblMerge* pUndo )
{
if( pUndo )
pUndo->SetSelBoxes( rBoxes );
- DeleteSel( pDoc, rBoxes, &rMerged, 0, TRUE, TRUE );
+ DeleteSel( pDoc, rBoxes, &rMerged, 0, sal_True, sal_True );
CHECK_TABLE( *this )
- return TRUE;
+ return sal_True;
}
/** lcl_CheckMinMax helps evaluating (horizontal) min/max of boxes
@@ -128,7 +128,7 @@ 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, USHORT nCheck, bool bSet )
+void lcl_CheckMinMax( long& rMin, long& rMax, const SwTableLine& rLine, sal_uInt16 nCheck, bool bSet )
{
++nCheck;
if( rLine.GetTabBoxes().Count() < nCheck )
@@ -139,7 +139,7 @@ void lcl_CheckMinMax( long& rMin, long& rMax, const SwTableLine& rLine, USHORT n
long nNew = 0; // will be the right border of the current box
long nWidth = 0; // the width of the current box
- for( USHORT nCurrBox = 0; nCurrBox < nCheck; ++nCurrBox )
+ for( sal_uInt16 nCurrBox = 0; nCurrBox < nCheck; ++nCurrBox )
{
SwTableBox* pBox = rLine.GetTabBoxes()[nCurrBox];
ASSERT( pBox, "Missing table box" );
@@ -172,8 +172,8 @@ long lcl_Box2LeftBorder( const SwTableBox& rBox )
return 0;
long nLeft = 0;
const SwTableLine &rLine = *rBox.GetUpper();
- USHORT nCount = rLine.GetTabBoxes().Count();
- for( USHORT nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
+ sal_uInt16 nCount = rLine.GetTabBoxes().Count();
+ for( sal_uInt16 nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
{
SwTableBox* pBox = rLine.GetTabBoxes()[nCurrBox];
ASSERT( pBox, "Missing table box" );
@@ -206,8 +206,8 @@ SwTableBox* lcl_LeftBorder2Box( long nLeft, const SwTableLine* pLine )
if( !pLine )
return 0;
long nCurrLeft = 0;
- USHORT nCount = pLine->GetTabBoxes().Count();
- for( USHORT nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
+ sal_uInt16 nCount = pLine->GetTabBoxes().Count();
+ for( sal_uInt16 nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox];
ASSERT( pBox, "Missing table box" );
@@ -252,7 +252,7 @@ false is also needed for deleted rows
*/
void lcl_ChangeRowSpan( const SwTable& rTable, const long nDiff,
- USHORT nRowIdx, const bool bSingle )
+ sal_uInt16 nRowIdx, const bool bSingle )
{
if( !nDiff || nRowIdx >= rTable.GetTabLines().Count() )
return;
@@ -270,8 +270,8 @@ 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 ];
- USHORT nBoxCount = pLine->GetTabBoxes().Count();
- for( USHORT nCurrBox = 0; nCurrBox < nBoxCount; ++nCurrBox )
+ sal_uInt16 nBoxCount = pLine->GetTabBoxes().Count();
+ for( sal_uInt16 nCurrBox = 0; nCurrBox < nBoxCount; ++nCurrBox )
{
long nRowSpan = pLine->GetTabBoxes()[nCurrBox]->getRowSpan();
long nAbsSpan = nRowSpan > 0 ? nRowSpan : -nRowSpan;
@@ -333,16 +333,16 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
if( !pStartNd || !pEndNd || pStartNd == pEndNd )
return 0;
- USHORT nLines = aLines.Count();
- USHORT nTop = 0, nBottom = 0;
+ sal_uInt16 nLines = aLines.Count();
+ sal_uInt16 nTop = 0, nBottom = 0;
long nMin = 0, nMax = 0;
int nFound = 0;
- for( USHORT nRow = 0; nFound < 2 && nRow < nLines; ++nRow )
+ for( sal_uInt16 nRow = 0; nFound < 2 && nRow < nLines; ++nRow )
{
SwTableLine* pLine = aLines[nRow];
ASSERT( pLine, "Missing table line" );
- USHORT nCols = pLine->GetTabBoxes().Count();
- for( USHORT nCol = 0; nCol < nCols; ++nCol )
+ sal_uInt16 nCols = pLine->GetTabBoxes().Count();
+ for( sal_uInt16 nCol = 0; nCol < nCols; ++nCol )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCol];
ASSERT( pBox, "Missing table box" );
@@ -372,12 +372,12 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
SwBoxSelection* pRet = new SwBoxSelection();
std::list< std::pair< SwTableBox*, long > > aNewWidthList;
- USHORT nCheckBottom = nBottom;
+ sal_uInt16 nCheckBottom = nBottom;
long nLeftSpan = 0;
long nRightSpan = 0;
long nLeftSpanCnt = 0;
long nRightSpanCnt = 0;
- for( USHORT nRow = nTop; nRow <= nBottom && bOkay; ++nRow )
+ for( sal_uInt16 nRow = nTop; nRow <= nBottom && bOkay; ++nRow )
{
SwTableLine* pLine = aLines[nRow];
ASSERT( pLine, "Missing table line" );
@@ -385,8 +385,8 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
long nLeft = 0;
long nRight = 0;
long nRowSpan = 1;
- USHORT nCount = pLine->GetTabBoxes().Count();
- for( USHORT nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
+ sal_uInt16 nCount = pLine->GetTabBoxes().Count();
+ for( sal_uInt16 nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox];
ASSERT( pBox, "Missing table box" );
@@ -448,9 +448,9 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
break;
}
if( nRowSpan > 1 && nRow + nRowSpan - 1 > nBottom )
- nBottom = nRow + (USHORT)nRowSpan - 1;
+ nBottom = nRow + (sal_uInt16)nRowSpan - 1;
if( nRowSpan < -1 && nRow - nRowSpan - 1 > nBottom )
- nBottom = (USHORT)(nRow - nRowSpan - 1);
+ nBottom = (sal_uInt16)(nRow - nRowSpan - 1);
if( nRightSpanCnt && nRight == nMax )
bOkay = false;
}
@@ -485,9 +485,9 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
{
long nTmpSpan = pInnerBox->getRowSpan();
if( nTmpSpan > 1 )
- nBottom += (USHORT)nTmpSpan - 1;
+ nBottom += (sal_uInt16)nTmpSpan - 1;
else if( nTmpSpan < -1 )
- nBottom = (USHORT)( nBottom - nTmpSpan - 1 );
+ nBottom = (sal_uInt16)( nBottom - nTmpSpan - 1 );
}
SwTableBox* pOuterBox = pLeftBox;
do
@@ -497,7 +497,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
long nOutSpan = pOuterBox->getRowSpan();
if( nOutSpan != 1 )
{
- USHORT nCheck = nRow;
+ sal_uInt16 nCheck = nRow;
if( nOutSpan < 0 )
{
const SwTableBox& rBox =
@@ -535,7 +535,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
nRightSpanCnt = nOutSpan;
}
}
- nCheck += (USHORT)nOutSpan - 1;
+ nCheck += (sal_uInt16)nOutSpan - 1;
if( nCheck > nCheckBottom )
nCheckBottom = nCheck;
}
@@ -610,19 +610,19 @@ void lcl_InvalidateCellFrm( const SwTableBox& rBox )
when a selection of cells is given and returns the average cell widths
*/
-long lcl_InsertPosition( SwTable &rTable, std::vector<USHORT>& rInsPos,
- const SwSelBoxes& rBoxes, BOOL bBehind )
+long lcl_InsertPosition( SwTable &rTable, std::vector<sal_uInt16>& rInsPos,
+ const SwSelBoxes& rBoxes, sal_Bool bBehind )
{
sal_Int32 nAddWidth = 0;
long nCount = 0;
- for( USHORT j = 0; j < rBoxes.Count(); ++j )
+ for( sal_uInt16 j = 0; j < rBoxes.Count(); ++j )
{
SwTableBox *pBox = rBoxes[j];
SwTableLine* pLine = pBox->GetUpper();
long nWidth = rBoxes[j]->GetFrmFmt()->GetFrmSize().GetWidth();
nAddWidth += nWidth;
- USHORT nCurrBox = pLine->GetTabBoxes().C40_GETPOS(SwTableBox, pBox );
- USHORT nCurrLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pLine );
+ sal_uInt16 nCurrBox = pLine->GetTabBoxes().C40_GETPOS(SwTableBox, pBox );
+ sal_uInt16 nCurrLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pLine );
ASSERT( nCurrLine != USHRT_MAX, "Time to say Good-Bye.." );
if( rInsPos[ nCurrLine ] == USHRT_MAX )
{
@@ -656,18 +656,18 @@ insertion behind (true) or before (false) the selected boxes
*/
-BOOL SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes,
- USHORT nCnt, BOOL bBehind )
+sal_Bool SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes,
+ sal_uInt16 nCnt, sal_Bool bBehind )
{
if( !aLines.Count() || !nCnt )
- return FALSE;
+ return sal_False;
CHECK_TABLE( *this )
long nNewBoxWidth = 0;
- std::vector< USHORT > aInsPos( aLines.Count(), USHRT_MAX );
+ 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( USHORT i = 0; i < aLines[0]->GetTabBoxes().Count(); ++i )
+ for( sal_uInt16 i = 0; i < aLines[0]->GetTabBoxes().Count(); ++i )
nTableWidth += aLines[0]->GetTabBoxes()[i]->GetFrmFmt()->GetFrmSize().GetWidth();
// Fill the vector of insert positions and the (average) width to insert
@@ -682,12 +682,12 @@ BOOL SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes,
nAddWidth *= nCnt; // we have to insert nCnt boxes per line
sal_uInt64 nResultingWidth = nAddWidth + nTableWidth;
if( !nResultingWidth )
- return FALSE;
+ return sal_False;
nAddWidth = (nAddWidth * nTableWidth) / nResultingWidth;
nNewBoxWidth = long( nAddWidth / nCnt ); // Rounding
nAddWidth = nNewBoxWidth * nCnt; // Rounding
if( !nAddWidth || nAddWidth >= nTableWidth )
- return FALSE;
+ return sal_False;
AdjustWidths( static_cast< long >(nTableWidth), static_cast< long >(nTableWidth - nAddWidth) );
}
@@ -698,13 +698,13 @@ BOOL SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes,
SwTableNode* pTblNd = GetTableNode();
std::vector<SwTableBoxFmt*> aInsFormat( nCnt, 0 );
- USHORT nLastLine = USHRT_MAX;
+ sal_uInt16 nLastLine = USHRT_MAX;
long nLastRowSpan = 1;
- for( USHORT i = 0; i < aLines.Count(); ++i )
+ for( sal_uInt16 i = 0; i < aLines.Count(); ++i )
{
SwTableLine* pLine = aLines[ i ];
- USHORT nInsPos = aInsPos[i];
+ sal_uInt16 nInsPos = aInsPos[i];
ASSERT( nInsPos != USHRT_MAX, "Didn't found insert position" );
SwTableBox* pBox = pLine->GetTabBoxes()[ nInsPos ];
if( bBehind )
@@ -721,10 +721,10 @@ BOOL SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes,
while( nLastLine < i )
{
SwTableLine* pTmpLine = aLines[ nLastLine ];
- USHORT nTmpPos = aInsPos[nLastLine];
+ sal_uInt16 nTmpPos = aInsPos[nLastLine];
if( bBehind )
++nTmpPos;
- for( USHORT j = 0; j < nCnt; ++j )
+ for( sal_uInt16 j = 0; j < nCnt; ++j )
pTmpLine->GetTabBoxes()[nTmpPos+j]->setRowSpan( nDiff );
if( nDiff > 0 )
nDiff = -nDiff;
@@ -749,7 +749,7 @@ BOOL SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes,
pNoRightBorder = new SvxBoxItem( aSelBoxItem );
pNoRightBorder->SetLine( 0, BOX_LINE_RIGHT );
}
- for( USHORT j = 0; j < nCnt; ++j )
+ for( sal_uInt16 j = 0; j < nCnt; ++j )
{
SwTableBox *pCurrBox = pLine->GetTabBoxes()[nInsPos+j];
if( bNewSpan )
@@ -780,14 +780,14 @@ BOOL SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes,
{
const SwTableBoxes &rTabBoxes = aLines[0]->GetTabBoxes();
long nNewWidth = 0;
- for( USHORT i = 0; i < rTabBoxes.Count(); ++i )
+ for( sal_uInt16 i = 0; i < rTabBoxes.Count(); ++i )
nNewWidth += rTabBoxes[i]->GetFrmFmt()->GetFrmSize().GetWidth();
ASSERT( nNewWidth > 0, "Very small" );
}
#endif
CHECK_TABLE( *this )
- return TRUE;
+ return sal_True;
}
/** SwTable::PrepareMerge(..) some preparation for the coming Merge(..)
@@ -847,7 +847,7 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
SwPosition aInsPos( *pMergeBox->GetSttNd()->EndOfSectionNode() );
SwPaM aChkPam( aInsPos );
// The number of lines in the selection rectangle: nLineCount
- const USHORT nLineCount = USHORT(pSel->aBoxes.size());
+ const sal_uInt16 nLineCount = sal_uInt16(pSel->aBoxes.size());
// BTW: nLineCount is the rowspan of the new master cell
long nRowSpan = nLineCount;
// We will need the first and last line of the selection
@@ -855,13 +855,13 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
SwTableLine* pFirstLn = 0;
SwTableLine* pLastLn = 0;
// Iteration over the lines of the selection...
- for( USHORT nCurrLine = 0; nCurrLine < nLineCount; ++nCurrLine )
+ for( sal_uInt16 nCurrLine = 0; nCurrLine < nLineCount; ++nCurrLine )
{
// The selected boxes in the current line
const SwSelBoxes* pBoxes = pSel->aBoxes[ nCurrLine ];
- USHORT nColCount = pBoxes->Count();
+ sal_uInt16 nColCount = pBoxes->Count();
// Iteration over the selected cell in the current row
- for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
+ for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
{
SwTableBox* pBox = (*pBoxes)[nCurrCol];
rMerged.Insert( pBox );
@@ -894,14 +894,14 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
SwPaM aPam( aInsPos );
aPam.GetPoint()->nNode.Assign( *pBox->GetSttNd()->EndOfSectionNode(), -1 );
SwCntntNode* pCNd = aPam.GetCntntNode();
- USHORT nL = pCNd ? pCNd->Len() : 0;
+ sal_uInt16 nL = pCNd ? pCNd->Len() : 0;
aPam.GetPoint()->nContent.Assign( pCNd, nL );
SwNodeIndex aSttNdIdx( *pBox->GetSttNd(), 1 );
if( pUndo )
- pDoc->DoUndo( FALSE );
+ pDoc->DoUndo( sal_False );
pDoc->AppendTxtNode( *aPam.GetPoint() );
if( pUndo )
- pDoc->DoUndo( TRUE );
+ pDoc->DoUndo( sal_True );
SwNodeRange aRg( aSttNdIdx, aPam.GetPoint()->nNode );
if( pUndo )
pUndo->MoveBoxCntnt( pDoc, aRg, rInsPosNd );
@@ -929,11 +929,11 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
// pNewFmt will be set to the new master box and the overlapped cells
SwFrmFmt* pNewFmt = pMergeBox->ClaimFrmFmt();
pNewFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, pSel->mnMergeWidth, 0 ) );
- for( USHORT nCurrLine = 0; nCurrLine < nLineCount; ++nCurrLine )
+ for( sal_uInt16 nCurrLine = 0; nCurrLine < nLineCount; ++nCurrLine )
{
const SwSelBoxes* pBoxes = pSel->aBoxes[ nCurrLine ];
- USHORT nColCount = pBoxes->Count();
- for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
+ sal_uInt16 nColCount = pBoxes->Count();
+ for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
{
SwTableBox* pBox = (*pBoxes)[nCurrCol];
if( nCurrCol )
@@ -979,15 +979,15 @@ void SwTable::_FindSuperfluousRows( SwSelBoxes& rBoxes,
pFirstLn = rBoxes[0]->GetUpper();
pLastLn = rBoxes[ rBoxes.Count() - 1 ]->GetUpper();
}
- USHORT nFirstLn = GetTabLines().C40_GETPOS(SwTableLine, pFirstLn );
- USHORT nLastLn = GetTabLines().C40_GETPOS(SwTableLine, pLastLn );
- for( USHORT nRow = nFirstLn; nRow <= nLastLn; ++nRow )
+ sal_uInt16 nFirstLn = GetTabLines().C40_GETPOS(SwTableLine, pFirstLn );
+ sal_uInt16 nLastLn = GetTabLines().C40_GETPOS(SwTableLine, pLastLn );
+ for( sal_uInt16 nRow = nFirstLn; nRow <= nLastLn; ++nRow )
{
SwTableLine* pLine = aLines[nRow];
ASSERT( pLine, "Missing table line" );
- USHORT nCols = pLine->GetTabBoxes().Count();
+ sal_uInt16 nCols = pLine->GetTabBoxes().Count();
bool bSuperfl = true;
- for( USHORT nCol = 0; nCol < nCols; ++nCol )
+ for( sal_uInt16 nCol = 0; nCol < nCols; ++nCol )
{
SwTableBox *pBox = pLine->GetTabBoxes()[nCol];
if( pBox->getRowSpan() > 0 &&
@@ -999,7 +999,7 @@ void SwTable::_FindSuperfluousRows( SwSelBoxes& rBoxes,
}
if( bSuperfl )
{
- for( USHORT nCol = 0; nCol < nCols; ++nCol )
+ for( sal_uInt16 nCol = 0; nCol < nCols; ++nCol )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCol];
rBoxes.Insert( pBox );
@@ -1012,7 +1012,7 @@ void SwTable::_FindSuperfluousRows( SwSelBoxes& rBoxes,
overlaps the given cell, it maybe the cell itself.
*/
-SwTableBox& SwTableBox::FindStartOfRowSpan( const SwTable& rTable, USHORT nMaxStep )
+SwTableBox& SwTableBox::FindStartOfRowSpan( const SwTable& rTable, sal_uInt16 nMaxStep )
{
if( getRowSpan() > 0 || !nMaxStep )
return *this;
@@ -1020,7 +1020,7 @@ SwTableBox& SwTableBox::FindStartOfRowSpan( const SwTable& rTable, USHORT nMaxSt
long nLeftBorder = lcl_Box2LeftBorder( *this );
SwTableBox* pBox = this;
const SwTableLine* pMyUpper = GetUpper();
- USHORT nLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pMyUpper );
+ sal_uInt16 nLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pMyUpper );
if( nLine && nLine < rTable.GetTabLines().Count() )
{
SwTableBox* pNext;
@@ -1039,7 +1039,7 @@ SwTableBox& SwTableBox::FindStartOfRowSpan( const SwTable& rTable, USHORT nMaxSt
any. Otherwise the cell itself will returned.
*/
-SwTableBox& SwTableBox::FindEndOfRowSpan( const SwTable& rTable, USHORT nMaxStep )
+SwTableBox& SwTableBox::FindEndOfRowSpan( const SwTable& rTable, sal_uInt16 nMaxStep )
{
long nAbsSpan = getRowSpan();
if( nAbsSpan < 0 )
@@ -1048,9 +1048,9 @@ SwTableBox& SwTableBox::FindEndOfRowSpan( const SwTable& rTable, USHORT nMaxStep
return *this;
if( nMaxStep > --nAbsSpan )
- nMaxStep = (USHORT)nAbsSpan;
+ nMaxStep = (sal_uInt16)nAbsSpan;
const SwTableLine* pMyUpper = GetUpper();
- USHORT nLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pMyUpper );
+ sal_uInt16 nLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pMyUpper );
nMaxStep = nLine + nMaxStep;
if( nMaxStep >= rTable.GetTabLines().Count() )
nMaxStep = rTable.GetTabLines().Count() - 1;
@@ -1074,9 +1074,9 @@ void lcl_getAllMergedBoxes( const SwTable& rTable, SwSelBoxes& rBoxes, SwTableBo
if( pBox->getRowSpan() == 1 )
return;
const SwTableLine* pMyUpper = pBox->GetUpper();
- USHORT nLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pMyUpper );
+ sal_uInt16 nLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pMyUpper );
long nLeftBorder = lcl_Box2LeftBorder( *pBox );
- USHORT nCount = rTable.GetTabLines().Count();
+ sal_uInt16 nCount = rTable.GetTabLines().Count();
while( ++nLine < nCount && pBox && pBox->getRowSpan() != -1 )
{
pBox = lcl_LeftBorder2Box( nLeftBorder, rTable.GetTabLines()[nLine] );
@@ -1089,22 +1089,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, USHORT nCnt,
- BOOL bSameHeight )
+void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, sal_uInt16 nCnt,
+ sal_Bool bSameHeight )
{
SwSelBoxes aBoxes;
lcl_getAllMergedBoxes( rTable, aBoxes, rBox );
- USHORT nCount = aBoxes.Count();
+ sal_uInt16 nCount = aBoxes.Count();
if( nCount < 2 )
return;
if( nCnt > nCount )
nCnt = nCount;
- USHORT *pSplitIdx = new USHORT[ nCnt ];
+ sal_uInt16 *pSplitIdx = new sal_uInt16[ nCnt ];
if( bSameHeight )
{
SwTwips *pHeights = new SwTwips[ nCount ];
SwTwips nHeight = 0;
- for( USHORT i = 0; i < nCount; ++i )
+ for( sal_uInt16 i = 0; i < nCount; ++i )
{
SwTableLine* pLine = aBoxes[ i ]->GetUpper();
SwFrmFmt *pRowFmt = pLine->GetFrmFmt();
@@ -1112,8 +1112,8 @@ void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, USHORT nCnt,
nHeight += pHeights[ i ];
}
SwTwips nSumH = 0;
- USHORT nIdx = 0;
- for( USHORT i = 1; i <= nCnt; ++i )
+ sal_uInt16 nIdx = 0;
+ for( sal_uInt16 i = 1; i <= nCnt; ++i )
{
SwTwips nSplit = ( i * nHeight ) / nCnt;
while( nSumH < nSplit && nIdx < nCount )
@@ -1125,12 +1125,12 @@ void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, USHORT nCnt,
else
{
for( long i = 1; i <= nCnt; ++i )
- pSplitIdx[ i - 1 ] = (USHORT)( ( i * nCount ) / nCnt );
+ pSplitIdx[ i - 1 ] = (sal_uInt16)( ( i * nCount ) / nCnt );
}
- USHORT nIdx = 0;
+ sal_uInt16 nIdx = 0;
for( long i = 0; i < nCnt; ++i )
{
- USHORT nNextIdx = pSplitIdx[ i ];
+ sal_uInt16 nNextIdx = pSplitIdx[ i ];
aBoxes[ nIdx ]->setRowSpan( nNextIdx - nIdx );
lcl_InvalidateCellFrm( *aBoxes[ nIdx ] );
while( ++nIdx < nNextIdx )
@@ -1144,8 +1144,8 @@ void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, USHORT nCnt,
void lcl_FillSelBoxes( SwSelBoxes &rBoxes, SwTableLine &rLine )
{
- USHORT nBoxCount = rLine.GetTabBoxes().Count();
- USHORT nCurrBox;
+ sal_uInt16 nBoxCount = rLine.GetTabBoxes().Count();
+ sal_uInt16 nCurrBox;
for( nCurrBox = 0; nCurrBox < nBoxCount; ++nCurrBox )
rBoxes.Insert( rLine.GetTabBoxes()[nCurrBox] );
}
@@ -1154,7 +1154,7 @@ void lcl_FillSelBoxes( SwSelBoxes &rBoxes, SwTableLine &rLine )
overlapped cells only. This is a preparation for an upcoming split.
*/
-void SwTable::InsertSpannedRow( SwDoc* pDoc, USHORT nRowIdx, USHORT nCnt )
+void SwTable::InsertSpannedRow( SwDoc* pDoc, sal_uInt16 nRowIdx, sal_uInt16 nCnt )
{
CHECK_TABLE( *this )
ASSERT( nCnt && nRowIdx < GetTabLines().Count(), "Wrong call of InsertSpannedRow" );
@@ -1171,12 +1171,12 @@ void SwTable::InsertSpannedRow( SwDoc* pDoc, USHORT nRowIdx, USHORT nCnt )
aFSz.SetHeight( nNewHeight );
pFrmFmt->SetFmtAttr( aFSz );
}
- _InsertRow( pDoc, aBoxes, nCnt, TRUE );
- USHORT nBoxCount = rLine.GetTabBoxes().Count();
- for( USHORT n = 0; n < nCnt; ++n )
+ _InsertRow( pDoc, aBoxes, nCnt, sal_True );
+ sal_uInt16 nBoxCount = rLine.GetTabBoxes().Count();
+ for( sal_uInt16 n = 0; n < nCnt; ++n )
{
SwTableLine *pNewLine = GetTabLines()[ nRowIdx + nCnt - n ];
- for( USHORT nCurrBox = 0; nCurrBox < nBoxCount; ++nCurrBox )
+ for( sal_uInt16 nCurrBox = 0; nCurrBox < nBoxCount; ++nCurrBox )
{
long nRowSpan = rLine.GetTabBoxes()[nCurrBox]->getRowSpan();
if( nRowSpan > 0 )
@@ -1188,7 +1188,7 @@ void SwTable::InsertSpannedRow( SwDoc* pDoc, USHORT nRowIdx, USHORT nCnt )
CHECK_TABLE( *this )
}
-typedef std::pair< USHORT, USHORT > SwLineOffset;
+typedef std::pair< sal_uInt16, sal_uInt16 > SwLineOffset;
typedef std::list< SwLineOffset > SwLineOffsetArray;
/******************************************************************************
@@ -1205,24 +1205,24 @@ Output
******************************************************************************/
void lcl_SophisticatedFillLineIndices( SwLineOffsetArray &rArr,
- const SwTable& rTable, const SwSelBoxes& rBoxes, USHORT nCnt )
+ const SwTable& rTable, const SwSelBoxes& rBoxes, sal_uInt16 nCnt )
{
std::list< SwLineOffset > aBoxes;
SwLineOffset aLnOfs( USHRT_MAX, USHRT_MAX );
- for( USHORT i = 0; i < rBoxes.Count(); ++i )
+ for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
{ // Collect all end line indices and the row spans
const SwTableBox &rBox = rBoxes[ i ]->FindStartOfRowSpan( rTable );
ASSERT( rBox.getRowSpan() > 0, "Didn't I say 'StartOfRowSpan' ??" )
if( nCnt > rBox.getRowSpan() )
{
const SwTableLine *pLine = rBox.GetUpper();
- const USHORT nEnd = USHORT( rBox.getRowSpan() +
+ const sal_uInt16 nEnd = sal_uInt16( rBox.getRowSpan() +
rTable.GetTabLines().C40_GETPOS( SwTableLine, pLine ) );
// The next if statement is a small optimization
if( aLnOfs.first != nEnd || aLnOfs.second != rBox.getRowSpan() )
{
aLnOfs.first = nEnd; // ok, this is the line behind the box
- aLnOfs.second = USHORT( rBox.getRowSpan() ); // the row span
+ aLnOfs.second = sal_uInt16( rBox.getRowSpan() ); // the row span
aBoxes.insert( aBoxes.end(), aLnOfs );
}
}
@@ -1230,7 +1230,7 @@ void lcl_SophisticatedFillLineIndices( SwLineOffsetArray &rArr,
// As I said, I noted the line index _behind_ the last line of the boxes
// in the resulting array the index has to be _on_ the line
// nSum is to evaluate the wished value
- USHORT nSum = 1;
+ sal_uInt16 nSum = 1;
while( aBoxes.size() )
{
// I. step:
@@ -1299,22 +1299,22 @@ typedef std::set< SwTwips > SwSplitLines;
to be splitted to fulfill the requested "split same height"
*/
-USHORT lcl_CalculateSplitLineHeights( SwSplitLines &rCurr, SwSplitLines &rNew,
- const SwTable& rTable, const SwSelBoxes& rBoxes, USHORT nCnt )
+sal_uInt16 lcl_CalculateSplitLineHeights( SwSplitLines &rCurr, SwSplitLines &rNew,
+ const SwTable& rTable, const SwSelBoxes& rBoxes, sal_uInt16 nCnt )
{
if( nCnt < 2 )
return 0;
std::list< SwLineOffset > aBoxes;
SwLineOffset aLnOfs( USHRT_MAX, USHRT_MAX );
- USHORT nFirst = USHRT_MAX; // becomes the index of the first line
- USHORT nLast = 0; // becomes the index of the last line of the splitting
- for( USHORT i = 0; i < rBoxes.Count(); ++i )
+ 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.Count(); ++i )
{ // Collect all pairs (start+end) of line indices to split
const SwTableBox &rBox = rBoxes[ i ]->FindStartOfRowSpan( rTable );
ASSERT( rBox.getRowSpan() > 0, "Didn't I say 'StartOfRowSpan' ??" )
const SwTableLine *pLine = rBox.GetUpper();
- const USHORT nStart = rTable.GetTabLines().C40_GETPOS( SwTableLine, pLine );
- const USHORT nEnd = USHORT( rBox.getRowSpan() + nStart - 1 );
+ const sal_uInt16 nStart = rTable.GetTabLines().C40_GETPOS( SwTableLine, pLine );
+ const sal_uInt16 nEnd = sal_uInt16( rBox.getRowSpan() + nStart - 1 );
// The next if statement is a small optimization
if( aLnOfs.first != nStart || aLnOfs.second != nEnd )
{
@@ -1332,7 +1332,7 @@ USHORT lcl_CalculateSplitLineHeights( SwSplitLines &rCurr, SwSplitLines &rNew,
return 0;
SwTwips nHeight = 0;
SwTwips* pLines = new SwTwips[ nLast + 1 - nFirst ];
- for( USHORT i = nFirst; i <= nLast; ++i )
+ for( sal_uInt16 i = nFirst; i <= nLast; ++i )
{
bool bLayoutAvailable = false;
nHeight += rTable.GetTabLines()[ i ]->GetTableLineHeight( bLayoutAvailable );
@@ -1345,7 +1345,7 @@ USHORT lcl_CalculateSplitLineHeights( SwSplitLines &rCurr, SwSplitLines &rNew,
SwTwips nBase = pSplit->first <= nFirst ? 0 :
pLines[ pSplit->first - nFirst - 1 ];
SwTwips nDiff = pLines[ pSplit->second - nFirst ] - nBase;
- for( USHORT i = 1; i < nCnt; ++i )
+ for( sal_uInt16 i = 1; i < nCnt; ++i )
{
SwTwips nSplit = nBase + ( i * nDiff ) / nCnt;
rNew.insert( nSplit );
@@ -1360,16 +1360,16 @@ USHORT lcl_CalculateSplitLineHeights( SwSplitLines &rCurr, SwSplitLines &rNew,
the box selection.
*/
-USHORT lcl_LineIndex( const SwTable& rTable, const SwSelBoxes& rBoxes,
+sal_uInt16 lcl_LineIndex( const SwTable& rTable, const SwSelBoxes& rBoxes,
bool bBehind )
{
- USHORT nDirect = USHRT_MAX;
- USHORT nSpan = USHRT_MAX;
- for( USHORT i = 0; i < rBoxes.Count(); ++i )
+ sal_uInt16 nDirect = USHRT_MAX;
+ sal_uInt16 nSpan = USHRT_MAX;
+ for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
{
SwTableBox *pBox = rBoxes[i];
const SwTableLine* pLine = rBoxes[i]->GetUpper();
- USHORT nPos = rTable.GetTabLines().C40_GETPOS( SwTableLine, pLine );
+ sal_uInt16 nPos = rTable.GetTabLines().C40_GETPOS( SwTableLine, pLine );
if( USHRT_MAX != nPos )
{
if( bBehind )
@@ -1381,7 +1381,7 @@ USHORT lcl_LineIndex( const SwTable& rTable, const SwSelBoxes& rBoxes,
nSpan = 0;
else if( nSpan )
{
- USHORT nEndOfRowSpan = (USHORT)(nPos + nRowSpan - 1);
+ sal_uInt16 nEndOfRowSpan = (sal_uInt16)(nPos + nRowSpan - 1);
if( nEndOfRowSpan > nSpan || nSpan == USHRT_MAX )
nSpan = nEndOfRowSpan;
}
@@ -1398,8 +1398,8 @@ USHORT lcl_LineIndex( const SwTable& rTable, const SwSelBoxes& rBoxes,
/** SwTable::NewSplitRow(..) splits all selected boxes horizontally.
*/
-BOOL SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt,
- BOOL bSameHeight )
+sal_Bool SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt,
+ sal_Bool bSameHeight )
{
CHECK_TABLE( *this )
++nCnt;
@@ -1410,7 +1410,7 @@ BOOL SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt,
{
SwSplitLines aRowLines;
SwSplitLines aSplitLines;
- USHORT nFirst = lcl_CalculateSplitLineHeights( aRowLines, aSplitLines,
+ sal_uInt16 nFirst = lcl_CalculateSplitLineHeights( aRowLines, aSplitLines,
*this, rBoxes, nCnt );
aFndBox.DelFrms( *this );
SwTwips nLast = 0;
@@ -1447,7 +1447,7 @@ BOOL SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt,
else
{
aFndBox.DelFrms( *this );
- bSameHeight = FALSE;
+ bSameHeight = sal_False;
}
if( !bSameHeight )
{
@@ -1461,15 +1461,15 @@ BOOL SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt,
}
}
- std::set< USHORT> aIndices;
- for( USHORT i = 0; i < rBoxes.Count(); ++i )
+ std::set< sal_uInt16> aIndices;
+ for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
{
ASSERT( rBoxes[i]->getRowSpan() != 1, "Forgot to split?" )
if( rBoxes[i]->getRowSpan() > 1 )
aIndices.insert( i );
}
- std::set< USHORT >::iterator pCurrBox = aIndices.begin();
+ std::set< sal_uInt16 >::iterator pCurrBox = aIndices.begin();
while( pCurrBox != aIndices.end() )
lcl_UnMerge( *this, *rBoxes[*pCurrBox++], nCnt, bSameHeight );
@@ -1477,21 +1477,21 @@ BOOL SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt,
//Layout updaten
aFndBox.MakeFrms( *this );
- return TRUE;
+ return sal_True;
}
/** SwTable::InsertRow(..) inserts one or more rows before or behind the selected
boxes.
*/
-BOOL SwTable::InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes,
- USHORT nCnt, BOOL bBehind )
+sal_Bool SwTable::InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes,
+ sal_uInt16 nCnt, sal_Bool bBehind )
{
bool bRet = false;
if( IsNewModel() )
{
CHECK_TABLE( *this )
- USHORT nRowIdx = lcl_LineIndex( *this, rBoxes, bBehind );
+ sal_uInt16 nRowIdx = lcl_LineIndex( *this, rBoxes, bBehind );
if( nRowIdx < USHRT_MAX )
{
_FndBox aFndBox( 0, 0 );
@@ -1504,12 +1504,12 @@ BOOL SwTable::InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes,
SwSelBoxes aLineBoxes;
lcl_FillSelBoxes( aLineBoxes, *pLine );
_InsertRow( pDoc, aLineBoxes, nCnt, bBehind );
- USHORT nBoxCount = pLine->GetTabBoxes().Count();
- USHORT nOfs = bBehind ? 0 : 1;
- for( USHORT n = 0; n < nCnt; ++n )
+ sal_uInt16 nBoxCount = pLine->GetTabBoxes().Count();
+ sal_uInt16 nOfs = bBehind ? 0 : 1;
+ for( sal_uInt16 n = 0; n < nCnt; ++n )
{
SwTableLine *pNewLine = GetTabLines()[ nRowIdx+nCnt-n-nOfs];
- for( USHORT nCurrBox = 0; nCurrBox < nBoxCount; ++nCurrBox )
+ for( sal_uInt16 nCurrBox = 0; nCurrBox < nBoxCount; ++nCurrBox )
{
long nRowSpan = pLine->GetTabBoxes()[nCurrBox]->getRowSpan();
if( bBehind )
@@ -1552,7 +1552,7 @@ void SwTable::PrepareDelBoxes( const SwSelBoxes& rBoxes )
{
if( IsNewModel() )
{
- for( USHORT i = 0; i < rBoxes.Count(); ++i )
+ for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
{
SwTableBox* pBox = rBoxes[i];
long nRowSpan = pBox->getRowSpan();
@@ -1560,7 +1560,7 @@ void SwTable::PrepareDelBoxes( const SwSelBoxes& rBoxes )
{
long nLeft = lcl_Box2LeftBorder( *pBox );
SwTableLine *pLine = pBox->GetUpper();
- USHORT nLinePos = GetTabLines().C40_GETPOS(SwTableLine, pLine);
+ sal_uInt16 nLinePos = GetTabLines().C40_GETPOS(SwTableLine, pLine);
ASSERT( nLinePos < USHRT_MAX, "Box/table mismatch" )
if( nRowSpan > 1 )
{
@@ -1612,8 +1612,8 @@ void lcl_SearchSelBox( const SwTable &rTable, SwSelBoxes& rBoxes, long nMin, lon
long nLeft = 0;
long nRight = 0;
long nMid = ( nMax + nMin )/ 2;
- USHORT nCount = rLine.GetTabBoxes().Count();
- for( USHORT nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
+ sal_uInt16 nCount = rLine.GetTabBoxes().Count();
+ for( sal_uInt16 nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
{
SwTableBox* pBox = rLine.GetTabBoxes()[nCurrBox];
ASSERT( pBox, "Missing table box" );
@@ -1633,7 +1633,7 @@ void lcl_SearchSelBox( const SwTable &rTable, SwSelBoxes& rBoxes, long nMin, lon
( !bChkProtected ||
!pBox->GetFrmFmt()->GetProtect().IsCntntProtected() ) )
{
- USHORT nOldCnt = rBoxes.Count();
+ sal_uInt16 nOldCnt = rBoxes.Count();
rBoxes.Insert( pBox );
if( bColumn && nRowSpan != 1 && nOldCnt < rBoxes.Count() )
{
@@ -1676,13 +1676,13 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd,
if( rBoxes.Count() )
{
// aKeepBoxes.Insert( &rBoxes );
- rBoxes.Remove( USHORT(0), rBoxes.Count() );
+ rBoxes.Remove( sal_uInt16(0), rBoxes.Count() );
}
// Looking for start and end of the selection given by SwNode-pointer
- USHORT nLines = aLines.Count();
+ sal_uInt16 nLines = aLines.Count();
// nTop becomes the line number of the upper box
// nBottom becomes the line number of the lower box
- USHORT nTop = 0, nBottom = 0;
+ sal_uInt16 nTop = 0, nBottom = 0;
// nUpperMin becomes the left border value of the upper box
// nUpperMax becomes the right border of the upper box
// nLowerMin and nLowerMax the borders of the lower box
@@ -1691,12 +1691,12 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd,
// nFound will incremented if a box is found
// 0 => no box found; 1 => the upper box has been found; 2 => both found
int nFound = 0;
- for( USHORT nRow = 0; nFound < 2 && nRow < nLines; ++nRow )
+ for( sal_uInt16 nRow = 0; nFound < 2 && nRow < nLines; ++nRow )
{
SwTableLine* pLine = aLines[nRow];
ASSERT( pLine, "Missing table line" );
- USHORT nCols = pLine->GetTabBoxes().Count();
- for( USHORT nCol = 0; nCol < nCols; ++nCol )
+ sal_uInt16 nCols = pLine->GetTabBoxes().Count();
+ for( sal_uInt16 nCol = 0; nCol < nCols; ++nCol )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCol];
ASSERT( pBox, "Missing table box" );
@@ -1736,12 +1736,12 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd,
// Selection of a row is quiet easy:
// every (unprotected) box between start and end line
// with a positive row span will be collected
- for( USHORT nRow = nTop; nRow <= nBottom; ++nRow )
+ for( sal_uInt16 nRow = nTop; nRow <= nBottom; ++nRow )
{
SwTableLine* pLine = aLines[nRow];
ASSERT( pLine, "Missing table line" );
- USHORT nCount = pLine->GetTabBoxes().Count();
- for( USHORT nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
+ sal_uInt16 nCount = pLine->GetTabBoxes().Count();
+ for( sal_uInt16 nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox];
ASSERT( pBox, "Missing table box" );
@@ -1780,7 +1780,7 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd,
const bool bColumn = eSearch == SEARCH_COL;
if( bColumn )
{
- for( USHORT i = 0; i < nTop; ++i )
+ for( sal_uInt16 i = 0; i < nTop; ++i )
lcl_SearchSelBox( *this, rBoxes, nUpperMin, nUpperMax,
*aLines[i], bChkProtected, bColumn );
}
@@ -1788,7 +1788,7 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd,
{
long nMin = nUpperMin < nLowerMin ? nUpperMin : nLowerMin;
long nMax = nUpperMax < nLowerMax ? nLowerMax : nUpperMax;
- for( USHORT i = nTop; i <= nBottom; ++i )
+ for( sal_uInt16 i = nTop; i <= nBottom; ++i )
lcl_SearchSelBox( *this, rBoxes, nMin, nMax, *aLines[i],
bChkProtected, bColumn );
}
@@ -1796,7 +1796,7 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd,
{
long nInnerMin = nUpperMin < nLowerMin ? nLowerMin : nUpperMin;
long nInnerMax = nUpperMax < nLowerMax ? nUpperMax : nLowerMax;
- for( USHORT i = nTop + 1; i < nBottom; ++i )
+ for( sal_uInt16 i = nTop + 1; i < nBottom; ++i )
lcl_SearchSelBox( *this, rBoxes, nInnerMin, nInnerMax, *aLines[i],
bChkProtected, bColumn );
}
@@ -1813,10 +1813,10 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd,
long nMin = nUpperMin < nLowerMin ? nUpperMin : nLowerMin;
long nMax = nUpperMax < nLowerMax ? nLowerMax : nUpperMax;
SwSelBoxes aCandidates;
- for( USHORT i = nTop; i <= nBottom; ++i )
+ for( sal_uInt16 i = nTop; i <= nBottom; ++i )
lcl_SearchSelBox( *this, aCandidates, nMin, nMax, *aLines[i],
bChkProtected, bColumn );
- USHORT nOld = 0, nNew = 0;
+ sal_uInt16 nOld = 0, nNew = 0;
while ( nOld < aKeepBoxes.Count() && nNew < aCandidates.Count() )
{
const SwTableBox* pPOld = *( aKeepBoxes.GetData() + nOld );
@@ -1835,7 +1835,7 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd,
} */
if( bColumn )
{
- for( USHORT i = nBottom + 1; i < nLines; ++i )
+ for( sal_uInt16 i = nBottom + 1; i < nLines; ++i )
lcl_SearchSelBox( *this, rBoxes, nLowerMin, nLowerMax, *aLines[i],
bChkProtected, true );
}
@@ -1853,15 +1853,15 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax
if( !aLines.Count() || !rBoxes.Count() )
return;
- USHORT nLineCnt = aLines.Count();
- USHORT nBoxCnt = rBoxes.Count();
- USHORT nBox = 0;
- for( USHORT nRow = 0; nRow < nLineCnt && nBox < nBoxCnt; ++nRow )
+ sal_uInt16 nLineCnt = aLines.Count();
+ sal_uInt16 nBoxCnt = rBoxes.Count();
+ sal_uInt16 nBox = 0;
+ for( sal_uInt16 nRow = 0; nRow < nLineCnt && nBox < nBoxCnt; ++nRow )
{
SwTableLine* pLine = aLines[nRow];
ASSERT( pLine, "Missing table line" );
- USHORT nCols = pLine->GetTabBoxes().Count();
- for( USHORT nCol = 0; nCol < nCols; ++nCol )
+ sal_uInt16 nCols = pLine->GetTabBoxes().Count();
+ for( sal_uInt16 nCol = 0; nCol < nCols; ++nCol )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCol];
ASSERT( pBox, "Missing table box" );
@@ -1874,13 +1874,13 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax
}
}
nBox = 0;
- for( USHORT nRow = 0; nRow < nLineCnt; ++nRow )
+ for( sal_uInt16 nRow = 0; nRow < nLineCnt; ++nRow )
{
SwTableLine* pLine = aLines[nRow];
- USHORT nCols = pLine->GetTabBoxes().Count();
+ sal_uInt16 nCols = pLine->GetTabBoxes().Count();
long nLeft = 0;
long nRight = 0;
- for( USHORT nCurrBox = 0; nCurrBox < nCols; ++nCurrBox )
+ for( sal_uInt16 nCurrBox = 0; nCurrBox < nCols; ++nCurrBox )
{
nLeft = nRight;
SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox];
@@ -1903,14 +1903,14 @@ void SwTable::PrepareDeleteCol( long nMin, long nMax )
const SwTwips nTabSize = GetFrmFmt()->GetFrmSize().GetWidth();
if( nTabSize == nMax )
nMid = nMax;
- USHORT nLineCnt = aLines.Count();
- for( USHORT nRow = 0; nRow < nLineCnt; ++nRow )
+ sal_uInt16 nLineCnt = aLines.Count();
+ for( sal_uInt16 nRow = 0; nRow < nLineCnt; ++nRow )
{
SwTableLine* pLine = aLines[nRow];
- USHORT nCols = pLine->GetTabBoxes().Count();
+ sal_uInt16 nCols = pLine->GetTabBoxes().Count();
long nLeft = 0;
long nRight = 0;
- for( USHORT nCurrBox = 0; nCurrBox < nCols; ++nCurrBox )
+ for( sal_uInt16 nCurrBox = 0; nCurrBox < nCols; ++nCurrBox )
{
nLeft = nRight;
SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox];
@@ -1948,7 +1948,7 @@ void SwTable::PrepareDeleteCol( long nMin, long nMax )
void SwTable::ExpandSelection( SwSelBoxes& rBoxes ) const
{
- for( USHORT i = 0; i < rBoxes.Count(); ++i )
+ for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
{
SwTableBox *pBox = rBoxes[i];
long nRowSpan = pBox->getRowSpan();
@@ -1968,7 +1968,7 @@ void SwTable::ExpandSelection( SwSelBoxes& rBoxes ) const
void SwTable::CheckRowSpan( SwTableLinePtr &rpLine, bool bUp ) const
{
ASSERT( IsNewModel(), "Don't call me for old tables" );
- USHORT nLineIdx = GetTabLines().C40_GETPOS( SwTableLine, rpLine );
+ sal_uInt16 nLineIdx = GetTabLines().C40_GETPOS( SwTableLine, rpLine );
ASSERT( nLineIdx < GetTabLines().Count(), "Start line out of range" );
bool bChange = true;
if( bUp )
@@ -1977,8 +1977,8 @@ void SwTable::CheckRowSpan( SwTableLinePtr &rpLine, bool bUp ) const
{
bChange = false;
rpLine = GetTabLines()[ nLineIdx ];
- USHORT nCols = rpLine->GetTabBoxes().Count();
- for( USHORT nCol = 0; !bChange && nCol < nCols; ++nCol )
+ sal_uInt16 nCols = rpLine->GetTabBoxes().Count();
+ for( sal_uInt16 nCol = 0; !bChange && nCol < nCols; ++nCol )
{
SwTableBox* pBox = rpLine->GetTabBoxes()[nCol];
if( pBox->getRowSpan() > 1 || pBox->getRowSpan() < -1 )
@@ -1998,13 +1998,13 @@ void SwTable::CheckRowSpan( SwTableLinePtr &rpLine, bool bUp ) const
}
else
{
- USHORT nMaxLine = GetTabLines().Count();
+ sal_uInt16 nMaxLine = GetTabLines().Count();
while( bChange )
{
bChange = false;
rpLine = GetTabLines()[ nLineIdx ];
- USHORT nCols = rpLine->GetTabBoxes().Count();
- for( USHORT nCol = 0; !bChange && nCol < nCols; ++nCol )
+ sal_uInt16 nCols = rpLine->GetTabBoxes().Count();
+ for( sal_uInt16 nCol = 0; !bChange && nCol < nCols; ++nCol )
{
SwTableBox* pBox = rpLine->GetTabBoxes()[nCol];
if( pBox->getRowSpan() < 0 )
@@ -2027,14 +2027,14 @@ void SwTable::CheckRowSpan( SwTableLinePtr &rpLine, bool bUp ) const
// In a top line no negative row span is allowed, so these have to be corrected.
// If there has been at least one correction, all values are stored
// and can be used by undo of table split
-SwSaveRowSpan::SwSaveRowSpan( SwTableBoxes& rBoxes, USHORT nSplitLn )
+SwSaveRowSpan::SwSaveRowSpan( SwTableBoxes& rBoxes, sal_uInt16 nSplitLn )
: mnSplitLine( nSplitLn )
{
bool bDontSave = true; // nothing changed, nothing to save
- USHORT nColCount = rBoxes.Count();
+ sal_uInt16 nColCount = rBoxes.Count();
ASSERT( nColCount, "Empty Table Line" )
mnRowSpans.resize( nColCount );
- for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
+ for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
{
SwTableBox* pBox = rBoxes[nCurrCol];
ASSERT( pBox, "Missing Table Box" );
@@ -2057,17 +2057,17 @@ void SwTable::RestoreRowSpan( const SwSaveRowSpan& rSave )
{
if( !IsNewModel() ) // for new model only
return;
- USHORT nLineCount = GetTabLines().Count();
+ sal_uInt16 nLineCount = GetTabLines().Count();
ASSERT( rSave.mnSplitLine < nLineCount, "Restore behind last line?" )
if( rSave.mnSplitLine < nLineCount )
{
SwTableLine* pLine = GetTabLines()[rSave.mnSplitLine];
- USHORT nColCount = pLine->GetTabBoxes().Count();
+ sal_uInt16 nColCount = pLine->GetTabBoxes().Count();
ASSERT( nColCount, "Empty Table Line" )
ASSERT( nColCount == rSave.mnRowSpans.size(), "Wrong row span store" )
if( nColCount == rSave.mnRowSpans.size() )
{
- for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
+ for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCurrCol];
ASSERT( pBox, "Missing Table Box" );
@@ -2078,7 +2078,7 @@ void SwTable::RestoreRowSpan( const SwSaveRowSpan& rSave )
ASSERT( rSave.mnRowSpans[ nCurrCol ] < 0, "Pardon me?!" )
pBox->setRowSpan( -nRowSp );
- USHORT nLine = rSave.mnSplitLine;
+ sal_uInt16 nLine = rSave.mnSplitLine;
if( nLine )
{
long nLeftBorder = lcl_Box2LeftBorder( *pBox );
@@ -2107,7 +2107,7 @@ void SwTable::RestoreRowSpan( const SwSaveRowSpan& rSave )
}
}
-SwSaveRowSpan* SwTable::CleanUpTopRowSpan( USHORT nSplitLine )
+SwSaveRowSpan* SwTable::CleanUpTopRowSpan( sal_uInt16 nSplitLine )
{
SwSaveRowSpan* pRet = 0;
if( !IsNewModel() )
@@ -2121,15 +2121,15 @@ SwSaveRowSpan* SwTable::CleanUpTopRowSpan( USHORT nSplitLine )
return pRet;
}
-void SwTable::CleanUpBottomRowSpan( USHORT nDelLines )
+void SwTable::CleanUpBottomRowSpan( sal_uInt16 nDelLines )
{
if( !IsNewModel() )
return;
- USHORT nLastLine = GetTabLines().Count()-1;
+ sal_uInt16 nLastLine = GetTabLines().Count()-1;
SwTableLine* pLine = GetTabLines()[nLastLine];
- USHORT nColCount = pLine->GetTabBoxes().Count();
+ sal_uInt16 nColCount = pLine->GetTabBoxes().Count();
ASSERT( nColCount, "Empty Table Line" )
- for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
+ for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCurrCol];
ASSERT( pBox, "Missing Table Box" );
@@ -2157,19 +2157,19 @@ void SwTable::CheckConsistency() const
{
if( !IsNewModel() )
return;
- USHORT nLineCount = GetTabLines().Count();
+ sal_uInt16 nLineCount = GetTabLines().Count();
const SwTwips nTabSize = GetFrmFmt()->GetFrmSize().GetWidth();
SwTwips nLineWidth = 0;
std::list< RowSpanCheck > aRowSpanCells;
std::list< RowSpanCheck >::iterator aIter = aRowSpanCells.end();
- for( USHORT nCurrLine = 0; nCurrLine < nLineCount; ++nCurrLine )
+ for( sal_uInt16 nCurrLine = 0; nCurrLine < nLineCount; ++nCurrLine )
{
SwTwips nWidth = 0;
SwTableLine* pLine = GetTabLines()[nCurrLine];
ASSERT( pLine, "Missing Table Line" )
- USHORT nColCount = pLine->GetTabBoxes().Count();
+ sal_uInt16 nColCount = pLine->GetTabBoxes().Count();
ASSERT( nColCount, "Empty Table Line" )
- for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
+ for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCurrCol];
ASSERT( pBox, "Missing Table Box" );
@@ -2236,10 +2236,10 @@ private:
{
const SwTableBox* mpKeyBox;
const SwTableBox* mpCacheBox;
- USHORT mnSteps;
+ sal_uInt16 mnSteps;
bool mbStart;
- SwFindRowSpanCacheObj( const SwTableBox& rKeyBox, const SwTableBox& rCacheBox, USHORT nSteps, bool bStart ) :
+ SwFindRowSpanCacheObj( const SwTableBox& rKeyBox, const SwTableBox& rCacheBox, sal_uInt16 nSteps, bool bStart ) :
mpKeyBox( &rKeyBox ), mpCacheBox( &rCacheBox ), mnSteps( nSteps ), mbStart( bStart ) {}
};
@@ -2251,8 +2251,8 @@ private:
public:
static SwFindRowSpanCache& getSwFindRowSpanCache();
- const SwTableBox* FindCachedStartEndOfRowSpan( const SwTableBox& rKeyBox, USHORT nSteps, bool bStart );
- void SetCachedStartEndOfRowSpan( const SwTableBox& rKeyBox, const SwTableBox& rCacheBox, USHORT nSteps, bool bStart );
+ const SwTableBox* FindCachedStartEndOfRowSpan( const SwTableBox& rKeyBox, sal_uInt16 nSteps, bool bStart );
+ void SetCachedStartEndOfRowSpan( const SwTableBox& rKeyBox, const SwTableBox& rCacheBox, sal_uInt16 nSteps, bool bStart );
void SetUseCache( bool bNew );
};
@@ -2273,7 +2273,7 @@ void SwFindRowSpanCache::SetUseCache( bool bNew )
}
const SwTableBox* SwFindRowSpanCache::FindCachedStartEndOfRowSpan( const SwTableBox& rKeyBox,
- USHORT nSteps,
+ sal_uInt16 nSteps,
bool bStart )
{
static nCallCount = 0;
@@ -2304,7 +2304,7 @@ const int FindBoxCacheSize = 2;
void SwFindRowSpanCache::SetCachedStartEndOfRowSpan( const SwTableBox& rKeyBox,
const SwTableBox& rCacheBox,
- USHORT nSteps,
+ sal_uInt16 nSteps,
bool bStart )
{
if ( !mbUseCache ) return;