[poppler] qt5/src

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Mar 2 00:00:28 UTC 2017


 qt5/src/poppler-form.cc |   20 ++++++++++++++++++++
 qt5/src/poppler-form.h  |   19 +++++++++++++++++++
 2 files changed, 39 insertions(+)

New commits:
commit 1b0653ce395242547b2b34b99034a19cd2d3ea6b
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Mar 2 01:00:12 2017 +0100

    Qt5: Expose Form additional actions

diff --git a/qt5/src/poppler-form.cc b/qt5/src/poppler-form.cc
index 03839bf..1ccb26c 100644
--- a/qt5/src/poppler-form.cc
+++ b/qt5/src/poppler-form.cc
@@ -160,6 +160,26 @@ Link* FormField::activationAction() const
   return action;
 }
 
+Link *FormField::additionalAction(AdditionalActionType type) const
+{
+  Annot::FormAdditionalActionsType actionType = Annot::actionFieldModified;
+  switch ( type )
+  {
+      case FieldModified:  actionType = Annot::actionFieldModified; break;
+      case FormatField:    actionType = Annot::actionFormatField; break;
+      case ValidateField:  actionType = Annot::actionValidateField; break;
+      case CalculateField: actionType = Annot::actionCalculateField; break;
+
+  }
+
+  Link* action = 0;
+  if (::LinkAction *act = m_formData->fm->getAdditionalAction(actionType))
+  {
+    action = PageData::convertLinkActionToLink(act, m_formData->doc, QRectF());
+  }
+  return action;
+}
+
 
 FormFieldButton::FormFieldButton(DocumentData *doc, ::Page *p, ::FormWidgetButton *w)
   : FormField(*new FormFieldData(doc, p, w))
diff --git a/qt5/src/poppler-form.h b/qt5/src/poppler-form.h
index 7996a2c..5a6b23b 100644
--- a/qt5/src/poppler-form.h
+++ b/qt5/src/poppler-form.h
@@ -116,6 +116,25 @@ namespace Poppler {
 	 */
 	Link* activationAction() const;
 
+        /**
+	  * Describes the flags from the form 'AA' dictionary.
+	  *
+	  * \since 0.53
+	 */
+	enum AdditionalActionType
+	{
+	    FieldModified,   ///< A JavaScript action to be performed when the user modifies the field
+	    FormatField,     ///< A JavaScript action to be performed before the field is formatted to display its value
+	    ValidateField,   ///< A JavaScript action to be performed when the field value changes
+	    CalculateField,  ///< A JavaScript action to be performed when the field needs to be recalculated
+	};
+	/**
+	  * Returns a given form additional action
+	  *
+	  * \since 0.53
+	 */
+	Link* additionalAction(AdditionalActionType type) const;
+
     protected:
 	/// \cond PRIVATE
 	FormField(FormFieldData &dd);


More information about the poppler mailing list