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 "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" | 7 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" |
8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" | 8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" |
9 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" | 9 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" |
10 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h" | 10 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h" |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
626 CFPDF_FileStream fileWrite(pFileHandler); | 626 CFPDF_FileStream fileWrite(pFileHandler); |
627 | 627 |
628 IXFA_DocHandler* pXFADocHander = m_pApp->GetXFAApp()->GetDocHandler(); | 628 IXFA_DocHandler* pXFADocHander = m_pApp->GetXFAApp()->GetDocHandler(); |
629 CFX_ByteString content; | 629 CFX_ByteString content; |
630 if (fileType == FXFA_SAVEAS_XML) { | 630 if (fileType == FXFA_SAVEAS_XML) { |
631 content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; | 631 content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; |
632 fileWrite.WriteBlock((const FX_CHAR*)content, fileWrite.GetSize(), | 632 fileWrite.WriteBlock((const FX_CHAR*)content, fileWrite.GetSize(), |
633 content.GetLength()); | 633 content.GetLength()); |
634 CFX_WideStringC data(L"data"); | 634 CFX_WideStringC data(L"data"); |
635 if (pXFADocHander->SavePackage(m_pXFADocView->GetDoc(), data, &fileWrite)) { | 635 if (pXFADocHander->SavePackage(m_pXFADocView->GetDoc(), data, &fileWrite)) { |
636 // TODO: Maybe report error. | 636 // Ignoring error. |
637 } | 637 } |
638 } else if (fileType == FXFA_SAVEAS_XDP) { | 638 } else if (fileType == FXFA_SAVEAS_XDP) { |
639 if (m_pPDFDoc == NULL) | 639 if (m_pPDFDoc == NULL) |
640 return; | 640 return; |
641 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); | 641 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); |
642 if (pRoot == NULL) | 642 if (pRoot == NULL) |
643 return; | 643 return; |
644 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); | 644 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); |
645 if (NULL == pAcroForm) | 645 if (NULL == pAcroForm) |
646 return; | 646 return; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
686 CPDF_Stream* pStream = (CPDF_Stream*)pDirectObj; | 686 CPDF_Stream* pStream = (CPDF_Stream*)pDirectObj; |
687 CPDF_StreamAcc* pAcc = new CPDF_StreamAcc; | 687 CPDF_StreamAcc* pAcc = new CPDF_StreamAcc; |
688 pAcc->LoadAllData(pStream); | 688 pAcc->LoadAllData(pStream); |
689 fileWrite.WriteBlock(pAcc->GetData(), fileWrite.GetSize(), | 689 fileWrite.WriteBlock(pAcc->GetData(), fileWrite.GetSize(), |
690 pAcc->GetSize()); | 690 pAcc->GetSize()); |
691 delete pAcc; | 691 delete pAcc; |
692 } | 692 } |
693 } | 693 } |
694 } | 694 } |
695 if (!fileWrite.Flush()) { | 695 if (!fileWrite.Flush()) { |
696 // TODO: Report error. | 696 // Ignoring flush error. |
697 } | 697 } |
698 } | 698 } |
699 void CPDFXFA_Document::ImportData(IXFA_Doc* hDoc, | 699 void CPDFXFA_Document::ImportData(IXFA_Doc* hDoc, |
700 const CFX_WideStringC& wsFilePath) { | 700 const CFX_WideStringC& wsFilePath) { |
701 // TODO ... | |
702 } | 701 } |
703 | 702 |
704 void CPDFXFA_Document::GotoURL(IXFA_Doc* hDoc, | 703 void CPDFXFA_Document::GotoURL(IXFA_Doc* hDoc, |
705 const CFX_WideStringC& bsURL, | 704 const CFX_WideStringC& bsURL, |
706 FX_BOOL bAppend) { | 705 FX_BOOL bAppend) { |
707 if (hDoc != m_pXFADoc) | 706 if (hDoc != m_pXFADoc) |
708 return; | 707 return; |
709 | 708 |
710 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) | 709 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) |
711 return; | 710 return; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
993 if (pPrePDFObj->GetString() == "form") { | 992 if (pPrePDFObj->GetString() == "form") { |
994 CFX_WideString ws; | 993 CFX_WideString ws; |
995 ws.FromLocal("form"); | 994 ws.FromLocal("form"); |
996 pDocHandler->SavePackage(m_pXFADoc, ws, &fileStream); | 995 pDocHandler->SavePackage(m_pXFADoc, ws, &fileStream); |
997 } else if (pPrePDFObj->GetString() == "datasets") { | 996 } else if (pPrePDFObj->GetString() == "datasets") { |
998 CFX_WideString ws; | 997 CFX_WideString ws; |
999 ws.FromLocal("datasets"); | 998 ws.FromLocal("datasets"); |
1000 pDocHandler->SavePackage(m_pXFADoc, ws, &fileStream); | 999 pDocHandler->SavePackage(m_pXFADoc, ws, &fileStream); |
1001 } else { | 1000 } else { |
1002 // PDF,creator. | 1001 // PDF,creator. |
1003 // TODO: | |
1004 } | 1002 } |
1005 } | 1003 } |
1006 } | 1004 } |
1007 return TRUE; | 1005 return TRUE; |
1008 } | 1006 } |
1009 | 1007 |
1010 void CPDFXFA_Document::_ClearChangeMark() { | 1008 void CPDFXFA_Document::_ClearChangeMark() { |
1011 if (m_pSDKDoc) | 1009 if (m_pSDKDoc) |
1012 m_pSDKDoc->ClearChangeMark(); | 1010 m_pSDKDoc->ClearChangeMark(); |
1013 } | 1011 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1184 FPDF_WIDESTRING pSubject = | 1182 FPDF_WIDESTRING pSubject = |
1185 (FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength()); | 1183 (FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength()); |
1186 FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength()); | 1184 FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength()); |
1187 pEnv->FFI_EmailTo(pFileHandler, pTo, pSubject, pCC, pBcc, pMsg); | 1185 pEnv->FFI_EmailTo(pFileHandler, pTo, pSubject, pCC, pBcc, pMsg); |
1188 bsTo.ReleaseBuffer(); | 1186 bsTo.ReleaseBuffer(); |
1189 bsCC.ReleaseBuffer(); | 1187 bsCC.ReleaseBuffer(); |
1190 bsBcc.ReleaseBuffer(); | 1188 bsBcc.ReleaseBuffer(); |
1191 bsSubject.ReleaseBuffer(); | 1189 bsSubject.ReleaseBuffer(); |
1192 bsMsg.ReleaseBuffer(); | 1190 bsMsg.ReleaseBuffer(); |
1193 } else { | 1191 } else { |
1194 // http¡¢ftp | 1192 // http or ftp |
Tom Sepez
2016/03/08 19:27:05
Nit: HTTP or FTP since they are initials.
dsinclair
2016/03/08 21:08:02
Done.
| |
1195 CFX_WideString ws; | 1193 CFX_WideString ws; |
1196 CFX_ByteString bs = csURL.UTF16LE_Encode(); | 1194 CFX_ByteString bs = csURL.UTF16LE_Encode(); |
1197 int len = bs.GetLength() / sizeof(unsigned short); | 1195 int len = bs.GetLength() / sizeof(unsigned short); |
1198 pEnv->FFI_UploadTo( | 1196 pEnv->FFI_UploadTo( |
1199 pFileHandler, fileFlag, | 1197 pFileHandler, fileFlag, |
1200 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short))); | 1198 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short))); |
1201 bs.ReleaseBuffer(len * sizeof(unsigned short)); | 1199 bs.ReleaseBuffer(len * sizeof(unsigned short)); |
1202 } | 1200 } |
1203 return bRet; | 1201 return bRet; |
1204 #else | 1202 #else |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1248 } | 1246 } |
1249 | 1247 |
1250 return _GetHValueByName(szPropName, hValue, | 1248 return _GetHValueByName(szPropName, hValue, |
1251 m_pSDKDoc->GetEnv()->GetJSRuntime()); | 1249 m_pSDKDoc->GetEnv()->GetJSRuntime()); |
1252 } | 1250 } |
1253 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, | 1251 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, |
1254 FXJSE_HVALUE hValue, | 1252 FXJSE_HVALUE hValue, |
1255 IJS_Runtime* runTime) { | 1253 IJS_Runtime* runTime) { |
1256 return runTime->GetHValueByName(utf8Name, hValue); | 1254 return runTime->GetHValueByName(utf8Name, hValue); |
1257 } | 1255 } |
OLD | NEW |