예제 #1
0
void CASpreadsheetHandler::searchOtherSheets(SearchDirection direction) {
    int tempCurrentSheet = d->currentSheetNum;
    if(direction == SearchForward) {
       d->matchPerSheet = 0;
       if(d->searchSheetNumber < sheetCount()) {
           d->searchSheetNumber = currentSheetNumber();
       } else {
         return;
       }
    } else if(direction == SearchBackwards) {
       if(d->searchSheetNumber >= 0) {
          d->matchPerSheet = d->findText->matches().count() - 1;
          d->searchSheetNumber = d->currentSheetNum - 1;
       } else {
          return;
       }
    }

    Calligra::Sheets::DocBase* kspreadDoc = qobject_cast<Calligra::Sheets::DocBase*> (document());

    while((d->searchSheetNumber < sheetCount()) && (d->searchSheetNumber >= 0)) {
      d->sheet = kspreadDoc->map()->sheet(d->searchSheetNumber);
      d->sheet = kspreadDoc->map()->sheet(d->searchSheetNumber);
      setSearchString(d->searchString);
      if(d->matchFound == true) {
         gotoSheet(d->searchSheetNumber, direction);
         setSearchString(d->searchString);
         if(direction == SearchBackwards) {
            if(d->findText->matches().count() == 1) {
               d->matchPerSheet = 0;
            }
            if(d->searchSheetNumber == 0) {
               d->findText->findPrevious();
            }
         }
         break;
      }

      if(direction == SearchForward) {
         d->searchSheetNumber++;
      } else if(direction == SearchBackwards) {
         d->searchSheetNumber--;
      }
    }

    if(d->matchFound == false) {
       gotoSheet(tempCurrentSheet,direction);
       if(direction == SearchBackwards) {
          d->matchPerSheet = d->findText->matches().count();
          d->findText->findPrevious();
       } else if( direction == SearchForward) {
          d->matchPerSheet = 1;
       }
    }
}
예제 #2
0
파일: TOCEntry.cpp 프로젝트: wagenadl/eln
bool TOCEntry::contains(int pgno) const {
  return pgno >= startPage()
    && pgno < startPage() + sheetCount();
}