summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_dest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc/cpdf_dest.cpp')
-rw-r--r--core/fpdfdoc/cpdf_dest.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/core/fpdfdoc/cpdf_dest.cpp b/core/fpdfdoc/cpdf_dest.cpp
index 0098f73f66..015cdcbc09 100644
--- a/core/fpdfdoc/cpdf_dest.cpp
+++ b/core/fpdfdoc/cpdf_dest.cpp
@@ -38,7 +38,7 @@ CPDF_Dest::CPDF_Dest(CPDF_Object* pObj) : m_pObj(pObj) {}
CPDF_Dest::~CPDF_Dest() {}
-int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) const {
+int CPDF_Dest::GetPageIndexDeprecated(CPDF_Document* pDoc) const {
CPDF_Array* pArray = ToArray(m_pObj.Get());
if (!pArray)
return 0;
@@ -46,10 +46,31 @@ int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) const {
CPDF_Object* pPage = pArray->GetDirectObjectAt(0);
if (!pPage)
return 0;
+
if (pPage->IsNumber())
return pPage->GetInteger();
+
if (!pPage->IsDictionary())
return 0;
+
+ return pDoc->GetPageIndex(pPage->GetObjNum());
+}
+
+int CPDF_Dest::GetDestPageIndex(CPDF_Document* pDoc) const {
+ CPDF_Array* pArray = ToArray(m_pObj.Get());
+ if (!pArray)
+ return -1;
+
+ CPDF_Object* pPage = pArray->GetDirectObjectAt(0);
+ if (!pPage)
+ return -1;
+
+ if (pPage->IsNumber())
+ return pPage->GetInteger();
+
+ if (!pPage->IsDictionary())
+ return -1;
+
return pDoc->GetPageIndex(pPage->GetObjNum());
}