summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_link.cpp
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2015-08-04 12:19:10 -0700
committerNico Weber <thakis@chromium.org>2015-08-04 12:19:10 -0700
commitb048f791a15f2da781a01eba5b09eb9d389f9c11 (patch)
tree6850a73c18bbc41eaf4b1fdc6b3c96646d45587b /core/src/fpdfdoc/doc_link.cpp
parentc8eeed31f217d99a706b0cbf5e4ce0bcc12beb64 (diff)
downloadpdfium-b048f791a15f2da781a01eba5b09eb9d389f9c11.tar.xz
clang-format all pdfium code.
No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163' | \ xargs ../../buildtools/mac/clang-format -i See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1265503005 .
Diffstat (limited to 'core/src/fpdfdoc/doc_link.cpp')
-rw-r--r--core/src/fpdfdoc/doc_link.cpp161
1 files changed, 77 insertions, 84 deletions
diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp
index fdae96ac2e..15bd14c31e 100644
--- a/core/src/fpdfdoc/doc_link.cpp
+++ b/core/src/fpdfdoc/doc_link.cpp
@@ -6,100 +6,93 @@
#include "../../include/fpdfdoc/fpdf_doc.h"
-CPDF_LinkList::~CPDF_LinkList()
-{
- FX_POSITION pos = m_PageMap.GetStartPosition();
- while (pos) {
- void* key;
- void* value;
- m_PageMap.GetNextAssoc(pos, key, value);
- delete (CFX_PtrArray*)value;
- }
+CPDF_LinkList::~CPDF_LinkList() {
+ FX_POSITION pos = m_PageMap.GetStartPosition();
+ while (pos) {
+ void* key;
+ void* value;
+ m_PageMap.GetNextAssoc(pos, key, value);
+ delete (CFX_PtrArray*)value;
+ }
}
-CFX_PtrArray* CPDF_LinkList::GetPageLinks(CPDF_Page* pPage)
-{
- FX_DWORD objnum = pPage->m_pFormDict->GetObjNum();
- if (objnum == 0) {
- return NULL;
- }
- CFX_PtrArray* pPageLinkList = NULL;
- if (!m_PageMap.Lookup((void*)(uintptr_t)objnum, (void*&)pPageLinkList)) {
- pPageLinkList = new CFX_PtrArray;
- m_PageMap.SetAt((void*)(uintptr_t)objnum, pPageLinkList);
- LoadPageLinks(pPage, pPageLinkList);
- }
- return pPageLinkList;
+CFX_PtrArray* CPDF_LinkList::GetPageLinks(CPDF_Page* pPage) {
+ FX_DWORD objnum = pPage->m_pFormDict->GetObjNum();
+ if (objnum == 0) {
+ return NULL;
+ }
+ CFX_PtrArray* pPageLinkList = NULL;
+ if (!m_PageMap.Lookup((void*)(uintptr_t)objnum, (void*&)pPageLinkList)) {
+ pPageLinkList = new CFX_PtrArray;
+ m_PageMap.SetAt((void*)(uintptr_t)objnum, pPageLinkList);
+ LoadPageLinks(pPage, pPageLinkList);
+ }
+ return pPageLinkList;
}
-int CPDF_LinkList::CountLinks(CPDF_Page* pPage)
-{
- CFX_PtrArray* pPageLinkList = GetPageLinks(pPage);
- if (pPageLinkList == NULL) {
- return 0;
- }
- return pPageLinkList->GetSize();
+int CPDF_LinkList::CountLinks(CPDF_Page* pPage) {
+ CFX_PtrArray* pPageLinkList = GetPageLinks(pPage);
+ if (pPageLinkList == NULL) {
+ return 0;
+ }
+ return pPageLinkList->GetSize();
}
-CPDF_Link CPDF_LinkList::GetLink(CPDF_Page* pPage, int index)
-{
- CFX_PtrArray* pPageLinkList = GetPageLinks(pPage);
- if (!pPageLinkList) {
- return CPDF_Link();
- }
- return CPDF_Link((CPDF_Dictionary*)pPageLinkList->GetAt(index));
+CPDF_Link CPDF_LinkList::GetLink(CPDF_Page* pPage, int index) {
+ CFX_PtrArray* pPageLinkList = GetPageLinks(pPage);
+ if (!pPageLinkList) {
+ return CPDF_Link();
+ }
+ return CPDF_Link((CPDF_Dictionary*)pPageLinkList->GetAt(index));
}
-CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y)
-{
- CFX_PtrArray* pPageLinkList = GetPageLinks(pPage);
- if (!pPageLinkList) {
- return CPDF_Link();
- }
- int size = pPageLinkList->GetSize();
- for (int i = size - 1; i >= 0; --i) {
- CPDF_Link link((CPDF_Dictionary*)pPageLinkList->GetAt(i));
- CPDF_Rect rect = link.GetRect();
- if (rect.Contains(pdf_x, pdf_y)) {
- return link;
- }
- }
+CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage,
+ FX_FLOAT pdf_x,
+ FX_FLOAT pdf_y) {
+ CFX_PtrArray* pPageLinkList = GetPageLinks(pPage);
+ if (!pPageLinkList) {
return CPDF_Link();
+ }
+ int size = pPageLinkList->GetSize();
+ for (int i = size - 1; i >= 0; --i) {
+ CPDF_Link link((CPDF_Dictionary*)pPageLinkList->GetAt(i));
+ CPDF_Rect rect = link.GetRect();
+ if (rect.Contains(pdf_x, pdf_y)) {
+ return link;
+ }
+ }
+ return CPDF_Link();
}
-void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage, CFX_PtrArray* pList)
-{
- CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArray("Annots");
- if (pAnnotList == NULL) {
- return;
+void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage, CFX_PtrArray* pList) {
+ CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArray("Annots");
+ if (pAnnotList == NULL) {
+ return;
+ }
+ for (FX_DWORD i = 0; i < pAnnotList->GetCount(); i++) {
+ CPDF_Dictionary* pAnnot = pAnnotList->GetDict(i);
+ if (pAnnot == NULL) {
+ continue;
}
- for (FX_DWORD i = 0; i < pAnnotList->GetCount(); i ++) {
- CPDF_Dictionary* pAnnot = pAnnotList->GetDict(i);
- if (pAnnot == NULL) {
- continue;
- }
- if (pAnnot->GetString("Subtype") != "Link") {
- continue;
- }
- pList->Add(pAnnot);
+ if (pAnnot->GetString("Subtype") != "Link") {
+ continue;
}
+ pList->Add(pAnnot);
+ }
}
-CPDF_Rect CPDF_Link::GetRect()
-{
- return m_pDict->GetRect("Rect");
+CPDF_Rect CPDF_Link::GetRect() {
+ return m_pDict->GetRect("Rect");
}
-CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc)
-{
- CPDF_Object* pDest = m_pDict->GetElementValue("Dest");
- if (pDest == NULL) {
- return CPDF_Dest();
- }
- if (pDest->GetType() == PDFOBJ_STRING || pDest->GetType() == PDFOBJ_NAME) {
- CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
- CFX_ByteStringC name = pDest->GetString();
- return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name));
- }
- if (pDest->GetType() == PDFOBJ_ARRAY) {
- return CPDF_Dest((CPDF_Array*)pDest);
- }
+CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) {
+ CPDF_Object* pDest = m_pDict->GetElementValue("Dest");
+ if (pDest == NULL) {
return CPDF_Dest();
+ }
+ if (pDest->GetType() == PDFOBJ_STRING || pDest->GetType() == PDFOBJ_NAME) {
+ CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
+ CFX_ByteStringC name = pDest->GetString();
+ return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name));
+ }
+ if (pDest->GetType() == PDFOBJ_ARRAY) {
+ return CPDF_Dest((CPDF_Array*)pDest);
+ }
+ return CPDF_Dest();
}
-CPDF_Action CPDF_Link::GetAction()
-{
- return CPDF_Action(m_pDict->GetDict("A"));
+CPDF_Action CPDF_Link::GetAction() {
+ return CPDF_Action(m_pDict->GetDict("A"));
}