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/include/fsdk_baseform.h" | 7 #include "fpdfsdk/include/fsdk_baseform.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) { | 260 void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) { |
261 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { | 261 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { |
262 CPDF_FormField* pFormField = GetFormField(); | 262 CPDF_FormField* pFormField = GetFormField(); |
263 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { | 263 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { |
264 switch (GetFieldType()) { | 264 switch (GetFieldType()) { |
265 case FIELDTYPE_CHECKBOX: | 265 case FIELDTYPE_CHECKBOX: |
266 case FIELDTYPE_RADIOBUTTON: { | 266 case FIELDTYPE_RADIOBUTTON: { |
267 CPDF_FormControl* pFormCtrl = GetFormControl(); | 267 CPDF_FormControl* pFormCtrl = GetFormControl(); |
268 XFA_CHECKSTATE eCheckState = | 268 XFA_CHECKSTATE eCheckState = |
269 pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off; | 269 pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off; |
270 pWidgetAcc->SetCheckState(eCheckState); | 270 pWidgetAcc->SetCheckState(eCheckState, true); |
271 } break; | 271 } break; |
272 case FIELDTYPE_TEXTFIELD: | 272 case FIELDTYPE_TEXTFIELD: |
273 pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit); | 273 pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit); |
274 break; | 274 break; |
275 case FIELDTYPE_LISTBOX: { | 275 case FIELDTYPE_LISTBOX: { |
276 pWidgetAcc->ClearAllSelections(); | 276 pWidgetAcc->ClearAllSelections(); |
277 | 277 |
278 for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) { | 278 for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) { |
279 int nIndex = pFormField->GetSelectedIndex(i); | 279 int nIndex = pFormField->GetSelectedIndex(i); |
280 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) | 280 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) |
281 pWidgetAcc->SetItemState(nIndex, TRUE, FALSE); | 281 pWidgetAcc->SetItemState(nIndex, TRUE, false, FALSE, TRUE); |
282 } | 282 } |
283 } break; | 283 } break; |
284 case FIELDTYPE_COMBOBOX: { | 284 case FIELDTYPE_COMBOBOX: { |
285 pWidgetAcc->ClearAllSelections(); | 285 pWidgetAcc->ClearAllSelections(); |
286 | 286 |
287 for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) { | 287 for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) { |
288 int nIndex = pFormField->GetSelectedIndex(i); | 288 int nIndex = pFormField->GetSelectedIndex(i); |
289 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) | 289 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) |
290 pWidgetAcc->SetItemState(nIndex, TRUE, FALSE); | 290 pWidgetAcc->SetItemState(nIndex, TRUE, false, FALSE, TRUE); |
291 } | 291 } |
292 } | 292 } |
293 | 293 |
294 pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit); | 294 pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit); |
295 break; | 295 break; |
296 } | 296 } |
297 | 297 |
298 if (bSynchronizeElse) | 298 if (bSynchronizeElse) |
299 pWidgetAcc->ProcessValueChanged(); | 299 pWidgetAcc->ProcessValueChanged(); |
300 } | 300 } |
(...skipping 2505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2806 break; | 2806 break; |
2807 } | 2807 } |
2808 } | 2808 } |
2809 } | 2809 } |
2810 | 2810 |
2811 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) { | 2811 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) { |
2812 CFX_FloatRect rcAnnot; | 2812 CFX_FloatRect rcAnnot; |
2813 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); | 2813 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); |
2814 return rcAnnot; | 2814 return rcAnnot; |
2815 } | 2815 } |
OLD | NEW |