kchart

csvimportdialog.h
1/* This file is part of the KDE project
2 Copyright (C) 1999 David Faure <faure@kde.org>
3 Copyright (C) 2004 Nicolas GOUTTE <goutte@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef CSVIMPORTDIALOG_H
22#define CSVIMPORTDIALOG_H
23
24#include <tqstringlist.h>
25
26#include <kdialogbase.h>
27
28class DialogUI;
29
30class CSVImportDialog : public KDialogBase
31{
32 TQ_OBJECT
33
34public:
35 enum Header
36 {
37 TEXT,
38 NUMBER,
39 DATE,
40 CURRENCY,
41 COMMANUMBER,
42 POINTNUMBER
43 };
44
45 CSVImportDialog(TQWidget* parent, TQByteArray& fileArray);
46 ~CSVImportDialog();
47
48 bool firstRowContainHeaders();
49 bool firstColContainHeaders();
50 int rows();
51 int cols();
52 int headerType(int col);
53 TQString text(int row, int col);
54
55private:
56 void fillTable();
57 void fillComboBox();
58 void setText(int row, int col, const TQString& text);
59 void adjustRows(int iRows);
60 void adjustCols(int iCols);
61 bool checkUpdateRange();
62 TQTextCodec* getCodec(void) const;
63
64 // The real contents of the dialog
65 DialogUI *m_dialog;
66
67 bool m_adjustRows;
68 bool m_adjustCols;
69 int m_startRow;
70 int m_startCol;
71 int m_endRow;
72 int m_endCol;
73 TQChar m_textquote;
74 TQString m_delimiter;
75 bool m_ignoreDups;
76 TQByteArray m_fileArray;
77 TQTextCodec *m_codec;
78 TQStringList m_formatList;
79
80private slots:
81 void returnPressed();
82 void formatChanged( const TQString& );
83 void delimiterClicked(int id);
84 void textquoteSelected(const TQString& mark);
85 void currentCellChanged(int, int col);
86 void textChanged ( const TQString & );
87 void ignoreDuplicatesChanged( int );
88 void updateClicked();
89 void encodingChanged ( const TQString & );
90};
91
92#endif