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

Side by Side Diff: fpdfsdk/fsdk_mgr.cpp

Issue 1846993002: Remove IXFA_* interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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/fsdk_baseform.cpp ('k') | fpdfsdk/include/fpdfxfa/fpdfxfa_app.h » ('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 "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>
11 11
12 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" 12 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
13 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
14 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 14 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
15 #include "fpdfsdk/formfiller/cffl_formfiller.h" 15 #include "fpdfsdk/formfiller/cffl_formfiller.h"
16 #include "fpdfsdk/include/fsdk_define.h" 16 #include "fpdfsdk/include/fsdk_define.h"
17 #include "fpdfsdk/javascript/ijs_runtime.h" 17 #include "fpdfsdk/javascript/ijs_runtime.h"
18 #include "public/fpdf_ext.h" 18 #include "public/fpdf_ext.h"
19 #include "third_party/base/stl_util.h" 19 #include "third_party/base/stl_util.h"
20 20
21 #ifdef PDF_ENABLE_XFA 21 #ifdef PDF_ENABLE_XFA
22 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" 22 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h"
23 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" 23 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
24 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" 24 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h"
25 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h" 25 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h"
26 #include "xfa/fxgraphics/include/cfx_graphics.h" 26 #include "xfa/fxgraphics/include/cfx_graphics.h"
27 #include "xfa/include/fxfa/xfa_rendercontext.h"
27 #endif // PDF_ENABLE_XFA 28 #endif // PDF_ENABLE_XFA
28 29
29 #if _FX_OS_ == _FX_ANDROID_ 30 #if _FX_OS_ == _FX_ANDROID_
30 #include "time.h" 31 #include "time.h"
31 #else 32 #else
32 #include <ctime> 33 #include <ctime>
33 #endif 34 #endif
34 35
35 namespace { 36 namespace {
36 37
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 696
696 if (pPage->GetDocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { 697 if (pPage->GetDocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) {
697 CFX_Graphics gs; 698 CFX_Graphics gs;
698 gs.Create(pDevice); 699 gs.Create(pDevice);
699 CFX_RectF rectClip; 700 CFX_RectF rectClip;
700 rectClip.Set(static_cast<FX_FLOAT>(pClip.left), 701 rectClip.Set(static_cast<FX_FLOAT>(pClip.left),
701 static_cast<FX_FLOAT>(pClip.top), 702 static_cast<FX_FLOAT>(pClip.top),
702 static_cast<FX_FLOAT>(pClip.Width()), 703 static_cast<FX_FLOAT>(pClip.Width()),
703 static_cast<FX_FLOAT>(pClip.Height())); 704 static_cast<FX_FLOAT>(pClip.Height()));
704 gs.SetClipRect(rectClip); 705 gs.SetClipRect(rectClip);
705 IXFA_RenderContext* pRenderContext = XFA_RenderContext_Create(); 706 CXFA_RenderContext* pRenderContext = new CXFA_RenderContext;
706 if (!pRenderContext)
707 return;
708 CXFA_RenderOptions renderOptions; 707 CXFA_RenderOptions renderOptions;
709 renderOptions.m_bHighlight = TRUE; 708 renderOptions.m_bHighlight = TRUE;
710 IXFA_PageView* xfaView = pPage->GetXFAPageView(); 709 CXFA_FFPageView* xfaView = pPage->GetXFAPageView();
711 pRenderContext->StartRender(xfaView, &gs, *pUser2Device, renderOptions); 710 pRenderContext->StartRender(xfaView, &gs, *pUser2Device, renderOptions);
712 pRenderContext->DoRender(); 711 pRenderContext->DoRender();
713 pRenderContext->StopRender(); 712 pRenderContext->StopRender();
714 pRenderContext->Release(); 713 pRenderContext->Release();
715 IXFA_DocView* docView = xfaView->GetDocView(); 714 CXFA_FFDocView* docView = xfaView->GetDocView();
716 if (!docView) 715 if (!docView)
717 return; 716 return;
718 CPDFSDK_Annot* annot = GetFocusAnnot(); 717 CPDFSDK_Annot* annot = GetFocusAnnot();
719 if (!annot) 718 if (!annot)
720 return; 719 return;
721 // Render the focus widget 720 // Render the focus widget
722 docView->GetWidgetHandler()->RenderWidget(annot->GetXFAWidget(), &gs, 721 docView->GetWidgetHandler()->RenderWidget(annot->GetXFAWidget(), &gs,
723 pUser2Device, FALSE); 722 pUser2Device, FALSE);
724 return; 723 return;
725 } 724 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 CPDFSDK_Annot* pSDKAnnot = pAnnotHandler->NewAnnot(pPDFAnnot, this); 813 CPDFSDK_Annot* pSDKAnnot = pAnnotHandler->NewAnnot(pPDFAnnot, this);
815 if (!pSDKAnnot) 814 if (!pSDKAnnot)
816 return nullptr; 815 return nullptr;
817 816
818 m_fxAnnotArray.push_back(pSDKAnnot); 817 m_fxAnnotArray.push_back(pSDKAnnot);
819 pAnnotHandler->Annot_OnCreate(pSDKAnnot); 818 pAnnotHandler->Annot_OnCreate(pSDKAnnot);
820 return pSDKAnnot; 819 return pSDKAnnot;
821 } 820 }
822 821
823 #ifdef PDF_ENABLE_XFA 822 #ifdef PDF_ENABLE_XFA
824 CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(IXFA_Widget* pPDFAnnot) { 823 CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CXFA_FFWidget* pPDFAnnot) {
825 if (!pPDFAnnot) 824 if (!pPDFAnnot)
826 return nullptr; 825 return nullptr;
827 826
828 CPDFSDK_Annot* pSDKAnnot = GetAnnotByXFAWidget(pPDFAnnot); 827 CPDFSDK_Annot* pSDKAnnot = GetAnnotByXFAWidget(pPDFAnnot);
829 if (pSDKAnnot) 828 if (pSDKAnnot)
830 return pSDKAnnot; 829 return pSDKAnnot;
831 830
832 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 831 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
833 CPDFSDK_AnnotHandlerMgr* pAnnotHandler = pEnv->GetAnnotHandlerMgr(); 832 CPDFSDK_AnnotHandlerMgr* pAnnotHandler = pEnv->GetAnnotHandlerMgr();
834 pSDKAnnot = pAnnotHandler->NewAnnot(pPDFAnnot, this); 833 pSDKAnnot = pAnnotHandler->NewAnnot(pPDFAnnot, this);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 906
908 CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByDict(CPDF_Dictionary* pDict) { 907 CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByDict(CPDF_Dictionary* pDict) {
909 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { 908 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) {
910 if (pAnnot->GetPDFAnnot()->GetAnnotDict() == pDict) 909 if (pAnnot->GetPDFAnnot()->GetAnnotDict() == pDict)
911 return pAnnot; 910 return pAnnot;
912 } 911 }
913 return nullptr; 912 return nullptr;
914 } 913 }
915 914
916 #ifdef PDF_ENABLE_XFA 915 #ifdef PDF_ENABLE_XFA
917 CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByXFAWidget(IXFA_Widget* hWidget) { 916 CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByXFAWidget(CXFA_FFWidget* hWidget) {
918 if (!hWidget) 917 if (!hWidget)
919 return nullptr; 918 return nullptr;
920 919
921 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { 920 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) {
922 if (pAnnot->GetXFAWidget() == hWidget) 921 if (pAnnot->GetXFAWidget() == hWidget)
923 return pAnnot; 922 return pAnnot;
924 } 923 }
925 return nullptr; 924 return nullptr;
926 } 925 }
927 #endif // PDF_ENABLE_XFA 926 #endif // PDF_ENABLE_XFA
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 m_pAnnotList.reset(new CPDF_AnnotList(m_page)); 1079 m_pAnnotList.reset(new CPDF_AnnotList(m_page));
1081 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); 1080 CPDF_InterForm::EnableUpdateAP(enableAPUpdate);
1082 const size_t nCount = m_pAnnotList->Count(); 1081 const size_t nCount = m_pAnnotList->Count();
1083 #endif // PDF_ENABLE_XFA 1082 #endif // PDF_ENABLE_XFA
1084 1083
1085 SetLock(TRUE); 1084 SetLock(TRUE);
1086 1085
1087 #ifdef PDF_ENABLE_XFA 1086 #ifdef PDF_ENABLE_XFA
1088 m_page->AddRef(); 1087 m_page->AddRef();
1089 if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { 1088 if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) {
1090 IXFA_PageView* pageView = m_page->GetXFAPageView(); 1089 CXFA_FFPageView* pageView = m_page->GetXFAPageView();
1091 IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetIterator( 1090 IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetIterator(
1092 XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible | 1091 XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible |
1093 XFA_WIDGETFILTER_Viewable | 1092 XFA_WIDGETFILTER_Viewable |
1094 XFA_WIDGETFILTER_AllType); 1093 XFA_WIDGETFILTER_AllType);
1095 if (!pWidgetHander) { 1094 if (!pWidgetHander) {
1096 m_page->Release(); 1095 m_page->Release();
1097 SetLock(FALSE); 1096 SetLock(FALSE);
1098 return; 1097 return;
1099 } 1098 }
1100 1099
1101 while (IXFA_Widget* pXFAAnnot = pWidgetHander->MoveToNext()) { 1100 while (CXFA_FFWidget* pXFAAnnot = pWidgetHander->MoveToNext()) {
1102 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAAnnot, this); 1101 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAAnnot, this);
1103 if (!pAnnot) 1102 if (!pAnnot)
1104 continue; 1103 continue;
1105 1104
1106 m_fxAnnotArray.push_back(pAnnot); 1105 m_fxAnnotArray.push_back(pAnnot);
1107 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); 1106 pAnnotHandlerMgr->Annot_OnLoad(pAnnot);
1108 } 1107 }
1109 pWidgetHander->Release(); 1108 pWidgetHander->Release();
1110 } else { 1109 } else {
1111 CPDF_Page* pPage = m_page->GetPDFPage(); 1110 CPDF_Page* pPage = m_page->GetPDFPage();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); 1199 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot();
1201 if (!pFocusAnnot) 1200 if (!pFocusAnnot)
1202 return nullptr; 1201 return nullptr;
1203 1202
1204 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { 1203 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) {
1205 if (pAnnot == pFocusAnnot) 1204 if (pAnnot == pFocusAnnot)
1206 return pAnnot; 1205 return pAnnot;
1207 } 1206 }
1208 return nullptr; 1207 return nullptr;
1209 } 1208 }
OLDNEW
« no previous file with comments | « fpdfsdk/fsdk_baseform.cpp ('k') | fpdfsdk/include/fpdfxfa/fpdfxfa_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698