File indexing completed on 2025-01-19 13:27:35
0001 /* 0002 * This file is part of Office 2007 Filters for Calligra 0003 * 0004 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 0005 * 0006 * Contact: Suresh Chande suresh.chande@nokia.com 0007 * 0008 * This library is free software; you can redistribute it and/or 0009 * modify it under the terms of the GNU Lesser General Public License 0010 * version 2.1 as published by the Free Software Foundation. 0011 * 0012 * This library is distributed in the hope that it will be useful, but 0013 * WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Lesser General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Lesser General Public 0018 * License along with this library; if not, write to the Free Software 0019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 0020 * 02110-1301 USA 0021 * 0022 */ 0023 0024 #ifndef XLSXXMLDOCUMENTREADER_H 0025 #define XLSXXMLDOCUMENTREADER_H 0026 0027 #include <MsooXmlTheme.h> 0028 #include <MsooXmlReader.h> 0029 0030 #include <QMap> 0031 0032 class XlsxImport; 0033 class XlsxComments; 0034 class XlsxStyles; 0035 0036 //! Context for XlsxXmlDocumentReader 0037 class XlsxXmlDocumentReaderContext : public MSOOXML::MsooXmlReaderContext 0038 { 0039 public: 0040 XlsxXmlDocumentReaderContext(XlsxImport& _import, 0041 MSOOXML::DrawingMLTheme* _themes, 0042 const QVector<QString>& _sharedStrings, 0043 const XlsxComments& _comments, 0044 const XlsxStyles& _styles, 0045 MSOOXML::MsooXmlRelationships& _relationships, 0046 const QString &_file, const QString &_path); 0047 XlsxImport *import; 0048 MSOOXML::DrawingMLTheme *themes; 0049 const QVector<QString>* sharedStrings; 0050 const XlsxComments* comments; 0051 const XlsxStyles* styles; 0052 QString file, path; 0053 0054 struct AutoFilterCondition { 0055 QString field; 0056 QString value; 0057 QString opField; 0058 }; 0059 0060 struct AutoFilter { 0061 QString type; // empty, -and, -or 0062 QString area; 0063 QString field; 0064 QVector<AutoFilterCondition> filterConditions; 0065 }; 0066 0067 QVector<XlsxXmlDocumentReaderContext::AutoFilter> autoFilters; 0068 }; 0069 0070 //! A class reading MSOOXML XLSX markup - workbook.xml part. 0071 class XlsxXmlDocumentReader : public MSOOXML::MsooXmlReader 0072 { 0073 public: 0074 explicit XlsxXmlDocumentReader(KoOdfWriters *writers); 0075 0076 ~XlsxXmlDocumentReader() override; 0077 0078 //! Reads/parses the file of format document.xml. 0079 //! The output goes mainly to KoXmlWriter* KoOdfWriters::body 0080 KoFilter::ConversionStatus read(MSOOXML::MsooXmlReaderContext* context = 0) override; 0081 0082 protected: 0083 KoFilter::ConversionStatus readInternal(); 0084 KoFilter::ConversionStatus read_workbook(); 0085 KoFilter::ConversionStatus read_sheets(); 0086 KoFilter::ConversionStatus read_sheet(); 0087 0088 XlsxXmlDocumentReaderContext* m_context; 0089 private: 0090 void init(); 0091 0092 class Private; 0093 Private* const d; 0094 }; 0095 0096 #endif //XLSXXMLDOCUMENTREADER_H