| 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 "fpdfsdk/javascript/Field.h" | 7 #include "fpdfsdk/javascript/Field.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 int& iControlNo) { | 137 int& iControlNo) { |
| 138 int iStart = strFieldNameParsed.find_last_of(L'.'); | 138 int iStart = strFieldNameParsed.find_last_of(L'.'); |
| 139 if (iStart == -1) { | 139 if (iStart == -1) { |
| 140 strFieldName = strFieldNameParsed; | 140 strFieldName = strFieldNameParsed; |
| 141 iControlNo = -1; | 141 iControlNo = -1; |
| 142 return; | 142 return; |
| 143 } | 143 } |
| 144 std::wstring suffixal = strFieldNameParsed.substr(iStart + 1); | 144 std::wstring suffixal = strFieldNameParsed.substr(iStart + 1); |
| 145 iControlNo = FXSYS_wtoi(suffixal.c_str()); | 145 iControlNo = FXSYS_wtoi(suffixal.c_str()); |
| 146 if (iControlNo == 0) { | 146 if (iControlNo == 0) { |
| 147 int iStart; | 147 int iSpaceStart; |
| 148 while ((iStart = suffixal.find_last_of(L" ")) != -1) { | 148 while ((iSpaceStart = suffixal.find_last_of(L" ")) != -1) { |
| 149 suffixal.erase(iStart, 1); | 149 suffixal.erase(iSpaceStart, 1); |
| 150 } | 150 } |
| 151 | 151 |
| 152 if (suffixal.compare(L"0") != 0) { | 152 if (suffixal.compare(L"0") != 0) { |
| 153 strFieldName = strFieldNameParsed; | 153 strFieldName = strFieldNameParsed; |
| 154 iControlNo = -1; | 154 iControlNo = -1; |
| 155 return; | 155 return; |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 strFieldName = strFieldNameParsed.substr(0, iStart); | 158 strFieldName = strFieldNameParsed.substr(0, iStart); |
| 159 } | 159 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 pDocument->SetChangeMark(); | 242 pDocument->SetChangeMark(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 void Field::UpdateFormControl(CPDFSDK_Document* pDocument, | 245 void Field::UpdateFormControl(CPDFSDK_Document* pDocument, |
| 246 CPDF_FormControl* pFormControl, | 246 CPDF_FormControl* pFormControl, |
| 247 FX_BOOL bChangeMark, | 247 FX_BOOL bChangeMark, |
| 248 FX_BOOL bResetAP, | 248 FX_BOOL bResetAP, |
| 249 FX_BOOL bRefresh) { | 249 FX_BOOL bRefresh) { |
| 250 ASSERT(pFormControl); | 250 ASSERT(pFormControl); |
| 251 | 251 |
| 252 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 252 CPDFSDK_InterForm* pForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); |
| 253 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl); | 253 CPDFSDK_Widget* pWidget = pForm->GetWidget(pFormControl); |
| 254 | 254 |
| 255 if (pWidget) { | 255 if (pWidget) { |
| 256 if (bResetAP) { | 256 if (bResetAP) { |
| 257 int nFieldType = pWidget->GetFieldType(); | 257 int nFieldType = pWidget->GetFieldType(); |
| 258 if (nFieldType == FIELDTYPE_COMBOBOX || | 258 if (nFieldType == FIELDTYPE_COMBOBOX || |
| 259 nFieldType == FIELDTYPE_TEXTFIELD) { | 259 nFieldType == FIELDTYPE_TEXTFIELD) { |
| 260 FX_BOOL bFormated = FALSE; | 260 FX_BOOL bFormated = FALSE; |
| 261 CFX_WideString sValue = pWidget->OnFormat(bFormated); | 261 CFX_WideString sValue = pWidget->OnFormat(bFormated); |
| 262 if (bFormated) | 262 if (bFormated) |
| 263 pWidget->ResetAppearance(sValue.c_str(), FALSE); | 263 pWidget->ResetAppearance(sValue.c_str(), FALSE); |
| (...skipping 3283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3547 } | 3547 } |
| 3548 } | 3548 } |
| 3549 | 3549 |
| 3550 void Field::AddField(CPDFSDK_Document* pDocument, | 3550 void Field::AddField(CPDFSDK_Document* pDocument, |
| 3551 int nPageIndex, | 3551 int nPageIndex, |
| 3552 int nFieldType, | 3552 int nFieldType, |
| 3553 const CFX_WideString& sName, | 3553 const CFX_WideString& sName, |
| 3554 const CFX_FloatRect& rcCoords) { | 3554 const CFX_FloatRect& rcCoords) { |
| 3555 // Not supported. | 3555 // Not supported. |
| 3556 } | 3556 } |
| OLD | NEW |