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 "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
9 #include "core/fpdfdoc/doc_utils.h" | 9 #include "core/fpdfdoc/doc_utils.h" |
10 #include "core/fpdfdoc/include/fpdf_doc.h" | 10 #include "core/fpdfdoc/include/fpdf_doc.h" |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 break; | 475 break; |
476 } | 476 } |
477 n--; | 477 n--; |
478 } | 478 } |
479 if (pValue) { | 479 if (pValue) { |
480 pValue = pValue->GetDirect(); | 480 pValue = pValue->GetDirect(); |
481 if (CPDF_Dictionary* pLabel = pValue->AsDictionary()) { | 481 if (CPDF_Dictionary* pLabel = pValue->AsDictionary()) { |
482 if (pLabel->KeyExist("P")) { | 482 if (pLabel->KeyExist("P")) { |
483 wsLabel += pLabel->GetUnicodeTextBy("P"); | 483 wsLabel += pLabel->GetUnicodeTextBy("P"); |
484 } | 484 } |
485 CFX_ByteString bsNumberingStyle = pLabel->GetStringBy("S", NULL); | 485 CFX_ByteString bsNumberingStyle = pLabel->GetStringBy("S", nullptr); |
486 int nLabelNum = nPage - n + pLabel->GetIntegerBy("St", 1); | 486 int nLabelNum = nPage - n + pLabel->GetIntegerBy("St", 1); |
487 CFX_WideString wsNumPortion = | 487 CFX_WideString wsNumPortion = |
488 _GetLabelNumPortion(nLabelNum, bsNumberingStyle); | 488 _GetLabelNumPortion(nLabelNum, bsNumberingStyle); |
489 wsLabel += wsNumPortion; | 489 wsLabel += wsNumPortion; |
490 return wsLabel; | 490 return wsLabel; |
491 } | 491 } |
492 } | 492 } |
493 wsLabel.Format(L"%d", nPage + 1); | 493 wsLabel.Format(L"%d", nPage + 1); |
494 return wsLabel; | 494 return wsLabel; |
495 } | 495 } |
(...skipping 17 matching lines...) Expand all Loading... |
513 bsLbl = bsOrig; | 513 bsLbl = bsOrig; |
514 int nPage = FXSYS_atoi(bsLbl.c_str()); | 514 int nPage = FXSYS_atoi(bsLbl.c_str()); |
515 if (nPage > 0 && nPage <= nPages) { | 515 if (nPage > 0 && nPage <= nPages) { |
516 return nPage; | 516 return nPage; |
517 } | 517 } |
518 return -1; | 518 return -1; |
519 } | 519 } |
520 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { | 520 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { |
521 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC()); | 521 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC()); |
522 } | 522 } |
OLD | NEW |