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.cxx362
1 files changed, 184 insertions, 178 deletions
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index b13c4a2bbf84..26ca86474869 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -33,13 +33,14 @@
#include <tblsel.hxx>
#include <tblrwcl.hxx>
#include <node.hxx>
-#include <undobj.hxx>
+#include <UndoTable.hxx>
#include <pam.hxx>
#include <frmfmt.hxx>
#include <frmatr.hxx>
#include <cellfrm.hxx>
#include <fmtfsize.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <vector>
#include <set>
#include <list>
@@ -88,18 +89,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
@@ -125,7 +126,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 )
@@ -136,7 +137,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];
OSL_ENSURE( pBox, "Missing table box" );
@@ -169,8 +170,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];
OSL_ENSURE( pBox, "Missing table box" );
@@ -203,8 +204,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];
OSL_ENSURE( pBox, "Missing table box" );
@@ -249,7 +250,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;
@@ -267,8 +268,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;
@@ -330,16 +331,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];
OSL_ENSURE( 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];
OSL_ENSURE( pBox, "Missing table box" );
@@ -369,12 +370,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];
OSL_ENSURE( pLine, "Missing table line" );
@@ -382,8 +383,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];
OSL_ENSURE( pBox, "Missing table box" );
@@ -445,9 +446,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;
}
@@ -482,9 +483,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
@@ -494,7 +495,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 =
@@ -532,7 +533,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
nRightSpanCnt = nOutSpan;
}
}
- nCheck += (USHORT)nOutSpan - 1;
+ nCheck += (sal_uInt16)nOutSpan - 1;
if( nCheck > nCheckBottom )
nCheckBottom = nCheck;
}
@@ -607,19 +608,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 );
OSL_ENSURE( nCurrLine != USHRT_MAX, "Time to say Good-Bye.." );
if( rInsPos[ nCurrLine ] == USHRT_MAX )
{
@@ -653,18 +654,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
@@ -679,12 +680,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) );
}
@@ -694,13 +695,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];
OSL_ENSURE( nInsPos != USHRT_MAX, "Didn't found insert position" );
SwTableBox* pBox = pLine->GetTabBoxes()[ nInsPos ];
if( bBehind )
@@ -717,10 +718,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;
@@ -745,7 +746,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 )
@@ -775,14 +776,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();
OSL_ENSURE( nNewWidth > 0, "Very small" );
}
#endif
CHECK_TABLE( *this )
- return TRUE;
+ return sal_True;
}
/** SwTable::PrepareMerge(..) some preparation for the coming Merge(..)
@@ -842,7 +843,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
@@ -850,13 +851,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 );
@@ -889,14 +890,19 @@ 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 );
+ bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo();
if( pUndo )
- pDoc->DoUndo( FALSE );
+ {
+ pDoc->GetIDocumentUndoRedo().DoUndo(false);
+ }
pDoc->AppendTxtNode( *aPam.GetPoint() );
if( pUndo )
- pDoc->DoUndo( TRUE );
+ {
+ pDoc->GetIDocumentUndoRedo().DoUndo(bUndo);
+ }
SwNodeRange aRg( aSttNdIdx, aPam.GetPoint()->nNode );
if( pUndo )
pUndo->MoveBoxCntnt( pDoc, aRg, rInsPosNd );
@@ -924,11 +930,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 )
@@ -974,15 +980,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];
OSL_ENSURE( 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 &&
@@ -994,7 +1000,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 );
@@ -1007,7 +1013,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;
@@ -1015,7 +1021,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;
@@ -1034,7 +1040,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 )
@@ -1043,9 +1049,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;
@@ -1069,9 +1075,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] );
@@ -1084,22 +1090,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();
@@ -1107,8 +1113,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 )
@@ -1120,12 +1126,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 )
@@ -1139,8 +1145,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] );
}
@@ -1149,7 +1155,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 )
OSL_ENSURE( nCnt && nRowIdx < GetTabLines().Count(), "Wrong call of InsertSpannedRow" );
@@ -1166,12 +1172,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 )
@@ -1183,7 +1189,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;
/******************************************************************************
@@ -1200,24 +1206,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 );
OSL_ENSURE( 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 );
}
}
@@ -1225,7 +1231,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:
@@ -1294,22 +1300,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 );
OSL_ENSURE( 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 )
{
@@ -1327,7 +1333,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 );
@@ -1340,7 +1346,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 );
@@ -1355,16 +1361,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 )
@@ -1376,7 +1382,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;
}
@@ -1393,8 +1399,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;
@@ -1405,7 +1411,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;
@@ -1442,7 +1448,7 @@ BOOL SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt,
else
{
aFndBox.DelFrms( *this );
- bSameHeight = FALSE;
+ bSameHeight = sal_False;
}
if( !bSameHeight )
{
@@ -1456,15 +1462,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 )
{
OSL_ENSURE( 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 );
@@ -1472,21 +1478,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 );
@@ -1498,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 )
@@ -1545,7 +1551,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();
@@ -1553,7 +1559,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);
OSL_ENSURE( nLinePos < USHRT_MAX, "Box/table mismatch" );
if( nRowSpan > 1 )
{
@@ -1605,8 +1611,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];
OSL_ENSURE( pBox, "Missing table box" );
@@ -1625,7 +1631,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() )
{
@@ -1668,13 +1674,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
@@ -1683,12 +1689,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];
OSL_ENSURE( 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];
OSL_ENSURE( pBox, "Missing table box" );
@@ -1728,12 +1734,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];
OSL_ENSURE( 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];
OSL_ENSURE( pBox, "Missing table box" );
@@ -1772,7 +1778,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 );
}
@@ -1780,13 +1786,13 @@ 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 );
}
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 );
}
@@ -1804,15 +1810,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];
OSL_ENSURE( 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];
OSL_ENSURE( pBox, "Missing table box" );
@@ -1825,13 +1831,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];
@@ -1854,14 +1860,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];
@@ -1899,7 +1905,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();
@@ -1919,7 +1925,7 @@ void SwTable::ExpandSelection( SwSelBoxes& rBoxes ) const
void SwTable::CheckRowSpan( SwTableLinePtr &rpLine, bool bUp ) const
{
OSL_ENSURE( IsNewModel(), "Don't call me for old tables" );
- USHORT nLineIdx = GetTabLines().C40_GETPOS( SwTableLine, rpLine );
+ sal_uInt16 nLineIdx = GetTabLines().C40_GETPOS( SwTableLine, rpLine );
OSL_ENSURE( nLineIdx < GetTabLines().Count(), "Start line out of range" );
bool bChange = true;
if( bUp )
@@ -1928,8 +1934,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 )
@@ -1949,13 +1955,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 )
@@ -1978,14 +1984,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();
OSL_ENSURE( 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];
OSL_ENSURE( pBox, "Missing Table Box" );
@@ -2008,17 +2014,17 @@ void SwTable::RestoreRowSpan( const SwSaveRowSpan& rSave )
{
if( !IsNewModel() ) // for new model only
return;
- USHORT nLineCount = GetTabLines().Count();
+ sal_uInt16 nLineCount = GetTabLines().Count();
OSL_ENSURE( 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();
OSL_ENSURE( nColCount, "Empty Table Line" );
OSL_ENSURE( 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];
OSL_ENSURE( pBox, "Missing Table Box" );
@@ -2029,7 +2035,7 @@ void SwTable::RestoreRowSpan( const SwSaveRowSpan& rSave )
OSL_ENSURE( 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 );
@@ -2058,7 +2064,7 @@ void SwTable::RestoreRowSpan( const SwSaveRowSpan& rSave )
}
}
-SwSaveRowSpan* SwTable::CleanUpTopRowSpan( USHORT nSplitLine )
+SwSaveRowSpan* SwTable::CleanUpTopRowSpan( sal_uInt16 nSplitLine )
{
SwSaveRowSpan* pRet = 0;
if( !IsNewModel() )
@@ -2072,15 +2078,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();
OSL_ENSURE( nColCount, "Empty Table Line" );
- for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
+ for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCurrCol];
OSL_ENSURE( pBox, "Missing Table Box" );
@@ -2108,19 +2114,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];
OSL_ENSURE( pLine, "Missing Table Line" );
- USHORT nColCount = pLine->GetTabBoxes().Count();
+ sal_uInt16 nColCount = pLine->GetTabBoxes().Count();
OSL_ENSURE( nColCount, "Empty Table Line" );
- for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
+ for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCurrCol];
OSL_ENSURE( pBox, "Missing Table Box" );