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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
912 CFX_WideString ws; | 912 CFX_WideString ws; |
913 ws.FromLocal("Submit cancelled."); | 913 ws.FromLocal("Submit cancelled."); |
914 CFX_ByteString bs = ws.UTF16LE_Encode(); | 914 CFX_ByteString bs = ws.UTF16LE_Encode(); |
915 int len = bs.GetLength(); | 915 int len = bs.GetLength(); |
916 pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len), | 916 pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len), |
917 (FPDF_WIDESTRING)L"", 0, 4); | 917 (FPDF_WIDESTRING)L"", 0, 4); |
918 bs.ReleaseBuffer(len); | 918 bs.ReleaseBuffer(len); |
919 return FALSE; | 919 return FALSE; |
920 } | 920 } |
921 | 921 |
922 FPDF_BOOL bRet = TRUE; | |
Tom Sepez
2016/10/25 23:08:45
note: they mean FX_BOOL, not the other kind.
npm
2016/10/26 14:33:00
Aren't they both the same (int)?
Tom Sepez
2016/10/26 15:45:09
Yes, and that would be an obstacle to converting F
| |
923 FPDF_FILEHANDLER* pFileHandler = nullptr; | 922 FPDF_FILEHANDLER* pFileHandler = nullptr; |
924 int fileFlag = -1; | 923 int fileFlag = -1; |
925 switch (submit.GetSubmitFormat()) { | 924 switch (submit.GetSubmitFormat()) { |
926 case XFA_ATTRIBUTEENUM_Xdp: { | 925 case XFA_ATTRIBUTEENUM_Xdp: { |
927 CFX_WideStringC csContentC; | 926 CFX_WideStringC csContentC; |
928 submit.GetSubmitXDPContent(csContentC); | 927 submit.GetSubmitXDPContent(csContentC); |
929 CFX_WideString csContent; | 928 CFX_WideString csContent; |
930 csContent = csContentC; | 929 csContent = csContentC; |
931 csContent.TrimLeft(); | 930 csContent.TrimLeft(); |
932 csContent.TrimRight(); | 931 csContent.TrimRight(); |
(...skipping 26 matching lines...) Expand all Loading... | |
959 return false; | 958 return false; |
960 } | 959 } |
961 if (!pFileHandler) | 960 if (!pFileHandler) |
962 return FALSE; | 961 return FALSE; |
963 if (csURL.Left(7).CompareNoCase(L"mailto:") == 0) { | 962 if (csURL.Left(7).CompareNoCase(L"mailto:") == 0) { |
964 CFX_WideString csToAddress; | 963 CFX_WideString csToAddress; |
965 CFX_WideString csCCAddress; | 964 CFX_WideString csCCAddress; |
966 CFX_WideString csBCCAddress; | 965 CFX_WideString csBCCAddress; |
967 CFX_WideString csSubject; | 966 CFX_WideString csSubject; |
968 CFX_WideString csMsg; | 967 CFX_WideString csMsg; |
969 bRet = MailToInfo(csURL, csToAddress, csCCAddress, csBCCAddress, csSubject, | 968 if (!MailToInfo(csURL, csToAddress, csCCAddress, csBCCAddress, csSubject, |
970 csMsg); | 969 csMsg)) { |
971 if (!bRet) | |
972 return FALSE; | 970 return FALSE; |
973 | 971 } |
974 CFX_ByteString bsTo = CFX_WideString(csToAddress).UTF16LE_Encode(); | 972 CFX_ByteString bsTo = CFX_WideString(csToAddress).UTF16LE_Encode(); |
975 CFX_ByteString bsCC = CFX_WideString(csCCAddress).UTF16LE_Encode(); | 973 CFX_ByteString bsCC = CFX_WideString(csCCAddress).UTF16LE_Encode(); |
976 CFX_ByteString bsBcc = CFX_WideString(csBCCAddress).UTF16LE_Encode(); | 974 CFX_ByteString bsBcc = CFX_WideString(csBCCAddress).UTF16LE_Encode(); |
977 CFX_ByteString bsSubject = CFX_WideString(csSubject).UTF16LE_Encode(); | 975 CFX_ByteString bsSubject = CFX_WideString(csSubject).UTF16LE_Encode(); |
978 CFX_ByteString bsMsg = CFX_WideString(csMsg).UTF16LE_Encode(); | 976 CFX_ByteString bsMsg = CFX_WideString(csMsg).UTF16LE_Encode(); |
979 FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bsTo.GetLength()); | 977 FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bsTo.GetLength()); |
980 FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bsCC.GetLength()); | 978 FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bsCC.GetLength()); |
981 FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer(bsBcc.GetLength()); | 979 FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer(bsBcc.GetLength()); |
982 FPDF_WIDESTRING pSubject = | 980 FPDF_WIDESTRING pSubject = |
983 (FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength()); | 981 (FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength()); |
984 FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength()); | 982 FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength()); |
985 pFormFillEnv->EmailTo(pFileHandler, pTo, pSubject, pCC, pBcc, pMsg); | 983 pFormFillEnv->EmailTo(pFileHandler, pTo, pSubject, pCC, pBcc, pMsg); |
986 bsTo.ReleaseBuffer(); | 984 bsTo.ReleaseBuffer(); |
987 bsCC.ReleaseBuffer(); | 985 bsCC.ReleaseBuffer(); |
988 bsBcc.ReleaseBuffer(); | 986 bsBcc.ReleaseBuffer(); |
989 bsSubject.ReleaseBuffer(); | 987 bsSubject.ReleaseBuffer(); |
990 bsMsg.ReleaseBuffer(); | 988 bsMsg.ReleaseBuffer(); |
991 } else { | 989 } else { |
992 // HTTP or FTP | 990 // HTTP or FTP |
993 CFX_WideString ws; | 991 CFX_WideString ws; |
994 CFX_ByteString bs = csURL.UTF16LE_Encode(); | 992 CFX_ByteString bs = csURL.UTF16LE_Encode(); |
995 int len = bs.GetLength(); | 993 int len = bs.GetLength(); |
996 pFormFillEnv->UploadTo(pFileHandler, fileFlag, | 994 pFormFillEnv->UploadTo(pFileHandler, fileFlag, |
997 (FPDF_WIDESTRING)bs.GetBuffer(len)); | 995 (FPDF_WIDESTRING)bs.GetBuffer(len)); |
998 bs.ReleaseBuffer(len); | 996 bs.ReleaseBuffer(len); |
999 } | 997 } |
1000 return bRet; | 998 return TRUE; |
1001 } | 999 } |
1002 | 1000 |
1003 FX_BOOL CPDFXFA_DocEnvironment::SetGlobalProperty( | 1001 FX_BOOL CPDFXFA_DocEnvironment::SetGlobalProperty( |
1004 CXFA_FFDoc* hDoc, | 1002 CXFA_FFDoc* hDoc, |
1005 const CFX_ByteStringC& szPropName, | 1003 const CFX_ByteStringC& szPropName, |
1006 CFXJSE_Value* pValue) { | 1004 CFXJSE_Value* pValue) { |
1007 if (hDoc != m_pDocument->GetXFADoc()) | 1005 if (hDoc != m_pDocument->GetXFADoc()) |
1008 return FALSE; | 1006 return FALSE; |
1009 | 1007 |
1010 if (m_pDocument->GetFormFillEnv() && | 1008 if (m_pDocument->GetFormFillEnv() && |
(...skipping 14 matching lines...) Expand all Loading... | |
1025 !m_pDocument->GetFormFillEnv()->GetJSRuntime()) { | 1023 !m_pDocument->GetFormFillEnv()->GetJSRuntime()) { |
1026 return FALSE; | 1024 return FALSE; |
1027 } | 1025 } |
1028 | 1026 |
1029 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv(); | 1027 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv(); |
1030 if (!m_pJSContext) | 1028 if (!m_pJSContext) |
1031 m_pJSContext = pFormFillEnv->GetJSRuntime()->NewContext(); | 1029 m_pJSContext = pFormFillEnv->GetJSRuntime()->NewContext(); |
1032 | 1030 |
1033 return pFormFillEnv->GetJSRuntime()->GetValueByName(szPropName, pValue); | 1031 return pFormFillEnv->GetJSRuntime()->GetValueByName(szPropName, pValue); |
1034 } | 1032 } |
OLD | NEW |