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/fpdfxfa/fpdfxfa_doc.h" | 9 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
10 #include "../include/fpdfxfa/fpdfxfa_util.h" | 10 #include "../include/fpdfxfa/fpdfxfa_util.h" |
(...skipping 2687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2698 if (bUrlEncoded) { | 2698 if (bUrlEncoded) { |
2699 if (!FDFToURLEncodedData(pBuffer, nBufSize)) | 2699 if (!FDFToURLEncodedData(pBuffer, nBufSize)) |
2700 return FALSE; | 2700 return FALSE; |
2701 } | 2701 } |
2702 | 2702 |
2703 pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str()); | 2703 pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str()); |
2704 | 2704 |
2705 return TRUE; | 2705 return TRUE; |
2706 } | 2706 } |
2707 | 2707 |
2708 void CPDFSDK_InterForm::DoFDFBuffer(CFX_ByteString sBuffer) { | |
2709 ASSERT(m_pDocument != NULL); | |
2710 | |
2711 if (CFDF_Document* pFDFDocument = CFDF_Document::ParseMemory( | |
2712 (const unsigned char*)sBuffer.GetBuffer(sBuffer.GetLength()), | |
2713 sBuffer.GetLength())) { | |
2714 CPDF_Dictionary* pRootDic = pFDFDocument->GetRoot(); | |
2715 if (pRootDic) { | |
2716 CPDF_Dictionary* pFDFDict = pRootDic->GetDict("FDF"); | |
2717 if (pFDFDict) { | |
2718 CPDF_Dictionary* pJSDict = pFDFDict->GetDict("JavaScript"); | |
2719 if (pJSDict) { | |
2720 CFX_WideString csJS; | |
2721 | |
2722 CPDF_Object* pJS = pJSDict->GetElementValue("Before"); | |
2723 if (pJS != NULL) { | |
2724 if (pJS->IsString()) | |
2725 csJS = pJSDict->GetUnicodeText("Before"); | |
2726 else if (pJS->GetType() == PDFOBJ_STREAM) | |
2727 csJS = pJS->GetUnicodeText(); | |
2728 } | |
2729 } | |
2730 } | |
2731 } | |
2732 delete pFDFDocument; | |
2733 } | |
2734 | |
2735 sBuffer.ReleaseBuffer(); | |
2736 } | |
2737 | |
2738 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, | 2708 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, |
2739 CFX_WideString csTxtFile) { | 2709 CFX_WideString csTxtFile) { |
2740 return TRUE; | 2710 return TRUE; |
2741 } | 2711 } |
2742 | 2712 |
2743 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, | 2713 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, |
2744 FX_STRSIZE& nBufSize) { | 2714 FX_STRSIZE& nBufSize) { |
2745 CFDF_Document* pFDF = CFDF_Document::ParseMemory(pBuf, nBufSize); | 2715 CFDF_Document* pFDF = CFDF_Document::ParseMemory(pBuf, nBufSize); |
2746 if (pFDF) { | 2716 if (pFDF) { |
2747 CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF"); | 2717 CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF"); |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3326 ASSERT(pAnnot != NULL); | 3296 ASSERT(pAnnot != NULL); |
3327 | 3297 |
3328 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 3298 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
3329 ASSERT(pPDFAnnot != NULL); | 3299 ASSERT(pPDFAnnot != NULL); |
3330 | 3300 |
3331 CPDF_Rect rcAnnot; | 3301 CPDF_Rect rcAnnot; |
3332 pPDFAnnot->GetRect(rcAnnot); | 3302 pPDFAnnot->GetRect(rcAnnot); |
3333 | 3303 |
3334 return rcAnnot; | 3304 return rcAnnot; |
3335 } | 3305 } |
OLD | NEW |