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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, | 559 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, |
560 mode, pOptions); | 560 mode, pOptions); |
561 } | 561 } |
562 | 562 |
563 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { | 563 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { |
564 return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL; | 564 return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL; |
565 } | 565 } |
566 | 566 |
567 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { | 567 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { |
568 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); | 568 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); |
569 if (pAP == NULL) | 569 if (!pAP) |
570 return FALSE; | 570 return FALSE; |
571 | 571 |
572 // Choose the right sub-ap | 572 // Choose the right sub-ap |
573 const FX_CHAR* ap_entry = "N"; | 573 const FX_CHAR* ap_entry = "N"; |
574 if (mode == CPDF_Annot::Down) | 574 if (mode == CPDF_Annot::Down) |
575 ap_entry = "D"; | 575 ap_entry = "D"; |
576 else if (mode == CPDF_Annot::Rollover) | 576 else if (mode == CPDF_Annot::Rollover) |
577 ap_entry = "R"; | 577 ap_entry = "R"; |
578 if (!pAP->KeyExist(ap_entry)) | 578 if (!pAP->KeyExist(ap_entry)) |
579 ap_entry = "N"; | 579 ap_entry = "N"; |
580 | 580 |
581 // Get the AP stream or subdirectory | 581 // Get the AP stream or subdirectory |
582 CPDF_Object* psub = pAP->GetElementValue(ap_entry); | 582 CPDF_Object* psub = pAP->GetElementValue(ap_entry); |
583 if (psub == NULL) | 583 return !!psub; |
584 return FALSE; | |
585 | |
586 return TRUE; | |
587 } | 584 } |
588 | 585 |
589 void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice, | 586 void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice, |
590 const CFX_Matrix* pUser2Device, | 587 const CFX_Matrix* pUser2Device, |
591 const CPDF_RenderOptions* pOptions) { | 588 const CPDF_RenderOptions* pOptions) { |
592 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); | 589 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); |
593 } | 590 } |
594 | 591 |
595 void CPDFSDK_BAAnnot::ClearCachedAP() { | 592 void CPDFSDK_BAAnnot::ClearCachedAP() { |
596 m_pAnnot->ClearCachedAP(); | 593 m_pAnnot->ClearCachedAP(); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 | 961 |
965 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { | 962 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { |
966 return GetPDFPage(); | 963 return GetPDFPage(); |
967 } | 964 } |
968 | 965 |
969 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | 966 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
970 if (m_pPageView) | 967 if (m_pPageView) |
971 return m_pPageView->GetPDFPage(); | 968 return m_pPageView->GetPDFPage(); |
972 return NULL; | 969 return NULL; |
973 } | 970 } |
OLD | NEW |