summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfdoc.cpp
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2015-01-10 22:52:59 -0800
committerBo Xu <bo_xu@foxitsoftware.com>2015-01-15 18:47:16 -0800
commit4d62b6b16bf5df3911948bdb5dd336b365ec76e0 (patch)
tree86a2e65ce65fd950ee95835c37e260e755e2b358 /fpdfsdk/src/fpdfdoc.cpp
parent60882dca3d11fd93d76dcdc73a2d0effd987cb78 (diff)
downloadpdfium-4d62b6b16bf5df3911948bdb5dd336b365ec76e0.tar.xz
XFA: merge patch from CL 834703002, add APIs for getting bookmarks and named destinations.
Also uses "((CPDFXFA_Document*)document)->GetPDFDoc();" in a various places Add APIs for getting bookmarks and named destinations. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/834703002
Diffstat (limited to 'fpdfsdk/src/fpdfdoc.cpp')
-rw-r--r--fpdfsdk/src/fpdfdoc.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp
index f2a190bc67..23c3c2e713 100644
--- a/fpdfsdk/src/fpdfdoc.cpp
+++ b/fpdfsdk/src/fpdfdoc.cpp
@@ -29,6 +29,42 @@ static CPDF_Bookmark FindBookmark(const CPDF_BookmarkTree& tree, CPDF_Bookmark b
return CPDF_Bookmark();
}
+DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict)
+{
+ if (!document || !pDict)
+ return NULL;
+ CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc();
+ CPDF_BookmarkTree tree(pDoc);
+ CPDF_Bookmark bookmark = CPDF_Bookmark((CPDF_Dictionary*)pDict);
+ return tree.GetFirstChild(bookmark).GetDict();
+}
+
+DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict)
+{
+ if (!document || !pDict)
+ return NULL;
+ CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc();
+ CPDF_BookmarkTree tree(pDoc);
+ CPDF_Bookmark bookmark = CPDF_Bookmark((CPDF_Dictionary*)pDict);
+ return tree.GetNextSibling(bookmark).GetDict();
+}
+
+DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK pDict, void* buffer, unsigned long buflen)
+{
+ if (!pDict)
+ return 0;
+ CPDF_Bookmark bookmark((CPDF_Dictionary*)pDict);
+ CFX_WideString title = bookmark.GetTitle();
+ CFX_ByteString encodedTitle = title.UTF16LE_Encode(FALSE);
+ unsigned long len = encodedTitle.GetLength();
+ if (buffer && buflen >= len + 2) {
+ FXSYS_memcpy(buffer, encodedTitle.c_str(), len);
+ ((FX_BYTE*)buffer)[len] = 0;
+ ((FX_BYTE*)buffer)[len + 1] = 0;
+ }
+ return len + 2;
+}
+
DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title)
{
if (!document)