7#include "core/fpdfdoc/cpdf_linklist.h"
11#include "core/fpdfapi/page/cpdf_page.h"
12#include "core/fpdfapi/parser/cpdf_array.h"
13#include "core/fpdfapi/parser/cpdf_dictionary.h"
14#include "third_party/base/numerics/safe_conversions.h"
21 const CFX_PointF& point,
23 const std::vector<RetainPtr<CPDF_Dictionary>>* pPageLinkList =
28 for (size_t i = pPageLinkList->size(); i > 0; --i) {
29 size_t annot_index = i - 1;
30 RetainPtr<CPDF_Dictionary> pAnnot = (*pPageLinkList)[annot_index];
39 *z_order = pdfium::base::checked_cast<int32_t>(annot_index);
45const std::vector<RetainPtr<CPDF_Dictionary>>* CPDF_LinkList::GetPageLinks(
47 uint32_t objnum = pPage->GetDict()->GetObjNum();
51 auto it = m_PageMap.find(objnum);
52 if (it != m_PageMap.end())
56 auto* page_link_list = &m_PageMap[objnum];
57 RetainPtr<CPDF_Array> pAnnotList = pPage->GetMutableAnnotsArray();
59 return page_link_list;
61 for (size_t i = 0; i < pAnnotList->size(); ++i) {
62 RetainPtr<CPDF_Dictionary> pAnnot = pAnnotList->GetMutableDictAt(i);
63 bool add_link = (pAnnot && pAnnot->GetByteStringFor(
"Subtype") ==
"Link");
65 page_link_list->emplace_back(add_link ? pAnnot :
nullptr);
67 return page_link_list;
bool Contains(const CFX_PointF &point) const
CPDF_Link GetLinkAtPoint(CPDF_Page *pPage, const CFX_PointF &point, int *z_order)
~CPDF_LinkList() override