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 "../include/fsdk_define.h" | 7 #include "../include/fsdk_define.h" |
8 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 8 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
9 #include "../include/fpdfxfa/fpdfxfa_util.h" | 9 #include "../include/fpdfxfa/fpdfxfa_util.h" |
10 #include "../include/fsdk_mgr.h" | 10 #include "../include/fsdk_mgr.h" |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 | 758 |
759 FX_BOOL CPDFSDK_XFAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { | 759 FX_BOOL CPDFSDK_XFAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { |
760 return pAnnot->GetXFAWidget() != NULL; | 760 return pAnnot->GetXFAWidget() != NULL; |
761 } | 761 } |
762 | 762 |
763 void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, | 763 void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, |
764 CPDFSDK_Annot* pAnnot, | 764 CPDFSDK_Annot* pAnnot, |
765 CFX_RenderDevice* pDevice, | 765 CFX_RenderDevice* pDevice, |
766 CPDF_Matrix* pUser2Device, | 766 CPDF_Matrix* pUser2Device, |
767 FX_DWORD dwFlags) { | 767 FX_DWORD dwFlags) { |
| 768 #ifdef PDF_ENABLE_XFA |
| 769 |
768 ASSERT(pPageView != NULL); | 770 ASSERT(pPageView != NULL); |
769 ASSERT(pAnnot != NULL); | 771 ASSERT(pAnnot != NULL); |
770 | 772 |
771 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); | 773 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); |
772 ASSERT(pSDKDoc != NULL); | 774 ASSERT(pSDKDoc != NULL); |
773 | 775 |
774 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 776 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
775 ASSERT(pWidgetHandler != NULL); | 777 ASSERT(pWidgetHandler != NULL); |
776 | 778 |
777 CFX_Graphics gs; | 779 CFX_Graphics gs; |
778 gs.Create(pDevice); | 780 gs.Create(pDevice); |
779 | 781 |
780 CFX_Matrix mt; | 782 CFX_Matrix mt; |
781 mt = *(CFX_Matrix*)pUser2Device; | 783 mt = *(CFX_Matrix*)pUser2Device; |
782 | 784 |
783 IXFA_Widget* hWidget = pAnnot->GetXFAWidget(); | 785 IXFA_Widget* hWidget = pAnnot->GetXFAWidget(); |
784 ASSERT(hWidget != NULL); | 786 ASSERT(hWidget != NULL); |
785 | 787 |
786 FX_BOOL bIsHighlight = FALSE; | 788 FX_BOOL bIsHighlight = FALSE; |
787 if (pSDKDoc->GetFocusAnnot() != pAnnot) | 789 if (pSDKDoc->GetFocusAnnot() != pAnnot) |
788 bIsHighlight = TRUE; | 790 bIsHighlight = TRUE; |
789 | 791 |
790 pWidgetHandler->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt, bIsHighlight); | 792 pWidgetHandler->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt, bIsHighlight); |
791 | 793 |
792 // to do highlight and shadow | 794 // to do highlight and shadow |
| 795 #endif // PDF_ENABLE_XFA |
793 } | 796 } |
794 | 797 |
795 void CPDFSDK_XFAAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { | 798 void CPDFSDK_XFAAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { |
796 ASSERT(pAnnot != NULL); | 799 ASSERT(pAnnot != NULL); |
797 | 800 |
798 CPDFSDK_XFAWidget* pWidget = (CPDFSDK_XFAWidget*)pAnnot; | 801 CPDFSDK_XFAWidget* pWidget = (CPDFSDK_XFAWidget*)pAnnot; |
799 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); | 802 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); |
800 ASSERT(pInterForm != NULL); | 803 ASSERT(pInterForm != NULL); |
801 | 804 |
802 pInterForm->RemoveXFAMap(pWidget->GetXFAWidget()); | 805 pInterForm->RemoveXFAMap(pWidget->GetXFAWidget()); |
803 | 806 |
804 delete pWidget; | 807 delete pWidget; |
805 } | 808 } |
806 | 809 |
807 CPDF_Rect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, | 810 CPDF_Rect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, |
808 CPDFSDK_Annot* pAnnot) { | 811 CPDFSDK_Annot* pAnnot) { |
809 ASSERT(pAnnot != NULL); | 812 ASSERT(pAnnot != NULL); |
810 | 813 |
811 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 814 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
812 ASSERT(pWidgetHandler != NULL); | 815 ASSERT(pWidgetHandler != NULL); |
813 | 816 |
| 817 CFX_RectF rcBBox; |
| 818 #ifdef PDF_ENABLE_XFA |
814 XFA_ELEMENT eType = | 819 XFA_ELEMENT eType = |
815 pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->GetUIType(); | 820 pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->GetUIType(); |
816 CFX_RectF rcBBox; | |
817 if (eType == XFA_ELEMENT_Signature) | 821 if (eType == XFA_ELEMENT_Signature) |
818 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, | 822 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, |
819 XFA_WIDGETSTATUS_Visible, TRUE); | 823 XFA_WIDGETSTATUS_Visible, TRUE); |
820 else | 824 else |
| 825 #endif |
821 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, 0); | 826 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, 0); |
822 | 827 |
823 CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, | 828 CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, |
824 rcBBox.top + rcBBox.height); | 829 rcBBox.top + rcBBox.height); |
825 rcWidget.left -= 1.0f; | 830 rcWidget.left -= 1.0f; |
826 rcWidget.right += 1.0f; | 831 rcWidget.right += 1.0f; |
827 rcWidget.bottom -= 1.0f; | 832 rcWidget.bottom -= 1.0f; |
828 rcWidget.top += 1.0f; | 833 rcWidget.top += 1.0f; |
829 | 834 |
830 return rcWidget; | 835 return rcWidget; |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 if (pReaderAnnot == pTopMostAnnot) { | 1310 if (pReaderAnnot == pTopMostAnnot) { |
1306 m_pIteratorAnnotList.RemoveAt(i); | 1311 m_pIteratorAnnotList.RemoveAt(i); |
1307 m_pIteratorAnnotList.InsertAt(0, pReaderAnnot); | 1312 m_pIteratorAnnotList.InsertAt(0, pReaderAnnot); |
1308 break; | 1313 break; |
1309 } | 1314 } |
1310 } | 1315 } |
1311 } | 1316 } |
1312 | 1317 |
1313 return TRUE; | 1318 return TRUE; |
1314 } | 1319 } |
OLD | NEW |