File indexing completed on 2024-05-12 16:35:17

0001 /* This file is part of the KDE project
0002    Copyright 2006      Stefan Nikolaus <stefan.nikolaus@kdemail.net>
0003              2002-2003 Norbert Andres <nandres@web.de>
0004              2002-2003 Ariya Hidayat <ariya@kde.org>
0005              2002      Laurent Montel <montel@kde.org>
0006              1999      David Faure <faure@kde.org>
0007 
0008    This library is free software; you can redistribute it and/or
0009    modify it under the terms of the GNU Library General Public
0010    License as published by the Free Software Foundation; either
0011    version 2 of the License, or (at your option) any later version.
0012 
0013    This library is distributed in the hope that it will be useful,
0014    but WITHOUT ANY WARRANTY; without even the implied warranty of
0015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016    Library General Public License for more details.
0017 
0018    You should have received a copy of the GNU Library General Public License
0019    along with this library; see the file COPYING.LIB.  If not, write to
0020    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0021    Boston, MA 02110-1301, USA.
0022 */
0023 
0024 #ifndef CSVDIALOG_H
0025 #define CSVDIALOG_H
0026 
0027 #include <KoCsvImportDialog.h>
0028 
0029 namespace Calligra
0030 {
0031 namespace Sheets
0032 {
0033 class Selection;
0034 
0035 /**
0036  * \ingroup UI
0037  * Provides dialog for managing CSV (comma separated value) data.
0038  *
0039  * Currently CSVDialog is used for converting text into columns,
0040  * inserting text file and pasting text from clipboard, where conversion
0041  * from CSV (comma separated value) data is is all required.
0042  * The different purposed mentioned above is determined
0043  * using mode, which can be Column, File, or Clipboard respectively.
0044  *
0045 */
0046 class CSVDialog : public KoCsvImportDialog
0047 {
0048     Q_OBJECT
0049 
0050 public:
0051     enum Mode { Clipboard, File, Column };
0052 
0053     CSVDialog(QWidget* parent, Selection* selection, Mode mode);
0054     ~CSVDialog() override;
0055 
0056     bool canceled();
0057 
0058 protected Q_SLOTS:
0059     void init();
0060 
0061 protected:
0062     void accept() override;
0063 
0064 private:
0065     Selection* m_selection;
0066     bool    m_canceled;
0067     QRect   m_targetRect;
0068     Mode    m_mode;
0069     QString m_filename;
0070 };
0071 
0072 } // namespace Sheets
0073 } // namespace Calligra
0074 
0075 #endif // CVSDIALOG_H