summaryrefslogtreecommitdiff
path: root/xfa/src/fxfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/src/fxfa')
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffdoc.cpp13
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffdochandler.cpp2
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffdocview.cpp36
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp2
-rw-r--r--xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp84
-rw-r--r--xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp45
-rw-r--r--xfa/src/fxfa/src/parser/xfa_document_imp.cpp15
-rw-r--r--xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp2
-rw-r--r--xfa/src/fxfa/src/parser/xfa_document_serialize.cpp7
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp2
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp9
-rw-r--r--xfa/src/fxfa/src/parser/xfa_object_imp.cpp105
-rw-r--r--xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp12
-rw-r--r--xfa/src/fxfa/src/parser/xfa_script_hostpseudomodel.cpp10
-rw-r--r--xfa/src/fxfa/src/parser/xfa_script_imp.cpp41
-rw-r--r--xfa/src/fxfa/src/parser/xfa_script_layoutpseudomodel.cpp10
-rw-r--r--xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp4
-rw-r--r--xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp45
-rw-r--r--xfa/src/fxfa/src/parser/xfa_script_signaturepseudomodel.cpp4
19 files changed, 217 insertions, 231 deletions
diff --git a/xfa/src/fxfa/src/app/xfa_ffdoc.cpp b/xfa/src/fxfa/src/app/xfa_ffdoc.cpp
index 012aa4c6a5..87745616e0 100644
--- a/xfa/src/fxfa/src/app/xfa_ffdoc.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffdoc.cpp
@@ -100,8 +100,7 @@ void XFA_XPDPacket_MergeRootNode(CXFA_Node* pOriginRoot, CXFA_Node* pNewRoot) {
int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) {
int32_t iStatus = m_pDocument->GetParser()->DoParse(pPause);
if (iStatus == XFA_PARSESTATUS_Done && !m_pPDFDoc) {
- CXFA_Node* pPDFNode =
- (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Pdf);
+ CXFA_Node* pPDFNode = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Pdf));
if (!pPDFNode) {
return XFA_PARSESTATUS_SyntaxErr;
}
@@ -160,8 +159,7 @@ int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) {
void CXFA_FFDoc::StopLoad() {
m_pApp->GetXFAFontMgr()->LoadDocFonts(this);
m_dwDocType = XFA_DOCTYPE_Static;
- CXFA_Node* pConfig =
- (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Config);
+ CXFA_Node* pConfig = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Config));
if (!pConfig) {
return;
}
@@ -397,9 +395,7 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName,
IFDE_XMLElement* CXFA_FFDoc::GetPackageData(const CFX_WideStringC& wsPackage) {
FX_DWORD packetHash =
FX_HashCode_String_GetW(wsPackage.GetPtr(), wsPackage.GetLength());
- CXFA_Object* pObject = m_pDocument->GetXFAObject(packetHash);
- CXFA_Node* pNode =
- (pObject && pObject->IsNode()) ? (CXFA_Node*)pObject : NULL;
+ CXFA_Node* pNode = ToNode(m_pDocument->GetXFAObject(packetHash));
if (!pNode) {
return NULL;
}
@@ -421,8 +417,7 @@ FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage,
if (packetHash == XFA_HASHCODE_Xfa) {
pNode = m_pDocument->GetRoot();
} else {
- CXFA_Object* pObject = m_pDocument->GetXFAObject(packetHash);
- pNode = (pObject && pObject->IsNode()) ? (CXFA_Node*)pObject : NULL;
+ pNode = ToNode(m_pDocument->GetXFAObject(packetHash));
}
FX_BOOL bFlags = FALSE;
if (pNode) {
diff --git a/xfa/src/fxfa/src/app/xfa_ffdochandler.cpp b/xfa/src/fxfa/src/app/xfa_ffdochandler.cpp
index 2fac3449ad..3bb4bfdc58 100644
--- a/xfa/src/fxfa/src/app/xfa_ffdochandler.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffdochandler.cpp
@@ -79,7 +79,7 @@ XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(IXFA_Doc* hDoc) {
if (!pXFADoc) {
return XFA_ATTRIBUTEENUM_Unknown;
}
- CXFA_Node* pForm = (CXFA_Node*)pXFADoc->GetXFAObject(XFA_HASHCODE_Form);
+ CXFA_Node* pForm = ToNode(pXFADoc->GetXFAObject(XFA_HASHCODE_Form));
if (!pForm) {
return XFA_ATTRIBUTEENUM_Unknown;
}
diff --git a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp
index 5232d19417..345b142f47 100644
--- a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp
@@ -80,7 +80,7 @@ int32_t CXFA_FFDocView::StartLayout(int32_t iStartPage) {
return iStatus;
}
CXFA_Node* pRootItem =
- (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form);
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
if (!pRootItem) {
return iStatus;
}
@@ -102,7 +102,7 @@ int32_t CXFA_FFDocView::DoLayout(IFX_Pause* pPause) {
}
void CXFA_FFDocView::StopLayout() {
CXFA_Node* pRootItem =
- (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form);
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
if (!pRootItem) {
return;
}
@@ -170,7 +170,7 @@ void CXFA_FFDocView::UpdateDocView() {
LockUpdate();
int32_t iNewAdds = m_NewAddedNodes.GetSize();
for (int32_t i = 0; i < iNewAdds; i++) {
- CXFA_Node* pNode = (CXFA_Node*)m_NewAddedNodes[i];
+ CXFA_Node* pNode = reinterpret_cast<CXFA_Node*>(m_NewAddedNodes[i]);
InitCalculate(pNode);
InitValidate(pNode);
ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Ready, TRUE);
@@ -265,7 +265,7 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam,
if (pParam->m_eType == XFA_EVENT_Validate) {
CFX_WideString wsValidateStr = FX_WSTRC(L"preSubmit");
CXFA_Node* pConfigItem =
- (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config);
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config));
if (pConfigItem) {
CXFA_Node* pValidateNode = NULL;
CXFA_Node* pAcrobatNode = pConfigItem->GetChild(0, XFA_ELEMENT_Acrobat);
@@ -303,7 +303,7 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam,
CXFA_Node* pNode = pWidgetAcc ? pWidgetAcc->GetNode() : NULL;
if (!pNode) {
CXFA_Node* pRootItem =
- (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form);
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
if (!pRootItem) {
return XFA_EVENTERROR_Error;
}
@@ -525,9 +525,9 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName(
return NULL;
}
if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
- CXFA_Object* pNode = resoveNodeRS.nodes[0];
- if (pNode->IsNode()) {
- return (CXFA_WidgetAcc*)((CXFA_Node*)pNode)->GetWidgetData();
+ CXFA_Node* pNode = resoveNodeRS.nodes[0]->AsNode();
+ if (pNode) {
+ return (CXFA_WidgetAcc*)pNode->GetWidgetData();
}
}
return NULL;
@@ -613,7 +613,8 @@ FX_BOOL CXFA_FFDocView::RunLayout() {
void CXFA_FFDocView::RunSubformIndexChange() {
int32_t iSubforms = m_IndexChangedSubforms.GetSize();
for (int32_t i = 0; i < iSubforms; i++) {
- CXFA_Node* pSubformNode = (CXFA_Node*)m_IndexChangedSubforms[i];
+ CXFA_Node* pSubformNode =
+ reinterpret_cast<CXFA_Node*>(m_IndexChangedSubforms[i]);
CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pSubformNode->GetWidgetData();
if (!pWidgetAcc) {
continue;
@@ -635,7 +636,7 @@ void CXFA_FFDocView::AddIndexChangedSubform(CXFA_Node* pNode) {
}
void CXFA_FFDocView::RunDocClose() {
CXFA_Node* pRootItem =
- (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form);
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
if (!pRootItem) {
return;
}
@@ -748,7 +749,7 @@ FX_BOOL CXFA_FFDocView::RunValidate() {
}
FX_BOOL CXFA_FFDocView::RunEventLayoutReady() {
CXFA_Node* pRootItem =
- (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form);
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
if (!pRootItem) {
return FALSE;
}
@@ -759,16 +760,17 @@ FX_BOOL CXFA_FFDocView::RunEventLayoutReady() {
void CXFA_FFDocView::RunBindItems() {
int32_t iCount = m_bindItems.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- if (((CXFA_Node*)m_bindItems[i])->HasFlag(XFA_NODEFLAG_HasRemoved)) {
+ if (reinterpret_cast<CXFA_Node*>(m_bindItems[i])
+ ->HasFlag(XFA_NODEFLAG_HasRemoved)) {
continue;
}
- CXFA_Node* pWidgetNode =
- ((CXFA_Node*)m_bindItems[i])->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pWidgetNode = reinterpret_cast<CXFA_Node*>(m_bindItems[i])
+ ->GetNodeItem(XFA_NODEITEM_Parent);
CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pWidgetNode->GetWidgetData();
if (!pAcc) {
continue;
}
- CXFA_BindItems binditems((CXFA_Node*)m_bindItems[i]);
+ CXFA_BindItems binditems(reinterpret_cast<CXFA_Node*>(m_bindItems[i]));
IXFA_ScriptContext* pScriptContext =
pWidgetNode->GetDocument()->GetScriptContext();
CFX_WideStringC wsRef;
@@ -799,7 +801,7 @@ void CXFA_FFDocView::RunBindItems() {
if (!refObj->IsNode()) {
continue;
}
- CXFA_Node* refNode = (CXFA_Node*)refObj;
+ CXFA_Node* refNode = refObj->AsNode();
if (bValueUseContent) {
wsValue = refNode->GetContent();
} else {
@@ -835,7 +837,7 @@ void CXFA_FFDocView::SetChangeMark() {
}
CXFA_Node* CXFA_FFDocView::GetRootSubform() {
CXFA_Node* pFormPacketNode =
- (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form);
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
if (!pFormPacketNode) {
return NULL;
}
diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp
index 05ffefdf5d..81bfa53dc3 100644
--- a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp
@@ -1701,7 +1701,7 @@ FX_BOOL CXFA_TextProvider::GetEmbbedObj(FX_BOOL bURI,
}
if (!pIDNode) {
pIDNode = pDocument->GetNodeByID(
- (CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Form), wsAttr);
+ ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), wsAttr);
}
if (pIDNode) {
pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData();
diff --git a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp
index 49ab94fd60..529474f5eb 100644
--- a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp
@@ -1549,9 +1549,10 @@ void CXFA_FM2JSContext::Time2Num(FXJSE_HOBJECT hThis,
IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr();
IFX_Locale* pLocale = NULL;
if (localString.IsEmpty()) {
- CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject();
- FXSYS_assert(pThisNode->IsNode());
- CXFA_WidgetData widgetData((CXFA_Node*)pThisNode);
+ CXFA_Node* pThisNode =
+ ToNode(pDoc->GetScriptContext()->GetThisObject());
+ FXSYS_assert(pThisNode);
+ CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
pLocale = pMgr->GetLocaleByName(
@@ -1998,9 +1999,9 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoDate(FXJSE_HOBJECT hThis,
IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr();
IFX_Locale* pLocale = NULL;
if (szLocale.IsEmpty()) {
- CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject();
- FXSYS_assert(pThisNode->IsNode());
- CXFA_WidgetData widgetData((CXFA_Node*)pThisNode);
+ CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ FXSYS_assert(pThisNode);
+ CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
pLocale = pMgr->GetLocaleByName(
@@ -2038,9 +2039,9 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoTime(FXJSE_HOBJECT hThis,
IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr();
IFX_Locale* pLocale = NULL;
if (szLocale.IsEmpty()) {
- CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject();
- FXSYS_assert(pThisNode->IsNode());
- CXFA_WidgetData widgetData((CXFA_Node*)pThisNode);
+ CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ FXSYS_assert(pThisNode);
+ CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
pLocale = pMgr->GetLocaleByName(
@@ -2081,9 +2082,9 @@ FX_BOOL CXFA_FM2JSContext::IsoDate2Local(FXJSE_HOBJECT hThis,
IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr();
IFX_Locale* pLocale = NULL;
if (szLocale.IsEmpty()) {
- CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject();
- FXSYS_assert(pThisNode->IsNode());
- CXFA_WidgetData widgetData((CXFA_Node*)pThisNode);
+ CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ FXSYS_assert(pThisNode);
+ CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
pLocale = pMgr->GetLocaleByName(
@@ -2123,9 +2124,9 @@ FX_BOOL CXFA_FM2JSContext::IsoTime2Local(FXJSE_HOBJECT hThis,
IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr();
IFX_Locale* pLocale = NULL;
if (szLocale.IsEmpty()) {
- CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject();
- FXSYS_assert(pThisNode->IsNode());
- CXFA_WidgetData widgetData((CXFA_Node*)pThisNode);
+ CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ FXSYS_assert(pThisNode);
+ CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
pLocale = pMgr->GetLocaleByName(
@@ -2167,9 +2168,9 @@ FX_BOOL CXFA_FM2JSContext::GetGMTTime(FXJSE_HOBJECT hThis,
IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr();
IFX_Locale* pLocale = NULL;
if (szLocale.IsEmpty()) {
- CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject();
- FXSYS_assert(pThisNode->IsNode());
- CXFA_WidgetData widgetData((CXFA_Node*)pThisNode);
+ CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ FXSYS_assert(pThisNode);
+ CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
pLocale = pMgr->GetLocaleByName(
@@ -2352,9 +2353,9 @@ void CXFA_FM2JSContext::GetLocalDateFormat(FXJSE_HOBJECT hThis,
IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr();
IFX_Locale* pLocale = NULL;
if (szLocalStr.IsEmpty()) {
- CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject();
- FXSYS_assert(pThisNode->IsNode());
- CXFA_WidgetData widgetData((CXFA_Node*)pThisNode);
+ CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ FXSYS_assert(pThisNode);
+ CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
pLocale = pMgr->GetLocaleByName(
@@ -2407,9 +2408,8 @@ void CXFA_FM2JSContext::GetLocalTimeFormat(FXJSE_HOBJECT hThis,
IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr();
IFX_Locale* pLocale = NULL;
if (szLocalStr.IsEmpty()) {
- CXFA_Object* pThisObject = pDoc->GetScriptContext()->GetThisObject();
- FXSYS_assert(pThisObject->IsNode());
- CXFA_Node* pThisNode = (CXFA_Node*)pThisObject;
+ CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ FXSYS_assert(pThisNode);
CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
@@ -4359,9 +4359,9 @@ void CXFA_FM2JSContext::Format(FXJSE_HOBJECT hThis,
HValueToUTF8String(argTwo, szValue);
CXFA_Document* pDoc = pContext->GetDocument();
IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr();
- CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject();
- FXSYS_assert(pThisNode->IsNode());
- CXFA_WidgetData widgetData((CXFA_Node*)pThisNode);
+ CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ FXSYS_assert(pThisNode);
+ CXFA_WidgetData widgetData(pThisNode);
IFX_Locale* pLocale = widgetData.GetLocal();
FX_DWORD patternType;
FX_BOOL bCompelte = XFA_PATTERN_STRING_Type(szPattern, patternType);
@@ -4571,9 +4571,9 @@ void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis,
HValueToUTF8String(argTwo, szValue);
CXFA_Document* pDoc = pContext->GetDocument();
IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr();
- CXFA_Object* pThisNode = pDoc->GetScriptContext()->GetThisObject();
- FXSYS_assert(pThisNode->IsNode());
- CXFA_WidgetData widgetData((CXFA_Node*)pThisNode);
+ CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ FXSYS_assert(pThisNode);
+ CXFA_WidgetData widgetData(pThisNode);
IFX_Locale* pLocale = widgetData.GetLocal();
FX_DWORD patternType;
FX_BOOL bCompletePattern =
@@ -6753,24 +6753,23 @@ void CXFA_FM2JSContext::unfoldArgs(FXJSE_HOBJECT hThis,
}
void CXFA_FM2JSContext::GetObjectDefaultValue(FXJSE_HVALUE hObjectValue,
FXJSE_HVALUE hDefaultValue) {
- CXFA_Object* pNode = (CXFA_Object*)FXJSE_Value_ToObject(hObjectValue, NULL);
- if (pNode && pNode->IsNode()) {
- ((CXFA_Node*)pNode)
- ->Script_Som_DefaultValue(hDefaultValue, FALSE, (XFA_ATTRIBUTE)-1);
+ CXFA_Node* pNode =
+ ToNode((CXFA_Object*)FXJSE_Value_ToObject(hObjectValue, NULL));
+ if (pNode) {
+ pNode->Script_Som_DefaultValue(hDefaultValue, FALSE, (XFA_ATTRIBUTE)-1);
} else {
FXJSE_Value_SetNull(hDefaultValue);
}
}
FX_BOOL CXFA_FM2JSContext::SetObjectDefaultValue(FXJSE_HVALUE hObjectValue,
FXJSE_HVALUE hNewValue) {
- FX_BOOL bSuccess = FALSE;
- CXFA_Object* pNode = (CXFA_Object*)FXJSE_Value_ToObject(hObjectValue, NULL);
- if (pNode && pNode->IsNode()) {
- ((CXFA_Node*)pNode)
- ->Script_Som_DefaultValue(hNewValue, TRUE, (XFA_ATTRIBUTE)-1);
- bSuccess = TRUE;
+ CXFA_Node* pNode =
+ ToNode((CXFA_Object*)FXJSE_Value_ToObject(hObjectValue, NULL));
+ if (pNode) {
+ pNode->Script_Som_DefaultValue(hNewValue, TRUE, (XFA_ATTRIBUTE)-1);
+ return TRUE;
}
- return bSuccess;
+ return FALSE;
}
void CXFA_FM2JSContext::GenerateSomExpression(const CFX_ByteStringC& szName,
int32_t iIndexFlags,
@@ -6855,8 +6854,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(FXJSE_HOBJECT hThis,
FXSYS_assert(pNode);
if (bHasNoResolveName) {
CFX_WideString wsName;
- if (pNode->IsNode()) {
- CXFA_Node* pXFANode = (CXFA_Node*)pNode;
+ if (CXFA_Node* pXFANode = pNode->AsNode()) {
pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE);
}
if (wsName.IsEmpty()) {
diff --git a/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp
index 058ed483d0..50685056f4 100644
--- a/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp
@@ -459,11 +459,11 @@ static CXFA_Node* XFA_DataMerge_FindDataRefDataNode(CXFA_Document* pDocument,
rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll ||
rs.nodes.GetSize() > 1) {
return pDocument->GetNotBindNode(rs.nodes);
- } else if (rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeOne) {
+ }
+ if (rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeOne) {
CXFA_Object* pObject = (rs.nodes.GetSize() > 0) ? rs.nodes[0] : NULL;
- CXFA_Node* pNode =
- (pObject && pObject->IsNode()) ? (CXFA_Node*)pObject : NULL;
- if (!bForceBind && (pNode != NULL) && pNode->HasBindItem()) {
+ CXFA_Node* pNode = ToNode(pObject);
+ if (!bForceBind && pNode && pNode->HasBindItem()) {
pNode = NULL;
}
return pNode;
@@ -840,7 +840,8 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet(
subformMapArray.GetStartPosition();
for (int32_t iIndex = 0; iIndex < subformArray.GetSize(); iIndex++) {
CXFA_Node* pSubform = subformArray[iIndex];
- CXFA_Node* pDataNode = (CXFA_Node*)subformMapArray.GetValueAt(pSubform);
+ CXFA_Node* pDataNode =
+ reinterpret_cast<CXFA_Node*>(subformMapArray.GetValueAt(pSubform));
for (CXFA_Node* pTemplateChild =
pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem(
@@ -1162,7 +1163,7 @@ static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument,
? XFA_ELEMENT_DataGroup
: XFA_ELEMENT_DataValue;
CXFA_Node* pRecordNode =
- (CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Record);
+ ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record));
pDataNode = XFA_DataDescription_MaybeCreateDataNode(
pDocument, pRecordNode, eDataNodeType,
pFormNode->GetCData(XFA_ATTRIBUTE_Name));
@@ -1192,8 +1193,7 @@ static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument,
pDocument->GetScriptContext()->ResolveObjects(pDataScope, wsRef, rs,
dFlags, pTemplateNode);
CXFA_Object* pObject = (rs.nodes.GetSize() > 0) ? rs.nodes[0] : NULL;
- pDataNode =
- (pObject && pObject->IsNode()) ? (CXFA_Node*)pObject : NULL;
+ pDataNode = ToNode(pObject);
if (pDataNode) {
XFA_DataMerge_CreateDataBinding(
pFormNode, pDataNode,
@@ -1279,7 +1279,7 @@ static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument, CXFA_
? XFA_ELEMENT_DataGroup
: XFA_ELEMENT_DataValue;
CXFA_Node* pRecordNode =
- (CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Record);
+ ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record));
pDataNode = XFA_DataDescription_MaybeCreateDataNode(
pDocument, pRecordNode, eDataNodeType,
pFormNode->GetCData(XFA_ATTRIBUTE_Name));
@@ -1302,7 +1302,7 @@ static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument, CXFA_
pDocument->GetScriptContext()->ResolveObjects(pDataScope, wsRef, rs,
dFlags, pTemplateNode);
CXFA_Object* pObject = (rs.nodes.GetSize() > 0) ? rs.nodes[0] : NULL;
- pDataNode = (pObject && pObject->IsNode()) ? (CXFA_Node*)pObject : NULL;
+ pDataNode = ToNode(pObject);
if (pDataNode) {
XFA_DataMerge_CreateDataBinding(pFormNode, pDataNode, FALSE);
}
@@ -1337,8 +1337,8 @@ CXFA_Node* XFA_DataMerge_FindDataScope(CXFA_Node* pParentFormNode) {
return pDataScope;
}
}
- return (CXFA_Node*)pParentFormNode->GetDocument()->GetXFAObject(
- XFA_HASHCODE_Data);
+ return ToNode(
+ pParentFormNode->GetDocument()->GetXFAObject(XFA_HASHCODE_Data));
}
void CXFA_Document::DataMerge_UpdateBindingRelations(
CXFA_Node* pFormUpdateRoot) {
@@ -1359,10 +1359,10 @@ void CXFA_Document::DataMerge_UpdateBindingRelations(
while (rgFormNodeList.GetCount()) {
FX_POSITION pos;
pos = rgFormNodeList.GetHeadPosition();
- CXFA_Node* pCurFormNode = (CXFA_Node*)rgFormNodeList.GetAt(pos);
+ CXFA_Node* pCurFormNode = ToNode(rgFormNodeList.GetAt(pos));
rgFormNodeList.RemoveAt(pos);
pos = rgDataScopeList.GetHeadPosition();
- CXFA_Node* pCurDataScope = (CXFA_Node*)rgDataScopeList.GetAt(pos);
+ CXFA_Node* pCurDataScope = ToNode(rgDataScopeList.GetAt(pos));
rgDataScopeList.RemoveAt(pos);
XFA_DataMerge_UpdateBindingRelations(this, pCurFormNode, pCurDataScope,
rgFormNodeList, rgDataScopeList);
@@ -1371,19 +1371,14 @@ void CXFA_Document::DataMerge_UpdateBindingRelations(
}
CXFA_Node* CXFA_Document::GetNotBindNode(CXFA_ObjArray& arrayNodes) {
for (int32_t i = 0; i < arrayNodes.GetSize(); i++) {
- CXFA_Object* pObject = arrayNodes[i];
- if (!pObject->IsNode()) {
- continue;
- }
- if (((CXFA_Node*)pObject)->HasBindItem()) {
- continue;
- }
- return ((CXFA_Node*)pObject);
+ CXFA_Node* pNode = arrayNodes[i]->AsNode();
+ if (pNode && !pNode->HasBindItem())
+ return pNode;
}
- return NULL;
+ return nullptr;
}
void CXFA_Document::DoDataMerge() {
- CXFA_Node* pDatasetsRoot = (CXFA_Node*)GetXFAObject(XFA_HASHCODE_Datasets);
+ CXFA_Node* pDatasetsRoot = ToNode(GetXFAObject(XFA_HASHCODE_Datasets));
if (!pDatasetsRoot) {
IFDE_XMLElement* pDatasetsXMLNode =
IFDE_XMLElement::Create(FX_WSTRC(L"xfa:datasets"));
@@ -1537,7 +1532,7 @@ void CXFA_Document::DoDataMerge() {
}
}
void CXFA_Document::DoDataRemerge(FX_BOOL bDoDataMerge) {
- CXFA_Node* pFormRoot = (CXFA_Node*)this->GetXFAObject(XFA_HASHCODE_Form);
+ CXFA_Node* pFormRoot = ToNode(GetXFAObject(XFA_HASHCODE_Form));
if (pFormRoot) {
while (CXFA_Node* pNode = pFormRoot->GetNodeItem(XFA_NODEITEM_FirstChild)) {
pFormRoot->RemoveChild(pNode);
diff --git a/xfa/src/fxfa/src/parser/xfa_document_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_imp.cpp
index ed50ce4822..6b7a0350e6 100644
--- a/xfa/src/fxfa/src/parser/xfa_document_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_document_imp.cpp
@@ -97,8 +97,7 @@ CXFA_Object* CXFA_Document::GetXFAObject(const CFX_WideStringC& wsNodeName) {
CXFA_Object* CXFA_Document::GetXFAObject(FX_DWORD dwNodeNameHash) {
switch (dwNodeNameHash) {
case XFA_HASHCODE_Data: {
- CXFA_Node* pDatasetsNode =
- (CXFA_Node*)GetXFAObject(XFA_HASHCODE_Datasets);
+ CXFA_Node* pDatasetsNode = ToNode(GetXFAObject(XFA_HASHCODE_Datasets));
if (!pDatasetsNode) {
return NULL;
}
@@ -125,7 +124,7 @@ CXFA_Object* CXFA_Document::GetXFAObject(FX_DWORD dwNodeNameHash) {
}
return NULL;
case XFA_HASHCODE_Record: {
- CXFA_Node* pData = (CXFA_Node*)GetXFAObject(XFA_HASHCODE_Data);
+ CXFA_Node* pData = ToNode(GetXFAObject(XFA_HASHCODE_Data));
return pData ? pData->GetFirstChildByClass(XFA_ELEMENT_DataGroup) : NULL;
}
case XFA_HASHCODE_DataWindow: {
@@ -213,7 +212,7 @@ FX_BOOL CXFA_Document::IsInteractive() {
if (m_dwDocFlags & XFA_DOCFLAG_HasInteractive) {
return m_dwDocFlags & XFA_DOCFLAG_Interactive;
}
- CXFA_Node* pConfig = (CXFA_Node*)this->GetXFAObject(XFA_HASHCODE_Config);
+ CXFA_Node* pConfig = ToNode(GetXFAObject(XFA_HASHCODE_Config));
if (!pConfig) {
return FALSE;
}
@@ -240,9 +239,9 @@ FX_BOOL CXFA_Document::IsInteractive() {
CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() {
if (!m_pLocalMgr) {
CFX_WideString wsLanguage;
- this->GetParser()->GetNotify()->GetAppProvider()->GetLanguage(wsLanguage);
+ GetParser()->GetNotify()->GetAppProvider()->GetLanguage(wsLanguage);
m_pLocalMgr = new CXFA_LocaleMgr(
- (CXFA_Node*)this->GetXFAObject(XFA_HASHCODE_LocaleSet), wsLanguage);
+ ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)), wsLanguage);
}
return m_pLocalMgr;
}
@@ -356,7 +355,7 @@ static void XFA_ProtoMerge_MergeNode(CXFA_Document* pDocument,
}
}
void CXFA_Document::DoProtoMerge() {
- CXFA_Node* pTemplateRoot = (CXFA_Node*)GetXFAObject(XFA_HASHCODE_Template);
+ CXFA_Node* pTemplateRoot = ToNode(GetXFAObject(XFA_HASHCODE_Template));
if (!pTemplateRoot) {
return;
}
@@ -425,7 +424,7 @@ void CXFA_Document::DoProtoMerge() {
int32_t iRet = m_pScriptContext->ResolveObjects(pUseHrefNode, wsSOM,
resoveNodeRS, dwFlag);
if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) {
- pProtoNode = (CXFA_Node*)resoveNodeRS.nodes[0];
+ pProtoNode = resoveNodeRS.nodes[0]->AsNode();
}
} else if (!wsID.IsEmpty()) {
if (!mIDMap.Lookup(
diff --git a/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp
index a9843fae2b..1c47ccb009 100644
--- a/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp
@@ -52,7 +52,7 @@ int32_t CXFA_LayoutProcessor::StartLayout(FX_BOOL bForceRestart) {
}
m_nProgressCounter = 0;
CXFA_Node* pFormPacketNode =
- (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form);
+ ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form));
if (!pFormPacketNode) {
return -1;
}
diff --git a/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp b/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp
index b5eaa5f4c6..bba10ba74e 100644
--- a/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp
@@ -42,13 +42,12 @@ FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) {
return FALSE;
}
CXFA_Node* pDataModel =
- (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets);
+ ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets));
if (!pDataModel) {
pDataDocumentParser->Release();
return FALSE;
}
- CXFA_Node* pDataNode =
- (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Data);
+ CXFA_Node* pDataNode = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Data));
if (pDataNode) {
pDataModel->RemoveChild(pDataNode);
}
@@ -445,7 +444,7 @@ void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode,
pStream->WriteString(pURI, FXSYS_wcslen(pURI));
CFX_WideString wsVersionNumber;
XFA_DataExporter_RecognizeXFAVersionNumber(
- (CXFA_Node*)pNode->GetDocument()->GetXFAObject(XFA_XDPPACKET_Template),
+ ToNode(pNode->GetDocument()->GetXFAObject(XFA_XDPPACKET_Template)),
wsVersionNumber);
if (wsVersionNumber.IsEmpty()) {
wsVersionNumber = FX_WSTRC(L"2.8");
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
index cbfdb09fc4..f3b1276797 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
@@ -1770,7 +1770,7 @@ static FX_FLOAT XFA_ItemLayoutProcessor_InsertPendingItems(
while (pProcessor->m_rgPendingNodes.GetCount() > 0) {
FX_POSITION pos = pProcessor->m_rgPendingNodes.GetHeadPosition();
CXFA_Node* pPendingNode =
- (CXFA_Node*)pProcessor->m_rgPendingNodes.GetAt(pos);
+ reinterpret_cast<CXFA_Node*>(pProcessor->m_rgPendingNodes.GetAt(pos));
pProcessor->m_rgPendingNodes.RemoveAt(pos);
CXFA_ContentLayoutItem* pPendingLayoutItem = NULL;
CXFA_ItemLayoutProcessor* pPendingProcessor =
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
index 0d5dfb4b07..5f30d75ad4 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
@@ -293,7 +293,7 @@ static CXFA_Node* XFA_ResolveBreakTarget(CXFA_Node* pPageSetRoot,
bTargetAllFind = FALSE;
if (wsTargetExpr.GetAt(0) == '#') {
CXFA_Node* pNode = pDocument->GetNodeByID(
- (CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Template),
+ ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Template)),
wsTargetExpr.Mid(1));
if (pNode) {
return pNode;
@@ -311,7 +311,7 @@ static CXFA_Node* XFA_ResolveBreakTarget(CXFA_Node* pPageSetRoot,
XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Siblings |
XFA_RESOLVENODE_Parent);
if (iCount > 0 && rs.nodes[0]->IsNode()) {
- return (CXFA_Node*)rs.nodes[0];
+ return rs.nodes[0]->AsNode();
}
}
iSpliteIndex = iSpliteNextIndex;
@@ -1739,7 +1739,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
}
pContainerItem->m_pFormNode = pDocument->DataMerge_CopyContainer(
pContainerItem->m_pFormNode, pParentNode,
- (CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Record), TRUE);
+ ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record)), TRUE);
} break;
case XFA_ELEMENT_ContentArea: {
CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode;
@@ -1760,7 +1760,8 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
}
if (!pPendingPageSet->GetNodeItem(XFA_NODEITEM_Parent)) {
CXFA_Node* pFormToplevelSubform =
- ((CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Form))
+ pDocument->GetXFAObject(XFA_HASHCODE_Form)
+ ->AsNode()
->GetFirstChildByClass(XFA_ELEMENT_Subform);
pFormToplevelSubform->InsertChild(pPendingPageSet);
}
diff --git a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp
index 1829ffdb67..10d5e24abf 100644
--- a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp
@@ -30,12 +30,15 @@ uint32_t CXFA_Object::GetClassHashCode() const {
}
XFA_ELEMENT CXFA_Object::GetClassID() const {
if (IsNode()) {
- return ((const CXFA_Node*)this)->GetClassID();
- } else if (IsOrdinaryObject()) {
- return ((const CXFA_OrdinaryObject*)this)->GetClassID();
- } else if (IsNodeList()) {
- return ((const CXFA_NodeList*)this)->GetClassID();
- } else if (IsOrdinaryList()) {
+ return AsNode()->GetClassID();
+ }
+ if (IsOrdinaryObject()) {
+ return AsOrdinaryObject()->GetClassID();
+ }
+ if (IsNodeList()) {
+ return AsNodeList()->GetClassID();
+ }
+ if (IsOrdinaryList()) {
return XFA_ELEMENT_List;
}
ASSERT(FALSE);
@@ -329,7 +332,7 @@ void CXFA_Node::SetTemplateNode(CXFA_Node* pTemplateNode) {
}
CXFA_Node* CXFA_Node::GetBindData() {
ASSERT(GetPacketID() == XFA_XDPPACKET_Form);
- return (CXFA_Node*)GetObject(XFA_ATTRIBUTE_BindingNode);
+ return static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode));
}
int32_t CXFA_Node::GetBindItems(CXFA_NodeArray& formItems) {
if (m_uFlags & XFA_NODEFLAG_BindFormItems) {
@@ -338,7 +341,8 @@ int32_t CXFA_Node::GetBindItems(CXFA_NodeArray& formItems) {
formItems.Copy(*pItems);
return formItems.GetSize();
}
- CXFA_Node* pFormNode = (CXFA_Node*)GetObject(XFA_ATTRIBUTE_BindingNode);
+ CXFA_Node* pFormNode =
+ static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode));
if (pFormNode) {
formItems.Add(pFormNode);
}
@@ -362,7 +366,8 @@ int32_t CXFA_Node::AddBindItem(CXFA_Node* pFormNode) {
}
return pItems->GetSize();
}
- CXFA_Node* pOldFormItem = (CXFA_Node*)GetObject(XFA_ATTRIBUTE_BindingNode);
+ CXFA_Node* pOldFormItem =
+ static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode));
if (!pOldFormItem) {
SetObject(XFA_ATTRIBUTE_BindingNode, pFormNode);
return 1;
@@ -397,7 +402,8 @@ int32_t CXFA_Node::RemoveBindItem(CXFA_Node* pFormNode) {
}
return iCount;
}
- CXFA_Node* pOldFormItem = (CXFA_Node*)GetObject(XFA_ATTRIBUTE_BindingNode);
+ CXFA_Node* pOldFormItem =
+ static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode));
if (pOldFormItem == pFormNode) {
SetObject(XFA_ATTRIBUTE_BindingNode, NULL);
pOldFormItem = NULL;
@@ -480,7 +486,7 @@ CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() {
: NULL;
}
FX_BOOL CXFA_Node::GetLocaleName(CFX_WideString& wsLocaleName) {
- CXFA_Node* pForm = (CXFA_Node*)GetDocument()->GetXFAObject(XFA_HASHCODE_Form);
+ CXFA_Node* pForm = GetDocument()->GetXFAObject(XFA_HASHCODE_Form)->AsNode();
CXFA_Node* pTopSubform = pForm->GetFirstChildByClass(XFA_ELEMENT_Subform);
FXSYS_assert(pTopSubform);
CXFA_Node* pLocaleNode = this;
@@ -494,8 +500,7 @@ FX_BOOL CXFA_Node::GetLocaleName(CFX_WideString& wsLocaleName) {
if (bLocale) {
return bLocale;
}
- CXFA_Node* pConfig =
- (CXFA_Node*)GetDocument()->GetXFAObject(XFA_HASHCODE_Config);
+ CXFA_Node* pConfig = ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Config));
wsLocaleName = GetDocument()->GetLocalMgr()->GetConfigLocaleName(pConfig);
if (!wsLocaleName.IsEmpty()) {
bLocale = TRUE;
@@ -625,7 +630,7 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) {
}
CXFA_Node* refNode = this;
if (refNode->GetClassID() == XFA_ELEMENT_Xfa) {
- refNode = (CXFA_Node*)pScriptContext->GetThisObject();
+ refNode = ToNode(pScriptContext->GetThisObject());
}
FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes |
XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
@@ -674,7 +679,7 @@ void CXFA_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) {
XFA_RESOLVENODE_Siblings;
CXFA_Node* refNode = this;
if (refNode->GetClassID() == XFA_ELEMENT_Xfa) {
- refNode = (CXFA_Node*)m_pDocument->GetScriptContext()->GetThisObject();
+ refNode = ToNode(m_pDocument->GetScriptContext()->GetThisObject());
}
Script_Som_ResolveNodeList(hValue, wsExpression, dwFlag, refNode);
}
@@ -695,9 +700,8 @@ void CXFA_Node::Script_Som_ResolveNodeList(FXJSE_HVALUE hValue,
CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument);
if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
for (int32_t i = 0; i < resoveNodeRS.nodes.GetSize(); i++) {
- if (resoveNodeRS.nodes[i]->IsNode()) {
- pNodeList->Append((CXFA_Node*)resoveNodeRS.nodes[i]);
- }
+ if (resoveNodeRS.nodes[i]->IsNode())
+ pNodeList->Append(resoveNodeRS.nodes[i]->AsNode());
}
} else {
CXFA_HVALUEArray hValueArray(pScriptContext->GetRuntime());
@@ -705,9 +709,8 @@ void CXFA_Node::Script_Som_ResolveNodeList(FXJSE_HVALUE hValue,
CXFA_ObjArray objectArray;
hValueArray.GetAttributeObject(objectArray);
for (int32_t i = 0; i < objectArray.GetSize(); i++) {
- if (objectArray[i]->IsNode()) {
- pNodeList->Append((CXFA_Node*)objectArray[i]);
- }
+ if (objectArray[i]->IsNode())
+ pNodeList->Append(objectArray[i]->AsNode());
}
}
}
@@ -1160,7 +1163,7 @@ void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) {
CXFA_Node* pNode = NULL;
CFX_WideString wsName;
if (iLength >= 1) {
- pNode = (CXFA_Node*)pArguments->GetObject(0);
+ pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
}
if (iLength >= 2) {
CFX_ByteString bsName = pArguments->GetUTF8String(1);
@@ -1479,7 +1482,7 @@ void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue,
this->GetClassID() == XFA_ELEMENT_Desc) {
CFX_WideString wsUseVal = wsValue, wsID, wsSOM;
CXFA_Node* pTemplateNode =
- (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Template);
+ ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template));
CXFA_Node* pProtoRoot =
pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform)
->GetFirstChildByClass(XFA_ELEMENT_Proto);
@@ -1502,7 +1505,7 @@ void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue,
int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects(
pProtoRoot, wsSOM, resoveNodeRS, dwFlag);
if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) {
- pProtoNode = (CXFA_Node*)resoveNodeRS.nodes[0];
+ pProtoNode = resoveNodeRS.nodes[0]->AsNode();
}
} else if (!wsID.IsEmpty()) {
pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID);
@@ -3108,7 +3111,7 @@ static CXFA_Node* XFA_ScriptInstanceManager_CreateInstance(
}
}
if (!pDataScope) {
- pDataScope = (CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Record);
+ pDataScope = ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record));
ASSERT(pDataScope);
}
CXFA_Node* pInstance = pDocument->DataMerge_CopyContainer(
@@ -3188,7 +3191,7 @@ void CXFA_Node::Script_InstanceManager_RemoveInstance(
return;
}
pLayoutPro->AddChangedContainer(
- (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form));
+ ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)));
}
void CXFA_Node::Script_InstanceManager_SetInstances(
CFXJSE_Arguments* pArguments) {
@@ -3235,7 +3238,7 @@ void CXFA_Node::Script_InstanceManager_AddInstance(
return;
}
pLayoutPro->AddChangedContainer(
- (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form));
+ ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)));
}
void CXFA_Node::Script_InstanceManager_InsertInstance(
CFXJSE_Arguments* pArguments) {
@@ -3278,7 +3281,7 @@ void CXFA_Node::Script_InstanceManager_InsertInstance(
return;
}
pLayoutPro->AddChangedContainer(
- (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form));
+ ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)));
}
int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) {
CXFA_Occur nodeOccur(GetOccurNode());
@@ -3339,11 +3342,10 @@ int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) {
}
}
CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor();
- if (!pLayoutPro) {
- return 0;
+ if (pLayoutPro) {
+ pLayoutPro->AddChangedContainer(
+ ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)));
}
- pLayoutPro->AddChangedContainer(
- (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form));
return 0;
}
int32_t CXFA_Node::InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom) {
@@ -3360,11 +3362,10 @@ int32_t CXFA_Node::InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom) {
XFA_ScriptInstanceManager_InsertItem(this, pMoveInstance, iTo, iCount - 1,
TRUE);
CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor();
- if (!pLayoutPro) {
- return 0;
+ if (pLayoutPro) {
+ pLayoutPro->AddChangedContainer(
+ ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)));
}
- pLayoutPro->AddChangedContainer(
- (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form));
return 0;
}
void CXFA_Node::Script_Occur_Max(FXJSE_HVALUE hValue,
@@ -3400,7 +3401,7 @@ void CXFA_Node::Script_Desc_Metadata(CFXJSE_Arguments* pArguments) {
void CXFA_Node::Script_Form_FormNodes(CFXJSE_Arguments* pArguments) {
int32_t argc = pArguments->GetLength();
if (argc == 1) {
- CXFA_Node* pDataNode = (CXFA_Node*)pArguments->GetObject(0);
+ CXFA_Node* pDataNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
if (pDataNode) {
CXFA_NodeArray formItems;
CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument);
@@ -4483,21 +4484,21 @@ CXFA_Node* CXFA_Node::GetModelNode() {
case XFA_XDPPACKET_XDP:
return m_pDocument->GetRoot();
case XFA_XDPPACKET_Config:
- return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Config);
+ return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Config));
case XFA_XDPPACKET_Template:
- return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Template);
+ return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template));
case XFA_XDPPACKET_Form:
- return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form);
+ return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form));
case XFA_XDPPACKET_Datasets:
- return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets);
+ return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets));
case XFA_XDPPACKET_LocaleSet:
- return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_LocaleSet);
+ return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_LocaleSet));
case XFA_XDPPACKET_ConnectionSet:
- return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_ConnectionSet);
+ return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_ConnectionSet));
case XFA_XDPPACKET_SourceSet:
- return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet);
+ return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet));
case XFA_XDPPACKET_Xdc:
- return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc);
+ return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc));
default:
return this;
}
@@ -4821,14 +4822,14 @@ int32_t CXFA_Node::GetNodeSameNameIndex() const {
if (!pScriptContext) {
return -1;
}
- return pScriptContext->GetIndexByName((CXFA_Node*)this);
+ return pScriptContext->GetIndexByName(const_cast<CXFA_Node*>(this));
}
int32_t CXFA_Node::GetNodeSameClassIndex() const {
IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
if (!pScriptContext) {
return -1;
}
- return pScriptContext->GetIndexByClassName((CXFA_Node*)this);
+ return pScriptContext->GetIndexByClassName(const_cast<CXFA_Node*>(this));
}
void CXFA_Node::GetSOMExpression(CFX_WideString& wsSOMExpression) {
IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
@@ -5163,7 +5164,7 @@ void CXFA_Node::RemoveMapModuleKey(void* pKey) {
}
void CXFA_Node::MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr) {
XFA_LPMAPMODULEDATA pDstModuleData =
- ((CXFA_Node*)pDstModule)->GetMapModuleData(TRUE);
+ static_cast<CXFA_Node*>(pDstModule)->GetMapModuleData(TRUE);
if (!pDstModuleData) {
return;
}
@@ -5299,7 +5300,7 @@ CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) {
void CXFA_NodeList::Script_ListClass_Append(CFXJSE_Arguments* pArguments) {
int32_t argc = pArguments->GetLength();
if (argc == 1) {
- CXFA_Node* pNode = (CXFA_Node*)pArguments->GetObject(0);
+ CXFA_Node* pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
if (pNode) {
Append(pNode);
} else {
@@ -5312,8 +5313,8 @@ void CXFA_NodeList::Script_ListClass_Append(CFXJSE_Arguments* pArguments) {
void CXFA_NodeList::Script_ListClass_Insert(CFXJSE_Arguments* pArguments) {
int32_t argc = pArguments->GetLength();
if (argc == 2) {
- CXFA_Node* pNewNode = (CXFA_Node*)pArguments->GetObject(0);
- CXFA_Node* pBeforeNode = (CXFA_Node*)pArguments->GetObject(1);
+ CXFA_Node* pNewNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
+ CXFA_Node* pBeforeNode = static_cast<CXFA_Node*>(pArguments->GetObject(1));
if (pNewNode) {
Insert(pNewNode, pBeforeNode);
} else {
@@ -5326,7 +5327,7 @@ void CXFA_NodeList::Script_ListClass_Insert(CFXJSE_Arguments* pArguments) {
void CXFA_NodeList::Script_ListClass_Remove(CFXJSE_Arguments* pArguments) {
int32_t argc = pArguments->GetLength();
if (argc == 1) {
- CXFA_Node* pNode = (CXFA_Node*)pArguments->GetObject(0);
+ CXFA_Node* pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
if (pNode) {
Remove(pNode);
} else {
diff --git a/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp b/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp
index e34220b30c..9261a77ed7 100644
--- a/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp
@@ -1921,7 +1921,7 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState,
}
}
CXFA_Node* CXFA_WidgetData::GetExclGroupNode() {
- CXFA_Node* pExcl = (CXFA_Node*)m_pNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pExcl = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_Parent));
if (!pExcl || pExcl->GetClassID() != XFA_ELEMENT_ExclGroup) {
return NULL;
}
@@ -1933,9 +1933,8 @@ CXFA_Node* CXFA_WidgetData::GetSelectedMember() {
if (wsState.IsEmpty()) {
return pSelectedMember;
}
- for (CXFA_Node* pNode =
- (CXFA_Node*)m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pNode != NULL; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pNode = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild));
+ pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
CXFA_WidgetData widgetData(pNode);
if (widgetData.GetCheckState() == XFA_CHECKSTATE_On) {
pSelectedMember = pNode;
@@ -1949,9 +1948,8 @@ CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName,
CXFA_Node* pSelectedMember = NULL;
FX_DWORD nameHash =
FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength());
- for (CXFA_Node* pNode =
- (CXFA_Node*)m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pNode != NULL; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pNode = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild));
+ pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
if (pNode->GetNameHash() == nameHash) {
CXFA_WidgetData widgetData(pNode);
widgetData.SetCheckState(XFA_CHECKSTATE_On, bNotify);
diff --git a/xfa/src/fxfa/src/parser/xfa_script_hostpseudomodel.cpp b/xfa/src/fxfa/src/parser/xfa_script_hostpseudomodel.cpp
index 39e8d29c59..ee42d5a4fc 100644
--- a/xfa/src/fxfa/src/parser/xfa_script_hostpseudomodel.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_script_hostpseudomodel.cpp
@@ -305,7 +305,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList(
if (iLength >= 1) {
FXJSE_HVALUE hValue = pArguments->GetValue(0);
if (FXJSE_Value_IsObject(hValue)) {
- pNode = (CXFA_Node*)FXJSE_Value_ToObject(hValue, NULL);
+ pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, nullptr));
} else if (FXJSE_Value_IsUTF8String(hValue)) {
CFX_ByteString bsString;
FXJSE_Value_ToUTF8String(hValue, bsString);
@@ -330,7 +330,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList(
FXJSE_Value_Release(hValue);
return;
}
- pNode = (CXFA_Node*)resoveNodeRS.nodes[0];
+ pNode = resoveNodeRS.nodes[0]->AsNode();
}
FXJSE_Value_Release(hValue);
}
@@ -463,7 +463,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData(
if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) {
continue;
}
- pNode = (CXFA_Node*)resoveNodeRS.nodes[0];
+ pNode = resoveNodeRS.nodes[0]->AsNode();
pNotify->ResetData(pNode->GetWidgetData());
}
if (!pNode) {
@@ -508,7 +508,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus(
if (iLength >= 1) {
FXJSE_HVALUE hValue = pArguments->GetValue(0);
if (FXJSE_Value_IsObject(hValue)) {
- pNode = (CXFA_Node*)FXJSE_Value_ToObject(hValue, NULL);
+ pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, NULL));
} else if (FXJSE_Value_IsUTF8String(hValue)) {
CFX_ByteString bsString;
FXJSE_Value_ToUTF8String(hValue, bsString);
@@ -533,7 +533,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus(
FXJSE_Value_Release(hValue);
return;
}
- pNode = (CXFA_Node*)resoveNodeRS.nodes[0];
+ pNode = resoveNodeRS.nodes[0]->AsNode();
}
FXJSE_Value_Release(hValue);
}
diff --git a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp
index 5fa1c6aff6..00b9b945fa 100644
--- a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp
@@ -117,9 +117,9 @@ void CXFA_ScriptContext::GlobalPropertySetter(FXJSE_HOBJECT hObject,
FX_DWORD dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings |
XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
XFA_RESOLVENODE_Attributes;
- CXFA_Node* pRefNode = (CXFA_Node*)lpScriptContext->GetThisObject();
+ CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject());
if (lpOrginalNode->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) {
- pRefNode = (CXFA_Node*)lpCurNode;
+ pRefNode = ToNode(lpCurNode);
}
if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag,
TRUE)) {
@@ -190,9 +190,9 @@ void CXFA_ScriptContext::GlobalPropertyGetter(FXJSE_HOBJECT hObject,
}
FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
XFA_RESOLVENODE_Attributes;
- CXFA_Node* pRefNode = (CXFA_Node*)lpScriptContext->GetThisObject();
+ CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject());
if (pOrginalObject->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) {
- pRefNode = (CXFA_Node*)lpCurNode;
+ pRefNode = ToNode(lpCurNode);
}
if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag,
FALSE)) {
@@ -206,8 +206,8 @@ void CXFA_ScriptContext::GlobalPropertyGetter(FXJSE_HOBJECT hObject,
CXFA_Object* pScriptObject =
lpScriptContext->GetVariablesThis(pOrginalObject, TRUE);
if (pScriptObject &&
- lpScriptContext->QueryVariableHValue((CXFA_Node*)pScriptObject,
- szPropName, hValue, TRUE)) {
+ lpScriptContext->QueryVariableHValue(pScriptObject->AsNode(), szPropName,
+ hValue, TRUE)) {
return;
}
IXFA_Notify* pNotify = pDoc->GetNotify();
@@ -239,8 +239,8 @@ void CXFA_ScriptContext::NormalPropertyGetter(FXJSE_HOBJECT hObject,
}
FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
XFA_RESOLVENODE_Attributes;
- FX_BOOL bRet = lpScriptContext->QueryNodeByFlag(
- (CXFA_Node*)pObject, wsPropName, hValue, dwFlag, FALSE);
+ FX_BOOL bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject), wsPropName,
+ hValue, dwFlag, FALSE);
if (bRet) {
return;
}
@@ -248,8 +248,8 @@ void CXFA_ScriptContext::NormalPropertyGetter(FXJSE_HOBJECT hObject,
(lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Javascript &&
!lpScriptContext->IsStrictScopeInJavaScript())) {
dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings;
- bRet = lpScriptContext->QueryNodeByFlag((CXFA_Node*)pObject, wsPropName,
- hValue, dwFlag, FALSE);
+ bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject), wsPropName, hValue,
+ dwFlag, FALSE);
}
if (bRet) {
return;
@@ -257,7 +257,7 @@ void CXFA_ScriptContext::NormalPropertyGetter(FXJSE_HOBJECT hObject,
CXFA_Object* pScriptObject =
lpScriptContext->GetVariablesThis(pOrginalObject, TRUE);
if (pScriptObject) {
- bRet = lpScriptContext->QueryVariableHValue((CXFA_Node*)pScriptObject,
+ bRet = lpScriptContext->QueryVariableHValue(ToNode(pScriptObject),
szPropName, hValue, TRUE);
}
if (!bRet) {
@@ -287,7 +287,7 @@ void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject,
if (wsPropName.GetAt(0) == '#') {
wsPropName = wsPropName.Right(wsPropName.GetLength() - 1);
}
- CXFA_Node* pNode = (CXFA_Node*)pObject;
+ CXFA_Node* pNode = ToNode(pObject);
CXFA_Node* pPropOrChild = NULL;
XFA_LPCELEMENTINFO lpElementInfo = XFA_GetElementByName(wsPropName);
if (lpElementInfo) {
@@ -310,8 +310,8 @@ void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject,
CXFA_Object* pScriptObject =
lpScriptContext->GetVariablesThis(pOrginalObject, TRUE);
if (pScriptObject) {
- lpScriptContext->QueryVariableHValue((CXFA_Node*)pScriptObject,
- szPropName, hValue, FALSE);
+ lpScriptContext->QueryVariableHValue(ToNode(pScriptObject), szPropName,
+ hValue, FALSE);
}
}
}
@@ -569,10 +569,9 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
(dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings))) {
m_upObjectArray.RemoveAll();
}
- if (refNode &&
- (dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings)) &&
- refNode->IsNode()) {
- m_upObjectArray.Add((CXFA_Node*)refNode);
+ if (refNode && refNode->IsNode() &&
+ (dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings))) {
+ m_upObjectArray.Add(refNode->AsNode());
}
FX_BOOL bNextCreate = FALSE;
if (dwStyles & XFA_RESOLVENODE_CreateNode) {
@@ -611,7 +610,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
break;
}
} else {
- pDataNode = (CXFA_Node*)findNodes[0];
+ pDataNode = findNodes[0]->AsNode();
findNodes.RemoveAll();
findNodes.Add(pDataNode);
break;
@@ -682,7 +681,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
bNextCreate = TRUE;
if (m_pResolveProcessor->GetNodeHelper()->m_pCreateParent == NULL) {
m_pResolveProcessor->GetNodeHelper()->m_pCreateParent =
- (CXFA_Node*)rndFind.m_CurNode;
+ ToNode(rndFind.m_CurNode);
m_pResolveProcessor->GetNodeHelper()->m_iCreateCount = 1;
}
FX_BOOL bCreate =
@@ -731,7 +730,7 @@ FXJSE_HVALUE CXFA_ScriptContext::GetJSValueFromMap(CXFA_Object* pObject) {
return NULL;
}
if (pObject->IsNode()) {
- RunVariablesScript((CXFA_Node*)pObject);
+ RunVariablesScript(pObject->AsNode());
}
void* pValue = m_mapXFAToHValue.GetValueAt(pObject);
if (pValue == NULL) {
diff --git a/xfa/src/fxfa/src/parser/xfa_script_layoutpseudomodel.cpp b/xfa/src/fxfa/src/parser/xfa_script_layoutpseudomodel.cpp
index 851dbcdac2..d2a9212b05 100644
--- a/xfa/src/fxfa/src/parser/xfa_script_layoutpseudomodel.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_script_layoutpseudomodel.cpp
@@ -64,7 +64,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY(
CFX_WideString wsUnit = FX_WSTRC(L"pt");
int32_t iIndex = 0;
if (iLength >= 1) {
- pNode = (CXFA_Node*)pArguments->GetObject(0);
+ pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
}
if (iLength >= 2) {
CFX_ByteString bsUnit = pArguments->GetUTF8String(1);
@@ -176,7 +176,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageSpan(
}
CXFA_Node* pNode = NULL;
if (iLength >= 1) {
- pNode = (CXFA_Node*)pArguments->GetObject(0);
+ pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
}
if (!pNode) {
return;
@@ -440,7 +440,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageInBatch(
}
CXFA_Node* pNode = NULL;
if (iLength >= 1) {
- pNode = (CXFA_Node*)pArguments->GetObject(0);
+ pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
}
if (!pNode) {
return;
@@ -474,7 +474,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch(
}
CXFA_Node* pNode = NULL;
if (iLength >= 1) {
- pNode = (CXFA_Node*)pArguments->GetObject(0);
+ pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
}
if (!pNode) {
return;
@@ -528,7 +528,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageImp(
}
CXFA_Node* pNode = NULL;
if (iLength >= 1) {
- pNode = (CXFA_Node*)pArguments->GetObject(0);
+ pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
}
int32_t iPage = 0;
FXJSE_HVALUE hValue = pArguments->GetReturnValue();
diff --git a/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp b/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp
index 32a3d58d20..8fe9348b51 100644
--- a/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp
@@ -353,8 +353,8 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode(
FX_BOOL bResult = FALSE;
if (wsName.GetAt(0) == '!') {
wsName = wsName.Right(wsName.GetLength() - 1);
- m_pCreateParent = (CXFA_Node*)pScriptContext->GetDocument()->GetXFAObject(
- XFA_HASHCODE_Datasets);
+ m_pCreateParent = ToNode(
+ pScriptContext->GetDocument()->GetXFAObject(XFA_HASHCODE_Datasets));
}
if (wsName.GetAt(0) == '#') {
bIsClassName = TRUE;
diff --git a/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp b/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp
index f9503ce4ca..6df0866a0b 100644
--- a/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp
@@ -92,8 +92,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_AnyChild(
bClassName = TRUE;
wsName = wsName.Right(wsName.GetLength() - 1);
}
- findNode = m_pNodeHelper->XFA_ResolveNodes_GetOneChild(
- (CXFA_Node*)rnd.m_CurNode, wsName, bClassName);
+ findNode = m_pNodeHelper->XFA_ResolveNodes_GetOneChild(ToNode(rnd.m_CurNode),
+ wsName, bClassName);
if (findNode == NULL) {
return 0;
}
@@ -140,8 +140,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Excalmatory(
return 0;
}
CXFA_Node* datasets =
- (CXFA_Node*)rnd.m_pSC->GetDocument()->GetXFAObject(XFA_HASHCODE_Datasets);
- if (datasets == NULL) {
+ ToNode(rnd.m_pSC->GetDocument()->GetXFAObject(XFA_HASHCODE_Datasets));
+ if (!datasets) {
return 0;
}
CXFA_ResolveNodesData rndFind;
@@ -164,7 +164,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_NumberSign(
CXFA_ResolveNodesData& rnd) {
CFX_WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1);
CFX_WideString wsCondition = rnd.m_wsCondition;
- CXFA_Node* curNode = (CXFA_Node*)rnd.m_CurNode;
+ CXFA_Node* curNode = ToNode(rnd.m_CurNode);
if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName)) {
return 1;
}
@@ -212,7 +212,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal(
if (!rnd.m_CurNode->IsNode()) {
return 0;
}
- CXFA_Node* curNode = (CXFA_Node*)rnd.m_CurNode;
+ CXFA_Node* curNode = ToNode(rnd.m_CurNode);
CXFA_ObjArray& nodes = rnd.m_Nodes;
int32_t nNum = nodes.GetSize();
FX_DWORD dwStyles = rnd.m_dwStyles;
@@ -308,13 +308,13 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal(
if (nodes.GetSize() > nNum) {
if (!(dwStyles & XFA_RESOLVENODE_ALL)) {
CXFA_NodeArray upArrayNodes;
- if (m_pNodeHelper->XFA_NodeIsTransparent((CXFA_Node*)curNode)) {
+ if (m_pNodeHelper->XFA_NodeIsTransparent(ToNode(curNode))) {
m_pNodeHelper->XFA_CountSiblings(
- (CXFA_Node*)nodes[0], XFA_LOGIC_Transparent, &upArrayNodes,
+ ToNode(nodes[0]), XFA_LOGIC_Transparent, &upArrayNodes,
!!(dwStyles & XFA_RESOLVENODE_TagName));
}
if (upArrayNodes.GetSize() > nodes.GetSize()) {
- upArrayNodes[0] = (CXFA_Node*)nodes[0];
+ upArrayNodes[0] = ToNode(nodes[0]);
nodes.RemoveAll();
nodes.Append((CXFA_ObjArray&)upArrayNodes);
upArrayNodes.RemoveAll();
@@ -357,16 +357,15 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal(
if (XFA_ELEMENT_Subform == curNode->GetClassID() &&
XFA_HASHCODE_Occur == uNameHash) {
CXFA_Node* pInstanceManager =
- ((CXFA_Node*)curNode)->GetInstanceMgrOfSubform();
+ curNode->AsNode()->GetInstanceMgrOfSubform();
if (pInstanceManager) {
pProp = pInstanceManager->GetProperty(0, XFA_ELEMENT_Occur, TRUE);
}
} else {
XFA_LPCELEMENTINFO pElement = XFA_GetElementByName(wsName);
if (pElement) {
- pProp = ((CXFA_Node*)curNode)
- ->GetProperty(0, pElement->eName,
- pElement->eName != XFA_ELEMENT_PageSet);
+ pProp = curNode->AsNode()->GetProperty(
+ 0, pElement->eName, pElement->eName != XFA_ELEMENT_PageSet);
}
}
if (pProp) {
@@ -375,11 +374,11 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal(
}
}
CXFA_Node* parentNode = m_pNodeHelper->XFA_ResolveNodes_GetParent(
- (CXFA_Node*)curNode, XFA_LOGIC_NoTransparent);
+ curNode->AsNode(), XFA_LOGIC_NoTransparent);
uint32_t uCurClassHash = curNode->GetClassHashCode();
- if (parentNode == NULL) {
+ if (!parentNode) {
if (uCurClassHash == uNameHash) {
- nodes.Add((CXFA_Node*)curNode);
+ nodes.Add(curNode->AsNode());
XFA_ResolveNode_FilterCondition(rnd, wsCondition);
if (nodes.GetSize() > 0) {
return 1;
@@ -457,10 +456,10 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal(
if (m_pNodeHelper->XFA_NodeIsTransparent(parentNode)) {
CXFA_NodeArray upArrayNodes;
m_pNodeHelper->XFA_CountSiblings(
- (CXFA_Node*)nodes[0], XFA_LOGIC_Transparent, &upArrayNodes,
+ ToNode(nodes[0]), XFA_LOGIC_Transparent, &upArrayNodes,
!!(dwStyles & XFA_RESOLVENODE_TagName));
if (upArrayNodes.GetSize() > nodes.GetSize()) {
- upArrayNodes[0] = (CXFA_Node*)nodes[0];
+ upArrayNodes[0] = ToNode(nodes[0]);
nodes.RemoveAll();
nodes.Append((CXFA_ObjArray&)upArrayNodes);
upArrayNodes.RemoveAll();
@@ -499,7 +498,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal(
}
int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Asterisk(
CXFA_ResolveNodesData& rnd) {
- CXFA_Node* curNode = (CXFA_Node*)rnd.m_CurNode;
+ CXFA_Node* curNode = ToNode(rnd.m_CurNode);
CXFA_ObjArray& nodes = rnd.m_Nodes;
CXFA_NodeArray array;
curNode->GetNodeList(array,
@@ -645,7 +644,7 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_ConditionArray(
if (bAll) {
if (rnd.m_dwStyles & XFA_RESOLVENODE_CreateNode) {
if (rnd.m_dwStyles & XFA_RESOLVENODE_Bind) {
- m_pNodeHelper->m_pCreateParent = (CXFA_Node*)rnd.m_CurNode;
+ m_pNodeHelper->m_pCreateParent = ToNode(rnd.m_CurNode);
m_pNodeHelper->m_iCreateCount = 1;
findNodes.RemoveAll();
m_pNodeHelper->m_iCurAllStart = -1;
@@ -653,7 +652,7 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_ConditionArray(
} else {
if (m_pNodeHelper->m_iCurAllStart == -1) {
m_pNodeHelper->m_iCurAllStart = m_iCurStart;
- m_pNodeHelper->m_pAllStartParent = (CXFA_Node*)rnd.m_CurNode;
+ m_pNodeHelper->m_pAllStartParent = ToNode(rnd.m_CurNode);
}
}
} else if (rnd.m_dwStyles & XFA_RESOLVENODE_BindNew) {
@@ -674,7 +673,7 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_ConditionArray(
}
if (iFoundCount <= iIndex || iIndex < 0) {
if (rnd.m_dwStyles & XFA_RESOLVENODE_CreateNode) {
- m_pNodeHelper->m_pCreateParent = (CXFA_Node*)rnd.m_CurNode;
+ m_pNodeHelper->m_pCreateParent = ToNode(rnd.m_CurNode);
m_pNodeHelper->m_iCreateCount = iIndex - iFoundCount + 1;
}
findNodes.RemoveAll();
@@ -749,7 +748,7 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_FilterCondition(
}
if (iFoundCount <= iCurrIndex) {
if (rnd.m_dwStyles & XFA_RESOLVENODE_CreateNode) {
- m_pNodeHelper->m_pCreateParent = (CXFA_Node*)rnd.m_CurNode;
+ m_pNodeHelper->m_pCreateParent = ToNode(rnd.m_CurNode);
m_pNodeHelper->m_iCreateCount = iCurrIndex - iFoundCount + 1;
}
findNodes.RemoveAll();
diff --git a/xfa/src/fxfa/src/parser/xfa_script_signaturepseudomodel.cpp b/xfa/src/fxfa/src/parser/xfa_script_signaturepseudomodel.cpp
index e4c257b31f..cbaa86f0fd 100644
--- a/xfa/src/fxfa/src/parser/xfa_script_signaturepseudomodel.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_script_signaturepseudomodel.cpp
@@ -35,7 +35,7 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Verify(
IXFA_Doc* hDoc = pNotify->GetHDOC();
CXFA_Node* pNode = NULL;
if (iLength >= 1) {
- pNode = (CXFA_Node*)pArguments->GetObject(0);
+ pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
}
int32_t bVerify = pNotify->GetDocProvider()->Verify(hDoc, pNode);
FXJSE_HVALUE hValue = pArguments->GetReturnValue();
@@ -108,7 +108,7 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Clear(
CXFA_Node* pNode = NULL;
FX_BOOL bClear = TRUE;
if (iLength >= 1) {
- pNode = (CXFA_Node*)pArguments->GetObject(0);
+ pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
}
if (iLength >= 2) {
bClear = pArguments->GetInt32(1) == 0 ? FALSE : TRUE;