00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KO_CSV_IMPORT_DIALOG
00022 #define KO_CSV_IMPORT_DIALOG
00023
00024 #include <QStringList>
00025 #include <QWidget>
00026
00027 #include <kdialog.h>
00028
00029 #include "koffice_export.h"
00030
00031 #include "ui_KoCsvImportDialog.h"
00032
00033 class KoCsvImportWidget : public QWidget, public Ui::KoCsvImportWidget
00034 {
00035 public:
00036 KoCsvImportWidget(QWidget* parent) : QWidget(parent) { setupUi(this); }
00037 };
00038
00039 class KOFFICEUI_EXPORT KoCsvImportDialog : public KDialog
00040 {
00041 Q_OBJECT
00042 public:
00043 enum Header
00044 {
00045 TEXT,
00046 NUMBER,
00047 DATE,
00048 CURRENCY,
00049 COMMANUMBER,
00050 POINTNUMBER
00051 };
00052
00053 KoCsvImportDialog(QWidget* parent);
00054 ~KoCsvImportDialog();
00055
00056 void setData( const QByteArray& data);
00057 bool firstRowContainHeaders();
00058 bool firstColContainHeaders();
00059 int rows();
00060 int cols();
00061 int headerType(int col);
00062 QString text(int row, int col);
00063
00064 protected:
00065 void fillTable();
00066 void fillComboBox();
00067 void setText(int row, int col, const QString& text);
00068 void adjustRows(int iRows);
00069 void adjustCols(int iCols);
00070 bool checkUpdateRange();
00071 QTextCodec* getCodec(void) const;
00072
00073
00074 KoCsvImportWidget *m_dialog;
00075
00076 bool m_adjustRows;
00077 bool m_adjustCols;
00078 int m_startRow;
00079 int m_startCol;
00080 int m_endRow;
00081 int m_endCol;
00082 QChar m_textquote;
00083 QString m_delimiter;
00084 bool m_ignoreDups;
00085 QByteArray m_fileArray;
00086 QTextCodec *m_codec;
00087 QStringList m_formatList;
00088
00089 protected slots:
00090 void returnPressed();
00091 void formatChanged( const QString& );
00092 void delimiterClicked(int id);
00093 void textquoteSelected(const QString& mark);
00094 void currentCellChanged(int, int col);
00095 void genericDelimiterChanged( const QString & );
00096 void ignoreDuplicatesChanged( int );
00097 void updateClicked();
00098 void encodingChanged ( const QString & );
00099 };
00100
00101 #endif // KO_CSV_IMPORT_DIALOG