summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfannot.cpp
diff options
context:
space:
mode:
authorJane Liu <janeliulwq@google.com>2017-07-05 15:04:33 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-06 13:09:26 +0000
commitb137e75343cada31ddcf905fc581a3a86a63b5d5 (patch)
tree69c8a46658e61739da60852b522b5dbfcc3b9cac /fpdfsdk/fpdfannot.cpp
parentddf2418ba8e5d925909d7955ac22b33f37ccce44 (diff)
downloadpdfium-b137e75343cada31ddcf905fc581a3a86a63b5d5.tar.xz
Added APIs for setting annotation flag values
1. Added APIs for getting/setting/unsetting annotation flag values in annotation dictionaries. * Added an embedder test testing all the new functions. Bug=pdfium:737 Change-Id: Ib6bbcf05d6e93c43ec4dcd7120db71bc244afdbf Reviewed-on: https://pdfium-review.googlesource.com/7154 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfannot.cpp')
-rw-r--r--fpdfsdk/fpdfannot.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfannot.cpp b/fpdfsdk/fpdfannot.cpp
index 4d75e6e236..d7ab8abac1 100644
--- a/fpdfsdk/fpdfannot.cpp
+++ b/fpdfsdk/fpdfannot.cpp
@@ -705,3 +705,29 @@ DLLEXPORT unsigned long STDCALL FPDFAnnot_GetText(FPDF_ANNOTATION annot,
return len;
}
+
+DLLEXPORT int STDCALL FPDFAnnot_GetFlags(FPDF_ANNOTATION annot) {
+ if (!annot)
+ return FPDF_ANNOT_FLAG_NONE;
+
+ CPDF_Dictionary* pAnnotDict =
+ CPDFAnnotContextFromFPDFAnnotation(annot)->GetAnnotDict();
+ if (!pAnnotDict)
+ return FPDF_ANNOT_FLAG_NONE;
+
+ return pAnnotDict->GetIntegerFor("F");
+}
+
+DLLEXPORT FPDF_BOOL STDCALL FPDFAnnot_SetFlags(FPDF_ANNOTATION annot,
+ int flags) {
+ if (!annot)
+ return false;
+
+ CPDF_Dictionary* pAnnotDict =
+ CPDFAnnotContextFromFPDFAnnotation(annot)->GetAnnotDict();
+ if (!pAnnotDict)
+ return false;
+
+ pAnnotDict->SetNewFor<CPDF_Number>("F", flags);
+ return true;
+}