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_annothandler.h" | 7 #include "fpdfsdk/include/fsdk_annothandler.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 CPDF_Page* pPage = pWidget->GetPDFPage(); | 416 CPDF_Page* pPage = pWidget->GetPDFPage(); |
417 CPDF_Document* pDocument = pPage->m_pDocument; | 417 CPDF_Document* pDocument = pPage->m_pDocument; |
418 uint32_t dwPermissions = pDocument->GetUserPermissions(); | 418 uint32_t dwPermissions = pDocument->GetUserPermissions(); |
419 return (dwPermissions & FPDFPERM_FILL_FORM) || | 419 return (dwPermissions & FPDFPERM_FILL_FORM) || |
420 (dwPermissions & FPDFPERM_ANNOT_FORM); | 420 (dwPermissions & FPDFPERM_ANNOT_FORM); |
421 } | 421 } |
422 | 422 |
423 CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, | 423 CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, |
424 CPDFSDK_PageView* pPage) { | 424 CPDFSDK_PageView* pPage) { |
425 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); | 425 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); |
426 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); | 426 CPDFSDK_InterForm* pInterForm = pSDKDoc->GetInterForm(); |
427 CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl( | 427 CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl( |
428 pInterForm->GetInterForm(), pAnnot->GetAnnotDict()); | 428 pInterForm->GetInterForm(), pAnnot->GetAnnotDict()); |
429 if (!pCtrl) | 429 if (!pCtrl) |
430 return nullptr; | 430 return nullptr; |
431 | 431 |
432 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); | 432 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); |
433 pInterForm->AddMap(pCtrl, pWidget); | 433 pInterForm->AddMap(pCtrl, pWidget); |
434 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); | 434 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); |
435 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) | 435 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) |
436 pWidget->ResetAppearance(nullptr, FALSE); | 436 pWidget->ResetAppearance(nullptr, FALSE); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 } | 722 } |
723 | 723 |
724 #ifdef PDF_ENABLE_XFA | 724 #ifdef PDF_ENABLE_XFA |
725 | 725 |
726 CPDFSDK_XFAAnnotHandler::CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp) | 726 CPDFSDK_XFAAnnotHandler::CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp) |
727 : m_pApp(pApp) {} | 727 : m_pApp(pApp) {} |
728 | 728 |
729 CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(CXFA_FFWidget* pAnnot, | 729 CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(CXFA_FFWidget* pAnnot, |
730 CPDFSDK_PageView* pPage) { | 730 CPDFSDK_PageView* pPage) { |
731 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); | 731 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); |
732 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); | 732 CPDFSDK_InterForm* pInterForm = pSDKDoc->GetInterForm(); |
733 CPDFSDK_XFAWidget* pWidget = new CPDFSDK_XFAWidget(pAnnot, pPage, pInterForm); | 733 CPDFSDK_XFAWidget* pWidget = new CPDFSDK_XFAWidget(pAnnot, pPage, pInterForm); |
734 pInterForm->AddXFAMap(pAnnot, pWidget); | 734 pInterForm->AddXFAMap(pAnnot, pWidget); |
735 return pWidget; | 735 return pWidget; |
736 } | 736 } |
737 | 737 |
738 FX_BOOL CPDFSDK_XFAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { | 738 FX_BOOL CPDFSDK_XFAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { |
739 return !!pAnnot->GetXFAWidget(); | 739 return !!pAnnot->GetXFAWidget(); |
740 } | 740 } |
741 | 741 |
742 void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, | 742 void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 | 1091 |
1092 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { | 1092 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { |
1093 if (m_pos < m_iteratorAnnotList.size()) | 1093 if (m_pos < m_iteratorAnnotList.size()) |
1094 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; | 1094 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; |
1095 return nullptr; | 1095 return nullptr; |
1096 } | 1096 } |
1097 | 1097 |
1098 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { | 1098 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { |
1099 return m_bReverse ? PrevAnnot() : NextAnnot(); | 1099 return m_bReverse ? PrevAnnot() : NextAnnot(); |
1100 } | 1100 } |
OLD | NEW |