summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-06-21 14:15:25 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-21 14:15:26 -0700
commit56a8b1944d555ed65dda97164b702a9a657485ca (patch)
tree0bfead2fa031b2c162a5992d29a11f872cf77135 /xfa/fxfa/app
parentbb8b63d6b762393e6e7460351375d596bdabef0c (diff)
downloadpdfium-56a8b1944d555ed65dda97164b702a9a657485ca.tar.xz
Convert XFA_ELEMENT to an enum class
This CL changes XFA_ELEMENT From an enum to an enum class. The type name was updated to XFA_Element. Review-Url: https://codereview.chromium.org/2089443002
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r--xfa/fxfa/app/xfa_ffdoc.cpp6
-rw-r--r--xfa/fxfa/app/xfa_ffdochandler.cpp2
-rw-r--r--xfa/fxfa/app/xfa_ffdocview.cpp52
-rw-r--r--xfa/fxfa/app/xfa_fffield.cpp16
-rw-r--r--xfa/fxfa/app/xfa_ffnotify.cpp72
-rw-r--r--xfa/fxfa/app/xfa_ffpageview.cpp8
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.cpp26
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp30
-rw-r--r--xfa/fxfa/app/xfa_ffwidgetacc.cpp128
-rw-r--r--xfa/fxfa/app/xfa_ffwidgethandler.cpp96
10 files changed, 220 insertions, 216 deletions
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp
index ce7628e43e..e85d1b76c5 100644
--- a/xfa/fxfa/app/xfa_ffdoc.cpp
+++ b/xfa/fxfa/app/xfa_ffdoc.cpp
@@ -292,16 +292,16 @@ void CXFA_FFDoc::StopLoad() {
if (!pConfig) {
return;
}
- CXFA_Node* pAcrobat = pConfig->GetFirstChildByClass(XFA_ELEMENT_Acrobat);
+ CXFA_Node* pAcrobat = pConfig->GetFirstChildByClass(XFA_Element::Acrobat);
if (!pAcrobat) {
return;
}
- CXFA_Node* pAcrobat7 = pAcrobat->GetFirstChildByClass(XFA_ELEMENT_Acrobat7);
+ CXFA_Node* pAcrobat7 = pAcrobat->GetFirstChildByClass(XFA_Element::Acrobat7);
if (!pAcrobat7) {
return;
}
CXFA_Node* pDynamicRender =
- pAcrobat7->GetFirstChildByClass(XFA_ELEMENT_DynamicRender);
+ pAcrobat7->GetFirstChildByClass(XFA_Element::DynamicRender);
if (!pDynamicRender) {
return;
}
diff --git a/xfa/fxfa/app/xfa_ffdochandler.cpp b/xfa/fxfa/app/xfa_ffdochandler.cpp
index 38e872a043..e0a28337ca 100644
--- a/xfa/fxfa/app/xfa_ffdochandler.cpp
+++ b/xfa/fxfa/app/xfa_ffdochandler.cpp
@@ -35,7 +35,7 @@ XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(CXFA_FFDoc* hDoc) {
if (!pForm)
return XFA_ATTRIBUTEENUM_Unknown;
- CXFA_Node* pSubForm = pForm->GetFirstChildByClass(XFA_ELEMENT_Subform);
+ CXFA_Node* pSubForm = pForm->GetFirstChildByClass(XFA_Element::Subform);
if (!pSubForm)
return XFA_ATTRIBUTEENUM_Unknown;
return pSubForm->GetEnum(XFA_ATTRIBUTE_RestoreState);
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp
index 7a5397f683..d42dce3ea0 100644
--- a/xfa/fxfa/app/xfa_ffdocview.cpp
+++ b/xfa/fxfa/app/xfa_ffdocview.cpp
@@ -109,12 +109,12 @@ void CXFA_FFDocView::StopLayout() {
if (!pRootItem) {
return;
}
- CXFA_Node* pSubformNode = pRootItem->GetChild(0, XFA_ELEMENT_Subform);
+ CXFA_Node* pSubformNode = pRootItem->GetChild(0, XFA_Element::Subform);
if (!pSubformNode) {
return;
}
CXFA_Node* pPageSetNode =
- pSubformNode->GetFirstChildByClass(XFA_ELEMENT_PageSet);
+ pSubformNode->GetFirstChildByClass(XFA_Element::PageSet);
if (!pPageSetNode) {
return;
}
@@ -209,8 +209,8 @@ CXFA_LayoutProcessor* CXFA_FFDocView::GetXFALayout() const {
}
FX_BOOL CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) {
CXFA_Node* pNode = pWidgetAcc->GetNode();
- XFA_ELEMENT eType = pNode->GetClassID();
- if (eType != XFA_ELEMENT_Field && eType != XFA_ELEMENT_ExclGroup) {
+ XFA_Element eType = pNode->GetClassID();
+ if (eType != XFA_Element::Field && eType != XFA_Element::ExclGroup) {
return FALSE;
}
pWidgetAcc->ResetData();
@@ -234,12 +234,12 @@ void CXFA_FFDocView::ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc) {
if (!pFormNode) {
return;
}
- if (pFormNode->GetClassID() != XFA_ELEMENT_Field &&
- pFormNode->GetClassID() != XFA_ELEMENT_ExclGroup) {
+ if (pFormNode->GetClassID() != XFA_Element::Field &&
+ pFormNode->GetClassID() != XFA_Element::ExclGroup) {
CXFA_WidgetAccIterator Iterator(this, pFormNode);
while (CXFA_WidgetAcc* pAcc = Iterator.MoveToNext()) {
bChanged |= ResetSingleWidgetAccData(pAcc);
- if (pAcc->GetNode()->GetClassID() == XFA_ELEMENT_ExclGroup) {
+ if (pAcc->GetNode()->GetClassID() == XFA_Element::ExclGroup) {
Iterator.SkipTree();
}
}
@@ -250,23 +250,25 @@ void CXFA_FFDocView::ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc) {
}
int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam,
CXFA_WidgetAcc* pWidgetAcc) {
- if (pParam == NULL) {
+ if (!pParam)
return XFA_EVENTERROR_Error;
- }
+
if (pParam->m_eType == XFA_EVENT_Validate) {
CFX_WideString wsValidateStr(L"preSubmit");
CXFA_Node* pConfigItem =
ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config));
if (pConfigItem) {
- CXFA_Node* pValidateNode = NULL;
- CXFA_Node* pAcrobatNode = pConfigItem->GetChild(0, XFA_ELEMENT_Acrobat);
- pValidateNode =
- pAcrobatNode ? pAcrobatNode->GetChild(0, XFA_ELEMENT_Validate) : NULL;
+ CXFA_Node* pValidateNode = nullptr;
+ CXFA_Node* pAcrobatNode = pConfigItem->GetChild(0, XFA_Element::Acrobat);
+ pValidateNode = pAcrobatNode
+ ? pAcrobatNode->GetChild(0, XFA_Element::Validate)
+ : nullptr;
if (!pValidateNode) {
- CXFA_Node* pPresentNode = pConfigItem->GetChild(0, XFA_ELEMENT_Present);
+ CXFA_Node* pPresentNode =
+ pConfigItem->GetChild(0, XFA_Element::Present);
pValidateNode = pPresentNode
- ? pPresentNode->GetChild(0, XFA_ELEMENT_Validate)
- : NULL;
+ ? pPresentNode->GetChild(0, XFA_Element::Validate)
+ : nullptr;
}
if (pValidateNode) {
wsValidateStr = pValidateNode->GetContent();
@@ -291,14 +293,14 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam,
return XFA_EVENTERROR_Success;
}
}
- CXFA_Node* pNode = pWidgetAcc ? pWidgetAcc->GetNode() : NULL;
+ CXFA_Node* pNode = pWidgetAcc ? pWidgetAcc->GetNode() : nullptr;
if (!pNode) {
CXFA_Node* pRootItem =
ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
if (!pRootItem) {
return XFA_EVENTERROR_Error;
}
- pNode = pRootItem->GetChild(0, XFA_ELEMENT_Subform);
+ pNode = pRootItem->GetChild(0, XFA_Element::Subform);
}
ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady);
return XFA_EVENTERROR_Success;
@@ -399,7 +401,7 @@ static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView,
if (!pParam || pParam->m_eType == XFA_EVENT_Unknown) {
return XFA_EVENTERROR_NotExist;
}
- if (!pWidgetAcc || pWidgetAcc->GetClassID() == XFA_ELEMENT_Draw) {
+ if (!pWidgetAcc || pWidgetAcc->GetClassID() == XFA_Element::Draw) {
return XFA_EVENTERROR_NotExist;
}
switch (pParam->m_eType) {
@@ -439,8 +441,8 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
if (pFormNode == pExclude) {
return iRet;
}
- XFA_ELEMENT elementType = pFormNode->GetClassID();
- if (elementType == XFA_ELEMENT_Field) {
+ XFA_Element elementType = pFormNode->GetClassID();
+ if (elementType == XFA_Element::Field) {
if (eEventType == XFA_EVENT_IndexChange) {
return iRet;
}
@@ -460,8 +462,8 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling,
XFA_ObjectType::ContainerNode)) {
elementType = pNode->GetClassID();
- if (elementType != XFA_ELEMENT_Variables &&
- elementType != XFA_ELEMENT_Draw) {
+ if (elementType != XFA_Element::Variables &&
+ elementType != XFA_Element::Draw) {
iRet |= ExecEventActivityByDeepFirst(pNode, eEventType, bIsFormReady,
bRecursive, pExclude);
}
@@ -598,7 +600,7 @@ void CXFA_FFDocView::AddNewFormNode(CXFA_Node* pNode) {
InitLayout(pNode);
}
void CXFA_FFDocView::AddIndexChangedSubform(CXFA_Node* pNode) {
- ASSERT(pNode->GetClassID() == XFA_ELEMENT_Subform);
+ ASSERT(pNode->GetClassID() == XFA_Element::Subform);
m_IndexChangedSubforms.Add(pNode);
}
void CXFA_FFDocView::RunDocClose() {
@@ -802,7 +804,7 @@ CXFA_Node* CXFA_FFDocView::GetRootSubform() {
if (!pFormPacketNode) {
return NULL;
}
- return pFormPacketNode->GetFirstChildByClass(XFA_ELEMENT_Subform);
+ return pFormPacketNode->GetFirstChildByClass(XFA_Element::Subform);
}
CXFA_WidgetAccIterator::CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView,
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index 6d2f1e8db7..59374cdbec 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -36,10 +36,10 @@ FX_BOOL CXFA_FFField::GetBBox(CFX_RectF& rtBox,
if (!bDrawFocus)
return CXFA_FFWidget::GetBBox(rtBox, dwStatus);
- XFA_ELEMENT type = (XFA_ELEMENT)m_pDataAcc->GetUIType();
- if (type == XFA_ELEMENT_Button || type == XFA_ELEMENT_CheckButton ||
- type == XFA_ELEMENT_ImageEdit || type == XFA_ELEMENT_Signature ||
- type == XFA_ELEMENT_ChoiceList) {
+ XFA_Element type = m_pDataAcc->GetUIType();
+ if (type == XFA_Element::Button || type == XFA_Element::CheckButton ||
+ type == XFA_Element::ImageEdit || type == XFA_Element::Signature ||
+ type == XFA_Element::ChoiceList) {
rtBox = m_rtUI;
CFX_Matrix mt;
GetRotateMatrix(mt);
@@ -127,9 +127,9 @@ void CXFA_FFField::UnloadWidget() {
m_pNormalWidget = nullptr;
}
void CXFA_FFField::SetEditScrollOffset() {
- XFA_ELEMENT eType = m_pDataAcc->GetUIType();
- if (eType == XFA_ELEMENT_TextEdit || eType == XFA_ELEMENT_NumericEdit ||
- eType == XFA_ELEMENT_PasswordEdit) {
+ XFA_Element eType = m_pDataAcc->GetUIType();
+ if (eType == XFA_Element::TextEdit || eType == XFA_Element::NumericEdit ||
+ eType == XFA_Element::PasswordEdit) {
FX_FLOAT fScrollOffset = 0;
CXFA_FFField* pPrev = static_cast<CXFA_FFField*>(GetPrev());
if (pPrev) {
@@ -323,7 +323,7 @@ void CXFA_FFField::UpdateFWL() {
uint32_t CXFA_FFField::UpdateUIProperty() {
CXFA_Node* pUiNode = m_pDataAcc->GetUIChild();
uint32_t dwStyle = 0;
- if (pUiNode && pUiNode->GetClassID() == XFA_ELEMENT_DefaultUi) {
+ if (pUiNode && pUiNode->GetClassID() == XFA_Element::DefaultUi) {
dwStyle = FWL_STYLEEXT_EDT_ReadOnly;
}
return dwStyle;
diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp
index 58618c2270..1a89ceaba5 100644
--- a/xfa/fxfa/app/xfa_ffnotify.cpp
+++ b/xfa/fxfa/app/xfa_ffnotify.cpp
@@ -53,7 +53,7 @@ void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_WidgetData* pSender,
const FX_WCHAR* pValue,
int32_t iIndex) {
CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender);
- if (pWidgetAcc->GetUIType() != XFA_ELEMENT_ChoiceList)
+ if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList)
return;
CXFA_FFWidget* pWidget = nullptr;
@@ -71,7 +71,7 @@ void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_WidgetData* pSender,
void CXFA_FFNotify::OnWidgetListItemRemoved(CXFA_WidgetData* pSender,
int32_t iIndex) {
CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender);
- if (pWidgetAcc->GetUIType() != XFA_ELEMENT_ChoiceList)
+ if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList)
return;
CXFA_FFWidget* pWidget = nullptr;
@@ -89,11 +89,11 @@ void CXFA_FFNotify::OnWidgetListItemRemoved(CXFA_WidgetData* pSender,
CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) {
CXFA_LayoutProcessor* pLayout = m_pDoc->GetXFADoc()->GetDocLayout();
CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout);
- XFA_ELEMENT eType = pNode->GetClassID();
- if (eType == XFA_ELEMENT_PageArea)
+ XFA_Element eType = pNode->GetClassID();
+ if (eType == XFA_Element::PageArea)
return new CXFA_FFPageView(pDocView, pNode);
- if (eType == XFA_ELEMENT_ContentArea)
+ if (eType == XFA_Element::ContentArea)
return new CXFA_ContainerLayoutItem(pNode);
CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData());
@@ -102,65 +102,65 @@ CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) {
CXFA_FFWidget* pWidget;
switch (pAcc->GetUIType()) {
- case XFA_ELEMENT_Barcode:
+ case XFA_Element::Barcode:
pWidget = new CXFA_FFBarcode(nullptr, pAcc);
break;
- case XFA_ELEMENT_Button:
+ case XFA_Element::Button:
pWidget = new CXFA_FFPushButton(nullptr, pAcc);
break;
- case XFA_ELEMENT_CheckButton:
+ case XFA_Element::CheckButton:
pWidget = new CXFA_FFCheckButton(nullptr, pAcc);
break;
- case XFA_ELEMENT_ChoiceList: {
+ case XFA_Element::ChoiceList: {
if (pAcc->IsListBox()) {
pWidget = new CXFA_FFListBox(nullptr, pAcc);
} else {
pWidget = new CXFA_FFComboBox(nullptr, pAcc);
}
} break;
- case XFA_ELEMENT_DateTimeEdit:
+ case XFA_Element::DateTimeEdit:
pWidget = new CXFA_FFDateTimeEdit(nullptr, pAcc);
break;
- case XFA_ELEMENT_ImageEdit:
+ case XFA_Element::ImageEdit:
pWidget = new CXFA_FFImageEdit(nullptr, pAcc);
break;
- case XFA_ELEMENT_NumericEdit:
+ case XFA_Element::NumericEdit:
pWidget = new CXFA_FFNumericEdit(nullptr, pAcc);
break;
- case XFA_ELEMENT_PasswordEdit:
+ case XFA_Element::PasswordEdit:
pWidget = new CXFA_FFPasswordEdit(nullptr, pAcc);
break;
- case XFA_ELEMENT_Signature:
+ case XFA_Element::Signature:
pWidget = new CXFA_FFSignature(nullptr, pAcc);
break;
- case XFA_ELEMENT_TextEdit:
+ case XFA_Element::TextEdit:
pWidget = new CXFA_FFTextEdit(nullptr, pAcc);
break;
- case XFA_ELEMENT_Arc:
+ case XFA_Element::Arc:
pWidget = new CXFA_FFArc(nullptr, pAcc);
break;
- case XFA_ELEMENT_Line:
+ case XFA_Element::Line:
pWidget = new CXFA_FFLine(nullptr, pAcc);
break;
- case XFA_ELEMENT_Rectangle:
+ case XFA_Element::Rectangle:
pWidget = new CXFA_FFRectangle(nullptr, pAcc);
break;
- case XFA_ELEMENT_Text:
+ case XFA_Element::Text:
pWidget = new CXFA_FFText(nullptr, pAcc);
break;
- case XFA_ELEMENT_Image:
+ case XFA_Element::Image:
pWidget = new CXFA_FFImage(nullptr, pAcc);
break;
- case XFA_ELEMENT_Draw:
+ case XFA_Element::Draw:
pWidget = new CXFA_FFDraw(nullptr, pAcc);
break;
- case XFA_ELEMENT_Subform:
+ case XFA_Element::Subform:
pWidget = new CXFA_FFSubForm(nullptr, pAcc);
break;
- case XFA_ELEMENT_ExclGroup:
+ case XFA_Element::ExclGroup:
pWidget = new CXFA_FFExclGroup(nullptr, pAcc);
break;
- case XFA_ELEMENT_DefaultUi:
+ case XFA_Element::DefaultUi:
default:
pWidget = nullptr;
break;
@@ -254,7 +254,7 @@ CXFA_FFWidget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) {
return XFA_GetWidgetFromLayoutItem(pLayoutItem);
}
void CXFA_FFNotify::OpenDropDownList(CXFA_FFWidget* hWidget) {
- if (hWidget->GetDataAcc()->GetUIType() != XFA_ELEMENT_ChoiceList) {
+ if (hWidget->GetDataAcc()->GetUIType() != XFA_Element::ChoiceList) {
return;
}
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
@@ -317,20 +317,20 @@ void CXFA_FFNotify::SetFocusWidgetNode(CXFA_Node* pNode) {
void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
- if (!pDocView) {
+ if (!pDocView)
return;
- }
- XFA_ELEMENT iType = pNode->GetClassID();
+
+ XFA_Element iType = pNode->GetClassID();
if (XFA_IsCreateWidget(iType)) {
CXFA_WidgetAcc* pAcc = new CXFA_WidgetAcc(pDocView, pNode);
pNode->SetObject(XFA_ATTRIBUTE_WidgetData, pAcc, &gs_XFADeleteWidgetAcc);
return;
}
switch (iType) {
- case XFA_ELEMENT_BindItems:
+ case XFA_Element::BindItems:
pDocView->m_BindItems.Add(pNode);
break;
- case XFA_ELEMENT_Validate: {
+ case XFA_Element::Validate: {
pNode->SetFlag(XFA_NodeFlag_NeedsInitApp, false);
} break;
default:
@@ -381,7 +381,7 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender,
return;
}
- XFA_ELEMENT ePType = pParentNode->GetClassID();
+ XFA_Element ePType = pParentNode->GetClassID();
FX_BOOL bIsContainerNode = pParentNode->IsContainerNode();
CXFA_WidgetAcc* pWidgetAcc =
static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData());
@@ -391,15 +391,15 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender,
bool bUpdateProperty = false;
pDocView->SetChangeMark();
switch (ePType) {
- case XFA_ELEMENT_Caption: {
+ case XFA_Element::Caption: {
CXFA_TextLayout* pCapOut = pWidgetAcc->GetCaptionTextLayout();
if (!pCapOut)
return;
pCapOut->Unload();
} break;
- case XFA_ELEMENT_Ui:
- case XFA_ELEMENT_Para:
+ case XFA_Element::Ui:
+ case XFA_Element::Para:
bUpdateProperty = true;
break;
default:
@@ -410,13 +410,13 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender,
if (eAttr == XFA_ATTRIBUTE_Value) {
pDocView->AddCalculateNodeNotify(pSender);
- if (ePType == XFA_ELEMENT_Value || bIsContainerNode) {
+ if (ePType == XFA_Element::Value || bIsContainerNode) {
if (bIsContainerNode) {
pWidgetAcc->UpdateUIDisplay();
pDocView->AddCalculateWidgetAcc(pWidgetAcc);
pDocView->AddValidateWidget(pWidgetAcc);
} else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent)->GetClassID() ==
- XFA_ELEMENT_ExclGroup) {
+ XFA_Element::ExclGroup) {
pWidgetAcc->UpdateUIDisplay();
}
return;
diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp
index aef7a30226..7123df82b9 100644
--- a/xfa/fxfa/app/xfa_ffpageview.cpp
+++ b/xfa/fxfa/app/xfa_ffpageview.cpp
@@ -76,7 +76,7 @@ bool PageWidgetFilter(CXFA_FFWidget* pWidget,
CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc();
if (!!(dwFilter & XFA_WidgetStatus_Focused) &&
- pWidgetAcc->GetClassID() != XFA_ELEMENT_Field) {
+ pWidgetAcc->GetClassID() != XFA_Element::Field) {
return false;
}
@@ -276,9 +276,9 @@ FX_BOOL CXFA_FFTabOrderPageWidgetIterator::SetCurrentWidget(
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget(
CXFA_FFWidget* pWidget) {
CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc();
- CXFA_Node* pTraversal = pAcc->GetNode()->GetChild(0, XFA_ELEMENT_Traversal);
+ CXFA_Node* pTraversal = pAcc->GetNode()->GetChild(0, XFA_Element::Traversal);
if (pTraversal) {
- CXFA_Node* pTraverse = pTraversal->GetChild(0, XFA_ELEMENT_Traverse);
+ CXFA_Node* pTraverse = pTraversal->GetChild(0, XFA_Element::Traverse);
if (pTraverse) {
CFX_WideString wsTraverseWidgetName;
if (pTraverse->GetAttribute(XFA_ATTRIBUTE_Ref, wsTraverseWidgetName)) {
@@ -306,7 +306,7 @@ void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() {
if (m_TabOrderWidgetArray.Find(hWidget) < 0) {
m_TabOrderWidgetArray.Add(hWidget);
CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc();
- if (pWidgetAcc->GetUIType() == XFA_ELEMENT_ExclGroup) {
+ if (pWidgetAcc->GetUIType() == XFA_Element::ExclGroup) {
int32_t iWidgetIndex = SpaceOrderWidgetArray.Find(hWidget) + 1;
while (TRUE) {
CXFA_FFWidget* pRadio =
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
index fd2abe7aba..d29446a086 100644
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -75,9 +75,9 @@ void CXFA_FFTextEdit::UpdateWidgetProperty() {
dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine;
}
- XFA_ELEMENT eType = XFA_ELEMENT_UNKNOWN;
+ XFA_Element eType = XFA_Element::Unknown;
int32_t iMaxChars = m_pDataAcc->GetMaxChars(eType);
- if (eType == XFA_ELEMENT_ExData) {
+ if (eType == XFA_Element::ExData) {
iMaxChars = 0;
}
int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
@@ -189,7 +189,7 @@ FX_BOOL CXFA_FFTextEdit::CommitData() {
}
void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) {
CXFA_WidgetAcc* pAcc = GetDataAcc();
- if (pAcc && pAcc->GetUIType() == XFA_ELEMENT_NumericEdit) {
+ if (pAcc && pAcc->GetUIType() == XFA_Element::NumericEdit) {
IXFA_AppProvider* pAppProvider = GetApp()->GetAppProvider();
if (pAppProvider) {
CFX_WideString wsTitle;
@@ -253,11 +253,11 @@ FX_BOOL CXFA_FFTextEdit::UpdateFWLData() {
eType = XFA_VALUEPICTURE_Edit;
}
FX_BOOL bUpdate = FALSE;
- if (m_pDataAcc->GetUIType() == XFA_ELEMENT_TextEdit &&
+ if (m_pDataAcc->GetUIType() == XFA_Element::TextEdit &&
m_pDataAcc->GetNumberOfCells() < 0) {
- XFA_ELEMENT elementType = XFA_ELEMENT_UNKNOWN;
+ XFA_Element elementType = XFA_Element::Unknown;
int32_t iMaxChars = m_pDataAcc->GetMaxChars(elementType);
- if (elementType == XFA_ELEMENT_ExData) {
+ if (elementType == XFA_Element::ExData) {
iMaxChars = eType == XFA_VALUEPICTURE_Edit ? iMaxChars : 0;
}
if (((CFWL_Edit*)m_pNormalWidget)->GetLimit() != iMaxChars) {
@@ -265,7 +265,7 @@ FX_BOOL CXFA_FFTextEdit::UpdateFWLData() {
bUpdate = TRUE;
}
}
- if (m_pDataAcc->GetUIType() == XFA_ELEMENT_Barcode) {
+ if (m_pDataAcc->GetUIType() == XFA_Element::Barcode) {
int32_t nDataLen = 0;
if (eType == XFA_VALUEPICTURE_Edit)
m_pDataAcc->GetBarcodeAttribute_DataLength(nDataLen);
@@ -337,7 +337,7 @@ FX_BOOL CXFA_FFTextEdit::DeSelect() {
FX_BOOL CXFA_FFTextEdit::GetSuggestWords(
CFX_PointF pointf,
std::vector<CFX_ByteString>& sSuggest) {
- if (m_pDataAcc->GetUIType() != XFA_ELEMENT_TextEdit) {
+ if (m_pDataAcc->GetUIType() != XFA_Element::TextEdit) {
return FALSE;
}
FWLToClient(pointf.x, pointf.y);
@@ -346,7 +346,7 @@ FX_BOOL CXFA_FFTextEdit::GetSuggestWords(
FX_BOOL CXFA_FFTextEdit::ReplaceSpellCheckWord(
CFX_PointF pointf,
const CFX_ByteStringC& bsReplace) {
- if (m_pDataAcc->GetUIType() != XFA_ELEMENT_TextEdit) {
+ if (m_pDataAcc->GetUIType() != XFA_Element::TextEdit) {
return FALSE;
}
FWLToClient(pointf.x, pointf.y);
@@ -363,7 +363,7 @@ void CXFA_FFTextEdit::OnTextChanged(IFWL_Widget* pWidget,
eParam.m_pTarget = m_pDataAcc;
eParam.m_wsPrevText = wsPrevText;
CFWL_Edit* pEdit = ((CFWL_Edit*)m_pNormalWidget);
- if (m_pDataAcc->GetUIType() == XFA_ELEMENT_DateTimeEdit) {
+ if (m_pDataAcc->GetUIType() == XFA_Element::DateTimeEdit) {
CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)pEdit;
pDateTime->GetEditText(eParam.m_wsNewText);
int32_t iSels = pDateTime->CountSelRanges();
@@ -387,7 +387,7 @@ void CXFA_FFTextEdit::OnTextFull(IFWL_Widget* pWidget) {
}
FX_BOOL CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) {
- if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_ELEMENT_TextEdit) {
+ if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit) {
return TRUE;
}
return GetDoc()->GetDocProvider()->CheckWord(GetDoc(), sWord);
@@ -395,7 +395,7 @@ FX_BOOL CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) {
FX_BOOL CXFA_FFTextEdit::GetSuggestWords(
const CFX_ByteStringC& sWord,
std::vector<CFX_ByteString>& sSuggest) {
- if (m_pDataAcc->GetUIType() != XFA_ELEMENT_TextEdit) {
+ if (m_pDataAcc->GetUIType() != XFA_Element::TextEdit) {
return FALSE;
}
return GetDoc()->GetDocProvider()->GetSuggestWords(GetDoc(), sWord, sSuggest);
@@ -600,7 +600,7 @@ FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() {
pWidget->SetEditText(wsText);
if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
switch (value.GetChildValueClassID()) {
- case XFA_ELEMENT_Date: {
+ case XFA_Element::Date: {
if (!wsText.IsEmpty()) {
CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
CFX_Unitime date = lcValue.GetDate();
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index 4ea2857e09..1611b81397 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -1179,15 +1179,15 @@ void XFA_RectWidthoutMargin(CFX_RectF& rt, const CXFA_Margin& mg, FX_BOOL bUI) {
rt.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
}
CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem) {
- XFA_ELEMENT iType = pLayoutItem->GetFormNode()->GetClassID();
+ XFA_Element iType = pLayoutItem->GetFormNode()->GetClassID();
if (XFA_IsCreateWidget(iType)) {
return static_cast<CXFA_FFWidget*>(pLayoutItem);
}
return nullptr;
}
-FX_BOOL XFA_IsCreateWidget(XFA_ELEMENT iType) {
- return iType == XFA_ELEMENT_Field || iType == XFA_ELEMENT_Draw ||
- iType == XFA_ELEMENT_Subform || iType == XFA_ELEMENT_ExclGroup;
+FX_BOOL XFA_IsCreateWidget(XFA_Element iType) {
+ return iType == XFA_Element::Field || iType == XFA_Element::Draw ||
+ iType == XFA_Element::Subform || iType == XFA_Element::ExclGroup;
}
static void XFA_BOX_GetPath_Arc(CXFA_Box box,
CFX_RectF rtDraw,
@@ -1646,20 +1646,20 @@ static void XFA_BOX_Fill(CXFA_Box box,
XFA_BOX_GetFillPath(box, strokes, rtWidget, fillPath,
(dwFlags & XFA_DRAWBOX_ForceRound) != 0);
fillPath.Close();
- int32_t eType = fill.GetFillType();
+ XFA_Element eType = fill.GetFillType();
switch (eType) {
- case XFA_ELEMENT_Radial:
+ case XFA_Element::Radial:
XFA_BOX_Fill_Radial(box, pGS, fillPath, rtWidget, pMatrix);
break;
- case XFA_ELEMENT_Pattern:
+ case XFA_Element::Pattern:
XFA_BOX_Fill_Pattern(box, pGS, fillPath, rtWidget, pMatrix);
break;
- case XFA_ELEMENT_Linear:
+ case XFA_Element::Linear:
XFA_BOX_Fill_Linear(box, pGS, fillPath, rtWidget, pMatrix);
break;
default: {
FX_ARGB cr;
- if (eType == XFA_ELEMENT_Stipple) {
+ if (eType == XFA_Element::Stipple) {
int32_t iRate = fill.GetStipple(cr);
if (iRate == 0) {
iRate = 100;
@@ -2030,16 +2030,16 @@ void XFA_DrawBox(CXFA_Box box,
const CFX_RectF& rtWidget,
CFX_Matrix* pMatrix,
uint32_t dwFlags) {
- if (!box || box.GetPresence() != XFA_ATTRIBUTEENUM_Visible) {
+ if (!box || box.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
return;
- }
- int32_t iType = box.GetClassID();
- if (iType != XFA_ELEMENT_Arc && iType != XFA_ELEMENT_Border &&
- iType != XFA_ELEMENT_Rectangle) {
+
+ XFA_Element iType = box.GetClassID();
+ if (iType != XFA_Element::Arc && iType != XFA_Element::Border &&
+ iType != XFA_Element::Rectangle) {
return;
}
CXFA_StrokeArray strokes;
- if (!(dwFlags & XFA_DRAWBOX_ForceRound) && iType != XFA_ELEMENT_Arc) {
+ if (!(dwFlags & XFA_DRAWBOX_ForceRound) && iType != XFA_Element::Arc) {
box.GetStrokes(strokes);
}
XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags);
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index 9bf07b4556..3d8d7e18dc 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -199,9 +199,9 @@ FX_BOOL CXFA_WidgetAcc::ProcessValueChanged() {
}
void CXFA_WidgetAcc::ResetData() {
CFX_WideString wsValue;
- XFA_ELEMENT eUIType = (XFA_ELEMENT)GetUIType();
+ XFA_Element eUIType = GetUIType();
switch (eUIType) {
- case XFA_ELEMENT_ImageEdit: {
+ case XFA_Element::ImageEdit: {
CXFA_Value imageValue = GetDefaultValue();
CXFA_Image image = imageValue.GetImage();
CFX_WideString wsContentType, wsHref;
@@ -212,7 +212,7 @@ void CXFA_WidgetAcc::ResetData() {
}
SetImageEdit(wsContentType, wsHref, wsValue);
} break;
- case XFA_ELEMENT_ExclGroup: {
+ case XFA_Element::ExclGroup: {
CXFA_Node* pNextChild = m_pNode->GetNodeItem(
XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode);
while (pNextChild) {
@@ -228,13 +228,13 @@ void CXFA_WidgetAcc::ResetData() {
SetValue(wsValue, XFA_VALUEPICTURE_Raw);
pAcc->SetValue(wsValue, XFA_VALUEPICTURE_Raw);
} else {
- CXFA_Node* pItems = pChild->GetChild(0, XFA_ELEMENT_Items);
+ CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items);
if (!pItems) {
continue;
}
CFX_WideString itemText;
- if (pItems->CountChildren(XFA_ELEMENT_UNKNOWN) > 1) {
- itemText = pItems->GetChild(1, XFA_ELEMENT_UNKNOWN)->GetContent();
+ if (pItems->CountChildren(XFA_Element::Unknown) > 1) {
+ itemText = pItems->GetChild(1, XFA_Element::Unknown)->GetContent();
}
pAcc->SetValue(itemText, XFA_VALUEPICTURE_Raw);
}
@@ -242,7 +242,7 @@ void CXFA_WidgetAcc::ResetData() {
XFA_ObjectType::ContainerNode);
}
} break;
- case XFA_ELEMENT_ChoiceList:
+ case XFA_Element::ChoiceList:
ClearAllSelections();
default:
if (CXFA_Value defValue = GetDefaultValue()) {
@@ -281,7 +281,7 @@ void CXFA_WidgetAcc::SetImageEdit(const CFX_WideString& wsContentType,
CXFA_WidgetAcc* CXFA_WidgetAcc::GetExclGroup() {
CXFA_Node* pExcl = m_pNode->GetNodeItem(XFA_NODEITEM_Parent);
- if (!pExcl || pExcl->GetClassID() != XFA_ELEMENT_ExclGroup) {
+ if (!pExcl || pExcl->GetClassID() != XFA_Element::ExclGroup) {
return NULL;
}
return static_cast<CXFA_WidgetAcc*>(pExcl->GetWidgetData());
@@ -300,7 +300,7 @@ IXFA_AppProvider* CXFA_WidgetAcc::GetAppProvider() {
}
int32_t CXFA_WidgetAcc::ProcessEvent(int32_t iActivity,
CXFA_EventParam* pEventParam) {
- if (GetClassID() == XFA_ELEMENT_Draw) {
+ if (GetClassID() == XFA_Element::Draw) {
return XFA_EVENTERROR_NotExist;
}
int32_t iRet = XFA_EVENTERROR_NotExist;
@@ -320,19 +320,19 @@ int32_t CXFA_WidgetAcc::ProcessEvent(int32_t iActivity,
}
int32_t CXFA_WidgetAcc::ProcessEvent(CXFA_Event& event,
CXFA_EventParam* pEventParam) {
- if (!event) {
+ if (!event)
return XFA_EVENTERROR_NotExist;
- }
+
switch (event.GetEventType()) {
- case XFA_ELEMENT_Execute:
+ case XFA_Element::Execute:
break;
- case XFA_ELEMENT_Script: {
+ case XFA_Element::Script: {
CXFA_Script script = event.GetScript();
return ExecuteScript(script, pEventParam);
} break;
- case XFA_ELEMENT_SignData:
+ case XFA_Element::SignData:
break;
- case XFA_ELEMENT_Submit: {
+ case XFA_Element::Submit: {
CXFA_Submit submit = event.GetSubmit();
return GetDoc()->GetDocProvider()->SubmitData(GetDoc(), submit);
}
@@ -343,7 +343,7 @@ int32_t CXFA_WidgetAcc::ProcessEvent(CXFA_Event& event,
}
int32_t CXFA_WidgetAcc::ProcessCalculate() {
- if (GetClassID() == XFA_ELEMENT_Draw)
+ if (GetClassID() == XFA_Element::Draw)
return XFA_EVENTERROR_NotExist;
CXFA_Calculate calc = GetCalculate();
@@ -569,7 +569,7 @@ void CXFA_WidgetAcc::GetValidateMessage(IXFA_AppProvider* pAppProvider,
wsCaptionName.c_str());
}
int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) {
- if (GetClassID() == XFA_ELEMENT_Draw) {
+ if (GetClassID() == XFA_Element::Draw) {
return XFA_EVENTERROR_NotExist;
}
CXFA_Validate validate = GetValidate();
@@ -711,7 +711,7 @@ void CXFA_WidgetAcc::UpdateUIDisplay(CXFA_FFWidget* pExcept) {
CXFA_FFWidget* pWidget = NULL;
while ((pWidget = GetNextWidget(pWidget)) != nullptr) {
if (pWidget == pExcept || !pWidget->IsLoaded() ||
- (GetUIType() != XFA_ELEMENT_CheckButton && pWidget->IsFocused())) {
+ (GetUIType() != XFA_Element::CheckButton && pWidget->IsFocused())) {
continue;
}
pWidget->UpdateFWLData();
@@ -725,7 +725,7 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) {
return;
}
LoadCaption();
- XFA_ELEMENT eUIType = (XFA_ELEMENT)GetUIType();
+ XFA_Element eUIType = GetUIType();
int32_t iCapPlacement = caption.GetPlacementType();
FX_FLOAT fCapReserve = caption.GetReserve();
const bool bVert = iCapPlacement == XFA_ATTRIBUTEENUM_Top ||
@@ -735,7 +735,7 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) {
static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get())
->m_pCapTextLayout.get();
if (pCapTextLayout) {
- if (!bVert && eUIType != XFA_ELEMENT_Button) {
+ if (!bVert && eUIType != XFA_Element::Button) {
szCap.x = fCapReserve;
}
CFX_SizeF minSize;
@@ -863,7 +863,7 @@ void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) {
pTextOut->SetLineBreakTolerance(fFontSize * 0.2f);
pTextOut->SetLineSpace(GetLineHeight());
uint32_t dwStyles = FDE_TTOSTYLE_LastLineHeight;
- if (GetUIType() == XFA_ELEMENT_TextEdit && IsMultiLine()) {
+ if (GetUIType() == XFA_Element::TextEdit && IsMultiLine()) {
dwStyles |= FDE_TTOSTYLE_LineWrap;
}
pTextOut->SetStyles(dwStyles);
@@ -1087,8 +1087,8 @@ FX_FLOAT CXFA_WidgetAcc::GetHeightWithoutMargin(FX_FLOAT fHeightCalc) {
void CXFA_WidgetAcc::StartWidgetLayout(FX_FLOAT& fCalcWidth,
FX_FLOAT& fCalcHeight) {
InitLayoutData();
- XFA_ELEMENT eUIType = GetUIType();
- if (eUIType == XFA_ELEMENT_Text) {
+ XFA_Element eUIType = GetUIType();
+ if (eUIType == XFA_Element::Text) {
m_pLayoutData->m_fWidgetHeight = -1;
GetHeight(m_pLayoutData->m_fWidgetHeight);
StartTextLayout(fCalcWidth, fCalcHeight);
@@ -1114,39 +1114,39 @@ void CXFA_WidgetAcc::StartWidgetLayout(FX_FLOAT& fCalcWidth,
}
m_pLayoutData->m_fWidgetHeight = fCalcHeight;
}
-void CXFA_WidgetAcc::CalculateAccWidthAndHeight(XFA_ELEMENT eUIType,
+void CXFA_WidgetAcc::CalculateAccWidthAndHeight(XFA_Element eUIType,
FX_FLOAT& fWidth,
FX_FLOAT& fCalcHeight) {
CFX_SizeF sz(fWidth, m_pLayoutData->m_fWidgetHeight);
switch (eUIType) {
- case XFA_ELEMENT_Barcode:
- case XFA_ELEMENT_ChoiceList:
- case XFA_ELEMENT_Signature:
+ case XFA_Element::Barcode:
+ case XFA_Element::ChoiceList:
+ case XFA_Element::Signature:
CalculateFieldAutoSize(sz);
break;
- case XFA_ELEMENT_ImageEdit:
+ case XFA_Element::ImageEdit:
CalculateImageEditAutoSize(sz);
break;
- case XFA_ELEMENT_Button:
+ case XFA_Element::Button:
CalculatePushButtonAutoSize(sz);
break;
- case XFA_ELEMENT_CheckButton:
+ case XFA_Element::CheckButton:
CalculateCheckButtonAutoSize(sz);
break;
- case XFA_ELEMENT_DateTimeEdit:
- case XFA_ELEMENT_NumericEdit:
- case XFA_ELEMENT_PasswordEdit:
- case XFA_ELEMENT_TextEdit:
+ case XFA_Element::DateTimeEdit:
+ case XFA_Element::NumericEdit:
+ case XFA_Element::PasswordEdit:
+ case XFA_Element::TextEdit:
CalculateTextEditAutoSize(sz);
break;
- case XFA_ELEMENT_Image:
+ case XFA_Element::Image:
CalculateImageAutoSize(sz);
break;
- case XFA_ELEMENT_Arc:
- case XFA_ELEMENT_Line:
- case XFA_ELEMENT_Rectangle:
- case XFA_ELEMENT_Subform:
- case XFA_ELEMENT_ExclGroup:
+ case XFA_Element::Arc:
+ case XFA_Element::Line:
+ case XFA_Element::Rectangle:
+ case XFA_Element::Subform:
+ case XFA_Element::ExclGroup:
CalculateWidgetAutoSize(sz);
break;
default:
@@ -1158,13 +1158,13 @@ void CXFA_WidgetAcc::CalculateAccWidthAndHeight(XFA_ELEMENT eUIType,
}
FX_BOOL CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex,
FX_FLOAT& fCalcHeight) {
- XFA_ELEMENT eUIType = (XFA_ELEMENT)GetUIType();
- if (eUIType == XFA_ELEMENT_Subform) {
+ XFA_Element eUIType = GetUIType();
+ if (eUIType == XFA_Element::Subform) {
return FALSE;
}
- if (eUIType != XFA_ELEMENT_Text && eUIType != XFA_ELEMENT_TextEdit &&
- eUIType != XFA_ELEMENT_NumericEdit &&
- eUIType != XFA_ELEMENT_PasswordEdit) {
+ if (eUIType != XFA_Element::Text && eUIType != XFA_Element::TextEdit &&
+ eUIType != XFA_Element::NumericEdit &&
+ eUIType != XFA_Element::PasswordEdit) {
fCalcHeight = 0;
return TRUE;
}
@@ -1181,7 +1181,7 @@ FX_BOOL CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex,
fTopInset += rtUIMargin.top;
fBottomInset += rtUIMargin.width;
}
- if (eUIType == XFA_ELEMENT_Text) {
+ if (eUIType == XFA_Element::Text) {
FX_FLOAT fHeight = fCalcHeight;
if (iBlockIndex == 0) {
fCalcHeight = fCalcHeight - fTopInset;
@@ -1392,22 +1392,22 @@ void CXFA_WidgetAcc::InitLayoutData() {
return;
}
switch (GetUIType()) {
- case XFA_ELEMENT_Text:
+ case XFA_Element::Text:
m_pLayoutData.reset(new CXFA_TextLayoutData);
return;
- case XFA_ELEMENT_TextEdit:
+ case XFA_Element::TextEdit:
m_pLayoutData.reset(new CXFA_TextEditData);
return;
- case XFA_ELEMENT_Image:
+ case XFA_Element::Image:
m_pLayoutData.reset(new CXFA_ImageLayoutData);
return;
- case XFA_ELEMENT_ImageEdit:
+ case XFA_Element::ImageEdit:
m_pLayoutData.reset(new CXFA_ImageEditData);
return;
default:
break;
}
- if (GetClassID() == XFA_ELEMENT_Field) {
+ if (GetClassID() == XFA_Element::Field) {
m_pLayoutData.reset(new CXFA_FieldLayoutData);
return;
}
@@ -1556,7 +1556,7 @@ FX_ARGB CXFA_WidgetAcc::GetTextColor() {
CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) {
bRichText = FALSE;
if (m_pTextNode) {
- if (m_pTextNode->GetClassID() == XFA_ELEMENT_ExData) {
+ if (m_pTextNode->GetClassID() == XFA_Element::ExData) {
CFX_WideString wsContentType;
m_pTextNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType,
FALSE);
@@ -1568,12 +1568,12 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) {
}
if (m_eType == XFA_TEXTPROVIDERTYPE_Text) {
CXFA_Node* pElementNode = m_pWidgetAcc->GetNode();
- CXFA_Node* pValueNode = pElementNode->GetChild(0, XFA_ELEMENT_Value);
+ CXFA_Node* pValueNode = pElementNode->GetChild(0, XFA_Element::Value);
if (!pValueNode) {
return NULL;
}
CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- if (pChildNode && pChildNode->GetClassID() == XFA_ELEMENT_ExData) {
+ if (pChildNode && pChildNode->GetClassID() == XFA_Element::ExData) {
CFX_WideString wsContentType;
pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE);
if (wsContentType == FX_WSTRC(L"text/html")) {
@@ -1599,16 +1599,16 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) {
return pBind;
} else if (m_eType == XFA_TEXTPROVIDERTYPE_Caption) {
CXFA_Node* pCaptionNode =
- m_pWidgetAcc->GetNode()->GetChild(0, XFA_ELEMENT_Caption);
+ m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption);
if (pCaptionNode == NULL) {
return NULL;
}
- CXFA_Node* pValueNode = pCaptionNode->GetChild(0, XFA_ELEMENT_Value);
+ CXFA_Node* pValueNode = pCaptionNode->GetChild(0, XFA_Element::Value);
if (pValueNode == NULL) {
return NULL;
}
CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- if (pChildNode && pChildNode->GetClassID() == XFA_ELEMENT_ExData) {
+ if (pChildNode && pChildNode->GetClassID() == XFA_Element::ExData) {
CFX_WideString wsContentType;
pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE);
if (wsContentType == FX_WSTRC(L"text/html")) {
@@ -1618,7 +1618,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) {
return pChildNode;
}
CXFA_Node* pItemNode =
- m_pWidgetAcc->GetNode()->GetChild(0, XFA_ELEMENT_Items);
+ m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Items);
if (pItemNode == NULL) {
return NULL;
}
@@ -1641,23 +1641,23 @@ CXFA_Para CXFA_TextProvider::GetParaNode() {
if (m_eType == XFA_TEXTPROVIDERTYPE_Text) {
return m_pWidgetAcc->GetPara();
}
- CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_ELEMENT_Caption);
- return CXFA_Para(pNode->GetChild(0, XFA_ELEMENT_Para));
+ CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption);
+ return CXFA_Para(pNode->GetChild(0, XFA_Element::Para));
}
CXFA_Font CXFA_TextProvider::GetFontNode() {
if (m_eType == XFA_TEXTPROVIDERTYPE_Text) {
return m_pWidgetAcc->GetFont();
}
- CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_ELEMENT_Caption);
- pNode = pNode->GetChild(0, XFA_ELEMENT_Font);
+ CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption);
+ pNode = pNode->GetChild(0, XFA_Element::Font);
if (pNode) {
return CXFA_Font(pNode);
}
return m_pWidgetAcc->GetFont();
}
FX_BOOL CXFA_TextProvider::IsCheckButtonAndAutoWidth() {
- XFA_ELEMENT eType = m_pWidgetAcc->GetUIType();
- if (eType == XFA_ELEMENT_CheckButton) {
+ XFA_Element eType = m_pWidgetAcc->GetUIType();
+ if (eType == XFA_Element::CheckButton) {
FX_FLOAT fWidth = 0;
return !m_pWidgetAcc->GetWidth(fWidth);
}
diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp
index eeaadc73b2..6ad03d1b73 100644
--- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp
@@ -187,7 +187,7 @@ FX_BOOL CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc,
XFA_EVENTTYPE eEventType) {
if (!pWidgetAcc || eEventType == XFA_EVENT_Unknown)
return FALSE;
- if (pWidgetAcc->GetClassID() == XFA_ELEMENT_Draw)
+ if (pWidgetAcc->GetClassID() == XFA_Element::Draw)
return FALSE;
switch (eEventType) {
@@ -219,7 +219,7 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc,
CXFA_EventParam* pParam) {
if (!pParam || pParam->m_eType == XFA_EVENT_Unknown)
return XFA_EVENTERROR_NotExist;
- if (!pWidgetAcc || pWidgetAcc->GetClassID() == XFA_ELEMENT_Draw)
+ if (!pWidgetAcc || pWidgetAcc->GetClassID() == XFA_Element::Draw)
return XFA_EVENTERROR_NotExist;
switch (pParam->m_eType) {
@@ -321,28 +321,28 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem(
CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateField(XFA_ELEMENT_Button, pParent, pBefore);
- CXFA_Node* pCaption = CreateCopyNode(XFA_ELEMENT_Caption, pField);
- CXFA_Node* pValue = CreateCopyNode(XFA_ELEMENT_Value, pCaption);
- CXFA_Node* pText = CreateCopyNode(XFA_ELEMENT_Text, pValue);
+ CXFA_Node* pField = CreateField(XFA_Element::Button, pParent, pBefore);
+ CXFA_Node* pCaption = CreateCopyNode(XFA_Element::Caption, pField);
+ CXFA_Node* pValue = CreateCopyNode(XFA_Element::Value, pCaption);
+ CXFA_Node* pText = CreateCopyNode(XFA_Element::Text, pValue);
pText->SetContent(L"Button", L"Button", FALSE);
- CXFA_Node* pPara = CreateCopyNode(XFA_ELEMENT_Para, pCaption);
+ CXFA_Node* pPara = CreateCopyNode(XFA_Element::Para, pCaption);
pPara->SetEnum(XFA_ATTRIBUTE_VAlign, XFA_ATTRIBUTEENUM_Middle, FALSE);
pPara->SetEnum(XFA_ATTRIBUTE_HAlign, XFA_ATTRIBUTEENUM_Center, FALSE);
CreateFontNode(pCaption);
- CXFA_Node* pBorder = CreateCopyNode(XFA_ELEMENT_Border, pField);
+ CXFA_Node* pBorder = CreateCopyNode(XFA_Element::Border, pField);
pBorder->SetEnum(XFA_ATTRIBUTE_Hand, XFA_ATTRIBUTEENUM_Right, FALSE);
- CXFA_Node* pEdge = CreateCopyNode(XFA_ELEMENT_Edge, pBorder);
+ CXFA_Node* pEdge = CreateCopyNode(XFA_Element::Edge, pBorder);
pEdge->SetEnum(XFA_ATTRIBUTE_Stroke, XFA_ATTRIBUTEENUM_Raised, FALSE);
- CXFA_Node* pFill = CreateCopyNode(XFA_ELEMENT_Fill, pBorder);
- CXFA_Node* pColor = CreateCopyNode(XFA_ELEMENT_Color, pFill);
+ CXFA_Node* pFill = CreateCopyNode(XFA_Element::Fill, pBorder);
+ CXFA_Node* pColor = CreateCopyNode(XFA_Element::Color, pFill);
pColor->SetCData(XFA_ATTRIBUTE_Value, L"212, 208, 200", FALSE);
- CXFA_Node* pBind = CreateCopyNode(XFA_ELEMENT_Bind, pField);
+ CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField);
pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None);
return pField;
@@ -350,55 +350,55 @@ CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent,
CXFA_Node* CXFA_FFWidgetHandler::CreateCheckButton(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- return CreateField(XFA_ELEMENT_CheckButton, pParent, pBefore);
+ return CreateField(XFA_Element::CheckButton, pParent, pBefore);
}
CXFA_Node* CXFA_FFWidgetHandler::CreateExclGroup(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- return CreateFormItem(XFA_ELEMENT_ExclGroup, pParent, pBefore);
+ return CreateFormItem(XFA_Element::ExclGroup, pParent, pBefore);
}
CXFA_Node* CXFA_FFWidgetHandler::CreateRadioButton(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateField(XFA_ELEMENT_CheckButton, pParent, pBefore);
- CXFA_Node* pUi = pField->GetFirstChildByClass(XFA_ELEMENT_Ui);
- CXFA_Node* pWidget = pUi->GetFirstChildByClass(XFA_ELEMENT_CheckButton);
+ CXFA_Node* pField = CreateField(XFA_Element::CheckButton, pParent, pBefore);
+ CXFA_Node* pUi = pField->GetFirstChildByClass(XFA_Element::Ui);
+ CXFA_Node* pWidget = pUi->GetFirstChildByClass(XFA_Element::CheckButton);
pWidget->SetEnum(XFA_ATTRIBUTE_Shape, XFA_ATTRIBUTEENUM_Round);
return pField;
}
CXFA_Node* CXFA_FFWidgetHandler::CreateDatetimeEdit(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateField(XFA_ELEMENT_DateTimeEdit, pParent, pBefore);
- CreateValueNode(XFA_ELEMENT_Date, pField);
+ CXFA_Node* pField = CreateField(XFA_Element::DateTimeEdit, pParent, pBefore);
+ CreateValueNode(XFA_Element::Date, pField);
return pField;
}
CXFA_Node* CXFA_FFWidgetHandler::CreateDecimalField(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
CXFA_Node* pField = CreateNumericField(pParent, pBefore);
- CreateValueNode(XFA_ELEMENT_Decimal, pField);
+ CreateValueNode(XFA_Element::Decimal, pField);
return pField;
}
CXFA_Node* CXFA_FFWidgetHandler::CreateNumericField(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- return CreateField(XFA_ELEMENT_NumericEdit, pParent, pBefore);
+ return CreateField(XFA_Element::NumericEdit, pParent, pBefore);
}
CXFA_Node* CXFA_FFWidgetHandler::CreateSignature(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- return CreateField(XFA_ELEMENT_Signature, pParent, pBefore);
+ return CreateField(XFA_Element::Signature, pParent, pBefore);
}
CXFA_Node* CXFA_FFWidgetHandler::CreateTextEdit(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- return CreateField(XFA_ELEMENT_TextEdit, pParent, pBefore);
+ return CreateField(XFA_Element::TextEdit, pParent, pBefore);
}
CXFA_Node* CXFA_FFWidgetHandler::CreateDropdownList(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- return CreateField(XFA_ELEMENT_ChoiceList, pParent, pBefore);
+ return CreateField(XFA_Element::ChoiceList, pParent, pBefore);
}
CXFA_Node* CXFA_FFWidgetHandler::CreateListBox(CXFA_Node* pParent,
@@ -413,70 +413,72 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateListBox(CXFA_Node* pParent,
CXFA_Node* CXFA_FFWidgetHandler::CreateImageField(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- return CreateField(XFA_ELEMENT_ImageEdit, pParent, pBefore);
+ return CreateField(XFA_Element::ImageEdit, pParent, pBefore);
}
CXFA_Node* CXFA_FFWidgetHandler::CreatePasswordEdit(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateField(XFA_ELEMENT_PasswordEdit, pParent, pBefore);
- CXFA_Node* pBind = CreateCopyNode(XFA_ELEMENT_Bind, pField);
+ CXFA_Node* pField = CreateField(XFA_Element::PasswordEdit, pParent, pBefore);
+ CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField);
pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None, FALSE);
return pField;
}
-CXFA_Node* CXFA_FFWidgetHandler::CreateField(XFA_ELEMENT eElement,
+CXFA_Node* CXFA_FFWidgetHandler::CreateField(XFA_Element eElement,
CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateFormItem(XFA_ELEMENT_Field, pParent, pBefore);
- CreateCopyNode(eElement, CreateCopyNode(XFA_ELEMENT_Ui, pField));
+ CXFA_Node* pField = CreateFormItem(XFA_Element::Field, pParent, pBefore);
+ CreateCopyNode(eElement, CreateCopyNode(XFA_Element::Ui, pField));
CreateFontNode(pField);
return pField;
}
CXFA_Node* CXFA_FFWidgetHandler::CreateArc(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- return CreateDraw(XFA_ELEMENT_Arc, pParent, pBefore);
+ return CreateDraw(XFA_Element::Arc, pParent, pBefore);
}
CXFA_Node* CXFA_FFWidgetHandler::CreateRectangle(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- return CreateDraw(XFA_ELEMENT_Rectangle, pParent, pBefore);
+ return CreateDraw(XFA_Element::Rectangle, pParent, pBefore);
}
CXFA_Node* CXFA_FFWidgetHandler::CreateImage(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateDraw(XFA_ELEMENT_Image, pParent, pBefore);
- CreateCopyNode(XFA_ELEMENT_ImageEdit, CreateCopyNode(XFA_ELEMENT_Ui, pField));
+ CXFA_Node* pField = CreateDraw(XFA_Element::Image, pParent, pBefore);
+ CreateCopyNode(XFA_Element::ImageEdit,
+ CreateCopyNode(XFA_Element::Ui, pField));
return pField;
}
CXFA_Node* CXFA_FFWidgetHandler::CreateLine(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- return CreateDraw(XFA_ELEMENT_Line, pParent, pBefore);
+ return CreateDraw(XFA_Element::Line, pParent, pBefore);
}
CXFA_Node* CXFA_FFWidgetHandler::CreateText(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateDraw(XFA_ELEMENT_Text, pParent, pBefore);
- CreateCopyNode(XFA_ELEMENT_TextEdit, CreateCopyNode(XFA_ELEMENT_Ui, pField));
+ CXFA_Node* pField = CreateDraw(XFA_Element::Text, pParent, pBefore);
+ CreateCopyNode(XFA_Element::TextEdit,
+ CreateCopyNode(XFA_Element::Ui, pField));
CreateFontNode(pField);
return pField;
}
-CXFA_Node* CXFA_FFWidgetHandler::CreateDraw(XFA_ELEMENT eElement,
+CXFA_Node* CXFA_FFWidgetHandler::CreateDraw(XFA_Element eElement,
CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- CXFA_Node* pDraw = CreateFormItem(XFA_ELEMENT_Draw, pParent, pBefore);
+ CXFA_Node* pDraw = CreateFormItem(XFA_Element::Draw, pParent, pBefore);
CreateValueNode(eElement, pDraw);
return pDraw;
}
CXFA_Node* CXFA_FFWidgetHandler::CreateSubform(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
- return CreateFormItem(XFA_ELEMENT_Subform, pParent, pBefore);
+ return CreateFormItem(XFA_Element::Subform, pParent, pBefore);
}
-CXFA_Node* CXFA_FFWidgetHandler::CreateFormItem(XFA_ELEMENT eElement,
+CXFA_Node* CXFA_FFWidgetHandler::CreateFormItem(XFA_Element eElement,
CXFA_Node* pParent,
CXFA_Node* pBefore) const {
CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : NULL;
@@ -486,7 +488,7 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateFormItem(XFA_ELEMENT eElement,
return pNewFormItem;
}
-CXFA_Node* CXFA_FFWidgetHandler::CreateCopyNode(XFA_ELEMENT eElement,
+CXFA_Node* CXFA_FFWidgetHandler::CreateCopyNode(XFA_Element eElement,
CXFA_Node* pParent,
CXFA_Node* pBefore) const {
CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : NULL;
@@ -499,7 +501,7 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateCopyNode(XFA_ELEMENT eElement,
return pNewNode;
}
-CXFA_Node* CXFA_FFWidgetHandler::CreateTemplateNode(XFA_ELEMENT eElement,
+CXFA_Node* CXFA_FFWidgetHandler::CreateTemplateNode(XFA_Element eElement,
CXFA_Node* pParent,
CXFA_Node* pBefore) const {
CXFA_Document* pXFADoc = GetXFADoc();
@@ -511,7 +513,7 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateTemplateNode(XFA_ELEMENT eElement,
}
CXFA_Node* CXFA_FFWidgetHandler::CreateFontNode(CXFA_Node* pParent) const {
- CXFA_Node* pFont = CreateCopyNode(XFA_ELEMENT_Font, pParent);
+ CXFA_Node* pFont = CreateCopyNode(XFA_Element::Font, pParent);
pFont->SetCData(XFA_ATTRIBUTE_Typeface, L"Myriad Pro", FALSE);
return pFont;
}
@@ -519,7 +521,7 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateFontNode(CXFA_Node* pParent) const {
CXFA_Node* CXFA_FFWidgetHandler::CreateMarginNode(CXFA_Node* pParent,
uint32_t dwFlags,
FX_FLOAT fInsets[4]) const {
- CXFA_Node* pMargin = CreateCopyNode(XFA_ELEMENT_Margin, pParent);
+ CXFA_Node* pMargin = CreateCopyNode(XFA_Element::Margin, pParent);
if (dwFlags & 0x01)
pMargin->SetMeasure(XFA_ATTRIBUTE_LeftInset,
CXFA_Measurement(fInsets[0], XFA_UNIT_Pt), FALSE);
@@ -535,9 +537,9 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateMarginNode(CXFA_Node* pParent,
return pMargin;
}
-CXFA_Node* CXFA_FFWidgetHandler::CreateValueNode(XFA_ELEMENT eValue,
+CXFA_Node* CXFA_FFWidgetHandler::CreateValueNode(XFA_Element eValue,
CXFA_Node* pParent) const {
- CXFA_Node* pValue = CreateCopyNode(XFA_ELEMENT_Value, pParent);
+ CXFA_Node* pValue = CreateCopyNode(XFA_Element::Value, pParent);
CreateCopyNode(eValue, pValue);
return pValue;
}