| 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" |
| 11 #include "core/fpdfapi/parser/cpdf_string.h" | 11 #include "core/fpdfapi/parser/cpdf_string.h" |
| 12 #include "fpdfsdk/cpdfsdk_document.h" | 12 #include "fpdfsdk/cpdfsdk_document.h" |
| 13 #include "fpdfsdk/cpdfsdk_environment.h" | 13 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
| 14 #include "fpdfsdk/cpdfsdk_interform.h" | 14 #include "fpdfsdk/cpdfsdk_interform.h" |
| 15 #include "fpdfsdk/cpdfsdk_pageview.h" | 15 #include "fpdfsdk/cpdfsdk_pageview.h" |
| 16 #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" | 16 #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" |
| 17 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" | 17 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" |
| 18 #include "fpdfsdk/javascript/ijs_runtime.h" | 18 #include "fpdfsdk/javascript/ijs_runtime.h" |
| 19 #include "xfa/fxfa/xfa_ffdocview.h" | 19 #include "xfa/fxfa/xfa_ffdocview.h" |
| 20 #include "xfa/fxfa/xfa_ffwidget.h" | 20 #include "xfa/fxfa/xfa_ffwidget.h" |
| 21 #include "xfa/fxfa/xfa_ffwidgethandler.h" | 21 #include "xfa/fxfa/xfa_ffwidgethandler.h" |
| 22 | 22 |
| 23 #define IDS_XFA_Validate_Input \ | 23 #define IDS_XFA_Validate_Input \ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 if (!m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) | 58 if (!m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) |
| 59 return; | 59 return; |
| 60 | 60 |
| 61 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) | 61 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) |
| 62 return; | 62 return; |
| 63 | 63 |
| 64 CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pPageView); | 64 CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pPageView); |
| 65 if (!pPage) | 65 if (!pPage) |
| 66 return; | 66 return; |
| 67 | 67 |
| 68 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 68 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
| 69 if (!pEnv) | 69 if (!pEnv) |
| 70 return; | 70 return; |
| 71 | 71 |
| 72 CFX_FloatRect rcPage = CFX_FloatRect::FromCFXRectF(rt); | 72 CFX_FloatRect rcPage = CFX_FloatRect::FromCFXRectF(rt); |
| 73 pEnv->Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, rcPage.right, | 73 pEnv->Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, rcPage.right, |
| 74 rcPage.top); | 74 rcPage.top); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget, | 77 void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget, |
| 78 FX_BOOL bVisible, | 78 FX_BOOL bVisible, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 90 return; | 90 return; |
| 91 | 91 |
| 92 CXFA_FFPageView* pPageView = hWidget->GetPageView(); | 92 CXFA_FFPageView* pPageView = hWidget->GetPageView(); |
| 93 if (!pPageView) | 93 if (!pPageView) |
| 94 return; | 94 return; |
| 95 | 95 |
| 96 CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pPageView); | 96 CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pPageView); |
| 97 if (!pPage) | 97 if (!pPage) |
| 98 return; | 98 return; |
| 99 | 99 |
| 100 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 100 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
| 101 if (!pEnv) | 101 if (!pEnv) |
| 102 return; | 102 return; |
| 103 | 103 |
| 104 CFX_FloatRect rcCaret = CFX_FloatRect::FromCFXRectF(*pRtAnchor); | 104 CFX_FloatRect rcCaret = CFX_FloatRect::FromCFXRectF(*pRtAnchor); |
| 105 pEnv->DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left, rcCaret.top, | 105 pEnv->DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left, rcCaret.top, |
| 106 rcCaret.right, rcCaret.bottom); | 106 rcCaret.right, rcCaret.bottom); |
| 107 } | 107 } |
| 108 | 108 |
| 109 FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget, | 109 FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget, |
| 110 FX_FLOAT fMinPopup, | 110 FX_FLOAT fMinPopup, |
| 111 FX_FLOAT fMaxPopup, | 111 FX_FLOAT fMaxPopup, |
| 112 const CFX_RectF& rtAnchor, | 112 const CFX_RectF& rtAnchor, |
| 113 CFX_RectF& rtPopup) { | 113 CFX_RectF& rtPopup) { |
| 114 if (!hWidget) | 114 if (!hWidget) |
| 115 return FALSE; | 115 return FALSE; |
| 116 | 116 |
| 117 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); | 117 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); |
| 118 if (!pXFAPageView) | 118 if (!pXFAPageView) |
| 119 return FALSE; | 119 return FALSE; |
| 120 | 120 |
| 121 CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pXFAPageView); | 121 CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pXFAPageView); |
| 122 if (!pPage) | 122 if (!pPage) |
| 123 return FALSE; | 123 return FALSE; |
| 124 | 124 |
| 125 CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc(); | 125 CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc(); |
| 126 int nRotate = pWidgetAcc->GetRotate(); | 126 int nRotate = pWidgetAcc->GetRotate(); |
| 127 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 127 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
| 128 if (!pEnv) | 128 if (!pEnv) |
| 129 return FALSE; | 129 return FALSE; |
| 130 | 130 |
| 131 FS_RECTF pageViewRect = {0.0f, 0.0f, 0.0f, 0.0f}; | 131 FS_RECTF pageViewRect = {0.0f, 0.0f, 0.0f, 0.0f}; |
| 132 pEnv->GetPageViewRect(pPage, pageViewRect); | 132 pEnv->GetPageViewRect(pPage, pageViewRect); |
| 133 | 133 |
| 134 int t1; | 134 int t1; |
| 135 int t2; | 135 int t2; |
| 136 CFX_FloatRect rcAnchor = CFX_FloatRect::FromCFXRectF(rtAnchor); | 136 CFX_FloatRect rcAnchor = CFX_FloatRect::FromCFXRectF(rtAnchor); |
| 137 switch (nRotate) { | 137 switch (nRotate) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 return FALSE; | 228 return FALSE; |
| 229 | 229 |
| 230 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); | 230 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); |
| 231 if (!pXFAPageView) | 231 if (!pXFAPageView) |
| 232 return FALSE; | 232 return FALSE; |
| 233 | 233 |
| 234 CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pXFAPageView); | 234 CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pXFAPageView); |
| 235 if (!pPage) | 235 if (!pPage) |
| 236 return FALSE; | 236 return FALSE; |
| 237 | 237 |
| 238 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 238 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
| 239 if (!pEnv) | 239 if (!pEnv) |
| 240 return FALSE; | 240 return FALSE; |
| 241 | 241 |
| 242 int menuFlag = 0; | 242 int menuFlag = 0; |
| 243 if (hWidget->CanUndo()) | 243 if (hWidget->CanUndo()) |
| 244 menuFlag |= FXFA_MENU_UNDO; | 244 menuFlag |= FXFA_MENU_UNDO; |
| 245 if (hWidget->CanRedo()) | 245 if (hWidget->CanRedo()) |
| 246 menuFlag |= FXFA_MENU_REDO; | 246 menuFlag |= FXFA_MENU_REDO; |
| 247 if (hWidget->CanPaste()) | 247 if (hWidget->CanPaste()) |
| 248 menuFlag |= FXFA_MENU_PASTE; | 248 menuFlag |= FXFA_MENU_PASTE; |
| 249 if (hWidget->CanCopy()) | 249 if (hWidget->CanCopy()) |
| 250 menuFlag |= FXFA_MENU_COPY; | 250 menuFlag |= FXFA_MENU_COPY; |
| 251 if (hWidget->CanCut()) | 251 if (hWidget->CanCut()) |
| 252 menuFlag |= FXFA_MENU_CUT; | 252 menuFlag |= FXFA_MENU_CUT; |
| 253 if (hWidget->CanSelectAll()) | 253 if (hWidget->CanSelectAll()) |
| 254 menuFlag |= FXFA_MENU_SELECTALL; | 254 menuFlag |= FXFA_MENU_SELECTALL; |
| 255 | 255 |
| 256 return pEnv->PopupMenu(pPage, hWidget, menuFlag, ptPopup); | 256 return pEnv->PopupMenu(pPage, hWidget, menuFlag, ptPopup); |
| 257 } | 257 } |
| 258 | 258 |
| 259 void CPDFXFA_DocEnvironment::PageViewEvent(CXFA_FFPageView* pPageView, | 259 void CPDFXFA_DocEnvironment::PageViewEvent(CXFA_FFPageView* pPageView, |
| 260 uint32_t dwFlags) { | 260 uint32_t dwFlags) { |
| 261 CPDFSDK_Document* pSDKDoc = m_pDocument->GetSDKDoc(); | 261 CPDFSDK_Document* pSDKDoc = m_pDocument->GetSDKDoc(); |
| 262 if (!pSDKDoc) | 262 if (!pSDKDoc) |
| 263 return; | 263 return; |
| 264 | 264 |
| 265 CPDFSDK_Environment* pEnv = pSDKDoc->GetEnv(); | 265 CPDFSDK_FormFillEnvironment* pEnv = pSDKDoc->GetEnv(); |
| 266 if (!pEnv) | 266 if (!pEnv) |
| 267 return; | 267 return; |
| 268 | 268 |
| 269 if (m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_LOADING || | 269 if (m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_LOADING || |
| 270 m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_CLOSING || | 270 m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_CLOSING || |
| 271 XFA_PAGEVIEWEVENT_StopLayout != dwFlags) | 271 XFA_PAGEVIEWEVENT_StopLayout != dwFlags) |
| 272 return; | 272 return; |
| 273 | 273 |
| 274 int nNewCount = m_pDocument->GetPageCount(); | 274 int nNewCount = m_pDocument->GetPageCount(); |
| 275 if (nNewCount == m_pDocument->GetOriginalPageCount()) | 275 if (nNewCount == m_pDocument->GetOriginalPageCount()) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 return m_pDocument->GetPageCount(); | 337 return m_pDocument->GetPageCount(); |
| 338 return 0; | 338 return 0; |
| 339 } | 339 } |
| 340 | 340 |
| 341 int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) { | 341 int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) { |
| 342 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) | 342 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) |
| 343 return -1; | 343 return -1; |
| 344 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) | 344 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) |
| 345 return -1; | 345 return -1; |
| 346 | 346 |
| 347 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 347 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
| 348 if (!pEnv) | 348 if (!pEnv) |
| 349 return -1; | 349 return -1; |
| 350 | 350 |
| 351 return pEnv->GetCurrentPageIndex(this); | 351 return pEnv->GetCurrentPageIndex(this); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc, | 354 void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc, |
| 355 int32_t iCurPage) { | 355 int32_t iCurPage) { |
| 356 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc() || | 356 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc() || |
| 357 m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || iCurPage < 0 || | 357 m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || iCurPage < 0 || |
| 358 iCurPage >= m_pDocument->GetSDKDoc()->GetPageCount()) { | 358 iCurPage >= m_pDocument->GetSDKDoc()->GetPageCount()) { |
| 359 return; | 359 return; |
| 360 } | 360 } |
| 361 | 361 |
| 362 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 362 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
| 363 if (!pEnv) | 363 if (!pEnv) |
| 364 return; | 364 return; |
| 365 pEnv->SetCurrentPage(this, iCurPage); | 365 pEnv->SetCurrentPage(this, iCurPage); |
| 366 } | 366 } |
| 367 | 367 |
| 368 FX_BOOL CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { | 368 FX_BOOL CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { |
| 369 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) | 369 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) |
| 370 return FALSE; | 370 return FALSE; |
| 371 if (m_pDocument->GetSDKDoc()->GetInterForm()) | 371 if (m_pDocument->GetSDKDoc()->GetInterForm()) |
| 372 return m_pDocument->GetSDKDoc()->GetInterForm()->IsXfaCalculateEnabled(); | 372 return m_pDocument->GetSDKDoc()->GetInterForm()->IsXfaCalculateEnabled(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, | 407 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, |
| 408 const CFX_WideString& wsFilePath, | 408 const CFX_WideString& wsFilePath, |
| 409 FX_BOOL bXDP) { | 409 FX_BOOL bXDP) { |
| 410 if (hDoc != m_pDocument->GetXFADoc()) | 410 if (hDoc != m_pDocument->GetXFADoc()) |
| 411 return; | 411 return; |
| 412 | 412 |
| 413 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA && | 413 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA && |
| 414 m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA) | 414 m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA) |
| 415 return; | 415 return; |
| 416 | 416 |
| 417 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 417 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
| 418 if (!pEnv) | 418 if (!pEnv) |
| 419 return; | 419 return; |
| 420 | 420 |
| 421 int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML; | 421 int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML; |
| 422 CFX_ByteString bs = wsFilePath.UTF16LE_Encode(); | 422 CFX_ByteString bs = wsFilePath.UTF16LE_Encode(); |
| 423 if (wsFilePath.IsEmpty()) { | 423 if (wsFilePath.IsEmpty()) { |
| 424 if (!pEnv->GetFormFillInfo() || !pEnv->GetFormFillInfo()->m_pJsPlatform) | 424 if (!pEnv->GetFormFillInfo() || !pEnv->GetFormFillInfo()->m_pJsPlatform) |
| 425 return; | 425 return; |
| 426 | 426 |
| 427 CFX_WideString filepath = pEnv->JS_fieldBrowse(); | 427 CFX_WideString filepath = pEnv->JS_fieldBrowse(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 } | 504 } |
| 505 | 505 |
| 506 void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc, | 506 void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc, |
| 507 const CFX_WideString& bsURL) { | 507 const CFX_WideString& bsURL) { |
| 508 if (hDoc != m_pDocument->GetXFADoc()) | 508 if (hDoc != m_pDocument->GetXFADoc()) |
| 509 return; | 509 return; |
| 510 | 510 |
| 511 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) | 511 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) |
| 512 return; | 512 return; |
| 513 | 513 |
| 514 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 514 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
| 515 if (!pEnv) | 515 if (!pEnv) |
| 516 return; | 516 return; |
| 517 | 517 |
| 518 CFX_WideStringC str(bsURL.c_str()); | 518 CFX_WideStringC str(bsURL.c_str()); |
| 519 pEnv->GotoURL(this, str); | 519 pEnv->GotoURL(this, str); |
| 520 } | 520 } |
| 521 | 521 |
| 522 FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) { | 522 FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) { |
| 523 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) | 523 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) |
| 524 return FALSE; | 524 return FALSE; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 } | 561 } |
| 562 } | 562 } |
| 563 | 563 |
| 564 void CPDFXFA_DocEnvironment::Print(CXFA_FFDoc* hDoc, | 564 void CPDFXFA_DocEnvironment::Print(CXFA_FFDoc* hDoc, |
| 565 int32_t nStartPage, | 565 int32_t nStartPage, |
| 566 int32_t nEndPage, | 566 int32_t nEndPage, |
| 567 uint32_t dwOptions) { | 567 uint32_t dwOptions) { |
| 568 if (hDoc != m_pDocument->GetXFADoc()) | 568 if (hDoc != m_pDocument->GetXFADoc()) |
| 569 return; | 569 return; |
| 570 | 570 |
| 571 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 571 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
| 572 if (!pEnv || !pEnv->GetFormFillInfo() || | 572 if (!pEnv || !pEnv->GetFormFillInfo() || |
| 573 !pEnv->GetFormFillInfo()->m_pJsPlatform || | 573 !pEnv->GetFormFillInfo()->m_pJsPlatform || |
| 574 !pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print) { | 574 !pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print) { |
| 575 return; | 575 return; |
| 576 } | 576 } |
| 577 | 577 |
| 578 pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print( | 578 pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print( |
| 579 pEnv->GetFormFillInfo()->m_pJsPlatform, | 579 pEnv->GetFormFillInfo()->m_pJsPlatform, |
| 580 dwOptions & XFA_PRINTOPT_ShowDialog, nStartPage, nEndPage, | 580 dwOptions & XFA_PRINTOPT_ShowDialog, nStartPage, nEndPage, |
| 581 dwOptions & XFA_PRINTOPT_CanCancel, dwOptions & XFA_PRINTOPT_ShrinkPage, | 581 dwOptions & XFA_PRINTOPT_CanCancel, dwOptions & XFA_PRINTOPT_ShrinkPage, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 pWidgetAccIterator.reset( | 628 pWidgetAccIterator.reset( |
| 629 m_pDocument->GetXFADocView()->CreateWidgetAccIterator()); | 629 m_pDocument->GetXFADocView()->CreateWidgetAccIterator()); |
| 630 if (!pWidgetAccIterator) | 630 if (!pWidgetAccIterator) |
| 631 return TRUE; | 631 return TRUE; |
| 632 | 632 |
| 633 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext(); | 633 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext(); |
| 634 pWidgetAcc = pWidgetAccIterator->MoveToNext(); | 634 pWidgetAcc = pWidgetAccIterator->MoveToNext(); |
| 635 while (pWidgetAcc) { | 635 while (pWidgetAcc) { |
| 636 int fRet = pWidgetAcc->ProcessValidate(-1); | 636 int fRet = pWidgetAcc->ProcessValidate(-1); |
| 637 if (fRet == XFA_EVENTERROR_Error) { | 637 if (fRet == XFA_EVENTERROR_Error) { |
| 638 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 638 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
| 639 if (!pEnv) | 639 if (!pEnv) |
| 640 return FALSE; | 640 return FALSE; |
| 641 | 641 |
| 642 CFX_WideString ws; | 642 CFX_WideString ws; |
| 643 ws.FromLocal(IDS_XFA_Validate_Input); | 643 ws.FromLocal(IDS_XFA_Validate_Input); |
| 644 CFX_ByteString bs = ws.UTF16LE_Encode(); | 644 CFX_ByteString bs = ws.UTF16LE_Encode(); |
| 645 int len = bs.GetLength(); | 645 int len = bs.GetLength(); |
| 646 pEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len), (FPDF_WIDESTRING)L"", 0, | 646 pEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len), (FPDF_WIDESTRING)L"", 0, |
| 647 1); | 647 1); |
| 648 bs.ReleaseBuffer(len); | 648 bs.ReleaseBuffer(len); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 | 690 |
| 691 m_pDocument->GetXFADocView()->UpdateDocView(); | 691 m_pDocument->GetXFADocView()->UpdateDocView(); |
| 692 FX_BOOL ret = SubmitDataInternal(hDoc, submit); | 692 FX_BOOL ret = SubmitDataInternal(hDoc, submit); |
| 693 NotifySubmit(FALSE); | 693 NotifySubmit(FALSE); |
| 694 return ret; | 694 return ret; |
| 695 } | 695 } |
| 696 | 696 |
| 697 IFX_FileRead* CPDFXFA_DocEnvironment::OpenLinkedFile( | 697 IFX_FileRead* CPDFXFA_DocEnvironment::OpenLinkedFile( |
| 698 CXFA_FFDoc* hDoc, | 698 CXFA_FFDoc* hDoc, |
| 699 const CFX_WideString& wsLink) { | 699 const CFX_WideString& wsLink) { |
| 700 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 700 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
| 701 if (!pEnv) | 701 if (!pEnv) |
| 702 return FALSE; | 702 return FALSE; |
| 703 | 703 |
| 704 CFX_ByteString bs = wsLink.UTF16LE_Encode(); | 704 CFX_ByteString bs = wsLink.UTF16LE_Encode(); |
| 705 int len = bs.GetLength(); | 705 int len = bs.GetLength(); |
| 706 FPDF_FILEHANDLER* pFileHandler = | 706 FPDF_FILEHANDLER* pFileHandler = |
| 707 pEnv->OpenFile(0, (FPDF_WIDESTRING)bs.GetBuffer(len), "rb"); | 707 pEnv->OpenFile(0, (FPDF_WIDESTRING)bs.GetBuffer(len), "rb"); |
| 708 bs.ReleaseBuffer(len); | 708 bs.ReleaseBuffer(len); |
| 709 | 709 |
| 710 if (!pFileHandler) | 710 if (!pFileHandler) |
| 711 return nullptr; | 711 return nullptr; |
| 712 return new CFPDF_FileStream(pFileHandler); | 712 return new CFPDF_FileStream(pFileHandler); |
| 713 } | 713 } |
| 714 | 714 |
| 715 FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, | 715 FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, |
| 716 int fileType, | 716 int fileType, |
| 717 FPDF_DWORD encodeType, | 717 FPDF_DWORD encodeType, |
| 718 FPDF_DWORD flag) { | 718 FPDF_DWORD flag) { |
| 719 if (!m_pDocument->GetXFADocView()) | 719 if (!m_pDocument->GetXFADocView()) |
| 720 return FALSE; | 720 return FALSE; |
| 721 | 721 |
| 722 CFX_ByteString content; | 722 CFX_ByteString content; |
| 723 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 723 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
| 724 if (!pEnv) | 724 if (!pEnv) |
| 725 return FALSE; | 725 return FALSE; |
| 726 | 726 |
| 727 CFPDF_FileStream fileStream(pFileHandler); | 727 CFPDF_FileStream fileStream(pFileHandler); |
| 728 if (fileType == FXFA_SAVEAS_XML) { | 728 if (fileType == FXFA_SAVEAS_XML) { |
| 729 const char kContent[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; | 729 const char kContent[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; |
| 730 fileStream.WriteBlock(kContent, 0, strlen(kContent)); | 730 fileStream.WriteBlock(kContent, 0, strlen(kContent)); |
| 731 m_pDocument->GetXFADoc()->SavePackage(XFA_HASHCODE_Data, &fileStream, | 731 m_pDocument->GetXFADoc()->SavePackage(XFA_HASHCODE_Data, &fileStream, |
| 732 nullptr); | 732 nullptr); |
| 733 return TRUE; | 733 return TRUE; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 srcURL = (pos == -1) ? L"" : srcURL.Right(csURL.GetLength() - (pos + 1)); | 884 srcURL = (pos == -1) ? L"" : srcURL.Right(csURL.GetLength() - (pos + 1)); |
| 885 } | 885 } |
| 886 csToAddress.Replace(L",", L";"); | 886 csToAddress.Replace(L",", L";"); |
| 887 csCCAddress.Replace(L",", L";"); | 887 csCCAddress.Replace(L",", L";"); |
| 888 csBCCAddress.Replace(L",", L";"); | 888 csBCCAddress.Replace(L",", L";"); |
| 889 return TRUE; | 889 return TRUE; |
| 890 } | 890 } |
| 891 | 891 |
| 892 FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, | 892 FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, |
| 893 CXFA_Submit submit) { | 893 CXFA_Submit submit) { |
| 894 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 894 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
| 895 if (!pEnv) | 895 if (!pEnv) |
| 896 return FALSE; | 896 return FALSE; |
| 897 | 897 |
| 898 CFX_WideStringC csURLC; | 898 CFX_WideStringC csURLC; |
| 899 submit.GetSubmitTarget(csURLC); | 899 submit.GetSubmitTarget(csURLC); |
| 900 CFX_WideString csURL(csURLC); | 900 CFX_WideString csURL(csURLC); |
| 901 if (csURL.IsEmpty()) { | 901 if (csURL.IsEmpty()) { |
| 902 CFX_WideString ws; | 902 CFX_WideString ws; |
| 903 ws.FromLocal("Submit cancelled."); | 903 ws.FromLocal("Submit cancelled."); |
| 904 CFX_ByteString bs = ws.UTF16LE_Encode(); | 904 CFX_ByteString bs = ws.UTF16LE_Encode(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 if (!m_pJSContext) { | 1015 if (!m_pJSContext) { |
| 1016 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument( | 1016 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument( |
| 1017 m_pDocument->GetSDKDoc()); | 1017 m_pDocument->GetSDKDoc()); |
| 1018 m_pJSContext = | 1018 m_pJSContext = |
| 1019 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext(); | 1019 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext(); |
| 1020 } | 1020 } |
| 1021 | 1021 |
| 1022 return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName( | 1022 return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName( |
| 1023 szPropName, pValue); | 1023 szPropName, pValue); |
| 1024 } | 1024 } |
| OLD | NEW |