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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 FX_BOOL bRefresh) { | 221 FX_BOOL bRefresh) { |
222 std::vector<CPDFSDK_Widget*> widgets; | 222 std::vector<CPDFSDK_Widget*> widgets; |
223 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); | 223 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); |
224 pInterForm->GetWidgets(pFormField, &widgets); | 224 pInterForm->GetWidgets(pFormField, &widgets); |
225 | 225 |
226 if (bResetAP) { | 226 if (bResetAP) { |
227 int nFieldType = pFormField->GetFieldType(); | 227 int nFieldType = pFormField->GetFieldType(); |
228 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) { | 228 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) { |
229 for (CPDFSDK_Widget* pWidget : widgets) { | 229 for (CPDFSDK_Widget* pWidget : widgets) { |
230 FX_BOOL bFormatted = FALSE; | 230 FX_BOOL bFormatted = FALSE; |
| 231 CPDFSDK_Widget::Observer observer(&pWidget); |
231 CFX_WideString sValue = pWidget->OnFormat(bFormatted); | 232 CFX_WideString sValue = pWidget->OnFormat(bFormatted); |
232 pWidget->ResetAppearance(bFormatted ? sValue.c_str() : nullptr, FALSE); | 233 if (pWidget) { |
| 234 pWidget->ResetAppearance(bFormatted ? sValue.c_str() : nullptr, |
| 235 FALSE); |
| 236 } |
233 } | 237 } |
234 } else { | 238 } else { |
235 for (CPDFSDK_Widget* pWidget : widgets) { | 239 for (CPDFSDK_Widget* pWidget : widgets) { |
236 pWidget->ResetAppearance(nullptr, FALSE); | 240 pWidget->ResetAppearance(nullptr, FALSE); |
237 } | 241 } |
238 } | 242 } |
239 } | 243 } |
240 | 244 |
241 if (bRefresh) { | 245 if (bRefresh) { |
242 for (CPDFSDK_Widget* pWidget : widgets) { | 246 for (CPDFSDK_Widget* pWidget : widgets) { |
(...skipping 3288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3531 } | 3535 } |
3532 } | 3536 } |
3533 | 3537 |
3534 void Field::AddField(CPDFSDK_Document* pDocument, | 3538 void Field::AddField(CPDFSDK_Document* pDocument, |
3535 int nPageIndex, | 3539 int nPageIndex, |
3536 int nFieldType, | 3540 int nFieldType, |
3537 const CFX_WideString& sName, | 3541 const CFX_WideString& sName, |
3538 const CFX_FloatRect& rcCoords) { | 3542 const CFX_FloatRect& rcCoords) { |
3539 // Not supported. | 3543 // Not supported. |
3540 } | 3544 } |
OLD | NEW |