| 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/fpdfxfa/include/cpdfxfa_docenvironment.h" | 7 #include "fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 m_pDocument->GetSDKDoc()->GetInterForm()->XfaSetValidationsEnabled( | 531 m_pDocument->GetSDKDoc()->GetInterForm()->XfaSetValidationsEnabled( |
| 532 bEnabled); | 532 bEnabled); |
| 533 } | 533 } |
| 534 | 534 |
| 535 void CPDFXFA_DocEnvironment::SetFocusWidget(CXFA_FFDoc* hDoc, | 535 void CPDFXFA_DocEnvironment::SetFocusWidget(CXFA_FFDoc* hDoc, |
| 536 CXFA_FFWidget* hWidget) { | 536 CXFA_FFWidget* hWidget) { |
| 537 if (hDoc != m_pDocument->GetXFADoc()) | 537 if (hDoc != m_pDocument->GetXFADoc()) |
| 538 return; | 538 return; |
| 539 | 539 |
| 540 if (!hWidget) { | 540 if (!hWidget) { |
| 541 m_pDocument->GetSDKDoc()->SetFocusAnnot(nullptr); | 541 CPDFSDK_Annot::ObservedPtr pNull; |
| 542 m_pDocument->GetSDKDoc()->SetFocusAnnot(&pNull); |
| 542 return; | 543 return; |
| 543 } | 544 } |
| 544 | 545 |
| 545 int pageViewCount = m_pDocument->GetSDKDoc()->GetPageViewCount(); | 546 int pageViewCount = m_pDocument->GetSDKDoc()->GetPageViewCount(); |
| 546 for (int i = 0; i < pageViewCount; i++) { | 547 for (int i = 0; i < pageViewCount; i++) { |
| 547 CPDFSDK_PageView* pPageView = m_pDocument->GetSDKDoc()->GetPageView(i); | 548 CPDFSDK_PageView* pPageView = m_pDocument->GetSDKDoc()->GetPageView(i); |
| 548 if (!pPageView) | 549 if (!pPageView) |
| 549 continue; | 550 continue; |
| 550 | 551 |
| 551 CPDFSDK_Annot* pAnnot = pPageView->GetAnnotByXFAWidget(hWidget); | 552 CPDFSDK_Annot::ObservedPtr pAnnot(pPageView->GetAnnotByXFAWidget(hWidget)); |
| 552 if (pAnnot) { | 553 if (pAnnot) { |
| 553 m_pDocument->GetSDKDoc()->SetFocusAnnot(pAnnot); | 554 m_pDocument->GetSDKDoc()->SetFocusAnnot(&pAnnot); |
| 554 break; | 555 break; |
| 555 } | 556 } |
| 556 } | 557 } |
| 557 } | 558 } |
| 558 | 559 |
| 559 void CPDFXFA_DocEnvironment::Print(CXFA_FFDoc* hDoc, | 560 void CPDFXFA_DocEnvironment::Print(CXFA_FFDoc* hDoc, |
| 560 int32_t nStartPage, | 561 int32_t nStartPage, |
| 561 int32_t nEndPage, | 562 int32_t nEndPage, |
| 562 uint32_t dwOptions) { | 563 uint32_t dwOptions) { |
| 563 if (hDoc != m_pDocument->GetXFADoc()) | 564 if (hDoc != m_pDocument->GetXFADoc()) |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 if (!m_pJSContext) { | 1011 if (!m_pJSContext) { |
| 1011 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument( | 1012 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument( |
| 1012 m_pDocument->GetSDKDoc()); | 1013 m_pDocument->GetSDKDoc()); |
| 1013 m_pJSContext = | 1014 m_pJSContext = |
| 1014 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext(); | 1015 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext(); |
| 1015 } | 1016 } |
| 1016 | 1017 |
| 1017 return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName( | 1018 return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName( |
| 1018 szPropName, pValue); | 1019 szPropName, pValue); |
| 1019 } | 1020 } |
| OLD | NEW |