| 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 std::unique_ptr<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_WidgetStatus_Visible | |
| 382 XFA_WIDGETFILTER_Viewable | | 382 XFA_WidgetStatus_Viewable | |
| 383 XFA_WIDGETFILTER_Field)); | 383 XFA_WidgetStatus_Focused)); |
| 384 if (!pWidgetIterator) | 384 if (!pWidgetIterator) |
| 385 return nullptr; | 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 = | 388 CXFA_FFWidget* hNextFocus = |
| 389 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); | 389 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); |
| 390 if (!hNextFocus && pSDKAnnot) | 390 if (!hNextFocus && pSDKAnnot) |
| 391 hNextFocus = pWidgetIterator->MoveToFirst(); | 391 hNextFocus = pWidgetIterator->MoveToFirst(); |
| 392 | 392 |
| 393 return pPageView->GetAnnotByXFAWidget(hNextFocus); | 393 return pPageView->GetAnnotByXFAWidget(hNextFocus); |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 delete pWidget; | 773 delete pWidget; |
| 774 } | 774 } |
| 775 | 775 |
| 776 CFX_FloatRect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, | 776 CFX_FloatRect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, |
| 777 CPDFSDK_Annot* pAnnot) { | 777 CPDFSDK_Annot* pAnnot) { |
| 778 ASSERT(pAnnot); | 778 ASSERT(pAnnot); |
| 779 | 779 |
| 780 CFX_RectF rcBBox; | 780 CFX_RectF rcBBox; |
| 781 XFA_ELEMENT eType = pAnnot->GetXFAWidget()->GetDataAcc()->GetUIType(); | 781 XFA_ELEMENT eType = pAnnot->GetXFAWidget()->GetDataAcc()->GetUIType(); |
| 782 if (eType == XFA_ELEMENT_Signature) | 782 if (eType == XFA_ELEMENT_Signature) |
| 783 pAnnot->GetXFAWidget()->GetBBox(rcBBox, XFA_WIDGETSTATUS_Visible, TRUE); | 783 pAnnot->GetXFAWidget()->GetBBox(rcBBox, XFA_WidgetStatus_Visible, TRUE); |
| 784 else | 784 else |
| 785 pAnnot->GetXFAWidget()->GetBBox(rcBBox, 0); | 785 pAnnot->GetXFAWidget()->GetBBox(rcBBox, XFA_WidgetStatus_None); |
| 786 | 786 |
| 787 CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, | 787 CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, |
| 788 rcBBox.top + rcBBox.height); | 788 rcBBox.top + rcBBox.height); |
| 789 rcWidget.left -= 1.0f; | 789 rcWidget.left -= 1.0f; |
| 790 rcWidget.right += 1.0f; | 790 rcWidget.right += 1.0f; |
| 791 rcWidget.bottom -= 1.0f; | 791 rcWidget.bottom -= 1.0f; |
| 792 rcWidget.top += 1.0f; | 792 rcWidget.top += 1.0f; |
| 793 | 793 |
| 794 return rcWidget; | 794 return rcWidget; |
| 795 } | 795 } |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 | 1091 |
| 1092 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { | 1092 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { |
| 1093 if (m_pos < m_iteratorAnnotList.size()) | 1093 if (m_pos < m_iteratorAnnotList.size()) |
| 1094 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; | 1094 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; |
| 1095 return nullptr; | 1095 return nullptr; |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { | 1098 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { |
| 1099 return m_bReverse ? PrevAnnot() : NextAnnot(); | 1099 return m_bReverse ? PrevAnnot() : NextAnnot(); |
| 1100 } | 1100 } |
| OLD | NEW |