1 /* This file is part of the KDE project 2 Copyright 2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net> 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Library General Public 6 License as published by the Free Software Foundation; either 7 version 2 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Library General Public License for more details. 13 14 You should have received a copy of the GNU Library General Public License 15 along with this library; see the file COPYING.LIB. If not, write to 16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef CALLIGRA_SHEETS_CSV_DATA_COMMAND 21 #define CALLIGRA_SHEETS_CSV_DATA_COMMAND 22 23 #include "DataManipulators.h" 24 25 #include <KoCsvImportDialog.h> 26 27 namespace Calligra 28 { 29 namespace Sheets 30 { 31 32 /** 33 * \ingroup Commands 34 * \brief Parses CSV data an fills it into a cell range. 35 */ 36 class CSVDataCommand : public AbstractDataManipulator 37 { 38 public: 39 /** 40 * Constructor. 41 */ 42 CSVDataCommand(); 43 44 /** 45 * Destructor. 46 */ 47 ~CSVDataCommand() override; 48 49 void setValue(const Value& value); 50 void setColumnDataTypes(const QList<KoCsvImportDialog::DataType>& dataTypes); 51 void setDecimalSymbol(const QString& symbol); 52 void setThousandsSeparator(const QString& separator); 53 54 protected: 55 Value newValue(Element* element, int col, int row, bool* parse, Format::Type* fmtType) override; 56 bool wantChange(Element* element, int col, int row) override; 57 bool preProcessing() override; 58 bool postProcessing() override; 59 60 private: 61 QList<KoCsvImportDialog::DataType> m_dataTypes; 62 Value m_value; 63 QString m_decimalSymbol; 64 QString m_thousandsSeparator; 65 QString m_documentDecimalSymbol; 66 QString m_documentThousandsSeparator; 67 }; 68 69 } // namespace Sheets 70 } // namespace Calligra 71 72 #endif // CALLIGRA_SHEETS_CSV_DATA_COMMAND 73