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

0001 /* This file is part of the KDE project
0002    Copyright (C) 2000 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 CSVEXPORT_H
0022 #define CSVEXPORT_H
0023 
0024 #include <QString>
0025 #include <QByteArray>
0026 #include <KoFilter.h>
0027 #include <QVariantList>
0028 #include <QDebug>
0029 #include <QLoggingCategory>
0030 
0031 Q_DECLARE_LOGGING_CATEGORY(lcCsvExport)
0032 
0033 namespace Calligra
0034 {
0035 namespace Sheets
0036 {
0037 class Sheet;
0038 class Doc;
0039 }
0040 }
0041 
0042 class CSVExport : public KoFilter
0043 {
0044     Q_OBJECT
0045 
0046 public:
0047     CSVExport(QObject* parent, const QVariantList &);
0048     ~CSVExport() override {}
0049 
0050     KoFilter::ConversionStatus convert(const QByteArray & from, const QByteArray & to) override;
0051 
0052 private:
0053     QString exportCSVCell(const Calligra::Sheets::Doc* doc, Calligra::Sheets::Sheet const * const sheet,
0054                           int col, int row, QChar const & textQuote, QChar csvDelimiter);
0055 
0056 private:
0057     QString m_eol; ///< End of line (LF, CR or CRLF)
0058 };
0059 
0060 #endif // CSVEXPORT_H