Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: fpdfsdk/src/fsdk_baseform.cpp

Issue 1417933002: Add type cast definitions for CPDF_String. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
Lei Zhang 2015/10/21 16:55:57 no blank line
dsinclair 2015/10/21 17:08:05 Done.
2234 } else if (pObject->IsDictionary()) {
2236 if (m_pInterForm->IsValidFormField(pObject)) 2235 if (m_pInterForm->IsValidFormField(pObject))
2237 fields.Add(pObject); 2236 fields.Add(pObject);
2238 } 2237 }
2239 } 2238 }
2240 } 2239 }
2241 2240
2242 /* ----------------------------- CPDF_FormNotify ----------------------------- 2241 /* ----------------------------- CPDF_FormNotify -----------------------------
2243 */ 2242 */
2244 2243
2245 int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, 2244 int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField,
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
2639 ASSERT(pAnnot != NULL); 2638 ASSERT(pAnnot != NULL);
2640 2639
2641 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 2640 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
2642 ASSERT(pPDFAnnot != NULL); 2641 ASSERT(pPDFAnnot != NULL);
2643 2642
2644 CPDF_Rect rcAnnot; 2643 CPDF_Rect rcAnnot;
2645 pPDFAnnot->GetRect(rcAnnot); 2644 pPDFAnnot->GetRect(rcAnnot);
2646 2645
2647 return rcAnnot; 2646 return rcAnnot;
2648 } 2647 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698