OLD | NEW |
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/cpdf_dictionary.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/cpdf_document.h" |
11 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" | 11 #include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" |
12 #include "core/fpdfdoc/cpdf_numbertree.h" | 12 #include "core/fpdfdoc/cpdf_numbertree.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 CFX_WideString MakeRoman(int num) { | 16 CFX_WideString MakeRoman(int num) { |
17 const int kArabic[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; | 17 const int kArabic[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; |
18 const CFX_WideString kRoman[] = {L"m", L"cm", L"d", L"cd", L"c", | 18 const CFX_WideString kRoman[] = {L"m", L"cm", L"d", L"cd", L"c", |
19 L"xc", L"l", L"xl", L"x", L"ix", | 19 L"xc", L"l", L"xl", L"x", L"ix", |
20 L"v", L"iv", L"i"}; | 20 L"v", L"iv", L"i"}; |
21 const int kMaxNum = 1000000; | 21 const int kMaxNum = 1000000; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 return i; | 127 return i; |
128 } | 128 } |
129 | 129 |
130 int nPage = FXSYS_atoi(CFX_ByteString(bsLabel).c_str()); // NUL terminate. | 130 int nPage = FXSYS_atoi(CFX_ByteString(bsLabel).c_str()); // NUL terminate. |
131 return nPage > 0 && nPage <= nPages ? nPage : -1; | 131 return nPage > 0 && nPage <= nPages ? nPage : -1; |
132 } | 132 } |
133 | 133 |
134 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { | 134 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { |
135 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC()); | 135 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC()); |
136 } | 136 } |
OLD | NEW |