| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "fpdfsdk/include/fsdk_mgr.h" | 9 #include "fpdfsdk/include/fsdk_mgr.h" |
| 10 | 10 |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 return m_pFocusAnnot; | 523 return m_pFocusAnnot; |
| 524 } | 524 } |
| 525 | 525 |
| 526 FX_BOOL CPDFSDK_Document::SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { | 526 FX_BOOL CPDFSDK_Document::SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { |
| 527 if (m_bBeingDestroyed) | 527 if (m_bBeingDestroyed) |
| 528 return FALSE; | 528 return FALSE; |
| 529 | 529 |
| 530 if (m_pFocusAnnot == pAnnot) | 530 if (m_pFocusAnnot == pAnnot) |
| 531 return TRUE; | 531 return TRUE; |
| 532 | 532 |
| 533 CPDFSDK_Annot* pLastFocusAnnot = m_pFocusAnnot; | |
| 534 | |
| 535 if (m_pFocusAnnot) { | 533 if (m_pFocusAnnot) { |
| 536 if (!KillFocusAnnot(nFlag)) | 534 if (!KillFocusAnnot(nFlag)) |
| 537 return FALSE; | 535 return FALSE; |
| 538 } | 536 } |
| 539 CPDFSDK_PageView* pPageView = NULL; | 537 |
| 540 if (pAnnot) | 538 if (!pAnnot) |
| 541 pPageView = pAnnot->GetPageView(); | 539 return FALSE; |
| 542 if (pAnnot && pPageView->IsValid()) { | 540 |
| 541 CPDFSDK_Annot* pLastFocusAnnot = m_pFocusAnnot; |
| 542 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
| 543 if (pPageView && pPageView->IsValid()) { |
| 543 CPDFSDK_AnnotHandlerMgr* pAnnotHandler = m_pEnv->GetAnnotHandlerMgr(); | 544 CPDFSDK_AnnotHandlerMgr* pAnnotHandler = m_pEnv->GetAnnotHandlerMgr(); |
| 544 if (!m_pFocusAnnot) { | 545 if (!m_pFocusAnnot) { |
| 545 if (!pAnnotHandler->Annot_OnChangeFocus(pAnnot, pLastFocusAnnot)) | 546 if (!pAnnotHandler->Annot_OnChangeFocus(pAnnot, pLastFocusAnnot)) |
| 546 return FALSE; | 547 return FALSE; |
| 547 | 548 |
| 548 if (!pAnnotHandler->Annot_OnSetFocus(pAnnot, nFlag)) | 549 if (!pAnnotHandler->Annot_OnSetFocus(pAnnot, nFlag)) |
| 549 return FALSE; | 550 return FALSE; |
| 550 if (!m_pFocusAnnot) { | 551 if (!m_pFocusAnnot) { |
| 551 m_pFocusAnnot = pAnnot; | 552 m_pFocusAnnot = pAnnot; |
| 552 return TRUE; | 553 return TRUE; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 582 } | 583 } |
| 583 } | 584 } |
| 584 return FALSE; | 585 return FALSE; |
| 585 } | 586 } |
| 586 | 587 |
| 587 void CPDFSDK_Document::OnCloseDocument() { | 588 void CPDFSDK_Document::OnCloseDocument() { |
| 588 KillFocusAnnot(); | 589 KillFocusAnnot(); |
| 589 } | 590 } |
| 590 | 591 |
| 591 FX_BOOL CPDFSDK_Document::GetPermissions(int nFlag) { | 592 FX_BOOL CPDFSDK_Document::GetPermissions(int nFlag) { |
| 592 FX_DWORD dwPermissions = m_pDoc->GetPDFDoc()->GetUserPermissions(); | 593 return GetPDFDocument()->GetUserPermissions() & nFlag; |
| 593 return dwPermissions & nFlag; | |
| 594 } | 594 } |
| 595 | 595 |
| 596 IJS_Runtime* CPDFSDK_Document::GetJsRuntime() { | 596 IJS_Runtime* CPDFSDK_Document::GetJsRuntime() { |
| 597 ASSERT(m_pEnv != NULL); | 597 ASSERT(m_pEnv != NULL); |
| 598 return m_pEnv->GetJSRuntime(); | 598 return m_pEnv->GetJSRuntime(); |
| 599 } | 599 } |
| 600 | 600 |
| 601 CFX_WideString CPDFSDK_Document::GetPath() { | 601 CFX_WideString CPDFSDK_Document::GetPath() { |
| 602 ASSERT(m_pEnv != NULL); | 602 ASSERT(m_pEnv != NULL); |
| 603 return m_pEnv->JS_docGetFilePath(); | 603 return m_pEnv->JS_docGetFilePath(); |
| 604 } | 604 } |
| 605 | 605 |
| 606 CPDFSDK_PageView::CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc, | 606 CPDFSDK_PageView::CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc, |
| 607 CPDFXFA_Page* page) | 607 UnderlyingPageType* page) |
| 608 : m_page(page), | 608 : m_page(page), |
| 609 m_pSDKDoc(pSDKDoc), | 609 m_pSDKDoc(pSDKDoc), |
| 610 m_CaptureWidget(nullptr), | 610 m_CaptureWidget(nullptr), |
| 611 m_bEnterWidget(FALSE), | 611 m_bEnterWidget(FALSE), |
| 612 m_bExitWidget(FALSE), | 612 m_bExitWidget(FALSE), |
| 613 m_bOnWidget(FALSE), | 613 m_bOnWidget(FALSE), |
| 614 m_bValid(FALSE), | 614 m_bValid(FALSE), |
| 615 m_bLocked(FALSE) { | 615 m_bLocked(FALSE) { |
| 616 CPDFSDK_InterForm* pInterForm = pSDKDoc->GetInterForm(); | 616 CPDFSDK_InterForm* pInterForm = pSDKDoc->GetInterForm(); |
| 617 if (pInterForm) { | 617 if (pInterForm) { |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); | 1080 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); |
| 1081 if (!pFocusAnnot) | 1081 if (!pFocusAnnot) |
| 1082 return nullptr; | 1082 return nullptr; |
| 1083 | 1083 |
| 1084 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { | 1084 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { |
| 1085 if (pAnnot == pFocusAnnot) | 1085 if (pAnnot == pFocusAnnot) |
| 1086 return pAnnot; | 1086 return pAnnot; |
| 1087 } | 1087 } |
| 1088 return nullptr; | 1088 return nullptr; |
| 1089 } | 1089 } |
| OLD | NEW |