author | ar <ar> | 2004-06-12 09:24:00 (UTC) |
---|---|---|
committer | ar <ar> | 2004-06-12 09:24:00 (UTC) |
commit | 7a62e8e3601ee98f5f06261c361fe8132334cd56 (patch) (unidiff) | |
tree | 72e1e68878e32c70140fe1de478bced96670e348 /noncore/apps/opie-sheet/mainwindow.cpp | |
parent | 3fbf3cb264200c5ac11dbef43a51f3ab2a969587 (diff) | |
download | opie-7a62e8e3601ee98f5f06261c361fe8132334cd56.zip opie-7a62e8e3601ee98f5f06261c361fe8132334cd56.tar.gz opie-7a62e8e3601ee98f5f06261c361fe8132334cd56.tar.bz2 |
- rename sheet-qt -> opie-sheet
- format source code for a better readability
Diffstat (limited to 'noncore/apps/opie-sheet/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-sheet/mainwindow.cpp | 1467 |
1 files changed, 744 insertions, 723 deletions
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp index 061748e..bb85a24 100644 --- a/noncore/apps/opie-sheet/mainwindow.cpp +++ b/noncore/apps/opie-sheet/mainwindow.cpp | |||
@@ -1,9 +1,28 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | * * | 2 | =. This file is part of the Opie Project |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org> |
4 | * it under the terms of the GNU General Public License as published by * | 4 | .>+-= |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | _;:, .> :=|. This program is free software; you can |
6 | * (at your option) any later version. * | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | * * | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | ***************************************************************************/ | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This program is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
9 | 28 | ||
@@ -16,2 +35,3 @@ | |||
16 | 35 | ||
36 | /* OPIE */ | ||
17 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
@@ -19,2 +39,3 @@ | |||
19 | 39 | ||
40 | /* QT */ | ||
20 | #include <qmessagebox.h> | 41 | #include <qmessagebox.h> |
@@ -22,2 +43,3 @@ | |||
22 | 43 | ||
44 | /* STD */ | ||
23 | #include "cellformat.h" | 45 | #include "cellformat.h" |
@@ -33,32 +55,31 @@ | |||
33 | MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl) | 55 | MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl) |
34 | :QMainWindow(parent, n, fl) | 56 | :QMainWindow(parent, n, fl) |
35 | { | 57 | { |
36 | // initialize variables | 58 | // initialize variables |
37 | documentModified=FALSE; | 59 | documentModified=FALSE; |
38 | |||
39 | // construct objects | ||
40 | currentDoc=0; | ||
41 | fileSelector=new FileSelector("application/sheet-qt", this, QString::null); | ||
42 | ExcelSelector=new FileSelector("application/excel",this,QString::null,FALSE); | ||
43 | connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); | ||
44 | connect(fileSelector, SIGNAL(newSelected(const DocLnk&)), this, SLOT(selectorFileNew(const DocLnk&))); | ||
45 | connect(fileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(selectorFileOpen(const DocLnk&))); | ||
46 | connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk&)),this,SLOT(slotImportExcel(const DocLnk&))); | ||
47 | connect(ExcelSelector,SIGNAL(closeMe()), this, SLOT(ExcelSelectorHide())); | ||
48 | |||
49 | |||
50 | listSheets.setAutoDelete(TRUE); | ||
51 | |||
52 | initActions(); | ||
53 | initMenu(); | ||
54 | initEditToolbar(); | ||
55 | initFunctionsToolbar(); | ||
56 | initStandardToolbar(); | ||
57 | initSheet(); | ||
58 | |||
59 | // set window title | ||
60 | setCaption(tr("Opie Sheet")); | ||
61 | 60 | ||
62 | // create sheets | 61 | // construct objects |
63 | selectorFileNew(DocLnk()); | 62 | currentDoc=0; |
63 | fileSelector=new FileSelector("application/opie-sheet", this, QString::null); | ||
64 | ExcelSelector=new FileSelector("application/excel",this,QString::null,FALSE); | ||
65 | connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); | ||
66 | connect(fileSelector, SIGNAL(newSelected(const DocLnk&)), this, SLOT(selectorFileNew(const DocLnk&))); | ||
67 | connect(fileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(selectorFileOpen(const DocLnk&))); | ||
68 | connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk&)),this,SLOT(slotImportExcel(const DocLnk&))); | ||
69 | connect(ExcelSelector,SIGNAL(closeMe()), this, SLOT(ExcelSelectorHide())); | ||
70 | |||
71 | listSheets.setAutoDelete(TRUE); | ||
72 | |||
73 | initActions(); | ||
74 | initMenu(); | ||
75 | initEditToolbar(); | ||
76 | initFunctionsToolbar(); | ||
77 | initStandardToolbar(); | ||
78 | initSheet(); | ||
79 | |||
80 | // set window title | ||
81 | setCaption(tr("Opie Sheet")); | ||
82 | |||
83 | // create sheets | ||
84 | selectorFileNew(DocLnk()); | ||
64 | } | 85 | } |
@@ -67,3 +88,3 @@ MainWindow::~MainWindow() | |||
67 | { | 88 | { |
68 | if (currentDoc) delete currentDoc; | 89 | if (currentDoc) delete currentDoc; |
69 | } | 90 | } |
@@ -72,29 +93,29 @@ void MainWindow::documentSave(DocLnk *lnkDoc) | |||
72 | { | 93 | { |
73 | FileManager fm; | 94 | FileManager fm; |
74 | QByteArray streamBuffer; | 95 | QByteArray streamBuffer; |
75 | QDataStream stream(streamBuffer, IO_WriteOnly); | 96 | QDataStream stream(streamBuffer, IO_WriteOnly); |
76 | 97 | ||
77 | typeSheet *currentSheet=findSheet(sheet->getName()); | 98 | typeSheet *currentSheet=findSheet(sheet->getName()); |
78 | if (!currentSheet) | 99 | if (!currentSheet) |
79 | { | 100 | { |
80 | QMessageBox::critical(this, tr("Error"), tr("Inconsistency error!")); | 101 | QMessageBox::critical(this, tr("Error"), tr("Inconsistency error!")); |
81 | return; | 102 | return; |
82 | } | 103 | } |
83 | sheet->copySheetData(¤tSheet->data); | 104 | sheet->copySheetData(¤tSheet->data); |
84 | stream.writeRawBytes("SQT100", 6); | 105 | stream.writeRawBytes("SQT100", 6); |
85 | stream << (Q_UINT32)listSheets.count(); | 106 | stream << (Q_UINT32)listSheets.count(); |
86 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) | 107 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) |
87 | { | 108 | { |
88 | stream << tempSheet->name << (Q_UINT32)tempSheet->data.count(); | 109 | stream << tempSheet->name << (Q_UINT32)tempSheet->data.count(); |
89 | for (typeCellData *tempCell=tempSheet->data.first(); tempCell; tempCell=tempSheet->data.next()) | 110 | for (typeCellData *tempCell=tempSheet->data.first(); tempCell; tempCell=tempSheet->data.next()) |
90 | stream << (Q_UINT32)tempCell->col << (Q_UINT32)tempCell->row << tempCell->borders.right << tempCell->borders.bottom << tempCell->background << (Q_UINT32)tempCell->alignment << tempCell->fontColor << tempCell->font << tempCell->data; | 111 | stream << (Q_UINT32)tempCell->col << (Q_UINT32)tempCell->row << tempCell->borders.right << tempCell->borders.bottom << tempCell->background << (Q_UINT32)tempCell->alignment << tempCell->fontColor << tempCell->font << tempCell->data; |
91 | } | 112 | } |
92 | 113 | ||
93 | lnkDoc->setType("application/sheet-qt"); | 114 | lnkDoc->setType("application/opie-sheet"); |
94 | if (!fm.saveFile(*lnkDoc, streamBuffer)) | 115 | if (!fm.saveFile(*lnkDoc, streamBuffer)) |
95 | { | 116 | { |
96 | QMessageBox::critical(this, tr("Error"), tr("File cannot be saved!")); | 117 | QMessageBox::critical(this, tr("Error"), tr("File cannot be saved!")); |
97 | return; | 118 | return; |
98 | } | 119 | } |
99 | documentModified=FALSE; | 120 | documentModified=FALSE; |
100 | } | 121 | } |
@@ -103,53 +124,53 @@ void MainWindow::documentOpen(const DocLnk &lnkDoc) | |||
103 | { | 124 | { |
104 | FileManager fm; | 125 | FileManager fm; |
105 | QByteArray streamBuffer; | 126 | QByteArray streamBuffer; |
106 | if (!lnkDoc.isValid() || !fm.loadFile(lnkDoc, streamBuffer)) | 127 | if (!lnkDoc.isValid() || !fm.loadFile(lnkDoc, streamBuffer)) |
107 | { | 128 | { |
108 | QMessageBox::critical(this, tr("Error"), tr("File cannot be opened!")); | 129 | QMessageBox::critical(this, tr("Error"), tr("File cannot be opened!")); |
109 | documentModified=FALSE; | 130 | documentModified=FALSE; |
110 | selectorFileNew(DocLnk()); | 131 | selectorFileNew(DocLnk()); |
111 | return; | 132 | return; |
112 | } | 133 | } |
113 | QDataStream stream(streamBuffer, IO_ReadOnly); | 134 | QDataStream stream(streamBuffer, IO_ReadOnly); |
114 | |||
115 | Q_UINT32 countSheet, countCell, i, j, row, col, alignment; | ||
116 | typeSheet *newSheet; | ||
117 | typeCellData *newCell; | ||
118 | |||
119 | char fileFormat[7]; | ||
120 | stream.readRawBytes(fileFormat, 6); | ||
121 | fileFormat[6]=0; | ||
122 | if ((QString)fileFormat!="SQT100") | ||
123 | { | ||
124 | QMessageBox::critical(this, tr("Error"), tr("Invalid file format!")); | ||
125 | documentModified=FALSE; | ||
126 | selectorFileNew(DocLnk()); | ||
127 | return; | ||
128 | } | ||
129 | 135 | ||
130 | stream >> countSheet; | 136 | Q_UINT32 countSheet, countCell, i, j, row, col, alignment; |
131 | for (i=0; i<countSheet; ++i) | 137 | typeSheet *newSheet; |
132 | { | 138 | typeCellData *newCell; |
133 | newSheet=new typeSheet; | ||
134 | newSheet->data.setAutoDelete(TRUE); | ||
135 | stream >> newSheet->name >> countCell; | ||
136 | comboSheets->insertItem(newSheet->name); | ||
137 | 139 | ||
138 | for (j=0; j<countCell; ++j) | 140 | char fileFormat[7]; |
141 | stream.readRawBytes(fileFormat, 6); | ||
142 | fileFormat[6]=0; | ||
143 | if ((QString)fileFormat!="SQT100") | ||
139 | { | 144 | { |
140 | newCell=new typeCellData; | 145 | QMessageBox::critical(this, tr("Error"), tr("Invalid file format!")); |
141 | stream >> col >> row >> newCell->borders.right >> newCell->borders.bottom >> newCell->background >> alignment >> newCell->fontColor >> newCell->font >> newCell->data; | 146 | documentModified=FALSE; |
142 | newCell->col=col; | 147 | selectorFileNew(DocLnk()); |
143 | newCell->row=row; | 148 | return; |
144 | newCell->alignment=(Qt::AlignmentFlags)alignment; | ||
145 | newSheet->data.append(newCell); | ||
146 | } | 149 | } |
147 | listSheets.append(newSheet); | ||
148 | 150 | ||
149 | if (i==0) | 151 | stream >> countSheet; |
152 | for (i=0; i<countSheet; ++i) | ||
150 | { | 153 | { |
151 | sheet->setName(newSheet->name); | 154 | newSheet=new typeSheet; |
152 | sheet->setSheetData(&newSheet->data); | 155 | newSheet->data.setAutoDelete(TRUE); |
156 | stream >> newSheet->name >> countCell; | ||
157 | comboSheets->insertItem(newSheet->name); | ||
158 | |||
159 | for (j=0; j<countCell; ++j) | ||
160 | { | ||
161 | newCell=new typeCellData; | ||
162 | stream >> col >> row >> newCell->borders.right >> newCell->borders.bottom >> newCell->background >> alignment >> newCell->fontColor >> newCell->font >> newCell->data; | ||
163 | newCell->col=col; | ||
164 | newCell->row=row; | ||
165 | newCell->alignment=(Qt::AlignmentFlags)alignment; | ||
166 | newSheet->data.append(newCell); | ||
167 | } | ||
168 | listSheets.append(newSheet); | ||
169 | |||
170 | if (i==0) | ||
171 | { | ||
172 | sheet->setName(newSheet->name); | ||
173 | sheet->setSheetData(&newSheet->data); | ||
174 | } | ||
153 | } | 175 | } |
154 | } | ||
155 | } | 176 | } |
@@ -158,20 +179,20 @@ int MainWindow::saveCurrentFile(bool ask) | |||
158 | { | 179 | { |
159 | if (ask) | 180 | if (ask) |
160 | { | 181 | { |
161 | int result=QMessageBox::information(this, tr("Save File"), tr("Do you want to save the current file?"), QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel); | 182 | int result=QMessageBox::information(this, tr("Save File"), tr("Do you want to save the current file?"), QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel); |
162 | if (result!=QMessageBox::Yes) return result; | 183 | if (result!=QMessageBox::Yes) return result; |
163 | } | 184 | } |
164 | 185 | ||
165 | if (!currentDoc->isValid()) | 186 | if (!currentDoc->isValid()) |
166 | { | 187 | { |
167 | TextDialog dialogText(this); | 188 | TextDialog dialogText(this); |
168 | if (dialogText.exec(tr("Save File"), tr("&File Name:"), tr("UnnamedFile"))!=QDialog::Accepted || dialogText.getValue().isEmpty()) return QMessageBox::Cancel; | 189 | if (dialogText.exec(tr("Save File"), tr("&File Name:"), tr("UnnamedFile"))!=QDialog::Accepted || dialogText.getValue().isEmpty()) return QMessageBox::Cancel; |
169 | 190 | ||
170 | currentDoc->setName(dialogText.getValue()); | 191 | currentDoc->setName(dialogText.getValue()); |
171 | currentDoc->setFile(QString::null); | 192 | currentDoc->setFile(QString::null); |
172 | currentDoc->setLinkFile(QString::null); | 193 | currentDoc->setLinkFile(QString::null); |
173 | } | 194 | } |
174 | 195 | ||
175 | documentSave(currentDoc); | 196 | documentSave(currentDoc); |
176 | return QMessageBox::Yes; | 197 | return QMessageBox::Yes; |
177 | } | 198 | } |
@@ -180,18 +201,18 @@ void MainWindow::selectorFileNew(const DocLnk &lnkDoc) | |||
180 | { | 201 | { |
181 | selectorHide(); | 202 | selectorHide(); |
182 | 203 | ||
183 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; | 204 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; |
184 | if (currentDoc) delete currentDoc; | 205 | if (currentDoc) delete currentDoc; |
185 | currentDoc = new DocLnk(lnkDoc); | 206 | currentDoc = new DocLnk(lnkDoc); |
186 | editData->clear(); | 207 | editData->clear(); |
187 | listSheets.clear(); | 208 | listSheets.clear(); |
188 | comboSheets->clear(); | 209 | comboSheets->clear(); |
189 | 210 | ||
190 | typeSheet *newSheet=createNewSheet(); | 211 | typeSheet *newSheet=createNewSheet(); |
191 | newSheet->data.setAutoDelete(TRUE); | 212 | newSheet->data.setAutoDelete(TRUE); |
192 | sheet->setName(newSheet->name); | 213 | sheet->setName(newSheet->name); |
193 | sheet->setSheetData(&newSheet->data); | 214 | sheet->setSheetData(&newSheet->data); |
194 | for (int i=1; i<DEFAULT_NUM_SHEETS; ++i) | 215 | for (int i=1; i<DEFAULT_NUM_SHEETS; ++i) |
195 | createNewSheet(); | 216 | createNewSheet(); |
196 | documentModified=FALSE; | 217 | documentModified=FALSE; |
197 | } | 218 | } |
@@ -200,4 +221,4 @@ void MainWindow::closeEvent(QCloseEvent *e) | |||
200 | { | 221 | { |
201 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) e->ignore(); | 222 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) e->ignore(); |
202 | else e->accept(); | 223 | else e->accept(); |
203 | } | 224 | } |
@@ -206,12 +227,12 @@ void MainWindow::selectorFileOpen(const DocLnk &lnkDoc) | |||
206 | { | 227 | { |
207 | selectorHide(); | 228 | selectorHide(); |
208 | 229 | ||
209 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; | 230 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; |
210 | if (currentDoc) delete currentDoc; | 231 | if (currentDoc) delete currentDoc; |
211 | currentDoc = new DocLnk(); | 232 | currentDoc = new DocLnk(); |
212 | listSheets.clear(); | 233 | listSheets.clear(); |
213 | comboSheets->clear(); | 234 | comboSheets->clear(); |
214 | 235 | ||
215 | documentOpen(lnkDoc); | 236 | documentOpen(lnkDoc); |
216 | documentModified=FALSE; | 237 | documentModified=FALSE; |
217 | } | 238 | } |
@@ -220,6 +241,6 @@ void MainWindow::selectorShow() | |||
220 | { | 241 | { |
221 | sheet->hide(); | 242 | sheet->hide(); |
222 | setCentralWidget(fileSelector); | 243 | setCentralWidget(fileSelector); |
223 | fileSelector->show(); | 244 | fileSelector->show(); |
224 | fileSelector->reread(); | 245 | fileSelector->reread(); |
225 | } | 246 | } |
@@ -228,5 +249,5 @@ void MainWindow::selectorHide() | |||
228 | { | 249 | { |
229 | fileSelector->hide(); | 250 | fileSelector->hide(); |
230 | setCentralWidget(sheet); | 251 | setCentralWidget(sheet); |
231 | sheet->show(); | 252 | sheet->show(); |
232 | } | 253 | } |
@@ -235,3 +256,3 @@ void MainWindow::slotFileNew() | |||
235 | { | 256 | { |
236 | selectorFileNew(DocLnk()); | 257 | selectorFileNew(DocLnk()); |
237 | } | 258 | } |
@@ -240,3 +261,3 @@ void MainWindow::slotFileOpen() | |||
240 | { | 261 | { |
241 | selectorShow(); | 262 | selectorShow(); |
242 | } | 263 | } |
@@ -245,6 +266,6 @@ void MainWindow::slotImportExcelOpen() | |||
245 | { | 266 | { |
246 | sheet->hide(); | 267 | sheet->hide(); |
247 | setCentralWidget(ExcelSelector); | 268 | setCentralWidget(ExcelSelector); |
248 | ExcelSelector->show(); | 269 | ExcelSelector->show(); |
249 | ExcelSelector->reread(); | 270 | ExcelSelector->reread(); |
250 | } | 271 | } |
@@ -253,5 +274,5 @@ void MainWindow::ExcelSelectorHide() | |||
253 | { | 274 | { |
254 | ExcelSelector->hide(); | 275 | ExcelSelector->hide(); |
255 | setCentralWidget(sheet); | 276 | setCentralWidget(sheet); |
256 | sheet->show(); | 277 | sheet->show(); |
257 | } | 278 | } |
@@ -260,3 +281,3 @@ void MainWindow::slotFileSave() | |||
260 | { | 281 | { |
261 | saveCurrentFile(FALSE); | 282 | saveCurrentFile(FALSE); |
262 | } | 283 | } |
@@ -265,3 +286,3 @@ void MainWindow::setDocument(const QString &applnk_filename) | |||
265 | { | 286 | { |
266 | selectorFileOpen(DocLnk(applnk_filename)); | 287 | selectorFileOpen(DocLnk(applnk_filename)); |
267 | } | 288 | } |
@@ -270,100 +291,100 @@ void MainWindow::initActions() | |||
270 | { | 291 | { |
271 | fileNew=new QAction(tr("New File"), Resource::loadPixmap( "new" ), tr("&New"), 0, this); | 292 | fileNew=new QAction(tr("New File"), Resource::loadPixmap( "new" ), tr("&New"), 0, this); |
272 | connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew())); | 293 | connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew())); |
273 | fileOpen=new QAction(tr("Open File"), Resource::loadPixmap( "fileopen" ), tr("&Open"), 0, this); | 294 | fileOpen=new QAction(tr("Open File"), Resource::loadPixmap( "fileopen" ), tr("&Open"), 0, this); |
274 | connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen())); | 295 | connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen())); |
275 | fileSave=new QAction(tr("Save File"),Resource::loadPixmap( "save" ), tr("&Save"), 0, this); | 296 | fileSave=new QAction(tr("Save File"),Resource::loadPixmap( "save" ), tr("&Save"), 0, this); |
276 | connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave())); | 297 | connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave())); |
277 | fileSaveAs=new QAction(tr("Save File As"), Resource::loadPixmap( "save" ), tr("Save &As"), 0, this); | 298 | fileSaveAs=new QAction(tr("Save File As"), Resource::loadPixmap( "save" ), tr("Save &As"), 0, this); |
278 | connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs())); | 299 | connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs())); |
279 | 300 | ||
280 | //fileQuit=new QAction(tr("Quit"), tr("&Quit"), 0, this); | 301 | //fileQuit=new QAction(tr("Quit"), tr("&Quit"), 0, this); |
281 | //connect(fileQuit, SIGNAL(activated()), this, SLOT(close())); | 302 | //connect(fileQuit, SIGNAL(activated()), this, SLOT(close())); |
282 | fileExcelImport=new QAction(tr("Import Excel file"),Resource::loadPixmap( "opie-sheet/excel16" ),tr("Import E&xcel file"),0,this); | 303 | fileExcelImport=new QAction(tr("Import Excel file"),Resource::loadPixmap( "opie-sheet/excel16" ),tr("Import E&xcel file"),0,this); |
283 | connect(fileExcelImport, SIGNAL(activated()), this, SLOT(slotImportExcelOpen())); | 304 | connect(fileExcelImport, SIGNAL(activated()), this, SLOT(slotImportExcelOpen())); |
284 | 305 | ||
285 | // helpGeneral=new QAction(tr("General Help"), QPixmap(help_general_xpm), tr("&General"), 0, this); | 306 | // helpGeneral=new QAction(tr("General Help"), QPixmap(help_general_xpm), tr("&General"), 0, this); |
286 | //connect(helpGeneral, SIGNAL(activated()), this, SLOT(slotHelpGeneral())); | 307 | //connect(helpGeneral, SIGNAL(activated()), this, SLOT(slotHelpGeneral())); |
287 | //helpAbout=new QAction(tr("About Opie Sheet"), tr("&About"), 0, this); | 308 | //helpAbout=new QAction(tr("About Opie Sheet"), tr("&About"), 0, this); |
288 | //connect(helpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout())); | 309 | //connect(helpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout())); |
289 | 310 | ||
290 | editAccept=new QAction(tr("Accept"),Resource::loadPixmap( "enter" ) , tr("&Accept"), 0, this); | 311 | editAccept=new QAction(tr("Accept"),Resource::loadPixmap( "enter" ) , tr("&Accept"), 0, this); |
291 | connect(editAccept, SIGNAL(activated()), this, SLOT(slotEditAccept())); | 312 | connect(editAccept, SIGNAL(activated()), this, SLOT(slotEditAccept())); |
292 | editCancel=new QAction(tr("Cancel"), Resource::loadPixmap( "close" ), tr("&Cancel"), 0, this); | 313 | editCancel=new QAction(tr("Cancel"), Resource::loadPixmap( "close" ), tr("&Cancel"), 0, this); |
293 | connect(editCancel, SIGNAL(activated()), this, SLOT(slotEditCancel())); | 314 | connect(editCancel, SIGNAL(activated()), this, SLOT(slotEditCancel())); |
294 | editCellSelect=new QAction(tr("Cell Selector"), Resource::loadPixmap( "opie-sheet/cell-select" ), tr("Cell &Selector"), 0, this); | 315 | editCellSelect=new QAction(tr("Cell Selector"), Resource::loadPixmap( "opie-sheet/cell-select" ), tr("Cell &Selector"), 0, this); |
295 | editCellSelect->setToggleAction(TRUE); | 316 | editCellSelect->setToggleAction(TRUE); |
296 | connect(editCellSelect, SIGNAL(toggled(bool)), this, SLOT(slotCellSelect(bool))); | 317 | connect(editCellSelect, SIGNAL(toggled(bool)), this, SLOT(slotCellSelect(bool))); |
297 | editCut=new QAction(tr("Cut Cells"), tr("Cu&t"), 0, this); | 318 | editCut=new QAction(tr("Cut Cells"), tr("Cu&t"), 0, this); |
298 | editCopy=new QAction(tr("Copy Cells"), tr("&Copy"), 0, this); | 319 | editCopy=new QAction(tr("Copy Cells"), tr("&Copy"), 0, this); |
299 | editPaste=new QAction(tr("Paste Cells"), tr("&Paste"), 0, this); | 320 | editPaste=new QAction(tr("Paste Cells"), tr("&Paste"), 0, this); |
300 | connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste())); | 321 | connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste())); |
301 | editPasteContents=new QAction(tr("Paste Contents"), tr("Paste Cont&ents"), 0, this); | 322 | editPasteContents=new QAction(tr("Paste Contents"), tr("Paste Cont&ents"), 0, this); |
302 | connect(editPasteContents, SIGNAL(activated()), this, SLOT(slotEditPasteContents())); | 323 | connect(editPasteContents, SIGNAL(activated()), this, SLOT(slotEditPasteContents())); |
303 | editClear=new QAction(tr("Clear Cells"), tr("C&lear"), 0, this); | 324 | editClear=new QAction(tr("Clear Cells"), tr("C&lear"), 0, this); |
304 | 325 | ||
305 | insertCells=new QAction(tr("Insert Cells"), tr("C&ells"), 0, this); | 326 | insertCells=new QAction(tr("Insert Cells"), tr("C&ells"), 0, this); |
306 | connect(insertCells, SIGNAL(activated()), this, SLOT(slotInsertCells())); | 327 | connect(insertCells, SIGNAL(activated()), this, SLOT(slotInsertCells())); |
307 | insertRows=new QAction(tr("Insert Rows"), tr("&Rows"), 0, this); | 328 | insertRows=new QAction(tr("Insert Rows"), tr("&Rows"), 0, this); |
308 | connect(insertRows, SIGNAL(activated()), this, SLOT(slotInsertRows())); | 329 | connect(insertRows, SIGNAL(activated()), this, SLOT(slotInsertRows())); |
309 | insertCols=new QAction(tr("Insert Columns"), tr("&Columns"), 0, this); | 330 | insertCols=new QAction(tr("Insert Columns"), tr("&Columns"), 0, this); |
310 | connect(insertCols, SIGNAL(activated()), this, SLOT(slotInsertCols())); | 331 | connect(insertCols, SIGNAL(activated()), this, SLOT(slotInsertCols())); |
311 | insertSheets=new QAction(tr("Add Sheets"), tr("&Sheets"), 0, this); | 332 | insertSheets=new QAction(tr("Add Sheets"), tr("&Sheets"), 0, this); |
312 | connect(insertSheets, SIGNAL(activated()), this, SLOT(slotInsertSheets())); | 333 | connect(insertSheets, SIGNAL(activated()), this, SLOT(slotInsertSheets())); |
313 | 334 | ||
314 | formatCells=new QAction(tr("Cells"), tr("&Cells"), 0, this); | 335 | formatCells=new QAction(tr("Cells"), tr("&Cells"), 0, this); |
315 | connect(formatCells, SIGNAL(activated()), this, SLOT(slotFormatCells())); | 336 | connect(formatCells, SIGNAL(activated()), this, SLOT(slotFormatCells())); |
316 | 337 | ||
317 | rowHeight=new QAction(tr("Row Height"), tr("H&eight"), 0, this); | 338 | rowHeight=new QAction(tr("Row Height"), tr("H&eight"), 0, this); |
318 | connect(rowHeight, SIGNAL(activated()), this, SLOT(slotRowHeight())); | 339 | connect(rowHeight, SIGNAL(activated()), this, SLOT(slotRowHeight())); |
319 | rowAdjust=new QAction(tr("Adjust Row"), tr("&Adjust"), 0, this); | 340 | rowAdjust=new QAction(tr("Adjust Row"), tr("&Adjust"), 0, this); |
320 | connect(rowAdjust, SIGNAL(activated()), this, SLOT(slotRowAdjust())); | 341 | connect(rowAdjust, SIGNAL(activated()), this, SLOT(slotRowAdjust())); |
321 | rowShow=new QAction(tr("Show Row"), tr("&Show"), 0, this); | 342 | rowShow=new QAction(tr("Show Row"), tr("&Show"), 0, this); |
322 | connect(rowShow, SIGNAL(activated()), this, SLOT(slotRowShow())); | 343 | connect(rowShow, SIGNAL(activated()), this, SLOT(slotRowShow())); |
323 | rowHide=new QAction(tr("Hide Row"), tr("&Hide"), 0, this); | 344 | rowHide=new QAction(tr("Hide Row"), tr("&Hide"), 0, this); |
324 | connect(rowHide, SIGNAL(activated()), this, SLOT(slotRowHide())); | 345 | connect(rowHide, SIGNAL(activated()), this, SLOT(slotRowHide())); |
325 | 346 | ||
326 | colWidth=new QAction(tr("Column Width"), tr("&Width"), 0, this); | 347 | colWidth=new QAction(tr("Column Width"), tr("&Width"), 0, this); |
327 | connect(colWidth, SIGNAL(activated()), this, SLOT(slotColumnWidth())); | 348 | connect(colWidth, SIGNAL(activated()), this, SLOT(slotColumnWidth())); |
328 | colAdjust=new QAction(tr("Adjust Column"), tr("&Adjust"), 0, this); | 349 | colAdjust=new QAction(tr("Adjust Column"), tr("&Adjust"), 0, this); |
329 | connect(colAdjust, SIGNAL(activated()), this, SLOT(slotColumnAdjust())); | 350 | connect(colAdjust, SIGNAL(activated()), this, SLOT(slotColumnAdjust())); |
330 | colShow=new QAction(tr("Show Column"), tr("&Show"), 0, this); | 351 | colShow=new QAction(tr("Show Column"), tr("&Show"), 0, this); |
331 | connect(colShow, SIGNAL(activated()), this, SLOT(slotColumnShow())); | 352 | connect(colShow, SIGNAL(activated()), this, SLOT(slotColumnShow())); |
332 | colHide=new QAction(tr("Hide Column"), tr("&Hide"), 0, this); | 353 | colHide=new QAction(tr("Hide Column"), tr("&Hide"), 0, this); |
333 | connect(colHide, SIGNAL(activated()), this, SLOT(slotColumnHide())); | 354 | connect(colHide, SIGNAL(activated()), this, SLOT(slotColumnHide())); |
334 | 355 | ||
335 | sheetRename=new QAction(tr("Rename Sheet"), tr("&Rename"), 0, this); | 356 | sheetRename=new QAction(tr("Rename Sheet"), tr("&Rename"), 0, this); |
336 | connect(sheetRename, SIGNAL(activated()), this, SLOT(slotSheetRename())); | 357 | connect(sheetRename, SIGNAL(activated()), this, SLOT(slotSheetRename())); |
337 | sheetRemove=new QAction(tr("Remove Sheet"), tr("R&emove"), 0, this); | 358 | sheetRemove=new QAction(tr("Remove Sheet"), tr("R&emove"), 0, this); |
338 | connect(sheetRemove, SIGNAL(activated()), this, SLOT(slotSheetRemove())); | 359 | connect(sheetRemove, SIGNAL(activated()), this, SLOT(slotSheetRemove())); |
339 | 360 | ||
340 | dataSort=new QAction(tr("Sort Data"), tr("&Sort"), 0, this); | 361 | dataSort=new QAction(tr("Sort Data"), tr("&Sort"), 0, this); |
341 | connect(dataSort, SIGNAL(activated()), this, SLOT(slotDataSort())); | 362 | connect(dataSort, SIGNAL(activated()), this, SLOT(slotDataSort())); |
342 | dataFindReplace=new QAction(tr("Find && Replace"), tr("&Find && Replace"), 0, this); | 363 | dataFindReplace=new QAction(tr("Find && Replace"), tr("&Find && Replace"), 0, this); |
343 | connect(dataFindReplace, SIGNAL(activated()), this, SLOT(slotDataFindReplace())); | 364 | connect(dataFindReplace, SIGNAL(activated()), this, SLOT(slotDataFindReplace())); |
344 | 365 | ||
345 | funcEqual=new QAction(tr("Equal To"), Resource::loadPixmap( "opie-sheet/func-equal" ), tr("&Equal To"), 0, this); | 366 | funcEqual=new QAction(tr("Equal To"), Resource::loadPixmap( "opie-sheet/func-equal" ), tr("&Equal To"), 0, this); |
346 | funcEqual->setToolTip("="); | 367 | funcEqual->setToolTip("="); |
347 | connect(funcEqual, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 368 | connect(funcEqual, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
348 | funcPlus=new QAction(tr("Addition"), Resource::loadPixmap( "opie-sheet/func-plus" ), tr("&Addition"), 0, this); | 369 | funcPlus=new QAction(tr("Addition"), Resource::loadPixmap( "opie-sheet/func-plus" ), tr("&Addition"), 0, this); |
349 | funcPlus->setToolTip("+"); | 370 | funcPlus->setToolTip("+"); |
350 | connect(funcPlus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 371 | connect(funcPlus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
351 | funcMinus=new QAction(tr("Subtraction"), Resource::loadPixmap( "opie-sheet/func-minus" ), tr("&Subtraction"), 0, this); | 372 | funcMinus=new QAction(tr("Subtraction"), Resource::loadPixmap( "opie-sheet/func-minus" ), tr("&Subtraction"), 0, this); |
352 | funcMinus->setToolTip("-"); | 373 | funcMinus->setToolTip("-"); |
353 | connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 374 | connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
354 | funcCross=new QAction(tr("Multiplication"), Resource::loadPixmap ("opie-sheet/func-cross" ), tr("&Multiplication"), 0, this); | 375 | funcCross=new QAction(tr("Multiplication"), Resource::loadPixmap ("opie-sheet/func-cross" ), tr("&Multiplication"), 0, this); |
355 | funcCross->setToolTip("*"); | 376 | funcCross->setToolTip("*"); |
356 | connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 377 | connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
357 | funcDivide=new QAction(tr("Division"), Resource::loadPixmap( "opie-sheet/func-divide" ), tr("&Division"), 0, this); | 378 | funcDivide=new QAction(tr("Division"), Resource::loadPixmap( "opie-sheet/func-divide" ), tr("&Division"), 0, this); |
358 | funcDivide->setToolTip("/"); | 379 | funcDivide->setToolTip("/"); |
359 | connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 380 | connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
360 | funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), Resource::loadPixmap( "opie-sheet/func-paran-open" ), tr("&Open Paranthesis"), 0, this); | 381 | funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), Resource::loadPixmap( "opie-sheet/func-paran-open" ), tr("&Open Paranthesis"), 0, this); |
361 | funcParanOpen->setToolTip("("); | 382 | funcParanOpen->setToolTip("("); |
362 | connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 383 | connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
363 | funcParanClose=new QAction(tr("Close Paranthesis"), Resource::loadPixmap( "opie-sheet/func-paran-close" ), tr("&Close Paranthesis"), 0, this); | 384 | funcParanClose=new QAction(tr("Close Paranthesis"), Resource::loadPixmap( "opie-sheet/func-paran-close" ), tr("&Close Paranthesis"), 0, this); |
364 | funcParanClose->setToolTip(")"); | 385 | funcParanClose->setToolTip(")"); |
365 | connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 386 | connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
366 | funcComma=new QAction(tr("Comma"), Resource::loadPixmap( "opie-sheet/func-comma" ), tr("&Comma"), 0, this); | 387 | funcComma=new QAction(tr("Comma"), Resource::loadPixmap( "opie-sheet/func-comma" ), tr("&Comma"), 0, this); |
367 | funcComma->setToolTip(","); | 388 | funcComma->setToolTip(","); |
368 | connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 389 | connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
369 | } | 390 | } |
@@ -372,198 +393,198 @@ void MainWindow::initMenu() | |||
372 | { | 393 | { |
373 | menu=new QMenuBar(this); | 394 | menu=new QMenuBar(this); |
374 | 395 | ||
375 | menuFile=new QPopupMenu; | 396 | menuFile=new QPopupMenu; |
376 | fileNew->addTo(menuFile); | 397 | fileNew->addTo(menuFile); |
377 | fileOpen->addTo(menuFile); | 398 | fileOpen->addTo(menuFile); |
378 | fileSave->addTo(menuFile); | 399 | fileSave->addTo(menuFile); |
379 | fileSaveAs->addTo(menuFile); | 400 | fileSaveAs->addTo(menuFile); |
380 | // menuFile->insertSeparator(); | 401 | // menuFile->insertSeparator(); |
381 | // fileQuit->addTo(menuFile); | 402 | // fileQuit->addTo(menuFile); |
382 | menuFile->insertSeparator(); | 403 | menuFile->insertSeparator(); |
383 | fileExcelImport->addTo(menuFile); | 404 | fileExcelImport->addTo(menuFile); |
384 | menu->insertItem(tr("&File"), menuFile); | 405 | menu->insertItem(tr("&File"), menuFile); |
385 | 406 | ||
386 | menuEdit=new QPopupMenu; | 407 | menuEdit=new QPopupMenu; |
387 | editAccept->addTo(menuEdit); | 408 | editAccept->addTo(menuEdit); |
388 | editCancel->addTo(menuEdit); | 409 | editCancel->addTo(menuEdit); |
389 | editCellSelect->addTo(menuEdit); | 410 | editCellSelect->addTo(menuEdit); |
390 | menuEdit->insertSeparator(); | 411 | menuEdit->insertSeparator(); |
391 | editCut->addTo(menuEdit); | 412 | editCut->addTo(menuEdit); |
392 | editCopy->addTo(menuEdit); | 413 | editCopy->addTo(menuEdit); |
393 | editPaste->addTo(menuEdit); | 414 | editPaste->addTo(menuEdit); |
394 | editPasteContents->addTo(menuEdit); | 415 | editPasteContents->addTo(menuEdit); |
395 | editClear->addTo(menuEdit); | 416 | editClear->addTo(menuEdit); |
396 | menu->insertItem(tr("&Edit"), menuEdit); | 417 | menu->insertItem(tr("&Edit"), menuEdit); |
397 | 418 | ||
398 | menuInsert=new QPopupMenu; | 419 | menuInsert=new QPopupMenu; |
399 | menu->insertItem(tr("&Insert"), menuInsert); | 420 | menu->insertItem(tr("&Insert"), menuInsert); |
400 | 421 | ||
401 | menuFormat=new QPopupMenu; | 422 | menuFormat=new QPopupMenu; |
402 | formatCells->addTo(menuFormat); | 423 | formatCells->addTo(menuFormat); |
403 | menu->insertItem(tr("&Format"), menuFormat); | 424 | menu->insertItem(tr("&Format"), menuFormat); |
404 | 425 | ||
405 | menuData=new QPopupMenu; | 426 | menuData=new QPopupMenu; |
406 | dataSort->addTo(menuData); | 427 | dataSort->addTo(menuData); |
407 | dataFindReplace->addTo(menuData); | 428 | dataFindReplace->addTo(menuData); |
408 | menu->insertItem(tr("&Data"), menuData); | 429 | menu->insertItem(tr("&Data"), menuData); |
409 | 430 | ||
410 | // menuHelp=new QPopupMenu; | 431 | // menuHelp=new QPopupMenu; |
411 | // helpGeneral->addTo(menuHelp); | 432 | // helpGeneral->addTo(menuHelp); |
412 | // helpAbout->addTo(menuHelp); | 433 | // helpAbout->addTo(menuHelp); |
413 | // menu->insertItem(tr("&Help"), menuHelp); | 434 | // menu->insertItem(tr("&Help"), menuHelp); |
414 | 435 | ||
415 | submenuRow=new QPopupMenu; | 436 | submenuRow=new QPopupMenu; |
416 | rowHeight->addTo(submenuRow); | 437 | rowHeight->addTo(submenuRow); |
417 | rowAdjust->addTo(submenuRow); | 438 | rowAdjust->addTo(submenuRow); |
418 | rowShow->addTo(submenuRow); | 439 | rowShow->addTo(submenuRow); |
419 | rowHide->addTo(submenuRow); | 440 | rowHide->addTo(submenuRow); |
420 | menuFormat->insertItem(tr("&Row"), submenuRow); | 441 | menuFormat->insertItem(tr("&Row"), submenuRow); |
421 | 442 | ||
422 | submenuCol=new QPopupMenu; | 443 | submenuCol=new QPopupMenu; |
423 | colWidth->addTo(submenuCol); | 444 | colWidth->addTo(submenuCol); |
424 | colAdjust->addTo(submenuCol); | 445 | colAdjust->addTo(submenuCol); |
425 | colShow->addTo(submenuCol); | 446 | colShow->addTo(submenuCol); |
426 | colHide->addTo(submenuCol); | 447 | colHide->addTo(submenuCol); |
427 | menuFormat->insertItem(tr("Colum&n"), submenuCol); | 448 | menuFormat->insertItem(tr("Colum&n"), submenuCol); |
428 | 449 | ||
429 | submenuSheet=new QPopupMenu; | 450 | submenuSheet=new QPopupMenu; |
430 | sheetRename->addTo(submenuSheet); | 451 | sheetRename->addTo(submenuSheet); |
431 | sheetRemove->addTo(submenuSheet); | 452 | sheetRemove->addTo(submenuSheet); |
432 | menuFormat->insertItem(tr("&Sheet"), submenuSheet); | 453 | menuFormat->insertItem(tr("&Sheet"), submenuSheet); |
433 | 454 | ||
434 | submenuFunc=new QPopupMenu; | 455 | submenuFunc=new QPopupMenu; |
435 | menuInsert->insertItem(tr("&Function"), submenuFunc); | 456 | menuInsert->insertItem(tr("&Function"), submenuFunc); |
436 | 457 | ||
437 | submenuFuncStd=new QPopupMenu; | 458 | submenuFuncStd=new QPopupMenu; |
438 | funcPlus->addTo(submenuFuncStd); | 459 | funcPlus->addTo(submenuFuncStd); |
439 | funcMinus->addTo(submenuFuncStd); | 460 | funcMinus->addTo(submenuFuncStd); |
440 | funcCross->addTo(submenuFuncStd); | 461 | funcCross->addTo(submenuFuncStd); |
441 | funcDivide->addTo(submenuFuncStd); | 462 | funcDivide->addTo(submenuFuncStd); |
442 | submenuFunc->insertItem(tr("&Simple"), submenuFuncStd); | 463 | submenuFunc->insertItem(tr("&Simple"), submenuFuncStd); |
443 | 464 | ||
444 | 465 | ||
445 | 466 | ||
446 | submenuFuncStandard=new QPopupMenu; | 467 | submenuFuncStandard=new QPopupMenu; |
447 | addFlyAction(tr("ABS(x)"), tr("ABS(x)"), "ABS(", submenuFuncStandard); | 468 | addFlyAction(tr("ABS(x)"), tr("ABS(x)"), "ABS(", submenuFuncStandard); |
448 | addFlyAction(tr("CEILING(x,acc)"), tr("CEILING(x,acc)"), "CEILING(", submenuFuncStandard); | 469 | addFlyAction(tr("CEILING(x,acc)"), tr("CEILING(x,acc)"), "CEILING(", submenuFuncStandard); |
449 | addFlyAction(tr("FACT(x)"), tr("FACT(x)"), "FACT(", submenuFuncStandard); | 470 | addFlyAction(tr("FACT(x)"), tr("FACT(x)"), "FACT(", submenuFuncStandard); |
450 | addFlyAction(tr("FLOOR(x,acc)"), tr("FLOOR(x,acc)"), "FLOOR(", submenuFuncStandard); | 471 | addFlyAction(tr("FLOOR(x,acc)"), tr("FLOOR(x,acc)"), "FLOOR(", submenuFuncStandard); |
451 | addFlyAction(tr("INT(x)"), tr("INT(x)"), "INT(", submenuFuncStandard); | 472 | addFlyAction(tr("INT(x)"), tr("INT(x)"), "INT(", submenuFuncStandard); |
452 | addFlyAction(tr("MOD(x,y)"), tr("MOD(x,y)"), "MOD(", submenuFuncStandard); | 473 | addFlyAction(tr("MOD(x,y)"), tr("MOD(x,y)"), "MOD(", submenuFuncStandard); |
453 | addFlyAction(tr("ROUND(x,digits)"), tr("ROUND(x,digits)"), "ROUND(", submenuFuncStandard); | 474 | addFlyAction(tr("ROUND(x,digits)"), tr("ROUND(x,digits)"), "ROUND(", submenuFuncStandard); |
454 | addFlyAction(tr("SIGN(x)"), tr("SIGN(x)"), "SIGN(", submenuFuncStandard); | 475 | addFlyAction(tr("SIGN(x)"), tr("SIGN(x)"), "SIGN(", submenuFuncStandard); |
455 | submenuFuncStandard->insertSeparator(); | 476 | submenuFuncStandard->insertSeparator(); |
456 | addFlyAction(tr("EXP(x)"), tr("EXP(x)"), "EXP(", submenuFuncStandard); | 477 | addFlyAction(tr("EXP(x)"), tr("EXP(x)"), "EXP(", submenuFuncStandard); |
457 | addFlyAction(tr("LN(x)"), tr("LN(x)"), "LN(", submenuFuncStandard); | 478 | addFlyAction(tr("LN(x)"), tr("LN(x)"), "LN(", submenuFuncStandard); |
458 | addFlyAction(tr("LOG(x,b)"), tr("LOG(x,b)"), "LOG(", submenuFuncStandard); | 479 | addFlyAction(tr("LOG(x,b)"), tr("LOG(x,b)"), "LOG(", submenuFuncStandard); |
459 | addFlyAction(tr("LOG10(x)"), tr("LOG10(x)"), "LOG10(", submenuFuncStandard); | 480 | addFlyAction(tr("LOG10(x)"), tr("LOG10(x)"), "LOG10(", submenuFuncStandard); |
460 | addFlyAction(tr("POWER(x,y)"), tr("POWER(x,y)"), "POWER(", submenuFuncStandard); | 481 | addFlyAction(tr("POWER(x,y)"), tr("POWER(x,y)"), "POWER(", submenuFuncStandard); |
461 | addFlyAction(tr("SQRT(x)"), tr("SQRT(x)"), "SQRT(", submenuFuncStandard); | 482 | addFlyAction(tr("SQRT(x)"), tr("SQRT(x)"), "SQRT(", submenuFuncStandard); |
462 | submenuFuncStandard->insertSeparator(); | 483 | submenuFuncStandard->insertSeparator(); |
463 | addFlyAction(tr("DEGREES(x)"), tr("DEGREES(x)"), "DEGREES(", submenuFuncStandard); | 484 | addFlyAction(tr("DEGREES(x)"), tr("DEGREES(x)"), "DEGREES(", submenuFuncStandard); |
464 | addFlyAction(tr("RADIANS(x)"), tr("RADIANS(x)"), "RADIANS(", submenuFuncStandard); | 485 | addFlyAction(tr("RADIANS(x)"), tr("RADIANS(x)"), "RADIANS(", submenuFuncStandard); |
465 | addFlyAction(tr("PI()"), tr("PI()"), "PI()", submenuFuncStandard); | 486 | addFlyAction(tr("PI()"), tr("PI()"), "PI()", submenuFuncStandard); |
466 | addFlyAction(tr("RAND()"), tr("RAND()"), "RAND(", submenuFuncStandard); | 487 | addFlyAction(tr("RAND()"), tr("RAND()"), "RAND(", submenuFuncStandard); |
467 | addFlyAction(tr("RANDBETWEEN(a,b)"), tr("RANDBETWEEN(a,b)"), "RANDBETWEEN(", submenuFuncStandard); | 488 | addFlyAction(tr("RANDBETWEEN(a,b)"), tr("RANDBETWEEN(a,b)"), "RANDBETWEEN(", submenuFuncStandard); |
468 | submenuFunc->insertItem(tr("S&tandard"), submenuFuncStandard); | 489 | submenuFunc->insertItem(tr("S&tandard"), submenuFuncStandard); |
469 | 490 | ||
470 | submenuFuncLogic=new QPopupMenu; | 491 | submenuFuncLogic=new QPopupMenu; |
471 | addFlyAction(tr("AND(x1,x2)"), tr("AND(x1,x2)"), "AND(", submenuFuncLogic); | 492 | addFlyAction(tr("AND(x1,x2)"), tr("AND(x1,x2)"), "AND(", submenuFuncLogic); |
472 | addFlyAction(tr("NOT(x)"), tr("NOT(x)"), "NOT(", submenuFuncLogic); | 493 | addFlyAction(tr("NOT(x)"), tr("NOT(x)"), "NOT(", submenuFuncLogic); |
473 | addFlyAction(tr("OR(x1,x2)"), tr("OR(x1,x2)"), "OR(", submenuFuncLogic); | 494 | addFlyAction(tr("OR(x1,x2)"), tr("OR(x1,x2)"), "OR(", submenuFuncLogic); |
474 | submenuFuncLogic->insertSeparator(); | 495 | submenuFuncLogic->insertSeparator(); |
475 | addFlyAction(tr("IF(compare,val1,val2)"), tr("IF(compare,val1,val2)"), "IF(", submenuFuncLogic); | 496 | addFlyAction(tr("IF(compare,val1,val2)"), tr("IF(compare,val1,val2)"), "IF(", submenuFuncLogic); |
476 | addFlyAction(tr("INDEX(range,index)"),tr("INDEX(range,index)"), "INDEX(", submenuFuncLogic); | 497 | addFlyAction(tr("INDEX(range,index)"),tr("INDEX(range,index)"), "INDEX(", submenuFuncLogic); |
477 | addFlyAction(tr("ISBLANK(x)"), tr("ISBLANK(x)"), "ISBLANK(", submenuFuncLogic); | 498 | addFlyAction(tr("ISBLANK(x)"), tr("ISBLANK(x)"), "ISBLANK(", submenuFuncLogic); |
478 | addFlyAction(tr("ISNUMBER(x)"), tr("ISNUMBER(x)"), "ISNUMBER(", submenuFuncLogic); | 499 | addFlyAction(tr("ISNUMBER(x)"), tr("ISNUMBER(x)"), "ISNUMBER(", submenuFuncLogic); |
479 | addFlyAction(tr("EVEN(x)"), tr("EVEN(x)"), "EVEN(", submenuFuncLogic); | 500 | addFlyAction(tr("EVEN(x)"), tr("EVEN(x)"), "EVEN(", submenuFuncLogic); |
480 | addFlyAction(tr("ISEVEN(x)"), tr("ISEVEN(x)"), "ISEVEN(", submenuFuncLogic); | 501 | addFlyAction(tr("ISEVEN(x)"), tr("ISEVEN(x)"), "ISEVEN(", submenuFuncLogic); |
481 | addFlyAction(tr("ODD(x)"), tr("ODD(x)"), "ODD(", submenuFuncLogic); | 502 | addFlyAction(tr("ODD(x)"), tr("ODD(x)"), "ODD(", submenuFuncLogic); |
482 | addFlyAction(tr("ISODD(x)"), tr("ISODD(x)"), "ISODD(", submenuFuncLogic); | 503 | addFlyAction(tr("ISODD(x)"), tr("ISODD(x)"), "ISODD(", submenuFuncLogic); |
483 | submenuFunc->insertItem(tr("Logical-&Information"), submenuFuncLogic); | 504 | submenuFunc->insertItem(tr("Logical-&Information"), submenuFuncLogic); |
484 | 505 | ||
485 | submenuFuncTrig=new QPopupMenu; | 506 | submenuFuncTrig=new QPopupMenu; |
486 | addFlyAction(tr("SIN(x)"), tr("SIN(x)"), "SIN(", submenuFuncTrig); | 507 | addFlyAction(tr("SIN(x)"), tr("SIN(x)"), "SIN(", submenuFuncTrig); |
487 | addFlyAction(tr("COS(x)"), tr("COS(x)"), "COS(", submenuFuncTrig); | 508 | addFlyAction(tr("COS(x)"), tr("COS(x)"), "COS(", submenuFuncTrig); |
488 | addFlyAction(tr("TAN(x)"), tr("TAN(x)"), "TAN(", submenuFuncTrig); | 509 | addFlyAction(tr("TAN(x)"), tr("TAN(x)"), "TAN(", submenuFuncTrig); |
489 | addFlyAction(tr("ASIN(x)"), tr("ASIN(x)"), "ASIN(", submenuFuncTrig); | 510 | addFlyAction(tr("ASIN(x)"), tr("ASIN(x)"), "ASIN(", submenuFuncTrig); |
490 | addFlyAction(tr("ACOS(x)"), tr("ACOS(x)"), "ACOS(", submenuFuncTrig); | 511 | addFlyAction(tr("ACOS(x)"), tr("ACOS(x)"), "ACOS(", submenuFuncTrig); |
491 | addFlyAction(tr("ATAN(x)"), tr("ATAN(x)"), "ATAN(", submenuFuncTrig); | 512 | addFlyAction(tr("ATAN(x)"), tr("ATAN(x)"), "ATAN(", submenuFuncTrig); |
492 | addFlyAction(tr("ATAN2(x,y)"), tr("ATAN2(x,y)"), "ATAN2(", submenuFuncTrig); | 513 | addFlyAction(tr("ATAN2(x,y)"), tr("ATAN2(x,y)"), "ATAN2(", submenuFuncTrig); |
493 | submenuFuncTrig->insertSeparator(); | 514 | submenuFuncTrig->insertSeparator(); |
494 | addFlyAction(tr("SINH(x)"), tr("SINH(x)"), "SINH(", submenuFuncTrig); | 515 | addFlyAction(tr("SINH(x)"), tr("SINH(x)"), "SINH(", submenuFuncTrig); |
495 | addFlyAction(tr("COSH(x)"), tr("COSH(x)"), "COSH(", submenuFuncTrig); | 516 | addFlyAction(tr("COSH(x)"), tr("COSH(x)"), "COSH(", submenuFuncTrig); |
496 | addFlyAction(tr("TANH(x)"), tr("TANH(x)"), "TANH(", submenuFuncTrig); | 517 | addFlyAction(tr("TANH(x)"), tr("TANH(x)"), "TANH(", submenuFuncTrig); |
497 | addFlyAction(tr("ACOSH(x)"), tr("ACOSH(x)"), "ACOSH(", submenuFuncTrig); | 518 | addFlyAction(tr("ACOSH(x)"), tr("ACOSH(x)"), "ACOSH(", submenuFuncTrig); |
498 | addFlyAction(tr("ASINH(x)"), tr("ASINH(x)"), "ASINH(", submenuFuncTrig); | 519 | addFlyAction(tr("ASINH(x)"), tr("ASINH(x)"), "ASINH(", submenuFuncTrig); |
499 | addFlyAction(tr("ATANH(x)"), tr("ATANH(x)"), "ATANH(", submenuFuncTrig); | 520 | addFlyAction(tr("ATANH(x)"), tr("ATANH(x)"), "ATANH(", submenuFuncTrig); |
500 | submenuFunc->insertItem(tr("&Trigonometric"), submenuFuncTrig); | 521 | submenuFunc->insertItem(tr("&Trigonometric"), submenuFuncTrig); |
501 | 522 | ||
502 | submenuFuncString=new QPopupMenu; | 523 | submenuFuncString=new QPopupMenu; |
503 | addFlyAction(tr("LEN(s)"), tr("LEN(s)"), "LEN(",submenuFuncString); | 524 | addFlyAction(tr("LEN(s)"), tr("LEN(s)"), "LEN(",submenuFuncString); |
504 | addFlyAction(tr("LEFT(s,num)"), tr("LEFT(s,num)"), "LEFT(",submenuFuncString); | 525 | addFlyAction(tr("LEFT(s,num)"), tr("LEFT(s,num)"), "LEFT(",submenuFuncString); |
505 | addFlyAction(tr("RIGHT(s,num)"), tr("RIGHT(s,num)"), "RIGHT(",submenuFuncString); | 526 | addFlyAction(tr("RIGHT(s,num)"), tr("RIGHT(s,num)"), "RIGHT(",submenuFuncString); |
506 | addFlyAction(tr("MID(s,pos,len)"), tr("MID(s,pos,len)"), "MID(",submenuFuncString); | 527 | addFlyAction(tr("MID(s,pos,len)"), tr("MID(s,pos,len)"), "MID(",submenuFuncString); |
507 | submenuFuncString->insertSeparator(); | 528 | submenuFuncString->insertSeparator(); |
508 | addFlyAction(tr("CONCATENATE(s1,s2..)"), tr("CONCATENATE(s1,s2..)"), "CONCATENATE(",submenuFuncString); | 529 | addFlyAction(tr("CONCATENATE(s1,s2..)"), tr("CONCATENATE(s1,s2..)"), "CONCATENATE(",submenuFuncString); |
509 | addFlyAction(tr("EXACT(s1,s2)"), tr("EXACT(s1,s2)"), "EXACT(",submenuFuncString); | 530 | addFlyAction(tr("EXACT(s1,s2)"), tr("EXACT(s1,s2)"), "EXACT(",submenuFuncString); |
510 | addFlyAction(tr("FIND(what,where,pos)"), | 531 | addFlyAction(tr("FIND(what,where,pos)"), |
511 | tr("FIND(what,where,pos)"), "FIND(",submenuFuncString); | 532 | tr("FIND(what,where,pos)"), "FIND(",submenuFuncString); |
512 | addFlyAction(tr("REPLACE(s,pos,len,ns)"), tr("REPLACE(s,pos,len,ns)"), "REPLACE(",submenuFuncString); | 533 | addFlyAction(tr("REPLACE(s,pos,len,ns)"), tr("REPLACE(s,pos,len,ns)"), "REPLACE(",submenuFuncString); |
513 | addFlyAction(tr("REPT(s,n)"), tr("REPT(s,n)"), "REPT(",submenuFuncString); | 534 | addFlyAction(tr("REPT(s,n)"), tr("REPT(s,n)"), "REPT(",submenuFuncString); |
514 | submenuFuncString->insertSeparator(); | 535 | submenuFuncString->insertSeparator(); |
515 | addFlyAction(tr("UPPER(s)"), tr("UPPER(s)"), "UPPER(",submenuFuncString); | 536 | addFlyAction(tr("UPPER(s)"), tr("UPPER(s)"), "UPPER(",submenuFuncString); |
516 | addFlyAction(tr("LOWER(s)"), tr("LOWER(s)"), "LOWER(",submenuFuncString); | 537 | addFlyAction(tr("LOWER(s)"), tr("LOWER(s)"), "LOWER(",submenuFuncString); |
517 | submenuFunc->insertItem(tr("&Strings"), submenuFuncString); | 538 | submenuFunc->insertItem(tr("&Strings"), submenuFuncString); |
518 | 539 | ||
519 | submenuFuncStat=new QPopupMenu; | 540 | submenuFuncStat=new QPopupMenu; |
520 | addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat); | 541 | addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat); |
521 | addFlyAction(tr("COUNT(range)"), tr("COUNT(range)"), "COUNT(",submenuFuncStat); | 542 | addFlyAction(tr("COUNT(range)"), tr("COUNT(range)"), "COUNT(",submenuFuncStat); |
522 | addFlyAction(tr("COUNTIF(range,eqls)"), tr("COUNTIF(range,eqls)"), "COUNTIF(",submenuFuncStat); | 543 | addFlyAction(tr("COUNTIF(range,eqls)"), tr("COUNTIF(range,eqls)"), "COUNTIF(",submenuFuncStat); |
523 | addFlyAction(tr("MAX(range)"), tr("MAX(range)"), "MAX(",submenuFuncStat); | 544 | addFlyAction(tr("MAX(range)"), tr("MAX(range)"), "MAX(",submenuFuncStat); |
524 | addFlyAction(tr("MIN(range)"), tr("MIN(range)"), "MIN(",submenuFuncStat); | 545 | addFlyAction(tr("MIN(range)"), tr("MIN(range)"), "MIN(",submenuFuncStat); |
525 | addFlyAction(tr("SUM(range)"), tr("SUM(range)"), "SUM(",submenuFuncStat); | 546 | addFlyAction(tr("SUM(range)"), tr("SUM(range)"), "SUM(",submenuFuncStat); |
526 | addFlyAction(tr("SUMSQ(range)"), tr("SUMSQ(range)"), "SUMSQ(",submenuFuncStat); | 547 | addFlyAction(tr("SUMSQ(range)"), tr("SUMSQ(range)"), "SUMSQ(",submenuFuncStat); |
527 | submenuFuncStat->insertSeparator(); | 548 | submenuFuncStat->insertSeparator(); |
528 | addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat); | 549 | addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat); |
529 | addFlyAction(tr("VAR(range)"), tr("VAR(range)"), "VAR(",submenuFuncStat); | 550 | addFlyAction(tr("VAR(range)"), tr("VAR(range)"), "VAR(",submenuFuncStat); |
530 | addFlyAction(tr("VARP(range)"), tr("VARP(range)"), "VARP(",submenuFuncStat); | 551 | addFlyAction(tr("VARP(range)"), tr("VARP(range)"), "VARP(",submenuFuncStat); |
531 | addFlyAction(tr("STDEV(range)"), tr("STDEV(range)"), "STDEV(",submenuFuncStat); | 552 | addFlyAction(tr("STDEV(range)"), tr("STDEV(range)"), "STDEV(",submenuFuncStat); |
532 | addFlyAction(tr("STDEVP(range)"), tr("STDEVP(range)"), "STDEVP(",submenuFuncStat); | 553 | addFlyAction(tr("STDEVP(range)"), tr("STDEVP(range)"), "STDEVP(",submenuFuncStat); |
533 | addFlyAction(tr("SKEW(range)"), tr("SKEW(range)"), "SKEW(",submenuFuncStat); | 554 | addFlyAction(tr("SKEW(range)"), tr("SKEW(range)"), "SKEW(",submenuFuncStat); |
534 | addFlyAction(tr("KURT(range)"), tr("KURT(range)"), "KURT(",submenuFuncStat); | 555 | addFlyAction(tr("KURT(range)"), tr("KURT(range)"), "KURT(",submenuFuncStat); |
535 | submenuFunc->insertItem(tr("Sta&tistical"), submenuFuncStat); | 556 | submenuFunc->insertItem(tr("Sta&tistical"), submenuFuncStat); |
536 | 557 | ||
537 | submenuFuncScientific=new QPopupMenu; | 558 | submenuFuncScientific=new QPopupMenu; |
538 | addFlyAction(tr("BESSELI(x,n)"), tr("BESSELI(x,n)"), "BESSELI(",submenuFuncScientific); | 559 | addFlyAction(tr("BESSELI(x,n)"), tr("BESSELI(x,n)"), "BESSELI(",submenuFuncScientific); |
539 | addFlyAction(tr("BESSELJ(x,n)"), tr("BESSELJ(x,n)"), "BESSELJ(",submenuFuncScientific); | 560 | addFlyAction(tr("BESSELJ(x,n)"), tr("BESSELJ(x,n)"), "BESSELJ(",submenuFuncScientific); |
540 | addFlyAction(tr("BESSELK(x,n)"), tr("BESSELK(x,n)"), "BESSELK(",submenuFuncScientific); | 561 | addFlyAction(tr("BESSELK(x,n)"), tr("BESSELK(x,n)"), "BESSELK(",submenuFuncScientific); |
541 | addFlyAction(tr("BESSELY(x,n)"), tr("BESSELY(x,n)"), "BESSELY(",submenuFuncScientific); | 562 | addFlyAction(tr("BESSELY(x,n)"), tr("BESSELY(x,n)"), "BESSELY(",submenuFuncScientific); |
542 | submenuFuncScientific->insertSeparator(); | 563 | submenuFuncScientific->insertSeparator(); |
543 | addFlyAction(tr("BETAI(x,a,b)"), tr("BETAI(x,a,b)"), "BETAI(",submenuFuncScientific); | 564 | addFlyAction(tr("BETAI(x,a,b)"), tr("BETAI(x,a,b)"), "BETAI(",submenuFuncScientific); |
544 | addFlyAction(tr("ERF(a,b)"), tr("ERF(a,b)"), "ERF(",submenuFuncScientific); | 565 | addFlyAction(tr("ERF(a,b)"), tr("ERF(a,b)"), "ERF(",submenuFuncScientific); |
545 | addFlyAction(tr("ERFC(a,b)"), tr("ERFC(a,b)"), "ERFC(",submenuFuncScientific); | 566 | addFlyAction(tr("ERFC(a,b)"), tr("ERFC(a,b)"), "ERFC(",submenuFuncScientific); |
546 | addFlyAction(tr("GAMMALN(x)"), tr("GAMMALN(x)"), "GAMMALN(",submenuFuncScientific); | 567 | addFlyAction(tr("GAMMALN(x)"), tr("GAMMALN(x)"), "GAMMALN(",submenuFuncScientific); |
547 | addFlyAction(tr("GAMMAP(x,a)"), tr("GAMMAP(x,a)"), "GAMMAP(",submenuFuncScientific); | 568 | addFlyAction(tr("GAMMAP(x,a)"), tr("GAMMAP(x,a)"), "GAMMAP(",submenuFuncScientific); |
548 | addFlyAction(tr("GAMMAQ(x,a)"), tr("GAMMAQ(x,a)"), "GAMMAQ(",submenuFuncScientific); | 569 | addFlyAction(tr("GAMMAQ(x,a)"), tr("GAMMAQ(x,a)"), "GAMMAQ(",submenuFuncScientific); |
549 | submenuFunc->insertItem(tr("Scienti&fic"), submenuFuncScientific); | 570 | submenuFunc->insertItem(tr("Scienti&fic"), submenuFuncScientific); |
550 | 571 | ||
551 | submenuFuncDistr=new QPopupMenu; | 572 | submenuFuncDistr=new QPopupMenu; |
552 | addFlyAction(tr("BETADIST(z,a,b,Q?)"), tr("BETADIST(z,a,b,Q?)"), "BETADIST(",submenuFuncDistr); | 573 | addFlyAction(tr("BETADIST(z,a,b,Q?)"), tr("BETADIST(z,a,b,Q?)"), "BETADIST(",submenuFuncDistr); |
553 | addFlyAction(tr("CHI2DIST(x,n,Q?)"), tr("CHI2DIST(x,n,Q?)"), "CHI2DIST(",submenuFuncDistr); | 574 | addFlyAction(tr("CHI2DIST(x,n,Q?)"), tr("CHI2DIST(x,n,Q?)"), "CHI2DIST(",submenuFuncDistr); |
554 | addFlyAction(tr("CHIDIST(x,n,Q?)"), tr("CHIDIST(x,n,Q?)"), "CHIDIST(",submenuFuncDistr); | 575 | addFlyAction(tr("CHIDIST(x,n,Q?)"), tr("CHIDIST(x,n,Q?)"), "CHIDIST(",submenuFuncDistr); |
555 | addFlyAction(tr("FDIST(z,deg1,deg2,Q?)"), tr("FDIST(z,deg1,deg2,Q?)"), "FDIST(",submenuFuncDistr); | 576 | addFlyAction(tr("FDIST(z,deg1,deg2,Q?)"), tr("FDIST(z,deg1,deg2,Q?)"), "FDIST(",submenuFuncDistr); |
556 | addFlyAction(tr("GAMMADIST(x,a,b,Q?)"), tr("GAMMADIST(x,a,b,Q?)"), "GAMMADIST(",submenuFuncDistr); | 577 | addFlyAction(tr("GAMMADIST(x,a,b,Q?)"), tr("GAMMADIST(x,a,b,Q?)"), "GAMMADIST(",submenuFuncDistr); |
557 | addFlyAction(tr("NORMALDIST(x,m,s,Q?)"), tr("NORMALDIST(x,m,s,Q?)"), "NORMALDIST(",submenuFuncDistr); | 578 | addFlyAction(tr("NORMALDIST(x,m,s,Q?)"), tr("NORMALDIST(x,m,s,Q?)"), "NORMALDIST(",submenuFuncDistr); |
558 | addFlyAction(tr("PHI(x,Q?)"), tr("PHI(x,Q?)"), "PHI(",submenuFuncDistr); | 579 | addFlyAction(tr("PHI(x,Q?)"), tr("PHI(x,Q?)"), "PHI(",submenuFuncDistr); |
559 | addFlyAction(tr("POISSON(x,n,Q?)"), tr("POISSON(x,n,Q?)"), "POISSON(",submenuFuncDistr); | 580 | addFlyAction(tr("POISSON(x,n,Q?)"), tr("POISSON(x,n,Q?)"), "POISSON(",submenuFuncDistr); |
560 | submenuFunc->insertItem(tr("&Distributions"), submenuFuncDistr); | 581 | submenuFunc->insertItem(tr("&Distributions"), submenuFuncDistr); |
561 | 582 | ||
562 | 583 | ||
563 | 584 | ||
564 | menuInsert->insertSeparator(); | 585 | menuInsert->insertSeparator(); |
565 | insertCells->addTo(menuInsert); | 586 | insertCells->addTo(menuInsert); |
566 | insertRows->addTo(menuInsert); | 587 | insertRows->addTo(menuInsert); |
567 | insertCols->addTo(menuInsert); | 588 | insertCols->addTo(menuInsert); |
568 | insertSheets->addTo(menuInsert); | 589 | insertSheets->addTo(menuInsert); |
569 | } | 590 | } |
@@ -572,13 +593,13 @@ void MainWindow::initStandardToolbar() | |||
572 | { | 593 | { |
573 | toolbarStandard=new QToolBar(this); | 594 | toolbarStandard=new QToolBar(this); |
574 | toolbarStandard->setHorizontalStretchable(TRUE); | 595 | toolbarStandard->setHorizontalStretchable(TRUE); |
575 | moveToolBar(toolbarStandard, Top); | 596 | moveToolBar(toolbarStandard, Top); |
576 | 597 | ||
577 | fileNew->addTo(toolbarStandard); | 598 | fileNew->addTo(toolbarStandard); |
578 | fileOpen->addTo(toolbarStandard); | 599 | fileOpen->addTo(toolbarStandard); |
579 | fileSave->addTo(toolbarStandard); | 600 | fileSave->addTo(toolbarStandard); |
580 | 601 | ||
581 | comboSheets=new QComboBox(toolbarStandard); | 602 | comboSheets=new QComboBox(toolbarStandard); |
582 | toolbarStandard->setStretchableWidget(comboSheets); | 603 | toolbarStandard->setStretchableWidget(comboSheets); |
583 | connect(comboSheets, SIGNAL(activated(const QString&)), this, SLOT(slotSheetChanged(const QString&))); | 604 | connect(comboSheets, SIGNAL(activated(const QString&)), this, SLOT(slotSheetChanged(const QString&))); |
584 | } | 605 | } |
@@ -587,20 +608,20 @@ void MainWindow::initFunctionsToolbar() | |||
587 | { | 608 | { |
588 | toolbarFunctions=new QToolBar(this); | 609 | toolbarFunctions=new QToolBar(this); |
589 | toolbarFunctions->setHorizontalStretchable(TRUE); | 610 | toolbarFunctions->setHorizontalStretchable(TRUE); |
590 | moveToolBar(toolbarFunctions, Bottom); | 611 | moveToolBar(toolbarFunctions, Bottom); |
591 | 612 | ||
592 | funcEqual->addTo(toolbarFunctions); | 613 | funcEqual->addTo(toolbarFunctions); |
593 | funcPlus->addTo(toolbarFunctions); | 614 | funcPlus->addTo(toolbarFunctions); |
594 | funcMinus->addTo(toolbarFunctions); | 615 | funcMinus->addTo(toolbarFunctions); |
595 | funcCross->addTo(toolbarFunctions); | 616 | funcCross->addTo(toolbarFunctions); |
596 | funcDivide->addTo(toolbarFunctions); | 617 | funcDivide->addTo(toolbarFunctions); |
597 | funcParanOpen->addTo(toolbarFunctions); | 618 | funcParanOpen->addTo(toolbarFunctions); |
598 | funcParanClose->addTo(toolbarFunctions); | 619 | funcParanClose->addTo(toolbarFunctions); |
599 | funcComma->addTo(toolbarFunctions); | 620 | funcComma->addTo(toolbarFunctions); |
600 | 621 | ||
601 | toolFunction=new QToolButton(toolbarFunctions); | 622 | toolFunction=new QToolButton(toolbarFunctions); |
602 | toolFunction->setPixmap(Resource::loadPixmap( "opie-sheet/func-func" )); | 623 | toolFunction->setPixmap(Resource::loadPixmap( "opie-sheet/func-func" )); |
603 | toolFunction->setTextLabel(tr("Functions")); | 624 | toolFunction->setTextLabel(tr("Functions")); |
604 | toolFunction->setPopup(submenuFunc); | 625 | toolFunction->setPopup(submenuFunc); |
605 | toolFunction->setPopupDelay(0); | 626 | toolFunction->setPopupDelay(0); |
606 | } | 627 | } |
@@ -609,14 +630,14 @@ void MainWindow::initEditToolbar() | |||
609 | { | 630 | { |
610 | toolbarEdit=new QToolBar(this); | 631 | toolbarEdit=new QToolBar(this); |
611 | toolbarEdit->setHorizontalStretchable(TRUE); | 632 | toolbarEdit->setHorizontalStretchable(TRUE); |
612 | moveToolBar(toolbarEdit, Bottom); | 633 | moveToolBar(toolbarEdit, Bottom); |
613 | 634 | ||
614 | editAccept->addTo(toolbarEdit); | 635 | editAccept->addTo(toolbarEdit); |
615 | editCancel->addTo(toolbarEdit); | 636 | editCancel->addTo(toolbarEdit); |
616 | 637 | ||
617 | editData=new QLineEdit(toolbarEdit); | 638 | editData=new QLineEdit(toolbarEdit); |
618 | toolbarEdit->setStretchableWidget(editData); | 639 | toolbarEdit->setStretchableWidget(editData); |
619 | connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept())); | 640 | connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept())); |
620 | 641 | ||
621 | editCellSelect->addTo(toolbarEdit); | 642 | editCellSelect->addTo(toolbarEdit); |
622 | } | 643 | } |
@@ -625,11 +646,11 @@ void MainWindow::slotHelpAbout() | |||
625 | { | 646 | { |
626 | QDialog dialogAbout(this, 0, TRUE); | 647 | QDialog dialogAbout(this, 0, TRUE); |
627 | dialogAbout.resize(width()-40, height()-80); | 648 | dialogAbout.resize(width()-40, height()-80); |
628 | dialogAbout.setCaption(tr("About Opie Sheet")); | 649 | dialogAbout.setCaption(tr("About Opie Sheet")); |
629 | 650 | ||
630 | QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout); | 651 | QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout); |
631 | label.setGeometry(dialogAbout.rect()); | 652 | label.setGeometry(dialogAbout.rect()); |
632 | label.setAlignment(Qt::AlignCenter | Qt::WordBreak); | 653 | label.setAlignment(Qt::AlignCenter | Qt::WordBreak); |
633 | 654 | ||
634 | dialogAbout.exec(); | 655 | dialogAbout.exec(); |
635 | } | 656 | } |
@@ -638,12 +659,12 @@ void MainWindow::initSheet() | |||
638 | { | 659 | { |
639 | sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this); | 660 | sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this); |
640 | setCentralWidget(sheet); | 661 | setCentralWidget(sheet); |
641 | 662 | ||
642 | connect(sheet, SIGNAL(currentDataChanged(const QString&)), editData, SLOT(setText(const QString&))); | 663 | connect(sheet, SIGNAL(currentDataChanged(const QString&)), editData, SLOT(setText(const QString&))); |
643 | connect(sheet, SIGNAL(cellClicked(const QString&)), this, SLOT(slotCellClicked(const QString&))); | 664 | connect(sheet, SIGNAL(cellClicked(const QString&)), this, SLOT(slotCellClicked(const QString&))); |
644 | connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified())); | 665 | connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified())); |
645 | 666 | ||
646 | connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut())); | 667 | connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut())); |
647 | connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy())); | 668 | connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy())); |
648 | connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear())); | 669 | connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear())); |
649 | } | 670 | } |
@@ -652,3 +673,3 @@ void MainWindow::slotEditAccept() | |||
652 | { | 673 | { |
653 | sheet->setData(editData->text()); | 674 | sheet->setData(editData->text()); |
654 | } | 675 | } |
@@ -657,3 +678,3 @@ void MainWindow::slotEditCancel() | |||
657 | { | 678 | { |
658 | editData->setText(sheet->getData()); | 679 | editData->setText(sheet->getData()); |
659 | } | 680 | } |
@@ -662,3 +683,3 @@ void MainWindow::slotCellSelect(bool lock) | |||
662 | { | 683 | { |
663 | sheet->lockClicks(lock); | 684 | sheet->lockClicks(lock); |
664 | } | 685 | } |
@@ -667,3 +688,3 @@ void MainWindow::addToData(const QString &data) | |||
667 | { | 688 | { |
668 | editData->setText(editData->text().insert(editData->cursorPosition(), data)); | 689 | editData->setText(editData->text().insert(editData->cursorPosition(), data)); |
669 | } | 690 | } |
@@ -672,4 +693,4 @@ void MainWindow::slotFuncOutput() | |||
672 | { | 693 | { |
673 | if (sender()->isA("QAction")) | 694 | if (sender()->isA("QAction")) |
674 | addToData(((QAction *)sender())->toolTip()); | 695 | addToData(((QAction *)sender())->toolTip()); |
675 | } | 696 | } |
@@ -678,5 +699,5 @@ void MainWindow::slotInsertRows() | |||
678 | { | 699 | { |
679 | NumberDialog dialogNumber(this); | 700 | NumberDialog dialogNumber(this); |
680 | if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted) | 701 | if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted) |
681 | sheet->insertRows(dialogNumber.getValue()); | 702 | sheet->insertRows(dialogNumber.getValue()); |
682 | } | 703 | } |
@@ -685,5 +706,5 @@ void MainWindow::slotInsertCols() | |||
685 | { | 706 | { |
686 | NumberDialog dialogNumber(this); | 707 | NumberDialog dialogNumber(this); |
687 | if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted) | 708 | if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted) |
688 | sheet->insertColumns(dialogNumber.getValue()); | 709 | sheet->insertColumns(dialogNumber.getValue()); |
689 | } | 710 | } |
@@ -692,5 +713,5 @@ void MainWindow::slotInsertSheets() | |||
692 | { | 713 | { |
693 | NumberDialog dialogNumber(this); | 714 | NumberDialog dialogNumber(this); |
694 | if (dialogNumber.exec(tr("Add Sheets"), tr("&Number of sheets:"))==QDialog::Accepted) | 715 | if (dialogNumber.exec(tr("Add Sheets"), tr("&Number of sheets:"))==QDialog::Accepted) |
695 | for (int i=dialogNumber.getValue(); i>0; --i) createNewSheet(); | 716 | for (int i=dialogNumber.getValue(); i>0; --i) createNewSheet(); |
696 | } | 717 | } |
@@ -699,4 +720,4 @@ void MainWindow::slotCellClicked(const QString &cell) | |||
699 | { | 720 | { |
700 | editCellSelect->setOn(FALSE); | 721 | editCellSelect->setOn(FALSE); |
701 | addToData(cell); | 722 | addToData(cell); |
702 | } | 723 | } |
@@ -705,16 +726,16 @@ typeSheet *MainWindow::createNewSheet() | |||
705 | { | 726 | { |
706 | typeSheet *newSheet=new typeSheet; | 727 | typeSheet *newSheet=new typeSheet; |
707 | int currentNo=1, tempNo=0; | 728 | int currentNo=1, tempNo=0; |
708 | bool ok; | 729 | bool ok; |
709 | 730 | ||
710 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) | 731 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) |
711 | if (tempSheet->name.startsWith(tr("Sheet")) && (tempNo=tempSheet->name.mid(tr("Sheet").length()).toInt(&ok))>=currentNo && ok) | 732 | if (tempSheet->name.startsWith(tr("Sheet")) && (tempNo=tempSheet->name.mid(tr("Sheet").length()).toInt(&ok))>=currentNo && ok) |
712 | currentNo=tempNo+1; | 733 | currentNo=tempNo+1; |
713 | 734 | ||
714 | newSheet->name=tr("Sheet")+QString::number(currentNo); | 735 | newSheet->name=tr("Sheet")+QString::number(currentNo); |
715 | newSheet->data.setAutoDelete(TRUE); | 736 | newSheet->data.setAutoDelete(TRUE); |
716 | 737 | ||
717 | comboSheets->insertItem(newSheet->name); | 738 | comboSheets->insertItem(newSheet->name); |
718 | listSheets.append(newSheet); | 739 | listSheets.append(newSheet); |
719 | return newSheet; | 740 | return newSheet; |
720 | } | 741 | } |
@@ -723,6 +744,6 @@ typeSheet *MainWindow::findSheet(const QString &name) | |||
723 | { | 744 | { |
724 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) | 745 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) |
725 | if (tempSheet->name==name) | 746 | if (tempSheet->name==name) |
726 | return tempSheet; | 747 | return tempSheet; |
727 | return NULL; | 748 | return NULL; |
728 | } | 749 | } |
@@ -731,6 +752,6 @@ void MainWindow::slotSheetChanged(const QString &name) | |||
731 | { | 752 | { |
732 | sheet->copySheetData(&findSheet(sheet->getName())->data); | 753 | sheet->copySheetData(&findSheet(sheet->getName())->data); |
733 | sheet->setName(name); | 754 | sheet->setName(name); |
734 | sheet->setSheetData(&findSheet(name)->data); | 755 | sheet->setSheetData(&findSheet(name)->data); |
735 | sheet->ReCalc(); | 756 | sheet->ReCalc(); |
736 | } | 757 | } |
@@ -739,6 +760,6 @@ void MainWindow::addFlyAction(const QString &text, const QString &menuText, cons | |||
739 | { | 760 | { |
740 | QAction *action=new QAction(text, menuText, 0, this); | 761 | QAction *action=new QAction(text, menuText, 0, this); |
741 | action->setToolTip(tip); | 762 | action->setToolTip(tip); |
742 | connect(action, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 763 | connect(action, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
743 | action->addTo(w); | 764 | action->addTo(w); |
744 | } | 765 | } |
@@ -747,5 +768,5 @@ void MainWindow::slotFormatCells() | |||
747 | { | 768 | { |
748 | CellFormat dialogCellFormat(this); | 769 | CellFormat dialogCellFormat(this); |
749 | QPEApplication::showDialog( &dialogCellFormat ); | 770 | QPEApplication::showDialog( &dialogCellFormat ); |
750 | dialogCellFormat.exec(sheet); | 771 | dialogCellFormat.exec(sheet); |
751 | } | 772 | } |
@@ -754,3 +775,3 @@ void MainWindow::slotEditPaste() | |||
754 | { | 775 | { |
755 | sheet->editPaste(); | 776 | sheet->editPaste(); |
756 | } | 777 | } |
@@ -759,3 +780,3 @@ void MainWindow::slotEditPasteContents() | |||
759 | { | 780 | { |
760 | sheet->editPaste(TRUE); | 781 | sheet->editPaste(TRUE); |
761 | } | 782 | } |
@@ -764,12 +785,12 @@ void MainWindow::slotRowHeight() | |||
764 | { | 785 | { |
765 | int row1, row2, col1, col2; | 786 | int row1, row2, col1, col2; |
766 | sheet->getSelection(&row1, &col1, &row2, &col2); | 787 | sheet->getSelection(&row1, &col1, &row2, &col2); |
767 | 788 | ||
768 | NumberDialog dialogNumber(this); | 789 | NumberDialog dialogNumber(this); |
769 | if (dialogNumber.exec(tr("Row Height"), tr("&Height of each row:"), sheet->rowHeight(row1))==QDialog::Accepted) | 790 | if (dialogNumber.exec(tr("Row Height"), tr("&Height of each row:"), sheet->rowHeight(row1))==QDialog::Accepted) |
770 | { | 791 | { |
771 | int newHeight=dialogNumber.getValue(), row; | 792 | int newHeight=dialogNumber.getValue(), row; |
772 | for (row=row1; row<=row2; ++row) | 793 | for (row=row1; row<=row2; ++row) |
773 | sheet->setRowHeight(row, newHeight); | 794 | sheet->setRowHeight(row, newHeight); |
774 | } | 795 | } |
775 | } | 796 | } |
@@ -778,7 +799,7 @@ void MainWindow::slotRowAdjust() | |||
778 | { | 799 | { |
779 | int row1, row2, col1, col2; | 800 | int row1, row2, col1, col2; |
780 | sheet->getSelection(&row1, &col1, &row2, &col2); | 801 | sheet->getSelection(&row1, &col1, &row2, &col2); |
781 | 802 | ||
782 | for (int row=row1; row<=row2; ++row) | 803 | for (int row=row1; row<=row2; ++row) |
783 | sheet->adjustRow(row); | 804 | sheet->adjustRow(row); |
784 | } | 805 | } |
@@ -787,7 +808,7 @@ void MainWindow::slotRowShow() | |||
787 | { | 808 | { |
788 | int row1, row2, col1, col2; | 809 | int row1, row2, col1, col2; |
789 | sheet->getSelection(&row1, &col1, &row2, &col2); | 810 | sheet->getSelection(&row1, &col1, &row2, &col2); |
790 | 811 | ||
791 | for (int row=row1; row<=row2; ++row) | 812 | for (int row=row1; row<=row2; ++row) |
792 | sheet->showRow(row); | 813 | sheet->showRow(row); |
793 | } | 814 | } |
@@ -796,7 +817,7 @@ void MainWindow::slotRowHide() | |||
796 | { | 817 | { |
797 | int row1, row2, col1, col2; | 818 | int row1, row2, col1, col2; |
798 | sheet->getSelection(&row1, &col1, &row2, &col2); | 819 | sheet->getSelection(&row1, &col1, &row2, &col2); |
799 | 820 | ||
800 | for (int row=row1; row<=row2; ++row) | 821 | for (int row=row1; row<=row2; ++row) |
801 | sheet->hideRow(row); | 822 | sheet->hideRow(row); |
802 | } | 823 | } |
@@ -805,12 +826,12 @@ void MainWindow::slotColumnWidth() | |||
805 | { | 826 | { |
806 | int row1, row2, col1, col2; | 827 | int row1, row2, col1, col2; |
807 | sheet->getSelection(&row1, &col1, &row2, &col2); | 828 | sheet->getSelection(&row1, &col1, &row2, &col2); |
808 | 829 | ||
809 | NumberDialog dialogNumber(this); | 830 | NumberDialog dialogNumber(this); |
810 | if (dialogNumber.exec(tr("Column Width"), tr("&Width of each column:"), sheet->columnWidth(col1))==QDialog::Accepted) | 831 | if (dialogNumber.exec(tr("Column Width"), tr("&Width of each column:"), sheet->columnWidth(col1))==QDialog::Accepted) |
811 | { | 832 | { |
812 | int newWidth=dialogNumber.getValue(), col; | 833 | int newWidth=dialogNumber.getValue(), col; |
813 | for (col=col1; col<=col2; ++col) | 834 | for (col=col1; col<=col2; ++col) |
814 | sheet->setColumnWidth(col, newWidth); | 835 | sheet->setColumnWidth(col, newWidth); |
815 | } | 836 | } |
816 | } | 837 | } |
@@ -819,7 +840,7 @@ void MainWindow::slotColumnAdjust() | |||
819 | { | 840 | { |
820 | int row1, row2, col1, col2; | 841 | int row1, row2, col1, col2; |
821 | sheet->getSelection(&row1, &col1, &row2, &col2); | 842 | sheet->getSelection(&row1, &col1, &row2, &col2); |
822 | 843 | ||
823 | for (int col=col1; col<=col2; ++col) | 844 | for (int col=col1; col<=col2; ++col) |
824 | sheet->adjustColumn(col); | 845 | sheet->adjustColumn(col); |
825 | } | 846 | } |
@@ -828,7 +849,7 @@ void MainWindow::slotColumnShow() | |||
828 | { | 849 | { |
829 | int row1, row2, col1, col2; | 850 | int row1, row2, col1, col2; |
830 | sheet->getSelection(&row1, &col1, &row2, &col2); | 851 | sheet->getSelection(&row1, &col1, &row2, &col2); |
831 | 852 | ||
832 | for (int col=col1; col<=col2; ++col) | 853 | for (int col=col1; col<=col2; ++col) |
833 | sheet->showColumn(col); | 854 | sheet->showColumn(col); |
834 | } | 855 | } |
@@ -837,7 +858,7 @@ void MainWindow::slotColumnHide() | |||
837 | { | 858 | { |
838 | int row1, row2, col1, col2; | 859 | int row1, row2, col1, col2; |
839 | sheet->getSelection(&row1, &col1, &row2, &col2); | 860 | sheet->getSelection(&row1, &col1, &row2, &col2); |
840 | 861 | ||
841 | for (int col=col1; col<=col2; ++col) | 862 | for (int col=col1; col<=col2; ++col) |
842 | sheet->hideColumn(col); | 863 | sheet->hideColumn(col); |
843 | } | 864 | } |
@@ -846,9 +867,9 @@ void MainWindow::slotFileSaveAs() | |||
846 | { | 867 | { |
847 | TextDialog dialogText(this); | 868 | TextDialog dialogText(this); |
848 | if (dialogText.exec(tr("Save File As"), tr("&File Name:"), currentDoc->name())!=QDialog::Accepted || dialogText.getValue().isEmpty()) return; | 869 | if (dialogText.exec(tr("Save File As"), tr("&File Name:"), currentDoc->name())!=QDialog::Accepted || dialogText.getValue().isEmpty()) return; |
849 | 870 | ||
850 | currentDoc->setName(dialogText.getValue()); | 871 | currentDoc->setName(dialogText.getValue()); |
851 | currentDoc->setFile(QString::null); | 872 | currentDoc->setFile(QString::null); |
852 | currentDoc->setLinkFile(QString::null); | 873 | currentDoc->setLinkFile(QString::null); |
853 | documentSave(currentDoc); | 874 | documentSave(currentDoc); |
854 | } | 875 | } |
@@ -857,60 +878,60 @@ void MainWindow::slotImportExcel(const DocLnk &lnkDoc) | |||
857 | { | 878 | { |
858 | ExcelBook file1; | 879 | ExcelBook file1; |
859 | file1.ParseBook((char *)lnkDoc.file().ascii()); | 880 | file1.ParseBook((char *)lnkDoc.file().ascii()); |
860 | int NumOfSheets=file1.Sheets.count(); | 881 | int NumOfSheets=file1.Sheets.count(); |
861 | printf("OpieSheet::NumberOfSheets:%d\r\n",NumOfSheets); | 882 | printf("OpieSheet::NumberOfSheets:%d\r\n",NumOfSheets); |
862 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; | 883 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; |
863 | if (currentDoc) delete currentDoc; | 884 | if (currentDoc) delete currentDoc; |
864 | currentDoc = new DocLnk(); | 885 | currentDoc = new DocLnk(); |
865 | listSheets.clear(); | 886 | listSheets.clear(); |
866 | comboSheets->clear(); | 887 | comboSheets->clear(); |
867 | int w1,r,c; | 888 | int w1,r,c; |
868 | ExcelSheet* sh1; | 889 | ExcelSheet* sh1; |
869 | typeSheet* newSheet; | 890 | typeSheet* newSheet; |
870 | QString* str; | 891 | QString* str; |
871 | typeCellData* newCell; | 892 | typeCellData* newCell; |
872 | for(w1=1;w1<=NumOfSheets;w1++) | 893 | for(w1=1;w1<=NumOfSheets;w1++) |
873 | { | 894 | { |
874 | sh1=file1.Sheets[w1-1]; | 895 | sh1=file1.Sheets[w1-1]; |
875 | printf("OpieSheet:newSheet:%x,r=%d,c=%d\r\n",sh1,sh1->rows,sh1->cols); | 896 | printf("OpieSheet:newSheet:%x,r=%d,c=%d\r\n",sh1,sh1->rows,sh1->cols); |
876 | newSheet=new typeSheet; | 897 | newSheet=new typeSheet; |
877 | newSheet->data.setAutoDelete(TRUE); | 898 | newSheet->data.setAutoDelete(TRUE); |
878 | newSheet->name=sh1->name; | 899 | newSheet->name=sh1->name; |
879 | printf("OpieSheet:Sheetname:%s\r\n",sh1->name.ascii()); | 900 | printf("OpieSheet:Sheetname:%s\r\n",sh1->name.ascii()); |
880 | comboSheets->insertItem(newSheet->name); | 901 | comboSheets->insertItem(newSheet->name); |
881 | for(r=1; r <= sh1->rows; r++) | 902 | for(r=1; r <= sh1->rows; r++) |
882 | { | 903 | { |
883 | for(c=1;c <= sh1->cols; c++) | 904 | for(c=1;c <= sh1->cols; c++) |
884 | { | 905 | { |
885 | str=file1.CellDataString(sh1,r-1,c-1); | 906 | str=file1.CellDataString(sh1,r-1,c-1); |
886 | if(str!=NULL && r<DEFAULT_NUM_ROWS && c<DEFAULT_NUM_COLS) | 907 | if(str!=NULL && r<DEFAULT_NUM_ROWS && c<DEFAULT_NUM_COLS) |
887 | { | 908 | { |
888 | newCell=new typeCellData; | 909 | newCell=new typeCellData; |
889 | newCell->row=r-1; | 910 | newCell->row=r-1; |
890 | newCell->col=c-1; | 911 | newCell->col=c-1; |
891 | if(str!=NULL) newCell->data=QString(*str); else newCell->data=QString(""); | 912 | if(str!=NULL) newCell->data=QString(*str); else newCell->data=QString(""); |
892 | newCell->background=QBrush(Qt::white, Qt::SolidPattern); | 913 | newCell->background=QBrush(Qt::white, Qt::SolidPattern); |
893 | newCell->alignment=(Qt::AlignmentFlags)(Qt::AlignLeft | Qt::AlignTop); | 914 | newCell->alignment=(Qt::AlignmentFlags)(Qt::AlignLeft | Qt::AlignTop); |
894 | newCell->fontColor=Qt::black; | 915 | newCell->fontColor=Qt::black; |
895 | newCell->font=font(); | 916 | newCell->font=font(); |
896 | newCell->borders.right=QPen(Qt::gray, 1, Qt::SolidLine); | 917 | newCell->borders.right=QPen(Qt::gray, 1, Qt::SolidLine); |
897 | newCell->borders.bottom=QPen(Qt::gray, 1, Qt::SolidLine); | 918 | newCell->borders.bottom=QPen(Qt::gray, 1, Qt::SolidLine); |
898 | newSheet->data.append(newCell); | 919 | newSheet->data.append(newCell); |
899 | //there is no format parsing at the moment or style parsing | 920 | //there is no format parsing at the moment or style parsing |
900 | //printf("OpieSheetNumber:row=%d,col=%d,val=%s\r\n",r,c,str->latin1()); | 921 | //printf("OpieSheetNumber:row=%d,col=%d,val=%s\r\n",r,c,str->latin1()); |
901 | }; | 922 | }; |
902 | }; | 923 | }; |
903 | }; | 924 | }; |
904 | listSheets.append(newSheet); | 925 | listSheets.append(newSheet); |
905 | if (w1==1)//if i==0 link sheet1 with sheetview | 926 | if (w1==1)//if i==0 link sheet1 with sheetview |
906 | { | 927 | { |
907 | sheet->setName(newSheet->name); | 928 | sheet->setName(newSheet->name); |
908 | sheet->setSheetData(&newSheet->data); | 929 | sheet->setSheetData(&newSheet->data); |
909 | sheet->ReCalc(); | 930 | sheet->ReCalc(); |
910 | }; | 931 | }; |
911 | 932 | ||
912 | }; | 933 | }; |
913 | file1.CloseFile(); | 934 | file1.CloseFile(); |
914 | printf("Excel FILE read OK\r\n"); | 935 | printf("Excel FILE read OK\r\n"); |
915 | documentModified=TRUE; | 936 | documentModified=TRUE; |
916 | 937 | ||
@@ -921,22 +942,22 @@ void MainWindow::slotSheetRename() | |||
921 | { | 942 | { |
922 | TextDialog dialogText(this); | 943 | TextDialog dialogText(this); |
923 | if (dialogText.exec(tr("Rename Sheet"), tr("&Sheet Name:"), sheet->getName())!=QDialog::Accepted || dialogText.getValue().isEmpty()) return; | 944 | if (dialogText.exec(tr("Rename Sheet"), tr("&Sheet Name:"), sheet->getName())!=QDialog::Accepted || dialogText.getValue().isEmpty()) return; |
924 | QString newName=dialogText.getValue(); | 945 | QString newName=dialogText.getValue(); |
925 | |||
926 | typeSheet *tempSheet=findSheet(newName); | ||
927 | if (tempSheet) | ||
928 | { | ||
929 | QMessageBox::critical(this, tr("Error"), tr("There is already a sheet named '"+newName+'\'')); | ||
930 | return; | ||
931 | } | ||
932 | 946 | ||
933 | tempSheet=findSheet(sheet->getName()); | 947 | typeSheet *tempSheet=findSheet(newName); |
934 | for (int i=0; i<comboSheets->count(); ++i) | 948 | if (tempSheet) |
935 | if (comboSheets->text(i)==tempSheet->name) | ||
936 | { | 949 | { |
937 | comboSheets->changeItem(newName, i); | 950 | QMessageBox::critical(this, tr("Error"), tr("There is already a sheet named '"+newName+'\'')); |
938 | break; | 951 | return; |
939 | } | 952 | } |
940 | tempSheet->name=newName; | 953 | |
941 | sheet->setName(newName); | 954 | tempSheet=findSheet(sheet->getName()); |
955 | for (int i=0; i<comboSheets->count(); ++i) | ||
956 | if (comboSheets->text(i)==tempSheet->name) | ||
957 | { | ||
958 | comboSheets->changeItem(newName, i); | ||
959 | break; | ||
960 | } | ||
961 | tempSheet->name=newName; | ||
962 | sheet->setName(newName); | ||
942 | } | 963 | } |
@@ -945,20 +966,20 @@ void MainWindow::slotSheetRemove() | |||
945 | { | 966 | { |
946 | if (comboSheets->count()<2) | 967 | if (comboSheets->count()<2) |
947 | { | 968 | { |
948 | QMessageBox::warning(this, tr("Error"), tr("There is only one sheet!")); | 969 | QMessageBox::warning(this, tr("Error"), tr("There is only one sheet!")); |
949 | return; | 970 | return; |
950 | } | 971 | } |
951 | if (QMessageBox::information(this, tr("Remove Sheet"), tr("Are you sure?"), QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes) | 972 | if (QMessageBox::information(this, tr("Remove Sheet"), tr("Are you sure?"), QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes) |
952 | { | 973 | { |
953 | typeSheet *tempSheet=findSheet(sheet->getName()); | 974 | typeSheet *tempSheet=findSheet(sheet->getName()); |
954 | for (int i=0; i<comboSheets->count(); ++i) | 975 | for (int i=0; i<comboSheets->count(); ++i) |
955 | if (comboSheets->text(i)==tempSheet->name) | 976 | if (comboSheets->text(i)==tempSheet->name) |
956 | { | 977 | { |
957 | comboSheets->removeItem(i); | 978 | comboSheets->removeItem(i); |
958 | break; | 979 | break; |
959 | } | 980 | } |
960 | comboSheets->setCurrentItem(0); | 981 | comboSheets->setCurrentItem(0); |
961 | slotSheetChanged(comboSheets->currentText()); | 982 | slotSheetChanged(comboSheets->currentText()); |
962 | listSheets.remove(tempSheet); | 983 | listSheets.remove(tempSheet); |
963 | } | 984 | } |
964 | } | 985 | } |
@@ -967,5 +988,5 @@ void MainWindow::slotDataSort() | |||
967 | { | 988 | { |
968 | SortDialog dialogSort(this); | 989 | SortDialog dialogSort(this); |
969 | QPEApplication::showDialog( &dialogSort ); | 990 | QPEApplication::showDialog( &dialogSort ); |
970 | dialogSort.exec(sheet); | 991 | dialogSort.exec(sheet); |
971 | } | 992 | } |
@@ -974,3 +995,3 @@ void MainWindow::slotDocModified() | |||
974 | { | 995 | { |
975 | documentModified=TRUE; | 996 | documentModified=TRUE; |
976 | } | 997 | } |
@@ -979,22 +1000,22 @@ void MainWindow::slotInsertCells() | |||
979 | { | 1000 | { |
980 | QDialog dialogInsert(this, 0, TRUE); | 1001 | QDialog dialogInsert(this, 0, TRUE); |
981 | dialogInsert.resize(180, 130); | 1002 | dialogInsert.resize(180, 130); |
982 | dialogInsert.setCaption(tr("Insert Cells")); | 1003 | dialogInsert.setCaption(tr("Insert Cells")); |
983 | 1004 | ||
984 | QVButtonGroup *group=new QVButtonGroup(tr("&Type"), &dialogInsert); | 1005 | QVButtonGroup *group=new QVButtonGroup(tr("&Type"), &dialogInsert); |
985 | group->setGeometry(10, 10, 160, 110); | 1006 | group->setGeometry(10, 10, 160, 110); |
986 | QRadioButton *radio=new QRadioButton(tr("Shift cells &down"), group); | 1007 | QRadioButton *radio=new QRadioButton(tr("Shift cells &down"), group); |
987 | radio=new QRadioButton(tr("Shift cells &right"), group); | 1008 | radio=new QRadioButton(tr("Shift cells &right"), group); |
988 | radio=new QRadioButton(tr("Entire ro&w"), group); | 1009 | radio=new QRadioButton(tr("Entire ro&w"), group); |
989 | radio=new QRadioButton(tr("Entire &column"), group); | 1010 | radio=new QRadioButton(tr("Entire &column"), group); |
990 | group->setButton(0); | 1011 | group->setButton(0); |
991 | 1012 | ||
992 | if (dialogInsert.exec()==QDialog::Accepted) | 1013 | if (dialogInsert.exec()==QDialog::Accepted) |
993 | switch (group->id(group->selected())) | 1014 | switch (group->id(group->selected())) |
994 | { | 1015 | { |
995 | case 0: sheet->insertRows(1, FALSE); break; | 1016 | case 0: sheet->insertRows(1, FALSE); break; |
996 | case 1: sheet->insertColumns(1, FALSE); break; | 1017 | case 1: sheet->insertColumns(1, FALSE); break; |
997 | case 2: sheet->insertRows(1, TRUE); break; | 1018 | case 2: sheet->insertRows(1, TRUE); break; |
998 | case 3: sheet->insertColumns(1, TRUE); break; | 1019 | case 3: sheet->insertColumns(1, TRUE); break; |
999 | } | 1020 | } |
1000 | } | 1021 | } |
@@ -1003,5 +1024,5 @@ void MainWindow::slotDataFindReplace() | |||
1003 | { | 1024 | { |
1004 | FindDialog dialogFind(this); | 1025 | FindDialog dialogFind(this); |
1005 | QPEApplication::showDialog( &dialogFind ); | 1026 | QPEApplication::showDialog( &dialogFind ); |
1006 | dialogFind.exec(sheet); | 1027 | dialogFind.exec(sheet); |
1007 | } | 1028 | } |