OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/cpdfsdk_annothandlermgr.h" | 7 #include "fpdfsdk/include/cpdfsdk_annothandlermgr.h" |
8 | 8 |
9 #include "core/fpdfdoc/include/cpdf_annot.h" | 9 #include "core/fpdfdoc/include/cpdf_annot.h" |
10 #include "fpdfsdk/include/cba_annotiterator.h" | 10 #include "fpdfsdk/include/cba_annotiterator.h" |
11 #include "fpdfsdk/include/cpdfsdk_annot.h" | 11 #include "fpdfsdk/include/cpdfsdk_annot.h" |
12 #include "fpdfsdk/include/cpdfsdk_baannot.h" | 12 #include "fpdfsdk/include/cpdfsdk_baannot.h" |
13 #include "fpdfsdk/include/cpdfsdk_baannothandler.h" | 13 #include "fpdfsdk/include/cpdfsdk_baannothandler.h" |
14 #include "fpdfsdk/include/cpdfsdk_bfannothandler.h" | |
15 #include "fpdfsdk/include/cpdfsdk_datetime.h" | 14 #include "fpdfsdk/include/cpdfsdk_datetime.h" |
| 15 #include "fpdfsdk/include/cpdfsdk_widgethandler.h" |
16 #include "fpdfsdk/include/fsdk_mgr.h" | 16 #include "fpdfsdk/include/fsdk_mgr.h" |
17 | 17 |
18 #ifdef PDF_ENABLE_XFA | 18 #ifdef PDF_ENABLE_XFA |
19 #include "fpdfsdk/include/cpdfsdk_xfaannothandler.h" | 19 #include "fpdfsdk/include/cpdfsdk_xfawidgethandler.h" |
20 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" | 20 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" |
21 #include "xfa/fxfa/include/xfa_ffpageview.h" | 21 #include "xfa/fxfa/include/xfa_ffpageview.h" |
22 #include "xfa/fxfa/include/xfa_ffwidget.h" | 22 #include "xfa/fxfa/include/xfa_ffwidget.h" |
23 #endif // PDF_ENABLE_XFA | 23 #endif // PDF_ENABLE_XFA |
24 | 24 |
25 CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp) | 25 CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp) |
26 : m_pBAAnnotHandler(new CPDFSDK_BAAnnotHandler()), | 26 : m_pBAAnnotHandler(new CPDFSDK_BAAnnotHandler()), |
27 m_pBFAnnotHandler(new CPDFSDK_BFAnnotHandler(pApp)), | 27 m_pWidgetHandler(new CPDFSDK_WidgetHandler(pApp)), |
28 #ifdef PDF_ENABLE_XFA | 28 #ifdef PDF_ENABLE_XFA |
29 m_pXFAAnnotHandler(new CPDFSDK_XFAAnnotHandler(pApp)), | 29 m_pXFAWidgetHandler(new CPDFSDK_XFAWidgetHandler(pApp)), |
30 #endif // PDF_ENABLE_XFA | 30 #endif // PDF_ENABLE_XFA |
31 m_pApp(pApp) { | 31 m_pApp(pApp) { |
32 m_pBFAnnotHandler->SetFormFiller(m_pApp->GetIFormFiller()); | 32 m_pWidgetHandler->SetFormFiller(m_pApp->GetIFormFiller()); |
33 } | 33 } |
34 | 34 |
35 CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() {} | 35 CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() {} |
36 | 36 |
37 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot, | 37 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot, |
38 CPDFSDK_PageView* pPageView) { | 38 CPDFSDK_PageView* pPageView) { |
39 ASSERT(pPageView); | 39 ASSERT(pPageView); |
40 return GetAnnotHandler(pAnnot->GetSubtype())->NewAnnot(pAnnot, pPageView); | 40 return GetAnnotHandler(pAnnot->GetSubtype())->NewAnnot(pAnnot, pPageView); |
41 } | 41 } |
42 | 42 |
(...skipping 29 matching lines...) Expand all Loading... |
72 } | 72 } |
73 | 73 |
74 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( | 74 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( |
75 CPDFSDK_Annot* pAnnot) const { | 75 CPDFSDK_Annot* pAnnot) const { |
76 return GetAnnotHandler(pAnnot->GetAnnotSubtype()); | 76 return GetAnnotHandler(pAnnot->GetAnnotSubtype()); |
77 } | 77 } |
78 | 78 |
79 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( | 79 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( |
80 const CFX_ByteString& sType) const { | 80 const CFX_ByteString& sType) const { |
81 if (sType == "Widget") | 81 if (sType == "Widget") |
82 return m_pBFAnnotHandler.get(); | 82 return m_pWidgetHandler.get(); |
83 | 83 |
84 #ifdef PDF_ENABLE_XFA | 84 #ifdef PDF_ENABLE_XFA |
85 if (sType == FSDK_XFAWIDGET_TYPENAME) | 85 if (sType == FSDK_XFAWIDGET_TYPENAME) |
86 return m_pXFAAnnotHandler.get(); | 86 return m_pXFAWidgetHandler.get(); |
87 #endif // PDF_ENABLE_XFA | 87 #endif // PDF_ENABLE_XFA |
88 | 88 |
89 return m_pBAAnnotHandler.get(); | 89 return m_pBAAnnotHandler.get(); |
90 } | 90 } |
91 | 91 |
92 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, | 92 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, |
93 CPDFSDK_Annot* pAnnot, | 93 CPDFSDK_Annot* pAnnot, |
94 CFX_RenderDevice* pDevice, | 94 CFX_RenderDevice* pDevice, |
95 CFX_Matrix* pUser2Device, | 95 CFX_Matrix* pUser2Device, |
96 uint32_t dwFlags) { | 96 uint32_t dwFlags) { |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); | 296 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); |
297 if (!hNextFocus && pSDKAnnot) | 297 if (!hNextFocus && pSDKAnnot) |
298 hNextFocus = pWidgetIterator->MoveToFirst(); | 298 hNextFocus = pWidgetIterator->MoveToFirst(); |
299 | 299 |
300 return pPageView->GetAnnotByXFAWidget(hNextFocus); | 300 return pPageView->GetAnnotByXFAWidget(hNextFocus); |
301 #else // PDF_ENABLE_XFA | 301 #else // PDF_ENABLE_XFA |
302 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget"); | 302 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget"); |
303 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); | 303 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
304 #endif // PDF_ENABLE_XFA | 304 #endif // PDF_ENABLE_XFA |
305 } | 305 } |
OLD | NEW |