author | thufir <thufir> | 2002-10-08 16:43:57 (UTC) |
---|---|---|
committer | thufir <thufir> | 2002-10-08 16:43:57 (UTC) |
commit | 9475b63d025c1ca386764784b7dad460935f45b0 (patch) (side-by-side diff) | |
tree | f0b209ab08afb75e94f6d3f2b0ff4bc235774cbd /noncore/apps/opie-sheet/sheet.cpp | |
parent | 76fb8a57bf9fbae3a7073c8b0be1216f34adf99c (diff) | |
download | opie-9475b63d025c1ca386764784b7dad460935f45b0.zip opie-9475b63d025c1ca386764784b7dad460935f45b0.tar.gz opie-9475b63d025c1ca386764784b7dad460935f45b0.tar.bz2 |
fixed bug #250
Diffstat (limited to 'noncore/apps/opie-sheet/sheet.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-sheet/sheet.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/noncore/apps/opie-sheet/sheet.cpp b/noncore/apps/opie-sheet/sheet.cpp index be4046b..c2563c2 100644 --- a/noncore/apps/opie-sheet/sheet.cpp +++ b/noncore/apps/opie-sheet/sheet.cpp @@ -90,3 +90,3 @@ void Sheet::slotCellChanged(int row, int col) for (cellData=sheetData.first(); cellData; cellData=sheetData.next()) - setText(cellData->row, cellData->col, dataParser(cellData->data)); + setText(cellData->row, cellData->col, dataParser(findCellName(cellData->row, cellData->col), cellData->data)); emit sheetModified(); @@ -104,4 +104,4 @@ void Sheet::swapCells(int row1, int col1, int row2, int col2) cellData2->data=tempData; - setText(cellData1->row, cellData1->col, dataParser(cellData1->data)); - setText(cellData2->row, cellData2->col, dataParser(cellData2->data)); + setText(cellData1->row, cellData1->col, dataParser(findCellName(cellData1->row, cellData1->col), cellData1->data)); + setText(cellData2->row, cellData2->col, dataParser(findCellName(cellData2->row, cellData2->col), cellData2->data)); emit sheetModified(); @@ -168,3 +168,3 @@ double Sheet::calculateVariable(const QString &variable) int row, col; - return (findRowColumn(variable, &row, &col, TRUE) ? text(row, col).toDouble() : 0); + return (findRowColumn(variable, &row, &col, TRUE) ? dataParser(variable, text(row, col)).toDouble() : 0); } @@ -422,3 +422,3 @@ QString Sheet::dataParserHelper(const QString &data) -QString Sheet::dataParser(const QString &data) +QString Sheet::dataParser(const QString &cell, const QString &data) { @@ -427,2 +427,4 @@ QString Sheet::dataParser(const QString &data) if (strippedData.isEmpty() || strippedData[0]!='=') return data; + if (listDataParser.find(cell)!=listDataParser.end()) return "0"; + listDataParser.append(cell); strippedData=dataParserHelper(strippedData.remove(0, 1).upper().replace(QRegExp(":"), ",")); @@ -437,2 +439,3 @@ QString Sheet::dataParser(const QString &data) while (!tempParameter.isNull()); + listDataParser.remove(cell); return result.mid(1); @@ -541,5 +544,5 @@ void Sheet::viewportMouseReleaseEvent(QMouseEvent *e) if (oldSelection.topRow()==oldSelection.bottomRow() && oldSelection.leftCol()==oldSelection.rightCol()) - emit cellClicked(getHeaderString(oldSelection.leftCol()+1)+QString::number(oldSelection.topRow()+1)); + emit cellClicked(findCellName(oldSelection.topRow(), oldSelection.leftCol())); else - emit cellClicked(getHeaderString(oldSelection.leftCol()+1)+QString::number(oldSelection.topRow()+1)+','+getHeaderString(oldSelection.rightCol()+1)+QString::number(oldSelection.bottomRow()+1)); + emit cellClicked(findCellName(oldSelection.topRow(), oldSelection.leftCol())+','+findCellName(oldSelection.bottomRow(), oldSelection.rightCol())); } @@ -549,2 +552,7 @@ void Sheet::viewportMouseReleaseEvent(QMouseEvent *e) +QString Sheet::findCellName(int row, int col) +{ + return (getHeaderString(col+1)+QString::number(row+1)); +} + void Sheet::copySheetData(QList<typeCellData> *destSheetData) @@ -578,3 +586,3 @@ void Sheet::setSheetData(QList<typeCellData> *srcSheetData) sheetData.append(newCellData); - setText(newCellData->row, newCellData->col, dataParser(newCellData->data)); + setText(newCellData->row, newCellData->col, dataParser(findCellName(newCellData->row, newCellData->col), newCellData->data)); } @@ -758,3 +766,3 @@ void Sheet::editPaste(bool onlyContents) } - setText(cellData->row, cellData->col, dataParser(cellData->data)); + setText(cellData->row, cellData->col, dataParser(findCellName(cellData->row, cellData->col), cellData->data)); emit sheetModified(); @@ -781,3 +789,3 @@ void Sheet::insertRows(int no, bool allColumns) updateCell(tempCellData->row-no, tempCellData->col); - setText(tempCellData->row, tempCellData->col, dataParser(tempCellData->data)); + setText(tempCellData->row, tempCellData->col, dataParser(findCellName(tempCellData->row, tempCellData->col), tempCellData->data)); } @@ -807,3 +815,3 @@ void Sheet::insertColumns(int no, bool allRows) updateCell(tempCellData->row, tempCellData->col-no); - setText(tempCellData->row, tempCellData->col, dataParser(tempCellData->data)); + setText(tempCellData->row, tempCellData->col, dataParser(findCellName(tempCellData->row, tempCellData->col), tempCellData->data)); } @@ -834,3 +842,3 @@ void Sheet::dataFindReplace(const QString &findStr, const QString &replaceStr, b tempCellData->data=cellItem->text().replace(QRegExp(findStr, matchCase), replaceStr); - setText(tempCellData->row, tempCellData->col, dataParser(tempCellData->data)); + setText(tempCellData->row, tempCellData->col, dataParser(findCellName(tempCellData->row, tempCellData->col), tempCellData->data)); } |