From a74e75d69594e469906e2a95b5f2394c88acbe7a Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Wed, 10 Jan 2018 18:06:55 +0000 Subject: Add FPDFAnnot_GetAP to public API. The matching FPDFAnnot_SetAP will be added in a subsequent CL. Change-Id: If567e02c6c56138d218498879cb4a8ee91dff080 Reviewed-on: https://pdfium-review.googlesource.com/22450 Reviewed-by: dsinclair Commit-Queue: Henrique Nakashima --- public/fpdf_annot.h | 28 ++++++++++++++++++++++++++++ public/fpdfview.h | 3 ++- 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'public') diff --git a/public/fpdf_annot.h b/public/fpdf_annot.h index 1fbc366872..8841963183 100644 --- a/public/fpdf_annot.h +++ b/public/fpdf_annot.h @@ -58,6 +58,11 @@ extern "C" { #define FPDF_ANNOT_FLAG_LOCKED (1 << 7) #define FPDF_ANNOT_FLAG_TOGGLENOVIEW (1 << 8) +#define FPDF_ANNOT_APPEARANCEMODE_NORMAL 0 +#define FPDF_ANNOT_APPEARANCEMODE_ROLLOVER 1 +#define FPDF_ANNOT_APPEARANCEMODE_DOWN 2 +#define FPDF_ANNOT_APPEARANCEMODE_COUNT 3 + #define FPDF_OBJECT_UNKNOWN 0 #define FPDF_OBJECT_BOOLEAN 1 #define FPDF_OBJECT_NUMBER 2 @@ -395,6 +400,29 @@ FPDFAnnot_GetStringValue(FPDF_ANNOTATION annot, void* buffer, unsigned long buflen); +// Experimental API. +// Get the AP (appearance string) from |annot|'s dictionary for a given +// |appearanceMode|. +// |buffer| is only modified if |buflen| is large enough to hold the whole AP +// string. If |buflen| is smaller, the total size of the AP is still returned, +// but nothing is copied. +// If there is no appearance stream for |annot| in |appearanceMode|, an empty +// string is written to |buf| and 2 is returned. +// On other errors, nothing is written to |buffer| and 0 is returned. +// +// annot - handle to an annotation. +// appearanceMode - the appearance mode (normal, rollover or down) for which +// to get the AP. +// buffer - buffer for holding the value string, encoded in UTF16-LE. +// buflen - length of the buffer. +// +// Returns the length of the string value. +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDFAnnot_GetAP(FPDF_ANNOTATION annot, + FPDF_ANNOT_APPEARANCEMODE appearanceMode, + void* buffer, + unsigned long buflen); + // Experimental API. // Get the annotation corresponding to |key| in |annot|'s dictionary. Common // keys for linking annotations include "IRT" and "Popup". Must call diff --git a/public/fpdfview.h b/public/fpdfview.h index 370b84ed0f..1cd3d6d194 100644 --- a/public/fpdfview.h +++ b/public/fpdfview.h @@ -137,8 +137,9 @@ typedef struct _FS_RECTF_ { // Const Pointer to FS_RECTF structure. typedef const FS_RECTF* FS_LPCRECTF; -// Annotation subtype. +// Annotation enums. typedef int FPDF_ANNOTATION_SUBTYPE; +typedef int FPDF_ANNOT_APPEARANCEMODE; // Dictionary value types. typedef int FPDF_OBJECT_TYPE; -- cgit v1.2.3