1
/* poppler-form.h: qt4 interface to poppler
2
* Copyright (C) 2007-2008, Pino Toscano <pino@kde.org>
3
* Copyright (C) 2008, Albert Astals Cid <aacid@kde.org>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2, or (at your option)
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
20
#ifndef _POPPLER_QT4_FORM_H_
21
#define _POPPLER_QT4_FORM_H_
23
#include <QtCore/QRectF>
24
#include <QtCore/QStringList>
25
#include "poppler-export.h"
29
class FormWidgetButton;
31
class FormWidgetChoice;
40
The base class representing a form field.
44
class POPPLER_QT4_EXPORT FormField {
48
The different types of form field.
51
FormButton, ///< A button field. See \ref Poppler::FormFieldButton::ButtonType "ButtonType"
52
FormText, ///< A text field. See \ref Poppler::FormFieldText::TextType "TextType"
53
FormChoice, ///< A single choice field. See \ref Poppler::FormFieldChoice::ChoiceType "ChoiceType"
54
FormSignature ///< A signature field.
60
The type of the field.
62
virtual FormType type() const = 0;
65
\return The size of the field, in normalized coordinates, i.e.
66
[0..1] with regard to the dimensions (cropbox) of the page
76
The internal name of the field.
81
The name of the field to be used in user interface (eg messages to
84
QString uiName() const;
87
Whether this form field is read-only.
89
bool isReadOnly() const;
92
Whether this form field is visible.
94
bool isVisible() const;
97
The activation action of this form field.
101
Link* activationAction() const;
105
FormField(FormFieldData &dd);
107
FormFieldData *m_formData;
111
Q_DISABLE_COPY(FormField)
115
A form field that represents a "button".
119
class POPPLER_QT4_EXPORT FormFieldButton : public FormField {
123
* The types of button field.
127
Push, ///< A simple push button.
128
CheckBox, ///< A check box.
129
Radio ///< A radio button.
133
FormFieldButton(DocumentData *doc, ::Page *p, ::FormWidgetButton *w);
135
virtual ~FormFieldButton();
137
virtual FormType type() const;
140
The particular type of the button field.
142
ButtonType buttonType() const;
145
* The caption to be used for the button.
147
QString caption() const;
150
The state of the button.
155
Sets the state of the button to the new \p state .
157
void setState( bool state );
160
The list with the IDs of siblings (ie, buttons belonging to the same
161
group as the current one.
163
Valid only for \ref Radio buttons, an empty list otherwise.
165
QList<int> siblings() const;
168
Q_DISABLE_COPY(FormFieldButton)
172
A form field that represents a text input.
176
class POPPLER_QT4_EXPORT FormFieldText : public FormField {
180
The particular type of this text field.
183
Normal, ///< A simple singleline text field.
184
Multiline, ///< A multiline text field.
185
FileSelect ///< An input field to select the path of a file on disk.
189
FormFieldText(DocumentData *doc, ::Page *p, ::FormWidgetText *w);
191
virtual ~FormFieldText();
193
virtual FormType type() const;
196
The text type of the text field.
198
TextType textType() const;
201
The text associated with the text field.
203
QString text() const;
206
Sets the text associated with the text field to the specified
209
void setText( const QString& text );
212
Whether this text field is a password input, eg its text \b must be
213
replaced with asterisks.
215
Always false for \ref FileSelect text fields.
217
bool isPassword() const;
220
Whether this text field should allow rich text.
222
bool isRichText() const;
225
The maximum length for the text of this field, or -1 if not set.
227
int maximumLength() const;
230
The horizontal alignment for the text of this text field.
232
Qt::Alignment textAlignment() const;
235
Whether the text inserted manually in the field (where possible)
236
can be spell-checked.
238
bool canBeSpellChecked() const;
241
Q_DISABLE_COPY(FormFieldText)
245
A form field that represents a choice field.
249
class POPPLER_QT4_EXPORT FormFieldChoice : public FormField {
253
The particular type of this choice field.
256
ComboBox, ///< A simple singleline text field.
257
ListBox ///< A multiline text field.
261
FormFieldChoice(DocumentData *doc, ::Page *p, ::FormWidgetChoice *w);
263
virtual ~FormFieldChoice();
265
virtual FormType type() const;
268
The choice type of the choice field.
270
ChoiceType choiceType() const;
273
The possible choices of the choice field.
275
QStringList choices() const;
278
Whether this FormFieldChoice::ComboBox is editable, i.e. the user
279
can type in a custom value.
281
Always false for the other types of choices.
283
bool isEditable() const;
286
Whether more than one choice of this FormFieldChoice::ListBox
287
can be selected at the same time.
289
Always false for the other types of choices.
291
bool multiSelect() const;
294
The currently selected choices.
296
QList<int> currentChoices() const;
299
Sets the selected choices to \p choice.
301
void setCurrentChoices( const QList<int> &choice );
304
The horizontal alignment for the text of this text field.
306
Qt::Alignment textAlignment() const;
309
Whether the text inserted manually in the field (where possible)
310
can be spell-checked.
312
Returns false if the field is not an editable text field.
314
bool canBeSpellChecked() const;
317
Q_DISABLE_COPY(FormFieldChoice)