summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/fsdk_baseform.cpp22
-rw-r--r--fpdfsdk/include/fsdk_baseform.h6
2 files changed, 10 insertions, 18 deletions
diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp
index 4a2540093f..6693de1250 100644
--- a/fpdfsdk/fsdk_baseform.cpp
+++ b/fpdfsdk/fsdk_baseform.cpp
@@ -7,6 +7,7 @@
#include "fpdfsdk/include/fsdk_baseform.h"
#include <algorithm>
+#include <map>
#include <memory>
#include <vector>
@@ -1997,7 +1998,7 @@ CPDFSDK_InterForm::~CPDFSDK_InterForm() {
m_pInterForm = nullptr;
m_Map.clear();
#ifdef PDF_ENABLE_XFA
- m_XFAMap.RemoveAll();
+ m_XFAMap.clear();
#endif // PDF_ENABLE_XFA
}
@@ -2114,18 +2115,19 @@ FX_BOOL CPDFSDK_InterForm::IsCalculateEnabled() const {
#ifdef PDF_ENABLE_XFA
void CPDFSDK_InterForm::AddXFAMap(CXFA_FFWidget* hWidget,
CPDFSDK_XFAWidget* pWidget) {
- m_XFAMap.SetAt(hWidget, pWidget);
+ FXSYS_assert(hWidget);
+ m_XFAMap[hWidget] = pWidget;
}
void CPDFSDK_InterForm::RemoveXFAMap(CXFA_FFWidget* hWidget) {
- m_XFAMap.RemoveKey(hWidget);
+ FXSYS_assert(hWidget);
+ m_XFAMap.erase(hWidget);
}
CPDFSDK_XFAWidget* CPDFSDK_InterForm::GetXFAWidget(CXFA_FFWidget* hWidget) {
- CPDFSDK_XFAWidget* pWidget = NULL;
- m_XFAMap.Lookup(hWidget, pWidget);
-
- return pWidget;
+ FXSYS_assert(hWidget);
+ auto it = m_XFAMap.find(hWidget);
+ return it != m_XFAMap.end() ? it->second : nullptr;
}
void CPDFSDK_InterForm::XfaEnableCalculate(FX_BOOL bEnabled) {
@@ -2454,14 +2456,8 @@ FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(
#ifdef PDF_ENABLE_XFA
void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField,
FX_BOOL bSynchronizeElse) {
- int x = 0;
- if (m_FieldSynchronizeMap.Lookup(pFormField, x))
- return;
-
for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
- ASSERT(pFormCtrl);
- ASSERT(m_pInterForm);
if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) {
pWidget->Synchronize(bSynchronizeElse);
}
diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h
index fbe9a41c84..fa19c75a6b 100644
--- a/fpdfsdk/include/fsdk_baseform.h
+++ b/fpdfsdk/include/fsdk_baseform.h
@@ -243,9 +243,6 @@ class CPDFSDK_XFAWidget : public CPDFSDK_Annot {
CPDFSDK_InterForm* m_pInterForm;
CXFA_FFWidget* m_hXFAWidget;
};
-#define CPDFSDK_XFAWidgetMap \
- CFX_MapPtrTemplate<CXFA_FFWidget*, CPDFSDK_XFAWidget*>
-#define CPDFSDK_FieldSynchronizeMap CFX_MapPtrTemplate<CPDF_FormField*, int>
#endif // PDF_ENABLE_XFA
class CPDFSDK_InterForm : public CPDF_FormNotify {
@@ -341,8 +338,7 @@ class CPDFSDK_InterForm : public CPDF_FormNotify {
CPDF_InterForm* m_pInterForm;
CPDFSDK_WidgetMap m_Map;
#ifdef PDF_ENABLE_XFA
- CPDFSDK_XFAWidgetMap m_XFAMap;
- CPDFSDK_FieldSynchronizeMap m_FieldSynchronizeMap;
+ std::map<CXFA_FFWidget*, CPDFSDK_XFAWidget*> m_XFAMap;
FX_BOOL m_bXfaCalculate;
FX_BOOL m_bXfaValidationsEnabled;
#endif // PDF_ENABLE_XFA