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 QXLSX_XLSXDATAVALIDATION_H andre@1: #define QXLSX_XLSXDATAVALIDATION_H andre@1: andre@1: #include "xlsxglobal.h" andre@1: #include andre@1: #include andre@1: #include andre@1: andre@1: class QXmlStreamReader; andre@1: class QXmlStreamWriter; andre@1: andre@1: QT_BEGIN_NAMESPACE_XLSX andre@1: andre@1: class Worksheet; andre@1: class CellRange; andre@1: class CellReference; andre@1: andre@1: class DataValidationPrivate; andre@1: class Q_XLSX_EXPORT DataValidation andre@1: { andre@1: public: andre@1: enum ValidationType andre@1: { andre@1: None, andre@1: Whole, andre@1: Decimal, andre@1: List, andre@1: Date, andre@1: Time, andre@1: TextLength, andre@1: Custom andre@1: }; andre@1: andre@1: enum ValidationOperator andre@1: { andre@1: Between, andre@1: NotBetween, andre@1: Equal, andre@1: NotEqual, andre@1: LessThan, andre@1: LessThanOrEqual, andre@1: GreaterThan, andre@1: GreaterThanOrEqual andre@1: }; andre@1: andre@1: enum ErrorStyle andre@1: { andre@1: Stop, andre@1: Warning, andre@1: Information andre@1: }; andre@1: andre@1: DataValidation(); andre@1: DataValidation(ValidationType type, ValidationOperator op=Between, const QString &formula1=QString() andre@1: , const QString &formula2=QString(), bool allowBlank=false); andre@1: DataValidation(const DataValidation &other); andre@1: ~DataValidation(); andre@1: andre@1: ValidationType validationType() const; andre@1: ValidationOperator validationOperator() const; andre@1: ErrorStyle errorStyle() const; andre@1: QString formula1() const; andre@1: QString formula2() const; andre@1: bool allowBlank() const; andre@1: QString errorMessage() const; andre@1: QString errorMessageTitle() const; andre@1: QString promptMessage() const; andre@1: QString promptMessageTitle() const; andre@1: bool isPromptMessageVisible() const; andre@1: bool isErrorMessageVisible() const; andre@1: QList ranges() const; andre@1: andre@1: void setValidationType(ValidationType type); andre@1: void setValidationOperator(ValidationOperator op); andre@1: void setErrorStyle(ErrorStyle es); andre@1: void setFormula1(const QString &formula); andre@1: void setFormula2(const QString &formula); andre@1: void setErrorMessage(const QString &error, const QString &title=QString()); andre@1: void setPromptMessage(const QString &prompt, const QString &title=QString()); andre@1: void setAllowBlank(bool enable); andre@1: void setPromptMessageVisible(bool visible); andre@1: void setErrorMessageVisible(bool visible); andre@1: andre@1: void addCell(const CellReference &cell); andre@1: void addCell(int row, int col); andre@1: void addRange(int firstRow, int firstCol, int lastRow, int lastCol); andre@1: void addRange(const CellRange &range); andre@1: andre@1: DataValidation &operator=(const DataValidation &other); andre@1: andre@1: bool saveToXml(QXmlStreamWriter &writer) const; andre@1: static DataValidation loadFromXml(QXmlStreamReader &reader); andre@1: private: andre@1: QSharedDataPointer d; andre@1: }; andre@1: andre@1: QT_END_NAMESPACE_XLSX andre@1: andre@1: #endif // QXLSX_XLSXDATAVALIDATION_H