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