Kaydet (Commit) f8552dca authored tarafından K_Karthikeyan's avatar K_Karthikeyan Kaydeden (comit) Miklos Vajna

Optimization in for loop condition part

Change-Id: Ia9a52598e9c295fee8be040530ca232fddbd14c3
Reviewed-on: https://gerrit.libreoffice.org/1560Reviewed-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
Tested-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
üst d14f7e4e
...@@ -1028,10 +1028,11 @@ void TableModel::optimize() ...@@ -1028,10 +1028,11 @@ void TableModel::optimize()
if( !maRows.empty() && !maColumns.empty() ) if( !maRows.empty() && !maColumns.empty() )
{ {
sal_Int32 nCol = getColumnCountImpl() - 1; sal_Int32 nCol = getColumnCountImpl() - 1;
sal_Int32 nRows = getRowCountImpl();
while( nCol > 0 ) while( nCol > 0 )
{ {
bool bEmpty = true; bool bEmpty = true;
for( sal_Int32 nRow = 0; (nRow < getRowCountImpl()) && bEmpty; nRow++ ) for( sal_Int32 nRow = 0; (nRow < nRows) && bEmpty; nRow++ )
{ {
Reference< XMergeableCell > xCell( getCellByPosition( nCol, nRow ), UNO_QUERY ); Reference< XMergeableCell > xCell( getCellByPosition( nCol, nRow ), UNO_QUERY );
if( xCell.is() && !xCell->isMerged() ) if( xCell.is() && !xCell->isMerged() )
...@@ -1065,10 +1066,11 @@ void TableModel::optimize() ...@@ -1065,10 +1066,11 @@ void TableModel::optimize()
} }
sal_Int32 nRow = getRowCountImpl() - 1; sal_Int32 nRow = getRowCountImpl() - 1;
sal_Int32 nCols = getColumnCountImpl();
while( nRow > 0 ) while( nRow > 0 )
{ {
bool bEmpty = true; bool bEmpty = true;
for( nCol = 0; (nCol < getColumnCountImpl()) && bEmpty; nCol++ ) for( nCol = 0; (nCol < nCols) && bEmpty; nCol++ )
{ {
Reference< XMergeableCell > xCell( getCellByPosition( nCol, nRow ), UNO_QUERY ); Reference< XMergeableCell > xCell( getCellByPosition( nCol, nRow ), UNO_QUERY );
if( xCell.is() && !xCell->isMerged() ) if( xCell.is() && !xCell->isMerged() )
......
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