File indexing completed on 2025-01-19 13:27:14

0001 /* This file is part of the KDE project
0002    Copyright (C) 1999 David Faure <faure@kde.org>
0003    Copyright (C) 2004 Nicolas GOUTTE <goutte@kde.org>
0004 
0005    This library is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 
0010    This library is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013    Library General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this library; see the file COPYING.LIB.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #ifndef CSVEXPORTDIALOG_H
0022 #define CSVEXPORTDIALOG_H
0023 
0024 #include <KoDialog.h>
0025 #include <ui_exportdialogui.h>
0026 
0027 class ExportDialogUI;
0028 class QValidator;
0029 
0030 namespace Calligra
0031 {
0032 namespace Sheets
0033 {
0034 class Map;
0035 }
0036 }
0037 
0038 class ExportDialogUI : public QWidget, public Ui::ExportDialogUI
0039 {
0040 public:
0041     explicit ExportDialogUI(QWidget *parent) : QWidget(parent) {
0042         setupUi(this);
0043     }
0044 };
0045 
0046 
0047 class CSVExportDialog : public KoDialog
0048 {
0049     Q_OBJECT
0050 public:
0051     explicit CSVExportDialog(QWidget *parent);
0052     ~CSVExportDialog() override;
0053 
0054     QChar   getDelimiter() const;
0055     QChar   getTextQuote() const;
0056     bool    exportSheet(QString const & sheetName) const;
0057     bool    printAlwaysSheetDelimiter() const;
0058     QString getSheetDelimiter() const;
0059     bool    exportSelectionOnly() const;
0060 
0061     void  fillSheet(Calligra::Sheets::Map * map);
0062     QString getEndOfLine(void) const;
0063     QTextCodec* getCodec(void) const;
0064 
0065 private:
0066     void loadSettings();
0067     void saveSettings();
0068     ExportDialogUI * m_dialog;
0069 
0070     QValidator* m_delimiterValidator;
0071     QString m_delimiter;
0072     QChar   m_textquote;
0073 
0074 private Q_SLOTS:
0075     void slotOk();
0076     void slotCancel();
0077 
0078     void returnPressed();
0079     void delimiterClicked(int id);
0080     void textChanged(const QString &);
0081     void textquoteSelected(const QString & mark);
0082     void selectionOnlyChanged(bool);
0083 };
0084 
0085 #endif