Foxit PDF SDK

Public Member Functions | Static Public Attributes | List of all members
com.foxit.sdk.addon.xfa.AppProviderCallback Class Reference

## Public Member Functions
void | beep (int type)
| A callback function used to beep for specified beep type. More...
FileReaderCallback | downLoadUrl (String url)
| A callback function used to download from specified URL. More...
String | getAppInfo (int app_info)
| A callback function used to get application information for a specified information type. More...
String | loadString (int string_id)
| A callback function used to load a string in local language for a specified case. More...
int | msgBox (String message, String title, int icon_type, int button_type)
| A callback function used to set message box. More...
String | postRequestURL (String url, String data, String content_type, String encode, String header)
| A callback function used to post data to the given URL. More...
boolean | putRequestURL (String url, String data, String encode)
| A callback function used to put data to the given URL. More...
void | release ()
| A callback function used to release current callback object itself. More...
String | response (String question, String title, String default_answer, boolean is_mask)
| A callback function used to response. More...
WStringArray | showFileDialog (String string_title, String string_filter, boolean is_openfile_dialog)
| A callback function used to show file dialog. More...

## Static Public Attributes
static final int | e_AppInfoLanguage = 0x01
| Application information: language.
static final int | e_AppInfoName = 0x04
| Application information: name.
static final int | e_AppInfoPlatform = 0x02
| Application information: platform.
static final int | e_AppInfoType = 0x05
| Application information: type.
static final int | e_AppInfoVariation = 0x03
| Application information: variation.
static final int | e_AppInfoVersion = 0x0
| Application information: version.
static final int | e_BeepTypeDefault = 4
| Beep type: default.
static final int | e_BeepTypeError = 0
| Beep type: error.
static final int | e_BeepTypeQuestion = 2
| Beep type: question.
static final int | e_BeepTypeStatus = 3
| Beep type: status.
static final int | e_BeepTypeWarning = 1
| Beep type: warning.
static final int | e_MsgBoxIconError = 0
| Message box icon: Error.
static final int | e_MsgBoxIconQuestion = 2
| Message box icon: Question.
static final int | e_MsgBoxIconStatus = 3
| Message box icon: Status.
static final int | e_MsgBoxIconWarning = 1
| Message box icon: Warning.
static final int | e_MsgBtnIDCancel = 2
| Message box button ID: Cancel.
static final int | e_MsgBtnIDNo = 3
| Message box button ID: No.
static final int | e_MsgBtnIDOK = 1
| Message box button ID: OK.
static final int | e_MsgBtnIDYes = 4
| Message box button ID: Yes.
static final int | e_MsgBtnTypeOK = 0
| Message box button: OK.
static final int | e_MsgBtnTypeOKCancel = 1
| Message box button: OK and Cancel.
static final int | e_MsgBtnTypeYesNo = 2
| Message box button: Yes and No.
static final int | e_MsgBtnTypeYesNoCancel = 3
| Message box button: Yes, No and Cancel.
static final int | e_StringIDAccessProertyInNotObject = 61
| Sample message: "An attempt was made to reference property '%s' of a non-object in SOM expression %s".
static final int | e_StringIDAppName = 5
| String ID for case: Application's name. Sample message: "Foxit Phantom".
static final int | e_StringIDArgumentExpectContainer = 60
| Sample message: "'%s' argument is expected to be a container".
static final int | e_StringIDArgumentMismatch = 66
| Sample message: "Argument mismatch in property or function argument".
static final int | e_StringIDArgumentNotArray = 59
| Sample message: "'%s' function's %d argument cannot be array".
static final int | e_StringIDBadSuffix = 26
| Sample message: "Bad suffix on number".
static final int | e_StringIDCalcOverride = 2
| Sample message: "Calculate Override".
static final int | e_StringIDCannotAssign = 54
| Sample message: "Cannot assign to '%s'".
static final int | e_StringIDCannotCovertToObject = 45
| Sample message: "%s.%s cannot covert to object".
static final int | e_StringIDCannotModifyValue = 36
| Sample message: "Cannot modify the '%s' value".
static final int | e_StringIDCompilerError = 35
| Sample message: "Compiler error".
static final int | e_StringIDConditionIsNull = 40
| Sample message: "Condition is null".
static final int | e_StringIDDivideZero = 44
| Sample message: "Divide by zero".
static final int | e_StringIDErrorMessage = 63
| Sample message: "%s : %s".
static final int | e_StringIDExpectedEndIf = 38
| Sample message: "Expected 'endif' instead of '%s'".
static final int | e_StringIDExpectedIdent = 27
| Sample message: "Expected identifier instead of '%s'".
static final int | e_StringIDExpectedNumber = 52
| Sample message: "Expected number instead of '%s'".
static final int | e_StringIDExpectedOperator = 43
| Sample message: "Expected operator '%s' instead of '%s'".
static final int | e_StringIDExpectedString = 28
| Sample message: "Expected '%s' instead of '%s'".
static final int | e_StringIDFunctionBuildIn = 62
| Sample message: "Function 's' is built-in.
static final int | e_StringIDIllegalBreak = 41
| Sample message: "Illegal break".
static final int | e_StringIDIllegalContinue = 42
| Sample message: "Illegal continue".
static final int | e_StringIDImageFilter = 6
| String ID for case: Filter for image files. Sample message: "Image Files(*.bmp;*.jpg;*.png;*.gif;*.tif)|*.bmp;*.jpg;*.png;*.gif;*.tif|All Files(*.*)|*.*||".
static final int | e_StringIDIncorrectNumberOfMethod = 65
| Sample message: "Incorrect number of parameters are used when calling method '%s'".
static final int | e_StringIDIndexValueOutOfBounds = 64
| Sample message: "Index value is out of bounds".
static final int | e_StringIDInvalidAppend = 68
| Sample message: "Invalid append operation: %s cannot have a child element of %s".
static final int | e_StringIDInvalidateChar = 29
| Sample message: "Invalidate character '%c'".
static final int | e_StringIDInvalidateInstruction = 51
| Sample message: "Invalidate instruction".
static final int | e_StringIDInvalidateLeftValue = 34
| Sample message: "Invalidate left-value '%s'".
static final int | e_StringIDInvalidBarcodeValue = 103
| Sample message: "Invalid Barcode Value: %s is an invalid value for barcodes of type %s.".
static final int | e_StringIDInvalidEnumerate = 67
| Sample message: "Invalid enumerated value: %s".
static final int | e_StringIDInvalidEnumValue = 10
| String ID for case: Some enumerate value is invalid. Sample message: "Invalid enumerate value:".
static final int | e_StringIDInvalidExpression = 32
| Sample message: "Invalidate expression '%s'".
static final int | e_StringIDInvalidNodeType = 71
| Sample message: "Invalid node type: '%s'".
static final int | e_StringIDInvalidPropertySetOperation = 13
| String ID for case: Some setting operation to property is invalid. Sample message: "Invalid property setting operation:".
static final int | e_StringIDInvalidToken = 31
| Sample message: "Invalidate token '%s'".
static final int | e_StringIDIsNotArray = 56
| Sample message: "'%s' is not an array".
static final int | e_StringIDModifyField = 3
| String ID for case: If to modify field. Sample message: "Do you want to modify this field?".
static final int | e_StringIDMonthApril = 84
| String ID for case: Use string in local language for "April".
static final int | e_StringIDMonthAug = 88
| String ID for case: Use string in local language for "August".
static final int | e_StringIDMonthDec = 92
| String ID for case: Use string in local language for "December".
static final int | e_StringIDMonthFeb = 82
| String ID for case: Use string in local language for "February".
static final int | e_StringIDMonthJan = 81
| String ID for case: Use string in local language for "January".
static final int | e_StringIDMonthJuly = 87
| String ID for case: Use string in local language for "July".
static final int | e_StringIDMonthJune = 86
| String ID for case: Use string in local language for "June".
static final int | e_StringIDMonthMarch = 83
| String ID for case: Use string in local language for "March".
static final int | e_StringIDMonthMay = 85
| String ID for case: Use string in local language for "May".
static final int | e_StringIDMonthNov = 91
| String ID for case: Use string in local language for "November".
static final int | e_StringIDMonthOct = 90
| String ID for case: Use string in local language for "October".
static final int | e_StringIDMonthSep = 89
| String ID for case: Use string in local language for "September".
static final int | e_StringIDNotAssignObject = 50
| Sample message: "Cannot directly assign the value to object".
static final int | e_StringIDNotDefaultValue = 14
| Sample message: "Not have a default property".
static final int | e_StringIDNotFoundConst = 49
| Sample message: "Cannot find const '%s'".
static final int | e_StringIDNotFoundContainer = 46
| Sample message: "Cannot find container '%s'".
static final int | e_StringIDNotFoundFunction = 55
| Sample message: "Cannot find function '%s'".
static final int | e_StringIDNotFoundMethod = 48
| Sample message: "Cannot find method '%s'".
static final int | e_StringIDNotFoundProperty = 47
| Sample message: "Cannot find property '%s'".
static final int | e_StringIDNotHaveProperty = 70
| Sample message: "'%s' doesn't have property '%s'".
static final int | e_StringIDNotModifyField = 4
| String ID for case: Not allow to modify field. Sample message: "You are not allowed to modify this field.".
static final int | e_StringIDNotSupportArrayCalculate = 58
| Sample message: "'%s' operator cannot support array calculation".
static final int | e_StringIDNumberOfOccur = 22
| Sample message: "The element [%s] has violated its allowable number of occurrences".
static final int | e_StringIDOutOfArrayRange = 57
| Sample message: "Out of the range of '%s' array".
static final int | e_StringIDParametersError = 37
| Sample message: "Function '%s' does not have %d parameters".
static final int | e_StringIDRedefinition = 30
| Sample message: "'%s' redefinition".
static final int | e_StringIDScriptArgumentMismatch = 104
| Sample message: "Error:Argument mismatch in property or function argument.".
static final int | e_StringIDScriptFailedError = 100
| Sample message: "Script failed(language is %s;context is %s) script=%s".
static final int | e_StringIDScriptInvalidValue = 101
| Sample message: "Error:Invalid enumerated value:%s".
static final int | e_StringIDServerDeny = 73
| String ID for case: Server denies. Sample message: "Server does not permit".
static final int | e_StringIDSOMExpectedList = 69
| Sample message: "SOM expression returned list when single result was expected".
static final int | e_StringIDSubmitValidateNullError = 102
| Sample message: "At least one required field was empty. Please fill in the required fields(highlighted) before continuing.".
static final int | e_StringIDToday = 93
| String ID for case: Use string in local language for "Today".
static final int | e_StringIDUnableSetClassName = 23
| Sample message: "Unable to set the value for property 'className'".
static final int | e_StringIDUnableSetLanguage = 15
| Sample message: "Unable to set the value for property 'language'".
static final int | e_StringIDUnableSetLengthValue = 24
| Sample message: "Unable to set the value for property 'length'".
static final int | e_StringIDUnableSetNumPages = 16
| Sample message: "Unable to set the value for property 'numPages'".
static final int | e_StringIDUnableSetPlatformValue = 17
| Sample message: "Unable to set the value for property 'platform'".
static final int | e_StringIDUnableSetReady = 21
| Sample message: "Unable to set the value for property 'ready'".
static final int | e_StringIDUnableSetValidationsEnabledValue = 18
| Sample message: "Unable to set the value for property 'validationsEnabled'".
static final int | e_StringIDUnableSetValidationsValue = 19
| Sample message: "Unable to set the value for property 'variation'".
static final int | e_StringIDUnableSetVersion = 20
| Sample message: "Unable to set the value for property 'version'".
static final int | e_StringIDUnableToSet = 8
| Sample message: "Unable to set".
static final int | e_StringIDUndefineIdentifier = 33
| Sample message: "Undefined identifier '%s'".
static final int | e_StringIDUnexpectedExpression = 39
| Sample message: "Unexpected expression '%s'".
static final int | e_StringIDUnknownCaught = 7
| Sample message: "Unknown error is caught!".
static final int | e_StringIDUnsupportChar = 25
| Sample message: "Unsupported character '%c'".
static final int | e_StringIDUnsupportMethod = 11
| Sample message: "Unsupported method %s.".
static final int | e_StringIDUnsupportProperty = 12
| Sample message: "Unsupported property %s.".
static final int | e_StringIDValidateError = 98
| Sample message: "The value you entered for %s is invalid.".
static final int | e_StringIDValidateFailed = 1
| Sample message: "Validate failed".
static final int | e_StringIDValidateLimit = 94
| Sample message: "Message limit exceeded. Remaining %d validation errors not reported.".
static final int | e_StringIDValidateNullError = 96
| Sample message: "%s cannot be left blank.".
static final int | e_StringIDValidateNullWarning = 95
| Sample message: "%s cannot be left blank. To ignore validations for %s, click Ignore.".
static final int | e_StringIDValidateNumberError = 99
| Sample message: "Illegal value:cannot assign '%s' to %s.".
static final int | e_StringIDValidateOutOfArray = 53
| Sample message: "Validate access index '%s' out of array".
static final int | e_StringIDValidateWarning = 97
| Sample message: "The value you entered for %s is invalid. To ignore validations for %s, click Ignore.".
static final int | e_StringIDValueExcalmatory = 9
| Sample message: "Value!".
static final int | e_StringIDViolateBoundary = 72
| Sample message: "The element [%s] has violated its allowable number of occurrences".
static final int | e_StringIDWeekDayFri = 79
| String ID for case: Use string in local language for "Friday".
static final int | e_StringIDWeekDayMon = 75
| String ID for case: Use string in local language for "Monday".
static final int | e_StringIDWeekDaySat = 80
| String ID for case: Use string in local language for "Saturday".
static final int | e_StringIDWeekDaySun = 74
| String ID for case: Use string in local language for "Sunday".
static final int | e_StringIDWeekDayThu = 78
| String ID for case: Use string in local language for "Thursday".
static final int | e_StringIDWeekDayTue = 76
| String ID for case: Use string in local language for "Tuesday".
static final int | e_StringIDWeekDayWed = 77
| String ID for case: Use string in local language for "Wednesday".

## Detailed Description

This class represents a callback object as an XFA application provider. All the functions in this class are used as callback functions. Pure virtual functions should be implemented by user.

## Member Function Documentation

## ◆ beep()

void com.foxit.sdk.addon.xfa.AppProviderCallback.beep | ( | int | type | ) |

A callback function used to beep for specified beep type.

Parameters

  [in] | type | The beep type. Please refer to values starting from com.foxit.sdk.addon.xfa.AppProviderCallback.e_BeepTypeError and this would be one of these values.

Returns
  None.

## ◆ downLoadUrl()

FileReaderCallback com.foxit.sdk.addon.xfa.AppProviderCallback.downLoadUrl | ( | String | url | ) |

A callback function used to download from specified URL.

Parameters

  [in] | url | A URL to be downloaded.

Returns
  A com.foxit.sdk.common.fxcrt.FileReaderCallback object which can be used to read the downloading result.

## ◆ getAppInfo()

String com.foxit.sdk.addon.xfa.AppProviderCallback.getAppInfo | ( | int | app_info | ) |

A callback function used to get application information for a specified information type.

Parameters

  [in] | app_info | The type of application information, whose information is to retrieved. Please refer to values starting from com.foxit.sdk.addon.xfa.AppProviderCallback.e_AppInfoType and this would be one of these values.

Returns
  A string of application information.

## ◆ loadString()

String com.foxit.sdk.addon.xfa.AppProviderCallback.loadString | ( | int | string_id | ) |

A callback function used to load a string in local language for a specified case.

This function is very useful for user to use local language for message of specified cases. User can re-write or translate the sample message (which is defined in the comment of values starting from com.foxit.sdk.addon.xfa.AppProviderCallback.e_StringIDValidateFailed ) into local language for the specified case, and return the result string to Foxit PDF SDK. Specially, Foxit PDF SDK will add some necessary information/data to the format part in the sample message, in order to make the message more useful. User is recommended to keep these format part in the re-written or translated result string; otherwise, these information/data will not be lost and will not be added to the message offered by user.

Parameters

  [in] | string_id | A string ID to specify a case. Please refer to values starting from com.foxit.sdk.addon.xfa.AppProviderCallback.e_StringIDValidateFailed and this would be one of these values.

Returns
  A string used for the specified case.

## ◆ msgBox()

int com.foxit.sdk.addon.xfa.AppProviderCallback.msgBox | ( | String | message,
|  | String | title,
|  | int | icon_type,
|  | int | button_type
| ) |  |

A callback function used to set message box.

Parameters

  [in] | message | A message string.
  [in] | title | The title of message box.
  [in] | icon_type | The icon type for message box. Please refer to values starting from com.foxit.sdk.addon.xfa.AppProviderCallback.e_MsgBoxIconError and this would be one of these values.
  [in] | button_type | The button type for message box. Please refer to values starting from com.foxit.sdk.addon.xfa.AppProviderCallback.e_MsgBtnTypeOK and this would be one of these values.

Returns
  The button ID for message box. Please refer to values starting from com.foxit.sdk.addon.xfa.AppProviderCallback.e_MsgBtnIDOK and this should be one of these values.

## ◆ postRequestURL()

String com.foxit.sdk.addon.xfa.AppProviderCallback.postRequestURL | ( | String | url,
|  | String | data,
|  | String | content_type,
|  | String | encode,
|  | String | header
| ) |  |

A callback function used to post data to the given URL.

Parameters

  [in] | url | A URL, to which the data will be posted.
  [in] | data | The data to be posted.
  [in] | content_type | A string that represents the content type of data. This string could be "text/html", "text/xml", "text/plain", "multipart/form-data", "application/x-www-form-urlencoded", "application/octet-stream", or any valid MIME type.
  [in] | encode | A string that represents the encoding of data. This string could be "UTF-8", "UTF-16", "ISO8859-1", or any recognized [IANA]character encoding.
  [in] | header | A string that represents any additional HTTP headers to be included in the post.

Returns
  The response string.

## ◆ putRequestURL()

boolean com.foxit.sdk.addon.xfa.AppProviderCallback.putRequestURL | ( | String | url,
|  | String | data,
|  | String | encode
| ) |  |

A callback function used to put data to the given URL.

Parameters

  [in] | url | A URL, to which the data will be put.
  [in] | data | The data to be put.
  [in] | encode | A string that represents the encoding of data. This string could be "UTF-8", "UTF-16", ISO8859-1", or any recognized [IANA]character encoding.

Returns
  true means success, while false means failure.

## ◆ release()

void com.foxit.sdk.addon.xfa.AppProviderCallback.release | ( |  | ) |

A callback function used to release current callback object itself.

Returns
  None.

## ◆ response()

String com.foxit.sdk.addon.xfa.AppProviderCallback.response | ( | String | question,
|  | String | title,
|  | String | default_answer,
|  | boolean | is_mask
| ) |  |

A callback function used to response.

Parameters

  [in] | question | A string that represents the question.
  [in] | title | A string that represents the title.
  [in] | default_answer | A string that represents the default answer. It could be an empty string which means no default answer.
  [in] | is_mask | true means the answer should be masked by '*', while false means the answer does not need to be masked by '*'.

Returns
  A string that represents the response answer.

## ◆ showFileDialog()

WStringArray com.foxit.sdk.addon.xfa.AppProviderCallback.showFileDialog | ( | String | string_title,
|  | String | string_filter,
|  | boolean | is_openfile_dialog
| ) |  |

A callback function used to show file dialog.

Parameters

  [in] | string_title | A string that represents the dialog title.
  [in] | string_filter | A string that represents the dialog file filter.
  [in] | is_openfile_dialog | true means the dialog is an open-file-dialog, while false means the dialog is a save-as-dialog.

Returns
  An array of file paths.