andre@1: /**************************************************************************** andre@1: ** Copyright (c) 2013-2014 Debao Zhang andre@1: ** All right reserved. andre@1: ** andre@1: ** Permission is hereby granted, free of charge, to any person obtaining andre@1: ** a copy of this software and associated documentation files (the andre@1: ** "Software"), to deal in the Software without restriction, including andre@1: ** without limitation the rights to use, copy, modify, merge, publish, andre@1: ** distribute, sublicense, and/or sell copies of the Software, and to andre@1: ** permit persons to whom the Software is furnished to do so, subject to andre@1: ** the following conditions: andre@1: ** andre@1: ** The above copyright notice and this permission notice shall be andre@1: ** included in all copies or substantial portions of the Software. andre@1: ** andre@1: ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, andre@1: ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF andre@1: ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND andre@1: ** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE andre@1: ** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION andre@1: ** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION andre@1: ** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. andre@1: ** andre@1: ****************************************************************************/ andre@1: #ifndef XLSXWORKBOOK_H andre@1: #define XLSXWORKBOOK_H andre@1: andre@1: #include "xlsxglobal.h" andre@1: #include "xlsxabstractooxmlfile.h" andre@1: #include "xlsxabstractsheet.h" andre@1: #include andre@1: #include andre@1: #include andre@1: andre@1: class QIODevice; andre@1: andre@1: QT_BEGIN_NAMESPACE_XLSX andre@1: andre@1: class SharedStrings; andre@1: class Styles; andre@1: class Drawing; andre@1: class Document; andre@1: class Theme; andre@1: class Relationships; andre@1: class DocumentPrivate; andre@1: class MediaFile; andre@1: class Chart; andre@1: class Chartsheet; andre@1: class Worksheet; andre@1: andre@1: class WorkbookPrivate; andre@1: class Q_XLSX_EXPORT Workbook : public AbstractOOXmlFile andre@1: { andre@1: Q_DECLARE_PRIVATE(Workbook) andre@1: public: andre@1: ~Workbook(); andre@1: andre@1: int sheetCount() const; andre@1: AbstractSheet *sheet(int index) const; andre@1: andre@1: AbstractSheet *addSheet(const QString &name = QString(), AbstractSheet::SheetType type = AbstractSheet::ST_WorkSheet); andre@1: AbstractSheet *insertSheet(int index, const QString &name = QString(), AbstractSheet::SheetType type = AbstractSheet::ST_WorkSheet); andre@1: bool renameSheet(int index, const QString &name); andre@1: bool deleteSheet(int index); andre@1: bool copySheet(int index, const QString &newName=QString()); andre@1: bool moveSheet(int srcIndex, int distIndex); andre@1: andre@1: AbstractSheet *activeSheet() const; andre@1: bool setActiveSheet(int index); andre@1: andre@1: // void addChart(); andre@1: bool defineName(const QString &name, const QString &formula, const QString &comment=QString(), const QString &scope=QString()); andre@1: bool isDate1904() const; andre@1: void setDate1904(bool date1904); andre@1: bool isStringsToNumbersEnabled() const; andre@1: void setStringsToNumbersEnabled(bool enable=true); andre@1: bool isStringsToHyperlinksEnabled() const; andre@1: void setStringsToHyperlinksEnabled(bool enable=true); andre@1: bool isHtmlToRichStringEnabled() const; andre@1: void setHtmlToRichStringEnabled(bool enable=true); andre@1: QString defaultDateFormat() const; andre@1: void setDefaultDateFormat(const QString &format); andre@1: andre@1: //internal used member andre@1: void addMediaFile(QSharedPointer media, bool force=false); andre@1: QList > mediaFiles() const; andre@1: void addChartFile(QSharedPointer chartFile); andre@1: QList > chartFiles() const; andre@1: andre@1: private: andre@1: friend class Worksheet; andre@1: friend class Chartsheet; andre@1: friend class WorksheetPrivate; andre@1: friend class Document; andre@1: friend class DocumentPrivate; andre@1: andre@1: Workbook(Workbook::CreateFlag flag); andre@1: andre@1: void saveToXmlFile(QIODevice *device) const; andre@1: bool loadFromXmlFile(QIODevice *device); andre@1: andre@1: SharedStrings *sharedStrings() const; andre@1: Styles *styles(); andre@1: Theme *theme(); andre@1: QList images(); andre@1: QList drawings(); andre@1: QList > getSheetsByTypes(AbstractSheet::SheetType type) const; andre@1: QStringList worksheetNames() const; andre@1: AbstractSheet *addSheet(const QString &name, int sheetId, AbstractSheet::SheetType type = AbstractSheet::ST_WorkSheet); andre@1: }; andre@1: andre@1: QT_END_NAMESPACE_XLSX andre@1: andre@1: #endif // XLSXWORKBOOK_H