Kaydet (Commit) 6483ed12 authored tarafından Matteo Casalin's avatar Matteo Casalin

Avoid unneeded downcast, reduce scope, constify

Change-Id: Ic2298985c26356170d395d943c1d538a7544e4da
üst 196fcbd8
...@@ -103,20 +103,18 @@ bool SwTableRep::FillTabCols( SwTabCols& rTabCols ) const ...@@ -103,20 +103,18 @@ bool SwTableRep::FillTabCols( SwTabCols& rTabCols ) const
break; break;
} }
sal_uInt16 i;
SwTwips nPos = 0; SwTwips nPos = 0;
SwTwips nLeft = GetLeftSpace(); const SwTwips nLeft = GetLeftSpace();
rTabCols.SetLeft(nLeft); rTabCols.SetLeft(nLeft);
if(bSingleLine) if(bSingleLine)
{ {
// The invisible separators are taken from the old TabCols, // The invisible separators are taken from the old TabCols,
// the visible coming from pTColumns. // the visible coming from pTColumns.
boost::scoped_array<TColumn> pOldTColumns(new TColumn[nAllCols + 1]); boost::scoped_array<TColumn> pOldTColumns(new TColumn[nAllCols + 1]);
SwTwips nStart = 0, SwTwips nStart = 0;
nEnd; for ( sal_uInt16 i = 0; i < nAllCols - 1; ++i )
for(i = 0; i < nAllCols - 1; i++)
{ {
nEnd = rTabCols[i] - rTabCols.GetLeft(); const SwTwips nEnd = rTabCols[i] - rTabCols.GetLeft();
pOldTColumns[i].nWidth = nEnd - nStart; pOldTColumns[i].nWidth = nEnd - nStart;
pOldTColumns[i].bVisible = !rTabCols.IsHidden(i); pOldTColumns[i].bVisible = !rTabCols.IsHidden(i);
nStart = nEnd; nStart = nEnd;
...@@ -130,9 +128,8 @@ bool SwTableRep::FillTabCols( SwTabCols& rTabCols ) const ...@@ -130,9 +128,8 @@ bool SwTableRep::FillTabCols( SwTabCols& rTabCols ) const
SwTwips nNew = 0; SwTwips nNew = 0;
bool bOld = false; bool bOld = false;
bool bFirst = true; bool bFirst = true;
i = 0;
while ( i < nAllCols -1 ) for ( sal_uInt16 i = 0; i < nAllCols - 1; ++i )
{ {
while((bFirst || bOld ) && nOldPos < nAllCols ) while((bFirst || bOld ) && nOldPos < nAllCols )
{ {
...@@ -151,16 +148,15 @@ bool SwTableRep::FillTabCols( SwTabCols& rTabCols ) const ...@@ -151,16 +148,15 @@ bool SwTableRep::FillTabCols( SwTabCols& rTabCols ) const
bFirst = false; bFirst = false;
// They have to be inserted sorted. // They have to be inserted sorted.
bOld = nOld < nNew; bOld = nOld < nNew;
nPos = sal_uInt16(bOld ? nOld : nNew); nPos = bOld ? nOld : nNew;
rTabCols[i] = nPos + nLeft; rTabCols[i] = nPos + nLeft;
rTabCols.SetHidden( i, bOld ); rTabCols.SetHidden( i, bOld );
i++;
} }
rTabCols.SetRight(nLeft + nTblWidth); rTabCols.SetRight(nLeft + nTblWidth);
} }
else else
{ {
for ( i = 0; i < nAllCols - 1; ++i ) for ( sal_uInt16 i = 0; i < nAllCols - 1; ++i )
{ {
nPos += pTColumns[i].nWidth; nPos += pTColumns[i].nWidth;
rTabCols[i] = nPos + rTabCols.GetLeft(); rTabCols[i] = nPos + rTabCols.GetLeft();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment