| 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 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2046 CPDF_Dictionary* pRootDic = pFDFDocument->GetRoot(); | 2046 CPDF_Dictionary* pRootDic = pFDFDocument->GetRoot(); |
| 2047 if (pRootDic) { | 2047 if (pRootDic) { |
| 2048 CPDF_Dictionary* pFDFDict = pRootDic->GetDict("FDF"); | 2048 CPDF_Dictionary* pFDFDict = pRootDic->GetDict("FDF"); |
| 2049 if (pFDFDict) { | 2049 if (pFDFDict) { |
| 2050 CPDF_Dictionary* pJSDict = pFDFDict->GetDict("JavaScript"); | 2050 CPDF_Dictionary* pJSDict = pFDFDict->GetDict("JavaScript"); |
| 2051 if (pJSDict) { | 2051 if (pJSDict) { |
| 2052 CFX_WideString csJS; | 2052 CFX_WideString csJS; |
| 2053 | 2053 |
| 2054 CPDF_Object* pJS = pJSDict->GetElementValue("Before"); | 2054 CPDF_Object* pJS = pJSDict->GetElementValue("Before"); |
| 2055 if (pJS != NULL) { | 2055 if (pJS != NULL) { |
| 2056 int iType = pJS->GetType(); | 2056 if (pJS->IsString()) |
| 2057 if (iType == PDFOBJ_STRING) | |
| 2058 csJS = pJSDict->GetUnicodeText("Before"); | 2057 csJS = pJSDict->GetUnicodeText("Before"); |
| 2059 else if (iType == PDFOBJ_STREAM) | 2058 else if (pJS->GetType() == PDFOBJ_STREAM) |
| 2060 csJS = pJS->GetUnicodeText(); | 2059 csJS = pJS->GetUnicodeText(); |
| 2061 } | 2060 } |
| 2062 } | 2061 } |
| 2063 } | 2062 } |
| 2064 } | 2063 } |
| 2065 delete pFDFDocument; | 2064 delete pFDFDocument; |
| 2066 } | 2065 } |
| 2067 | 2066 |
| 2068 sBuffer.ReleaseBuffer(); | 2067 sBuffer.ReleaseBuffer(); |
| 2069 } | 2068 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2219 void CPDFSDK_InterForm::GetFieldFromObjects(const CFX_PtrArray& objects, | 2218 void CPDFSDK_InterForm::GetFieldFromObjects(const CFX_PtrArray& objects, |
| 2220 CFX_PtrArray& fields) { | 2219 CFX_PtrArray& fields) { |
| 2221 ASSERT(m_pInterForm != NULL); | 2220 ASSERT(m_pInterForm != NULL); |
| 2222 | 2221 |
| 2223 int iCount = objects.GetSize(); | 2222 int iCount = objects.GetSize(); |
| 2224 for (int i = 0; i < iCount; i++) { | 2223 for (int i = 0; i < iCount; i++) { |
| 2225 CPDF_Object* pObject = (CPDF_Object*)objects[i]; | 2224 CPDF_Object* pObject = (CPDF_Object*)objects[i]; |
| 2226 if (pObject == NULL) | 2225 if (pObject == NULL) |
| 2227 continue; | 2226 continue; |
| 2228 | 2227 |
| 2229 int iType = pObject->GetType(); | 2228 if (pObject->IsString()) { |
| 2230 if (iType == PDFOBJ_STRING) { | |
| 2231 CFX_WideString csName = pObject->GetUnicodeText(); | 2229 CFX_WideString csName = pObject->GetUnicodeText(); |
| 2232 CPDF_FormField* pField = m_pInterForm->GetField(0, csName); | 2230 CPDF_FormField* pField = m_pInterForm->GetField(0, csName); |
| 2233 if (pField != NULL) | 2231 if (pField != NULL) |
| 2234 fields.Add(pField); | 2232 fields.Add(pField); |
| 2235 } else if (iType == PDFOBJ_DICTIONARY) { | 2233 } else if (pObject->IsDictionary()) { |
| 2236 if (m_pInterForm->IsValidFormField(pObject)) | 2234 if (m_pInterForm->IsValidFormField(pObject)) |
| 2237 fields.Add(pObject); | 2235 fields.Add(pObject); |
| 2238 } | 2236 } |
| 2239 } | 2237 } |
| 2240 } | 2238 } |
| 2241 | 2239 |
| 2242 /* ----------------------------- CPDF_FormNotify ----------------------------- | 2240 /* ----------------------------- CPDF_FormNotify ----------------------------- |
| 2243 */ | 2241 */ |
| 2244 | 2242 |
| 2245 int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, | 2243 int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2639 ASSERT(pAnnot != NULL); | 2637 ASSERT(pAnnot != NULL); |
| 2640 | 2638 |
| 2641 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 2639 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
| 2642 ASSERT(pPDFAnnot != NULL); | 2640 ASSERT(pPDFAnnot != NULL); |
| 2643 | 2641 |
| 2644 CPDF_Rect rcAnnot; | 2642 CPDF_Rect rcAnnot; |
| 2645 pPDFAnnot->GetRect(rcAnnot); | 2643 pPDFAnnot->GetRect(rcAnnot); |
| 2646 | 2644 |
| 2647 return rcAnnot; | 2645 return rcAnnot; |
| 2648 } | 2646 } |
| OLD | NEW |