Kaydet (Commit) 029b2d51 authored tarafından Matteo Casalin's avatar Matteo Casalin

Use more proper integer types and range-based for loops

Change-Id: I48555d58af6c2cc814f9ac1cc39e221b31cce2f2
üst afe66e34
...@@ -603,10 +603,10 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss ) ...@@ -603,10 +603,10 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss )
// Calculate width. // Calculate width.
sal_uInt8 nPrcWidth = bPrcWidth ? (sal_uInt8)nWidth : 0; sal_uInt8 nPrcWidth = bPrcWidth ? (sal_uInt8)nWidth : 0;
sal_uInt16 nTwipWidth = 0; SwTwips nTwipWidth = 0;
if( !bPrcWidth && nWidth && Application::GetDefaultDevice() ) if( !bPrcWidth && nWidth && Application::GetDefaultDevice() )
{ {
nTwipWidth = (sal_uInt16)Application::GetDefaultDevice() nTwipWidth = Application::GetDefaultDevice()
->PixelToLogic( Size(nWidth, 0), ->PixelToLogic( Size(nWidth, 0),
MapMode(MAP_TWIP) ).Width(); MapMode(MAP_TWIP) ).Width();
} }
......
...@@ -151,9 +151,9 @@ bool SwHTMLWrtTable::HasTabBackground( const SwTableBox& rBox, ...@@ -151,9 +151,9 @@ bool SwHTMLWrtTable::HasTabBackground( const SwTableBox& rBox,
else else
{ {
const SwTableLines& rLines = rBox.GetTabLines(); const SwTableLines& rLines = rBox.GetTabLines();
sal_uInt16 nCount = rLines.size(); const SwTableLines::size_type nCount = rLines.size();
bool bLeftRight = bLeft || bRight; bool bLeftRight = bLeft || bRight;
for( sal_uInt16 i=0; !bRet && i<nCount; i++ ) for( SwTableLines::size_type i=0; !bRet && i<nCount; ++i )
{ {
bool bT = bTop && 0 == i; bool bT = bTop && 0 == i;
bool bB = bBottom && nCount-1 == i; bool bB = bBottom && nCount-1 == i;
...@@ -180,9 +180,9 @@ bool SwHTMLWrtTable::HasTabBackground( const SwTableLine& rLine, ...@@ -180,9 +180,9 @@ bool SwHTMLWrtTable::HasTabBackground( const SwTableLine& rLine,
if( !bRet ) if( !bRet )
{ {
const SwTableBoxes& rBoxes = rLine.GetTabBoxes(); const SwTableBoxes& rBoxes = rLine.GetTabBoxes();
sal_uInt16 nCount = rBoxes.size(); const SwTableBoxes::size_type nCount = rBoxes.size();
bool bTopBottom = bTop || bBottom; bool bTopBottom = bTop || bBottom;
for( sal_uInt16 i=0; !bRet && i<nCount; i++ ) for( SwTableBoxes::size_type i=0; !bRet && i<nCount; ++i )
{ {
bool bL = bLeft && 0 == i; bool bL = bLeft && 0 == i;
bool bR = bRight && nCount-1 == i; bool bR = bRight && nCount-1 == i;
...@@ -325,7 +325,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, ...@@ -325,7 +325,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt,
} }
long nWidth = 0; long nWidth = 0;
sal_uInt32 nPrcWidth = USHRT_MAX; sal_uInt32 nPrcWidth = SAL_MAX_UINT32;
if( bOutWidth ) if( bOutWidth )
{ {
if( bLayoutExport ) if( bLayoutExport )
...@@ -344,7 +344,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, ...@@ -344,7 +344,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt,
else else
{ {
if( HasRelWidths() ) if( HasRelWidths() )
nPrcWidth = (sal_uInt16)GetPrcWidth(nCol,nColSpan); nPrcWidth = GetPrcWidth(nCol, nColSpan);
else else
nWidth = GetAbsWidth( nCol, nColSpan ); nWidth = GetAbsWidth( nCol, nColSpan );
} }
...@@ -372,7 +372,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, ...@@ -372,7 +372,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt,
{ {
sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width). sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width).
append("=\""); append("=\"");
if( nPrcWidth != USHRT_MAX ) if( nPrcWidth != SAL_MAX_UINT32 )
{ {
sOut.append(static_cast<sal_Int32>(nPrcWidth)).append('%'); sOut.append(static_cast<sal_Int32>(nPrcWidth)).append('%');
} }
...@@ -513,7 +513,7 @@ void SwHTMLWrtTable::OutTableCells( SwHTMLWriter& rWrt, ...@@ -513,7 +513,7 @@ void SwHTMLWrtTable::OutTableCells( SwHTMLWriter& rWrt,
sal_Int16 eRowVertOri = text::VertOrientation::NONE; sal_Int16 eRowVertOri = text::VertOrientation::NONE;
if( rCells.size() > 1 ) if( rCells.size() > 1 )
{ {
for( sal_uInt16 nCell = 0; nCell<rCells.size(); nCell++ ) for( SwWriteTableCells::size_type nCell = 0; nCell<rCells.size(); ++nCell )
{ {
sal_Int16 eCellVertOri = rCells[nCell].GetVertOri(); sal_Int16 eCellVertOri = rCells[nCell].GetVertOri();
if( 0==nCell ) if( 0==nCell )
...@@ -553,8 +553,8 @@ void SwHTMLWrtTable::OutTableCells( SwHTMLWriter& rWrt, ...@@ -553,8 +553,8 @@ void SwHTMLWrtTable::OutTableCells( SwHTMLWriter& rWrt,
rWrt.IncIndentLevel(); // Inhalt von <TR>...</TR> einruecken rWrt.IncIndentLevel(); // Inhalt von <TR>...</TR> einruecken
for( sal_uInt16 nCell = 0; nCell<rCells.size(); nCell++ ) for( const auto &rCell : rCells )
OutTableCell( rWrt, &rCells[nCell], text::VertOrientation::NONE==eRowVertOri ); OutTableCell( rWrt, &rCell, text::VertOrientation::NONE==eRowVertOri );
rWrt.DecIndentLevel(); // Inhalt von <TR>...</TR> einruecken rWrt.DecIndentLevel(); // Inhalt von <TR>...</TR> einruecken
...@@ -567,8 +567,6 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, ...@@ -567,8 +567,6 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign,
const OUString *pCaption, bool bTopCaption, const OUString *pCaption, bool bTopCaption,
sal_uInt16 nHSpace, sal_uInt16 nVSpace ) const sal_uInt16 nHSpace, sal_uInt16 nVSpace ) const
{ {
sal_uInt16 nRow;
// Wert fuer FRAME bestimmen // Wert fuer FRAME bestimmen
sal_uInt16 nFrameMask = 15; sal_uInt16 nFrameMask = 15;
if( !(aRows.front())->bTopBorder ) if( !(aRows.front())->bTopBorder )
...@@ -584,7 +582,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, ...@@ -584,7 +582,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign,
bool bRowsHaveBorder = false; bool bRowsHaveBorder = false;
bool bRowsHaveBorderOnly = true; bool bRowsHaveBorderOnly = true;
SwWriteTableRow *pRow = aRows[0]; SwWriteTableRow *pRow = aRows[0];
for( nRow=1; nRow < aRows.size(); nRow++ ) for( SwWriteTableRows::size_type nRow=1; nRow < aRows.size(); ++nRow )
{ {
SwWriteTableRow *pNextRow = aRows[nRow]; SwWriteTableRow *pNextRow = aRows[nRow];
bool bBorder = ( pRow->bBottomBorder || pNextRow->bTopBorder ); bool bBorder = ( pRow->bBottomBorder || pNextRow->bTopBorder );
...@@ -607,8 +605,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, ...@@ -607,8 +605,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign,
bool bColsHaveBorder = false; bool bColsHaveBorder = false;
bool bColsHaveBorderOnly = true; bool bColsHaveBorderOnly = true;
SwWriteTableCol *pCol = aCols[0]; SwWriteTableCol *pCol = aCols[0];
sal_uInt16 nCol; for( SwWriteTableCols::size_type nCol=1; nCol<aCols.size(); ++nCol )
for( nCol=1; nCol<aCols.size(); nCol++ )
{ {
SwWriteTableCol *pNextCol = aCols[nCol]; SwWriteTableCol *pNextCol = aCols[nCol];
bool bBorder = ( pCol->bRightBorder || pNextCol->bLeftBorder ); bool bBorder = ( pCol->bRightBorder || pNextCol->bLeftBorder );
...@@ -627,7 +624,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, ...@@ -627,7 +624,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign,
OStringBuffer sOut; OStringBuffer sOut;
sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_table); sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_table);
sal_uInt16 nOldDirection = rWrt.nDirection; const sal_uInt16 nOldDirection = rWrt.nDirection;
if( pFrameFormat ) if( pFrameFormat )
rWrt.nDirection = rWrt.GetHTMLDirection( pFrameFormat->GetAttrSet() ); rWrt.nDirection = rWrt.GetHTMLDirection( pFrameFormat->GetAttrSet() );
if( rWrt.bOutFlyFrame || nOldDirection != rWrt.nDirection ) if( rWrt.bOutFlyFrame || nOldDirection != rWrt.nDirection )
...@@ -737,7 +734,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, ...@@ -737,7 +734,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign,
HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_caption, false ); HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_caption, false );
} }
sal_uInt16 nCols = aCols.size(); const SwWriteTableCols::size_type nCols = aCols.size();
// <COLGRP>/<COL> ausgeben: Bei Export ueber Layout nur wenn beim // <COLGRP>/<COL> ausgeben: Bei Export ueber Layout nur wenn beim
// Import welche da waren, sonst immer. // Import welche da waren, sonst immer.
...@@ -752,7 +749,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, ...@@ -752,7 +749,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign,
rWrt.IncIndentLevel(); // Inhalt von <COLGRP> einruecken rWrt.IncIndentLevel(); // Inhalt von <COLGRP> einruecken
} }
for( nCol=0; nCol<nCols; nCol++ ) for( SwWriteTableCols::size_type nCol=0; nCol<nCols; ++nCol )
{ {
rWrt.OutNewLine(); // <COL> in neue Zeile rWrt.OutNewLine(); // <COL> in neue Zeile
...@@ -830,7 +827,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, ...@@ -830,7 +827,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign,
rWrt.IncIndentLevel(); // Inhalt von <THEAD>/<TDATA> einr. rWrt.IncIndentLevel(); // Inhalt von <THEAD>/<TDATA> einr.
} }
for( nRow = 0; nRow < aRows.size(); nRow++ ) for( SwWriteTableRows::size_type nRow = 0; nRow < aRows.size(); ++nRow )
{ {
const SwWriteTableRow *pRow2 = aRows[nRow]; const SwWriteTableRow *pRow2 = aRows[nRow];
...@@ -838,8 +835,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, ...@@ -838,8 +835,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign,
if( !nCellSpacing && nRow < aRows.size()-1 && pRow2->bBottomBorder && if( !nCellSpacing && nRow < aRows.size()-1 && pRow2->bBottomBorder &&
pRow2->nBottomBorder > DEF_LINE_WIDTH_1 ) pRow2->nBottomBorder > DEF_LINE_WIDTH_1 )
{ {
sal_uInt16 nCnt = (pRow2->nBottomBorder / DEF_LINE_WIDTH_1) - 1; for( auto nCnt = (pRow2->nBottomBorder / DEF_LINE_WIDTH_1) - 1; nCnt; --nCnt )
for( ; nCnt; nCnt-- )
{ {
rWrt.OutNewLine(); rWrt.OutNewLine();
HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_tablerow, HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_tablerow,
......
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