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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 } | 289 } |
290 | 290 |
291 if (bRefresh) { | 291 if (bRefresh) { |
292 // Refresh the widget list. The calls in |bResetAP| may have caused widgets | 292 // Refresh the widget list. The calls in |bResetAP| may have caused widgets |
293 // to be removed from the list. We need to call |GetWidgets| again to be | 293 // to be removed from the list. We need to call |GetWidgets| again to be |
294 // sure none of the widgets have been deleted. | 294 // sure none of the widgets have been deleted. |
295 std::vector<CPDFSDK_Widget*> widgets; | 295 std::vector<CPDFSDK_Widget*> widgets; |
296 pInterForm->GetWidgets(pFormField, &widgets); | 296 pInterForm->GetWidgets(pFormField, &widgets); |
297 | 297 |
298 for (CPDFSDK_Widget* pWidget : widgets) { | 298 for (CPDFSDK_Widget* pWidget : widgets) { |
299 CPDFSDK_Document* pDoc = pWidget->GetInterForm()->GetDocument(); | 299 pWidget->GetInterForm() |
300 pDoc->UpdateAllViews(nullptr, pWidget); | 300 ->GetFormFillEnv() |
301 ->GetSDKDocument() | |
Tom Sepez
2016/10/06 18:42:06
is the document invariant across the all widgets?
dsinclair
2016/10/06 19:21:23
a document has a single InterForm, but I haven't d
| |
302 ->UpdateAllViews(nullptr, pWidget); | |
301 } | 303 } |
302 } | 304 } |
303 | 305 |
304 if (bChangeMark) | 306 if (bChangeMark) |
305 pDocument->SetChangeMark(); | 307 pDocument->SetChangeMark(); |
306 } | 308 } |
307 | 309 |
308 void Field::UpdateFormControl(CPDFSDK_Document* pDocument, | 310 void Field::UpdateFormControl(CPDFSDK_Document* pDocument, |
309 CPDF_FormControl* pFormControl, | 311 CPDF_FormControl* pFormControl, |
310 FX_BOOL bChangeMark, | 312 FX_BOOL bChangeMark, |
(...skipping 12 matching lines...) Expand all Loading... | |
323 FX_BOOL bFormatted = FALSE; | 325 FX_BOOL bFormatted = FALSE; |
324 CFX_WideString sValue = pWidget->OnFormat(bFormatted); | 326 CFX_WideString sValue = pWidget->OnFormat(bFormatted); |
325 pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE); | 327 pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE); |
326 } else { | 328 } else { |
327 pWidget->ResetAppearance(nullptr, FALSE); | 329 pWidget->ResetAppearance(nullptr, FALSE); |
328 } | 330 } |
329 } | 331 } |
330 | 332 |
331 if (bRefresh) { | 333 if (bRefresh) { |
332 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); | 334 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); |
333 CPDFSDK_Document* pDoc = pInterForm->GetDocument(); | 335 pInterForm->GetFormFillEnv()->GetSDKDocument()->UpdateAllViews(nullptr, |
334 pDoc->UpdateAllViews(nullptr, pWidget); | 336 pWidget); |
335 } | 337 } |
336 } | 338 } |
337 | 339 |
338 if (bChangeMark) | 340 if (bChangeMark) |
339 pDocument->SetChangeMark(); | 341 pDocument->SetChangeMark(); |
340 } | 342 } |
341 | 343 |
342 CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument, | 344 CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument, |
343 CPDF_FormControl* pFormControl, | 345 CPDF_FormControl* pFormControl, |
344 bool createIfNeeded) { | 346 bool createIfNeeded) { |
(...skipping 3147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3492 } | 3494 } |
3493 } | 3495 } |
3494 | 3496 |
3495 void Field::AddField(CPDFSDK_Document* pDocument, | 3497 void Field::AddField(CPDFSDK_Document* pDocument, |
3496 int nPageIndex, | 3498 int nPageIndex, |
3497 int nFieldType, | 3499 int nFieldType, |
3498 const CFX_WideString& sName, | 3500 const CFX_WideString& sName, |
3499 const CFX_FloatRect& rcCoords) { | 3501 const CFX_FloatRect& rcCoords) { |
3500 // Not supported. | 3502 // Not supported. |
3501 } | 3503 } |
OLD | NEW |