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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 dt.second = static_cast<uint8_t>(n % 60); | 423 dt.second = static_cast<uint8_t>(n % 60); |
424 if (days != 0) | 424 if (days != 0) |
425 AddDays(days); | 425 AddDays(days); |
426 | 426 |
427 return *this; | 427 return *this; |
428 } | 428 } |
429 | 429 |
430 CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) | 430 CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) |
431 : m_pPageView(pPageView), m_bSelected(FALSE), m_nTabOrder(-1) {} | 431 : m_pPageView(pPageView), m_bSelected(FALSE), m_nTabOrder(-1) {} |
432 | 432 |
| 433 CPDFSDK_Annot::~CPDFSDK_Annot() {} |
| 434 |
| 435 #ifdef PDF_ENABLE_XFA |
| 436 |
| 437 FX_BOOL CPDFSDK_Annot::IsXFAField() { |
| 438 return FALSE; |
| 439 } |
| 440 |
| 441 CXFA_FFWidget* CPDFSDK_Annot::GetXFAWidget() const { |
| 442 return nullptr; |
| 443 } |
| 444 |
| 445 #endif // PDF_ENABLE_XFA |
| 446 |
| 447 FX_FLOAT CPDFSDK_Annot::GetMinWidth() const { |
| 448 return kMinWidth; |
| 449 } |
| 450 |
| 451 FX_FLOAT CPDFSDK_Annot::GetMinHeight() const { |
| 452 return kMinHeight; |
| 453 } |
| 454 |
| 455 int CPDFSDK_Annot::GetLayoutOrder() const { |
| 456 return 5; |
| 457 } |
| 458 |
| 459 CPDF_Annot* CPDFSDK_Annot::GetPDFAnnot() const { |
| 460 return nullptr; |
| 461 } |
| 462 |
| 463 CFX_ByteString CPDFSDK_Annot::GetType() const { |
| 464 return ""; |
| 465 } |
| 466 |
| 467 CFX_ByteString CPDFSDK_Annot::GetSubType() const { |
| 468 return ""; |
| 469 } |
| 470 |
| 471 void CPDFSDK_Annot::SetRect(const CFX_FloatRect& rect) {} |
| 472 |
| 473 CFX_FloatRect CPDFSDK_Annot::GetRect() const { |
| 474 return CFX_FloatRect(); |
| 475 } |
| 476 |
| 477 void CPDFSDK_Annot::Annot_OnDraw(CFX_RenderDevice* pDevice, |
| 478 CFX_Matrix* pUser2Device, |
| 479 CPDF_RenderOptions* pOptions) {} |
| 480 |
433 CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, | 481 CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, |
434 CPDFSDK_PageView* pPageView) | 482 CPDFSDK_PageView* pPageView) |
435 : CPDFSDK_Annot(pPageView), m_pAnnot(pAnnot) {} | 483 : CPDFSDK_Annot(pPageView), m_pAnnot(pAnnot) {} |
436 | 484 |
| 485 CPDFSDK_BAAnnot::~CPDFSDK_BAAnnot() {} |
| 486 |
437 CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() const { | 487 CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() const { |
438 return m_pAnnot; | 488 return m_pAnnot; |
439 } | 489 } |
440 | 490 |
441 FX_BOOL CPDFSDK_Annot::IsSelected() { | 491 FX_BOOL CPDFSDK_Annot::IsSelected() { |
442 return m_bSelected; | 492 return m_bSelected; |
443 } | 493 } |
444 | 494 |
445 void CPDFSDK_Annot::SetSelected(FX_BOOL bSelected) { | 495 void CPDFSDK_Annot::SetSelected(FX_BOOL bSelected) { |
446 m_bSelected = bSelected; | 496 m_bSelected = bSelected; |
447 } | 497 } |
448 | 498 |
449 // Tab Order | |
450 int CPDFSDK_Annot::GetTabOrder() { | 499 int CPDFSDK_Annot::GetTabOrder() { |
451 return m_nTabOrder; | 500 return m_nTabOrder; |
452 } | 501 } |
453 | 502 |
454 void CPDFSDK_Annot::SetTabOrder(int iTabOrder) { | 503 void CPDFSDK_Annot::SetTabOrder(int iTabOrder) { |
455 m_nTabOrder = iTabOrder; | 504 m_nTabOrder = iTabOrder; |
456 } | 505 } |
457 | 506 |
458 CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const { | 507 CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const { |
459 return m_pAnnot->GetAnnotDict(); | 508 return m_pAnnot->GetAnnotDict(); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 | 818 |
770 if (pStreamDict) { | 819 if (pStreamDict) { |
771 pStreamDict->SetAtMatrix("Matrix", matrix); | 820 pStreamDict->SetAtMatrix("Matrix", matrix); |
772 pStreamDict->SetAtRect("BBox", rcBBox); | 821 pStreamDict->SetAtRect("BBox", rcBBox); |
773 } | 822 } |
774 | 823 |
775 pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength(), FALSE, | 824 pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength(), FALSE, |
776 FALSE); | 825 FALSE); |
777 } | 826 } |
778 | 827 |
779 FX_FLOAT CPDFSDK_Annot::GetMinWidth() const { | |
780 return kMinWidth; | |
781 } | |
782 | |
783 FX_FLOAT CPDFSDK_Annot::GetMinHeight() const { | |
784 return kMinHeight; | |
785 } | |
786 | |
787 FX_BOOL CPDFSDK_BAAnnot::CreateFormFiller() { | 828 FX_BOOL CPDFSDK_BAAnnot::CreateFormFiller() { |
788 return TRUE; | 829 return TRUE; |
789 } | 830 } |
790 FX_BOOL CPDFSDK_BAAnnot::IsVisible() const { | 831 FX_BOOL CPDFSDK_BAAnnot::IsVisible() const { |
791 uint32_t nFlags = GetFlags(); | 832 uint32_t nFlags = GetFlags(); |
792 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) || | 833 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) || |
793 (nFlags & ANNOTFLAG_NOVIEW)); | 834 (nFlags & ANNOTFLAG_NOVIEW)); |
794 } | 835 } |
795 | 836 |
796 CPDF_Action CPDFSDK_BAAnnot::GetAction() const { | 837 CPDF_Action CPDFSDK_BAAnnot::GetAction() const { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 | 872 |
832 if (AAction.ActionExist(eAAT)) | 873 if (AAction.ActionExist(eAAT)) |
833 return AAction.GetAction(eAAT); | 874 return AAction.GetAction(eAAT); |
834 | 875 |
835 if (eAAT == CPDF_AAction::ButtonUp) | 876 if (eAAT == CPDF_AAction::ButtonUp) |
836 return GetAction(); | 877 return GetAction(); |
837 | 878 |
838 return CPDF_Action(); | 879 return CPDF_Action(); |
839 } | 880 } |
840 | 881 |
841 #ifdef PDF_ENABLE_XFA | |
842 FX_BOOL CPDFSDK_BAAnnot::IsXFAField() { | |
843 return FALSE; | |
844 } | |
845 #endif // PDF_ENABLE_XFA | |
846 | |
847 void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, | 882 void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, |
848 CFX_Matrix* pUser2Device, | 883 CFX_Matrix* pUser2Device, |
849 CPDF_RenderOptions* pOptions) { | 884 CPDF_RenderOptions* pOptions) { |
850 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); | 885 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); |
851 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, | 886 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, |
852 CPDF_Annot::Normal, nullptr); | 887 CPDF_Annot::Normal, nullptr); |
853 } | 888 } |
854 | 889 |
855 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { | 890 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { |
856 #ifdef PDF_ENABLE_XFA | 891 #ifdef PDF_ENABLE_XFA |
857 return GetPDFXFAPage(); | 892 return GetPDFXFAPage(); |
858 #else // PDF_ENABLE_XFA | 893 #else // PDF_ENABLE_XFA |
859 return GetPDFPage(); | 894 return GetPDFPage(); |
860 #endif // PDF_ENABLE_XFA | 895 #endif // PDF_ENABLE_XFA |
861 } | 896 } |
862 | 897 |
863 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | 898 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
864 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; | 899 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
865 } | 900 } |
866 | 901 |
867 #ifdef PDF_ENABLE_XFA | 902 #ifdef PDF_ENABLE_XFA |
| 903 |
868 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { | 904 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
869 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; | 905 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; |
870 } | 906 } |
| 907 |
871 #endif // PDF_ENABLE_XFA | 908 #endif // PDF_ENABLE_XFA |
OLD | NEW |