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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 uint32_t dwFlags) { | 260 uint32_t dwFlags) { |
261 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 261 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
262 if (!pEnv) | 262 if (!pEnv) |
263 return; | 263 return; |
264 | 264 |
265 if (m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_LOADING || | 265 if (m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_LOADING || |
266 m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_CLOSING || | 266 m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_CLOSING || |
267 XFA_PAGEVIEWEVENT_StopLayout != dwFlags) | 267 XFA_PAGEVIEWEVENT_StopLayout != dwFlags) |
268 return; | 268 return; |
269 | 269 |
270 int nNewCount = m_pDocument->GetPageCount(); | 270 int nNewCount = m_pDocument->GetXFAPageCount(); |
271 if (nNewCount == m_pDocument->GetOriginalPageCount()) | 271 if (nNewCount == m_pDocument->GetOriginalPageCount()) |
272 return; | 272 return; |
273 | 273 |
274 CXFA_FFDocView* pXFADocView = m_pDocument->GetXFADocView(); | 274 CXFA_FFDocView* pXFADocView = m_pDocument->GetXFADocView(); |
275 if (!pXFADocView) | 275 if (!pXFADocView) |
276 return; | 276 return; |
277 | 277 |
278 for (int iPageIter = 0; iPageIter < m_pDocument->GetOriginalPageCount(); | 278 for (int iPageIter = 0; iPageIter < m_pDocument->GetOriginalPageCount(); |
279 iPageIter++) { | 279 iPageIter++) { |
280 CPDFXFA_Page* pPage = m_pDocument->GetXFAPageList()->GetAt(iPageIter); | 280 CPDFXFA_Page* pPage = m_pDocument->GetXFAPageList()->GetAt(iPageIter); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 return; | 323 return; |
324 | 324 |
325 CPDFSDK_PageView* pSdkPageView = | 325 CPDFSDK_PageView* pSdkPageView = |
326 m_pDocument->GetSDKDoc()->GetPageView(pXFAPage, true); | 326 m_pDocument->GetSDKDoc()->GetPageView(pXFAPage, true); |
327 if (CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget)) | 327 if (CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget)) |
328 pSdkPageView->DeleteAnnot(pAnnot); | 328 pSdkPageView->DeleteAnnot(pAnnot); |
329 } | 329 } |
330 | 330 |
331 int32_t CPDFXFA_DocEnvironment::CountPages(CXFA_FFDoc* hDoc) { | 331 int32_t CPDFXFA_DocEnvironment::CountPages(CXFA_FFDoc* hDoc) { |
332 if (hDoc == m_pDocument->GetXFADoc() && m_pDocument->GetSDKDoc()) | 332 if (hDoc == m_pDocument->GetXFADoc() && m_pDocument->GetSDKDoc()) |
333 return m_pDocument->GetPageCount(); | 333 return m_pDocument->GetXFAPageCount(); |
334 return 0; | 334 return 0; |
335 } | 335 } |
336 | 336 |
337 int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) { | 337 int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) { |
338 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) | 338 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) |
339 return -1; | 339 return -1; |
340 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) | 340 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) |
341 return -1; | 341 return -1; |
342 | 342 |
343 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 343 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 if (!m_pJSContext) { | 1012 if (!m_pJSContext) { |
1013 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument( | 1013 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument( |
1014 m_pDocument->GetSDKDoc()); | 1014 m_pDocument->GetSDKDoc()); |
1015 m_pJSContext = | 1015 m_pJSContext = |
1016 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext(); | 1016 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext(); |
1017 } | 1017 } |
1018 | 1018 |
1019 return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName( | 1019 return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName( |
1020 szPropName, pValue); | 1020 szPropName, pValue); |
1021 } | 1021 } |
OLD | NEW |