| 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 "fpdfsdk/include/fsdk_mgr.h" | 7 #include "fpdfsdk/include/fsdk_mgr.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 } | 633 } |
| 634 | 634 |
| 635 void CPDFSDK_PageView::KillFocusAnnotIfNeeded() { | 635 void CPDFSDK_PageView::KillFocusAnnotIfNeeded() { |
| 636 // if there is a focused annot on the page, we should kill the focus first. | 636 // if there is a focused annot on the page, we should kill the focus first. |
| 637 if (CPDFSDK_Annot* focusedAnnot = m_pSDKDoc->GetFocusAnnot()) { | 637 if (CPDFSDK_Annot* focusedAnnot = m_pSDKDoc->GetFocusAnnot()) { |
| 638 if (pdfium::ContainsValue(m_fxAnnotArray, focusedAnnot)) | 638 if (pdfium::ContainsValue(m_fxAnnotArray, focusedAnnot)) |
| 639 KillFocusAnnot(); | 639 KillFocusAnnot(); |
| 640 } | 640 } |
| 641 } | 641 } |
| 642 | 642 |
| 643 FX_BOOL CPDFSDK_PageView::Annot_HasAppearance(CPDF_Annot* pAnnot) { | |
| 644 CPDF_Dictionary* pAnnotDic = pAnnot->GetAnnotDict(); | |
| 645 if (pAnnotDic) | |
| 646 return pAnnotDic->KeyExist("AS"); | |
| 647 return FALSE; | |
| 648 } | |
| 649 | |
| 650 CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CPDF_Annot* pPDFAnnot) { | 643 CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CPDF_Annot* pPDFAnnot) { |
| 651 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 644 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 652 ASSERT(pEnv); | 645 ASSERT(pEnv); |
| 653 CPDFSDK_AnnotHandlerMgr* pAnnotHandler = pEnv->GetAnnotHandlerMgr(); | 646 CPDFSDK_AnnotHandlerMgr* pAnnotHandler = pEnv->GetAnnotHandlerMgr(); |
| 654 CPDFSDK_Annot* pSDKAnnot = pAnnotHandler->NewAnnot(pPDFAnnot, this); | 647 CPDFSDK_Annot* pSDKAnnot = pAnnotHandler->NewAnnot(pPDFAnnot, this); |
| 655 if (!pSDKAnnot) | 648 if (!pSDKAnnot) |
| 656 return nullptr; | 649 return nullptr; |
| 657 | 650 |
| 658 m_fxAnnotArray.push_back(pSDKAnnot); | 651 m_fxAnnotArray.push_back(pSDKAnnot); |
| 659 pAnnotHandler->Annot_OnCreate(pSDKAnnot); | 652 pAnnotHandler->Annot_OnCreate(pSDKAnnot); |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { | 1050 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { |
| 1058 #ifdef PDF_ENABLE_XFA | 1051 #ifdef PDF_ENABLE_XFA |
| 1059 CPDF_Page* pPage = m_page->GetPDFPage(); | 1052 CPDF_Page* pPage = m_page->GetPDFPage(); |
| 1060 #else // PDF_ENABLE_XFA | 1053 #else // PDF_ENABLE_XFA |
| 1061 CPDF_Page* pPage = m_page; | 1054 CPDF_Page* pPage = m_page; |
| 1062 #endif // PDF_ENABLE_XFA | 1055 #endif // PDF_ENABLE_XFA |
| 1063 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 1056 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
| 1064 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); | 1057 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); |
| 1065 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; | 1058 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; |
| 1066 } | 1059 } |
| OLD | NEW |