diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-30 17:29:21 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-30 17:29:21 +0000 |
commit | 1917cdd8c90b977772cdee16cf496e56dce1a2ad (patch) | |
tree | 6a3fc052a3783e4c1fcbd59713e689bd9561fb7a /fpdfsdk/cpdfsdk_widget.cpp | |
parent | af9f83656f986b1fd2316972f92f9b3f4c17f620 (diff) | |
download | pdfium-1917cdd8c90b977772cdee16cf496e56dce1a2ad.tar.xz |
Cleanup some CPDFSDK_Widget XFA code.
This CL removes unused Synchronization methods and makes methods private
which are not used externally.
Change-Id: Icd7106e20adc957b7ced45d8fc5014d84ac8a154
Reviewed-on: https://pdfium-review.googlesource.com/24590
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_widget.cpp')
-rw-r--r-- | fpdfsdk/cpdfsdk_widget.cpp | 97 |
1 files changed, 1 insertions, 96 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index e0a033ee8d..fc67059025 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -326,100 +326,6 @@ void CPDFSDK_Widget::Synchronize(bool bSynchronizeElse) { context->GetXFADocView()->ProcessValueChanged(node); } } - -void CPDFSDK_Widget::SynchronizeXFAValue() { - CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext(); - CXFA_FFDocView* pXFADocView = pContext->GetXFADocView(); - if (!pXFADocView) - return; - - if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { - if (GetXFAWidgetHandler()) { - CPDFSDK_Widget::SynchronizeXFAValue(pXFADocView, hWidget, GetFormField(), - GetFormControl()); - } - } -} - -void CPDFSDK_Widget::SynchronizeXFAItems() { - CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext(); - CXFA_FFDocView* pXFADocView = pContext->GetXFADocView(); - if (!pXFADocView) - return; - - if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { - if (GetXFAWidgetHandler()) - SynchronizeXFAItems(pXFADocView, hWidget, GetFormField(), nullptr); - } -} - -void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, - CXFA_FFWidget* hWidget, - CPDF_FormField* pFormField, - CPDF_FormControl* pFormControl) { - ASSERT(hWidget); - ASSERT(pFormControl); - - CXFA_Node* node = hWidget->GetNode(); - switch (pFormField->GetFieldType()) { - case FormFieldType::kRadioButton: - case FormFieldType::kCheckBox: { - if (node->IsWidgetReady()) { - pFormField->CheckControl(pFormField->GetControlIndex(pFormControl), - node->GetCheckState() == XFA_CHECKSTATE_On, - true); - } - break; - } - case FormFieldType::kTextField: { - if (node->IsWidgetReady()) - pFormField->SetValue(node->GetValue(XFA_VALUEPICTURE_Display), true); - break; - } - case FormFieldType::kComboBox: - case FormFieldType::kListBox: { - pFormField->ClearSelection(false); - - if (node->IsWidgetReady()) { - int32_t item_count = node->CountSelectedItems(); - for (int i = 0; i < item_count; ++i) { - int nIndex = node->GetSelectedItem(i); - if (nIndex > -1 && nIndex < pFormField->CountOptions()) - pFormField->SetItemSelection(nIndex, true, true); - } - if (pFormField->GetFieldType() == FormFieldType::kComboBox) - pFormField->SetValue(node->GetValue(XFA_VALUEPICTURE_Display), true); - } - break; - } - default: - break; - } -} - -void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, - CXFA_FFWidget* hWidget, - CPDF_FormField* pFormField, - CPDF_FormControl* pFormControl) { - ASSERT(hWidget); - - FormFieldType type = pFormField->GetFieldType(); - if (type != FormFieldType::kComboBox && type != FormFieldType::kListBox) - return; - - CXFA_Node* node = hWidget->GetNode(); - pFormField->ClearSelection(false); - pFormField->ClearOptions(type == FormFieldType::kListBox); - - if (node->IsWidgetReady()) { - for (int i = 0; i < node->CountChoiceListItems(false); ++i) { - pFormField->InsertOption(node->GetChoiceListItem(i, false).value_or(L""), - i, type == FormFieldType::kListBox); - } - } - if (pFormField->GetFieldType() == FormFieldType::kComboBox) - pFormField->SetValue(L"", true); -} #endif // PDF_ENABLE_XFA bool CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode) { @@ -515,8 +421,7 @@ int CPDFSDK_Widget::GetRotate() const { #ifdef PDF_ENABLE_XFA WideString CPDFSDK_Widget::GetName() const { - CPDF_FormField* pFormField = GetFormField(); - return pFormField->GetFullName(); + return GetFormField()->GetFullName(); } #endif // PDF_ENABLE_XFA |