Warning, file /office/calligra/libs/widgets/KoCsvImportDialog.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 KO_CSV_IMPORT_DIALOG
0022 #define KO_CSV_IMPORT_DIALOG
0023 
0024 #include <KoDialog.h>
0025 
0026 #include "kowidgets_export.h"
0027 
0028 /**
0029  * A dialog to choose the options for importing CSV data.
0030  */
0031 class KOWIDGETS_EXPORT KoCsvImportDialog : public KoDialog
0032 {
0033     Q_OBJECT
0034 public:
0035     /**
0036      * The type the data should be treated as.
0037      */
0038     enum DataType
0039     {
0040         Generic     = 0x01, ///< Parses the content; it may become text, number, date, ...
0041         Text        = 0x02, ///< Forces the content to a text value.
0042         Date        = 0x04, ///< Tries to convert the content to a date value.
0043         Currency    = 0x08, ///< Tries to convert the content to a currency value.
0044         None        = 0x10  ///< Skips the content.
0045     };
0046     Q_DECLARE_FLAGS(DataTypes, DataType)
0047 
0048     /**
0049      * Constructor.
0050      */
0051     explicit KoCsvImportDialog(QWidget *parent);
0052 
0053     /**
0054      * Destructor.
0055      */
0056     ~KoCsvImportDialog() override;
0057 
0058     /**
0059      * Set the data to import.
0060      */
0061     void setData(const QByteArray& data);
0062 
0063     /**
0064      * \return whether the first row is a header row
0065      */
0066     bool firstRowContainHeaders() const;
0067 
0068     /**
0069      * \return whether the first column is a header column
0070      */
0071     bool firstColContainHeaders() const;
0072 
0073     /**
0074      * \return the number of rows to import
0075      */
0076     int rows() const;
0077 
0078     /**
0079      * \return the number of columns to import
0080      */
0081     int cols() const;
0082 
0083     /**
0084      * The data type of column \p col.
0085      */
0086     DataType dataType(int col) const;
0087 
0088     /**
0089      * The text at \p row, \p col.
0090      */
0091     QString  text(int row, int col) const;
0092 
0093     /**
0094      * Sets the data types, that should be selectable.
0095      */
0096     void setDataTypes(DataTypes dataTypes);
0097 
0098     /**
0099      * Enables or disables the data widget.
0100      */
0101     void setDataWidgetEnabled(bool enable);
0102 
0103     /**
0104      * \return the decimal symbol
0105      */
0106     QString decimalSymbol() const;
0107 
0108     /**
0109      * Sets the decimal symbol.
0110      */
0111     void setDecimalSymbol(const QString& symbol);
0112 
0113     /**
0114      * \return the thousands separator
0115      */
0116     QString thousandsSeparator() const;
0117 
0118     /**
0119      * Sets the thousands separator.
0120      */
0121     void setThousandsSeparator(const QString& separator);
0122 
0123     QString delimiter() const;
0124     void setDelimiter(const QString& delimit);
0125 
0126 protected Q_SLOTS:
0127     void returnPressed();
0128     void formatChanged(const QString&);
0129     void delimiterClicked(int id);
0130     void textquoteSelected(const QString& mark);
0131     void currentCellChanged(int, int col);
0132     void genericDelimiterChanged(const QString &);
0133     void ignoreDuplicatesChanged(int);
0134     void updateClicked();
0135     void encodingChanged(const QString &);
0136 
0137 private:
0138     Q_DISABLE_COPY(KoCsvImportDialog)
0139 
0140     class Private;
0141     Private * const d;
0142 };
0143 
0144 Q_DECLARE_OPERATORS_FOR_FLAGS(KoCsvImportDialog::DataTypes)
0145 
0146 #endif // KO_CSV_IMPORT_DIALOG