|
Poppler Qt4 0.18.1
|
00001 /* poppler-form.h: qt4 interface to poppler 00002 * Copyright (C) 2007-2008, Pino Toscano <pino@kde.org> 00003 * Copyright (C) 2008, 2011, Albert Astals Cid <aacid@kde.org> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2, or (at your option) 00008 * any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. 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 fullyQualifiedName() const; 00085 00090 QString uiName() const; 00091 00095 bool isReadOnly() const; 00096 00100 bool isVisible() const; 00101 00107 Link* activationAction() const; 00108 00109 protected: 00111 FormField(FormFieldData &dd); 00112 00113 FormFieldData *m_formData; 00115 00116 private: 00117 Q_DISABLE_COPY(FormField) 00118 }; 00119 00125 class POPPLER_QT4_EXPORT FormFieldButton : public FormField { 00126 public: 00127 00131 enum ButtonType 00132 { 00133 Push, 00134 CheckBox, 00135 Radio 00136 }; 00137 00139 FormFieldButton(DocumentData *doc, ::Page *p, ::FormWidgetButton *w); 00141 virtual ~FormFieldButton(); 00142 00143 virtual FormType type() const; 00144 00148 ButtonType buttonType() const; 00149 00153 QString caption() const; 00154 00158 bool state() const; 00159 00163 void setState( bool state ); 00164 00171 QList<int> siblings() const; 00172 00173 private: 00174 Q_DISABLE_COPY(FormFieldButton) 00175 }; 00176 00182 class POPPLER_QT4_EXPORT FormFieldText : public FormField { 00183 public: 00184 00188 enum TextType { 00189 Normal, 00190 Multiline, 00191 FileSelect 00192 }; 00193 00195 FormFieldText(DocumentData *doc, ::Page *p, ::FormWidgetText *w); 00197 virtual ~FormFieldText(); 00198 00199 virtual FormType type() const; 00200 00204 TextType textType() const; 00205 00209 QString text() const; 00210 00215 void setText( const QString& text ); 00216 00223 bool isPassword() const; 00224 00228 bool isRichText() const; 00229 00233 int maximumLength() const; 00234 00238 Qt::Alignment textAlignment() const; 00239 00244 bool canBeSpellChecked() const; 00245 00246 private: 00247 Q_DISABLE_COPY(FormFieldText) 00248 }; 00249 00255 class POPPLER_QT4_EXPORT FormFieldChoice : public FormField { 00256 public: 00257 00261 enum ChoiceType { 00262 ComboBox, 00263 ListBox 00264 }; 00265 00267 FormFieldChoice(DocumentData *doc, ::Page *p, ::FormWidgetChoice *w); 00269 virtual ~FormFieldChoice(); 00270 00271 virtual FormType type() const; 00272 00276 ChoiceType choiceType() const; 00277 00281 QStringList choices() const; 00282 00289 bool isEditable() const; 00290 00297 bool multiSelect() const; 00298 00302 QList<int> currentChoices() const; 00303 00307 void setCurrentChoices( const QList<int> &choice ); 00308 00312 Qt::Alignment textAlignment() const; 00313 00320 bool canBeSpellChecked() const; 00321 00322 private: 00323 Q_DISABLE_COPY(FormFieldChoice) 00324 }; 00325 00326 } 00327 00328 #endif
1.7.4