Clean up enumerated types in cxfa_node.h
Bug: pdfium:1085
Change-Id: I91179b9add6bbd0ded4a0c4133cd73abff263ae8
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/80713
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 4dae85f..17bd99c 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -265,25 +265,24 @@
case FormFieldType::kCheckBox:
case FormFieldType::kRadioButton: {
CPDF_FormControl* pFormCtrl = GetFormControl();
- XFA_CHECKSTATE eCheckState =
- pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off;
+ XFA_CheckState eCheckState =
+ pFormCtrl->IsChecked() ? XFA_CheckState::kOn : XFA_CheckState::kOff;
node->SetCheckState(eCheckState);
break;
}
case FormFieldType::kTextField:
- node->SetValue(XFA_VALUEPICTURE_Edit, pFormField->GetValue());
+ node->SetValue(XFA_ValuePicture::kEdit, pFormField->GetValue());
break;
case FormFieldType::kComboBox:
case FormFieldType::kListBox: {
node->ClearAllSelections();
-
for (int i = 0; i < pFormField->CountSelectedItems(); ++i) {
int nIndex = pFormField->GetSelectedIndex(i);
if (nIndex > -1 && nIndex < node->CountChoiceListItems(false))
node->SetItemState(nIndex, true, false, false, true);
}
if (GetFieldType() == FormFieldType::kComboBox)
- node->SetValue(XFA_VALUEPICTURE_Edit, pFormField->GetValue());
+ node->SetValue(XFA_ValuePicture::kEdit, pFormField->GetValue());
break;
}
default:
@@ -486,7 +485,7 @@
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
CXFA_Node* node = hWidget->GetNode();
if (node->IsWidgetReady())
- return node->GetValue(XFA_VALUEPICTURE_Display);
+ return node->GetValue(XFA_ValuePicture::kDisplay);
}
#endif // PDF_ENABLE_XFA
CPDF_FormField* pFormField = GetFormField();
@@ -534,7 +533,7 @@
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
CXFA_Node* node = hWidget->GetNode();
if (node->IsWidgetReady())
- return node->GetCheckState() == XFA_CHECKSTATE_On;
+ return node->GetCheckState() == XFA_CheckState::kOn;
}
#endif // PDF_ENABLE_XFA
CPDF_FormControl* pFormCtrl = GetFormControl();
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index 7ac6619..7d397f0 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -2573,7 +2573,7 @@
WideString wsFormat = FormatFromString(pLocale, bsFormat);
WideString wsRet;
CXFA_LocaleValue(XFA_VT_DATE, WideString::FromUTF8(bsDate), pMgr)
- .FormatPatterns(wsRet, wsFormat, pLocale, XFA_VALUEPICTURE_Display);
+ .FormatPatterns(wsRet, wsFormat, pLocale, XFA_ValuePicture::kDisplay);
return wsRet.ToUTF8();
}
@@ -2596,7 +2596,7 @@
CXFA_LocaleValue widgetValue(XFA_VT_TIME, WideString::FromUTF8(bsTime), pMgr);
WideString wsRet;
widgetValue.FormatPatterns(wsRet, wsFormat, pLocale,
- XFA_VALUEPICTURE_Display);
+ XFA_ValuePicture::kDisplay);
return wsRet.ToUTF8();
}
@@ -3833,7 +3833,7 @@
pMgr);
WideString wsRet;
if (!localeValue.FormatPatterns(wsRet, wsPattern, pLocale,
- XFA_VALUEPICTURE_Display)) {
+ XFA_ValuePicture::kDisplay)) {
info.GetReturnValue().SetEmptyString();
return;
}
diff --git a/fxjs/xfa/cfxjse_resolveprocessor.cpp b/fxjs/xfa/cfxjse_resolveprocessor.cpp
index 0efb1dd..f69019a 100644
--- a/fxjs/xfa/cfxjse_resolveprocessor.cpp
+++ b/fxjs/xfa/cfxjse_resolveprocessor.cpp
@@ -521,7 +521,7 @@
bool CFXJSE_ResolveProcessor::ResolveAsterisk(CFXJSE_ResolveNodeData& rnd) {
CXFA_Node* curNode = ToNode(rnd.m_CurObject.Get());
std::vector<CXFA_Node*> array = curNode->GetNodeListWithFilter(
- XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties);
+ XFA_NodeFilter_Children | XFA_NodeFilter_Properties);
rnd.m_Result.objects.insert(rnd.m_Result.objects.end(), array.begin(),
array.end());
return !rnd.m_Result.objects.empty();
diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp
index a521d2e..d2e223d 100644
--- a/fxjs/xfa/cjx_field.cpp
+++ b/fxjs/xfa/cjx_field.cpp
@@ -311,12 +311,13 @@
return;
if (bSetting) {
- node->SetValue(XFA_VALUEPICTURE_Edit,
+ node->SetValue(XFA_ValuePicture::kEdit,
fxv8::ReentrantToWideStringHelper(pIsolate, *pValue));
return;
}
*pValue = fxv8::NewStringHelper(
- pIsolate, node->GetValue(XFA_VALUEPICTURE_Edit).ToUTF8().AsStringView());
+ pIsolate,
+ node->GetValue(XFA_ValuePicture::kEdit).ToUTF8().AsStringView());
}
void CJX_Field::formatMessage(v8::Isolate* pIsolate,
@@ -335,13 +336,13 @@
return;
if (bSetting) {
- node->SetValue(XFA_VALUEPICTURE_Display,
+ node->SetValue(XFA_ValuePicture::kDisplay,
fxv8::ReentrantToWideStringHelper(pIsolate, *pValue));
return;
}
*pValue = fxv8::NewStringHelper(
pIsolate,
- node->GetValue(XFA_VALUEPICTURE_Display).ToUTF8().AsStringView());
+ node->GetValue(XFA_ValuePicture::kDisplay).ToUTF8().AsStringView());
}
void CJX_Field::length(v8::Isolate* pIsolate,
diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp
index f1a737d..4d3c66a 100644
--- a/fxjs/xfa/cjx_node.cpp
+++ b/fxjs/xfa/cjx_node.cpp
@@ -460,7 +460,7 @@
}
std::vector<CXFA_Node*> properties =
- GetXFANode()->GetNodeListWithFilter(XFA_NODEFILTER_OneOfProperty);
+ GetXFANode()->GetNodeListWithFilter(XFA_NodeFilter_OneOfProperty);
if (!properties.empty()) {
*pValue = GetDocument()->GetScriptContext()->GetOrCreateJSBindingFromMap(
properties.front());
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index ccb70a2..8a39e4f 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -1298,7 +1298,7 @@
pContainerNode = pFormNode->GetContainerNode();
if (pContainerNode) {
wsPicture =
- pContainerNode->GetPictureContent(XFA_VALUEPICTURE_DataBind);
+ pContainerNode->GetPictureContent(XFA_ValuePicture::kDataBind);
}
if (!wsPicture.IsEmpty())
break;
diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp
index 5ddbf88..5a6b3c5 100644
--- a/xfa/fxfa/cxfa_ffbarcode.cpp
+++ b/xfa/fxfa/cxfa_ffbarcode.cpp
@@ -158,7 +158,7 @@
{
CFWL_Widget::ScopedUpdateLock update_lock(pFWLBarcode);
- pFWLBarcode->SetText(m_pNode->GetValue(XFA_VALUEPICTURE_Display));
+ pFWLBarcode->SetText(m_pNode->GetValue(XFA_ValuePicture::kDisplay));
UpdateWidgetProperty();
}
diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp
index 0a00606..dbc6c39 100644
--- a/xfa/fxfa/cxfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp
@@ -264,13 +264,13 @@
return true;
}
-XFA_CHECKSTATE CXFA_FFCheckButton::FWLState2XFAState() {
+XFA_CheckState CXFA_FFCheckButton::FWLState2XFAState() {
uint32_t dwState = GetNormalWidget()->GetStates();
if (dwState & FWL_STATE_CKB_Checked)
- return XFA_CHECKSTATE_On;
+ return XFA_CheckState::kOn;
if (dwState & FWL_STATE_CKB_Neutral)
- return XFA_CHECKSTATE_Neutral;
- return XFA_CHECKSTATE_Off;
+ return XFA_CheckState::kNeutral;
+ return XFA_CheckState::kOff;
}
bool CXFA_FFCheckButton::CommitData() {
@@ -279,14 +279,14 @@
}
bool CXFA_FFCheckButton::IsDataChanged() {
- XFA_CHECKSTATE eCheckState = FWLState2XFAState();
+ XFA_CheckState eCheckState = FWLState2XFAState();
return m_pNode->GetCheckState() != eCheckState;
}
-void CXFA_FFCheckButton::SetFWLCheckState(XFA_CHECKSTATE eCheckState) {
- if (eCheckState == XFA_CHECKSTATE_Neutral)
+void CXFA_FFCheckButton::SetFWLCheckState(XFA_CheckState eCheckState) {
+ if (eCheckState == XFA_CheckState::kNeutral)
GetNormalWidget()->SetStates(FWL_STATE_CKB_Neutral);
- else if (eCheckState == XFA_CHECKSTATE_On)
+ else if (eCheckState == XFA_CheckState::kOn)
GetNormalWidget()->SetStates(FWL_STATE_CKB_Checked);
else
GetNormalWidget()->RemoveStates(FWL_STATE_CKB_Checked);
@@ -311,7 +311,7 @@
case CFWL_Event::Type::CheckStateChanged: {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Change;
- eParam.m_wsPrevText = m_pNode->GetValue(XFA_VALUEPICTURE_Raw);
+ eParam.m_wsPrevText = m_pNode->GetValue(XFA_ValuePicture::kRaw);
CXFA_Node* exclNode = m_pNode->GetExclGroupIfExists();
if (ProcessCommittedData()) {
diff --git a/xfa/fxfa/cxfa_ffcheckbutton.h b/xfa/fxfa/cxfa_ffcheckbutton.h
index d93821f..a46d706 100644
--- a/xfa/fxfa/cxfa_ffcheckbutton.h
+++ b/xfa/fxfa/cxfa_ffcheckbutton.h
@@ -37,7 +37,7 @@
const CFX_Matrix& matrix) override;
FormFieldType GetFormFieldType() override;
- void SetFWLCheckState(XFA_CHECKSTATE eCheckState);
+ void SetFWLCheckState(XFA_CheckState eCheckState);
private:
CXFA_FFCheckButton(CXFA_Node* pNode, CXFA_CheckButton* button);
@@ -46,7 +46,7 @@
bool IsDataChanged() override;
void CapLeftRightPlacement(const CXFA_Margin* captionMargin);
void AddUIMargin(XFA_AttributeValue iCapPlacement);
- XFA_CHECKSTATE FWLState2XFAState();
+ XFA_CheckState FWLState2XFAState();
cppgc::Member<IFWL_WidgetDelegate> m_pOldDelegate;
cppgc::Member<CXFA_CheckButton> const button_;
diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp
index f9bf697..cee7076 100644
--- a/xfa/fxfa/cxfa_ffcombobox.cpp
+++ b/xfa/fxfa/cxfa_ffcombobox.cpp
@@ -74,7 +74,7 @@
std::vector<int32_t> iSelArray = m_pNode->GetSelectedItems();
if (iSelArray.empty())
- pComboBox->SetEditText(m_pNode->GetValue(XFA_VALUEPICTURE_Raw));
+ pComboBox->SetEditText(m_pNode->GetValue(XFA_ValuePicture::kRaw));
else
pComboBox->SetCurSel(iSelArray.front());
@@ -129,12 +129,12 @@
}
bool CXFA_FFComboBox::CommitData() {
- return m_pNode->SetValue(XFA_VALUEPICTURE_Raw, m_wsNewValue);
+ return m_pNode->SetValue(XFA_ValuePicture::kRaw, m_wsNewValue);
}
bool CXFA_FFComboBox::IsDataChanged() {
WideString wsText = GetCurrentText();
- if (m_pNode->GetValue(XFA_VALUEPICTURE_Raw) == wsText)
+ if (m_pNode->GetValue(XFA_ValuePicture::kRaw) == wsText)
return false;
m_wsNewValue = std::move(wsText);
@@ -210,7 +210,7 @@
pComboBox->SetCurSel(iSelArray.front());
} else {
pComboBox->SetCurSel(-1);
- pComboBox->SetEditText(m_pNode->GetValue(XFA_VALUEPICTURE_Raw));
+ pComboBox->SetEditText(m_pNode->GetValue(XFA_ValuePicture::kRaw));
}
pComboBox->Update();
return true;
@@ -314,14 +314,14 @@
void CXFA_FFComboBox::OnTextChanged(CFWL_Widget* pWidget,
const WideString& wsChanged) {
CXFA_EventParam eParam;
- eParam.m_wsPrevText = m_pNode->GetValue(XFA_VALUEPICTURE_Raw);
+ eParam.m_wsPrevText = m_pNode->GetValue(XFA_ValuePicture::kRaw);
eParam.m_wsChange = wsChanged;
FWLEventSelChange(&eParam);
}
void CXFA_FFComboBox::OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp) {
CXFA_EventParam eParam;
- eParam.m_wsPrevText = m_pNode->GetValue(XFA_VALUEPICTURE_Raw);
+ eParam.m_wsPrevText = m_pNode->GetValue(XFA_ValuePicture::kRaw);
FWLEventSelChange(&eParam);
if (m_pNode->IsChoiceListCommitOnSelect() && bLButtonUp)
m_pDocView->SetFocusNode(nullptr);
diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
index 9c693fb..e6b1806 100644
--- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp
+++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
@@ -56,7 +56,7 @@
{
CFWL_Widget::ScopedUpdateLock update_lock(pWidget);
- WideString wsText = m_pNode->GetValue(XFA_VALUEPICTURE_Display);
+ WideString wsText = m_pNode->GetValue(XFA_ValuePicture::kDisplay);
pWidget->SetEditText(wsText);
CXFA_Value* value = m_pNode->GetFormValueIfExists();
@@ -145,7 +145,7 @@
bool CXFA_FFDateTimeEdit::CommitData() {
CFWL_DateTimePicker* pPicker = GetPickerWidget();
- if (!m_pNode->SetValue(XFA_VALUEPICTURE_Edit, pPicker->GetEditText()))
+ if (!m_pNode->SetValue(XFA_ValuePicture::kEdit, pPicker->GetEditText()))
return false;
GetDoc()->GetDocView()->UpdateUIDisplay(m_pNode.Get(), this);
@@ -156,9 +156,9 @@
if (!GetNormalWidget())
return false;
- XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display;
+ XFA_ValuePicture eType = XFA_ValuePicture::kDisplay;
if (IsFocused())
- eType = XFA_VALUEPICTURE_Edit;
+ eType = XFA_ValuePicture::kEdit;
WideString wsText = m_pNode->GetValue(eType);
CFWL_DateTimePicker* pPicker = GetPickerWidget();
@@ -180,20 +180,20 @@
return true;
WideString wsText = GetPickerWidget()->GetEditText();
- return m_pNode->GetValue(XFA_VALUEPICTURE_Edit) != wsText;
+ return m_pNode->GetValue(XFA_ValuePicture::kEdit) != wsText;
}
void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget,
int32_t iYear,
int32_t iMonth,
int32_t iDay) {
- WideString wsPicture = m_pNode->GetPictureContent(XFA_VALUEPICTURE_Edit);
+ WideString wsPicture = m_pNode->GetPictureContent(XFA_ValuePicture::kEdit);
CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocaleMgr());
date.SetDate(CFX_DateTime(iYear, iMonth, iDay, 0, 0, 0, 0));
WideString wsDate;
date.FormatPatterns(wsDate, wsPicture, m_pNode->GetLocale(),
- XFA_VALUEPICTURE_Edit);
+ XFA_ValuePicture::kEdit);
CFWL_DateTimePicker* pPicker = GetPickerWidget();
pPicker->SetEditText(wsDate);
@@ -203,7 +203,7 @@
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Change;
eParam.m_pTarget = m_pNode.Get();
- eParam.m_wsPrevText = m_pNode->GetValue(XFA_VALUEPICTURE_Raw);
+ eParam.m_wsPrevText = m_pNode->GetValue(XFA_ValuePicture::kRaw);
m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Change, &eParam);
}
diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp
index cf0fb3f..9c33637 100644
--- a/xfa/fxfa/cxfa_fflistbox.cpp
+++ b/xfa/fxfa/cxfa_fflistbox.cpp
@@ -166,7 +166,7 @@
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Change;
eParam.m_pTarget = m_pNode.Get();
- eParam.m_wsPrevText = m_pNode->GetValue(XFA_VALUEPICTURE_Raw);
+ eParam.m_wsPrevText = m_pNode->GetValue(XFA_ValuePicture::kRaw);
m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Change, &eParam);
}
diff --git a/xfa/fxfa/cxfa_ffnumericedit.cpp b/xfa/fxfa/cxfa_ffnumericedit.cpp
index cae2530..e464d71 100644
--- a/xfa/fxfa/cxfa_ffnumericedit.cpp
+++ b/xfa/fxfa/cxfa_ffnumericedit.cpp
@@ -36,7 +36,7 @@
{
CFWL_Widget::ScopedUpdateLock update_lock(pWidget);
- pWidget->SetText(m_pNode->GetValue(XFA_VALUEPICTURE_Display));
+ pWidget->SetText(m_pNode->GetValue(XFA_ValuePicture::kDisplay));
UpdateWidgetProperty();
}
@@ -78,7 +78,7 @@
bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget,
const WideString& wsText) {
- WideString wsPattern = m_pNode->GetPictureContent(XFA_VALUEPICTURE_Edit);
+ WideString wsPattern = m_pNode->GetPictureContent(XFA_ValuePicture::kEdit);
if (!wsPattern.IsEmpty())
return true;
diff --git a/xfa/fxfa/cxfa_ffpasswordedit.cpp b/xfa/fxfa/cxfa_ffpasswordedit.cpp
index 1bf03a0..0fccb11 100644
--- a/xfa/fxfa/cxfa_ffpasswordedit.cpp
+++ b/xfa/fxfa/cxfa_ffpasswordedit.cpp
@@ -40,7 +40,7 @@
{
CFWL_Widget::ScopedUpdateLock update_lock(pWidget);
- pWidget->SetText(m_pNode->GetValue(XFA_VALUEPICTURE_Display));
+ pWidget->SetText(m_pNode->GetValue(XFA_ValuePicture::kDisplay));
UpdateWidgetProperty();
}
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index ebf8cf2..92e139c 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -67,7 +67,7 @@
{
CFWL_Widget::ScopedUpdateLock update_lock(pFWLEdit);
UpdateWidgetProperty();
- pFWLEdit->SetText(m_pNode->GetValue(XFA_VALUEPICTURE_Display));
+ pFWLEdit->SetText(m_pNode->GetValue(XFA_ValuePicture::kDisplay));
}
return CXFA_FFField::LoadWidget();
@@ -197,7 +197,7 @@
bool CXFA_FFTextEdit::CommitData() {
WideString wsText = ToEdit(GetNormalWidget())->GetText();
- if (m_pNode->SetValue(XFA_VALUEPICTURE_Edit, wsText)) {
+ if (m_pNode->SetValue(XFA_ValuePicture::kEdit, wsText)) {
GetDoc()->GetDocView()->UpdateUIDisplay(m_pNode.Get(), this);
return true;
}
@@ -267,9 +267,9 @@
if (!pEdit)
return false;
- XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display;
+ XFA_ValuePicture eType = XFA_ValuePicture::kDisplay;
if (IsFocused())
- eType = XFA_VALUEPICTURE_Edit;
+ eType = XFA_ValuePicture::kEdit;
bool bUpdate = false;
if (m_pNode->GetFFWidgetType() == XFA_FFWidgetType::kTextEdit &&
@@ -278,14 +278,14 @@
int32_t iMaxChars;
std::tie(elementType, iMaxChars) = m_pNode->GetMaxChars();
if (elementType == XFA_Element::ExData)
- iMaxChars = eType == XFA_VALUEPICTURE_Edit ? iMaxChars : 0;
+ iMaxChars = eType == XFA_ValuePicture::kEdit ? iMaxChars : 0;
if (pEdit->GetLimit() != iMaxChars) {
pEdit->SetLimit(iMaxChars);
bUpdate = true;
}
} else if (m_pNode->GetFFWidgetType() == XFA_FFWidgetType::kBarcode) {
int32_t nDataLen = 0;
- if (eType == XFA_VALUEPICTURE_Edit) {
+ if (eType == XFA_ValuePicture::kEdit) {
nDataLen = static_cast<CXFA_Barcode*>(m_pNode->GetUIChildNode())
->GetDataLength()
.value_or(0);
@@ -296,7 +296,7 @@
}
WideString wsText = m_pNode->GetValue(eType);
WideString wsOldText = pEdit->GetText();
- if (wsText != wsOldText || (eType == XFA_VALUEPICTURE_Edit && bUpdate)) {
+ if (wsText != wsOldText || (eType == XFA_ValuePicture::kEdit && bUpdate)) {
pEdit->SetTextSkipNotify(wsText);
bUpdate = true;
}
diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp
index 781bb5d..176d70c 100644
--- a/xfa/fxfa/cxfa_textprovider.cpp
+++ b/xfa/fxfa/cxfa_textprovider.cpp
@@ -165,5 +165,5 @@
if (!pIDNode || !pIDNode->IsWidgetReady())
return {};
- return pIDNode->GetValue(XFA_VALUEPICTURE_Display);
+ return pIDNode->GetValue(XFA_ValuePicture::kDisplay);
}
diff --git a/xfa/fxfa/fxfa_basic.h b/xfa/fxfa/fxfa_basic.h
index b830e3c..b38d336 100644
--- a/xfa/fxfa/fxfa_basic.h
+++ b/xfa/fxfa/fxfa_basic.h
@@ -111,9 +111,6 @@
Measure,
};
-#define XFA_PROPERTYFLAG_OneOf 0x01
-#define XFA_PROPERTYFLAG_DefaultOneOf 0x02
-
enum class XFA_Unit : uint8_t {
Percent = 0,
Em,
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index 8f7f144..ba5bd02 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -675,7 +675,7 @@
case XFA_FFWidgetType::kChoiceList:
if (pFormNode->IsChoiceListMultiSelect()) {
std::vector<CXFA_Node*> items = pDataNode->GetNodeListWithFilter(
- XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties);
+ XFA_NodeFilter_Children | XFA_NodeFilter_Properties);
if (!items.empty()) {
bool single = items.size() == 1;
wsNormalizeValue.clear();
@@ -710,7 +710,7 @@
break;
case XFA_FFWidgetType::kNumericEdit: {
WideString wsPicture =
- pFormNode->GetPictureContent(XFA_VALUEPICTURE_DataBind);
+ pFormNode->GetPictureContent(XFA_ValuePicture::kDataBind);
if (wsPicture.IsEmpty())
wsNormalizeValue = pFormNode->NormalizeNumStr(wsNormalizeValue);
diff --git a/xfa/fxfa/parser/cxfa_document_builder.cpp b/xfa/fxfa/parser/cxfa_document_builder.cpp
index dd602d1..931e8d9 100644
--- a/xfa/fxfa/parser/cxfa_document_builder.cpp
+++ b/xfa/fxfa/parser/cxfa_document_builder.cpp
@@ -653,7 +653,7 @@
if (pXFANode->HasPropertyFlags(
eType,
- XFA_PROPERTYFLAG_OneOf | XFA_PROPERTYFLAG_DefaultOneOf)) {
+ XFA_PropertyFlag_OneOf | XFA_PropertyFlag_DefaultOneOf)) {
if (bOneOfPropertyFound)
break;
bOneOfPropertyFound = true;
diff --git a/xfa/fxfa/parser/cxfa_event.cpp b/xfa/fxfa/parser/cxfa_event.cpp
index 8b80ef3..715d193 100644
--- a/xfa/fxfa/parser/cxfa_event.cpp
+++ b/xfa/fxfa/parser/cxfa_event.cpp
@@ -14,11 +14,11 @@
namespace {
const CXFA_Node::PropertyData kEventPropertyData[] = {
- {XFA_Element::Execute, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Script, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::SignData, 1, XFA_PROPERTYFLAG_OneOf},
+ {XFA_Element::Execute, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Script, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::SignData, 1, XFA_PropertyFlag_OneOf},
{XFA_Element::Extras, 1, 0},
- {XFA_Element::Submit, 1, XFA_PROPERTYFLAG_OneOf},
+ {XFA_Element::Submit, 1, XFA_PropertyFlag_OneOf},
};
const CXFA_Node::AttributeData kEventAttributeData[] = {
diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp
index 77a5921..42a5b28 100644
--- a/xfa/fxfa/parser/cxfa_fill.cpp
+++ b/xfa/fxfa/parser/cxfa_fill.cpp
@@ -18,14 +18,14 @@
namespace {
const CXFA_Node::PropertyData kFillPropertyData[] = {
- {XFA_Element::Pattern, 1, XFA_PROPERTYFLAG_OneOf},
+ {XFA_Element::Pattern, 1, XFA_PropertyFlag_OneOf},
{XFA_Element::Solid, 1,
- XFA_PROPERTYFLAG_OneOf | XFA_PROPERTYFLAG_DefaultOneOf},
- {XFA_Element::Stipple, 1, XFA_PROPERTYFLAG_OneOf},
+ XFA_PropertyFlag_OneOf | XFA_PropertyFlag_DefaultOneOf},
+ {XFA_Element::Stipple, 1, XFA_PropertyFlag_OneOf},
{XFA_Element::Color, 1, 0},
- {XFA_Element::Linear, 1, XFA_PROPERTYFLAG_OneOf},
+ {XFA_Element::Linear, 1, XFA_PropertyFlag_OneOf},
{XFA_Element::Extras, 1, 0},
- {XFA_Element::Radial, 1, XFA_PROPERTYFLAG_OneOf},
+ {XFA_Element::Radial, 1, XFA_PropertyFlag_OneOf},
};
const CXFA_Node::AttributeData kFillAttributeData[] = {
diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp
index f143762..09bf72a 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.cpp
+++ b/xfa/fxfa/parser/cxfa_localevalue.cpp
@@ -271,7 +271,7 @@
bool CXFA_LocaleValue::FormatPatterns(WideString& wsResult,
const WideString& wsFormat,
GCedLocaleIface* pLocale,
- XFA_VALUEPICTURE eValueType) const {
+ XFA_ValuePicture eValueType) const {
wsResult.clear();
for (const auto& pattern : CFGAS_StringFormatter::SplitOnBars(wsFormat)) {
if (FormatSinglePattern(wsResult, pattern, pLocale, eValueType))
@@ -283,7 +283,7 @@
bool CXFA_LocaleValue::FormatSinglePattern(WideString& wsResult,
const WideString& wsFormat,
GCedLocaleIface* pLocale,
- XFA_VALUEPICTURE eValueType) const {
+ XFA_ValuePicture eValueType) const {
if (!m_pLocaleMgr)
return false;
@@ -329,7 +329,7 @@
bRet = true;
}
if (!bRet && (eCategory != CFGAS_StringFormatter::Category::kNum ||
- eValueType != XFA_VALUEPICTURE_Display)) {
+ eValueType != XFA_ValuePicture::kDisplay)) {
wsResult = m_wsValue;
}
diff --git a/xfa/fxfa/parser/cxfa_localevalue.h b/xfa/fxfa/parser/cxfa_localevalue.h
index 5f17e1c..94a925e 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.h
+++ b/xfa/fxfa/parser/cxfa_localevalue.h
@@ -54,7 +54,7 @@
bool FormatPatterns(WideString& wsResult,
const WideString& wsFormat,
GCedLocaleIface* pLocale,
- XFA_VALUEPICTURE eValueType) const;
+ XFA_ValuePicture eValueType) const;
void GetNumericFormat(WideString& wsFormat, int32_t nIntLen, int32_t nDecLen);
bool ValidateNumericTemp(const WideString& wsNumeric,
@@ -73,7 +73,7 @@
bool FormatSinglePattern(WideString& wsResult,
const WideString& wsFormat,
GCedLocaleIface* pLocale,
- XFA_VALUEPICTURE eValueType) const;
+ XFA_ValuePicture eValueType) const;
bool ValidateCanonicalValue(const WideString& wsValue, uint32_t dwVType);
bool ValidateCanonicalDate(const WideString& wsDate, CFX_DateTime* unDate);
bool ValidateCanonicalTime(const WideString& wsTime);
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index efe94f9..f35db20 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -684,12 +684,12 @@
CXFA_Node* FindFirstSiblingNamed(CXFA_Node* parent, uint32_t dwNameHash) {
CXFA_Node* result = FindFirstSiblingNamedInList(parent, dwNameHash,
- XFA_NODEFILTER_Properties);
+ XFA_NodeFilter_Properties);
if (result)
return result;
return FindFirstSiblingNamedInList(parent, dwNameHash,
- XFA_NODEFILTER_Children);
+ XFA_NodeFilter_Children);
}
CXFA_Node* FindFirstSiblingNamedInList(CXFA_Node* parent,
@@ -708,12 +708,12 @@
CXFA_Node* FindFirstSiblingOfClass(CXFA_Node* parent, XFA_Element element) {
CXFA_Node* result =
- FindFirstSiblingOfClassInList(parent, element, XFA_NODEFILTER_Properties);
+ FindFirstSiblingOfClassInList(parent, element, XFA_NodeFilter_Properties);
if (result)
return result;
return FindFirstSiblingOfClassInList(parent, element,
- XFA_NODEFILTER_Children);
+ XFA_NodeFilter_Children);
}
CXFA_Node* FindFirstSiblingOfClassInList(CXFA_Node* parent,
@@ -760,7 +760,7 @@
if (bIsFindProperty) {
for (CXFA_Node* child :
- parent->GetNodeListWithFilter(XFA_NODEFILTER_Properties)) {
+ parent->GetNodeListWithFilter(XFA_NodeFilter_Properties)) {
if (bIsClassName) {
if (child->GetClassHashCode() == dwNameHash)
pSiblings->push_back(child);
@@ -782,7 +782,7 @@
return;
}
for (CXFA_Node* child :
- parent->GetNodeListWithFilter(XFA_NODEFILTER_Children)) {
+ parent->GetNodeListWithFilter(XFA_NodeFilter_Children)) {
if (child->GetElementType() == XFA_Element::Variables)
continue;
@@ -1128,10 +1128,10 @@
if (node)
return node;
- if (HasPropertyFlags(eProperty, XFA_PROPERTYFLAG_OneOf)) {
+ if (HasPropertyFlags(eProperty, XFA_PropertyFlag_OneOf)) {
for (CXFA_Node* pNode = GetFirstChild(); pNode;
pNode = pNode->GetNextSibling()) {
- if (HasPropertyFlags(pNode->GetElementType(), XFA_PROPERTYFLAG_OneOf)) {
+ if (HasPropertyFlags(pNode->GetElementType(), XFA_PropertyFlag_OneOf)) {
return nullptr;
}
}
@@ -1192,21 +1192,21 @@
}
std::vector<CXFA_Node*> CXFA_Node::GetNodeListWithFilter(
- uint32_t dwTypeFilter) {
+ XFA_NodeFilterMask dwFilter) {
std::vector<CXFA_Node*> nodes;
- if (dwTypeFilter == (XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties)) {
+ if (dwFilter == (XFA_NodeFilter_Children | XFA_NodeFilter_Properties)) {
for (CXFA_Node* pChild = GetFirstChild(); pChild;
pChild = pChild->GetNextSibling())
nodes.push_back(pChild);
return nodes;
}
- if (dwTypeFilter == 0)
+ if (dwFilter == 0)
return nodes;
- bool bFilterChildren = !!(dwTypeFilter & XFA_NODEFILTER_Children);
- bool bFilterProperties = !!(dwTypeFilter & XFA_NODEFILTER_Properties);
- bool bFilterOneOfProperties = !!(dwTypeFilter & XFA_NODEFILTER_OneOfProperty);
+ bool bFilterChildren = !!(dwFilter & XFA_NodeFilter_Children);
+ bool bFilterProperties = !!(dwFilter & XFA_NodeFilter_Properties);
+ bool bFilterOneOfProperties = !!(dwFilter & XFA_NodeFilter_OneOfProperty);
for (CXFA_Node* pChild = GetFirstChild(); pChild;
pChild = pChild->GetNextSibling()) {
if (HasProperty(pChild->GetElementType())) {
@@ -1214,7 +1214,7 @@
nodes.push_back(pChild);
} else if (bFilterOneOfProperties &&
HasPropertyFlags(pChild->GetElementType(),
- XFA_PROPERTYFLAG_OneOf)) {
+ XFA_PropertyFlag_OneOf)) {
nodes.push_back(pChild);
} else if (bFilterChildren &&
(pChild->GetElementType() == XFA_Element::Variables ||
@@ -1230,7 +1230,7 @@
return nodes;
Optional<XFA_Element> property =
- GetFirstPropertyWithFlag(XFA_PROPERTYFLAG_DefaultOneOf);
+ GetFirstPropertyWithFlag(XFA_PropertyFlag_DefaultOneOf);
if (!property.has_value())
return nodes;
@@ -1354,7 +1354,7 @@
if (IsChoiceListMultiSelect())
return nullptr;
- WideString wsPicture = GetPictureContent(XFA_VALUEPICTURE_DataBind);
+ WideString wsPicture = GetPictureContent(XFA_ValuePicture::kDataBind);
if (!wsPicture.IsEmpty())
return this;
@@ -1368,7 +1368,7 @@
continue;
pFieldNode = pFormNode->IsWidgetReady() ? pFormNode : nullptr;
if (pFieldNode)
- wsPicture = pFieldNode->GetPictureContent(XFA_VALUEPICTURE_DataBind);
+ wsPicture = pFieldNode->GetPictureContent(XFA_ValuePicture::kDataBind);
if (!wsPicture.IsEmpty())
break;
@@ -2467,7 +2467,7 @@
return iRet;
if (GetRawValue() != EventParam.m_wsResult) {
- SetValue(XFA_VALUEPICTURE_Raw, EventParam.m_wsResult);
+ SetValue(XFA_ValuePicture::kRaw, EventParam.m_wsResult);
pDocView->UpdateUIDisplay(this, nullptr);
}
return XFA_EventError::kSuccess;
@@ -2577,7 +2577,7 @@
CXFA_Validate* validate,
int32_t iFlags,
bool bVersionFlag) {
- if (!GetValue(XFA_VALUEPICTURE_Raw).IsEmpty())
+ if (!GetValue(XFA_ValuePicture::kRaw).IsEmpty())
return XFA_EventError::kSuccess;
if (m_bIsNull && m_bPreNull)
return XFA_EventError::kSuccess;
@@ -2784,7 +2784,7 @@
if (pEventParam->m_eType == XFA_EVENT_InitCalculate) {
if ((iRet == XFA_EventError::kSuccess) &&
(GetRawValue() != pEventParam->m_wsResult)) {
- SetValue(XFA_VALUEPICTURE_Raw, pEventParam->m_wsResult);
+ SetValue(XFA_ValuePicture::kRaw, pEventParam->m_wsResult);
pDocView->AddValidateNode(this);
}
}
@@ -3071,8 +3071,8 @@
CXFA_Value* defValue = pChild->GetDefaultValueIfExists();
if (defValue) {
wsValue = defValue->GetChildValueContent();
- SetValue(XFA_VALUEPICTURE_Raw, wsValue);
- pChild->SetValue(XFA_VALUEPICTURE_Raw, wsValue);
+ SetValue(XFA_ValuePicture::kRaw, wsValue);
+ pChild->SetValue(XFA_ValuePicture::kRaw, wsValue);
done = true;
}
}
@@ -3089,7 +3089,7 @@
->JSObject()
->GetContent(false);
}
- pChild->SetValue(XFA_VALUEPICTURE_Raw, itemText);
+ pChild->SetValue(XFA_ValuePicture::kRaw, itemText);
}
pNextChild = pChild->GetNextContainerSibling();
}
@@ -3103,7 +3103,7 @@
if (defValue)
wsValue = defValue->GetChildValueContent();
- SetValue(XFA_VALUEPICTURE_Raw, wsValue);
+ SetValue(XFA_ValuePicture::kRaw, wsValue);
break;
}
}
@@ -3268,7 +3268,7 @@
void CXFA_Node::CalculateTextContentSize(CXFA_FFDoc* doc, CFX_SizeF* pSize) {
float fFontSize = GetFontSize();
- WideString wsText = GetValue(XFA_VALUEPICTURE_Display);
+ WideString wsText = GetValue(XFA_ValuePicture::kDisplay);
if (wsText.IsEmpty()) {
pSize->height += fFontSize;
return;
@@ -3644,7 +3644,7 @@
CXFA_FieldLayoutData* pFieldData = m_pLayoutData->AsFieldLayoutData();
int32_t iLinesCount = 0;
float fHeight = m_pLayoutData->m_fWidgetHeight;
- if (GetValue(XFA_VALUEPICTURE_Display).IsEmpty()) {
+ if (GetValue(XFA_ValuePicture::kDisplay).IsEmpty()) {
iLinesCount = 1;
} else {
if (!pFieldData->m_pTextOut) {
@@ -3973,29 +3973,29 @@
return CXFA_Measurement(10, XFA_Unit::Pt).ToUnit(XFA_Unit::Pt);
}
-XFA_CHECKSTATE CXFA_Node::GetCheckState() {
+XFA_CheckState CXFA_Node::GetCheckState() {
WideString wsValue = GetRawValue();
if (wsValue.IsEmpty())
- return XFA_CHECKSTATE_Off;
+ return XFA_CheckState::kOff;
auto* pItems = GetChild<CXFA_Items>(0, XFA_Element::Items, false);
if (!pItems)
- return XFA_CHECKSTATE_Off;
+ return XFA_CheckState::kOff;
CXFA_Node* pText = pItems->GetFirstChild();
int32_t i = 0;
while (pText) {
Optional<WideString> wsContent = pText->JSObject()->TryContent(false, true);
if (wsContent && *wsContent == wsValue)
- return static_cast<XFA_CHECKSTATE>(i);
+ return static_cast<XFA_CheckState>(i);
i++;
pText = pText->GetNextSibling();
}
- return XFA_CHECKSTATE_Off;
+ return XFA_CheckState::kOff;
}
-void CXFA_Node::SetCheckState(XFA_CHECKSTATE eCheckState) {
+void CXFA_Node::SetCheckState(XFA_CheckState eCheckState) {
CXFA_Node* node = GetExclGroupIfExists();
if (!node) {
CXFA_Items* pItems = GetChild<CXFA_Items>(0, XFA_Element::Items, false);
@@ -4007,7 +4007,7 @@
WideString wsContent;
while (pText) {
i++;
- if (i == eCheckState) {
+ if (i == static_cast<int32_t>(eCheckState)) {
wsContent = pText->JSObject()->GetContent(false);
break;
}
@@ -4019,7 +4019,7 @@
}
WideString wsValue;
- if (eCheckState != XFA_CHECKSTATE_Off) {
+ if (eCheckState != XFA_CheckState::kOff) {
if (CXFA_Items* pItems =
GetChild<CXFA_Items>(0, XFA_Element::Items, false)) {
CXFA_Node* pText = pItems->GetFirstChild();
@@ -4063,7 +4063,7 @@
for (CXFA_Node* pNode = ToNode(GetFirstChild()); pNode;
pNode = pNode->GetNextSibling()) {
- if (pNode->GetCheckState() == XFA_CHECKSTATE_On) {
+ if (pNode->GetCheckState() == XFA_CheckState::kOn) {
pSelectedMember = pNode;
break;
}
@@ -4076,7 +4076,7 @@
for (CXFA_Node* pNode = ToNode(GetFirstChild()); pNode;
pNode = pNode->GetNextSibling()) {
if (pNode->GetNameHash() == nameHash) {
- pNode->SetCheckState(XFA_CHECKSTATE_On);
+ pNode->SetCheckState(XFA_CheckState::kOn);
return pNode;
}
}
@@ -4658,7 +4658,7 @@
.value_or(-1);
}
-bool CXFA_Node::SetValue(XFA_VALUEPICTURE eValueType,
+bool CXFA_Node::SetValue(XFA_ValuePicture eValueType,
const WideString& wsValue) {
if (wsValue.IsEmpty()) {
SyncValue(wsValue, true);
@@ -4704,13 +4704,13 @@
return bValidate;
}
-WideString CXFA_Node::GetPictureContent(XFA_VALUEPICTURE ePicture) {
- if (ePicture == XFA_VALUEPICTURE_Raw)
+WideString CXFA_Node::GetPictureContent(XFA_ValuePicture ePicture) {
+ if (ePicture == XFA_ValuePicture::kRaw)
return WideString();
CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this);
switch (ePicture) {
- case XFA_VALUEPICTURE_Display: {
+ case XFA_ValuePicture::kDisplay: {
if (CXFA_Format* pFormat =
GetChild<CXFA_Format>(0, XFA_Element::Format, false)) {
if (CXFA_Picture* pPicture = pFormat->GetChild<CXFA_Picture>(
@@ -4746,7 +4746,7 @@
return WideString();
}
}
- case XFA_VALUEPICTURE_Edit: {
+ case XFA_ValuePicture::kEdit: {
CXFA_Ui* pUI = GetChild<CXFA_Ui>(0, XFA_Element::Ui, false);
if (pUI) {
if (CXFA_Picture* pPicture =
@@ -4780,7 +4780,7 @@
return WideString();
}
}
- case XFA_VALUEPICTURE_DataBind: {
+ case XFA_ValuePicture::kDataBind: {
CXFA_Bind* bind = GetBindIfExists();
if (bind)
return bind->GetPicture();
@@ -4792,10 +4792,10 @@
return WideString();
}
-WideString CXFA_Node::GetValue(XFA_VALUEPICTURE eValueType) {
+WideString CXFA_Node::GetValue(XFA_ValuePicture eValueType) {
WideString wsValue = JSObject()->GetContent(false);
- if (eValueType == XFA_VALUEPICTURE_Display)
+ if (eValueType == XFA_ValuePicture::kDisplay)
wsValue = GetItemLabel(wsValue.AsStringView());
WideString wsPicture = GetPictureContent(eValueType);
@@ -4805,7 +4805,7 @@
switch (pNode->GetElementType()) {
case XFA_Element::ChoiceList: {
- if (eValueType == XFA_VALUEPICTURE_Display) {
+ if (eValueType == XFA_ValuePicture::kDisplay) {
int32_t iSelItemIndex = GetSelectedItem(0);
if (iSelItemIndex >= 0) {
wsValue =
@@ -4816,9 +4816,9 @@
break;
}
case XFA_Element::NumericEdit:
- if (eValueType != XFA_VALUEPICTURE_Raw && wsPicture.IsEmpty()) {
+ if (eValueType != XFA_ValuePicture::kRaw && wsPicture.IsEmpty()) {
LocaleIface* pLocale = GetLocale();
- if (eValueType == XFA_VALUEPICTURE_Display && pLocale)
+ if (eValueType == XFA_ValuePicture::kDisplay && pLocale)
wsValue = FormatNumStr(NormalizeNumStr(wsValue), pLocale);
}
break;
@@ -4863,7 +4863,7 @@
if (wsValue.IsEmpty())
return WideString();
- WideString wsPicture = GetPictureContent(XFA_VALUEPICTURE_DataBind);
+ WideString wsPicture = GetPictureContent(XFA_ValuePicture::kDataBind);
if (wsPicture.IsEmpty())
return wsValue;
@@ -4882,7 +4882,7 @@
if (wsValue.IsEmpty())
return WideString();
- WideString wsPicture = GetPictureContent(XFA_VALUEPICTURE_DataBind);
+ WideString wsPicture = GetPictureContent(XFA_ValuePicture::kDataBind);
if (wsPicture.IsEmpty())
return wsValue;
@@ -4935,7 +4935,7 @@
if (SplitDateTime(wsValue, wsDate, wsTime)) {
CXFA_LocaleValue date(XFA_VT_DATE, wsDate, pLocaleMgr);
if (date.FormatPatterns(wsFormattedValue, wsPicture, pLocale,
- XFA_VALUEPICTURE_DataBind)) {
+ XFA_ValuePicture::kDataBind)) {
return wsFormattedValue;
}
}
@@ -4946,7 +4946,7 @@
if (SplitDateTime(wsValue, wsDate, wsTime)) {
CXFA_LocaleValue time(XFA_VT_TIME, wsTime, pLocaleMgr);
if (time.FormatPatterns(wsFormattedValue, wsPicture, pLocale,
- XFA_VALUEPICTURE_DataBind)) {
+ XFA_ValuePicture::kDataBind)) {
return wsFormattedValue;
}
}
@@ -4956,7 +4956,7 @@
break;
}
widgetValue.FormatPatterns(wsFormattedValue, wsPicture, pLocale,
- XFA_VALUEPICTURE_DataBind);
+ XFA_ValuePicture::kDataBind);
}
return wsFormattedValue;
}
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 7be0d75..455181d 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -7,6 +7,7 @@
#ifndef XFA_FXFA_PARSER_CXFA_NODE_H_
#define XFA_FXFA_PARSER_CXFA_NODE_H_
+#include <type_traits>
#include <utility>
#include <vector>
@@ -50,24 +51,27 @@
class CXFA_WidgetLayoutData;
class GCedLocaleIface;
-#define XFA_NODEFILTER_Children 0x01
-#define XFA_NODEFILTER_Properties 0x02
-#define XFA_NODEFILTER_OneOfProperty 0x04
+enum XFA_NodeFilter : uint8_t {
+ XFA_NodeFilter_Children = 1 << 0,
+ XFA_NodeFilter_Properties = 1 << 1,
+ XFA_NodeFilter_OneOfProperty = 1 << 2,
+};
+using XFA_NodeFilterMask = std::underlying_type<XFA_NodeFilter>::type;
-enum XFA_CHECKSTATE {
- XFA_CHECKSTATE_On = 0,
- XFA_CHECKSTATE_Off = 1,
- XFA_CHECKSTATE_Neutral = 2,
+enum class XFA_CheckState : uint8_t {
+ kOn = 0,
+ kOff = 1,
+ kNeutral = 2,
};
-enum XFA_VALUEPICTURE {
- XFA_VALUEPICTURE_Raw = 0,
- XFA_VALUEPICTURE_Display,
- XFA_VALUEPICTURE_Edit,
- XFA_VALUEPICTURE_DataBind,
+enum class XFA_ValuePicture : uint8_t {
+ kRaw = 0,
+ kDisplay,
+ kEdit,
+ kDataBind,
};
-enum XFA_NodeFlag {
+enum XFA_NodeFlag : uint8_t {
XFA_NodeFlag_None = 0,
XFA_NodeFlag_Initialized = 1 << 0,
XFA_NodeFlag_HasRemovedChildren = 1 << 1,
@@ -77,13 +81,20 @@
XFA_NodeFlag_UnusedNode = 1 << 5,
XFA_NodeFlag_LayoutGeneratedNode = 1 << 6
};
+using XFA_NodeFlagMask = std::underlying_type<XFA_NodeFlag>::type;
+
+enum XFA_PropertyFlag : uint8_t {
+ XFA_PropertyFlag_OneOf = 1 << 0,
+ XFA_PropertyFlag_DefaultOneOf = 1 << 1,
+};
+using XFA_PropertyFlagMask = std::underlying_type<XFA_PropertyFlag>::type;
class CXFA_Node : public CXFA_Object, public GCedTreeNodeMixin<CXFA_Node> {
public:
struct PropertyData {
XFA_Element property;
uint8_t occurance_count;
- uint8_t flags;
+ XFA_PropertyFlagMask flags;
};
struct AttributeData {
@@ -186,7 +197,7 @@
CXFA_Node* GetContainerParent() const;
std::vector<CXFA_Node*> GetNodeListForType(XFA_Element eTypeFilter);
- std::vector<CXFA_Node*> GetNodeListWithFilter(uint32_t dwTypeFilter);
+ std::vector<CXFA_Node*> GetNodeListWithFilter(XFA_NodeFilterMask dwFilter);
CXFA_Node* CreateSamePacketNode(XFA_Element eType);
CXFA_Node* CloneTemplateToForm(bool bRecursive);
CXFA_Node* GetTemplateNodeIfExists() const;
@@ -329,8 +340,8 @@
float GetCheckButtonSize();
- XFA_CHECKSTATE GetCheckState();
- void SetCheckState(XFA_CHECKSTATE eCheckState);
+ XFA_CheckState GetCheckState();
+ void SetCheckState(XFA_CheckState eCheckState);
CXFA_Node* GetSelectedMember();
CXFA_Node* SetSelectedMember(WideStringView wsName);
@@ -376,10 +387,9 @@
bool IsVerticalScrollPolicyOff();
Optional<int32_t> GetNumberOfCells();
- bool SetValue(XFA_VALUEPICTURE eValueType, const WideString& wsValue);
- WideString GetValue(XFA_VALUEPICTURE eValueType);
-
- WideString GetPictureContent(XFA_VALUEPICTURE ePicture);
+ bool SetValue(XFA_ValuePicture eValueType, const WideString& wsValue);
+ WideString GetValue(XFA_ValuePicture eValueType);
+ WideString GetPictureContent(XFA_ValuePicture ePicture);
WideString GetNormalizeDataValue(const WideString& wsValue);
WideString GetFormatDataValue(const WideString& wsValue);
WideString NormalizeNumStr(const WideString& wsValue);
@@ -504,7 +514,7 @@
UnownedPtr<CFX_XMLNode> xml_node_;
const XFA_PacketType m_ePacket;
uint8_t m_ExecuteRecursionDepth = 0;
- uint16_t m_uNodeFlags = XFA_NodeFlag_None;
+ XFA_NodeFlagMask m_uNodeFlags = XFA_NodeFlag_None;
uint32_t m_dwNameHash = 0;
cppgc::Member<CXFA_Node> m_pAuxNode;
std::vector<cppgc::Member<CXFA_Node>> binding_nodes_;
diff --git a/xfa/fxfa/parser/cxfa_ui.cpp b/xfa/fxfa/parser/cxfa_ui.cpp
index 8e8a1f4..69c6f4a 100644
--- a/xfa/fxfa/parser/cxfa_ui.cpp
+++ b/xfa/fxfa/parser/cxfa_ui.cpp
@@ -12,18 +12,18 @@
namespace {
const CXFA_Node::PropertyData kUiPropertyData[] = {
- {XFA_Element::CheckButton, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::ChoiceList, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::DefaultUi, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Barcode, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Button, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::DateTimeEdit, 1, XFA_PROPERTYFLAG_OneOf},
+ {XFA_Element::CheckButton, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::ChoiceList, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::DefaultUi, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Barcode, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Button, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::DateTimeEdit, 1, XFA_PropertyFlag_OneOf},
{XFA_Element::Picture, 1, 0},
- {XFA_Element::ImageEdit, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::PasswordEdit, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::NumericEdit, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Signature, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::TextEdit, 1, XFA_PROPERTYFLAG_OneOf},
+ {XFA_Element::ImageEdit, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::PasswordEdit, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::NumericEdit, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Signature, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::TextEdit, 1, XFA_PropertyFlag_OneOf},
{XFA_Element::Extras, 1, 0},
};
@@ -53,7 +53,7 @@
for (auto& prop : kUiPropertyData) {
if (prop.property != child->GetElementType())
continue;
- if (!!(prop.flags & XFA_PROPERTYFLAG_OneOf))
+ if (!!(prop.flags & XFA_PropertyFlag_OneOf))
return true;
}
return false;
diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp
index d59b6e1..82e96b8 100644
--- a/xfa/fxfa/parser/cxfa_value.cpp
+++ b/xfa/fxfa/parser/cxfa_value.cpp
@@ -18,19 +18,19 @@
namespace {
const CXFA_Node::PropertyData kValuePropertyData[] = {
- {XFA_Element::Arc, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Text, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Time, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::DateTime, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Image, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Decimal, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Boolean, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Integer, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::ExData, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Rectangle, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Date, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Float, 1, XFA_PROPERTYFLAG_OneOf},
- {XFA_Element::Line, 1, XFA_PROPERTYFLAG_OneOf},
+ {XFA_Element::Arc, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Text, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Time, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::DateTime, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Image, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Decimal, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Boolean, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Integer, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::ExData, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Rectangle, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Date, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Float, 1, XFA_PropertyFlag_OneOf},
+ {XFA_Element::Line, 1, XFA_PropertyFlag_OneOf},
};
const CXFA_Node::AttributeData kValueAttributeData[] = {