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" |
(...skipping 28 matching lines...) Expand all Loading... |
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 |
43 #ifdef PDF_ENABLE_XFA | 43 #ifdef PDF_ENABLE_XFA |
44 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CXFA_FFWidget* pAnnot, | 44 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CXFA_FFWidget* pAnnot, |
45 CPDFSDK_PageView* pPageView) { | 45 CPDFSDK_PageView* pPageView) { |
46 ASSERT(pAnnot); | 46 ASSERT(pAnnot); |
47 ASSERT(pPageView); | 47 ASSERT(pPageView); |
48 | 48 |
49 return GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)->NewAnnot(pAnnot, pPageView); | 49 return GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET) |
| 50 ->NewAnnot(pAnnot, pPageView); |
50 } | 51 } |
51 #endif // PDF_ENABLE_XFA | 52 #endif // PDF_ENABLE_XFA |
52 | 53 |
53 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { | 54 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { |
54 IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot); | 55 IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot); |
55 pAnnotHandler->OnRelease(pAnnot); | 56 pAnnotHandler->OnRelease(pAnnot); |
56 pAnnotHandler->ReleaseAnnot(pAnnot); | 57 pAnnotHandler->ReleaseAnnot(pAnnot); |
57 } | 58 } |
58 | 59 |
59 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { | 60 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { |
(...skipping 10 matching lines...) Expand all Loading... |
70 ASSERT(pAnnot); | 71 ASSERT(pAnnot); |
71 GetAnnotHandler(pAnnot)->OnLoad(pAnnot); | 72 GetAnnotHandler(pAnnot)->OnLoad(pAnnot); |
72 } | 73 } |
73 | 74 |
74 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( | 75 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( |
75 CPDFSDK_Annot* pAnnot) const { | 76 CPDFSDK_Annot* pAnnot) const { |
76 return GetAnnotHandler(pAnnot->GetAnnotSubtype()); | 77 return GetAnnotHandler(pAnnot->GetAnnotSubtype()); |
77 } | 78 } |
78 | 79 |
79 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( | 80 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( |
80 const CFX_ByteString& sType) const { | 81 CPDF_Annot::Subtype nAnnotSubtype) const { |
81 if (sType == "Widget") | 82 if (nAnnotSubtype == CPDF_Annot::Subtype::WIDGET) |
82 return m_pWidgetHandler.get(); | 83 return m_pWidgetHandler.get(); |
83 | 84 |
84 #ifdef PDF_ENABLE_XFA | 85 #ifdef PDF_ENABLE_XFA |
85 if (sType == FSDK_XFAWIDGET_TYPENAME) | 86 if (nAnnotSubtype == CPDF_Annot::Subtype::XFAWIDGET) |
86 return m_pXFAWidgetHandler.get(); | 87 return m_pXFAWidgetHandler.get(); |
87 #endif // PDF_ENABLE_XFA | 88 #endif // PDF_ENABLE_XFA |
88 | 89 |
89 return m_pBAAnnotHandler.get(); | 90 return m_pBAAnnotHandler.get(); |
90 } | 91 } |
91 | 92 |
92 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, | 93 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, |
93 CPDFSDK_Annot* pAnnot, | 94 CPDFSDK_Annot* pAnnot, |
94 CFX_RenderDevice* pDevice, | 95 CFX_RenderDevice* pDevice, |
95 CFX_Matrix* pUser2Device, | 96 CFX_Matrix* pUser2Device, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 236 |
236 #ifdef PDF_ENABLE_XFA | 237 #ifdef PDF_ENABLE_XFA |
237 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus( | 238 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus( |
238 CPDFSDK_Annot* pSetAnnot, | 239 CPDFSDK_Annot* pSetAnnot, |
239 CPDFSDK_Annot* pKillAnnot) { | 240 CPDFSDK_Annot* pKillAnnot) { |
240 FX_BOOL bXFA = (pSetAnnot && pSetAnnot->GetXFAWidget()) || | 241 FX_BOOL bXFA = (pSetAnnot && pSetAnnot->GetXFAWidget()) || |
241 (pKillAnnot && pKillAnnot->GetXFAWidget()); | 242 (pKillAnnot && pKillAnnot->GetXFAWidget()); |
242 | 243 |
243 if (bXFA) { | 244 if (bXFA) { |
244 if (IPDFSDK_AnnotHandler* pXFAAnnotHandler = | 245 if (IPDFSDK_AnnotHandler* pXFAAnnotHandler = |
245 GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)) | 246 GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET)) |
246 return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot); | 247 return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot); |
247 } | 248 } |
248 | 249 |
249 return TRUE; | 250 return TRUE; |
250 } | 251 } |
251 #endif // PDF_ENABLE_XFA | 252 #endif // PDF_ENABLE_XFA |
252 | 253 |
253 CFX_FloatRect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox( | 254 CFX_FloatRect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox( |
254 CPDFSDK_PageView* pPageView, | 255 CPDFSDK_PageView* pPageView, |
255 CPDFSDK_Annot* pAnnot) { | 256 CPDFSDK_Annot* pAnnot) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 return nullptr; | 293 return nullptr; |
293 if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget()) | 294 if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget()) |
294 pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget()); | 295 pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget()); |
295 CXFA_FFWidget* hNextFocus = | 296 CXFA_FFWidget* hNextFocus = |
296 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); | 297 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); |
297 if (!hNextFocus && pSDKAnnot) | 298 if (!hNextFocus && pSDKAnnot) |
298 hNextFocus = pWidgetIterator->MoveToFirst(); | 299 hNextFocus = pWidgetIterator->MoveToFirst(); |
299 | 300 |
300 return pPageView->GetAnnotByXFAWidget(hNextFocus); | 301 return pPageView->GetAnnotByXFAWidget(hNextFocus); |
301 #else // PDF_ENABLE_XFA | 302 #else // PDF_ENABLE_XFA |
302 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget"); | 303 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET); |
303 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); | 304 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
304 #endif // PDF_ENABLE_XFA | 305 #endif // PDF_ENABLE_XFA |
305 } | 306 } |
OLD | NEW |