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/cpdfsdk_annothandlermgr.h" | 7 #include "fpdfsdk/cpdfsdk_annothandlermgr.h" |
8 | 8 |
9 #include "core/fpdfdoc/cpdf_annot.h" | 9 #include "core/fpdfdoc/cpdf_annot.h" |
10 #include "fpdfsdk/cba_annotiterator.h" | 10 #include "fpdfsdk/cba_annotiterator.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 int nFlag) { | 201 int nFlag) { |
202 if (m_pEnv->IsCTRLKeyDown(nFlag) || m_pEnv->IsALTKeyDown(nFlag)) | 202 if (m_pEnv->IsCTRLKeyDown(nFlag) || m_pEnv->IsALTKeyDown(nFlag)) |
203 return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag); | 203 return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag); |
204 | 204 |
205 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); | 205 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); |
206 CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); | 206 CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); |
207 if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) { | 207 if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) { |
208 CPDFSDK_Annot::ObservedPtr pNext( | 208 CPDFSDK_Annot::ObservedPtr pNext( |
209 GetNextAnnot(pFocusAnnot, !m_pEnv->IsSHIFTKeyDown(nFlag))); | 209 GetNextAnnot(pFocusAnnot, !m_pEnv->IsSHIFTKeyDown(nFlag))); |
210 if (pNext && pNext.Get() != pFocusAnnot) { | 210 if (pNext && pNext.Get() != pFocusAnnot) { |
211 pPage->GetSDKDocument()->SetFocusAnnot(&pNext); | 211 pPage->GetFormFillEnv()->GetSDKDocument()->SetFocusAnnot(&pNext); |
212 return TRUE; | 212 return TRUE; |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 return FALSE; | 216 return FALSE; |
217 } | 217 } |
218 | 218 |
219 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, | 219 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, |
220 int nKeyCode, | 220 int nKeyCode, |
221 int nFlag) { | 221 int nFlag) { |
222 return FALSE; | 222 return FALSE; |
223 } | 223 } |
224 | 224 |
225 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus( | 225 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus( |
226 CPDFSDK_Annot::ObservedPtr* pAnnot, | 226 CPDFSDK_Annot::ObservedPtr* pAnnot, |
227 uint32_t nFlag) { | 227 uint32_t nFlag) { |
228 ASSERT(*pAnnot); | 228 ASSERT(*pAnnot); |
229 if (!GetAnnotHandler(pAnnot->Get())->OnSetFocus(pAnnot, nFlag)) | 229 return GetAnnotHandler(pAnnot->Get())->OnSetFocus(pAnnot, nFlag); |
230 return FALSE; | |
231 | |
232 (*pAnnot)->GetPageView()->GetSDKDocument(); | |
233 return TRUE; | |
234 } | 230 } |
235 | 231 |
236 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus( | 232 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus( |
237 CPDFSDK_Annot::ObservedPtr* pAnnot, | 233 CPDFSDK_Annot::ObservedPtr* pAnnot, |
238 uint32_t nFlag) { | 234 uint32_t nFlag) { |
239 ASSERT(*pAnnot); | 235 ASSERT(*pAnnot); |
240 return GetAnnotHandler(pAnnot->Get())->OnKillFocus(pAnnot, nFlag); | 236 return GetAnnotHandler(pAnnot->Get())->OnKillFocus(pAnnot, nFlag); |
241 } | 237 } |
242 | 238 |
243 #ifdef PDF_ENABLE_XFA | 239 #ifdef PDF_ENABLE_XFA |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); | 299 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); |
304 if (!hNextFocus && pSDKAnnot) | 300 if (!hNextFocus && pSDKAnnot) |
305 hNextFocus = pWidgetIterator->MoveToFirst(); | 301 hNextFocus = pWidgetIterator->MoveToFirst(); |
306 | 302 |
307 return pPageView->GetAnnotByXFAWidget(hNextFocus); | 303 return pPageView->GetAnnotByXFAWidget(hNextFocus); |
308 #else // PDF_ENABLE_XFA | 304 #else // PDF_ENABLE_XFA |
309 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET); | 305 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET); |
310 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); | 306 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
311 #endif // PDF_ENABLE_XFA | 307 #endif // PDF_ENABLE_XFA |
312 } | 308 } |
OLD | NEW |