| 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/include/cpdf_dictionary.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 11 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" | 11 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" |
| 12 #include "core/fpdfdoc/doc_utils.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 arabic[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; | 17 const int arabic[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; |
| 18 const CFX_WideString roman[] = {L"m", L"cm", L"d", L"cd", L"c", | 18 const CFX_WideString roman[] = {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 nMaxNum = 1000000; | 21 const int nMaxNum = 1000000; |
| 22 num %= nMaxNum; | 22 num %= nMaxNum; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 return i; | 126 return i; |
| 127 } | 127 } |
| 128 | 128 |
| 129 int nPage = FXSYS_atoi(CFX_ByteString(bsLabel).c_str()); // NUL terminate. | 129 int nPage = FXSYS_atoi(CFX_ByteString(bsLabel).c_str()); // NUL terminate. |
| 130 return nPage > 0 && nPage <= nPages ? nPage : -1; | 130 return nPage > 0 && nPage <= nPages ? nPage : -1; |
| 131 } | 131 } |
| 132 | 132 |
| 133 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { | 133 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { |
| 134 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC()); | 134 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC()); |
| 135 } | 135 } |
| OLD | NEW |