| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "../../include/fpdfdoc/fpdf_doc.h" | 7 #include "../../include/fpdfdoc/fpdf_doc.h" |
| 8 const int nMaxRecursion = 32; | 8 const int nMaxRecursion = 32; |
| 9 int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) | 9 int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) |
| 10 { | 10 { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 return pPage->GetObjNum(); | 39 return pPage->GetObjNum(); |
| 40 } | 40 } |
| 41 return 0; | 41 return 0; |
| 42 } | 42 } |
| 43 const FX_CHAR* g_sZoomModes[] = {"XYZ", "Fit", "FitH", "FitV", "FitR", "FitB", "
FitBH", "FitBV", ""}; | 43 const FX_CHAR* g_sZoomModes[] = {"XYZ", "Fit", "FitH", "FitV", "FitR", "FitB", "
FitBH", "FitBV", ""}; |
| 44 int CPDF_Dest::GetZoomMode() | 44 int CPDF_Dest::GetZoomMode() |
| 45 { | 45 { |
| 46 if (m_pObj == NULL || m_pObj->GetType() != PDFOBJ_ARRAY) { | 46 if (m_pObj == NULL || m_pObj->GetType() != PDFOBJ_ARRAY) { |
| 47 return 0; | 47 return 0; |
| 48 } | 48 } |
| 49 CFX_ByteString mode = ((CPDF_Array*)m_pObj)->GetElementValue(1)->GetString()
; | 49 CFX_ByteString mode; |
| 50 CPDF_Object* pObj = ((CPDF_Array*)m_pObj)->GetElementValue(1); |
| 51 mode = pObj ? pObj->GetString() : CFX_ByteString(); |
| 50 int i = 0; | 52 int i = 0; |
| 51 while (g_sZoomModes[i][0] != '\0') { | 53 while (g_sZoomModes[i][0] != '\0') { |
| 52 if (mode == g_sZoomModes[i]) { | 54 if (mode == g_sZoomModes[i]) { |
| 53 return i + 1; | 55 return i + 1; |
| 54 } | 56 } |
| 55 i ++; | 57 i ++; |
| 56 } | 58 } |
| 57 return 0; | 59 return 0; |
| 58 } | 60 } |
| 59 FX_FLOAT CPDF_Dest::GetParam(int index) | 61 FX_FLOAT CPDF_Dest::GetParam(int index) |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 if (nPage > 0 && nPage <= nPages) { | 563 if (nPage > 0 && nPage <= nPages) { |
| 562 return nPage; | 564 return nPage; |
| 563 } | 565 } |
| 564 return -1; | 566 return -1; |
| 565 } | 567 } |
| 566 FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const | 568 FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const |
| 567 { | 569 { |
| 568 CFX_ByteString bsLabel = PDF_EncodeText((CFX_WideString)wsLabel); | 570 CFX_ByteString bsLabel = PDF_EncodeText((CFX_WideString)wsLabel); |
| 569 return GetPageByLabel(bsLabel); | 571 return GetPageByLabel(bsLabel); |
| 570 } | 572 } |
| OLD | NEW |