summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp97
-rw-r--r--fpdfsdk/cpdfsdk_widget.h20
2 files changed, 6 insertions, 111 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
diff --git a/fpdfsdk/cpdfsdk_widget.h b/fpdfsdk/cpdfsdk_widget.h
index 4b1115043f..22d0e364c1 100644
--- a/fpdfsdk/cpdfsdk_widget.h
+++ b/fpdfsdk/cpdfsdk_widget.h
@@ -38,7 +38,6 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
public:
#ifdef PDF_ENABLE_XFA
CXFA_FFWidget* GetMixXFAWidget() const;
- CXFA_FFWidget* GetGroupMixXFAWidget();
CXFA_FFWidgetHandler* GetXFAWidgetHandler() const;
bool HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT);
@@ -47,17 +46,6 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
CPDFSDK_PageView* pPageView);
void Synchronize(bool bSynchronizeElse);
- void SynchronizeXFAValue();
- void SynchronizeXFAItems();
-
- static void SynchronizeXFAValue(CXFA_FFDocView* pXFADocView,
- CXFA_FFWidget* hWidget,
- CPDF_FormField* pFormField,
- CPDF_FormControl* pFormControl);
- static void SynchronizeXFAItems(CXFA_FFDocView* pXFADocView,
- CXFA_FFWidget* hWidget,
- CPDF_FormField* pFormField,
- CPDF_FormControl* pFormControl);
#endif // PDF_ENABLE_XFA
CPDFSDK_Widget(CPDF_Annot* pAnnot,
@@ -94,9 +82,6 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
bool IsChecked() const;
int GetAlignment() const;
int GetMaxLen() const;
-#ifdef PDF_ENABLE_XFA
- WideString GetName() const;
-#endif // PDF_ENABLE_XFA
WideString GetAlternateName() const;
void SetCheck(bool bChecked, bool bNotify);
@@ -147,6 +132,11 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
CFX_Color GetFillPWLColor() const;
private:
+#ifdef PDF_ENABLE_XFA
+ CXFA_FFWidget* GetGroupMixXFAWidget();
+ WideString GetName() const;
+#endif // PDF_ENABLE_XFA
+
UnownedPtr<CPDFSDK_InterForm> const m_pInterForm;
bool m_bAppModified;
uint32_t m_nAppearanceAge;