summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-06-20 11:11:12 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-20 11:11:12 -0700
commitc5a8f217fedc1224104b34f7577044776a9d83d8 (patch)
tree0b457b9ccc3511ad45f75fe0f385425af8d6272d /xfa/fxfa/app
parent950e68f14aa6db5022919c55ce80f346a94a762e (diff)
downloadpdfium-c5a8f217fedc1224104b34f7577044776a9d83d8.tar.xz
Split the XFA_OBJECTTYPE enum into two parts.
Currently the object type and the node flags are both mixed into the single XFA_OBJECTTYPE_* enum. These two things are un-related and should not share a single type. This Cl creates an XFA_ObjectType enum class and a XFA_NodeFlag enum to hold the two types. Accessors are added to determine if the flags are set (or called where they already existed. Review-Url: https://codereview.chromium.org/2083453003
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r--xfa/fxfa/app/xfa_ffdocview.cpp20
-rw-r--r--xfa/fxfa/app/xfa_fffield.cpp8
-rw-r--r--xfa/fxfa/app/xfa_ffnotify.cpp2
-rw-r--r--xfa/fxfa/app/xfa_ffwidgetacc.cpp43
-rw-r--r--xfa/fxfa/app/xfa_ffwidgethandler.cpp6
5 files changed, 38 insertions, 41 deletions
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp
index 90ab7cd81f..7a5397f683 100644
--- a/xfa/fxfa/app/xfa_ffdocview.cpp
+++ b/xfa/fxfa/app/xfa_ffdocview.cpp
@@ -217,7 +217,7 @@ FX_BOOL CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) {
pWidgetAcc->UpdateUIDisplay();
if (CXFA_Validate validate = pWidgetAcc->GetValidate()) {
AddValidateWidget(pWidgetAcc);
- validate.GetNode()->SetFlag(XFA_NODEFLAG_NeedsInitApp, false);
+ validate.GetNode()->SetFlag(XFA_NodeFlag_NeedsInitApp, false);
}
return TRUE;
}
@@ -417,9 +417,9 @@ static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView,
if (!calc) {
return XFA_EVENTERROR_NotExist;
}
- if (pWidgetAcc->GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) {
+ if (pWidgetAcc->GetNode()->IsUserInteractive())
return XFA_EVENTERROR_Disabled;
- }
+
CXFA_Script script = calc.GetScript();
return pWidgetAcc->ExecuteScript(script, pParam);
}
@@ -456,9 +456,9 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
}
if (bRecursive) {
for (CXFA_Node* pNode = pFormNode->GetNodeItem(
- XFA_NODEITEM_FirstChild, XFA_OBJECTTYPE_ContainerNode);
+ XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode);
pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling,
- XFA_OBJECTTYPE_ContainerNode)) {
+ XFA_ObjectType::ContainerNode)) {
elementType = pNode->GetClassID();
if (elementType != XFA_ELEMENT_Variables &&
elementType != XFA_ELEMENT_Draw) {
@@ -634,9 +634,9 @@ void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) {
int32_t iCount = pGlobalData ? pGlobalData->m_Globals.GetSize() : 0;
for (int32_t i = 0; i < iCount; i++) {
CXFA_WidgetAcc* pResultAcc = pGlobalData->m_Globals[i];
- if (pResultAcc->GetNode()->HasFlag(XFA_NODEFLAG_HasRemoved)) {
+ if (pResultAcc->GetNode()->HasRemovedChildren())
continue;
- }
+
int32_t iAccs = m_CalculateAccs.GetSize();
CXFA_WidgetAcc* pCurrentAcc =
iAccs > 0 ? m_CalculateAccs[iAccs - 1] : nullptr;
@@ -703,9 +703,9 @@ FX_BOOL CXFA_FFDocView::RunValidate() {
int32_t iCounts = m_ValidateAccs.GetSize();
for (int32_t i = 0; i < iCounts; i++) {
CXFA_WidgetAcc* pAcc = m_ValidateAccs[i];
- if (pAcc->GetNode()->HasFlag(XFA_NODEFLAG_HasRemoved)) {
+ if (pAcc->GetNode()->HasRemovedChildren())
continue;
- }
+
pAcc->ProcessValidate();
}
m_ValidateAccs.RemoveAll();
@@ -723,7 +723,7 @@ FX_BOOL CXFA_FFDocView::RunEventLayoutReady() {
}
void CXFA_FFDocView::RunBindItems() {
for (int32_t i = 0; i < m_BindItems.GetSize(); i++) {
- if (m_BindItems[i]->HasFlag(XFA_NODEFLAG_HasRemoved))
+ if (m_BindItems[i]->HasRemovedChildren())
continue;
CXFA_Node* pWidgetNode = m_BindItems[i]->GetNodeItem(XFA_NODEITEM_Parent);
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index 7fad583c5b..6d2f1e8db7 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -740,9 +740,9 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) {
return 1;
}
}
- if (pAcc->GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) {
+ if (pAcc->GetNode()->IsUserInteractive())
return 1;
- }
+
IXFA_AppProvider* pAppProvider = GetApp()->GetAppProvider();
if (pAppProvider) {
CFX_WideString wsMessage;
@@ -757,7 +757,7 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) {
pAppProvider->LoadString(XFA_IDS_CalcOverride, wsTitle);
if (pAppProvider->MsgBox(wsMessage, wsTitle, XFA_MBICON_Warning,
XFA_MB_YesNo) == XFA_IDYes) {
- pAcc->GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false);
+ pAcc->GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
return 1;
}
}
@@ -766,7 +766,7 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) {
case XFA_ATTRIBUTEENUM_Ignore:
return 0;
case XFA_ATTRIBUTEENUM_Disabled:
- pAcc->GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false);
+ pAcc->GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
default:
return 1;
}
diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp
index 6c4daeb233..58618c2270 100644
--- a/xfa/fxfa/app/xfa_ffnotify.cpp
+++ b/xfa/fxfa/app/xfa_ffnotify.cpp
@@ -331,7 +331,7 @@ void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) {
pDocView->m_BindItems.Add(pNode);
break;
case XFA_ELEMENT_Validate: {
- pNode->SetFlag(XFA_NODEFLAG_NeedsInitApp, false);
+ pNode->SetFlag(XFA_NodeFlag_NeedsInitApp, false);
} break;
default:
break;
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index 9eeccdbb44..9bf07b4556 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -214,7 +214,7 @@ void CXFA_WidgetAcc::ResetData() {
} break;
case XFA_ELEMENT_ExclGroup: {
CXFA_Node* pNextChild = m_pNode->GetNodeItem(
- XFA_NODEITEM_FirstChild, XFA_OBJECTTYPE_ContainerNode);
+ XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode);
while (pNextChild) {
CXFA_Node* pChild = pNextChild;
CXFA_WidgetAcc* pAcc =
@@ -239,7 +239,7 @@ void CXFA_WidgetAcc::ResetData() {
pAcc->SetValue(itemText, XFA_VALUEPICTURE_Raw);
}
pNextChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling,
- XFA_OBJECTTYPE_ContainerNode);
+ XFA_ObjectType::ContainerNode);
}
} break;
case XFA_ELEMENT_ChoiceList:
@@ -343,16 +343,15 @@ 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();
- if (!calc) {
+ if (!calc)
return XFA_EVENTERROR_NotExist;
- }
- if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) {
+ if (GetNode()->IsUserInteractive())
return XFA_EVENTERROR_Disabled;
- }
+
CXFA_EventParam EventParam;
EventParam.m_eType = XFA_EVENT_Calculate;
CXFA_Script script = calc.GetScript();
@@ -383,12 +382,11 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate,
validate.GetScriptMessageText(wsScriptMsg);
int32_t eScriptTest = validate.GetScriptTest();
if (eScriptTest == XFA_ATTRIBUTEENUM_Warning) {
- if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) {
+ if (GetNode()->IsUserInteractive())
return;
- }
- if (wsScriptMsg.IsEmpty()) {
+ if (wsScriptMsg.IsEmpty())
GetValidateMessage(pAppProvider, wsScriptMsg, FALSE, bVersionFlag);
- }
+
if (bVersionFlag) {
pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning,
XFA_MB_OK);
@@ -396,7 +394,7 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate,
}
if (pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning,
XFA_MB_YesNo) == XFA_IDYes) {
- GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false);
+ GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
}
} else {
if (wsScriptMsg.IsEmpty()) {
@@ -438,12 +436,11 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate,
pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK);
return XFA_EVENTERROR_Success;
}
- if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) {
+ if (GetNode()->IsUserInteractive())
return XFA_EVENTERROR_NotExist;
- }
- if (wsFormatMsg.IsEmpty()) {
+ if (wsFormatMsg.IsEmpty())
GetValidateMessage(pAppProvider, wsFormatMsg, FALSE, bVersionFlag);
- }
+
if (bVersionFlag) {
pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning,
XFA_MB_OK);
@@ -451,7 +448,7 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate,
}
if (pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning,
XFA_MB_YesNo) == XFA_IDYes) {
- GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false);
+ GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
}
return XFA_EVENTERROR_Success;
}
@@ -509,9 +506,9 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate,
return XFA_EVENTERROR_Error;
}
case XFA_ATTRIBUTEENUM_Warning: {
- if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) {
+ if (GetNode()->IsUserInteractive())
return TRUE;
- }
+
if (wsNullMsg.IsEmpty()) {
GetValidateCaptionName(wsCaptionName, bVersionFlag);
CFX_WideString wsWarning;
@@ -521,7 +518,7 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate,
}
if (pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Warning,
XFA_MB_YesNo) == XFA_IDYes) {
- GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false);
+ GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
}
return XFA_EVENTERROR_Error;
}
@@ -579,7 +576,7 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) {
if (!validate) {
return XFA_EVENTERROR_NotExist;
}
- FX_BOOL bInitDoc = validate.GetNode()->HasFlag(XFA_NODEFLAG_NeedsInitApp);
+ FX_BOOL bInitDoc = validate.GetNode()->NeedsInitApp();
FX_BOOL bStatus =
m_pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End;
int32_t iFormat = 0;
@@ -601,7 +598,7 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) {
bVersionFlag = TRUE;
}
if (bInitDoc) {
- validate.GetNode()->ClearFlag(XFA_NODEFLAG_NeedsInitApp);
+ validate.GetNode()->ClearFlag(XFA_NodeFlag_NeedsInitApp);
} else {
iFormat = ProcessFormatTestValidate(validate, bVersionFlag);
if (!bVersionFlag) {
diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp
index 87ef610882..eeaadc73b2 100644
--- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp
@@ -235,7 +235,7 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc,
CXFA_Calculate calc = pWidgetAcc->GetCalculate();
if (!calc)
return XFA_EVENTERROR_NotExist;
- if (pWidgetAcc->GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive))
+ if (pWidgetAcc->GetNode()->IsUserInteractive())
return XFA_EVENTERROR_Disabled;
CXFA_Script script = calc.GetScript();
@@ -261,8 +261,8 @@ CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent,
if (!pNewFormItem)
return nullptr;
- pNewFormItem->GetTemplateNode()->SetFlag(XFA_NODEFLAG_Initialized, true);
- pNewFormItem->SetFlag(XFA_NODEFLAG_Initialized, true);
+ pNewFormItem->GetTemplateNode()->SetFlag(XFA_NodeFlag_Initialized, true);
+ pNewFormItem->SetFlag(XFA_NodeFlag_Initialized, true);
m_pDocView->RunLayout();
CXFA_LayoutItem* pLayout =
m_pDocView->GetXFALayout()->GetLayoutItem(pNewFormItem);