Exemple #1
0
CPDF_Bookmark CPDF_BookmarkTree::GetNextSibling(
    const CPDF_Bookmark& bookmark) const {
  if (!bookmark.m_pDict) {
    return CPDF_Bookmark();
  }
  CPDF_Dictionary* pNext = bookmark.m_pDict->GetDict("Next");
  return pNext == bookmark.m_pDict ? CPDF_Bookmark() : CPDF_Bookmark(pNext);
}
Exemple #2
0
CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild(
    const CPDF_Bookmark& parent) const {
  if (!parent.m_pDict) {
    CPDF_Dictionary* pRoot = m_pDocument->GetRoot()->GetDict("Outlines");
    if (!pRoot) {
      return CPDF_Bookmark();
    }
    return CPDF_Bookmark(pRoot->GetDict("First"));
  }
  return CPDF_Bookmark(parent.m_pDict->GetDict("First"));
}
Exemple #3
0
DLLEXPORT FPDF_BOOKMARK STDCALL
FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict) {
    if (!document || !pDict)
        return NULL;
    CPDF_Document* pDoc = (CPDF_Document*)document;
    CPDF_BookmarkTree tree(pDoc);
    CPDF_Bookmark bookmark = CPDF_Bookmark((CPDF_Dictionary*)pDict);
    return tree.GetNextSibling(bookmark).GetDict();
}
Exemple #4
0
DLLEXPORT FPDF_BOOKMARK STDCALL
FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict) {
  CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
  if (!pDoc)
    return nullptr;
  CPDF_BookmarkTree tree(pDoc);
  CPDF_Bookmark bookmark =
      CPDF_Bookmark(ToDictionary(static_cast<CPDF_Object*>(pDict)));
  return tree.GetFirstChild(bookmark).GetDict();
}
Exemple #5
0
DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document,
        FPDF_WIDESTRING title) {
    if (!document)
        return NULL;
    if (!title || title[0] == 0)
        return NULL;
    CPDF_Document* pDoc = (CPDF_Document*)document;
    CPDF_BookmarkTree tree(pDoc);
    FX_STRSIZE len = CFX_WideString::WStringLength(title);
    CFX_WideString encodedTitle = CFX_WideString::FromUTF16LE(title, len);
    return FindBookmark(tree, CPDF_Bookmark(), encodedTitle).GetDict();
}
Exemple #6
0
DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document,
                                                  FPDF_WIDESTRING title) {
  if (!title || title[0] == 0)
    return nullptr;
  CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
  if (!pDoc)
    return nullptr;
  CPDF_BookmarkTree tree(pDoc);
  FX_STRSIZE len = CFX_WideString::WStringLength(title);
  CFX_WideString encodedTitle = CFX_WideString::FromUTF16LE(title, len);
  std::set<CPDF_Dictionary*> visited;
  return FindBookmark(tree, CPDF_Bookmark(), encodedTitle, &visited).GetDict();
}
Exemple #7
0
FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title) {
  CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
  if (!pDoc)
    return nullptr;

  if (!title || title[0] == 0)
    return nullptr;

  CPDF_BookmarkTree tree(pDoc);
  size_t len = WideString::WStringLength(title);
  WideString encodedTitle = WideString::FromUTF16LE(title, len);
  std::set<const CPDF_Dictionary*> visited;
  return FPDFBookmarkFromCPDFDictionary(
      FindBookmark(tree, CPDF_Bookmark(), encodedTitle, &visited).GetDict());
}