1namespace Poppler {
2
3class FormField {
4%TypeHeaderCode
5#include <qt5/poppler-qt5.h>
6#include <qt5/poppler-form.h>
7%End
8
9public:
10    enum FormType {
11        FormButton,
12        FormText,
13        FormChoice,
14        FormSignature,
15    };
16    virtual ~FormField();
17    virtual FormType type() const = 0;
18    QRectF rect() const;
19    int id() const;
20    QString name() const;
21%If(POPPLER_V0_51_0 -)
22    void setName(const QString &name) const;
23%End
24%If(POPPLER_V0_20_0 -)
25    QString fullyQualifiedName() const;
26%End
27    QString uiName() const;
28    bool isReadOnly() const;
29    bool isVisible() const;
30    Poppler::Link* activationAction() const;
31%If(POPPLER_V0_53_0 -)
32	enum AdditionalActionType
33	{
34	    FieldModified,   ///< A JavaScript action to be performed when the user modifies the field
35	    FormatField,     ///< A JavaScript action to be performed before the field is formatted to display its value
36	    ValidateField,   ///< A JavaScript action to be performed when the field value changes
37	    CalculateField,  ///< A JavaScript action to be performed when the field needs to be recalculated
38	};
39	Link* additionalAction(AdditionalActionType type) const;
40%End
41
42private:
43    FormField(const Poppler::FormField&);
44
45%ConvertToSubClassCode
46    switch (sipCpp->type()) {
47        case Poppler::FormField::FormButton:
48            sipType = sipType_Poppler_FormFieldButton;
49            break;
50        case Poppler::FormField::FormText:
51            sipType = sipType_Poppler_FormFieldText;
52            break;
53        case Poppler::FormField::FormChoice:
54            sipType = sipType_Poppler_FormFieldChoice;
55            break;
56        default:
57            sipType = sipType_Poppler_FormField;
58    }
59%End
60
61}; // class FormField
62
63
64class FormFieldButton : Poppler::FormField {
65%TypeHeaderCode
66#include <qt5/poppler-qt5.h>
67#include <qt5/poppler-form.h>
68%End
69
70public:
71    enum ButtonType {
72        Push,
73        CheckBox,
74        Radio,
75    };
76//     FormFieldButton(DocumentData *doc, ::Page *p, ::FormWidgetButton *w);
77    virtual ~FormFieldButton();
78    virtual FormType type() const;
79    ButtonType buttonType() const;
80    QString caption() const;
81    bool state() const;
82    void setState( bool state );
83    QList<int> siblings() const;
84
85private:
86    FormFieldButton(const Poppler::FormFieldButton&);
87
88}; // class FormFieldButton
89
90
91class FormFieldText : Poppler::FormField {
92%TypeHeaderCode
93#include <qt5/poppler-qt5.h>
94#include <qt5/poppler-form.h>
95%End
96
97public:
98    enum TextType {
99        Normal,
100        Multiline,
101        FileSelect,
102    };
103//     FormFieldText(DocumentData *doc, ::Page *p, ::FormWidgetText *w);
104    virtual ~FormFieldText();
105    virtual FormType type() const;
106    TextType textType() const;
107    QString text() const;
108    void setText( const QString& text );
109    bool isPassword() const;
110    bool isRichText() const;
111    int maximumLength() const;
112    Qt::Alignment textAlignment() const;
113    bool canBeSpellChecked() const;
114    double getFontSize() const;
115    void setFontSize(int fontSize);
116
117private:
118    FormFieldText(const Poppler::FormFieldText&);
119
120}; // class FormFieldText
121
122
123class FormFieldChoice : Poppler::FormField {
124%TypeHeaderCode
125#include <qt5/poppler-qt5.h>
126#include <qt5/poppler-form.h>
127%End
128
129public:
130    enum ChoiceType {
131        ComboBox,
132        ListBox,
133    };
134//     FormFieldChoice(DocumentData *doc, ::Page *p, ::FormWidgetChoice *w);
135    virtual ~FormFieldChoice();
136    virtual FormType type() const;
137    ChoiceType choiceType() const;
138    QStringList choices() const;
139    bool isEditable() const;
140    bool multiSelect() const;
141    QList<int> currentChoices() const;
142    void setCurrentChoices( const QList<int> &choice );
143%If(POPPLER_V0_22_0 -)
144    QString editChoice() const;
145    void setEditChoice(const QString& text);
146%End
147    Qt::Alignment textAlignment() const;
148    bool canBeSpellChecked() const;
149
150private:
151    FormFieldChoice(const Poppler::FormFieldChoice&);
152
153}; // class FormFieldChoice
154
155%If(POPPLER_V0_51_0 -)
156class SignatureValidationInfo {
157%TypeHeaderCode
158#include <time.h>
159#include <qt5/poppler-qt5.h>
160#include <qt5/poppler-form.h>
161%End
162    public:
163	enum SignatureStatus {
164	    SignatureValid,          ///< The signature is cryptographically valid.
165	    SignatureInvalid,        ///< The signature is cryptographically invalid.
166	    SignatureDigestMismatch, ///< The document content was changed after the signature was applied.
167	    SignatureDecodingError,  ///< The signature CMS/PKCS7 structure is malformed.
168	    SignatureGenericError,   ///< The signature could not be verified.
169	    SignatureNotFound,       ///< The requested signature is not present in the document.
170	    SignatureNotVerified     ///< The signature is not yet verified.
171	};
172	enum CertificateStatus {
173	    CertificateTrusted,         ///< The certificate is considered trusted.
174	    CertificateUntrustedIssuer, ///< The issuer of this certificate has been marked as untrusted by the user.
175	    CertificateUnknownIssuer,   ///< The certificate trust chain has not finished in a trusted root certificate.
176	    CertificateRevoked,         ///< The certificate was revoked by the issuing certificate authority.
177	    CertificateExpired,         ///< The signing time is outside the validity bounds of this certificate.
178	    CertificateGenericError,    ///< The certificate could not be verified.
179	    CertificateNotVerified      ///< The certificate is not yet verified.
180	};
181
182%If(POPPLER_V0_58_0 -)
183	enum HashAlgorithm
184	{
185	    HashAlgorithmUnknown,
186	    HashAlgorithmMd2,
187	    HashAlgorithmMd5,
188	    HashAlgorithmSha1,
189	    HashAlgorithmSha256,
190	    HashAlgorithmSha384,
191	    HashAlgorithmSha512,
192	    HashAlgorithmSha224
193	};
194%End
195	SignatureStatus signatureStatus() const;
196	CertificateStatus certificateStatus() const;
197	QString signerName() const;
198%If(POPPLER_V0_58_0 -)
199	QString signerSubjectDN() const;
200	HashAlgorithm hashAlgorithm() const;
201    time_t signingTime() const;
202    QByteArray signature() const;
203    QList<qint64> signedRangeBounds() const;
204    bool signsTotalDocument() const;
205
206	private:
207    SignatureValidationInfo(const SignatureValidationInfo &other);
208    //SignatureValidationInfo &operator=(const SignatureValidationInfo &other);
209%End
210
211}; // class SignatureValidationInfo
212
213class FormFieldSignature : Poppler::FormField {
214%TypeHeaderCode
215#include <qt5/poppler-qt5.h>
216#include <qt5/poppler-form.h>
217%End
218    public:
219
220%If(POPPLER_V0_58_0 -)
221	enum SignatureType {
222	    AdbePkcs7sha1,
223	    AdbePkcs7detached,
224	    EtsiCAdESdetached
225	};
226%End
227	enum ValidateOptions {
228	    ValidateVerifyCertificate = 1, ///< Validate the certificate.
229	    ValidateForceRevalidation = 2, ///< Force revalidation of the certificate.
230	};
231
232    private:
233	//FormFieldSignature(DocumentData *doc, ::Page *p, ::FormWidgetSignature *w);
234	//~FormFieldSignature();
235    FormFieldSignature(const Poppler::FormFieldSignature&);
236
237	FormType type() const;
238%If(POPPLER_V0_58_0 -)
239	SignatureType signatureType() const;
240%End
241
242	SignatureValidationInfo validate(ValidateOptions opt) const;
243%If(POPPLER_V0_58_0 -)
244	SignatureValidationInfo validate(int opt, const QDateTime& validationTime) const;
245%End
246};  // FormFieldSignature
247
248%End // POPPLER_V0_51_0
249
250
251
252
253}; // namespace Poppler
254
255/* kate: indent-width 4; space-indent on; hl c++; indent-mode cstyle; */
256