File indexing completed on 2024-06-23 03:45:56

0001 // xlsxcellformula.h
0002 
0003 #ifndef QXLSX_XLSXCELLFORMULA_H
0004 #define QXLSX_XLSXCELLFORMULA_H
0005 
0006 #include "xlsxglobal.h"
0007 
0008 #include <QExplicitlySharedDataPointer>
0009 
0010 class QXmlStreamWriter;
0011 class QXmlStreamReader;
0012 
0013 QT_BEGIN_NAMESPACE_XLSX
0014 
0015 class CellFormulaPrivate;
0016 class CellRange;
0017 class Worksheet;
0018 class WorksheetPrivate;
0019 
0020 class QXLSX_EXPORT CellFormula
0021 {
0022 public:
0023     enum FormulaType { NormalType, ArrayType, DataTableType, SharedType };
0024 
0025 public:
0026     CellFormula();
0027     CellFormula(const char *formula, FormulaType type=NormalType);
0028     CellFormula(const QString &formula, FormulaType type=NormalType);
0029     CellFormula(const QString &formula, const CellRange &ref, FormulaType type);
0030     CellFormula(const CellFormula &other);
0031     ~CellFormula();
0032 
0033 public:
0034     CellFormula &operator =(const CellFormula &other);
0035     bool isValid() const;
0036 
0037     FormulaType formulaType() const;
0038     QString formulaText() const;
0039     CellRange reference() const;
0040     int sharedIndex() const;
0041 
0042     bool operator == (const CellFormula &formula) const;
0043     bool operator != (const CellFormula &formula) const;
0044 
0045     bool saveToXml(QXmlStreamWriter &writer) const;
0046     bool loadFromXml(QXmlStreamReader &reader);
0047 private:
0048     friend class Worksheet;
0049     friend class WorksheetPrivate;
0050     QExplicitlySharedDataPointer<CellFormulaPrivate> d;
0051 };
0052 
0053 QT_END_NAMESPACE_XLSX
0054 
0055 #endif // QXLSX_XLSXCELLFORMULA_H