summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfannot.cpp
diff options
context:
space:
mode:
authorJane Liu <janeliulwq@google.com>2017-08-21 14:37:53 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-22 16:43:35 +0000
commit300bb27bf4a9a84fcd3f1348a4c0076d68a305ce (patch)
treeeecf41fa5ac9c130e6643afa5bb3a34b5e638489 /fpdfsdk/fpdfannot.cpp
parent878b27de2fa8e5bdc3b910c98846f4b43185d4aa (diff)
downloadpdfium-300bb27bf4a9a84fcd3f1348a4c0076d68a305ce.tar.xz
Added FPDFAnnot_GetLinkedAnnot()
Added FPDFAnnot_GetLinkedAnnot() to retrieve annotations linked to other annotations through a specified key. Bug=pdfium:863,pdfium:737 Change-Id: If81f41178fb4c40f6561bd392215c709722c4000 Reviewed-on: https://pdfium-review.googlesource.com/11491 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
Diffstat (limited to 'fpdfsdk/fpdfannot.cpp')
-rw-r--r--fpdfsdk/fpdfannot.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfannot.cpp b/fpdfsdk/fpdfannot.cpp
index 5c4aae2075..ec748e66ec 100644
--- a/fpdfsdk/fpdfannot.cpp
+++ b/fpdfsdk/fpdfannot.cpp
@@ -727,6 +727,22 @@ FPDFAnnot_GetStringValue(FPDF_ANNOTATION annot,
buffer, buflen);
}
+FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV
+FPDFAnnot_GetLinkedAnnot(FPDF_ANNOTATION annot, FPDF_WIDESTRING key) {
+ CPDF_AnnotContext* pAnnot = CPDFAnnotContextFromFPDFAnnotation(annot);
+ if (!pAnnot || !pAnnot->GetAnnotDict())
+ return nullptr;
+
+ CPDF_Dictionary* pLinkedDict =
+ pAnnot->GetAnnotDict()->GetDictFor(CFXByteStringFromFPDFWideString(key));
+ if (!pLinkedDict || pLinkedDict->GetStringFor("Type") != "Annot")
+ return nullptr;
+
+ auto pLinkedAnnot = pdfium::MakeUnique<CPDF_AnnotContext>(
+ pLinkedDict, pAnnot->GetPage(), nullptr);
+ return pLinkedAnnot.release();
+}
+
FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetFlags(FPDF_ANNOTATION annot) {
if (!annot)
return FPDF_ANNOT_FLAG_NONE;