~ubuntu-branches/ubuntu/oneiric/luatex/oneiric

« back to all changes in this revision

Viewing changes to source/libs/poppler/poppler-0.12.4/qt4/src/poppler-form.h

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2011-04-10 21:08:04 UTC
  • mfrom: (0.3.1) (1.6.1) (19.1.5 natty)
  • Revision ID: package-import@ubuntu.com-20110410210804-m979ehyw4hnzvhu3
Tags: 0.65.0-1ubuntu3
RebuildĀ againstĀ libpoppler13.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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>
 
4
 *
 
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)
 
8
 * any later version.
 
9
 *
 
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.
 
14
 *
 
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.
 
18
 */
 
19
 
 
20
#ifndef _POPPLER_QT4_FORM_H_
 
21
#define _POPPLER_QT4_FORM_H_
 
22
 
 
23
#include <QtCore/QRectF>
 
24
#include <QtCore/QStringList>
 
25
#include "poppler-export.h"
 
26
 
 
27
class Page;
 
28
class FormWidget;
 
29
class FormWidgetButton;
 
30
class FormWidgetText;
 
31
class FormWidgetChoice;
 
32
 
 
33
namespace Poppler {
 
34
 
 
35
    class DocumentData;
 
36
    class Link;
 
37
 
 
38
    class FormFieldData;
 
39
    /**
 
40
      The base class representing a form field.
 
41
 
 
42
      \since 0.6
 
43
     */
 
44
    class POPPLER_QT4_EXPORT FormField {
 
45
    public:
 
46
 
 
47
        /**
 
48
           The different types of form field.
 
49
        */
 
50
        enum FormType {
 
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.
 
55
        };
 
56
 
 
57
        virtual ~FormField();
 
58
 
 
59
        /**
 
60
          The type of the field.
 
61
         */
 
62
        virtual FormType type() const = 0;
 
63
 
 
64
        /**
 
65
           \return The size of the field, in normalized coordinates, i.e.
 
66
           [0..1] with regard to the dimensions (cropbox) of the page
 
67
        */
 
68
        QRectF rect() const;
 
69
 
 
70
        /**
 
71
          The ID of the field.
 
72
         */
 
73
        int id() const;
 
74
 
 
75
        /**
 
76
          The internal name of the field.
 
77
         */
 
78
        QString name() const;
 
79
 
 
80
        /**
 
81
          The name of the field to be used in user interface (eg messages to
 
82
          the user).
 
83
         */
 
84
        QString uiName() const;
 
85
 
 
86
        /**
 
87
          Whether this form field is read-only.
 
88
         */
 
89
        bool isReadOnly() const;
 
90
 
 
91
        /**
 
92
          Whether this form field is visible.
 
93
         */
 
94
        bool isVisible() const;
 
95
 
 
96
        /**
 
97
          The activation action of this form field.
 
98
 
 
99
          \note It may be null.
 
100
         */
 
101
        Link* activationAction() const;
 
102
 
 
103
    protected:
 
104
        /// \cond PRIVATE
 
105
        FormField(FormFieldData &dd);
 
106
 
 
107
        FormFieldData *m_formData;
 
108
        /// \endcond
 
109
 
 
110
    private:
 
111
        Q_DISABLE_COPY(FormField)
 
112
    };
 
113
 
 
114
    /**
 
115
      A form field that represents a "button".
 
116
 
 
117
      \since 0.8
 
118
     */
 
119
    class POPPLER_QT4_EXPORT FormFieldButton : public FormField {
 
120
    public:
 
121
 
 
122
        /**
 
123
         * The types of button field.
 
124
         */
 
125
        enum ButtonType
 
126
        {
 
127
            Push,          ///< A simple push button.
 
128
            CheckBox,      ///< A check box.
 
129
            Radio          ///< A radio button.
 
130
        };
 
131
 
 
132
        /// \cond PRIVATE
 
133
        FormFieldButton(DocumentData *doc, ::Page *p, ::FormWidgetButton *w);
 
134
        /// \endcond
 
135
        virtual ~FormFieldButton();
 
136
 
 
137
        virtual FormType type() const;
 
138
 
 
139
        /**
 
140
          The particular type of the button field.
 
141
         */
 
142
        ButtonType buttonType() const;
 
143
 
 
144
        /**
 
145
         * The caption to be used for the button.
 
146
         */
 
147
        QString caption() const;
 
148
 
 
149
        /**
 
150
          The state of the button.
 
151
         */
 
152
        bool state() const;
 
153
 
 
154
        /**
 
155
          Sets the state of the button to the new \p state .
 
156
         */
 
157
        void setState( bool state );
 
158
 
 
159
        /**
 
160
          The list with the IDs of siblings (ie, buttons belonging to the same
 
161
          group as the current one.
 
162
 
 
163
          Valid only for \ref Radio buttons, an empty list otherwise.
 
164
         */
 
165
        QList<int> siblings() const;
 
166
 
 
167
    private:
 
168
        Q_DISABLE_COPY(FormFieldButton)
 
169
    };
 
170
 
 
171
    /**
 
172
      A form field that represents a text input.
 
173
 
 
174
      \since 0.6
 
175
     */
 
176
    class POPPLER_QT4_EXPORT FormFieldText : public FormField {
 
177
    public:
 
178
 
 
179
        /**
 
180
           The particular type of this text field.
 
181
        */
 
182
        enum TextType {
 
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.
 
186
        };
 
187
 
 
188
        /// \cond PRIVATE
 
189
        FormFieldText(DocumentData *doc, ::Page *p, ::FormWidgetText *w);
 
190
        /// \endcond
 
191
        virtual ~FormFieldText();
 
192
 
 
193
        virtual FormType type() const;
 
194
 
 
195
        /**
 
196
          The text type of the text field.
 
197
         */
 
198
        TextType textType() const;
 
199
 
 
200
        /**
 
201
          The text associated with the text field.
 
202
         */
 
203
        QString text() const;
 
204
 
 
205
        /**
 
206
          Sets the text associated with the text field to the specified
 
207
          \p text.
 
208
         */
 
209
        void setText( const QString& text );
 
210
 
 
211
        /**
 
212
          Whether this text field is a password input, eg its text \b must be
 
213
          replaced with asterisks.
 
214
 
 
215
          Always false for \ref FileSelect text fields.
 
216
         */
 
217
        bool isPassword() const;
 
218
 
 
219
        /**
 
220
          Whether this text field should allow rich text.
 
221
         */
 
222
        bool isRichText() const;
 
223
 
 
224
        /**
 
225
          The maximum length for the text of this field, or -1 if not set.
 
226
         */
 
227
        int maximumLength() const;
 
228
 
 
229
        /**
 
230
          The horizontal alignment for the text of this text field.
 
231
         */
 
232
        Qt::Alignment textAlignment() const;
 
233
 
 
234
        /**
 
235
          Whether the text inserted manually in the field (where possible)
 
236
          can be spell-checked.
 
237
         */
 
238
        bool canBeSpellChecked() const;
 
239
 
 
240
    private:
 
241
        Q_DISABLE_COPY(FormFieldText)
 
242
    };
 
243
 
 
244
    /**
 
245
      A form field that represents a choice field.
 
246
 
 
247
      \since 0.6
 
248
     */
 
249
    class POPPLER_QT4_EXPORT FormFieldChoice : public FormField {
 
250
    public:
 
251
 
 
252
        /**
 
253
           The particular type of this choice field.
 
254
        */
 
255
        enum ChoiceType {
 
256
            ComboBox,     ///< A simple singleline text field.
 
257
            ListBox       ///< A multiline text field.
 
258
        };
 
259
 
 
260
        /// \cond PRIVATE
 
261
        FormFieldChoice(DocumentData *doc, ::Page *p, ::FormWidgetChoice *w);
 
262
        /// \endcond
 
263
        virtual ~FormFieldChoice();
 
264
 
 
265
        virtual FormType type() const;
 
266
 
 
267
        /**
 
268
          The choice type of the choice field.
 
269
         */
 
270
        ChoiceType choiceType() const;
 
271
 
 
272
        /**
 
273
          The possible choices of the choice field.
 
274
         */
 
275
        QStringList choices() const;
 
276
 
 
277
        /**
 
278
          Whether this FormFieldChoice::ComboBox is editable, i.e. the user
 
279
          can type in a custom value.
 
280
 
 
281
          Always false for the other types of choices.
 
282
         */
 
283
        bool isEditable() const;
 
284
 
 
285
        /**
 
286
          Whether more than one choice of this FormFieldChoice::ListBox
 
287
          can be selected at the same time.
 
288
 
 
289
          Always false for the other types of choices.
 
290
         */
 
291
        bool multiSelect() const;
 
292
 
 
293
        /**
 
294
          The currently selected choices.
 
295
         */
 
296
        QList<int> currentChoices() const;
 
297
 
 
298
        /**
 
299
          Sets the selected choices to \p choice.
 
300
         */
 
301
        void setCurrentChoices( const QList<int> &choice );
 
302
 
 
303
        /**
 
304
          The horizontal alignment for the text of this text field.
 
305
         */
 
306
        Qt::Alignment textAlignment() const;
 
307
 
 
308
        /**
 
309
          Whether the text inserted manually in the field (where possible)
 
310
          can be spell-checked.
 
311
 
 
312
          Returns false if the field is not an editable text field.
 
313
         */
 
314
        bool canBeSpellChecked() const;
 
315
 
 
316
    private:
 
317
        Q_DISABLE_COPY(FormFieldChoice)
 
318
    };
 
319
 
 
320
}
 
321
 
 
322
#endif