OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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/fsdk_annothandler.h" | 7 #include "fpdfsdk/include/fsdk_annothandler.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 CPDFXFA_Page* pPage = pPageView->GetPDFXFAPage(); | 369 CPDFXFA_Page* pPage = pPageView->GetPDFXFAPage(); |
370 if (pPage == NULL) | 370 if (pPage == NULL) |
371 return NULL; | 371 return NULL; |
372 if (pPage->GetPDFPage()) { // for pdf annots. | 372 if (pPage->GetPDFPage()) { // for pdf annots. |
373 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), pSDKAnnot->GetType(), ""); | 373 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), pSDKAnnot->GetType(), ""); |
374 CPDFSDK_Annot* pNext = | 374 CPDFSDK_Annot* pNext = |
375 bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); | 375 bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
376 return pNext; | 376 return pNext; |
377 } | 377 } |
378 // for xfa annots | 378 // for xfa annots |
379 IXFA_WidgetIterator* pWidgetIterator = | 379 std::unique_ptr<IXFA_WidgetIterator> pWidgetIterator( |
380 pPage->GetXFAPageView()->CreateWidgetIterator( | 380 pPage->GetXFAPageView()->CreateWidgetIterator( |
381 XFA_TRAVERSEWAY_Tranvalse, XFA_WIDGETFILTER_Visible | | 381 XFA_TRAVERSEWAY_Tranvalse, XFA_WIDGETFILTER_Visible | |
382 XFA_WIDGETFILTER_Viewable | | 382 XFA_WIDGETFILTER_Viewable | |
383 XFA_WIDGETFILTER_Field); | 383 XFA_WIDGETFILTER_Field)); |
384 if (pWidgetIterator == NULL) | 384 if (!pWidgetIterator) |
385 return NULL; | 385 return nullptr; |
386 if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget()) | 386 if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget()) |
387 pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget()); | 387 pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget()); |
388 CXFA_FFWidget* hNextFocus = NULL; | 388 CXFA_FFWidget* hNextFocus = |
389 hNextFocus = | |
390 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); | 389 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); |
391 if (!hNextFocus && pSDKAnnot) | 390 if (!hNextFocus && pSDKAnnot) |
392 hNextFocus = pWidgetIterator->MoveToFirst(); | 391 hNextFocus = pWidgetIterator->MoveToFirst(); |
393 | 392 |
394 pWidgetIterator->Release(); | |
395 return pPageView->GetAnnotByXFAWidget(hNextFocus); | 393 return pPageView->GetAnnotByXFAWidget(hNextFocus); |
396 #else // PDF_ENABLE_XFA | 394 #else // PDF_ENABLE_XFA |
397 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", ""); | 395 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", ""); |
398 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); | 396 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
399 #endif // PDF_ENABLE_XFA | 397 #endif // PDF_ENABLE_XFA |
400 } | 398 } |
401 | 399 |
402 FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { | 400 FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { |
403 ASSERT(pAnnot->GetType() == "Widget"); | 401 ASSERT(pAnnot->GetType() == "Widget"); |
404 if (pAnnot->GetSubType() == BFFT_SIGNATURE) | 402 if (pAnnot->GetSubType() == BFFT_SIGNATURE) |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 | 1091 |
1094 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { | 1092 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { |
1095 if (m_pos < m_iteratorAnnotList.size()) | 1093 if (m_pos < m_iteratorAnnotList.size()) |
1096 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; | 1094 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; |
1097 return nullptr; | 1095 return nullptr; |
1098 } | 1096 } |
1099 | 1097 |
1100 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { | 1098 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { |
1101 return m_bReverse ? PrevAnnot() : NextAnnot(); | 1099 return m_bReverse ? PrevAnnot() : NextAnnot(); |
1102 } | 1100 } |
OLD | NEW |