1 /* This file is part of the KDE project
2    Copyright 2006      Stefan Nikolaus <stefan.nikolaus@kdemail.net>
3              2002-2003 Norbert Andres <nandres@web.de>
4              2002-2003 Ariya Hidayat <ariya@kde.org>
5              2002      Laurent Montel <montel@kde.org>
6              1999      David Faure <faure@kde.org>
7 
8    This library is free software; you can redistribute it and/or
9    modify it under the terms of the GNU Library General Public
10    License as published by the Free Software Foundation; either
11    version 2 of the License, or (at your option) any later version.
12 
13    This library is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    Library General Public License for more details.
17 
18    You should have received a copy of the GNU Library General Public License
19    along with this library; see the file COPYING.LIB.  If not, write to
20    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21    Boston, MA 02110-1301, USA.
22 */
23 
24 #ifndef CSVDIALOG_H
25 #define CSVDIALOG_H
26 
27 #include <KoCsvImportDialog.h>
28 
29 namespace Calligra
30 {
31 namespace Sheets
32 {
33 class Selection;
34 
35 /**
36  * \ingroup UI
37  * Provides dialog for managing CSV (comma separated value) data.
38  *
39  * Currently CSVDialog is used for converting text into columns,
40  * inserting text file and pasting text from clipboard, where conversion
41  * from CSV (comma separated value) data is is all required.
42  * The different purposed mentioned above is determined
43  * using mode, which can be Column, File, or Clipboard respectively.
44  *
45 */
46 class CSVDialog : public KoCsvImportDialog
47 {
48     Q_OBJECT
49 
50 public:
51     enum Mode { Clipboard, File, Column };
52 
53     CSVDialog(QWidget* parent, Selection* selection, Mode mode);
54     ~CSVDialog() override;
55 
56     bool canceled();
57 
58 protected Q_SLOTS:
59     void init();
60 
61 protected:
62     void accept() override;
63 
64 private:
65     Selection* m_selection;
66     bool    m_canceled;
67     QRect   m_targetRect;
68     Mode    m_mode;
69     QString m_filename;
70 };
71 
72 } // namespace Sheets
73 } // namespace Calligra
74 
75 #endif // CVSDIALOG_H
76