| 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 "../../third_party/base/nonstd_unique_ptr.h" | 7 #include "../../third_party/base/nonstd_unique_ptr.h" |
| 8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
| 9 #include "../include/fsdk_mgr.h" | 9 #include "../include/fsdk_mgr.h" |
| 10 #include "../include/fsdk_baseannot.h" | 10 #include "../include/fsdk_baseannot.h" |
| (...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 if (bUrlEncoded) { | 2030 if (bUrlEncoded) { |
| 2031 if (!FDFToURLEncodedData(pBuffer, nBufSize)) | 2031 if (!FDFToURLEncodedData(pBuffer, nBufSize)) |
| 2032 return FALSE; | 2032 return FALSE; |
| 2033 } | 2033 } |
| 2034 | 2034 |
| 2035 pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str()); | 2035 pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str()); |
| 2036 | 2036 |
| 2037 return TRUE; | 2037 return TRUE; |
| 2038 } | 2038 } |
| 2039 | 2039 |
| 2040 void CPDFSDK_InterForm::DoFDFBuffer(CFX_ByteString sBuffer) { | |
| 2041 ASSERT(m_pDocument != NULL); | |
| 2042 | |
| 2043 if (CFDF_Document* pFDFDocument = CFDF_Document::ParseMemory( | |
| 2044 (const unsigned char*)sBuffer.GetBuffer(sBuffer.GetLength()), | |
| 2045 sBuffer.GetLength())) { | |
| 2046 CPDF_Dictionary* pRootDic = pFDFDocument->GetRoot(); | |
| 2047 if (pRootDic) { | |
| 2048 CPDF_Dictionary* pFDFDict = pRootDic->GetDict("FDF"); | |
| 2049 if (pFDFDict) { | |
| 2050 CPDF_Dictionary* pJSDict = pFDFDict->GetDict("JavaScript"); | |
| 2051 if (pJSDict) { | |
| 2052 CFX_WideString csJS; | |
| 2053 | |
| 2054 CPDF_Object* pJS = pJSDict->GetElementValue("Before"); | |
| 2055 if (pJS != NULL) { | |
| 2056 if (pJS->IsString()) | |
| 2057 csJS = pJSDict->GetUnicodeText("Before"); | |
| 2058 else if (pJS->GetType() == PDFOBJ_STREAM) | |
| 2059 csJS = pJS->GetUnicodeText(); | |
| 2060 } | |
| 2061 } | |
| 2062 } | |
| 2063 } | |
| 2064 delete pFDFDocument; | |
| 2065 } | |
| 2066 | |
| 2067 sBuffer.ReleaseBuffer(); | |
| 2068 } | |
| 2069 | |
| 2070 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, | 2040 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, |
| 2071 CFX_WideString csTxtFile) { | 2041 CFX_WideString csTxtFile) { |
| 2072 return TRUE; | 2042 return TRUE; |
| 2073 } | 2043 } |
| 2074 | 2044 |
| 2075 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, | 2045 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, |
| 2076 FX_STRSIZE& nBufSize) { | 2046 FX_STRSIZE& nBufSize) { |
| 2077 CFDF_Document* pFDF = CFDF_Document::ParseMemory(pBuf, nBufSize); | 2047 CFDF_Document* pFDF = CFDF_Document::ParseMemory(pBuf, nBufSize); |
| 2078 if (pFDF) { | 2048 if (pFDF) { |
| 2079 CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF"); | 2049 CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF"); |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2637 ASSERT(pAnnot != NULL); | 2607 ASSERT(pAnnot != NULL); |
| 2638 | 2608 |
| 2639 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 2609 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
| 2640 ASSERT(pPDFAnnot != NULL); | 2610 ASSERT(pPDFAnnot != NULL); |
| 2641 | 2611 |
| 2642 CPDF_Rect rcAnnot; | 2612 CPDF_Rect rcAnnot; |
| 2643 pPDFAnnot->GetRect(rcAnnot); | 2613 pPDFAnnot->GetRect(rcAnnot); |
| 2644 | 2614 |
| 2645 return rcAnnot; | 2615 return rcAnnot; |
| 2646 } | 2616 } |
| OLD | NEW |