| 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 "xfa/fxfa/parser/cscript_hostpseudomodel.h" | 7 #include "xfa/fxfa/parser/cscript_hostpseudomodel.h" |
| 8 | 8 |
| 9 #include "fxjs/include/cfxjse_arguments.h" | 9 #include "fxjs/include/cfxjse_arguments.h" |
| 10 #include "xfa/fxfa/app/xfa_ffnotify.h" | 10 #include "xfa/fxfa/app/xfa_ffnotify.h" |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 } | 621 } |
| 622 FX_BOOL bPrintAnnot = TRUE; | 622 FX_BOOL bPrintAnnot = TRUE; |
| 623 if (iLength >= 8) { | 623 if (iLength >= 8) { |
| 624 bPrintAnnot = pArguments->GetInt32(7) == 0 ? FALSE : TRUE; | 624 bPrintAnnot = pArguments->GetInt32(7) == 0 ? FALSE : TRUE; |
| 625 } | 625 } |
| 626 if (bPrintAnnot) { | 626 if (bPrintAnnot) { |
| 627 dwOptions |= XFA_PRINTOPT_PrintAnnot; | 627 dwOptions |= XFA_PRINTOPT_PrintAnnot; |
| 628 } | 628 } |
| 629 pNotify->GetDocProvider()->Print(hDoc, nStartPage, nEndPage, dwOptions); | 629 pNotify->GetDocProvider()->Print(hDoc, nStartPage, nEndPage, dwOptions); |
| 630 } | 630 } |
| 631 |
| 631 void CScript_HostPseudoModel::ImportData(CFXJSE_Arguments* pArguments) { | 632 void CScript_HostPseudoModel::ImportData(CFXJSE_Arguments* pArguments) { |
| 632 int32_t iLength = pArguments->GetLength(); | 633 int32_t iLength = pArguments->GetLength(); |
| 633 if (iLength < 0 || iLength > 1) { | 634 if (iLength < 0 || iLength > 1) { |
| 634 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData"); | 635 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData"); |
| 635 return; | 636 return; |
| 636 } | 637 } |
| 637 CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); | 638 // Not implemented. |
| 638 if (!pNotify) { | |
| 639 return; | |
| 640 } | |
| 641 CFX_WideString wsFilePath; | |
| 642 if (iLength > 0) { | |
| 643 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); | |
| 644 wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC()); | |
| 645 } | |
| 646 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | |
| 647 pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath); | |
| 648 } | 639 } |
| 640 |
| 649 void CScript_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) { | 641 void CScript_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) { |
| 650 int32_t iLength = pArguments->GetLength(); | 642 int32_t iLength = pArguments->GetLength(); |
| 651 if (iLength < 0 || iLength > 2) { | 643 if (iLength < 0 || iLength > 2) { |
| 652 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData"); | 644 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData"); |
| 653 return; | 645 return; |
| 654 } | 646 } |
| 655 CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); | 647 CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); |
| 656 if (!pNotify) { | 648 if (!pNotify) { |
| 657 return; | 649 return; |
| 658 } | 650 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 void CScript_HostPseudoModel::CurrentDateTime(CFXJSE_Arguments* pArguments) { | 699 void CScript_HostPseudoModel::CurrentDateTime(CFXJSE_Arguments* pArguments) { |
| 708 CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); | 700 CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); |
| 709 if (!pNotify) { | 701 if (!pNotify) { |
| 710 return; | 702 return; |
| 711 } | 703 } |
| 712 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); | 704 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); |
| 713 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 705 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 714 if (pValue) | 706 if (pValue) |
| 715 pValue->SetString(FX_UTF8Encode(wsDataTime).AsStringC()); | 707 pValue->SetString(FX_UTF8Encode(wsDataTime).AsStringC()); |
| 716 } | 708 } |
| OLD | NEW |