[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kspread
From: David Faure <faure () kde ! org>
Date: 2003-01-27 13:20:40
[Download RAW message or body]
CVS commit by faure:
Fix for find previous (yeah now it works)
M +21 -5 kspread_view.cc 1.634
--- koffice/kspread/kspread_view.cc #1.633:1.634
@@ -3421,5 +3421,6 @@ void KSpreadView::initFindReplace()
m_findPos = QPoint( colStart, rowStart );
m_findEnd = QPoint( colEnd, rowEnd );
- kdDebug() << k_funcinfo << m_findPos << " to " << m_findEnd << endl;
+ //kdDebug() << k_funcinfo << m_findPos << " to " << m_findEnd << endl;
+ //kdDebug() << k_funcinfo << "leftcol=" << m_findLeftColumn << " rightcol=" << \
m_findRightColumn << endl; }
@@ -3440,4 +3441,5 @@ void KSpreadView::findNext()
findObj->setData( cell->text() );
m_findPos = QPoint( cell->column(), cell->row() );
+ //kdDebug() << "setData(cell " << m_findPos << ")" << endl;
}
@@ -3485,9 +3487,11 @@ KSpreadCell* KSpreadView::findNextCell()
bool forw = ! ( m_findOptions & KFindDialog::FindBackwards );
int col = m_findPos.x();
+ int row = m_findPos.y();
+ int maxRow = sheet->maxRow();
+ //kdDebug() << "findNextCell starting at " << col << "," << row << " forw=" << \
forw << endl;
- // TODO: check those tests. < or <= ?
- for (int row = m_findPos.y() ; !cell && (forw ? row < m_findEnd.y() : row > \
m_findEnd.y()) ; forw ? ++row : --row ) + while ( !cell && row != m_findEnd.y() && \
(forw ? row < maxRow : row >= 0) ) {
- while ( !cell && (forw ? col < m_findEnd.x() : col > m_findEnd.x()) )
+ while ( !cell && (forw ? col <= m_findRightColumn : col >= m_findLeftColumn) \
) {
cell = sheet->cellAt( col, row );
@@ -3497,9 +3501,20 @@ KSpreadCell* KSpreadView::findNextCell()
else --col;
}
- col = forw ? m_findLeftColumn : m_findRightColumn;
+ if ( cell )
+ break;
+ // Prepare looking in the next row
+ if ( forw ) {
+ col = m_findLeftColumn;
+ ++row;
+ } else {
+ col = m_findRightColumn;
+ --row;
+ }
+ //kdDebug() << "next row: " << col << "," << row << endl;
}
// if ( !cell )
// No more next cell - TODO go to next sheet (if not looking in a selection)
// (and make m_findEnd (max,max) in that case...)
+ //kdDebug() << k_funcinfo << " returning " << cell << endl;
return cell;
}
@@ -3512,4 +3527,5 @@ void KSpreadView::findPrevious()
return;
}
+ //kdDebug() << "findPrevious" << endl;
int opt = m_findOptions;
bool forw = ! ( opt & KFindDialog::FindBackwards );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic