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/cpdfsdk_pageview.h" | 7 #include "fpdfsdk/cpdfsdk_pageview.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pPDFAnnot, this); | 504 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pPDFAnnot, this); |
505 if (!pAnnot) | 505 if (!pAnnot) |
506 continue; | 506 continue; |
507 m_fxAnnotArray.push_back(pAnnot); | 507 m_fxAnnotArray.push_back(pAnnot); |
508 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); | 508 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); |
509 } | 509 } |
510 | 510 |
511 SetLock(FALSE); | 511 SetLock(FALSE); |
512 } | 512 } |
513 | 513 |
514 void CPDFSDK_PageView::ClearFXAnnots() { | |
515 SetLock(TRUE); | |
516 if (m_pSDKDoc && GetFocusAnnot()) { | |
517 CPDFSDK_Annot::ObservedPtr pNull; | |
518 m_pSDKDoc->SetFocusAnnot(&pNull); | |
519 } | |
520 m_pCaptureWidget.Reset(); | |
521 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) | |
522 m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr()->ReleaseAnnot(pAnnot); | |
523 m_fxAnnotArray.clear(); | |
524 m_pAnnotList.reset(); | |
525 SetLock(FALSE); | |
526 } | |
527 | |
528 void CPDFSDK_PageView::UpdateRects(const std::vector<CFX_FloatRect>& rects) { | 514 void CPDFSDK_PageView::UpdateRects(const std::vector<CFX_FloatRect>& rects) { |
529 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); | 515 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
530 for (const auto& rc : rects) | 516 for (const auto& rc : rects) |
531 pEnv->Invalidate(m_page, rc.left, rc.top, rc.right, rc.bottom); | 517 pEnv->Invalidate(m_page, rc.left, rc.top, rc.right, rc.bottom); |
532 } | 518 } |
533 | 519 |
534 void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) { | 520 void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) { |
535 CFX_FloatRect rcWindow = pAnnot->GetRect(); | 521 CFX_FloatRect rcWindow = pAnnot->GetRect(); |
536 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); | 522 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
537 pEnv->Invalidate(m_page, rcWindow.left, rcWindow.top, rcWindow.right, | 523 pEnv->Invalidate(m_page, rcWindow.left, rcWindow.top, rcWindow.right, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 return pAnnot; | 568 return pAnnot; |
583 } | 569 } |
584 return nullptr; | 570 return nullptr; |
585 } | 571 } |
586 | 572 |
587 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { | 573 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { |
588 CPDF_Dictionary* pDict = GetPDFPage()->m_pFormDict; | 574 CPDF_Dictionary* pDict = GetPDFPage()->m_pFormDict; |
589 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); | 575 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); |
590 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; | 576 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; |
591 } | 577 } |
OLD | NEW |