jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 1 | // 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 | |
| 7 | #include "fpdfsdk/include/cpdfsdk_annothandlermgr.h" |
| 8 | |
| 9 | #include "core/fpdfdoc/include/cpdf_annot.h" |
jaepark | 611adb8 | 2016-08-17 11:34:36 -0700 | [diff] [blame] | 10 | #include "fpdfsdk/include/cba_annotiterator.h" |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 11 | #include "fpdfsdk/include/cpdfsdk_annot.h" |
| 12 | #include "fpdfsdk/include/cpdfsdk_baannot.h" |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 13 | #include "fpdfsdk/include/cpdfsdk_baannothandler.h" |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 14 | #include "fpdfsdk/include/cpdfsdk_datetime.h" |
jaepark | 8c54182 | 2016-08-30 13:43:05 -0700 | [diff] [blame] | 15 | #include "fpdfsdk/include/cpdfsdk_widgethandler.h" |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 16 | #include "fpdfsdk/include/fsdk_mgr.h" |
| 17 | |
| 18 | #ifdef PDF_ENABLE_XFA |
jaepark | 8c54182 | 2016-08-30 13:43:05 -0700 | [diff] [blame] | 19 | #include "fpdfsdk/include/cpdfsdk_xfawidgethandler.h" |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 20 | #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" |
| 21 | #include "xfa/fxfa/include/xfa_ffpageview.h" |
| 22 | #include "xfa/fxfa/include/xfa_ffwidget.h" |
| 23 | #endif // PDF_ENABLE_XFA |
| 24 | |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 25 | CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp) |
| 26 | : m_pBAAnnotHandler(new CPDFSDK_BAAnnotHandler()), |
jaepark | 8c54182 | 2016-08-30 13:43:05 -0700 | [diff] [blame] | 27 | m_pWidgetHandler(new CPDFSDK_WidgetHandler(pApp)), |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 28 | #ifdef PDF_ENABLE_XFA |
jaepark | 8c54182 | 2016-08-30 13:43:05 -0700 | [diff] [blame] | 29 | m_pXFAWidgetHandler(new CPDFSDK_XFAWidgetHandler(pApp)), |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 30 | #endif // PDF_ENABLE_XFA |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 31 | m_pApp(pApp) { |
jaepark | 8c54182 | 2016-08-30 13:43:05 -0700 | [diff] [blame] | 32 | m_pWidgetHandler->SetFormFiller(m_pApp->GetIFormFiller()); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() {} |
| 36 | |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 37 | CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot, |
| 38 | CPDFSDK_PageView* pPageView) { |
| 39 | ASSERT(pPageView); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 40 | return GetAnnotHandler(pAnnot->GetSubtype())->NewAnnot(pAnnot, pPageView); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | #ifdef PDF_ENABLE_XFA |
| 44 | CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CXFA_FFWidget* pAnnot, |
| 45 | CPDFSDK_PageView* pPageView) { |
| 46 | ASSERT(pAnnot); |
| 47 | ASSERT(pPageView); |
| 48 | |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 49 | return GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)->NewAnnot(pAnnot, pPageView); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 50 | } |
| 51 | #endif // PDF_ENABLE_XFA |
| 52 | |
| 53 | void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 54 | IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot); |
| 55 | pAnnotHandler->OnRelease(pAnnot); |
| 56 | pAnnotHandler->ReleaseAnnot(pAnnot); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { |
| 60 | CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
| 61 | |
| 62 | CPDFSDK_DateTime curTime; |
| 63 | pPDFAnnot->GetAnnotDict()->SetAtString("M", curTime.ToPDFDateTimeString()); |
| 64 | pPDFAnnot->GetAnnotDict()->SetAtNumber("F", 0); |
| 65 | |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 66 | GetAnnotHandler(pAnnot)->OnCreate(pAnnot); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) { |
| 70 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 71 | GetAnnotHandler(pAnnot)->OnLoad(pAnnot); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( |
| 75 | CPDFSDK_Annot* pAnnot) const { |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 76 | return GetAnnotHandler(pAnnot->GetAnnotSubtype()); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( |
| 80 | const CFX_ByteString& sType) const { |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 81 | if (sType == "Widget") |
jaepark | 8c54182 | 2016-08-30 13:43:05 -0700 | [diff] [blame] | 82 | return m_pWidgetHandler.get(); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 83 | |
| 84 | #ifdef PDF_ENABLE_XFA |
| 85 | if (sType == FSDK_XFAWIDGET_TYPENAME) |
jaepark | 8c54182 | 2016-08-30 13:43:05 -0700 | [diff] [blame] | 86 | return m_pXFAWidgetHandler.get(); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 87 | #endif // PDF_ENABLE_XFA |
| 88 | |
| 89 | return m_pBAAnnotHandler.get(); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, |
| 93 | CPDFSDK_Annot* pAnnot, |
| 94 | CFX_RenderDevice* pDevice, |
| 95 | CFX_Matrix* pUser2Device, |
| 96 | uint32_t dwFlags) { |
| 97 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 98 | GetAnnotHandler(pAnnot)->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, |
| 99 | dwFlags); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown( |
| 103 | CPDFSDK_PageView* pPageView, |
| 104 | CPDFSDK_Annot* pAnnot, |
| 105 | uint32_t nFlags, |
| 106 | const CFX_FloatPoint& point) { |
| 107 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 108 | return GetAnnotHandler(pAnnot)->OnLButtonDown(pPageView, pAnnot, nFlags, |
| 109 | point); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp( |
| 113 | CPDFSDK_PageView* pPageView, |
| 114 | CPDFSDK_Annot* pAnnot, |
| 115 | uint32_t nFlags, |
| 116 | const CFX_FloatPoint& point) { |
| 117 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 118 | return GetAnnotHandler(pAnnot)->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk( |
| 122 | CPDFSDK_PageView* pPageView, |
| 123 | CPDFSDK_Annot* pAnnot, |
| 124 | uint32_t nFlags, |
| 125 | const CFX_FloatPoint& point) { |
| 126 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 127 | return GetAnnotHandler(pAnnot)->OnLButtonDblClk(pPageView, pAnnot, nFlags, |
| 128 | point); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove( |
| 132 | CPDFSDK_PageView* pPageView, |
| 133 | CPDFSDK_Annot* pAnnot, |
| 134 | uint32_t nFlags, |
| 135 | const CFX_FloatPoint& point) { |
| 136 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 137 | return GetAnnotHandler(pAnnot)->OnMouseMove(pPageView, pAnnot, nFlags, point); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel( |
| 141 | CPDFSDK_PageView* pPageView, |
| 142 | CPDFSDK_Annot* pAnnot, |
| 143 | uint32_t nFlags, |
| 144 | short zDelta, |
| 145 | const CFX_FloatPoint& point) { |
| 146 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 147 | return GetAnnotHandler(pAnnot)->OnMouseWheel(pPageView, pAnnot, nFlags, |
| 148 | zDelta, point); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown( |
| 152 | CPDFSDK_PageView* pPageView, |
| 153 | CPDFSDK_Annot* pAnnot, |
| 154 | uint32_t nFlags, |
| 155 | const CFX_FloatPoint& point) { |
| 156 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 157 | return GetAnnotHandler(pAnnot)->OnRButtonDown(pPageView, pAnnot, nFlags, |
| 158 | point); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp( |
| 162 | CPDFSDK_PageView* pPageView, |
| 163 | CPDFSDK_Annot* pAnnot, |
| 164 | uint32_t nFlags, |
| 165 | const CFX_FloatPoint& point) { |
| 166 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 167 | return GetAnnotHandler(pAnnot)->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView* pPageView, |
| 171 | CPDFSDK_Annot* pAnnot, |
| 172 | uint32_t nFlag) { |
| 173 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 174 | GetAnnotHandler(pAnnot)->OnMouseEnter(pPageView, pAnnot, nFlag); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView* pPageView, |
| 178 | CPDFSDK_Annot* pAnnot, |
| 179 | uint32_t nFlag) { |
| 180 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 181 | GetAnnotHandler(pAnnot)->OnMouseExit(pPageView, pAnnot, nFlag); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, |
| 185 | uint32_t nChar, |
| 186 | uint32_t nFlags) { |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 187 | return GetAnnotHandler(pAnnot)->OnChar(pAnnot, nChar, nFlags); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, |
| 191 | int nKeyCode, |
| 192 | int nFlag) { |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 193 | if (m_pApp->FFI_IsCTRLKeyDown(nFlag) || m_pApp->FFI_IsALTKeyDown(nFlag)) |
| 194 | return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 195 | |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 196 | CPDFSDK_PageView* pPage = pAnnot->GetPageView(); |
| 197 | CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); |
| 198 | if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) { |
| 199 | CPDFSDK_Annot* pNext = |
| 200 | GetNextAnnot(pFocusAnnot, !m_pApp->FFI_IsSHIFTKeyDown(nFlag)); |
| 201 | |
| 202 | if (pNext && pNext != pFocusAnnot) { |
| 203 | CPDFSDK_Document* pDocument = pPage->GetSDKDocument(); |
| 204 | pDocument->SetFocusAnnot(pNext); |
| 205 | return TRUE; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 206 | } |
| 207 | } |
| 208 | |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 209 | return FALSE; |
| 210 | } |
| 211 | |
| 212 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, |
| 213 | int nKeyCode, |
| 214 | int nFlag) { |
| 215 | return FALSE; |
| 216 | } |
| 217 | |
| 218 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, |
| 219 | uint32_t nFlag) { |
| 220 | ASSERT(pAnnot); |
| 221 | |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 222 | if (!GetAnnotHandler(pAnnot)->OnSetFocus(pAnnot, nFlag)) |
| 223 | return FALSE; |
| 224 | |
| 225 | CPDFSDK_PageView* pPage = pAnnot->GetPageView(); |
| 226 | pPage->GetSDKDocument(); |
| 227 | return TRUE; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, |
| 231 | uint32_t nFlag) { |
| 232 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 233 | return GetAnnotHandler(pAnnot)->OnKillFocus(pAnnot, nFlag); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | #ifdef PDF_ENABLE_XFA |
| 237 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus( |
| 238 | CPDFSDK_Annot* pSetAnnot, |
| 239 | CPDFSDK_Annot* pKillAnnot) { |
| 240 | FX_BOOL bXFA = (pSetAnnot && pSetAnnot->GetXFAWidget()) || |
| 241 | (pKillAnnot && pKillAnnot->GetXFAWidget()); |
| 242 | |
| 243 | if (bXFA) { |
| 244 | if (IPDFSDK_AnnotHandler* pXFAAnnotHandler = |
| 245 | GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)) |
| 246 | return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot); |
| 247 | } |
| 248 | |
| 249 | return TRUE; |
| 250 | } |
| 251 | #endif // PDF_ENABLE_XFA |
| 252 | |
| 253 | CFX_FloatRect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox( |
| 254 | CPDFSDK_PageView* pPageView, |
| 255 | CPDFSDK_Annot* pAnnot) { |
| 256 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 257 | return GetAnnotHandler(pAnnot)->GetViewBBox(pPageView, pAnnot); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView* pPageView, |
| 261 | CPDFSDK_Annot* pAnnot, |
| 262 | const CFX_FloatPoint& point) { |
| 263 | ASSERT(pAnnot); |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 264 | IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot); |
| 265 | if (pAnnotHandler->CanAnswer(pAnnot)) |
| 266 | return pAnnotHandler->HitTest(pPageView, pAnnot, point); |
| 267 | |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 268 | return FALSE; |
| 269 | } |
| 270 | |
| 271 | CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, |
| 272 | FX_BOOL bNext) { |
| 273 | #ifdef PDF_ENABLE_XFA |
| 274 | CPDFSDK_PageView* pPageView = pSDKAnnot->GetPageView(); |
| 275 | CPDFXFA_Page* pPage = pPageView->GetPDFXFAPage(); |
| 276 | if (!pPage) |
| 277 | return nullptr; |
| 278 | if (pPage->GetPDFPage()) { // for pdf annots. |
jaepark | 9ed9137 | 2016-08-26 16:16:10 -0700 | [diff] [blame] | 279 | CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), |
| 280 | pSDKAnnot->GetAnnotSubtype()); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 281 | CPDFSDK_Annot* pNext = |
| 282 | bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
| 283 | return pNext; |
| 284 | } |
| 285 | // for xfa annots |
| 286 | std::unique_ptr<IXFA_WidgetIterator> pWidgetIterator( |
| 287 | pPage->GetXFAPageView()->CreateWidgetIterator( |
| 288 | XFA_TRAVERSEWAY_Tranvalse, XFA_WidgetStatus_Visible | |
| 289 | XFA_WidgetStatus_Viewable | |
| 290 | XFA_WidgetStatus_Focused)); |
| 291 | if (!pWidgetIterator) |
| 292 | return nullptr; |
| 293 | if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget()) |
| 294 | pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget()); |
| 295 | CXFA_FFWidget* hNextFocus = |
| 296 | bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); |
| 297 | if (!hNextFocus && pSDKAnnot) |
| 298 | hNextFocus = pWidgetIterator->MoveToFirst(); |
| 299 | |
| 300 | return pPageView->GetAnnotByXFAWidget(hNextFocus); |
| 301 | #else // PDF_ENABLE_XFA |
jaepark | 9ed9137 | 2016-08-26 16:16:10 -0700 | [diff] [blame] | 302 | CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget"); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 303 | return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
| 304 | #endif // PDF_ENABLE_XFA |
| 305 | } |