Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: fpdfsdk/src/fsdk_annothandler.cpp

Issue 1155273002: Replace XFA_HWIDGET with IXFA_Widget* (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@ixfa_doc
Patch Set: Rebase. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ASSERT(pPageView != NULL); 67 ASSERT(pPageView != NULL);
68 68
69 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot->GetSub Type())) 69 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot->GetSub Type()))
70 { 70 {
71 return pAnnotHandler->NewAnnot(pAnnot, pPageView); 71 return pAnnotHandler->NewAnnot(pAnnot, pPageView);
72 } 72 }
73 73
74 return new CPDFSDK_BAAnnot(pAnnot, pPageView); 74 return new CPDFSDK_BAAnnot(pAnnot, pPageView);
75 } 75 }
76 76
77 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(XFA_HWIDGET pAnnot, CPDFSDK_Pag eView* pPageView) 77 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_Pa geView* pPageView)
78 { 78 {
79 ASSERT(pAnnot != NULL); 79 ASSERT(pAnnot != NULL);
80 ASSERT(pPageView != NULL); 80 ASSERT(pPageView != NULL);
81 81
82 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(FSDK_XFAWIDGET _TYPENAME)) 82 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(FSDK_XFAWIDGET _TYPENAME))
83 { 83 {
84 return pAnnotHandler->NewAnnot(pAnnot, pPageView); 84 return pAnnotHandler->NewAnnot(pAnnot, pPageView);
85 } 85 }
86 86
87 return NULL; 87 return NULL;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 ai.GetNextAnnot(pSDKAnnot) : 391 ai.GetNextAnnot(pSDKAnnot) :
392 ai.GetPrevAnnot(pSDKAnnot); 392 ai.GetPrevAnnot(pSDKAnnot);
393 return pNext; 393 return pNext;
394 } 394 }
395 // for xfa annots 395 // for xfa annots
396 IXFA_WidgetIterator* pWidgetIterator = pPage->GetXFAPageView()->CreateWi dgetIterator(XFA_TRAVERSEWAY_Tranvalse, XFA_WIDGETFILTER_Visible | XFA_WIDGETFIL TER_Viewable | XFA_WIDGETFILTER_Field); 396 IXFA_WidgetIterator* pWidgetIterator = pPage->GetXFAPageView()->CreateWi dgetIterator(XFA_TRAVERSEWAY_Tranvalse, XFA_WIDGETFILTER_Visible | XFA_WIDGETFIL TER_Viewable | XFA_WIDGETFILTER_Field);
397 if (pWidgetIterator == NULL) 397 if (pWidgetIterator == NULL)
398 return NULL; 398 return NULL;
399 if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget()) 399 if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget())
400 pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget()); 400 pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget());
401 » XFA_HWIDGET hNextFocus = NULL; 401 » IXFA_Widget* hNextFocus = NULL;
402 hNextFocus = bNext?pWidgetIterator->MoveToNext():pWidgetIterator->MoveTo Previous(); 402 hNextFocus = bNext?pWidgetIterator->MoveToNext():pWidgetIterator->MoveTo Previous();
403 if (hNextFocus == NULL && pSDKAnnot != NULL) 403 if (hNextFocus == NULL && pSDKAnnot != NULL)
404 hNextFocus = pWidgetIterator->MoveToFirst(); 404 hNextFocus = pWidgetIterator->MoveToFirst();
405 405
406 pWidgetIterator->Release(); 406 pWidgetIterator->Release();
407 return pPageView->GetAnnotByXFAWidget(hNextFocus); 407 return pPageView->GetAnnotByXFAWidget(hNextFocus);
408 } 408 }
409 409
410 FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) 410 FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot)
411 { 411 {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); 459 pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm);
460 pInterForm->AddMap(pCtrl, pWidget); 460 pInterForm->AddMap(pCtrl, pWidget);
461 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); 461 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm();
462 if(pPDFInterForm && pPDFInterForm->NeedConstructAP()) 462 if(pPDFInterForm && pPDFInterForm->NeedConstructAP())
463 pWidget->ResetAppearance(NULL,FALSE); 463 pWidget->ResetAppearance(NULL,FALSE);
464 } 464 }
465 465
466 return pWidget; 466 return pWidget;
467 } 467 }
468 468
469 CPDFSDK_Annot*» » CPDFSDK_BFAnnotHandler::NewAnnot(XFA_HWIDGET hWidget, CP DFSDK_PageView* pPage) 469 CPDFSDK_Annot*» » CPDFSDK_BFAnnotHandler::NewAnnot(IXFA_Widget* hWidget, C PDFSDK_PageView* pPage)
470 { 470 {
471 return NULL; 471 return NULL;
472 } 472 }
473 473
474 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) 474 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot)
475 { 475 {
476 ASSERT(pAnnot != NULL); 476 ASSERT(pAnnot != NULL);
477 477
478 if (m_pFormFiller) 478 if (m_pFormFiller)
479 m_pFormFiller->OnDelete(pAnnot); 479 m_pFormFiller->OnDelete(pAnnot);
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 #define FWL_WGTHITTEST_Border 17 830 #define FWL_WGTHITTEST_Border 17
831 #define FWL_WGTHITTEST_Edit 19 831 #define FWL_WGTHITTEST_Edit 19
832 #define FWL_WGTHITTEST_HyperLink 20 832 #define FWL_WGTHITTEST_HyperLink 20
833 833
834 CPDFSDK_XFAAnnotHandler::CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp) : 834 CPDFSDK_XFAAnnotHandler::CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp) :
835 m_pApp(pApp) 835 m_pApp(pApp)
836 { 836 {
837 837
838 } 838 }
839 839
840 CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(XFA_HWIDGET pAnnot, CPDFSDK_Pag eView* pPage) 840 CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_Pa geView* pPage)
841 { 841 {
842 ASSERT(pPage != NULL); 842 ASSERT(pPage != NULL);
843 ASSERT(pAnnot != NULL); 843 ASSERT(pAnnot != NULL);
844 844
845 CPDFSDK_Document* pSDKDoc = m_pApp->GetCurrentDoc(); 845 CPDFSDK_Document* pSDKDoc = m_pApp->GetCurrentDoc();
846 ASSERT(pSDKDoc); 846 ASSERT(pSDKDoc);
847 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterFor m(); 847 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterFor m();
848 ASSERT(pInterForm != NULL); 848 ASSERT(pInterForm != NULL);
849 849
850 CPDFSDK_XFAWidget* pWidget = NULL; 850 CPDFSDK_XFAWidget* pWidget = NULL;
(...skipping 21 matching lines...) Expand all
872 872
873 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); 873 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
874 ASSERT(pWidgetHandler != NULL); 874 ASSERT(pWidgetHandler != NULL);
875 875
876 CFX_Graphics gs; 876 CFX_Graphics gs;
877 gs.Create(pDevice); 877 gs.Create(pDevice);
878 878
879 CFX_Matrix mt; 879 CFX_Matrix mt;
880 mt = *(CFX_Matrix*)pUser2Device; 880 mt = *(CFX_Matrix*)pUser2Device;
881 881
882 » XFA_HWIDGET hWidget = pAnnot->GetXFAWidget(); 882 » IXFA_Widget* hWidget = pAnnot->GetXFAWidget();
883 ASSERT(hWidget != NULL); 883 ASSERT(hWidget != NULL);
884 884
885 FX_BOOL bIsHighlight = FALSE; 885 FX_BOOL bIsHighlight = FALSE;
886 if (pSDKDoc->GetFocusAnnot() != pAnnot) 886 if (pSDKDoc->GetFocusAnnot() != pAnnot)
887 bIsHighlight = TRUE; 887 bIsHighlight = TRUE;
888 888
889 pWidgetHandler->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt, bIsHighli ght); 889 pWidgetHandler->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt, bIsHighli ght);
890 890
891 // to do highlight and shadow 891 // to do highlight and shadow
892 892
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 { 1142 {
1143 IXFA_WidgetHandler* pWidgetHandler = NULL; 1143 IXFA_WidgetHandler* pWidgetHandler = NULL;
1144 1144
1145 if (pOldAnnot) 1145 if (pOldAnnot)
1146 pWidgetHandler = GetXFAWidgetHandler(pOldAnnot); 1146 pWidgetHandler = GetXFAWidgetHandler(pOldAnnot);
1147 else if (pNewAnnot) 1147 else if (pNewAnnot)
1148 pWidgetHandler = GetXFAWidgetHandler(pNewAnnot); 1148 pWidgetHandler = GetXFAWidgetHandler(pNewAnnot);
1149 1149
1150 if (pWidgetHandler) 1150 if (pWidgetHandler)
1151 { 1151 {
1152 » » FX_BOOL bRet = TRUE; /*pWidgetHandler->OnFocusChange(pNewAnnot ? pNewAnnot->GetXFAWidget() : NULL, 1152 » » FX_BOOL bRet = TRUE;
1153 » » » pOldAnnot ? pOldAnnot->GetXFAWidget() : NULL); */ 1153 » » IXFA_Widget* hWidget = pNewAnnot ? pNewAnnot->GetXFAWidget() : N ULL;
1154
1155 » » XFA_HWIDGET hWidget = pNewAnnot ? pNewAnnot->GetXFAWidget() : NU LL;
1156 if (hWidget) 1154 if (hWidget)
1157 { 1155 {
1158 IXFA_PageView* pXFAPageView = pWidgetHandler->GetPageVie w(hWidget); 1156 IXFA_PageView* pXFAPageView = pWidgetHandler->GetPageVie w(hWidget);
1159 if (pXFAPageView) 1157 if (pXFAPageView)
1160 { 1158 {
1161 bRet = pXFAPageView->GetDocView()->SetFocus(hWid get); 1159 bRet = pXFAPageView->GetDocView()->SetFocus(hWid get);
1162 if (pXFAPageView->GetDocView()->GetFocusWidget() == hWidget) 1160 if (pXFAPageView->GetDocView()->GetFocusWidget() == hWidget)
1163 bRet = TRUE; 1161 bRet = TRUE;
1164 } 1162 }
1165 } 1163 }
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 m_pIteratorAnnotList.RemoveAt(i); 1402 m_pIteratorAnnotList.RemoveAt(i);
1405 m_pIteratorAnnotList.InsertAt(0, pReaderAnnot); 1403 m_pIteratorAnnotList.InsertAt(0, pReaderAnnot);
1406 break; 1404 break;
1407 } 1405 }
1408 } 1406 }
1409 } 1407 }
1410 1408
1411 return TRUE; 1409 return TRUE;
1412 } 1410 }
1413 1411
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698