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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 } | 481 } |
482 return wsLetters; | 482 return wsLetters; |
483 } | 483 } |
484 static CFX_WideString _GetLabelNumPortion(int num, const CFX_ByteString& bsStyle
) | 484 static CFX_WideString _GetLabelNumPortion(int num, const CFX_ByteString& bsStyle
) |
485 { | 485 { |
486 CFX_WideString wsNumPortion; | 486 CFX_WideString wsNumPortion; |
487 if (bsStyle.IsEmpty()) { | 487 if (bsStyle.IsEmpty()) { |
488 return wsNumPortion; | 488 return wsNumPortion; |
489 } | 489 } |
490 if (bsStyle == "D") { | 490 if (bsStyle == "D") { |
491 wsNumPortion.Format((FX_LPCWSTR)L"%d", num); | 491 wsNumPortion.Format(L"%d", num); |
492 } else if (bsStyle == "R") { | 492 } else if (bsStyle == "R") { |
493 wsNumPortion = _MakeRoman(num); | 493 wsNumPortion = _MakeRoman(num); |
494 wsNumPortion.MakeUpper(); | 494 wsNumPortion.MakeUpper(); |
495 } else if (bsStyle == "r") { | 495 } else if (bsStyle == "r") { |
496 wsNumPortion = _MakeRoman(num); | 496 wsNumPortion = _MakeRoman(num); |
497 } else if (bsStyle == "A") { | 497 } else if (bsStyle == "A") { |
498 wsNumPortion = _MakeLetters(num); | 498 wsNumPortion = _MakeLetters(num); |
499 wsNumPortion.MakeUpper(); | 499 wsNumPortion.MakeUpper(); |
500 } else if (bsStyle == "a") { | 500 } else if (bsStyle == "a") { |
501 wsNumPortion = _MakeLetters(num); | 501 wsNumPortion = _MakeLetters(num); |
(...skipping 28 matching lines...) Expand all Loading... |
530 if (pLabel->KeyExist(FX_BSTRC("P"))) { | 530 if (pLabel->KeyExist(FX_BSTRC("P"))) { |
531 wsLabel += pLabel->GetUnicodeText(FX_BSTRC("P")); | 531 wsLabel += pLabel->GetUnicodeText(FX_BSTRC("P")); |
532 } | 532 } |
533 CFX_ByteString bsNumberingStyle = pLabel->GetString(FX_BSTRC("S"), N
ULL); | 533 CFX_ByteString bsNumberingStyle = pLabel->GetString(FX_BSTRC("S"), N
ULL); |
534 int nLabelNum = nPage - n + pLabel->GetInteger(FX_BSTRC("St"), 1); | 534 int nLabelNum = nPage - n + pLabel->GetInteger(FX_BSTRC("St"), 1); |
535 CFX_WideString wsNumPortion = _GetLabelNumPortion(nLabelNum, bsNumbe
ringStyle); | 535 CFX_WideString wsNumPortion = _GetLabelNumPortion(nLabelNum, bsNumbe
ringStyle); |
536 wsLabel += wsNumPortion; | 536 wsLabel += wsNumPortion; |
537 return wsLabel; | 537 return wsLabel; |
538 } | 538 } |
539 } | 539 } |
540 wsLabel.Format((FX_LPCWSTR)L"%d", nPage + 1); | 540 wsLabel.Format(L"%d", nPage + 1); |
541 return wsLabel; | 541 return wsLabel; |
542 } | 542 } |
543 FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const | 543 FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const |
544 { | 544 { |
545 if (m_pDocument == NULL) { | 545 if (m_pDocument == NULL) { |
546 return -1; | 546 return -1; |
547 } | 547 } |
548 CPDF_Dictionary* pPDFRoot = m_pDocument->GetRoot(); | 548 CPDF_Dictionary* pPDFRoot = m_pDocument->GetRoot(); |
549 if (pPDFRoot == NULL) { | 549 if (pPDFRoot == NULL) { |
550 return -1; | 550 return -1; |
(...skipping 12 matching lines...) Expand all Loading... |
563 if (nPage > 0 && nPage <= nPages) { | 563 if (nPage > 0 && nPage <= nPages) { |
564 return nPage; | 564 return nPage; |
565 } | 565 } |
566 return -1; | 566 return -1; |
567 } | 567 } |
568 FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const | 568 FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const |
569 { | 569 { |
570 CFX_ByteString bsLabel = PDF_EncodeText((CFX_WideString)wsLabel); | 570 CFX_ByteString bsLabel = PDF_EncodeText((CFX_WideString)wsLabel); |
571 return GetPageByLabel(bsLabel); | 571 return GetPageByLabel(bsLabel); |
572 } | 572 } |
OLD | NEW |