diff options
author | K_Karthikeyan <karthikeyan@kacst.edu.sa> | 2013-01-07 13:50:23 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-01-08 09:25:02 +0000 |
commit | f8552dca6b0142ce58bc2bdc25cfb170aa29506a (patch) | |
tree | a3ad008e98fb876fce4f47aab04a8ad3a4a535d8 | |
parent | fdo#40465 fix to maintain correct focus whilst zooming (diff) | |
download | core-f8552dca6b0142ce58bc2bdc25cfb170aa29506a.tar.gz core-f8552dca6b0142ce58bc2bdc25cfb170aa29506a.zip |
Optimization in for loop condition part
Change-Id: Ia9a52598e9c295fee8be040530ca232fddbd14c3
Reviewed-on: https://gerrit.libreoffice.org/1560
Reviewed-by: Miklos Vajna <vmiklos@suse.cz>
Tested-by: Miklos Vajna <vmiklos@suse.cz>
-rw-r--r-- | svx/source/table/tablemodel.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx index 59358e3429d5..65c8279d545f 100644 --- a/svx/source/table/tablemodel.cxx +++ b/svx/source/table/tablemodel.cxx @@ -1028,10 +1028,11 @@ void TableModel::optimize() if( !maRows.empty() && !maColumns.empty() ) { sal_Int32 nCol = getColumnCountImpl() - 1; + sal_Int32 nRows = getRowCountImpl(); while( nCol > 0 ) { 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 ); if( xCell.is() && !xCell->isMerged() ) @@ -1065,10 +1066,11 @@ void TableModel::optimize() } sal_Int32 nRow = getRowCountImpl() - 1; + sal_Int32 nCols = getColumnCountImpl(); while( nRow > 0 ) { 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 ); if( xCell.is() && !xCell->isMerged() ) |