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_datetime.h" | 14 #include "fpdfsdk/include/cpdfsdk_datetime.h" |
15 #include "fpdfsdk/include/cpdfsdk_document.h" | 15 #include "fpdfsdk/include/cpdfsdk_document.h" |
16 #include "fpdfsdk/include/cpdfsdk_environment.h" | 16 #include "fpdfsdk/include/cpdfsdk_environment.h" |
17 #include "fpdfsdk/include/cpdfsdk_pageview.h" | 17 #include "fpdfsdk/include/cpdfsdk_pageview.h" |
18 #include "fpdfsdk/include/cpdfsdk_widgethandler.h" | 18 #include "fpdfsdk/include/cpdfsdk_widgethandler.h" |
19 | 19 |
20 #ifdef PDF_ENABLE_XFA | 20 #ifdef PDF_ENABLE_XFA |
21 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" | 21 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" |
22 #include "fpdfsdk/include/cpdfsdk_xfawidgethandler.h" | 22 #include "fpdfsdk/include/cpdfsdk_xfawidgethandler.h" |
23 #include "xfa/fxfa/include/xfa_ffpageview.h" | 23 #include "xfa/fxfa/include/xfa_ffpageview.h" |
24 #include "xfa/fxfa/include/xfa_ffwidget.h" | 24 #include "xfa/fxfa/include/xfa_ffwidget.h" |
25 #endif // PDF_ENABLE_XFA | 25 #endif // PDF_ENABLE_XFA |
26 | 26 |
27 CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFSDK_Environment* pApp) | 27 CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFSDK_Environment* pEnv) |
28 : m_pBAAnnotHandler(new CPDFSDK_BAAnnotHandler()), | 28 : m_pBAAnnotHandler(new CPDFSDK_BAAnnotHandler()), |
29 m_pWidgetHandler(new CPDFSDK_WidgetHandler(pApp)), | 29 m_pWidgetHandler(new CPDFSDK_WidgetHandler(pEnv)), |
30 #ifdef PDF_ENABLE_XFA | 30 #ifdef PDF_ENABLE_XFA |
31 m_pXFAWidgetHandler(new CPDFSDK_XFAWidgetHandler(pApp)), | 31 m_pXFAWidgetHandler(new CPDFSDK_XFAWidgetHandler(pEnv)), |
32 #endif // PDF_ENABLE_XFA | 32 #endif // PDF_ENABLE_XFA |
33 m_pApp(pApp) { | 33 m_pEnv(pEnv) { |
34 m_pWidgetHandler->SetFormFiller(m_pApp->GetInteractiveFormFiller()); | 34 m_pWidgetHandler->SetFormFiller(m_pEnv->GetInteractiveFormFiller()); |
35 } | 35 } |
36 | 36 |
37 CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() {} | 37 CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() {} |
38 | 38 |
39 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot, | 39 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot, |
40 CPDFSDK_PageView* pPageView) { | 40 CPDFSDK_PageView* pPageView) { |
41 ASSERT(pPageView); | 41 ASSERT(pPageView); |
42 return GetAnnotHandler(pAnnot->GetSubtype())->NewAnnot(pAnnot, pPageView); | 42 return GetAnnotHandler(pAnnot->GetSubtype())->NewAnnot(pAnnot, pPageView); |
43 } | 43 } |
44 | 44 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, | 187 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, |
188 uint32_t nChar, | 188 uint32_t nChar, |
189 uint32_t nFlags) { | 189 uint32_t nFlags) { |
190 return GetAnnotHandler(pAnnot)->OnChar(pAnnot, nChar, nFlags); | 190 return GetAnnotHandler(pAnnot)->OnChar(pAnnot, nChar, nFlags); |
191 } | 191 } |
192 | 192 |
193 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, | 193 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, |
194 int nKeyCode, | 194 int nKeyCode, |
195 int nFlag) { | 195 int nFlag) { |
196 if (m_pApp->IsCTRLKeyDown(nFlag) || m_pApp->IsALTKeyDown(nFlag)) | 196 if (m_pEnv->IsCTRLKeyDown(nFlag) || m_pEnv->IsALTKeyDown(nFlag)) |
197 return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag); | 197 return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag); |
198 | 198 |
199 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); | 199 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); |
200 CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); | 200 CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); |
201 if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) { | 201 if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) { |
202 CPDFSDK_Annot* pNext = | 202 CPDFSDK_Annot* pNext = |
203 GetNextAnnot(pFocusAnnot, !m_pApp->IsSHIFTKeyDown(nFlag)); | 203 GetNextAnnot(pFocusAnnot, !m_pEnv->IsSHIFTKeyDown(nFlag)); |
204 | 204 |
205 if (pNext && pNext != pFocusAnnot) { | 205 if (pNext && pNext != pFocusAnnot) { |
206 CPDFSDK_Document* pDocument = pPage->GetSDKDocument(); | 206 CPDFSDK_Document* pDocument = pPage->GetSDKDocument(); |
207 pDocument->SetFocusAnnot(pNext); | 207 pDocument->SetFocusAnnot(pNext); |
208 return TRUE; | 208 return TRUE; |
209 } | 209 } |
210 } | 210 } |
211 | 211 |
212 return FALSE; | 212 return FALSE; |
213 } | 213 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); | 299 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); |
300 if (!hNextFocus && pSDKAnnot) | 300 if (!hNextFocus && pSDKAnnot) |
301 hNextFocus = pWidgetIterator->MoveToFirst(); | 301 hNextFocus = pWidgetIterator->MoveToFirst(); |
302 | 302 |
303 return pPageView->GetAnnotByXFAWidget(hNextFocus); | 303 return pPageView->GetAnnotByXFAWidget(hNextFocus); |
304 #else // PDF_ENABLE_XFA | 304 #else // PDF_ENABLE_XFA |
305 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET); | 305 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET); |
306 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); | 306 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
307 #endif // PDF_ENABLE_XFA | 307 #endif // PDF_ENABLE_XFA |
308 } | 308 } |
OLD | NEW |