File indexing completed on 2024-12-22 03:35:47

0001 /*
0002     File                 : OdsFilterPrivate.h
0003     Project              : LabPlot
0004     Description          : Ods I/O-filter
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2023 Stefan Gerlach
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef ODSFILTERPRIVATE_H
0011 #define ODSFILTERPRIVATE_H
0012 
0013 #include "backend/datasources/filters/AbstractFileFilter.h"
0014 
0015 #ifdef HAVE_ORCUS
0016 #include <orcus/spreadsheet/document.hpp>
0017 #endif
0018 
0019 class OdsFilter;
0020 class QTreeWidgetItem;
0021 
0022 class OdsFilterPrivate {
0023 public:
0024     explicit OdsFilterPrivate(OdsFilter*);
0025     ~OdsFilterPrivate();
0026 
0027     void readDataFromFile(const QString& fileName, AbstractDataSource* = nullptr, AbstractFileFilter::ImportMode = AbstractFileFilter::ImportMode::Replace);
0028     void readCurrentSheet(const QString& fileName, AbstractDataSource*, AbstractFileFilter::ImportMode);
0029     void write(const QString& fileName, AbstractDataSource*);
0030     QVector<QStringList> preview(const QString& sheetName, int lines);
0031     void parse(const QString& fileName, QTreeWidgetItem* root);
0032     QString currentSheetName;
0033     QStringList selectedSheetNames;
0034     bool firstRowAsColumnNames{false};
0035     int startRow{1};
0036     int endRow{-1};
0037     int startColumn{1};
0038     int endColumn{-1};
0039     int firstColumn{1}; // actual start column (including range)
0040 
0041 private:
0042 #ifdef HAVE_ORCUS
0043     orcus::spreadsheet::range_size_t m_ss{1048576, 16384};
0044     orcus::spreadsheet::document m_document{m_ss};
0045 #endif
0046 };
0047 
0048 #endif