Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/cpdfsdk_interform.h" | 7 #include "fpdfsdk/cpdfsdk_interform.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 return; | 229 return; |
| 230 | 230 |
| 231 m_bBusy = TRUE; | 231 m_bBusy = TRUE; |
| 232 | 232 |
| 233 if (!IsCalculateEnabled()) { | 233 if (!IsCalculateEnabled()) { |
| 234 m_bBusy = FALSE; | 234 m_bBusy = FALSE; |
| 235 return; | 235 return; |
| 236 } | 236 } |
| 237 | 237 |
| 238 IJS_Runtime* pRuntime = m_pFormFillEnv->GetJSRuntime(); | 238 IJS_Runtime* pRuntime = m_pFormFillEnv->GetJSRuntime(); |
| 239 pRuntime->SetReaderDocument(m_pFormFillEnv->GetSDKDocument()); | |
|
Tom Sepez
2016/10/11 16:17:13
Remind me again why we think documents are 1:1 wit
dsinclair
2016/10/11 17:37:45
The GetJSRuntime method, if it doesn't already exi
| |
| 240 | |
| 241 int nSize = m_pInterForm->CountFieldsInCalculationOrder(); | 239 int nSize = m_pInterForm->CountFieldsInCalculationOrder(); |
| 242 for (int i = 0; i < nSize; i++) { | 240 for (int i = 0; i < nSize; i++) { |
| 243 CPDF_FormField* pField = m_pInterForm->GetFieldInCalculationOrder(i); | 241 CPDF_FormField* pField = m_pInterForm->GetFieldInCalculationOrder(i); |
| 244 if (!pField) | 242 if (!pField) |
| 245 continue; | 243 continue; |
| 246 | 244 |
| 247 int nType = pField->GetFieldType(); | 245 int nType = pField->GetFieldType(); |
| 248 if (nType != FIELDTYPE_COMBOBOX && nType != FIELDTYPE_TEXTFIELD) | 246 if (nType != FIELDTYPE_COMBOBOX && nType != FIELDTYPE_TEXTFIELD) |
| 249 continue; | 247 continue; |
| 250 | 248 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 279 | 277 |
| 280 CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, | 278 CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, |
| 281 FX_BOOL& bFormatted) { | 279 FX_BOOL& bFormatted) { |
| 282 CFX_WideString sValue = pFormField->GetValue(); | 280 CFX_WideString sValue = pFormField->GetValue(); |
| 283 if (!m_pFormFillEnv->IsJSInitiated()) { | 281 if (!m_pFormFillEnv->IsJSInitiated()) { |
| 284 bFormatted = FALSE; | 282 bFormatted = FALSE; |
| 285 return sValue; | 283 return sValue; |
| 286 } | 284 } |
| 287 | 285 |
| 288 IJS_Runtime* pRuntime = m_pFormFillEnv->GetJSRuntime(); | 286 IJS_Runtime* pRuntime = m_pFormFillEnv->GetJSRuntime(); |
| 289 pRuntime->SetReaderDocument(m_pFormFillEnv->GetSDKDocument()); | |
|
dsinclair
2016/10/11 17:37:45
Same reasoning as above.
| |
| 290 | |
| 291 if (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX && | 287 if (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX && |
| 292 pFormField->CountSelectedItems() > 0) { | 288 pFormField->CountSelectedItems() > 0) { |
| 293 int index = pFormField->GetSelectedIndex(0); | 289 int index = pFormField->GetSelectedIndex(0); |
| 294 if (index >= 0) | 290 if (index >= 0) |
| 295 sValue = pFormField->GetOptionLabel(index); | 291 sValue = pFormField->GetOptionLabel(index); |
| 296 } | 292 } |
| 297 | 293 |
| 298 bFormatted = FALSE; | 294 bFormatted = FALSE; |
| 299 | 295 |
| 300 CPDF_AAction aAction = pFormField->GetAdditionalAction(); | 296 CPDF_AAction aAction = pFormField->GetAdditionalAction(); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 716 } | 712 } |
| 717 } | 713 } |
| 718 | 714 |
| 719 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) { | 715 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) { |
| 720 if (nFieldType < 0 || nFieldType > kNumFieldTypes) | 716 if (nFieldType < 0 || nFieldType > kNumFieldTypes) |
| 721 return FXSYS_RGB(255, 255, 255); | 717 return FXSYS_RGB(255, 255, 255); |
| 722 if (nFieldType == 0) | 718 if (nFieldType == 0) |
| 723 return m_aHighlightColor[0]; | 719 return m_aHighlightColor[0]; |
| 724 return m_aHighlightColor[nFieldType - 1]; | 720 return m_aHighlightColor[nFieldType - 1]; |
| 725 } | 721 } |
| OLD | NEW |