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/include/fxcrt/fx_ext.h" | 7 #include "core/include/fxcrt/fx_ext.h" |
8 #include "fpdfsdk/include/fsdk_baseannot.h" | 8 #include "fpdfsdk/include/fsdk_baseannot.h" |
9 #include "fpdfsdk/include/fsdk_define.h" | 9 #include "fpdfsdk/include/fsdk_define.h" |
10 #include "fpdfsdk/include/fsdk_mgr.h" | 10 #include "fpdfsdk/include/fsdk_mgr.h" |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 ASSERT(m_pAnnot != NULL); | 557 ASSERT(m_pAnnot != NULL); |
558 | 558 |
559 return m_pAnnot->GetSubType(); | 559 return m_pAnnot->GetSubType(); |
560 } | 560 } |
561 | 561 |
562 CFX_ByteString CPDFSDK_BAAnnot::GetSubType() const { | 562 CFX_ByteString CPDFSDK_BAAnnot::GetSubType() const { |
563 return ""; | 563 return ""; |
564 } | 564 } |
565 | 565 |
566 void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, | 566 void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, |
567 const CPDF_Matrix* pUser2Device, | 567 const CFX_Matrix* pUser2Device, |
568 CPDF_Annot::AppearanceMode mode, | 568 CPDF_Annot::AppearanceMode mode, |
569 const CPDF_RenderOptions* pOptions) { | 569 const CPDF_RenderOptions* pOptions) { |
570 ASSERT(m_pPageView != NULL); | 570 ASSERT(m_pPageView != NULL); |
571 ASSERT(m_pAnnot != NULL); | 571 ASSERT(m_pAnnot != NULL); |
572 | 572 |
573 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, | 573 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, |
574 mode, pOptions); | 574 mode, pOptions); |
575 } | 575 } |
576 | 576 |
577 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { | 577 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { |
(...skipping 16 matching lines...) Expand all Loading... |
594 | 594 |
595 // Get the AP stream or subdirectory | 595 // Get the AP stream or subdirectory |
596 CPDF_Object* psub = pAP->GetElementValue(ap_entry); | 596 CPDF_Object* psub = pAP->GetElementValue(ap_entry); |
597 if (psub == NULL) | 597 if (psub == NULL) |
598 return FALSE; | 598 return FALSE; |
599 | 599 |
600 return TRUE; | 600 return TRUE; |
601 } | 601 } |
602 | 602 |
603 void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice, | 603 void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice, |
604 const CPDF_Matrix* pUser2Device, | 604 const CFX_Matrix* pUser2Device, |
605 const CPDF_RenderOptions* pOptions) { | 605 const CPDF_RenderOptions* pOptions) { |
606 ASSERT(m_pAnnot != NULL); | 606 ASSERT(m_pAnnot != NULL); |
607 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); | 607 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); |
608 } | 608 } |
609 | 609 |
610 void CPDFSDK_BAAnnot::ClearCachedAP() { | 610 void CPDFSDK_BAAnnot::ClearCachedAP() { |
611 ASSERT(m_pAnnot != NULL); | 611 ASSERT(m_pAnnot != NULL); |
612 m_pAnnot->ClearCachedAP(); | 612 m_pAnnot->ClearCachedAP(); |
613 } | 613 } |
614 | 614 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 | 842 |
843 return TRUE; | 843 return TRUE; |
844 } | 844 } |
845 } | 845 } |
846 | 846 |
847 return FALSE; | 847 return FALSE; |
848 } | 848 } |
849 | 849 |
850 void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, | 850 void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, |
851 const CPDF_Rect& rcBBox, | 851 const CPDF_Rect& rcBBox, |
852 const CPDF_Matrix& matrix, | 852 const CFX_Matrix& matrix, |
853 const CFX_ByteString& sContents, | 853 const CFX_ByteString& sContents, |
854 const CFX_ByteString& sAPState) { | 854 const CFX_ByteString& sAPState) { |
855 CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); | 855 CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); |
856 | 856 |
857 if (!pAPDict) { | 857 if (!pAPDict) { |
858 pAPDict = new CPDF_Dictionary; | 858 pAPDict = new CPDF_Dictionary; |
859 m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict); | 859 m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict); |
860 } | 860 } |
861 | 861 |
862 CPDF_Stream* pStream = nullptr; | 862 CPDF_Stream* pStream = nullptr; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 return CPDF_Action(); | 970 return CPDF_Action(); |
971 } | 971 } |
972 | 972 |
973 #ifdef PDF_ENABLE_XFA | 973 #ifdef PDF_ENABLE_XFA |
974 FX_BOOL CPDFSDK_BAAnnot::IsXFAField() { | 974 FX_BOOL CPDFSDK_BAAnnot::IsXFAField() { |
975 return FALSE; | 975 return FALSE; |
976 } | 976 } |
977 #endif // PDF_ENABLE_XFA | 977 #endif // PDF_ENABLE_XFA |
978 | 978 |
979 void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, | 979 void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, |
980 CPDF_Matrix* pUser2Device, | 980 CFX_Matrix* pUser2Device, |
981 CPDF_RenderOptions* pOptions) { | 981 CPDF_RenderOptions* pOptions) { |
982 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); | 982 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); |
983 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, | 983 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, |
984 CPDF_Annot::Normal, NULL); | 984 CPDF_Annot::Normal, NULL); |
985 } | 985 } |
986 | 986 |
987 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { | 987 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { |
988 #ifdef PDF_ENABLE_XFA | 988 #ifdef PDF_ENABLE_XFA |
989 return GetPDFXFAPage(); | 989 return GetPDFXFAPage(); |
990 #else // PDF_ENABLE_XFA | 990 #else // PDF_ENABLE_XFA |
991 return GetPDFPage(); | 991 return GetPDFPage(); |
992 #endif // PDF_ENABLE_XFA | 992 #endif // PDF_ENABLE_XFA |
993 } | 993 } |
994 | 994 |
995 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | 995 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
996 if (m_pPageView) | 996 if (m_pPageView) |
997 return m_pPageView->GetPDFPage(); | 997 return m_pPageView->GetPDFPage(); |
998 return NULL; | 998 return NULL; |
999 } | 999 } |
1000 | 1000 |
1001 #ifdef PDF_ENABLE_XFA | 1001 #ifdef PDF_ENABLE_XFA |
1002 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { | 1002 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
1003 if (m_pPageView) | 1003 if (m_pPageView) |
1004 return m_pPageView->GetPDFXFAPage(); | 1004 return m_pPageView->GetPDFXFAPage(); |
1005 return NULL; | 1005 return NULL; |
1006 } | 1006 } |
1007 #endif // PDF_ENABLE_XFA | 1007 #endif // PDF_ENABLE_XFA |
OLD | NEW |