Okular

form.h
1 /***************************************************************************
2  * Copyright (C) 2007 by Pino Toscano <[email protected]> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  ***************************************************************************/
9 
10 #ifndef _OKULAR_FORM_H_
11 #define _OKULAR_FORM_H_
12 
13 #include "okularcore_export.h"
14 #include "area.h"
15 #include "annotations.h"
16 #include "signatureutils.h"
17 
18 #include <QStringList>
19 
20 #include <memory>
21 
22 namespace Okular {
23 
24 class Action;
25 class Page;
26 class PagePrivate;
27 class FormFieldPrivate;
28 class FormFieldButtonPrivate;
29 class FormFieldTextPrivate;
30 class FormFieldChoicePrivate;
31 class FormFieldSignaturePrivate;
32 
41 class OKULARCORE_EXPORT FormField
42 {
44  friend class Page;
45  friend class PagePrivate;
47 
48  public:
52  enum FieldType
53  {
57  FormSignature
58  };
59 
60  virtual ~FormField();
61 
65  FieldType type() const;
66 
70  virtual NormalizedRect rect() const = 0;
71 
75  virtual int id() const = 0;
76 
81  virtual QString name() const = 0;
82 
87  virtual QString uiName() const = 0;
88 
95  virtual QString fullyQualifiedName() const = 0;
96 
100  virtual bool isReadOnly() const;
101 
107  virtual void setReadOnly( bool value );
108 
112  virtual bool isVisible() const;
113 
119  virtual void setVisible( bool value );
120 
126  virtual bool isPrintable() const;
127 
133  virtual void setPrintable( bool value );
134 
135  Action* activationAction() const;
136 
143  {
148  };
149 
155  Action* additionalAction( AdditionalActionType type ) const;
156 
157  /* Returns the additional action of the given @p type or @c nullptr if no action has been defined.
158  *
159  * This is for actions of annotation widgets associated with the FormField
160  *
161  * @since 1.5
162  */
163  Action* additionalAction( Annotation::AdditionalActionType type ) const;
164 
165  protected:
167  FormField( FormFieldPrivate &dd );
168  Q_DECLARE_PRIVATE( FormField )
169  FormFieldPrivate *d_ptr;
171 
172  void setActivationAction( Action *action );
173  void setAdditionalAction( AdditionalActionType type, Action *action );
174  void setAdditionalAction( Annotation::AdditionalActionType type, Action *action );
175 
176  private:
177  Q_DISABLE_COPY( FormField )
178 };
179 
180 
189 class OKULARCORE_EXPORT FormFieldButton : public FormField
190 {
191  public:
196  {
199  Radio
200  };
201 
202  ~FormFieldButton() override;
203 
207  virtual ButtonType buttonType() const = 0;
208 
212  virtual QString caption() const = 0;
213 
217  virtual bool state() const = 0;
218 
222  virtual void setState( bool state );
223 
230  virtual QList< int > siblings() const = 0;
231 
237  virtual void setIcon( Okular::FormField *field );
238 
239  protected:
240  FormFieldButton();
241 
242  private:
243  Q_DECLARE_PRIVATE( FormFieldButton )
244  Q_DISABLE_COPY( FormFieldButton )
245 };
246 
247 
254 class OKULARCORE_EXPORT FormFieldText : public FormField
255 {
256  public:
260  enum TextType
261  {
264  FileSelect
265  };
266 
267  ~FormFieldText() override;
268 
272  virtual TextType textType() const = 0;
273 
277  virtual QString text() const = 0;
278 
286  virtual void setText( const QString& text );
287 
294  virtual bool isPassword() const;
295 
299  virtual bool isRichText() const;
300 
305  virtual int maximumLength() const;
306 
310  virtual Qt::Alignment textAlignment() const;
311 
318  virtual bool canBeSpellChecked() const;
319 
325  virtual void setAppearanceText( const QString &text ) = 0;
326 
327  protected:
328  FormFieldText();
329 
330  private:
331  Q_DECLARE_PRIVATE( FormFieldText )
332  Q_DISABLE_COPY( FormFieldText )
333 };
334 
335 
343 class OKULARCORE_EXPORT FormFieldChoice : public FormField
344 {
345  public:
350  {
352  ListBox
353  };
354 
355  ~FormFieldChoice() override;
356 
360  virtual ChoiceType choiceType() const = 0;
361 
365  virtual QStringList choices() const = 0;
366 
373  virtual bool isEditable() const;
374 
381  virtual bool multiSelect() const;
382 
388  virtual QList< int > currentChoices() const = 0;
389 
393  virtual void setCurrentChoices( const QList< int >& choices );
394 
400  virtual QString editChoice() const;
401 
407  virtual void setEditChoice( const QString& text );
408 
412  virtual Qt::Alignment textAlignment() const;
413 
420  virtual bool canBeSpellChecked() const;
421 
427  QString exportValueForChoice( const QString &choice ) const;
428 
429  protected:
430  FormFieldChoice();
431 
439  void setExportValues( const QMap<QString,QString> &values );
440 
441  private:
442  Q_DECLARE_PRIVATE( FormFieldChoice )
443  Q_DISABLE_COPY( FormFieldChoice )
444 };
445 
451 class OKULARCORE_EXPORT FormFieldSignature : public FormField
452 {
453  public:
458  AdbePkcs7sha1,
459  AdbePkcs7detached,
460  EtsiCAdESdetached,
461  UnknownType
462  };
463 
464  ~FormFieldSignature() override;
465 
469  virtual SignatureType signatureType() const = 0;
470 
474  virtual const SignatureInfo &signatureInfo() const = 0;
475 
476  protected:
478 
479  private:
480  Q_DECLARE_PRIVATE( FormFieldSignature )
481  Q_DISABLE_COPY( FormFieldSignature )
482 };
483 
484 }
485 
486 Q_DECLARE_METATYPE(const Okular::FormFieldSignature *);
487 
488 #endif
TextType
The types of text field.
Definition: form.h:260
A choice field. See FormFieldChoice::ChoiceType.
Definition: form.h:56
A NormalizedRect is a rectangle which can be defined by two NormalizedPoints.
Definition: area.h:192
FieldType
The types of form field.
Definition: form.h:52
A field of variable text. See FormFieldText::TextType.
Definition: form.h:55
A combo box choice field.
Definition: form.h:351
global.h
Definition: action.h:19
A "button". See FormFieldButton::ButtonType.
Definition: form.h:54
typedef Alignment
An action to be performed when the field needs to be recalculated.
Definition: form.h:147
Interface of a text form field.
Definition: form.h:254
ButtonType
The types of button field.
Definition: form.h:195
An action to be performed when the user modifies the field.
Definition: form.h:144
A simple singleline text field.
Definition: form.h:262
AdditionalActionType
Describes the type of form additional action.
Definition: form.h:142
An action to be performed before the field is formatted to display its value.
Definition: form.h:145
Interface of a choice form field.
Definition: form.h:343
Collector for all the data belonging to a page.
Definition: page.h:52
Interface of a signature form field.
Definition: form.h:451
A helper class to store information about digital signature.
A simple push button.
Definition: form.h:197
ChoiceType
The types of choice field.
Definition: form.h:349
AdditionalActionType
Describes the type of additional actions.
Definition: annotations.h:192
Encapsulates data that describes an action.
Definition: action.h:43
SignatureType
The types of signature.
Definition: form.h:457
Annotation struct holds properties shared by all annotations.
Definition: annotations.h:91
A multiline text field.
Definition: form.h:263
An action to be performed when the field value changes.
Definition: form.h:146
Interface of a button form field.
Definition: form.h:189
The base interface of a form field.
Definition: form.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jun 5 2020 22:31:34 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.