00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _POPPLER_QT4_FORM_H_
00021 #define _POPPLER_QT4_FORM_H_
00022
00023 #include <QtCore/QRectF>
00024 #include <QtCore/QStringList>
00025 #include "poppler-export.h"
00026
00027 class Page;
00028 class FormWidget;
00029 class FormWidgetButton;
00030 class FormWidgetText;
00031 class FormWidgetChoice;
00032
00033 namespace Poppler {
00034
00035 class DocumentData;
00036 class Link;
00037
00038 class FormFieldData;
00044 class POPPLER_QT4_EXPORT FormField {
00045 public:
00046
00050 enum FormType {
00051 FormButton,
00052 FormText,
00053 FormChoice,
00054 FormSignature
00055 };
00056
00057 virtual ~FormField();
00058
00062 virtual FormType type() const = 0;
00063
00068 QRectF rect() const;
00069
00073 int id() const;
00074
00078 QString name() const;
00079
00084 QString uiName() const;
00085
00089 bool isReadOnly() const;
00090
00094 bool isVisible() const;
00095
00101 Link* activationAction() const;
00102
00103 protected:
00105 FormField(FormFieldData &dd);
00106
00107 FormFieldData *m_formData;
00109
00110 private:
00111 Q_DISABLE_COPY(FormField)
00112 };
00113
00119 class POPPLER_QT4_EXPORT FormFieldButton : public FormField {
00120 public:
00121
00125 enum ButtonType
00126 {
00127 Push,
00128 CheckBox,
00129 Radio
00130 };
00131
00133 FormFieldButton(DocumentData *doc, ::Page *p, ::FormWidgetButton *w);
00135 virtual ~FormFieldButton();
00136
00137 virtual FormType type() const;
00138
00142 ButtonType buttonType() const;
00143
00147 QString caption() const;
00148
00152 bool state() const;
00153
00157 void setState( bool state );
00158
00165 QList<int> siblings() const;
00166
00167 private:
00168 Q_DISABLE_COPY(FormFieldButton)
00169 };
00170
00176 class POPPLER_QT4_EXPORT FormFieldText : public FormField {
00177 public:
00178
00182 enum TextType {
00183 Normal,
00184 Multiline,
00185 FileSelect
00186 };
00187
00189 FormFieldText(DocumentData *doc, ::Page *p, ::FormWidgetText *w);
00191 virtual ~FormFieldText();
00192
00193 virtual FormType type() const;
00194
00198 TextType textType() const;
00199
00203 QString text() const;
00204
00209 void setText( const QString& text );
00210
00217 bool isPassword() const;
00218
00222 bool isRichText() const;
00223
00227 int maximumLength() const;
00228
00232 Qt::Alignment textAlignment() const;
00233
00238 bool canBeSpellChecked() const;
00239
00240 private:
00241 Q_DISABLE_COPY(FormFieldText)
00242 };
00243
00249 class POPPLER_QT4_EXPORT FormFieldChoice : public FormField {
00250 public:
00251
00255 enum ChoiceType {
00256 ComboBox,
00257 ListBox
00258 };
00259
00261 FormFieldChoice(DocumentData *doc, ::Page *p, ::FormWidgetChoice *w);
00263 virtual ~FormFieldChoice();
00264
00265 virtual FormType type() const;
00266
00270 ChoiceType choiceType() const;
00271
00275 QStringList choices() const;
00276
00283 bool isEditable() const;
00284
00291 bool multiSelect() const;
00292
00296 QList<int> currentChoices() const;
00297
00301 void setCurrentChoices( const QList<int> &choice );
00302
00306 Qt::Alignment textAlignment() const;
00307
00314 bool canBeSpellChecked() const;
00315
00316 private:
00317 Q_DISABLE_COPY(FormFieldChoice)
00318 };
00319
00320 }
00321
00322 #endif