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

Side by Side Diff: fpdfsdk/javascript/Document.cpp

Issue 2380753003: Remove dead code from CPDF_InterForm. (Closed)
Patch Set: nit Created 4 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
« no previous file with comments | « fpdfsdk/cpdfsdk_pageview.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "fpdfsdk/javascript/Document.h" 7 #include "fpdfsdk/javascript/Document.h"
8 8
9 #include <utility>
9 #include <vector> 10 #include <vector>
10 11
11 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" 12 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
12 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" 13 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
13 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 14 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
14 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 15 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
15 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" 16 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
16 #include "core/fpdfdoc/include/cpdf_interform.h" 17 #include "core/fpdfdoc/include/cpdf_interform.h"
17 #include "core/fpdfdoc/include/cpdf_nametree.h" 18 #include "core/fpdfdoc/include/cpdf_nametree.h"
18 #include "fpdfsdk/include/cpdfsdk_annotiterator.h" 19 #include "fpdfsdk/include/cpdfsdk_annotiterator.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 if (vp.IsSetting()) { 168 if (vp.IsSetting()) {
168 sError = JSGetStringFromID(IDS_STRING_JSREADONLY); 169 sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
169 return FALSE; 170 return FALSE;
170 } 171 }
171 if (!m_pDocument) { 172 if (!m_pDocument) {
172 sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); 173 sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
173 return FALSE; 174 return FALSE;
174 } 175 }
175 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); 176 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm();
176 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); 177 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
177 vp << (int)pPDFForm->CountFields(); 178 vp << static_cast<int>(pPDFForm->CountFields(CFX_WideString()));
178 return TRUE; 179 return TRUE;
179 } 180 }
180 181
181 FX_BOOL Document::dirty(IJS_Context* cc, 182 FX_BOOL Document::dirty(IJS_Context* cc,
182 CJS_PropValue& vp, 183 CJS_PropValue& vp,
183 CFX_WideString& sError) { 184 CFX_WideString& sError) {
184 if (!m_pDocument) { 185 if (!m_pDocument) {
185 sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); 186 sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
186 return FALSE; 187 return FALSE;
187 } 188 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 331 }
331 CJS_Context* pContext = static_cast<CJS_Context*>(cc); 332 CJS_Context* pContext = static_cast<CJS_Context*>(cc);
332 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 333 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
333 int nIndex = params[0].ToInt(pRuntime); 334 int nIndex = params[0].ToInt(pRuntime);
334 if (nIndex < 0) { 335 if (nIndex < 0) {
335 sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR); 336 sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR);
336 return FALSE; 337 return FALSE;
337 } 338 }
338 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); 339 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm();
339 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); 340 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
340 CPDF_FormField* pField = pPDFForm->GetField(nIndex); 341 CPDF_FormField* pField = pPDFForm->GetField(nIndex, CFX_WideString());
341 if (!pField) 342 if (!pField)
342 return FALSE; 343 return FALSE;
343 344
344 vRet = CJS_Value(pRuntime, pField->GetFullName().c_str()); 345 vRet = CJS_Value(pRuntime, pField->GetFullName().c_str());
345 return TRUE; 346 return TRUE;
346 } 347 }
347 348
348 FX_BOOL Document::importAnFDF(IJS_Context* cc, 349 FX_BOOL Document::importAnFDF(IJS_Context* cc,
349 const std::vector<CJS_Value>& params, 350 const std::vector<CJS_Value>& params,
350 CJS_Value& vRet, 351 CJS_Value& vRet,
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 const std::vector<CJS_Value>& params, 610 const std::vector<CJS_Value>& params,
610 CJS_Value& vRet, 611 CJS_Value& vRet,
611 CFX_WideString& sError) { 612 CFX_WideString& sError) {
612 return TRUE; 613 return TRUE;
613 } 614 }
614 615
615 FX_BOOL Document::submitForm(IJS_Context* cc, 616 FX_BOOL Document::submitForm(IJS_Context* cc,
616 const std::vector<CJS_Value>& params, 617 const std::vector<CJS_Value>& params,
617 CJS_Value& vRet, 618 CJS_Value& vRet,
618 CFX_WideString& sError) { 619 CFX_WideString& sError) {
619
620 int nSize = params.size(); 620 int nSize = params.size();
621 if (nSize < 1) { 621 if (nSize < 1) {
622 sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); 622 sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
623 return FALSE; 623 return FALSE;
624 } 624 }
625 if (!m_pDocument) { 625 if (!m_pDocument) {
626 sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); 626 sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
627 return FALSE; 627 return FALSE;
628 } 628 }
629 CJS_Context* pContext = static_cast<CJS_Context*>(cc); 629 CJS_Context* pContext = static_cast<CJS_Context*>(cc);
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 1227
1228 bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) { 1228 bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) {
1229 return (rect.left <= LinkRect.left && rect.top <= LinkRect.top && 1229 return (rect.left <= LinkRect.left && rect.top <= LinkRect.top &&
1230 rect.right >= LinkRect.right && rect.bottom >= LinkRect.bottom); 1230 rect.right >= LinkRect.right && rect.bottom >= LinkRect.bottom);
1231 } 1231 }
1232 1232
1233 FX_BOOL Document::addIcon(IJS_Context* cc, 1233 FX_BOOL Document::addIcon(IJS_Context* cc,
1234 const std::vector<CJS_Value>& params, 1234 const std::vector<CJS_Value>& params,
1235 CJS_Value& vRet, 1235 CJS_Value& vRet,
1236 CFX_WideString& sError) { 1236 CFX_WideString& sError) {
1237
1238 if (params.size() != 2) { 1237 if (params.size() != 2) {
1239 sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); 1238 sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
1240 return FALSE; 1239 return FALSE;
1241 } 1240 }
1242 1241
1243 CJS_Context* pContext = static_cast<CJS_Context*>(cc); 1242 CJS_Context* pContext = static_cast<CJS_Context*>(cc);
1244 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 1243 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
1245 CFX_WideString swIconName = params[0].ToCFXWideString(pRuntime); 1244 CFX_WideString swIconName = params[0].ToCFXWideString(pRuntime);
1246 1245
1247 if (params[1].GetType() != CJS_Value::VT_object) { 1246 if (params[1].GetType() != CJS_Value::VT_object) {
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 } 1719 }
1721 } 1720 }
1722 1721
1723 for (const auto& pData : DelayDataForFieldAndControlIndex) 1722 for (const auto& pData : DelayDataForFieldAndControlIndex)
1724 Field::DoDelay(m_pDocument.Get(), pData.get()); 1723 Field::DoDelay(m_pDocument.Get(), pData.get());
1725 } 1724 }
1726 1725
1727 CJS_Document* Document::GetCJSDoc() const { 1726 CJS_Document* Document::GetCJSDoc() const {
1728 return static_cast<CJS_Document*>(m_pJSObject); 1727 return static_cast<CJS_Document*>(m_pJSObject);
1729 } 1728 }
OLDNEW
« no previous file with comments | « fpdfsdk/cpdfsdk_pageview.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698