summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-sheet/sheet.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-sheet/sheet.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/sheet.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/apps/opie-sheet/sheet.cpp b/noncore/apps/opie-sheet/sheet.cpp
index 1d7ec6f..2279191 100644
--- a/noncore/apps/opie-sheet/sheet.cpp
+++ b/noncore/apps/opie-sheet/sheet.cpp
@@ -98,25 +98,25 @@ void Sheet::swapCells(int row1, int col1, int row2, int col2)
if (!cellData2) cellData2=createCellData(row2, col2);
if (cellData1 && cellData2)
{
QString tempData(cellData1->data);
cellData1->data=cellData2->data;
cellData2->data=tempData;
setText(cellData1->row, cellData1->col, dataParser(cellData1->data));
setText(cellData2->row, cellData2->col, dataParser(cellData2->data));
emit sheetModified();
}
}
-QString Sheet::getParameter(const QString &parameters, int paramNo, bool giveError=FALSE, const QString funcName="")
+QString Sheet::getParameter(const QString &parameters, int paramNo, bool giveError, const QString funcName)
{
QString params(parameters);
int position;
for (int i=0; i<paramNo; ++i)
{
position=params.find(',');
if (position<0)
{
if (giveError) QMessageBox::critical(this, tr("Error"), tr("Too few arguments to function '"+funcName+'\''));
return QString();
}
params=params.mid(position+1);
@@ -136,25 +136,25 @@ bool Sheet::findRange(const QString &variable1, const QString &variable2, int *r
*row1=*row2;
*row2=row;
}
if (*col1>*col2)
{
col=*col1;
*col1=*col2;
*col2=col;
}
return TRUE;
}
-bool Sheet::findRowColumn(const QString &variable, int *row, int *col, bool giveError=FALSE)
+bool Sheet::findRowColumn(const QString &variable, int *row, int *col, bool giveError)
{
int position=variable.find(QRegExp("\\d"));
if (position<1)
{
if (giveError) QMessageBox::critical(this, tr("Error"), tr("Invalid variable: '"+variable+'\''));
return FALSE;
}
*row=variable.mid(position).toInt()-1;
*col=getHeaderColumn(variable.left(position))-1;
return TRUE;
}
@@ -443,25 +443,25 @@ void Sheet::setData(const QString &data)
slotCellChanged(currentRow(), currentColumn());
activateNextCell();
}
QString Sheet::getData()
{
typeCellData *cellData=findCellData(currentRow(), currentColumn());
if (cellData)
return cellData->data;
return "";
}
-void Sheet::lockClicks(bool lock=TRUE)
+void Sheet::lockClicks(bool lock)
{
clicksLocked=lock;
}
void Sheet::paintCell(QPainter *p, int row, int col, const QRect & cr, bool selected)
{
if (selected && row==currentRow() && col==currentColumn()) selected=FALSE;
int sheetDataCurrent=sheetData.at();
typeCellData *cellData=findCellData(row, col);
if (sheetDataCurrent>=0) sheetData.at(sheetDataCurrent);
if (!cellData) cellData=&defaultCellData;
@@ -727,72 +727,72 @@ void Sheet::editCopy()
newCellData->col-=col1;
clipboardData.append(newCellData);
}
}
}
void Sheet::editCut()
{
editCopy();
editClear();
}
-void Sheet::editPaste(bool onlyContents=FALSE)
+void Sheet::editPaste(bool onlyContents)
{
int row1=currentRow(), col1=currentColumn();
typeCellData *cellData, *tempCellData;
for (tempCellData=clipboardData.first(); tempCellData; tempCellData=clipboardData.next())
{
cellData=findCellData(tempCellData->row+row1, tempCellData->col+col1);
if (!cellData) cellData=createCellData(tempCellData->row+row1, tempCellData->col+col1);
if (cellData)
{
if (onlyContents)
cellData->data=tempCellData->data;
else
{
*cellData=*tempCellData;
cellData->row+=row1;
cellData->col+=col1;
}
setText(cellData->row, cellData->col, dataParser(cellData->data));
emit sheetModified();
}
}
}
-void Sheet::insertRows(int no=1, bool allColumns=TRUE)
+void Sheet::insertRows(int no, bool allColumns)
{
setNumRows(numRows()+no);
typeCellData *tempCellData;
int row=currentRow(), col=currentColumn();
for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next())
if (tempCellData->row>=row && (allColumns || tempCellData->col==col))
{
clearCell(tempCellData->row, tempCellData->col);
tempCellData->row+=no;
}
for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next())
if (tempCellData->row>=row && (allColumns || tempCellData->col==col))
{
updateCell(tempCellData->row-no, tempCellData->col);
setText(tempCellData->row, tempCellData->col, dataParser(tempCellData->data));
}
emit sheetModified();
}
-void Sheet::insertColumns(int no=1, bool allRows=TRUE)
+void Sheet::insertColumns(int no, bool allRows)
{
int noCols=numCols();
int newCols=noCols+no;
setNumCols(newCols);
for (int i=noCols; i<newCols; ++i)
horizontalHeader()->setLabel(i, getHeaderString(i+1), DEFAULT_COL_WIDTH);
typeCellData *tempCellData;
int col=currentColumn(), row=currentRow();
for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next())
if (tempCellData->col>=col && (allRows || tempCellData->row==row))
@@ -800,25 +800,25 @@ void Sheet::insertColumns(int no=1, bool allRows=TRUE)
clearCell(tempCellData->row, tempCellData->col);
tempCellData->col+=no;
}
for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next())
if (tempCellData->col>=col && (allRows || tempCellData->row==row))
{
updateCell(tempCellData->row, tempCellData->col-no);
setText(tempCellData->row, tempCellData->col, dataParser(tempCellData->data));
}
emit sheetModified();
}
-void Sheet::dataFindReplace(const QString &findStr, const QString &replaceStr, bool matchCase=TRUE, bool allCells=TRUE, bool entireCell=FALSE, bool replace=FALSE, bool replaceAll=FALSE)
+void Sheet::dataFindReplace(const QString &findStr, const QString &replaceStr, bool matchCase, bool allCells, bool entireCell, bool replace, bool replaceAll)
{
typeCellData *tempCellData;
int row1, col1, row2, col2;
getSelection(&row1, &col1, &row2, &col2);
bool found=FALSE;
for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next())
if (allCells || (tempCellData->row>=row1 && tempCellData->row<=row2 && tempCellData->col>=col1 && tempCellData->col<=col2))
{
QTableItem *cellItem=item(tempCellData->row, tempCellData->col);
if (cellItem && (entireCell ? (matchCase ? cellItem->text()==findStr : cellItem->text().upper()==findStr.upper()) : cellItem->text().find(findStr, 0, matchCase)>=0))
{