| 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/cpdfxfa_docenvironment.h" | 7 #include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/parser/cpdf_array.h" | 9 #include "core/fpdfapi/parser/cpdf_array.h" |
| 10 #include "core/fpdfapi/parser/cpdf_stream_acc.h" | 10 #include "core/fpdfapi/parser/cpdf_stream_acc.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 ASSERT(m_pDocument); | 39 ASSERT(m_pDocument); |
| 40 } | 40 } |
| 41 | 41 |
| 42 CPDFXFA_DocEnvironment::~CPDFXFA_DocEnvironment() { | 42 CPDFXFA_DocEnvironment::~CPDFXFA_DocEnvironment() { |
| 43 if (m_pJSContext && m_pDocument->GetFormFillEnv()) | 43 if (m_pJSContext && m_pDocument->GetFormFillEnv()) |
| 44 m_pDocument->GetFormFillEnv()->GetJSRuntime()->ReleaseContext(m_pJSContext); | 44 m_pDocument->GetFormFillEnv()->GetJSRuntime()->ReleaseContext(m_pJSContext); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void CPDFXFA_DocEnvironment::SetChangeMark(CXFA_FFDoc* hDoc) { | 47 void CPDFXFA_DocEnvironment::SetChangeMark(CXFA_FFDoc* hDoc) { |
| 48 if (hDoc == m_pDocument->GetXFADoc() && m_pDocument->GetFormFillEnv()) | 48 if (hDoc == m_pDocument->GetXFADoc() && m_pDocument->GetFormFillEnv()) |
| 49 m_pDocument->GetFormFillEnv()->GetSDKDocument()->SetChangeMark(); | 49 m_pDocument->GetFormFillEnv()->SetChangeMark(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView, | 52 void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView, |
| 53 const CFX_RectF& rt, | 53 const CFX_RectF& rt, |
| 54 uint32_t dwFlags /* = 0 */) { | 54 uint32_t dwFlags /* = 0 */) { |
| 55 if (!m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) | 55 if (!m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) |
| 56 return; | 56 return; |
| 57 | 57 |
| 58 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) | 58 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) |
| 59 return; | 59 return; |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 CXFA_FFDocView* pXFADocView = m_pDocument->GetXFADocView(); | 271 CXFA_FFDocView* pXFADocView = m_pDocument->GetXFADocView(); |
| 272 if (!pXFADocView) | 272 if (!pXFADocView) |
| 273 return; | 273 return; |
| 274 | 274 |
| 275 for (int iPageIter = 0; iPageIter < m_pDocument->GetOriginalPageCount(); | 275 for (int iPageIter = 0; iPageIter < m_pDocument->GetOriginalPageCount(); |
| 276 iPageIter++) { | 276 iPageIter++) { |
| 277 CPDFXFA_Page* pPage = m_pDocument->GetXFAPageList()->GetAt(iPageIter); | 277 CPDFXFA_Page* pPage = m_pDocument->GetXFAPageList()->GetAt(iPageIter); |
| 278 if (!pPage) | 278 if (!pPage) |
| 279 continue; | 279 continue; |
| 280 | 280 |
| 281 m_pDocument->GetFormFillEnv()->GetSDKDocument()->RemovePageView(pPage); | 281 m_pDocument->GetFormFillEnv()->RemovePageView(pPage); |
| 282 pPage->SetXFAPageView(pXFADocView->GetPageView(iPageIter)); | 282 pPage->SetXFAPageView(pXFADocView->GetPageView(iPageIter)); |
| 283 } | 283 } |
| 284 | 284 |
| 285 int flag = (nNewCount < m_pDocument->GetOriginalPageCount()) | 285 int flag = (nNewCount < m_pDocument->GetOriginalPageCount()) |
| 286 ? FXFA_PAGEVIEWEVENT_POSTREMOVED | 286 ? FXFA_PAGEVIEWEVENT_POSTREMOVED |
| 287 : FXFA_PAGEVIEWEVENT_POSTADDED; | 287 : FXFA_PAGEVIEWEVENT_POSTADDED; |
| 288 int count = FXSYS_abs(nNewCount - m_pDocument->GetOriginalPageCount()); | 288 int count = FXSYS_abs(nNewCount - m_pDocument->GetOriginalPageCount()); |
| 289 m_pDocument->SetOriginalPageCount(nNewCount); | 289 m_pDocument->SetOriginalPageCount(nNewCount); |
| 290 pFormFillEnv->PageEvent(count, flag); | 290 pFormFillEnv->PageEvent(count, flag); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void CPDFXFA_DocEnvironment::WidgetPostAdd(CXFA_FFWidget* hWidget, | 293 void CPDFXFA_DocEnvironment::WidgetPostAdd(CXFA_FFWidget* hWidget, |
| 294 CXFA_WidgetAcc* pWidgetData) { | 294 CXFA_WidgetAcc* pWidgetData) { |
| 295 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget) | 295 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget) |
| 296 return; | 296 return; |
| 297 | 297 |
| 298 CXFA_FFPageView* pPageView = hWidget->GetPageView(); | 298 CXFA_FFPageView* pPageView = hWidget->GetPageView(); |
| 299 if (!pPageView) | 299 if (!pPageView) |
| 300 return; | 300 return; |
| 301 | 301 |
| 302 CPDFXFA_Page* pXFAPage = m_pDocument->GetXFAPage(pPageView); | 302 CPDFXFA_Page* pXFAPage = m_pDocument->GetXFAPage(pPageView); |
| 303 if (!pXFAPage) | 303 if (!pXFAPage) |
| 304 return; | 304 return; |
| 305 | 305 |
| 306 m_pDocument->GetFormFillEnv() | 306 m_pDocument->GetFormFillEnv() |
| 307 ->GetSDKDocument() | |
| 308 ->GetPageView(pXFAPage, true) | 307 ->GetPageView(pXFAPage, true) |
| 309 ->AddAnnot(hWidget); | 308 ->AddAnnot(hWidget); |
| 310 } | 309 } |
| 311 | 310 |
| 312 void CPDFXFA_DocEnvironment::WidgetPreRemove(CXFA_FFWidget* hWidget, | 311 void CPDFXFA_DocEnvironment::WidgetPreRemove(CXFA_FFWidget* hWidget, |
| 313 CXFA_WidgetAcc* pWidgetData) { | 312 CXFA_WidgetAcc* pWidgetData) { |
| 314 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget) | 313 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget) |
| 315 return; | 314 return; |
| 316 | 315 |
| 317 CXFA_FFPageView* pPageView = hWidget->GetPageView(); | 316 CXFA_FFPageView* pPageView = hWidget->GetPageView(); |
| 318 if (!pPageView) | 317 if (!pPageView) |
| 319 return; | 318 return; |
| 320 | 319 |
| 321 CPDFXFA_Page* pXFAPage = m_pDocument->GetXFAPage(pPageView); | 320 CPDFXFA_Page* pXFAPage = m_pDocument->GetXFAPage(pPageView); |
| 322 if (!pXFAPage) | 321 if (!pXFAPage) |
| 323 return; | 322 return; |
| 324 | 323 |
| 325 CPDFSDK_PageView* pSdkPageView = | 324 CPDFSDK_PageView* pSdkPageView = |
| 326 m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetPageView(pXFAPage, | 325 m_pDocument->GetFormFillEnv()->GetPageView(pXFAPage, true); |
| 327 true); | |
| 328 if (CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget)) | 326 if (CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget)) |
| 329 pSdkPageView->DeleteAnnot(pAnnot); | 327 pSdkPageView->DeleteAnnot(pAnnot); |
| 330 } | 328 } |
| 331 | 329 |
| 332 int32_t CPDFXFA_DocEnvironment::CountPages(CXFA_FFDoc* hDoc) { | 330 int32_t CPDFXFA_DocEnvironment::CountPages(CXFA_FFDoc* hDoc) { |
| 333 if (hDoc == m_pDocument->GetXFADoc() && m_pDocument->GetFormFillEnv()) | 331 if (hDoc == m_pDocument->GetXFADoc() && m_pDocument->GetFormFillEnv()) |
| 334 return m_pDocument->GetPageCount(); | 332 return m_pDocument->GetPageCount(); |
| 335 return 0; | 333 return 0; |
| 336 } | 334 } |
| 337 | 335 |
| 338 int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) { | 336 int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) { |
| 339 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) | 337 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) |
| 340 return -1; | 338 return -1; |
| 341 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) | 339 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) |
| 342 return -1; | 340 return -1; |
| 343 | 341 |
| 344 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv(); | 342 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv(); |
| 345 if (!pFormFillEnv) | 343 if (!pFormFillEnv) |
| 346 return -1; | 344 return -1; |
| 347 | 345 |
| 348 return pFormFillEnv->GetCurrentPageIndex(this); | 346 return pFormFillEnv->GetCurrentPageIndex(this); |
| 349 } | 347 } |
| 350 | 348 |
| 351 void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc, | 349 void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc, |
| 352 int32_t iCurPage) { | 350 int32_t iCurPage) { |
| 353 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv() || | 351 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv() || |
| 354 m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || iCurPage < 0 || | 352 m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || iCurPage < 0 || |
| 355 iCurPage >= | 353 iCurPage >= m_pDocument->GetFormFillEnv()->GetPageCount()) { |
| 356 m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetPageCount()) { | |
| 357 return; | 354 return; |
| 358 } | 355 } |
| 359 | 356 |
| 360 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv(); | 357 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv(); |
| 361 if (!pFormFillEnv) | 358 if (!pFormFillEnv) |
| 362 return; | 359 return; |
| 363 pFormFillEnv->SetCurrentPage(this, iCurPage); | 360 pFormFillEnv->SetCurrentPage(this, iCurPage); |
| 364 } | 361 } |
| 365 | 362 |
| 366 FX_BOOL CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { | 363 FX_BOOL CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { |
| 367 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) | 364 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) |
| 368 return FALSE; | 365 return FALSE; |
| 369 if (m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetInterForm()) | 366 if (m_pDocument->GetFormFillEnv()->GetInterForm()) { |
| 370 return m_pDocument->GetFormFillEnv() | 367 return m_pDocument->GetFormFillEnv() |
| 371 ->GetSDKDocument() | |
| 372 ->GetInterForm() | 368 ->GetInterForm() |
| 373 ->IsXfaCalculateEnabled(); | 369 ->IsXfaCalculateEnabled(); |
| 370 } |
| 374 return FALSE; | 371 return FALSE; |
| 375 } | 372 } |
| 376 | 373 |
| 377 void CPDFXFA_DocEnvironment::SetCalculationsEnabled(CXFA_FFDoc* hDoc, | 374 void CPDFXFA_DocEnvironment::SetCalculationsEnabled(CXFA_FFDoc* hDoc, |
| 378 FX_BOOL bEnabled) { | 375 FX_BOOL bEnabled) { |
| 379 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) | 376 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) |
| 380 return; | 377 return; |
| 381 if (m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetInterForm()) | 378 if (m_pDocument->GetFormFillEnv()->GetInterForm()) { |
| 382 m_pDocument->GetFormFillEnv() | 379 m_pDocument->GetFormFillEnv() |
| 383 ->GetSDKDocument() | |
| 384 ->GetInterForm() | 380 ->GetInterForm() |
| 385 ->XfaEnableCalculate(bEnabled); | 381 ->XfaEnableCalculate(bEnabled); |
| 382 } |
| 386 } | 383 } |
| 387 | 384 |
| 388 void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc, | 385 void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc, |
| 389 CFX_WideString& wsTitle) { | 386 CFX_WideString& wsTitle) { |
| 390 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetPDFDoc()) | 387 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetPDFDoc()) |
| 391 return; | 388 return; |
| 392 | 389 |
| 393 CPDF_Dictionary* pInfoDict = m_pDocument->GetPDFDoc()->GetInfo(); | 390 CPDF_Dictionary* pInfoDict = m_pDocument->GetPDFDoc()->GetInfo(); |
| 394 if (!pInfoDict) | 391 if (!pInfoDict) |
| 395 return; | 392 return; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 408 pInfoDict->SetFor("Title", new CPDF_String(wsTitle)); | 405 pInfoDict->SetFor("Title", new CPDF_String(wsTitle)); |
| 409 } | 406 } |
| 410 | 407 |
| 411 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, | 408 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, |
| 412 const CFX_WideString& wsFilePath, | 409 const CFX_WideString& wsFilePath, |
| 413 FX_BOOL bXDP) { | 410 FX_BOOL bXDP) { |
| 414 if (hDoc != m_pDocument->GetXFADoc()) | 411 if (hDoc != m_pDocument->GetXFADoc()) |
| 415 return; | 412 return; |
| 416 | 413 |
| 417 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA && | 414 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA && |
| 418 m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA) | 415 m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA) { |
| 419 return; | 416 return; |
| 417 } |
| 420 | 418 |
| 421 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv(); | 419 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv(); |
| 422 if (!pFormFillEnv) | 420 if (!pFormFillEnv) |
| 423 return; | 421 return; |
| 424 | 422 |
| 425 int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML; | 423 int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML; |
| 426 CFX_ByteString bs = wsFilePath.UTF16LE_Encode(); | 424 CFX_ByteString bs = wsFilePath.UTF16LE_Encode(); |
| 427 if (wsFilePath.IsEmpty()) { | 425 if (wsFilePath.IsEmpty()) { |
| 428 if (!pFormFillEnv->GetFormFillInfo() || | 426 if (!pFormFillEnv->GetFormFillInfo() || |
| 429 !pFormFillEnv->GetFormFillInfo()->m_pJsPlatform) | 427 !pFormFillEnv->GetFormFillInfo()->m_pJsPlatform) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 if (!pFormFillEnv) | 518 if (!pFormFillEnv) |
| 521 return; | 519 return; |
| 522 | 520 |
| 523 CFX_WideStringC str(bsURL.c_str()); | 521 CFX_WideStringC str(bsURL.c_str()); |
| 524 pFormFillEnv->GotoURL(this, str); | 522 pFormFillEnv->GotoURL(this, str); |
| 525 } | 523 } |
| 526 | 524 |
| 527 FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) { | 525 FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) { |
| 528 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) | 526 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) |
| 529 return FALSE; | 527 return FALSE; |
| 530 if (m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetInterForm()) | 528 if (m_pDocument->GetFormFillEnv()->GetInterForm()) { |
| 531 return m_pDocument->GetFormFillEnv() | 529 return m_pDocument->GetFormFillEnv() |
| 532 ->GetSDKDocument() | |
| 533 ->GetInterForm() | 530 ->GetInterForm() |
| 534 ->IsXfaValidationsEnabled(); | 531 ->IsXfaValidationsEnabled(); |
| 532 } |
| 535 return TRUE; | 533 return TRUE; |
| 536 } | 534 } |
| 537 | 535 |
| 538 void CPDFXFA_DocEnvironment::SetValidationsEnabled(CXFA_FFDoc* hDoc, | 536 void CPDFXFA_DocEnvironment::SetValidationsEnabled(CXFA_FFDoc* hDoc, |
| 539 FX_BOOL bEnabled) { | 537 FX_BOOL bEnabled) { |
| 540 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) | 538 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) |
| 541 return; | 539 return; |
| 542 if (m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetInterForm()) | 540 if (m_pDocument->GetFormFillEnv()->GetInterForm()) { |
| 543 m_pDocument->GetFormFillEnv() | 541 m_pDocument->GetFormFillEnv() |
| 544 ->GetSDKDocument() | |
| 545 ->GetInterForm() | 542 ->GetInterForm() |
| 546 ->XfaSetValidationsEnabled(bEnabled); | 543 ->XfaSetValidationsEnabled(bEnabled); |
| 544 } |
| 547 } | 545 } |
| 548 | 546 |
| 549 void CPDFXFA_DocEnvironment::SetFocusWidget(CXFA_FFDoc* hDoc, | 547 void CPDFXFA_DocEnvironment::SetFocusWidget(CXFA_FFDoc* hDoc, |
| 550 CXFA_FFWidget* hWidget) { | 548 CXFA_FFWidget* hWidget) { |
| 551 if (hDoc != m_pDocument->GetXFADoc()) | 549 if (hDoc != m_pDocument->GetXFADoc()) |
| 552 return; | 550 return; |
| 553 | 551 |
| 554 if (!hWidget) { | 552 if (!hWidget) { |
| 555 CPDFSDK_Annot::ObservedPtr pNull; | 553 CPDFSDK_Annot::ObservedPtr pNull; |
| 556 m_pDocument->GetFormFillEnv()->GetSDKDocument()->SetFocusAnnot(&pNull); | 554 m_pDocument->GetFormFillEnv()->SetFocusAnnot(&pNull); |
| 557 return; | 555 return; |
| 558 } | 556 } |
| 559 | 557 |
| 560 int pageViewCount = | 558 int pageViewCount = m_pDocument->GetFormFillEnv()->GetPageViewCount(); |
| 561 m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetPageViewCount(); | |
| 562 for (int i = 0; i < pageViewCount; i++) { | 559 for (int i = 0; i < pageViewCount; i++) { |
| 563 CPDFSDK_PageView* pPageView = | 560 CPDFSDK_PageView* pPageView = m_pDocument->GetFormFillEnv()->GetPageView(i); |
| 564 m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetPageView(i); | |
| 565 if (!pPageView) | 561 if (!pPageView) |
| 566 continue; | 562 continue; |
| 567 | 563 |
| 568 CPDFSDK_Annot::ObservedPtr pAnnot(pPageView->GetAnnotByXFAWidget(hWidget)); | 564 CPDFSDK_Annot::ObservedPtr pAnnot(pPageView->GetAnnotByXFAWidget(hWidget)); |
| 569 if (pAnnot) { | 565 if (pAnnot) { |
| 570 m_pDocument->GetFormFillEnv()->GetSDKDocument()->SetFocusAnnot(&pAnnot); | 566 m_pDocument->GetFormFillEnv()->SetFocusAnnot(&pAnnot); |
| 571 break; | 567 break; |
| 572 } | 568 } |
| 573 } | 569 } |
| 574 } | 570 } |
| 575 | 571 |
| 576 void CPDFXFA_DocEnvironment::Print(CXFA_FFDoc* hDoc, | 572 void CPDFXFA_DocEnvironment::Print(CXFA_FFDoc* hDoc, |
| 577 int32_t nStartPage, | 573 int32_t nStartPage, |
| 578 int32_t nEndPage, | 574 int32_t nEndPage, |
| 579 uint32_t dwOptions) { | 575 uint32_t dwOptions) { |
| 580 if (hDoc != m_pDocument->GetXFADoc()) | 576 if (hDoc != m_pDocument->GetXFADoc()) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 592 dwOptions & XFA_PRINTOPT_ShowDialog, nStartPage, nEndPage, | 588 dwOptions & XFA_PRINTOPT_ShowDialog, nStartPage, nEndPage, |
| 593 dwOptions & XFA_PRINTOPT_CanCancel, dwOptions & XFA_PRINTOPT_ShrinkPage, | 589 dwOptions & XFA_PRINTOPT_CanCancel, dwOptions & XFA_PRINTOPT_ShrinkPage, |
| 594 dwOptions & XFA_PRINTOPT_AsImage, dwOptions & XFA_PRINTOPT_ReverseOrder, | 590 dwOptions & XFA_PRINTOPT_AsImage, dwOptions & XFA_PRINTOPT_ReverseOrder, |
| 595 dwOptions & XFA_PRINTOPT_PrintAnnot); | 591 dwOptions & XFA_PRINTOPT_PrintAnnot); |
| 596 } | 592 } |
| 597 | 593 |
| 598 FX_ARGB CPDFXFA_DocEnvironment::GetHighlightColor(CXFA_FFDoc* hDoc) { | 594 FX_ARGB CPDFXFA_DocEnvironment::GetHighlightColor(CXFA_FFDoc* hDoc) { |
| 599 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) | 595 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetFormFillEnv()) |
| 600 return 0; | 596 return 0; |
| 601 | 597 |
| 602 CPDFSDK_InterForm* pInterForm = | 598 CPDFSDK_InterForm* pInterForm = m_pDocument->GetFormFillEnv()->GetInterForm(); |
| 603 m_pDocument->GetFormFillEnv()->GetSDKDocument()->GetInterForm(); | |
| 604 if (!pInterForm) | 599 if (!pInterForm) |
| 605 return 0; | 600 return 0; |
| 606 | 601 |
| 607 return ArgbEncode(pInterForm->GetHighlightAlpha(), | 602 return ArgbEncode(pInterForm->GetHighlightAlpha(), |
| 608 pInterForm->GetHighlightColor(FPDF_FORMFIELD_XFA)); | 603 pInterForm->GetHighlightColor(FPDF_FORMFIELD_XFA)); |
| 609 } | 604 } |
| 610 | 605 |
| 611 FX_BOOL CPDFXFA_DocEnvironment::NotifySubmit(FX_BOOL bPrevOrPost) { | 606 FX_BOOL CPDFXFA_DocEnvironment::NotifySubmit(FX_BOOL bPrevOrPost) { |
| 612 if (bPrevOrPost) | 607 if (bPrevOrPost) |
| 613 return OnBeforeNotifySubmit(); | 608 return OnBeforeNotifySubmit(); |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 if (!m_pDocument->GetFormFillEnv() || | 1021 if (!m_pDocument->GetFormFillEnv() || |
| 1027 !m_pDocument->GetFormFillEnv()->GetJSRuntime()) | 1022 !m_pDocument->GetFormFillEnv()->GetJSRuntime()) |
| 1028 return FALSE; | 1023 return FALSE; |
| 1029 | 1024 |
| 1030 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv(); | 1025 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv(); |
| 1031 if (!m_pJSContext) | 1026 if (!m_pJSContext) |
| 1032 m_pJSContext = pFormFillEnv->GetJSRuntime()->NewContext(); | 1027 m_pJSContext = pFormFillEnv->GetJSRuntime()->NewContext(); |
| 1033 | 1028 |
| 1034 return pFormFillEnv->GetJSRuntime()->GetValueByName(szPropName, pValue); | 1029 return pFormFillEnv->GetJSRuntime()->GetValueByName(szPropName, pValue); |
| 1035 } | 1030 } |
| OLD | NEW |