xlsxworkbook.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // xlsxworkbook.h
  2. #ifndef XLSXWORKBOOK_H
  3. #define XLSXWORKBOOK_H
  4. #include <QtGlobal>
  5. #include <QList>
  6. #include <QImage>
  7. #include <QSharedPointer>
  8. #include <QIODevice>
  9. #include "xlsxglobal.h"
  10. #include "xlsxabstractooxmlfile.h"
  11. #include "xlsxabstractsheet.h"
  12. QT_BEGIN_NAMESPACE_XLSX
  13. class SharedStrings;
  14. class Styles;
  15. class Drawing;
  16. class Document;
  17. class Theme;
  18. class Relationships;
  19. class DocumentPrivate;
  20. class MediaFile;
  21. class Chart;
  22. class Chartsheet;
  23. class Worksheet;
  24. class WorkbookPrivate;
  25. class Workbook : public AbstractOOXmlFile
  26. {
  27. Q_DECLARE_PRIVATE(Workbook)
  28. public:
  29. ~Workbook();
  30. int sheetCount() const;
  31. AbstractSheet *sheet(int index) const;
  32. AbstractSheet *addSheet(const QString &name = QString(), AbstractSheet::SheetType type = AbstractSheet::ST_WorkSheet);
  33. AbstractSheet *insertSheet(int index, const QString &name = QString(), AbstractSheet::SheetType type = AbstractSheet::ST_WorkSheet);
  34. bool renameSheet(int index, const QString &name);
  35. bool deleteSheet(int index);
  36. bool copySheet(int index, const QString &newName=QString());
  37. bool moveSheet(int srcIndex, int distIndex);
  38. AbstractSheet *activeSheet() const;
  39. bool setActiveSheet(int index);
  40. // void addChart();
  41. bool defineName(const QString &name, const QString &formula, const QString &comment=QString(), const QString &scope=QString());
  42. bool isDate1904() const;
  43. void setDate1904(bool date1904);
  44. bool isStringsToNumbersEnabled() const;
  45. void setStringsToNumbersEnabled(bool enable=true);
  46. bool isStringsToHyperlinksEnabled() const;
  47. void setStringsToHyperlinksEnabled(bool enable=true);
  48. bool isHtmlToRichStringEnabled() const;
  49. void setHtmlToRichStringEnabled(bool enable=true);
  50. QString defaultDateFormat() const;
  51. void setDefaultDateFormat(const QString &format);
  52. //internal used member
  53. void addMediaFile(QSharedPointer<MediaFile> media, bool force=false);
  54. QList<QSharedPointer<MediaFile> > mediaFiles() const;
  55. void addChartFile(QSharedPointer<Chart> chartFile);
  56. QList<QSharedPointer<Chart> > chartFiles() const;
  57. private:
  58. friend class Worksheet;
  59. friend class Chartsheet;
  60. friend class WorksheetPrivate;
  61. friend class Document;
  62. friend class DocumentPrivate;
  63. Workbook(Workbook::CreateFlag flag);
  64. void saveToXmlFile(QIODevice *device) const;
  65. bool loadFromXmlFile(QIODevice *device);
  66. SharedStrings *sharedStrings() const;
  67. Styles *styles();
  68. Theme *theme();
  69. QList<QImage> images();
  70. QList<Drawing *> drawings();
  71. QList<QSharedPointer<AbstractSheet> > getSheetsByTypes(AbstractSheet::SheetType type) const;
  72. QStringList worksheetNames() const;
  73. AbstractSheet *addSheet(const QString &name, int sheetId, AbstractSheet::SheetType type = AbstractSheet::ST_WorkSheet);
  74. };
  75. QT_END_NAMESPACE_XLSX
  76. #endif // XLSXWORKBOOK_H