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 "../../public/fpdf_ext.h" | 7 #include "../../public/fpdf_ext.h" |
8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
9 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 9 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
10 #include "../include/fpdfxfa/fpdfxfa_page.h" | 10 #include "../include/fpdfxfa/fpdfxfa_page.h" |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 | 798 |
799 if(pAnnotHandler) | 799 if(pAnnotHandler) |
800 { | 800 { |
801 pAnnotHandler->Annot_OnCreate(pSDKAnnot); | 801 pAnnotHandler->Annot_OnCreate(pSDKAnnot); |
802 | 802 |
803 } | 803 } |
804 | 804 |
805 return pSDKAnnot; | 805 return pSDKAnnot; |
806 } | 806 } |
807 | 807 |
808 CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(XFA_HWIDGET pPDFAnnot) | 808 CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(IXFA_Widget* pPDFAnnot) |
809 { | 809 { |
810 if (!pPDFAnnot) return NULL; | 810 if (!pPDFAnnot) return NULL; |
811 | 811 |
812 CPDFSDK_Annot* pSDKAnnot = GetAnnotByXFAWidget(pPDFAnnot); | 812 CPDFSDK_Annot* pSDKAnnot = GetAnnotByXFAWidget(pPDFAnnot); |
813 if (pSDKAnnot) | 813 if (pSDKAnnot) |
814 return pSDKAnnot; | 814 return pSDKAnnot; |
815 | 815 |
816 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 816 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
817 ASSERT(pEnv); | 817 ASSERT(pEnv); |
818 CPDFSDK_AnnotHandlerMgr * pAnnotHandler= pEnv->GetAnnotHandlerMgr(); | 818 CPDFSDK_AnnotHandlerMgr * pAnnotHandler= pEnv->GetAnnotHandlerMgr(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 { | 898 { |
899 int nCount = m_fxAnnotArray.GetSize(); | 899 int nCount = m_fxAnnotArray.GetSize(); |
900 for(int i=0; i<nCount; i++) | 900 for(int i=0; i<nCount; i++) |
901 { | 901 { |
902 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); | 902 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); |
903 if(pDict==pAnnot->GetPDFAnnot()->m_pAnnotDict) | 903 if(pDict==pAnnot->GetPDFAnnot()->m_pAnnotDict) |
904 return pAnnot; | 904 return pAnnot; |
905 } | 905 } |
906 return NULL; | 906 return NULL; |
907 } | 907 } |
908 CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByXFAWidget(XFA_HWIDGET hWidget) | 908 CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByXFAWidget(IXFA_Widget* hWidget) |
909 { | 909 { |
910 if (hWidget == NULL) | 910 if (hWidget == NULL) |
911 return NULL; | 911 return NULL; |
912 int annotCount = m_fxAnnotArray.GetSize(); | 912 int annotCount = m_fxAnnotArray.GetSize(); |
913 | 913 |
914 for(int i = 0; i < annotCount; i++) | 914 for(int i = 0; i < annotCount; i++) |
915 { | 915 { |
916 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); | 916 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); |
917 if(pAnnot->GetXFAWidget() == hWidget) | 917 if(pAnnot->GetXFAWidget() == hWidget) |
918 return pAnnot; | 918 return pAnnot; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 ASSERT(pAnnotHandlerMgr != NULL); | 1111 ASSERT(pAnnotHandlerMgr != NULL); |
1112 | 1112 |
1113 SetLock(TRUE); | 1113 SetLock(TRUE); |
1114 m_page->AddRef(); | 1114 m_page->AddRef(); |
1115 if (m_pSDKDoc->GetDocument()->GetDocType() == DOCTYPE_DYNIMIC_XFA) | 1115 if (m_pSDKDoc->GetDocument()->GetDocType() == DOCTYPE_DYNIMIC_XFA) |
1116 { | 1116 { |
1117 IXFA_PageView* pageView = NULL; | 1117 IXFA_PageView* pageView = NULL; |
1118 pageView = m_page->GetXFAPageView(); | 1118 pageView = m_page->GetXFAPageView(); |
1119 ASSERT(pageView != NULL); | 1119 ASSERT(pageView != NULL); |
1120 | 1120 |
1121 XFA_HWIDGET pXFAAnnot = NULL; | |
1122 IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetItera
tor(XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible|XFA_WIDGETFILTER_Viewable|XFA
_WIDGETFILTER_AllType); | 1121 IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetItera
tor(XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible|XFA_WIDGETFILTER_Viewable|XFA
_WIDGETFILTER_AllType); |
1123 if (!pWidgetHander) | 1122 if (!pWidgetHander) |
1124 { | 1123 { |
1125 m_page->Release(); | 1124 m_page->Release(); |
1126 SetLock(FALSE); | 1125 SetLock(FALSE); |
1127 return; | 1126 return; |
1128 } | 1127 } |
1129 | 1128 |
1130 » » pXFAAnnot = pWidgetHander->MoveToNext(); | 1129 IXFA_Widget* pXFAAnnot = pWidgetHander->MoveToNext(); |
1131 while (pXFAAnnot) { | 1130 while (pXFAAnnot) { |
1132 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAA
nnot, this); | 1131 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAA
nnot, this); |
1133 if(!pAnnot) { | 1132 if(!pAnnot) { |
1134 pXFAAnnot = pWidgetHander->MoveToNext(); | 1133 pXFAAnnot = pWidgetHander->MoveToNext(); |
1135 continue; | 1134 continue; |
1136 } | 1135 } |
1137 m_fxAnnotArray.Add(pAnnot); | 1136 m_fxAnnotArray.Add(pAnnot); |
1138 | 1137 |
1139 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); | 1138 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); |
1140 | 1139 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 | 1232 |
1234 for(int i=0; i<m_fxAnnotArray.GetSize(); i++) | 1233 for(int i=0; i<m_fxAnnotArray.GetSize(); i++) |
1235 { | 1234 { |
1236 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); | 1235 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); |
1237 if(pAnnot == pFocusAnnot) | 1236 if(pAnnot == pFocusAnnot) |
1238 return pAnnot; | 1237 return pAnnot; |
1239 } | 1238 } |
1240 return NULL; | 1239 return NULL; |
1241 } | 1240 } |
1242 | 1241 |
OLD | NEW |