summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/cell-select.xpm25
-rw-r--r--noncore/apps/opie-sheet/excel16.xpm187
-rw-r--r--noncore/apps/opie-sheet/func-comma.xpm24
-rw-r--r--noncore/apps/opie-sheet/func-cross.xpm23
-rw-r--r--noncore/apps/opie-sheet/func-divide.xpm23
-rw-r--r--noncore/apps/opie-sheet/func-equal.xpm23
-rw-r--r--noncore/apps/opie-sheet/func-func.xpm23
-rw-r--r--noncore/apps/opie-sheet/func-minus.xpm23
-rw-r--r--noncore/apps/opie-sheet/func-paran-close.xpm24
-rw-r--r--noncore/apps/opie-sheet/func-paran-open.xpm24
-rw-r--r--noncore/apps/opie-sheet/func-plus.xpm23
-rw-r--r--noncore/apps/opie-sheet/mainwindow.cpp35
12 files changed, 11 insertions, 446 deletions
diff --git a/noncore/apps/opie-sheet/cell-select.xpm b/noncore/apps/opie-sheet/cell-select.xpm
deleted file mode 100644
index 4836c02..0000000
--- a/noncore/apps/opie-sheet/cell-select.xpm
+++ b/dev/null
@@ -1,25 +0,0 @@
-/* XPM */
-static const char *cell_select_xpm[]={
-"16 16 6 1",
-"# c None",
-"c c #0058c0",
-". c #585858",
-"b c #58a8ff",
-"a c #a8dcff",
-"d c #c0ffff",
-".###############",
-".#####...#######",
-"#...#.aab.######",
-"###..acaaa.#####",
-"###.aaacabc.####",
-"##.acaaaccab.###",
-"#.caacabbaaa.###",
-"#.ccaacbaaaaa.##",
-"#.bacbcaaaadaa.#",
-"##.bacbaaaddda.#",
-"###.bacaaaadaa.#",
-"####.bacaaaaac.#",
-"#####.bacaaacb.#",
-"######.bacccb.##",
-"#######.babb.###",
-"########....####"};
diff --git a/noncore/apps/opie-sheet/excel16.xpm b/noncore/apps/opie-sheet/excel16.xpm
deleted file mode 100644
index 45dd96d..0000000
--- a/noncore/apps/opie-sheet/excel16.xpm
+++ b/dev/null
@@ -1,187 +0,0 @@
-/* XPM */
-static const char *excel16_xpm[]={
-"16 16 168 2",
-"aL c None",
-"Qt c None",
-"aK c #24440a",
-"#y c #247d21",
-"#B c #276d1e",
-"aw c #284a0d",
-"au c #2b4e10",
-"#P c #2c6e1a",
-"ag c #2d5114",
-"ad c #2e541a",
-"af c #304326",
-"#2 c #317a1c",
-"ae c #334f25",
-"#5 c #335919",
-"#F c #375d1f",
-"#O c #3a872f",
-"#t c #3d6324",
-"ac c #3d7939",
-"#Y c #3e7132",
-"#p c #407f39",
-"#Z c #42903e",
-"#i c #436d28",
-".9 c #446e2a",
-"aJ c #466628",
-"av c #476430",
-"aI c #476829",
-".W c #47732d",
-"#K c #479643",
-"#1 c #48872e",
-"aH c #496b2d",
-".6 c #4a8a49",
-"aG c #4b6e31",
-".z c #4b7832",
-"#L c #4d9647",
-"aF c #4e7336",
-"aE c #52783b",
-".m c #527a3e",
-"#x c #529c4f",
-"#N c #549c4b",
-"aD c #567a3f",
-"#V c #579342",
-"#X c #588649",
-"aC c #598041",
-".T c #598955",
-"#A c #59a354",
-"#W c #5a8f48",
-"aB c #5d8745",
-"ax c #5d914d",
-"#o c #5ea657",
-"#C c #5f8755",
-"aA c #5f8947",
-".5 c #5f9f5a",
-"#e c #60965b",
-"#f c #609c5b",
-"az c #618b4a",
-".l c #629450",
-"ay c #679350",
-".k c #689854",
-"#U c #69a15f",
-"ah c #6c9c59",
-"#d c #6cae66",
-".R c #6da767",
-".S c #6ea564",
-"#n c #6eaf67",
-".3 c #6fad69",
-"#0 c #6fb067",
-".j c #719f5f",
-"ab c #729a6b",
-"#6 c #72a161",
-".2 c #74a270",
-"#J c #75b56d",
-".i c #76a366",
-"#l c #77ae74",
-"#M c #78b570",
-"#I c #79b176",
-".4 c #79b870",
-"#S c #7ba66b",
-".N c #7bb374",
-".h c #7da970",
-".1 c #7fbd76",
-"#G c #81ab74",
-"#c c #81bb78",
-".M c #83bb7b",
-"aa c #869782",
-".g c #86b079",
-"a# c #879783",
-"a. c #889885",
-"#u c #88b279",
-"#9 c #899886",
-".U c #89b188",
-".L c #89c081",
-".O c #8ab485",
-".0 c #8ac381",
-".f c #8eb580",
-"#j c #8eb680",
-".y c #91a483",
-"#m c #91c28a",
-"#. c #92b885",
-"#8 c #93ae91",
-".e c #93ba87",
-"#3 c #93be91",
-"at c #94a089",
-"#4 c #96a18b",
-"#z c #96c78d",
-".# c #97bc8a",
-"#D c #99b598",
-"#Q c #9abb99",
-"#R c #9ba890",
-".d c #9bbf90",
-"#E c #9ca991",
-"#s c #9ca992",
-"#b c #9dc895",
-"#h c #9fac95",
-".c c #9fc294",
-"#a c #a0c99b",
-".8 c #a2b198",
-".V c #a3b199",
-".b c #a4c699",
-".K c #a5b29b",
-".Z c #a6cf9f",
-".Y c #a7cda1",
-".a c #a9c99e",
-".n c #acc4a3",
-".x c #b2c3aa",
-"ai c #b4c4ab",
-".w c #b6c7ad",
-"#7 c #b7c7ae",
-".v c #b9cab1",
-"#T c #bbcab3",
-".u c #bbcbb3",
-".Q c #bbd0ba",
-"#H c #bccbb4",
-".t c #beceb7",
-".s c #c0d1ba",
-"#k c #c1d1bb",
-".r c #c2d1bc",
-"## c #c2d2bc",
-".X c #c4d5be",
-".q c #c6d9c1",
-".p c #c8d9c2",
-".o c #c9dac3",
-"#q c #cdddcd",
-"as c #d3e3d3",
-"ar c #d4e4d4",
-"aq c #d7e6d7",
-"ap c #d8e7d9",
-"ao c #dae9db",
-".7 c #dce8db",
-"#r c #dce9dc",
-"an c #ddebdd",
-"#g c #dfecdf",
-"am c #e1ede0",
-"al c #e3ede3",
-"#w c #e5efe5",
-"ak c #e6efe6",
-".J c #e7f0e7",
-"aj c #e8f0e8",
-".I c #eaf2ea",
-".P c #ebf3eb",
-".H c #ecf4ec",
-".G c #f0f5f0",
-".F c #f2f7f2",
-"#v c #f3f7f3",
-".E c #f4f8f4",
-".D c #f7f9f6",
-".C c #f9fbf8",
-".B c #fafcfa",
-".A c #fcfdfc",
-"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
-"Qt.#.a.b.c.d.e.f.g.h.i.j.k.l.mQt",
-"Qt.a.n.o.p.q.r.s.t.u.v.w.x.y.zQt",
-"Qt.b.o.A.B.C.D.E.F.G.H.I.J.K.zQt",
-"Qt.c.p.L.M.N.O.P.Q.R.S.T.U.V.WQt",
-"Qt.d.X.Y.Z.0.1.2.3.4.5.6.7.8.9Qt",
-"Qt#.##.D#a#b#c#d#e#f.6.7#g#h#iQt",
-"Qt#j#k.E.F#l#m#n#o#p#q#g#r#s#tQt",
-"Qt#u.s#v#w#x#y#z#A#A#B#C#D#E#FQt",
-"Qt#G#H.P#I#J#K#L#M#N#O#P#Q#R#FQt",
-"Qt#S#T#U#V#W#X#Y#Z#0#1#2#3#4#5Qt",
-"Qt#6#7#8#9a.a#aaabacadaeaf#4agQt",
-"QtahaiajakalamanaoapaqarasatauQt",
-"Qt.kavavavavavavavavavavavavawQt",
-"QtaxayazaAaBaCaDaEaFaGaHaIaJaKQt",
-"aLaLaLaLaLaLaLaLaLaLaLaLaLaLaLaL"};
diff --git a/noncore/apps/opie-sheet/func-comma.xpm b/noncore/apps/opie-sheet/func-comma.xpm
deleted file mode 100644
index 2e680d2..0000000
--- a/noncore/apps/opie-sheet/func-comma.xpm
+++ b/dev/null
@@ -1,24 +0,0 @@
-/* XPM */
-static const char *func_comma_xpm[]={
-"16 16 5 1",
-". c None",
-"# c #000000",
-"a c #0000ff",
-"b c #0058c0",
-"c c #0080ff",
-"................",
-"................",
-"................",
-"......###.......",
-".....#aaa#......",
-".....#bcca#.....",
-".....#bbaa#.....",
-"......##ba#.....",
-"........#b#.....",
-"........#b#.....",
-".......#b#......",
-"......#b#.......",
-"......##........",
-"................",
-"................",
-"................"};
diff --git a/noncore/apps/opie-sheet/func-cross.xpm b/noncore/apps/opie-sheet/func-cross.xpm
deleted file mode 100644
index 3b3f3d5..0000000
--- a/noncore/apps/opie-sheet/func-cross.xpm
+++ b/dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static const char *func_cross_xpm[]={
-"16 16 4 1",
-". c None",
-"b c #0000ff",
-"a c #0058c0",
-"# c #585858",
-"................",
-"................",
-"....#......##...",
-"...#a#....#ab#..",
-"..#bba#..#abb#..",
-"...#bba##abb#...",
-"....#bbaabb#....",
-".....#bbbb#.....",
-".....#bbbb#.....",
-"....#bbaabb#....",
-"...#bba##abb#...",
-"..#bba#..#abb#..",
-"..#ba#....#a#...",
-"...##......#....",
-"................",
-"................"};
diff --git a/noncore/apps/opie-sheet/func-divide.xpm b/noncore/apps/opie-sheet/func-divide.xpm
deleted file mode 100644
index beb3473..0000000
--- a/noncore/apps/opie-sheet/func-divide.xpm
+++ b/dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static const char *func_divide_xpm[]={
-"16 16 4 1",
-". c None",
-"# c #000000",
-"b c #0000ff",
-"a c #0058c0",
-"................",
-"................",
-"...........##...",
-"..........#ab#..",
-".........#aba#..",
-"........#bba#...",
-".......#bba#....",
-"......#bba#.....",
-".....#abb#......",
-"....#abb#.......",
-"...#abb#........",
-"..#aba#.........",
-"..#ba#..........",
-"...##...........",
-"................",
-"................"};
diff --git a/noncore/apps/opie-sheet/func-equal.xpm b/noncore/apps/opie-sheet/func-equal.xpm
deleted file mode 100644
index 8f34895..0000000
--- a/noncore/apps/opie-sheet/func-equal.xpm
+++ b/dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static const char *func_equal_xpm[]={
-"16 16 4 1",
-". c None",
-"b c #0000ff",
-"a c #0058c0",
-"# c #585858",
-"................",
-"................",
-"................",
-"...##########...",
-"..#aaabbbbaaa#..",
-"..#bbbbbbbbbb#..",
-"..############..",
-"................",
-"................",
-"..############..",
-"..#bbbbbbbbbb#..",
-"..#aaabbbbaaa#..",
-"...##########...",
-"................",
-"................",
-"................"};
diff --git a/noncore/apps/opie-sheet/func-func.xpm b/noncore/apps/opie-sheet/func-func.xpm
deleted file mode 100644
index b9ec747..0000000
--- a/noncore/apps/opie-sheet/func-func.xpm
+++ b/dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static const char *func_func_xpm[]={
-"16 16 4 1",
-". c None",
-"a c #0000ff",
-"b c #0058c0",
-"# c #585858",
-"................",
-".........#ab....",
-".......#aa##....",
-".......ab#......",
-".......ab#......",
-"......#a#.......",
-"....#aaaa#......",
-"....bbabbb......",
-"....##ab#a#.ba..",
-".....aa##baba#..",
-".....ab#.#ba#...",
-".....ab#.baba...",
-"....#a#.ba##ba..",
-"....ab#..#..#b..",
-"...#a#..........",
-"................"};
diff --git a/noncore/apps/opie-sheet/func-minus.xpm b/noncore/apps/opie-sheet/func-minus.xpm
deleted file mode 100644
index b747bd7..0000000
--- a/noncore/apps/opie-sheet/func-minus.xpm
+++ b/dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static const char *func_minus_xpm[]={
-"16 16 4 1",
-". c None",
-"a c #0000ff",
-"b c #0058c0",
-"# c #585858",
-"................",
-"................",
-"................",
-"................",
-"................",
-"................",
-"...##########...",
-"...#aaaaaabb#...",
-"...#bbaaaaaa#...",
-"...##########...",
-"................",
-"................",
-"................",
-"................",
-"................",
-"................"};
diff --git a/noncore/apps/opie-sheet/func-paran-close.xpm b/noncore/apps/opie-sheet/func-paran-close.xpm
deleted file mode 100644
index 1e9994c..0000000
--- a/noncore/apps/opie-sheet/func-paran-close.xpm
+++ b/dev/null
@@ -1,24 +0,0 @@
-/* XPM */
-static const char *func_paran_close_xpm[]={
-"16 16 5 1",
-"c c None",
-". c None",
-"b c #0000ff",
-"# c #0058c0",
-"a c #585858",
-"......#a........",
-"......#baa......",
-".......#bba.....",
-"........#b#.....",
-"........c##a....",
-"........c#ba....",
-"........c#ba....",
-"........c#ba....",
-"........c#ba....",
-"........c#ba....",
-"........#b#a....",
-".......abb#.....",
-".......#bba.....",
-"......#baa......",
-"......#a........",
-"................"};
diff --git a/noncore/apps/opie-sheet/func-paran-open.xpm b/noncore/apps/opie-sheet/func-paran-open.xpm
deleted file mode 100644
index ace24b0..0000000
--- a/noncore/apps/opie-sheet/func-paran-open.xpm
+++ b/dev/null
@@ -1,24 +0,0 @@
-/* XPM */
-static const char *func_paran_open_xpm[]={
-"16 16 5 1",
-"c c None",
-". c None",
-"b c #0000ff",
-"a c #0058c0",
-"# c #585858",
-"........#a......",
-"......##ba......",
-".....#bba.......",
-".....aba........",
-"....#aacc.......",
-"....#bacc.......",
-"....#bacc.......",
-"....#bacc.......",
-"....#bac........",
-"....#bac........",
-"....#aac........",
-".....abbc.......",
-".....#bba.......",
-"......##bac.....",
-"........#ac.....",
-"..........c....."};
diff --git a/noncore/apps/opie-sheet/func-plus.xpm b/noncore/apps/opie-sheet/func-plus.xpm
deleted file mode 100644
index c779f23..0000000
--- a/noncore/apps/opie-sheet/func-plus.xpm
+++ b/dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static const char *func_plus_xpm[]={
-"16 16 4 1",
-". c None",
-"a c #0000ff",
-"b c #0058c0",
-"# c #585858",
-"................",
-"................",
-"......####......",
-"......#ab#......",
-"......#ab#......",
-"......#ab#......",
-"..####babb####..",
-"..#aaaaaabbbb#..",
-"..#bbbbaaaaaa#..",
-"..####bbab####..",
-"......#ba#......",
-"......#ba#......",
-"......#ba#......",
-"......####......",
-"................",
-"................"};
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp
index a725e31..d47a570 100644
--- a/noncore/apps/opie-sheet/mainwindow.cpp
+++ b/noncore/apps/opie-sheet/mainwindow.cpp
@@ -1,744 +1,731 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/*
* Opie Sheet (formerly Sheet/Qt)
* by Serdar Ozler <sozler@sitebest.com>
*/
#include "mainwindow.h"
#include <qpe/filemanager.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/resource.h>
#include <qmessagebox.h>
#include <qfile.h>
#include <qtranslator.h>
#include <qradiobutton.h>
#include "cellformat.h"
#include "numberdlg.h"
#include "textdlg.h"
#include "sortdlg.h"
#include "finddlg.h"
-
-#include "func-plus.xpm"
-#include "func-minus.xpm"
-#include "func-cross.xpm"
-#include "func-divide.xpm"
-#include "func-paran-open.xpm"
-#include "func-paran-close.xpm"
-#include "func-comma.xpm"
-#include "func-func.xpm"
-#include "func-equal.xpm"
-#include "cell-select.xpm"
-#include "excel16.xpm"
-
#define DEFAULT_NUM_ROWS 300
#define DEFAULT_NUM_COLS (26*3)
#define DEFAULT_NUM_SHEETS 3
MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl)
:QMainWindow(parent, n, fl)
{
// initialize variables
documentModified=FALSE;
// construct objects
currentDoc=0;
fileSelector=new FileSelector("application/sheet-qt", this, QString::null);
ExcelSelector=new FileSelector("application/excel",this,QString::null,FALSE);
connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide()));
connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &)));
connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &)));
connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk &)),this,SLOT(slotImportExcel(const DocLnk &)));
connect(ExcelSelector,SIGNAL(closeMe()), this, SLOT(ExcelSelectorHide()));
listSheets.setAutoDelete(TRUE);
initActions();
initMenu();
initEditToolbar();
initFunctionsToolbar();
initStandardToolbar();
initSheet();
// set window title
setCaption(tr("Opie Sheet"));
// create sheets
selectorFileNew(DocLnk());
}
MainWindow::~MainWindow()
{
if (currentDoc) delete currentDoc;
}
void MainWindow::documentSave(DocLnk *lnkDoc)
{
FileManager fm;
QByteArray streamBuffer;
QDataStream stream(streamBuffer, IO_WriteOnly);
typeSheet *currentSheet=findSheet(sheet->getName());
if (!currentSheet)
{
QMessageBox::critical(this, tr("Error"), tr("Inconsistency error!"));
return;
}
sheet->copySheetData(&currentSheet->data);
stream.writeRawBytes("SQT100", 6);
stream << (Q_UINT32)listSheets.count();
for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next())
{
stream << tempSheet->name << (Q_UINT32)tempSheet->data.count();
for (typeCellData *tempCell=tempSheet->data.first(); tempCell; tempCell=tempSheet->data.next())
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;
}
lnkDoc->setType("application/sheet-qt");
if (!fm.saveFile(*lnkDoc, streamBuffer))
{
QMessageBox::critical(this, tr("Error"), tr("File cannot be saved!"));
return;
}
documentModified=FALSE;
}
void MainWindow::documentOpen(const DocLnk &lnkDoc)
{
FileManager fm;
QByteArray streamBuffer;
if (!lnkDoc.isValid() || !fm.loadFile(lnkDoc, streamBuffer))
{
QMessageBox::critical(this, tr("Error"), tr("File cannot be opened!"));
documentModified=FALSE;
selectorFileNew(DocLnk());
return;
}
QDataStream stream(streamBuffer, IO_ReadOnly);
Q_UINT32 countSheet, countCell, i, j, row, col, alignment;
typeSheet *newSheet;
typeCellData *newCell;
char fileFormat[7];
stream.readRawBytes(fileFormat, 6);
fileFormat[6]=0;
if ((QString)fileFormat!="SQT100")
{
QMessageBox::critical(this, tr("Error"), tr("Invalid file format!"));
documentModified=FALSE;
selectorFileNew(DocLnk());
return;
}
stream >> countSheet;
for (i=0; i<countSheet; ++i)
{
newSheet=new typeSheet;
newSheet->data.setAutoDelete(TRUE);
stream >> newSheet->name >> countCell;
comboSheets->insertItem(newSheet->name);
for (j=0; j<countCell; ++j)
{
newCell=new typeCellData;
stream >> col >> row >> newCell->borders.right >> newCell->borders.bottom >> newCell->background >> alignment >> newCell->fontColor >> newCell->font >> newCell->data;
newCell->col=col;
newCell->row=row;
newCell->alignment=(Qt::AlignmentFlags)alignment;
newSheet->data.append(newCell);
}
listSheets.append(newSheet);
if (i==0)
{
sheet->setName(newSheet->name);
sheet->setSheetData(&newSheet->data);
}
}
}
int MainWindow::saveCurrentFile(bool ask)
{
if (ask)
{
int result=QMessageBox::information(this, tr("Save File"), tr("Do you want to save the current file?"), QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel);
if (result!=QMessageBox::Yes) return result;
}
if (!currentDoc->isValid())
{
TextDialog dialogText(this);
if (dialogText.exec(tr("Save File"), tr("&File Name:"), tr("UnnamedFile"))!=QDialog::Accepted || dialogText.getValue().isEmpty()) return QMessageBox::Cancel;
currentDoc->setName(dialogText.getValue());
currentDoc->setFile(QString::null);
currentDoc->setLinkFile(QString::null);
}
documentSave(currentDoc);
return QMessageBox::Yes;
}
void MainWindow::selectorFileNew(const DocLnk &lnkDoc)
{
selectorHide();
if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return;
if (currentDoc) delete currentDoc;
currentDoc = new DocLnk(lnkDoc);
editData->clear();
listSheets.clear();
comboSheets->clear();
typeSheet *newSheet=createNewSheet();
newSheet->data.setAutoDelete(TRUE);
sheet->setName(newSheet->name);
sheet->setSheetData(&newSheet->data);
for (int i=1; i<DEFAULT_NUM_SHEETS; ++i)
createNewSheet();
documentModified=FALSE;
}
void MainWindow::closeEvent(QCloseEvent *e)
{
if (documentModified && saveCurrentFile()==QMessageBox::Cancel) e->ignore();
else e->accept();
}
void MainWindow::selectorFileOpen(const DocLnk &lnkDoc)
{
selectorHide();
if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return;
if (currentDoc) delete currentDoc;
currentDoc = new DocLnk();
listSheets.clear();
comboSheets->clear();
documentOpen(lnkDoc);
documentModified=FALSE;
}
void MainWindow::selectorShow()
{
sheet->hide();
setCentralWidget(fileSelector);
fileSelector->show();
fileSelector->reread();
}
void MainWindow::selectorHide()
{
fileSelector->hide();
setCentralWidget(sheet);
sheet->show();
}
void MainWindow::slotFileNew()
{
selectorFileNew(DocLnk());
}
void MainWindow::slotFileOpen()
{
selectorShow();
}
void MainWindow::slotImportExcelOpen()
{
sheet->hide();
setCentralWidget(ExcelSelector);
ExcelSelector->show();
ExcelSelector->reread();
}
void MainWindow::ExcelSelectorHide()
{
ExcelSelector->hide();
setCentralWidget(sheet);
sheet->show();
}
void MainWindow::slotFileSave()
{
saveCurrentFile(FALSE);
}
void MainWindow::setDocument(const QString &applnk_filename)
{
selectorFileOpen(DocLnk(applnk_filename));
}
void MainWindow::initActions()
{
fileNew=new QAction(tr("New File"), Resource::loadPixmap( "new" ), tr("&New"), 0, this);
connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew()));
fileOpen=new QAction(tr("Open File"), Resource::loadPixmap( "fileopen" ), tr("&Open"), 0, this);
connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen()));
fileSave=new QAction(tr("Save File"),Resource::loadPixmap( "save" ), tr("&Save"), 0, this);
connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave()));
fileSaveAs=new QAction(tr("Save File As"), Resource::loadPixmap( "save" ), tr("Save &As"), 0, this);
connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs()));
//fileQuit=new QAction(tr("Quit"), tr("&Quit"), 0, this);
//connect(fileQuit, SIGNAL(activated()), this, SLOT(close()));
- fileExcelImport=new QAction(tr("Import Excel file"),QPixmap(excel16_xpm),tr("Import E&xcel file"),0,this);
+ fileExcelImport=new QAction(tr("Import Excel file"),Resource::loadPixmap( "/opie-sheet/excel16" ),tr("Import E&xcel file"),0,this);
connect(fileExcelImport, SIGNAL(activated()), this, SLOT(slotImportExcelOpen()));
// helpGeneral=new QAction(tr("General Help"), QPixmap(help_general_xpm), tr("&General"), 0, this);
//connect(helpGeneral, SIGNAL(activated()), this, SLOT(slotHelpGeneral()));
//helpAbout=new QAction(tr("About Opie Sheet"), tr("&About"), 0, this);
//connect(helpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout()));
editAccept=new QAction(tr("Accept"),Resource::loadPixmap( "enter" ) , tr("&Accept"), 0, this);
connect(editAccept, SIGNAL(activated()), this, SLOT(slotEditAccept()));
editCancel=new QAction(tr("Cancel"), Resource::loadPixmap( "close" ), tr("&Cancel"), 0, this);
connect(editCancel, SIGNAL(activated()), this, SLOT(slotEditCancel()));
- editCellSelect=new QAction(tr("Cell Selector"), QPixmap(cell_select_xpm), tr("Cell &Selector"), 0, this);
+ editCellSelect=new QAction(tr("Cell Selector"), Resource::loadPixmap( "opie-sheet/cell_select" ), tr("Cell &Selector"), 0, this);
editCellSelect->setToggleAction(TRUE);
connect(editCellSelect, SIGNAL(toggled(bool)), this, SLOT(slotCellSelect(bool)));
editCut=new QAction(tr("Cut Cells"), tr("Cu&t"), 0, this);
editCopy=new QAction(tr("Copy Cells"), tr("&Copy"), 0, this);
editPaste=new QAction(tr("Paste Cells"), tr("&Paste"), 0, this);
connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste()));
editPasteContents=new QAction(tr("Paste Contents"), tr("Paste Cont&ents"), 0, this);
connect(editPasteContents, SIGNAL(activated()), this, SLOT(slotEditPasteContents()));
editClear=new QAction(tr("Clear Cells"), tr("C&lear"), 0, this);
insertCells=new QAction(tr("Insert Cells"), tr("C&ells"), 0, this);
connect(insertCells, SIGNAL(activated()), this, SLOT(slotInsertCells()));
insertRows=new QAction(tr("Insert Rows"), tr("&Rows"), 0, this);
connect(insertRows, SIGNAL(activated()), this, SLOT(slotInsertRows()));
insertCols=new QAction(tr("Insert Columns"), tr("&Columns"), 0, this);
connect(insertCols, SIGNAL(activated()), this, SLOT(slotInsertCols()));
insertSheets=new QAction(tr("Add Sheets"), tr("&Sheets"), 0, this);
connect(insertSheets, SIGNAL(activated()), this, SLOT(slotInsertSheets()));
formatCells=new QAction(tr("Cells"), tr("&Cells"), 0, this);
connect(formatCells, SIGNAL(activated()), this, SLOT(slotFormatCells()));
rowHeight=new QAction(tr("Row Height"), tr("H&eight"), 0, this);
connect(rowHeight, SIGNAL(activated()), this, SLOT(slotRowHeight()));
rowAdjust=new QAction(tr("Adjust Row"), tr("&Adjust"), 0, this);
connect(rowAdjust, SIGNAL(activated()), this, SLOT(slotRowAdjust()));
rowShow=new QAction(tr("Show Row"), tr("&Show"), 0, this);
connect(rowShow, SIGNAL(activated()), this, SLOT(slotRowShow()));
rowHide=new QAction(tr("Hide Row"), tr("&Hide"), 0, this);
connect(rowHide, SIGNAL(activated()), this, SLOT(slotRowHide()));
colWidth=new QAction(tr("Column Width"), tr("&Width"), 0, this);
connect(colWidth, SIGNAL(activated()), this, SLOT(slotColumnWidth()));
colAdjust=new QAction(tr("Adjust Column"), tr("&Adjust"), 0, this);
connect(colAdjust, SIGNAL(activated()), this, SLOT(slotColumnAdjust()));
colShow=new QAction(tr("Show Column"), tr("&Show"), 0, this);
connect(colShow, SIGNAL(activated()), this, SLOT(slotColumnShow()));
colHide=new QAction(tr("Hide Column"), tr("&Hide"), 0, this);
connect(colHide, SIGNAL(activated()), this, SLOT(slotColumnHide()));
sheetRename=new QAction(tr("Rename Sheet"), tr("&Rename"), 0, this);
connect(sheetRename, SIGNAL(activated()), this, SLOT(slotSheetRename()));
sheetRemove=new QAction(tr("Remove Sheet"), tr("R&emove"), 0, this);
connect(sheetRemove, SIGNAL(activated()), this, SLOT(slotSheetRemove()));
dataSort=new QAction(tr("Sort Data"), tr("&Sort"), 0, this);
connect(dataSort, SIGNAL(activated()), this, SLOT(slotDataSort()));
dataFindReplace=new QAction(tr("Find && Replace"), tr("&Find && Replace"), 0, this);
connect(dataFindReplace, SIGNAL(activated()), this, SLOT(slotDataFindReplace()));
- funcEqual=new QAction(tr("Equal To"), QPixmap(func_equal_xpm), tr("&Equal To"), 0, this);
+ funcEqual=new QAction(tr("Equal To"), Resource::loadPixmap( "opie-sheet/func_equal" ), tr("&Equal To"), 0, this);
funcEqual->setToolTip("=");
connect(funcEqual, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
- funcPlus=new QAction(tr("Addition"), QPixmap(func_plus_xpm), tr("&Addition"), 0, this);
+ funcPlus=new QAction(tr("Addition"), Resource::loadPixmap( "opie-sheet/func_plus" ), tr("&Addition"), 0, this);
funcPlus->setToolTip("+");
connect(funcPlus, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
- funcMinus=new QAction(tr("Subtraction"), QPixmap(func_minus_xpm), tr("&Subtraction"), 0, this);
+ funcMinus=new QAction(tr("Subtraction"), Resource::loadPixmap( "opie-sheet/func_minus" ), tr("&Subtraction"), 0, this);
funcMinus->setToolTip("-");
connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
- funcCross=new QAction(tr("Multiplication"), QPixmap(func_cross_xpm), tr("&Multiplication"), 0, this);
+ funcCross=new QAction(tr("Multiplication"), Resource::loadPixmap ("opie-sheet/func_cross" ), tr("&Multiplication"), 0, this);
funcCross->setToolTip("*");
connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
- funcDivide=new QAction(tr("Division"), QPixmap(func_divide_xpm), tr("&Division"), 0, this);
+ funcDivide=new QAction(tr("Division"), Resource::loadPixmap( "opie-sheet/func_divide" ), tr("&Division"), 0, this);
funcDivide->setToolTip("/");
connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
- funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), QPixmap(func_paran_open_xpm), tr("&Open Paranthesis"), 0, this);
+ funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), Resource::loadPixmap( "opie-sheet/func_paran_open" ), tr("&Open Paranthesis"), 0, this);
funcParanOpen->setToolTip("(");
connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
- funcParanClose=new QAction(tr("Close Paranthesis"), QPixmap(func_paran_close_xpm), tr("&Close Paranthesis"), 0, this);
+ funcParanClose=new QAction(tr("Close Paranthesis"), Resource::loadPixmap( "opie-sheet/func_paran_close" ), tr("&Close Paranthesis"), 0, this);
funcParanClose->setToolTip(")");
connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
- funcComma=new QAction(tr("Comma"), QPixmap(func_comma_xpm), tr("&Comma"), 0, this);
+ funcComma=new QAction(tr("Comma"), Resource::loadPixmap( "opie-sheet/func_comma" ), tr("&Comma"), 0, this);
funcComma->setToolTip(",");
connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
}
void MainWindow::initMenu()
{
menu=new QMenuBar(this);
menuFile=new QPopupMenu;
fileNew->addTo(menuFile);
fileOpen->addTo(menuFile);
fileSave->addTo(menuFile);
fileSaveAs->addTo(menuFile);
// menuFile->insertSeparator();
// fileQuit->addTo(menuFile);
menuFile->insertSeparator();
fileExcelImport->addTo(menuFile);
menu->insertItem(tr("&File"), menuFile);
menuEdit=new QPopupMenu;
editAccept->addTo(menuEdit);
editCancel->addTo(menuEdit);
editCellSelect->addTo(menuEdit);
menuEdit->insertSeparator();
editCut->addTo(menuEdit);
editCopy->addTo(menuEdit);
editPaste->addTo(menuEdit);
editPasteContents->addTo(menuEdit);
editClear->addTo(menuEdit);
menu->insertItem(tr("&Edit"), menuEdit);
menuInsert=new QPopupMenu;
menu->insertItem(tr("&Insert"), menuInsert);
menuFormat=new QPopupMenu;
formatCells->addTo(menuFormat);
menu->insertItem(tr("&Format"), menuFormat);
menuData=new QPopupMenu;
dataSort->addTo(menuData);
dataFindReplace->addTo(menuData);
menu->insertItem(tr("&Data"), menuData);
// menuHelp=new QPopupMenu;
// helpGeneral->addTo(menuHelp);
// helpAbout->addTo(menuHelp);
// menu->insertItem(tr("&Help"), menuHelp);
submenuRow=new QPopupMenu;
rowHeight->addTo(submenuRow);
rowAdjust->addTo(submenuRow);
rowShow->addTo(submenuRow);
rowHide->addTo(submenuRow);
menuFormat->insertItem(tr("&Row"), submenuRow);
submenuCol=new QPopupMenu;
colWidth->addTo(submenuCol);
colAdjust->addTo(submenuCol);
colShow->addTo(submenuCol);
colHide->addTo(submenuCol);
menuFormat->insertItem(tr("Colum&n"), submenuCol);
submenuSheet=new QPopupMenu;
sheetRename->addTo(submenuSheet);
sheetRemove->addTo(submenuSheet);
menuFormat->insertItem(tr("&Sheet"), submenuSheet);
submenuFunc=new QPopupMenu;
menuInsert->insertItem(tr("&Function"), submenuFunc);
submenuFuncStd=new QPopupMenu;
funcPlus->addTo(submenuFuncStd);
funcMinus->addTo(submenuFuncStd);
funcCross->addTo(submenuFuncStd);
funcDivide->addTo(submenuFuncStd);
submenuFunc->insertItem(tr("&Simple"), submenuFuncStd);
submenuFuncStandard=new QPopupMenu;
addFlyAction(tr("ABS(x)"), tr("ABS(x)"), "ABS(", submenuFuncStandard);
addFlyAction(tr("CEILING(x,acc)"), tr("CEILING(x,acc)"), "CEILING(", submenuFuncStandard);
addFlyAction(tr("FACT(x)"), tr("FACT(x)"), "FACT(", submenuFuncStandard);
addFlyAction(tr("FLOOR(x,acc)"), tr("FLOOR(x,acc)"), "FLOOR(", submenuFuncStandard);
addFlyAction(tr("INT(x)"), tr("INT(x)"), "INT(", submenuFuncStandard);
addFlyAction(tr("MOD(x,y)"), tr("MOD(x,y)"), "MOD(", submenuFuncStandard);
addFlyAction(tr("ROUND(x,digits)"), tr("ROUND(x,digits)"), "ROUND(", submenuFuncStandard);
addFlyAction(tr("SIGN(x)"), tr("SIGN(x)"), "SIGN(", submenuFuncStandard);
submenuFuncStandard->insertSeparator();
addFlyAction(tr("EXP(x)"), tr("EXP(x)"), "EXP(", submenuFuncStandard);
addFlyAction(tr("LN(x)"), tr("LN(x)"), "LN(", submenuFuncStandard);
addFlyAction(tr("LOG(x,b)"), tr("LOG(x,b)"), "LOG(", submenuFuncStandard);
addFlyAction(tr("LOG10(x)"), tr("LOG10(x)"), "LOG10(", submenuFuncStandard);
addFlyAction(tr("POWER(x,y)"), tr("POWER(x,y)"), "POWER(", submenuFuncStandard);
addFlyAction(tr("SQRT(x)"), tr("SQRT(x)"), "SQRT(", submenuFuncStandard);
submenuFuncStandard->insertSeparator();
addFlyAction(tr("DEGREES(x)"), tr("DEGREES(x)"), "DEGREES(", submenuFuncStandard);
addFlyAction(tr("RADIANS(x)"), tr("RADIANS(x)"), "RADIANS(", submenuFuncStandard);
addFlyAction(tr("PI()"), tr("PI()"), "PI()", submenuFuncStandard);
addFlyAction(tr("RAND()"), tr("RAND()"), "RAND(", submenuFuncStandard);
addFlyAction(tr("RANDBETWEEN(a,b)"), tr("RANDBETWEEN(a,b)"), "RANDBETWEEN(", submenuFuncStandard);
submenuFunc->insertItem(tr("S&tandard"), submenuFuncStandard);
submenuFuncLogic=new QPopupMenu;
addFlyAction(tr("AND(x1,x2)"), tr("AND(x1,x2)"), "AND(", submenuFuncLogic);
addFlyAction(tr("NOT(x)"), tr("NOT(x)"), "NOT(", submenuFuncLogic);
addFlyAction(tr("OR(x1,x2)"), tr("OR(x1,x2)"), "OR(", submenuFuncLogic);
submenuFuncLogic->insertSeparator();
addFlyAction(tr("IF(compare,val1,val2)"), tr("IF(compare,val1,val2)"), "IF(", submenuFuncLogic);
addFlyAction(tr("INDEX(range,index)"),tr("INDEX(range,index)"), "INDEX(", submenuFuncLogic);
addFlyAction(tr("ISBLANK(x)"), tr("ISBLANK(x)"), "ISBLANK(", submenuFuncLogic);
addFlyAction(tr("ISNUMBER(x)"), tr("ISNUMBER(x)"), "ISNUMBER(", submenuFuncLogic);
addFlyAction(tr("EVEN(x)"), tr("EVEN(x)"), "EVEN(", submenuFuncLogic);
addFlyAction(tr("ISEVEN(x)"), tr("ISEVEN(x)"), "ISEVEN(", submenuFuncLogic);
addFlyAction(tr("ODD(x)"), tr("ODD(x)"), "ODD(", submenuFuncLogic);
addFlyAction(tr("ISODD(x)"), tr("ISODD(x)"), "ISODD(", submenuFuncLogic);
submenuFunc->insertItem(tr("Logical-&Information"), submenuFuncLogic);
submenuFuncTrig=new QPopupMenu;
addFlyAction(tr("SIN(x)"), tr("SIN(x)"), "SIN(", submenuFuncTrig);
addFlyAction(tr("COS(x)"), tr("COS(x)"), "COS(", submenuFuncTrig);
addFlyAction(tr("TAN(x)"), tr("TAN(x)"), "TAN(", submenuFuncTrig);
addFlyAction(tr("ASIN(x)"), tr("ASIN(x)"), "ASIN(", submenuFuncTrig);
addFlyAction(tr("ACOS(x)"), tr("ACOS(x)"), "ACOS(", submenuFuncTrig);
addFlyAction(tr("ATAN(x)"), tr("ATAN(x)"), "ATAN(", submenuFuncTrig);
addFlyAction(tr("ATAN2(x,y)"), tr("ATAN2(x,y)"), "ATAN2(", submenuFuncTrig);
submenuFuncTrig->insertSeparator();
addFlyAction(tr("SINH(x)"), tr("SINH(x)"), "SINH(", submenuFuncTrig);
addFlyAction(tr("COSH(x)"), tr("COSH(x)"), "COSH(", submenuFuncTrig);
addFlyAction(tr("TANH(x)"), tr("TANH(x)"), "TANH(", submenuFuncTrig);
addFlyAction(tr("ACOSH(x)"), tr("ACOSH(x)"), "ACOSH(", submenuFuncTrig);
addFlyAction(tr("ASINH(x)"), tr("ASINH(x)"), "ASINH(", submenuFuncTrig);
addFlyAction(tr("ATANH(x)"), tr("ATANH(x)"), "ATANH(", submenuFuncTrig);
submenuFunc->insertItem(tr("&Trigonometric"), submenuFuncTrig);
submenuFuncString=new QPopupMenu;
addFlyAction(tr("LEN(s)"), tr("LEN(s)"), "LEN(",submenuFuncString);
addFlyAction(tr("LEFT(s,num)"), tr("LEFT(s,num)"), "LEFT(",submenuFuncString);
addFlyAction(tr("RIGHT(s,num)"), tr("RIGHT(s,num)"), "RIGHT(",submenuFuncString);
addFlyAction(tr("MID(s,pos,len)"), tr("MID(s,pos,len)"), "MID(",submenuFuncString);
submenuFuncString->insertSeparator();
addFlyAction(tr("CONCATENATE(s1,s2..)"), tr("CONCATENATE(s1,s2..)"), "CONCATENATE(",submenuFuncString);
addFlyAction(tr("EXACT(s1,s2)"), tr("EXACT(s1,s2)"), "EXACT(",submenuFuncString);
addFlyAction(tr("FIND(what,where,pos)"),
tr("FIND(what,where,pos)"), "FIND(",submenuFuncString);
addFlyAction(tr("REPLACE(s,pos,len,ns)"), tr("REPLACE(s,pos,len,ns)"), "REPLACE(",submenuFuncString);
addFlyAction(tr("REPT(s,n)"), tr("REPT(s,n)"), "REPT(",submenuFuncString);
submenuFuncString->insertSeparator();
addFlyAction(tr("UPPER(s)"), tr("UPPER(s)"), "UPPER(",submenuFuncString);
addFlyAction(tr("LOWER(s)"), tr("LOWER(s)"), "LOWER(",submenuFuncString);
submenuFunc->insertItem(tr("&Strings"), submenuFuncString);
submenuFuncStat=new QPopupMenu;
addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat);
addFlyAction(tr("COUNT(range)"), tr("COUNT(range)"), "COUNT(",submenuFuncStat);
addFlyAction(tr("COUNTIF(range,eqls)"), tr("COUNTIF(range,eqls)"), "COUNTIF(",submenuFuncStat);
addFlyAction(tr("MAX(range)"), tr("MAX(range)"), "MAX(",submenuFuncStat);
addFlyAction(tr("MIN(range)"), tr("MIN(range)"), "MIN(",submenuFuncStat);
addFlyAction(tr("SUM(range)"), tr("SUM(range)"), "SUM(",submenuFuncStat);
addFlyAction(tr("SUMSQ(range)"), tr("SUMSQ(range)"), "SUMSQ(",submenuFuncStat);
submenuFuncStat->insertSeparator();
addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat);
addFlyAction(tr("VAR(range)"), tr("VAR(range)"), "VAR(",submenuFuncStat);
addFlyAction(tr("VARP(range)"), tr("VARP(range)"), "VARP(",submenuFuncStat);
addFlyAction(tr("STDEV(range)"), tr("STDEV(range)"), "STDEV(",submenuFuncStat);
addFlyAction(tr("STDEVP(range)"), tr("STDEVP(range)"), "STDEVP(",submenuFuncStat);
addFlyAction(tr("SKEW(range)"), tr("SKEW(range)"), "SKEW(",submenuFuncStat);
addFlyAction(tr("KURT(range)"), tr("KURT(range)"), "KURT(",submenuFuncStat);
submenuFunc->insertItem(tr("Sta&tistical"), submenuFuncStat);
submenuFuncScientific=new QPopupMenu;
addFlyAction(tr("BESSELI(x,n)"), tr("BESSELI(x,n)"), "BESSELI(",submenuFuncScientific);
addFlyAction(tr("BESSELJ(x,n)"), tr("BESSELJ(x,n)"), "BESSELJ(",submenuFuncScientific);
addFlyAction(tr("BESSELK(x,n)"), tr("BESSELK(x,n)"), "BESSELK(",submenuFuncScientific);
addFlyAction(tr("BESSELY(x,n)"), tr("BESSELY(x,n)"), "BESSELY(",submenuFuncScientific);
submenuFuncScientific->insertSeparator();
addFlyAction(tr("BETAI(x,a,b)"), tr("BETAI(x,a,b)"), "BETAI(",submenuFuncScientific);
addFlyAction(tr("ERF(a,b)"), tr("ERF(a,b)"), "ERF(",submenuFuncScientific);
addFlyAction(tr("ERFC(a,b)"), tr("ERFC(a,b)"), "ERFC(",submenuFuncScientific);
addFlyAction(tr("GAMMALN(x)"), tr("GAMMALN(x)"), "GAMMALN(",submenuFuncScientific);
addFlyAction(tr("GAMMAP(x,a)"), tr("GAMMAP(x,a)"), "GAMMAP(",submenuFuncScientific);
addFlyAction(tr("GAMMAQ(x,a)"), tr("GAMMAQ(x,a)"), "GAMMAQ(",submenuFuncScientific);
submenuFunc->insertItem(tr("Scienti&fic"), submenuFuncScientific);
submenuFuncDistr=new QPopupMenu;
addFlyAction(tr("BETADIST(z,a,b,Q?)"), tr("BETADIST(z,a,b,Q?)"), "BETADIST(",submenuFuncDistr);
addFlyAction(tr("CHI2DIST(x,n,Q?)"), tr("CHI2DIST(x,n,Q?)"), "CHI2DIST(",submenuFuncDistr);
addFlyAction(tr("CHIDIST(x,n,Q?)"), tr("CHIDIST(x,n,Q?)"), "CHIDIST(",submenuFuncDistr);
addFlyAction(tr("FDIST(z,deg1,deg2,Q?)"), tr("FDIST(z,deg1,deg2,Q?)"), "FDIST(",submenuFuncDistr);
addFlyAction(tr("GAMMADIST(x,a,b,Q?)"), tr("GAMMADIST(x,a,b,Q?)"), "GAMMADIST(",submenuFuncDistr);
addFlyAction(tr("NORMALDIST(x,m,s,Q?)"), tr("NORMALDIST(x,m,s,Q?)"), "NORMALDIST(",submenuFuncDistr);
addFlyAction(tr("PHI(x,Q?)"), tr("PHI(x,Q?)"), "PHI(",submenuFuncDistr);
addFlyAction(tr("POISSON(x,n,Q?)"), tr("POISSON(x,n,Q?)"), "POISSON(",submenuFuncDistr);
submenuFunc->insertItem(tr("&Distributions"), submenuFuncDistr);
menuInsert->insertSeparator();
insertCells->addTo(menuInsert);
insertRows->addTo(menuInsert);
insertCols->addTo(menuInsert);
insertSheets->addTo(menuInsert);
}
void MainWindow::initStandardToolbar()
{
toolbarStandard=new QToolBar(this);
toolbarStandard->setHorizontalStretchable(TRUE);
moveToolBar(toolbarStandard, Top);
fileNew->addTo(toolbarStandard);
fileOpen->addTo(toolbarStandard);
fileSave->addTo(toolbarStandard);
comboSheets=new QComboBox(toolbarStandard);
toolbarStandard->setStretchableWidget(comboSheets);
connect(comboSheets, SIGNAL(activated(const QString &)), this, SLOT(slotSheetChanged(const QString &)));
}
void MainWindow::initFunctionsToolbar()
{
toolbarFunctions=new QToolBar(this);
toolbarFunctions->setHorizontalStretchable(TRUE);
moveToolBar(toolbarFunctions, Bottom);
funcEqual->addTo(toolbarFunctions);
funcPlus->addTo(toolbarFunctions);
funcMinus->addTo(toolbarFunctions);
funcCross->addTo(toolbarFunctions);
funcDivide->addTo(toolbarFunctions);
funcParanOpen->addTo(toolbarFunctions);
funcParanClose->addTo(toolbarFunctions);
funcComma->addTo(toolbarFunctions);
toolFunction=new QToolButton(toolbarFunctions);
- toolFunction->setPixmap(func_func_xpm);
+ toolFunction->setPixmap(Resource::loadPixmap( "opie-sheet/func_func" ));
toolFunction->setTextLabel(tr("Functions"));
toolFunction->setPopup(submenuFunc);
toolFunction->setPopupDelay(0);
}
void MainWindow::initEditToolbar()
{
toolbarEdit=new QToolBar(this);
toolbarEdit->setHorizontalStretchable(TRUE);
moveToolBar(toolbarEdit, Bottom);
editAccept->addTo(toolbarEdit);
editCancel->addTo(toolbarEdit);
editData=new QLineEdit(toolbarEdit);
toolbarEdit->setStretchableWidget(editData);
connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept()));
editCellSelect->addTo(toolbarEdit);
}
void MainWindow::slotHelpAbout()
{
QDialog dialogAbout(this, 0, TRUE);
dialogAbout.resize(width()-40, height()-80);
dialogAbout.setCaption(tr("About Opie Sheet"));
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);
label.setGeometry(dialogAbout.rect());
label.setAlignment(Qt::AlignCenter | Qt::WordBreak);
dialogAbout.exec();
}
void MainWindow::initSheet()
{
sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this);
setCentralWidget(sheet);
connect(sheet, SIGNAL(currentDataChanged(const QString &)), editData, SLOT(setText(const QString &)));
connect(sheet, SIGNAL(cellClicked(const QString &)), this, SLOT(slotCellClicked(const QString &)));
connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified()));
connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut()));
connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy()));
connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear()));
}
void MainWindow::slotEditAccept()
{
sheet->setData(editData->text());
}
void MainWindow::slotEditCancel()
{
editData->setText(sheet->getData());
}
void MainWindow::slotCellSelect(bool lock)
{
sheet->lockClicks(lock);
}
void MainWindow::addToData(const QString &data)
{
editData->setText(editData->text().insert(editData->cursorPosition(), data));
}
void MainWindow::slotFuncOutput()
{
if (sender()->isA("QAction"))
addToData(((QAction *)sender())->toolTip());
}
void MainWindow::slotInsertRows()
{
NumberDialog dialogNumber(this);
if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted)
sheet->insertRows(dialogNumber.getValue());
}
void MainWindow::slotInsertCols()
{
NumberDialog dialogNumber(this);
if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted)
sheet->insertColumns(dialogNumber.getValue());
}
void MainWindow::slotInsertSheets()
{
NumberDialog dialogNumber(this);
if (dialogNumber.exec(tr("Add Sheets"), tr("&Number of sheets:"))==QDialog::Accepted)
for (int i=dialogNumber.getValue(); i>0; --i) createNewSheet();
}
void MainWindow::slotCellClicked(const QString &cell)
{
editCellSelect->setOn(FALSE);
addToData(cell);
}
typeSheet *MainWindow::createNewSheet()
{
typeSheet *newSheet=new typeSheet;
int currentNo=1, tempNo=0;
bool ok;
for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next())
if (tempSheet->name.startsWith(tr("Sheet")) && (tempNo=tempSheet->name.mid(tr("Sheet").length()).toInt(&ok))>=currentNo && ok)
currentNo=tempNo+1;
newSheet->name=tr("Sheet")+QString::number(currentNo);
newSheet->data.setAutoDelete(TRUE);
comboSheets->insertItem(newSheet->name);
listSheets.append(newSheet);
return newSheet;
}
typeSheet *MainWindow::findSheet(const QString &name)
{
for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next())
if (tempSheet->name==name)
return tempSheet;
return NULL;
}
void MainWindow::slotSheetChanged(const QString &name)