Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

mainwindow.h

Go to the documentation of this file.
00001 /*
00002                =.            This file is part of the Opie Project
00003              .=l.            Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org>
00004            .>+-=
00005  _;:,     .>    :=|.         This program is free software; you can
00006 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00007 :`=1 )Y*s>-.--   :           the terms of the GNU General Public
00008 .="- .-=="i,     .._         License as published by the Free Software
00009  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00010      ._= =}       :          or (at your option) any later version.
00011     .%`+i>       _;_.
00012     .i_,=:_.      -<s.       This program is distributed in the hope that
00013      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00014     : ..    .:,     . . .    without even the implied warranty of
00015     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00016   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00017 ..}^=.=       =       ;      Library General Public License for more
00018 ++=   -.     .`     .:       details.
00019  :     =  ...= . :.=-
00020  -.   .:....=;==+<;          You should have received a copy of the GNU
00021   -_. . .   )=.  =           Library General Public License along with
00022     --        :-=`           this library; see the file COPYING.LIB.
00023                              If not, write to the Free Software Foundation,
00024                              Inc., 59 Temple Place - Suite 330,
00025                              Boston, MA 02111-1307, USA.
00026 
00027 */
00028 
00029 /*
00030  * Opie Sheet (formerly Sheet/Qt)
00031  * by Serdar Ozler <sozler@sitebest.com>
00032  */
00033 
00034 #ifndef MAINWINDOW_H
00035 #define MAINWINDOW_H
00036 
00037 #include "Excel.h"
00038 #include "sheet.h"
00039 
00040 /* OPIE */
00041 #include <qpe/applnk.h>
00042 #include <qpe/fileselector.h>
00043 
00044 /* QT */
00045 #include <qmenubar.h>
00046 #include <qtoolbar.h>
00047 #include <qmainwindow.h>
00048 #include <qaction.h>
00049 #include <qlineedit.h>
00050 #include <qbutton.h>
00051 #include <qcombobox.h>
00052 #include <qtoolbutton.h>
00053 
00054 typedef struct typeSheet
00055 {
00056     QString name;
00057     QList<typeCellData> data;
00058 };
00059 
00060 class MainWindow: public QMainWindow
00061 {
00062     Q_OBJECT
00063 
00064     // QPE objects
00065     DocLnk* currentDoc;
00066     QMenuBar *menu;
00067     QToolBar *toolbarFunctions, *toolbarEdit, *toolbarStandard;
00068     FileSelector *fileSelector;
00069     FileSelector *ExcelSelector;
00070 
00071     // QT objects
00072     QPopupMenu *menuFile, *menuEdit, *menuInsert, *menuFormat, *menuData, *menuHelp,
00073     *submenuFunc, *submenuFuncStd, *submenuFuncStandard, *submenuFuncLogic,
00074     *submenuFuncTrig, *submenuFuncString, *submenuFuncScientific, *submenuFuncDistr,
00075     *submenuFuncStat,
00076     *submenuRow, *submenuCol, *submenuSheet;
00077     QAction *fileNew, *fileOpen, *fileSave, *fileSaveAs, *fileExcelImport, *fileQuit, *helpAbout, *editAccept, *editCancel, *formatCells,
00078     *funcPlus, *funcMinus, *funcCross, *funcDivide, *funcParanOpen, *funcParanClose, *funcComma, *funcEqual,
00079     *editCut, *editCopy, *editPaste, *editPasteContents, *editClear, *insertCols, *insertRows, *insertSheets, *insertCells,
00080     *rowHeight, *rowShow, *rowHide, *rowAdjust, *colWidth, *colShow, *colHide, *colAdjust, *sheetRename, *sheetRemove,
00081     *dataSort, *dataFindReplace, *editCellSelect, *helpGeneral;
00082     QLineEdit *editData;
00083     QButton *buttonUp, *buttonDown, *buttonLeft, *buttonRight;
00084     QComboBox *comboSheets;
00085     QToolButton *toolFunction;
00086     QList<typeSheet> listSheets;
00087     QString helpFile;
00088 
00089     // Other objects
00090     Sheet *sheet;
00091 
00092     // Variables
00093     bool documentModified;
00094 
00095     // Private functions
00096     void initMenu();
00097     void initActions();
00098     void initFunctionsToolbar();
00099     void initEditToolbar();
00100     void initStandardToolbar();
00101     void initSheet();
00102     void addToData(const QString &data);
00103     int saveCurrentFile(bool ask=TRUE);
00104     void documentOpen(const DocLnk &lnkDoc);
00105     void documentSave(DocLnk *lnkDoc);
00106     void closeEvent(QCloseEvent *e);
00107     void addFlyAction(const QString &text, const QString &menuText, const QString &tip, QWidget *w);
00108     typeSheet *createNewSheet();
00109     typeSheet *findSheet(const QString &name);
00110 
00111 private slots:
00112     void slotFileNew();
00113     void slotFileOpen();
00114     void slotFileSave();
00115     void slotFileSaveAs();
00116 
00117     void slotImportExcel(const DocLnk &lnkDoc);
00118     void slotImportExcelOpen();
00119     void ExcelSelectorHide();
00120 
00121     void slotHelpAbout();
00122     void slotEditAccept();
00123     void slotEditCancel();
00124     void slotEditPaste();
00125     void slotEditPasteContents();
00126     void slotFormatCells();
00127     void slotInsertCells();
00128     void slotInsertRows();
00129     void slotInsertCols();
00130     void slotInsertSheets();
00131     void slotDataSort();
00132     void slotDataFindReplace();
00133     void slotRowHeight();
00134     void slotRowAdjust();
00135     void slotRowShow();
00136     void slotRowHide();
00137     void slotColumnWidth();
00138     void slotColumnAdjust();
00139     void slotColumnShow();
00140     void slotColumnHide();
00141     void slotSheetRename();
00142     void slotSheetRemove();
00143     void slotFuncOutput();
00144     void slotCellSelect(bool lock);
00145     void slotCellClicked(const QString &cell);
00146     void slotSheetChanged(const QString &name);
00147     void slotDocModified();
00148     void selectorShow();
00149     void selectorHide();
00150     void selectorFileNew(const DocLnk &lnkDoc);
00151     void selectorFileOpen(const DocLnk &lnkDoc);
00152 
00153 public:
00154 static QString appName() { return QString::fromLatin1("opie-sheet"); }
00155     MainWindow(QWidget *p, const char*, WFlags);
00156     ~MainWindow();
00157 
00158     void setHelpFile(const QString &help_filename)          { helpFile=help_filename; }
00159 
00160 public slots:
00161     void setDocument(const QString &applnk_filename);
00162 };
00163 
00164 #endif

Generated on Sat Nov 5 16:15:53 2005 for OPIE by  doxygen 1.4.2