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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, | 563 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, |
564 mode, pOptions); | 564 mode, pOptions); |
565 } | 565 } |
566 | 566 |
567 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { | 567 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { |
568 return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL; | 568 return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL; |
569 } | 569 } |
570 | 570 |
571 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { | 571 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { |
572 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); | 572 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); |
573 if (pAP == NULL) | 573 if (!pAP) |
574 return FALSE; | 574 return FALSE; |
575 | 575 |
576 // Choose the right sub-ap | 576 // Choose the right sub-ap |
577 const FX_CHAR* ap_entry = "N"; | 577 const FX_CHAR* ap_entry = "N"; |
578 if (mode == CPDF_Annot::Down) | 578 if (mode == CPDF_Annot::Down) |
579 ap_entry = "D"; | 579 ap_entry = "D"; |
580 else if (mode == CPDF_Annot::Rollover) | 580 else if (mode == CPDF_Annot::Rollover) |
581 ap_entry = "R"; | 581 ap_entry = "R"; |
582 if (!pAP->KeyExist(ap_entry)) | 582 if (!pAP->KeyExist(ap_entry)) |
583 ap_entry = "N"; | 583 ap_entry = "N"; |
584 | 584 |
585 // Get the AP stream or subdirectory | 585 // Get the AP stream or subdirectory |
586 CPDF_Object* psub = pAP->GetElementValue(ap_entry); | 586 CPDF_Object* psub = pAP->GetElementValue(ap_entry); |
587 if (psub == NULL) | 587 return !!psub; |
588 return FALSE; | |
589 | |
590 return TRUE; | |
591 } | 588 } |
592 | 589 |
593 void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice, | 590 void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice, |
594 const CFX_Matrix* pUser2Device, | 591 const CFX_Matrix* pUser2Device, |
595 const CPDF_RenderOptions* pOptions) { | 592 const CPDF_RenderOptions* pOptions) { |
596 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); | 593 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); |
597 } | 594 } |
598 | 595 |
599 void CPDFSDK_BAAnnot::ClearCachedAP() { | 596 void CPDFSDK_BAAnnot::ClearCachedAP() { |
600 m_pAnnot->ClearCachedAP(); | 597 m_pAnnot->ClearCachedAP(); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 return NULL; | 981 return NULL; |
985 } | 982 } |
986 | 983 |
987 #ifdef PDF_ENABLE_XFA | 984 #ifdef PDF_ENABLE_XFA |
988 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { | 985 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
989 if (m_pPageView) | 986 if (m_pPageView) |
990 return m_pPageView->GetPDFXFAPage(); | 987 return m_pPageView->GetPDFXFAPage(); |
991 return NULL; | 988 return NULL; |
992 } | 989 } |
993 #endif // PDF_ENABLE_XFA | 990 #endif // PDF_ENABLE_XFA |
OLD | NEW |