blob: a1ac14cc696f8b1a92a308c9603ded12658659e8 [file] [log] [blame]
jaepark98e10192016-08-15 10:51:11 -07001// Copyright 2016 PDFium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
dsinclair114e46a2016-09-29 17:18:21 -07007#include "fpdfsdk/cpdfsdk_annothandlermgr.h"
jaepark98e10192016-08-15 10:51:11 -07008
tsepez0e606b52016-11-18 16:22:41 -08009#include "core/fpdfapi/parser/cpdf_number.h"
10#include "core/fpdfapi/parser/cpdf_string.h"
dsinclair1727aee2016-09-29 13:12:56 -070011#include "core/fpdfdoc/cpdf_annot.h"
dsinclair114e46a2016-09-29 17:18:21 -070012#include "fpdfsdk/cba_annotiterator.h"
13#include "fpdfsdk/cpdfsdk_annot.h"
14#include "fpdfsdk/cpdfsdk_baannot.h"
15#include "fpdfsdk/cpdfsdk_baannothandler.h"
16#include "fpdfsdk/cpdfsdk_datetime.h"
dsinclair735606d2016-10-05 15:47:02 -070017#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
dsinclair114e46a2016-09-29 17:18:21 -070018#include "fpdfsdk/cpdfsdk_pageview.h"
19#include "fpdfsdk/cpdfsdk_widgethandler.h"
Tom Sepezfe91c6c2017-05-16 15:33:20 -070020#include "third_party/base/ptr_util.h"
jaepark98e10192016-08-15 10:51:11 -070021
22#ifdef PDF_ENABLE_XFA
dsinclair114e46a2016-09-29 17:18:21 -070023#include "fpdfsdk/cpdfsdk_xfawidgethandler.h"
dsinclair4d29e782016-10-04 14:02:47 -070024#include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
Dan Sinclair80c48782017-03-23 12:11:20 -040025#include "xfa/fxfa/cxfa_ffpageview.h"
26#include "xfa/fxfa/cxfa_ffwidget.h"
jaepark98e10192016-08-15 10:51:11 -070027#endif // PDF_ENABLE_XFA
28
dsinclair735606d2016-10-05 15:47:02 -070029CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(
dsinclair8779fa82016-10-12 12:05:44 -070030 CPDFSDK_FormFillEnvironment* pFormFillEnv)
Tom Sepezfe91c6c2017-05-16 15:33:20 -070031 : m_pBAAnnotHandler(pdfium::MakeUnique<CPDFSDK_BAAnnotHandler>()),
Lei Zhang60fa2fc2017-07-21 17:42:19 -070032 m_pWidgetHandler(pdfium::MakeUnique<CPDFSDK_WidgetHandler>(pFormFillEnv))
jaepark98e10192016-08-15 10:51:11 -070033#ifdef PDF_ENABLE_XFA
Lei Zhang60fa2fc2017-07-21 17:42:19 -070034 ,
Tom Sepezfe91c6c2017-05-16 15:33:20 -070035 m_pXFAWidgetHandler(
Lei Zhang60fa2fc2017-07-21 17:42:19 -070036 pdfium::MakeUnique<CPDFSDK_XFAWidgetHandler>(pFormFillEnv))
jaepark98e10192016-08-15 10:51:11 -070037#endif // PDF_ENABLE_XFA
Lei Zhang60fa2fc2017-07-21 17:42:19 -070038{
jaepark98e10192016-08-15 10:51:11 -070039}
40
41CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() {}
42
jaepark98e10192016-08-15 10:51:11 -070043CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot,
44 CPDFSDK_PageView* pPageView) {
45 ASSERT(pPageView);
jaepark35512aa2016-08-29 17:15:08 -070046 return GetAnnotHandler(pAnnot->GetSubtype())->NewAnnot(pAnnot, pPageView);
jaepark98e10192016-08-15 10:51:11 -070047}
48
49#ifdef PDF_ENABLE_XFA
50CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CXFA_FFWidget* pAnnot,
51 CPDFSDK_PageView* pPageView) {
52 ASSERT(pAnnot);
53 ASSERT(pPageView);
54
jaepark956553e2016-08-31 06:49:27 -070055 return GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET)
56 ->NewAnnot(pAnnot, pPageView);
jaepark98e10192016-08-15 10:51:11 -070057}
58#endif // PDF_ENABLE_XFA
59
60void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
jaepark35512aa2016-08-29 17:15:08 -070061 IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot);
jaepark35512aa2016-08-29 17:15:08 -070062 pAnnotHandler->ReleaseAnnot(pAnnot);
jaepark98e10192016-08-15 10:51:11 -070063}
64
65void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) {
66 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
67
68 CPDFSDK_DateTime curTime;
tsepez0e606b52016-11-18 16:22:41 -080069 pPDFAnnot->GetAnnotDict()->SetNewFor<CPDF_String>(
70 "M", curTime.ToPDFDateTimeString(), false);
71 pPDFAnnot->GetAnnotDict()->SetNewFor<CPDF_Number>("F", 0);
jaepark98e10192016-08-15 10:51:11 -070072}
73
74void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) {
75 ASSERT(pAnnot);
jaepark35512aa2016-08-29 17:15:08 -070076 GetAnnotHandler(pAnnot)->OnLoad(pAnnot);
jaepark98e10192016-08-15 10:51:11 -070077}
78
Diana Gagedce2d722017-06-20 11:17:11 -070079CFX_WideString CPDFSDK_AnnotHandlerMgr::Annot_GetSelectedText(
80 CPDFSDK_Annot* pAnnot) {
81 return GetAnnotHandler(pAnnot)->GetSelectedText(pAnnot);
82}
83
Diana Gageab390972017-07-28 17:07:39 -070084void CPDFSDK_AnnotHandlerMgr::Annot_ReplaceSelection(
85 CPDFSDK_Annot* pAnnot,
86 const CFX_WideString& text) {
87 GetAnnotHandler(pAnnot)->ReplaceSelection(pAnnot, text);
Diana Gage1c7f1422017-07-24 11:19:52 -070088}
89
jaepark98e10192016-08-15 10:51:11 -070090IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
91 CPDFSDK_Annot* pAnnot) const {
jaepark35512aa2016-08-29 17:15:08 -070092 return GetAnnotHandler(pAnnot->GetAnnotSubtype());
jaepark98e10192016-08-15 10:51:11 -070093}
94
95IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
jaepark956553e2016-08-31 06:49:27 -070096 CPDF_Annot::Subtype nAnnotSubtype) const {
97 if (nAnnotSubtype == CPDF_Annot::Subtype::WIDGET)
jaepark8c541822016-08-30 13:43:05 -070098 return m_pWidgetHandler.get();
jaepark35512aa2016-08-29 17:15:08 -070099
100#ifdef PDF_ENABLE_XFA
jaepark956553e2016-08-31 06:49:27 -0700101 if (nAnnotSubtype == CPDF_Annot::Subtype::XFAWIDGET)
jaepark8c541822016-08-30 13:43:05 -0700102 return m_pXFAWidgetHandler.get();
jaepark35512aa2016-08-29 17:15:08 -0700103#endif // PDF_ENABLE_XFA
104
105 return m_pBAAnnotHandler.get();
jaepark98e10192016-08-15 10:51:11 -0700106}
107
108void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView,
109 CPDFSDK_Annot* pAnnot,
110 CFX_RenderDevice* pDevice,
jaepark75f84a52016-09-09 15:39:09 -0700111 CFX_Matrix* pUser2Device,
112 bool bDrawAnnots) {
jaepark98e10192016-08-15 10:51:11 -0700113 ASSERT(pAnnot);
jaepark75f84a52016-09-09 15:39:09 -0700114 GetAnnotHandler(pAnnot)->OnDraw(pPageView, pAnnot, pDevice, pUser2Device,
115 bDrawAnnots);
jaepark98e10192016-08-15 10:51:11 -0700116}
117
tsepez4cf55152016-11-02 14:37:54 -0700118bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(
jaepark98e10192016-08-15 10:51:11 -0700119 CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -0700120 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -0700121 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -0500122 const CFX_PointF& point) {
tsepezf8074ce2016-09-27 14:29:57 -0700123 ASSERT(*pAnnot);
124 return GetAnnotHandler(pAnnot->Get())
125 ->OnLButtonDown(pPageView, pAnnot, nFlags, point);
jaepark98e10192016-08-15 10:51:11 -0700126}
127
tsepez4cf55152016-11-02 14:37:54 -0700128bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(
jaepark98e10192016-08-15 10:51:11 -0700129 CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -0700130 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -0700131 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -0500132 const CFX_PointF& point) {
tsepezf8074ce2016-09-27 14:29:57 -0700133 ASSERT(*pAnnot);
134 return GetAnnotHandler(pAnnot->Get())
135 ->OnLButtonUp(pPageView, pAnnot, nFlags, point);
jaepark98e10192016-08-15 10:51:11 -0700136}
137
tsepez4cf55152016-11-02 14:37:54 -0700138bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(
jaepark98e10192016-08-15 10:51:11 -0700139 CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -0700140 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -0700141 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -0500142 const CFX_PointF& point) {
tsepezf8074ce2016-09-27 14:29:57 -0700143 ASSERT(*pAnnot);
144 return GetAnnotHandler(pAnnot->Get())
145 ->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
jaepark98e10192016-08-15 10:51:11 -0700146}
147
tsepez4cf55152016-11-02 14:37:54 -0700148bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(
jaepark98e10192016-08-15 10:51:11 -0700149 CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -0700150 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -0700151 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -0500152 const CFX_PointF& point) {
tsepezf8074ce2016-09-27 14:29:57 -0700153 ASSERT(*pAnnot);
154 return GetAnnotHandler(pAnnot->Get())
155 ->OnMouseMove(pPageView, pAnnot, nFlags, point);
jaepark98e10192016-08-15 10:51:11 -0700156}
157
tsepez4cf55152016-11-02 14:37:54 -0700158bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(
jaepark98e10192016-08-15 10:51:11 -0700159 CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -0700160 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -0700161 uint32_t nFlags,
162 short zDelta,
Dan Sinclairf528eee2017-02-14 11:52:07 -0500163 const CFX_PointF& point) {
tsepezf8074ce2016-09-27 14:29:57 -0700164 ASSERT(*pAnnot);
165 return GetAnnotHandler(pAnnot->Get())
166 ->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point);
jaepark98e10192016-08-15 10:51:11 -0700167}
168
tsepez4cf55152016-11-02 14:37:54 -0700169bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(
jaepark98e10192016-08-15 10:51:11 -0700170 CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -0700171 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -0700172 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -0500173 const CFX_PointF& point) {
tsepezf8074ce2016-09-27 14:29:57 -0700174 ASSERT(*pAnnot);
175 return GetAnnotHandler(pAnnot->Get())
176 ->OnRButtonDown(pPageView, pAnnot, nFlags, point);
jaepark98e10192016-08-15 10:51:11 -0700177}
178
tsepez4cf55152016-11-02 14:37:54 -0700179bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(
jaepark98e10192016-08-15 10:51:11 -0700180 CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -0700181 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -0700182 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -0500183 const CFX_PointF& point) {
tsepezf8074ce2016-09-27 14:29:57 -0700184 ASSERT(*pAnnot);
185 return GetAnnotHandler(pAnnot->Get())
186 ->OnRButtonUp(pPageView, pAnnot, nFlags, point);
jaepark98e10192016-08-15 10:51:11 -0700187}
188
tsepezf8074ce2016-09-27 14:29:57 -0700189void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(
190 CPDFSDK_PageView* pPageView,
191 CPDFSDK_Annot::ObservedPtr* pAnnot,
192 uint32_t nFlag) {
193 ASSERT(*pAnnot);
194 GetAnnotHandler(pAnnot->Get())->OnMouseEnter(pPageView, pAnnot, nFlag);
jaepark98e10192016-08-15 10:51:11 -0700195}
196
tsepezf8074ce2016-09-27 14:29:57 -0700197void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(
198 CPDFSDK_PageView* pPageView,
199 CPDFSDK_Annot::ObservedPtr* pAnnot,
200 uint32_t nFlag) {
201 ASSERT(*pAnnot);
202 GetAnnotHandler(pAnnot->Get())->OnMouseExit(pPageView, pAnnot, nFlag);
jaepark98e10192016-08-15 10:51:11 -0700203}
204
tsepez4cf55152016-11-02 14:37:54 -0700205bool CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot,
206 uint32_t nChar,
207 uint32_t nFlags) {
jaepark35512aa2016-08-29 17:15:08 -0700208 return GetAnnotHandler(pAnnot)->OnChar(pAnnot, nChar, nFlags);
jaepark98e10192016-08-15 10:51:11 -0700209}
210
tsepez4cf55152016-11-02 14:37:54 -0700211bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot,
212 int nKeyCode,
213 int nFlag) {
Lei Zhang60fa2fc2017-07-21 17:42:19 -0700214 if (CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag) ||
215 CPDFSDK_FormFillEnvironment::IsALTKeyDown(nFlag)) {
jaepark35512aa2016-08-29 17:15:08 -0700216 return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag);
thestig7b3252f2016-11-08 21:30:11 -0800217 }
jaepark98e10192016-08-15 10:51:11 -0700218
jaepark35512aa2016-08-29 17:15:08 -0700219 CPDFSDK_PageView* pPage = pAnnot->GetPageView();
220 CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot();
221 if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) {
Lei Zhang60fa2fc2017-07-21 17:42:19 -0700222 CPDFSDK_Annot::ObservedPtr pNext(GetNextAnnot(
223 pFocusAnnot, !CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag)));
tsepezf8074ce2016-09-27 14:29:57 -0700224 if (pNext && pNext.Get() != pFocusAnnot) {
dsinclair7cbe68e2016-10-12 11:56:23 -0700225 pPage->GetFormFillEnv()->SetFocusAnnot(&pNext);
tsepez4cf55152016-11-02 14:37:54 -0700226 return true;
jaepark98e10192016-08-15 10:51:11 -0700227 }
228 }
229
thestig7b3252f2016-11-08 21:30:11 -0800230 return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag);
jaepark98e10192016-08-15 10:51:11 -0700231}
232
tsepez4cf55152016-11-02 14:37:54 -0700233bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot,
234 int nKeyCode,
235 int nFlag) {
236 return false;
jaepark98e10192016-08-15 10:51:11 -0700237}
238
tsepez4cf55152016-11-02 14:37:54 -0700239bool CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(
tsepezf8074ce2016-09-27 14:29:57 -0700240 CPDFSDK_Annot::ObservedPtr* pAnnot,
241 uint32_t nFlag) {
242 ASSERT(*pAnnot);
dsinclairb402b172016-10-11 09:26:32 -0700243 return GetAnnotHandler(pAnnot->Get())->OnSetFocus(pAnnot, nFlag);
jaepark98e10192016-08-15 10:51:11 -0700244}
245
tsepez4cf55152016-11-02 14:37:54 -0700246bool CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(
tsepezf8074ce2016-09-27 14:29:57 -0700247 CPDFSDK_Annot::ObservedPtr* pAnnot,
248 uint32_t nFlag) {
249 ASSERT(*pAnnot);
250 return GetAnnotHandler(pAnnot->Get())->OnKillFocus(pAnnot, nFlag);
jaepark98e10192016-08-15 10:51:11 -0700251}
252
253#ifdef PDF_ENABLE_XFA
tsepez4cf55152016-11-02 14:37:54 -0700254bool CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus(
tsepezf8074ce2016-09-27 14:29:57 -0700255 CPDFSDK_Annot::ObservedPtr* pSetAnnot,
256 CPDFSDK_Annot::ObservedPtr* pKillAnnot) {
tsepez4cf55152016-11-02 14:37:54 -0700257 bool bXFA = (*pSetAnnot && (*pSetAnnot)->GetXFAWidget()) ||
258 (*pKillAnnot && (*pKillAnnot)->GetXFAWidget());
jaepark98e10192016-08-15 10:51:11 -0700259
260 if (bXFA) {
261 if (IPDFSDK_AnnotHandler* pXFAAnnotHandler =
jaepark956553e2016-08-31 06:49:27 -0700262 GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET))
jaepark98e10192016-08-15 10:51:11 -0700263 return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot);
264 }
265
tsepez4cf55152016-11-02 14:37:54 -0700266 return true;
jaepark98e10192016-08-15 10:51:11 -0700267}
268#endif // PDF_ENABLE_XFA
269
270CFX_FloatRect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox(
271 CPDFSDK_PageView* pPageView,
272 CPDFSDK_Annot* pAnnot) {
273 ASSERT(pAnnot);
jaepark35512aa2016-08-29 17:15:08 -0700274 return GetAnnotHandler(pAnnot)->GetViewBBox(pPageView, pAnnot);
jaepark98e10192016-08-15 10:51:11 -0700275}
276
tsepez4cf55152016-11-02 14:37:54 -0700277bool CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView* pPageView,
278 CPDFSDK_Annot* pAnnot,
Dan Sinclairf528eee2017-02-14 11:52:07 -0500279 const CFX_PointF& point) {
jaepark98e10192016-08-15 10:51:11 -0700280 ASSERT(pAnnot);
jaepark35512aa2016-08-29 17:15:08 -0700281 IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot);
282 if (pAnnotHandler->CanAnswer(pAnnot))
283 return pAnnotHandler->HitTest(pPageView, pAnnot, point);
284
tsepez4cf55152016-11-02 14:37:54 -0700285 return false;
jaepark98e10192016-08-15 10:51:11 -0700286}
287
288CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,
tsepez4cf55152016-11-02 14:37:54 -0700289 bool bNext) {
jaepark98e10192016-08-15 10:51:11 -0700290#ifdef PDF_ENABLE_XFA
291 CPDFSDK_PageView* pPageView = pSDKAnnot->GetPageView();
292 CPDFXFA_Page* pPage = pPageView->GetPDFXFAPage();
293 if (!pPage)
294 return nullptr;
295 if (pPage->GetPDFPage()) { // for pdf annots.
jaepark9ed91372016-08-26 16:16:10 -0700296 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(),
297 pSDKAnnot->GetAnnotSubtype());
jaepark98e10192016-08-15 10:51:11 -0700298 CPDFSDK_Annot* pNext =
299 bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot);
300 return pNext;
301 }
302 // for xfa annots
303 std::unique_ptr<IXFA_WidgetIterator> pWidgetIterator(
304 pPage->GetXFAPageView()->CreateWidgetIterator(
305 XFA_TRAVERSEWAY_Tranvalse, XFA_WidgetStatus_Visible |
306 XFA_WidgetStatus_Viewable |
307 XFA_WidgetStatus_Focused));
308 if (!pWidgetIterator)
309 return nullptr;
310 if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget())
311 pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget());
312 CXFA_FFWidget* hNextFocus =
313 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious();
314 if (!hNextFocus && pSDKAnnot)
315 hNextFocus = pWidgetIterator->MoveToFirst();
316
317 return pPageView->GetAnnotByXFAWidget(hNextFocus);
318#else // PDF_ENABLE_XFA
jaepark956553e2016-08-31 06:49:27 -0700319 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET);
jaepark98e10192016-08-15 10:51:11 -0700320 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot);
321#endif // PDF_ENABLE_XFA
322}