Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: core/fpdfdoc/cpdf_pagelabel.cpp

Issue 2354933002: Rename CPDFXFA_Document::GetPageCount (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "core/fpdfdoc/cpdf_pagelabel.h" 7 #include "core/fpdfdoc/cpdf_pagelabel.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const { 116 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const {
117 if (!m_pDocument) 117 if (!m_pDocument)
118 return -1; 118 return -1;
119 119
120 CPDF_Dictionary* pPDFRoot = m_pDocument->GetRoot(); 120 CPDF_Dictionary* pPDFRoot = m_pDocument->GetRoot();
121 if (!pPDFRoot) 121 if (!pPDFRoot)
122 return -1; 122 return -1;
123 123
124 // TOOD(dsinclair): Verify this works for XFA pages.
124 int nPages = m_pDocument->GetPageCount(); 125 int nPages = m_pDocument->GetPageCount();
125 for (int i = 0; i < nPages; i++) { 126 for (int i = 0; i < nPages; i++) {
126 if (PDF_EncodeText(GetLabel(i)).Compare(bsLabel)) 127 if (PDF_EncodeText(GetLabel(i)).Compare(bsLabel))
127 return i; 128 return i;
128 } 129 }
129 130
130 int nPage = FXSYS_atoi(CFX_ByteString(bsLabel).c_str()); // NUL terminate. 131 int nPage = FXSYS_atoi(CFX_ByteString(bsLabel).c_str()); // NUL terminate.
131 return nPage > 0 && nPage <= nPages ? nPage : -1; 132 return nPage > 0 && nPage <= nPages ? nPage : -1;
132 } 133 }
133 134
134 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { 135 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const {
135 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC()); 136 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC());
136 } 137 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698