From 070fcdfeafb17a9d3ada1418f48fd7f19aa4cf83 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 22 Jun 2016 22:04:54 -0700 Subject: Update GetClassID to GetElementType The GetClassID method actually returns the XFA_Element, change the name of the method to be more suggestive of the return value. The GetClassID was sort-of polymorphich and would call down to subclasses. This CL changes the data to be stored on the CXFA_Object class and just returns what is set. The values are set in the constructor as needed. Review-Url: https://codereview.chromium.org/2082573007 --- xfa/fxfa/app/xfa_ffdocview.cpp | 16 +- xfa/fxfa/app/xfa_fffield.cpp | 2 +- xfa/fxfa/app/xfa_ffnotify.cpp | 10 +- xfa/fxfa/app/xfa_ffpageview.cpp | 5 +- xfa/fxfa/app/xfa_ffwidget.cpp | 4 +- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 16 +- xfa/fxfa/app/xfa_ffwidgethandler.cpp | 4 +- xfa/fxfa/parser/cxfa_box.h | 8 +- xfa/fxfa/parser/cxfa_data.cpp | 4 +- xfa/fxfa/parser/cxfa_data.h | 2 +- xfa/fxfa/parser/cxfa_event.cpp | 2 +- xfa/fxfa/parser/cxfa_fill.cpp | 2 +- xfa/fxfa/parser/cxfa_stroke.h | 4 +- xfa/fxfa/parser/cxfa_validate.cpp | 4 +- xfa/fxfa/parser/cxfa_value.cpp | 2 +- xfa/fxfa/parser/cxfa_widgetdata.cpp | 38 ++-- .../parser/xfa_document_datadescription_imp.cpp | 10 +- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 50 ++--- xfa/fxfa/parser/xfa_document_imp.cpp | 2 +- xfa/fxfa/parser/xfa_document_serialize.cpp | 34 +-- xfa/fxfa/parser/xfa_layout_appadapter.cpp | 2 +- xfa/fxfa/parser/xfa_layout_appadapter.h | 2 +- xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 57 ++--- xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp | 95 ++++---- xfa/fxfa/parser/xfa_object.h | 15 +- xfa/fxfa/parser/xfa_object_imp.cpp | 243 ++++++++++----------- xfa/fxfa/parser/xfa_parser_imp.cpp | 6 +- xfa/fxfa/parser/xfa_script_imp.cpp | 19 +- xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp | 16 +- xfa/fxfa/parser/xfa_script_nodehelper.cpp | 30 +-- xfa/fxfa/parser/xfa_script_resolveprocessor.cpp | 28 +-- xfa/fxfa/parser/xfa_utils_imp.cpp | 19 +- 32 files changed, 381 insertions(+), 370 deletions(-) diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index d42dce3ea0..6d38cf589c 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -209,7 +209,7 @@ CXFA_LayoutProcessor* CXFA_FFDocView::GetXFALayout() const { } FX_BOOL CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) { CXFA_Node* pNode = pWidgetAcc->GetNode(); - XFA_Element eType = pNode->GetClassID(); + XFA_Element eType = pNode->GetElementType(); if (eType != XFA_Element::Field && eType != XFA_Element::ExclGroup) { return FALSE; } @@ -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->GetElementType() != XFA_Element::Field && + pFormNode->GetElementType() != 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()->GetElementType() == XFA_Element::ExclGroup) { Iterator.SkipTree(); } } @@ -401,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->GetElementType() == XFA_Element::Draw) { return XFA_EVENTERROR_NotExist; } switch (pParam->m_eType) { @@ -441,7 +441,7 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, if (pFormNode == pExclude) { return iRet; } - XFA_Element elementType = pFormNode->GetClassID(); + XFA_Element elementType = pFormNode->GetElementType(); if (elementType == XFA_Element::Field) { if (eEventType == XFA_EVENT_IndexChange) { return iRet; @@ -461,7 +461,7 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling, XFA_ObjectType::ContainerNode)) { - elementType = pNode->GetClassID(); + elementType = pNode->GetElementType(); if (elementType != XFA_Element::Variables && elementType != XFA_Element::Draw) { iRet |= ExecEventActivityByDeepFirst(pNode, eEventType, bIsFormReady, @@ -600,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->GetElementType() == XFA_Element::Subform); m_IndexChangedSubforms.Add(pNode); } void CXFA_FFDocView::RunDocClose() { diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 59374cdbec..d3e645d56b 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -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->GetElementType() == 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 1a89ceaba5..e4b8312841 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -89,7 +89,7 @@ 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(); + XFA_Element eType = pNode->GetElementType(); if (eType == XFA_Element::PageArea) return new CXFA_FFPageView(pDocView, pNode); @@ -320,7 +320,7 @@ void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) { if (!pDocView) return; - XFA_Element iType = pNode->GetClassID(); + XFA_Element iType = pNode->GetElementType(); if (XFA_IsCreateWidget(iType)) { CXFA_WidgetAcc* pAcc = new CXFA_WidgetAcc(pDocView, pNode); pNode->SetObject(XFA_ATTRIBUTE_WidgetData, pAcc, &gs_XFADeleteWidgetAcc); @@ -381,7 +381,7 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender, return; } - XFA_Element ePType = pParentNode->GetClassID(); + XFA_Element ePType = pParentNode->GetElementType(); FX_BOOL bIsContainerNode = pParentNode->IsContainerNode(); CXFA_WidgetAcc* pWidgetAcc = static_cast(pWidgetNode->GetWidgetData()); @@ -415,8 +415,8 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender, pWidgetAcc->UpdateUIDisplay(); pDocView->AddCalculateWidgetAcc(pWidgetAcc); pDocView->AddValidateWidget(pWidgetAcc); - } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent)->GetClassID() == - XFA_Element::ExclGroup) { + } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent) + ->GetElementType() == XFA_Element::ExclGroup) { pWidgetAcc->UpdateUIDisplay(); } return; diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index 7123df82b9..dd40ecf946 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->GetElementType() != XFA_Element::Field) { return false; } @@ -373,7 +373,8 @@ void CXFA_FFTabOrderPageWidgetIterator::OrderContainer( CXFA_TabParam* pParam = new CXFA_TabParam; pParam->m_pWidget = hWidget; tabParams.Add(pParam); - if (XFA_IsLayoutElement(pSearchItem->GetFormNode()->GetClassID(), TRUE)) { + if (XFA_IsLayoutElement(pSearchItem->GetFormNode()->GetElementType(), + TRUE)) { OrderContainer(sIterator, pSearchItem, pParam, bCurrentItem, bContentArea, bMarsterPage); } diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 1611b81397..45b6b7e31a 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -1179,7 +1179,7 @@ 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()->GetElementType(); if (XFA_IsCreateWidget(iType)) { return static_cast(pLayoutItem); } @@ -2033,7 +2033,7 @@ void XFA_DrawBox(CXFA_Box box, if (!box || box.GetPresence() != XFA_ATTRIBUTEENUM_Visible) return; - XFA_Element iType = box.GetClassID(); + XFA_Element iType = box.GetElementType(); if (iType != XFA_Element::Arc && iType != XFA_Element::Border && iType != XFA_Element::Rectangle) { return; diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 3d8d7e18dc..1e5bd0ac34 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -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->GetElementType() != XFA_Element::ExclGroup) { return NULL; } return static_cast(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 (GetElementType() == XFA_Element::Draw) { return XFA_EVENTERROR_NotExist; } int32_t iRet = XFA_EVENTERROR_NotExist; @@ -343,7 +343,7 @@ int32_t CXFA_WidgetAcc::ProcessEvent(CXFA_Event& event, } int32_t CXFA_WidgetAcc::ProcessCalculate() { - if (GetClassID() == XFA_Element::Draw) + if (GetElementType() == 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 (GetElementType() == XFA_Element::Draw) { return XFA_EVENTERROR_NotExist; } CXFA_Validate validate = GetValidate(); @@ -1407,7 +1407,7 @@ void CXFA_WidgetAcc::InitLayoutData() { default: break; } - if (GetClassID() == XFA_Element::Field) { + if (GetElementType() == 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->GetElementType() == XFA_Element::ExData) { CFX_WideString wsContentType; m_pTextNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); @@ -1573,7 +1573,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) { return NULL; } CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild); - if (pChildNode && pChildNode->GetClassID() == XFA_Element::ExData) { + if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) { CFX_WideString wsContentType; pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); if (wsContentType == FX_WSTRC(L"text/html")) { @@ -1608,7 +1608,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) { return NULL; } CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild); - if (pChildNode && pChildNode->GetClassID() == XFA_Element::ExData) { + if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) { CFX_WideString wsContentType; pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); if (wsContentType == FX_WSTRC(L"text/html")) { diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp index 6ad03d1b73..5221c7cd6d 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->GetElementType() == 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->GetElementType() == XFA_Element::Draw) return XFA_EVENTERROR_NotExist; switch (pParam->m_eType) { diff --git a/xfa/fxfa/parser/cxfa_box.h b/xfa/fxfa/parser/cxfa_box.h index 106ed20222..56c15a2c6b 100644 --- a/xfa/fxfa/parser/cxfa_box.h +++ b/xfa/fxfa/parser/cxfa_box.h @@ -19,9 +19,11 @@ class CXFA_Box : public CXFA_Data { public: explicit CXFA_Box(CXFA_Node* pNode) : CXFA_Data(pNode) {} - bool IsArc() const { return GetClassID() == XFA_Element::Arc; } - bool IsBorder() const { return GetClassID() == XFA_Element::Border; } - bool IsRectangle() const { return GetClassID() == XFA_Element::Rectangle; } + bool IsArc() const { return GetElementType() == XFA_Element::Arc; } + bool IsBorder() const { return GetElementType() == XFA_Element::Border; } + bool IsRectangle() const { + return GetElementType() == XFA_Element::Rectangle; + } int32_t GetHand() const; int32_t GetPresence() const; int32_t CountEdges() const; diff --git a/xfa/fxfa/parser/cxfa_data.cpp b/xfa/fxfa/parser/cxfa_data.cpp index 1e0db417d6..7a218516b7 100644 --- a/xfa/fxfa/parser/cxfa_data.cpp +++ b/xfa/fxfa/parser/cxfa_data.cpp @@ -59,8 +59,8 @@ FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) { return (0xff << 24) | (r << 16) | (g << 8) | b; } -XFA_Element CXFA_Data::GetClassID() const { - return m_pNode ? m_pNode->GetClassID() : XFA_Element::Unknown; +XFA_Element CXFA_Data::GetElementType() const { + return m_pNode ? m_pNode->GetElementType() : XFA_Element::Unknown; } FX_BOOL CXFA_Data::TryMeasure(XFA_ATTRIBUTE eAttr, diff --git a/xfa/fxfa/parser/cxfa_data.h b/xfa/fxfa/parser/cxfa_data.h index dfb1682fee..afb6c3b675 100644 --- a/xfa/fxfa/parser/cxfa_data.h +++ b/xfa/fxfa/parser/cxfa_data.h @@ -21,7 +21,7 @@ class CXFA_Data { operator bool() const { return !!m_pNode; } CXFA_Node* GetNode() const { return m_pNode; } - XFA_Element GetClassID() const; + XFA_Element GetElementType() const; protected: FX_BOOL TryMeasure(XFA_ATTRIBUTE eAttr, diff --git a/xfa/fxfa/parser/cxfa_event.cpp b/xfa/fxfa/parser/cxfa_event.cpp index 1eb182ec3b..3e5639617b 100644 --- a/xfa/fxfa/parser/cxfa_event.cpp +++ b/xfa/fxfa/parser/cxfa_event.cpp @@ -17,7 +17,7 @@ int32_t CXFA_Event::GetActivity() { XFA_Element CXFA_Event::GetEventType() { CXFA_Node* pChild = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pChild) { - XFA_Element eType = pChild->GetClassID(); + XFA_Element eType = pChild->GetElementType(); if (eType != XFA_Element::Extras) return eType; diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp index c19504facd..0c4a6f547d 100644 --- a/xfa/fxfa/parser/cxfa_fill.cpp +++ b/xfa/fxfa/parser/cxfa_fill.cpp @@ -39,7 +39,7 @@ FX_ARGB CXFA_Fill::GetColor(FX_BOOL bText) { XFA_Element CXFA_Fill::GetFillType() { CXFA_Node* pChild = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pChild) { - XFA_Element eType = pChild->GetClassID(); + XFA_Element eType = pChild->GetElementType(); if (eType != XFA_Element::Color && eType != XFA_Element::Extras) return eType; diff --git a/xfa/fxfa/parser/cxfa_stroke.h b/xfa/fxfa/parser/cxfa_stroke.h index f455edc69e..6bfc409af7 100644 --- a/xfa/fxfa/parser/cxfa_stroke.h +++ b/xfa/fxfa/parser/cxfa_stroke.h @@ -23,8 +23,8 @@ class CXFA_Stroke : public CXFA_Data { public: explicit CXFA_Stroke(CXFA_Node* pNode) : CXFA_Data(pNode) {} - bool IsCorner() const { return GetClassID() == XFA_Element::Corner; } - bool IsEdge() const { return GetClassID() == XFA_Element::Edge; } + bool IsCorner() const { return GetElementType() == XFA_Element::Corner; } + bool IsEdge() const { return GetElementType() == XFA_Element::Edge; } bool IsVisible() const { return GetPresence() == XFA_ATTRIBUTEENUM_Visible; } int32_t GetPresence() const; int32_t GetCapType() const; diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp index dcb00df551..2309a07799 100644 --- a/xfa/fxfa/parser/cxfa_validate.cpp +++ b/xfa/fxfa/parser/cxfa_validate.cpp @@ -48,7 +48,7 @@ void CXFA_Validate::GetMessageText(CFX_WideString& wsMessage, CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pItemNode; pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pItemNode->GetClassID() != XFA_Element::Text) + if (pItemNode->GetElementType() != XFA_Element::Text) continue; CFX_WideStringC wsName; @@ -85,7 +85,7 @@ void CXFA_Validate::SetMessageText(CFX_WideString& wsMessage, CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pItemNode; pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pItemNode->GetClassID() != XFA_Element::Text) + if (pItemNode->GetElementType() != XFA_Element::Text) continue; CFX_WideStringC wsName; diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp index eac146be8a..70b1aba5ab 100644 --- a/xfa/fxfa/parser/cxfa_value.cpp +++ b/xfa/fxfa/parser/cxfa_value.cpp @@ -12,7 +12,7 @@ XFA_Element CXFA_Value::GetChildValueClassID() { if (!m_pNode) return XFA_Element::Unknown; if (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) - return pNode->GetClassID(); + return pNode->GetElementType(); return XFA_Element::Unknown; } diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 28d3f4b312..ed53f8324b 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -294,7 +294,7 @@ FX_BOOL CXFA_WidgetData::GetButtonRollover(CFX_WideString& wsRollover, pText->TryCData(XFA_ATTRIBUTE_Name, wsName); if (wsName == FX_WSTRC(L"rollover")) { pText->TryContent(wsRollover); - bRichText = pText->GetClassID() == XFA_Element::ExData; + bRichText = pText->GetElementType() == XFA_Element::ExData; return !wsRollover.IsEmpty(); } pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); @@ -312,7 +312,7 @@ FX_BOOL CXFA_WidgetData::GetButtonDown(CFX_WideString& wsDown, pText->TryCData(XFA_ATTRIBUTE_Name, wsName); if (wsName == FX_WSTRC(L"down")) { pText->TryContent(wsDown); - bRichText = pText->GetClassID() == XFA_Element::ExData; + bRichText = pText->GetElementType() == XFA_Element::ExData; return !wsDown.IsEmpty(); } pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); @@ -339,7 +339,7 @@ int32_t CXFA_WidgetData::GetCheckButtonMark() { FX_BOOL CXFA_WidgetData::IsRadioButton() { if (CXFA_Node* pParent = m_pNode->GetNodeItem(XFA_NODEITEM_Parent)) - return pParent->GetClassID() == XFA_Element::ExclGroup; + return pParent->GetElementType() == XFA_Element::ExclGroup; return FALSE; } @@ -394,7 +394,7 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { CXFA_Node* pChild = exclGroup.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pChild->GetClassID() != XFA_Element::Field) + if (pChild->GetElementType() != XFA_Element::Field) continue; CXFA_Node* pItem = pChild->GetChild(0, XFA_Element::Items); @@ -440,7 +440,7 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { CXFA_Node* CXFA_WidgetData::GetExclGroupNode() { CXFA_Node* pExcl = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_Parent)); - if (!pExcl || pExcl->GetClassID() != XFA_Element::ExclGroup) + if (!pExcl || pExcl->GetElementType() != XFA_Element::ExclGroup) return NULL; return pExcl; } @@ -483,7 +483,7 @@ void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue, CFX_WideString wsExclGroup; for (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pNode->GetClassID() != XFA_Element::Field) + if (pNode->GetElementType() != XFA_Element::Field) continue; CXFA_Node* pItem = pNode->GetChild(0, XFA_Element::Items); @@ -520,7 +520,7 @@ CXFA_Node* CXFA_WidgetData::GetExclGroupFirstMember() { CXFA_Node* pNode = pExcl->GetNodeItem(XFA_NODEITEM_FirstChild); while (pNode) { - if (pNode->GetClassID() == XFA_Element::Field) + if (pNode->GetElementType() == XFA_Element::Field) return pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling); @@ -533,7 +533,7 @@ CXFA_Node* CXFA_WidgetData::GetExclGroupNextMember(CXFA_Node* pNode) { CXFA_Node* pNodeField = pNode->GetNodeItem(XFA_NODEITEM_NextSibling); while (pNodeField) { - if (pNodeField->GetClassID() == XFA_Element::Field) + if (pNodeField->GetElementType() == XFA_Element::Field) return pNodeField; pNodeField = pNodeField->GetNodeItem(XFA_NODEITEM_NextSibling); @@ -577,7 +577,7 @@ int32_t CXFA_WidgetData::CountChoiceListItems(FX_BOOL bSaveValue) { int32_t iCount = 0; CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pNode->GetClassID() != XFA_Element::Items) + if (pNode->GetElementType() != XFA_Element::Items) continue; iCount++; @@ -608,7 +608,7 @@ FX_BOOL CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText, int32_t iCount = 0; CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pNode->GetClassID() != XFA_Element::Items) + if (pNode->GetElementType() != XFA_Element::Items) continue; iCount++; @@ -643,7 +643,7 @@ void CXFA_WidgetData::GetChoiceListItems(CFX_WideStringArray& wsTextArray, int32_t iCount = 0; CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pNode->GetClassID() != XFA_Element::Items) + if (pNode->GetElementType() != XFA_Element::Items) continue; iCount++; @@ -875,7 +875,7 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, CXFA_Node* pItemNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pItemNode; pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pItemNode->GetClassID() != XFA_Element::Items) + if (pItemNode->GetElementType() != XFA_Element::Items) continue; listitems.Add(pItemNode); @@ -932,7 +932,7 @@ void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue, CXFA_NodeArray listitems; CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pItems->GetClassID() != XFA_Element::Items) + if (pItems->GetElementType() != XFA_Element::Items) continue; iCount++; @@ -978,7 +978,7 @@ void CXFA_WidgetData::GetItemValue(const CFX_WideStringC& wsLabel, CXFA_NodeArray listitems; CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pItems->GetClassID() != XFA_Element::Items) + if (pItems->GetElementType() != XFA_Element::Items) continue; iCount++; @@ -1023,7 +1023,7 @@ FX_BOOL CXFA_WidgetData::DeleteItem(int32_t nIndex, FX_BOOL bSetValue = FALSE; CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pItems->GetClassID() != XFA_Element::Items) + if (pItems->GetElementType() != XFA_Element::Items) continue; if (nIndex < 0) { @@ -1276,7 +1276,7 @@ int32_t CXFA_WidgetData::GetVerticalScrollPolicy() { int32_t CXFA_WidgetData::GetMaxChars(XFA_Element& eType) { if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value)) { if (CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) { - switch (pChild->GetClassID()) { + switch (pChild->GetElementType()) { case XFA_Element::Text: eType = XFA_Element::Text; return pChild->GetInteger(XFA_ATTRIBUTE_MaxChars); @@ -1328,7 +1328,7 @@ FX_BOOL CXFA_WidgetData::SetValue(const CFX_WideString& wsValue, if (!pNode) return TRUE; - XFA_Element uiType = pNode->GetClassID(); + XFA_Element uiType = pNode->GetElementType(); if (!wsPicture.IsEmpty()) { CXFA_LocaleMgr* pLocalMgr = m_pNode->GetDocument()->GetLocalMgr(); IFX_Locale* pLocale = GetLocal(); @@ -1493,7 +1493,7 @@ FX_BOOL CXFA_WidgetData::GetValue(CFX_WideString& wsValue, if (!pNode) return TRUE; - XFA_Element uiType = GetUIChild()->GetClassID(); + XFA_Element uiType = GetUIChild()->GetElementType(); switch (uiType) { case XFA_Element::ChoiceList: { if (eValueType == XFA_VALUEPICTURE_Display) { @@ -1598,7 +1598,7 @@ FX_BOOL CXFA_WidgetData::GetFormatDataValue(const CFX_WideString& wsValue, return FALSE; int32_t iVTType = XFA_VT_NULL; - XFA_Element eType = pValueChild->GetClassID(); + XFA_Element eType = pValueChild->GetElementType(); switch (eType) { case XFA_Element::Decimal: iVTType = XFA_VT_DECIMAL; diff --git a/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp b/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp index d0fb2f47ab..5c7fdfe83a 100644 --- a/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp @@ -31,7 +31,7 @@ void XFA_DataDescription_UpdateDataRelation(CXFA_Node* pDataNode, pDataChild; pDataChild = pDataChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { uint32_t dwNameHash = pDataChild->GetNameHash(); - XFA_Element eType = pDataChild->GetClassID(); + XFA_Element eType = pDataChild->GetElementType(); if (!dwNameHash) { continue; } @@ -40,7 +40,7 @@ void XFA_DataDescription_UpdateDataRelation(CXFA_Node* pDataNode, for (CXFA_Node* pDDGroupNode = sIterator.GetCurrent(); pDDGroupNode; pDDGroupNode = sIterator.MoveToNext()) { if (pDDGroupNode != pDataDescriptionNode) { - if (pDDGroupNode->GetClassID() != XFA_Element::DataGroup) { + if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup) { continue; } CFX_WideString wsNamespace; @@ -53,7 +53,7 @@ void XFA_DataDescription_UpdateDataRelation(CXFA_Node* pDataNode, if (!pDDNode) { continue; } - if (pDDNode->GetClassID() != eType) { + if (pDDNode->GetElementType() != eType) { break; } pDataChild->SetDataDescriptionNode(pDDNode); @@ -86,7 +86,7 @@ CXFA_Node* XFA_DataDescription_MaybeCreateDataNode( for (CXFA_Node* pDDGroupNode = sIterator.GetCurrent(); pDDGroupNode; pDDGroupNode = sIterator.MoveToNext()) { if (pDDGroupNode != pParentDDNode) { - if (pDDGroupNode->GetClassID() != XFA_Element::DataGroup) { + if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup) { continue; } CFX_WideString wsNamespace; @@ -100,7 +100,7 @@ CXFA_Node* XFA_DataDescription_MaybeCreateDataNode( if (!pDDNode) { continue; } - if (pDDNode->GetClassID() != eNodeType) { + if (pDDNode->GetElementType() != eNodeType) { break; } CXFA_Node* pDataNode = diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 6a6abe9a99..dc52c504a7 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -73,7 +73,7 @@ static FX_BOOL XFA_DataMerge_FormValueNode_SetChildContent( pChildNode->GetNodeItem(XFA_NODEITEM_FirstChild); if (!pContentRawDataNode) { XFA_Element element = XFA_Element::Sharptext; - if (pChildNode->GetClassID() == XFA_Element::ExData) { + if (pChildNode->GetElementType() == XFA_Element::ExData) { CFX_WideString wsContentType; pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); @@ -104,7 +104,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, FX_BOOL bDataToForm = TRUE) { pFormNode->SetObject(XFA_ATTRIBUTE_BindingNode, pDataNode); pDataNode->AddBindItem(pFormNode); - XFA_Element eClass = pFormNode->GetClassID(); + XFA_Element eClass = pFormNode->GetElementType(); if (eClass != XFA_Element::Field && eClass != XFA_Element::ExclGroup) { return; } @@ -173,7 +173,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, CXFA_Node* pChecked = NULL; CXFA_Node* pChild = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pChild->GetClassID() != XFA_Element::Field) { + if (pChild->GetElementType() != XFA_Element::Field) { continue; } CXFA_Node* pValue = pChild->GetChild(0, XFA_Element::Value); @@ -210,7 +210,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, if (pChild == pChecked) { continue; } - if (pChild->GetClassID() != XFA_Element::Field) { + if (pChild->GetElementType() != XFA_Element::Field) { continue; } CXFA_Node* pValue = pChild->GetProperty(0, XFA_Element::Value); @@ -367,7 +367,7 @@ static CXFA_Node* XFA_DataMerge_ScopeMatchGlobalBinding( pDataChild = pDataChild->GetNextSameNameSibling(dwNameHash)) { if (pDataChild == pLastDataScope || (eMatchDataNodeType != XFA_Element::DataModel && - pDataChild->GetClassID() != eMatchDataNodeType) || + pDataChild->GetElementType() != eMatchDataNodeType) || pDataChild->HasBindItem()) { continue; } @@ -425,7 +425,7 @@ static CXFA_Node* XFA_DataMerge_FindOnceDataNode(CXFA_Document* pDocument, pDataChild = pDataChild->GetNextSameNameSibling(dwNameHash)) { if (pDataChild == pLastDataScope || pDataChild->HasBindItem() || (eMatchNodeType != XFA_Element::DataModel && - pDataChild->GetClassID() != eMatchNodeType)) { + pDataChild->GetElementType() != eMatchNodeType)) { continue; } return pDataChild; @@ -471,7 +471,7 @@ CXFA_Node* XFA_DataMerge_FindFormDOMInstance(CXFA_Document* pDocument, CXFA_Node* pFormChild = pFormParent->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pFormChild; pFormChild = pFormChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pFormChild->GetClassID() == eClassID && + if (pFormChild->GetElementType() == eClassID && pFormChild->GetNameHash() == dwNameHash && pFormChild->IsUnusedNode()) { return pFormChild; } @@ -480,7 +480,7 @@ CXFA_Node* XFA_DataMerge_FindFormDOMInstance(CXFA_Document* pDocument, } static FX_BOOL XFA_NeedGenerateForm(CXFA_Node* pTemplateChild, FX_BOOL bUseInstanceManager = TRUE) { - XFA_Element eType = pTemplateChild->GetClassID(); + XFA_Element eType = pTemplateChild->GetElementType(); if (eType == XFA_Element::Variables) { return TRUE; } @@ -501,8 +501,8 @@ CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(CXFA_Document* pDocument, CXFA_Node* pExistingNode = NULL; if (pSubformArray == NULL) { pExistingNode = XFA_DataMerge_FindFormDOMInstance( - pDocument, pTemplateNode->GetClassID(), pTemplateNode->GetNameHash(), - pFormParent); + pDocument, pTemplateNode->GetElementType(), + pTemplateNode->GetNameHash(), pFormParent); } else if (pSubformArray->GetSize() > 0) { pExistingNode = pSubformArray->GetAt(0); pSubformArray->RemoveAt(0); @@ -516,7 +516,7 @@ CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(CXFA_Document* pDocument, } pExistingNode->ClearFlag(XFA_NodeFlag_UnusedNode); pExistingNode->SetTemplateNode(pTemplateNode); - if (bRecursive && pExistingNode->GetClassID() != XFA_Element::Items) { + if (bRecursive && pExistingNode->GetElementType() != XFA_Element::Items) { for (CXFA_Node* pTemplateChild = pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild); pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem( @@ -561,7 +561,7 @@ static CXFA_Node* XFA_NodeMerge_CloneOrMergeInstanceManager( for (CXFA_Node* pNode = pExistingNode->GetNodeItem(XFA_NODEITEM_NextSibling); pNode;) { - XFA_Element eCurType = pNode->GetClassID(); + XFA_Element eCurType = pNode->GetElementType(); if (eCurType == XFA_Element::InstanceManager) { break; } @@ -616,7 +616,7 @@ static CXFA_Node* XFA_DataMerge_FindMatchingDataNode( for (CXFA_Node* pCurTemplateNode = pIterator->GetCurrent(); pCurTemplateNode;) { XFA_Element eMatchNodeType; - switch (pCurTemplateNode->GetClassID()) { + switch (pCurTemplateNode->GetElementType()) { case XFA_Element::Subform: eMatchNodeType = XFA_Element::DataGroup; break; @@ -686,7 +686,7 @@ static CXFA_Node* XFA_DataMerge_FindMatchingDataNode( pDocument, pTemplateNodeBind->GetCData(XFA_ATTRIBUTE_Ref), pDataScope, eMatchNodeType, pTemplateNode, bForceBind, bUpLevel); if (pDataRefBindNode && - pDataRefBindNode->GetClassID() == eMatchNodeType) { + pDataRefBindNode->GetElementType() == eMatchNodeType) { pResult = pDataRefBindNode; } if (!pResult) { @@ -750,11 +750,11 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( CXFA_Node* pDataScope, FX_BOOL bOneInstance, FX_BOOL bDataMerge) { - XFA_Element eElement = pTemplateNode->GetClassID(); + XFA_Element eElement = pTemplateNode->GetElementType(); CXFA_Node* pOccurNode = NULL; CXFA_Node* pFirstInstance = NULL; FX_BOOL bUseInstanceManager = - pFormParentNode->GetClassID() != XFA_Element::Area; + pFormParentNode->GetElementType() != XFA_Element::Area; CXFA_Node* pInstMgrNode = NULL; CXFA_NodeArray subformArray; CXFA_NodeArray* pSearchArray = NULL; @@ -780,7 +780,7 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( if (pInstMgrNode) { pInstMgrNode->SetFlag(XFA_NodeFlag_Initialized, true); pSearchArray = &subformArray; - if (pFormParentNode->GetClassID() == XFA_Element::PageArea) { + if (pFormParentNode->GetElementType() == XFA_Element::PageArea) { bOneInstance = TRUE; if (subformArray.GetSize() < 1) { pSearchArray = NULL; @@ -963,7 +963,7 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( pSearchArray = NULL; } } else if (!XFA_DataMerge_FindFormDOMInstance( - pDocument, pTemplateNode->GetClassID(), + pDocument, pTemplateNode->GetElementType(), pTemplateNode->GetNameHash(), pFormParentNode)) { break; } @@ -1032,9 +1032,9 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_Field(CXFA_Document* pDocument, if (XFA_NeedGenerateForm(pTemplateChildNode)) { XFA_NodeMerge_CloneOrMergeContainer(pDocument, pFieldNode, pTemplateChildNode, TRUE); - } else if (pTemplateNode->GetClassID() == XFA_Element::ExclGroup && + } else if (pTemplateNode->GetElementType() == XFA_Element::ExclGroup && pTemplateChildNode->IsContainerNode()) { - if (pTemplateChildNode->GetClassID() == XFA_Element::Field) { + if (pTemplateChildNode->GetElementType() == XFA_Element::Field) { XFA_DataMerge_CopyContainer_Field(pDocument, pTemplateChildNode, pFieldNode, NULL, FALSE); } @@ -1061,7 +1061,7 @@ CXFA_Node* CXFA_Document::DataMerge_CopyContainer(CXFA_Node* pTemplateNode, FX_BOOL bOneInstance, FX_BOOL bDataMerge, FX_BOOL bUpLevel) { - switch (pTemplateNode->GetClassID()) { + switch (pTemplateNode->GetElementType()) { case XFA_Element::SubformSet: case XFA_Element::Subform: case XFA_Element::Area: @@ -1091,7 +1091,7 @@ static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument, FX_BOOL bDataRef, FX_BOOL bParentDataRef) { FX_BOOL bMatchRef = TRUE; - XFA_Element eClassID = pFormNode->GetClassID(); + XFA_Element eClassID = pFormNode->GetElementType(); CXFA_Node* pDataNode = pFormNode->GetBindData(); if (eClassID == XFA_Element::Subform || eClassID == XFA_Element::ExclGroup || eClassID == XFA_Element::Field) { @@ -1264,7 +1264,7 @@ void CXFA_Document::DoDataMerge() { pDatasetsRoot->GetNodeItem(XFA_NODEITEM_FirstChild); pChildNode; pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pChildNode->GetClassID() != XFA_Element::DataGroup) { + if (pChildNode->GetElementType() != XFA_Element::DataGroup) { continue; } CFX_WideString wsNamespaceURI; @@ -1306,7 +1306,7 @@ void CXFA_Document::DoDataMerge() { CXFA_Node* pTemplateChosen = dwNameHash != 0 ? pTemplateRoot->GetFirstChildByName(dwNameHash) : NULL; if (!pTemplateChosen || - pTemplateChosen->GetClassID() != XFA_Element::Subform) { + pTemplateChosen->GetElementType() != XFA_Element::Subform) { pTemplateChosen = pTemplateRoot->GetFirstChildByClass(XFA_Element::Subform); } if (!pTemplateChosen) { @@ -1377,7 +1377,7 @@ void CXFA_Document::DoDataMerge() { while (pNode) { if (pNode->IsUnusedNode()) { if (pNode->IsContainerNode() || - pNode->GetClassID() == XFA_Element::InstanceManager) { + pNode->GetElementType() == XFA_Element::InstanceManager) { CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext(); pNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pNode); pNode = pNext; diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp index 919a94d8fe..45102c8fb6 100644 --- a/xfa/fxfa/parser/xfa_document_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_imp.cpp @@ -290,7 +290,7 @@ static void XFA_ProtoMerge_MergeNodeRecurse(CXFA_Document* pDocument, pDestNodeParent->GetNodeItem(XFA_NODEITEM_FirstChild); pFormChild; pFormChild = pFormChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pFormChild->GetClassID() == pProtoNode->GetClassID() && + if (pFormChild->GetElementType() == pProtoNode->GetElementType() && pFormChild->GetNameHash() == pProtoNode->GetNameHash() && pFormChild->IsUnusedNode()) { pFormChild->ClearFlag(XFA_NodeFlag_UnusedNode); diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index c45f609e3a..5555673f8d 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -50,7 +50,7 @@ FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) { if (pDataNode) { pDataModel->RemoveChild(pDataNode); } - if (pImportDataRoot->GetClassID() == XFA_Element::DataModel) { + if (pImportDataRoot->GetElementType() == XFA_Element::DataModel) { while (CXFA_Node* pChildNode = pImportDataRoot->GetNodeItem(XFA_NODEITEM_FirstChild)) { pImportDataRoot->RemoveChild(pChildNode); @@ -145,11 +145,11 @@ static FX_BOOL XFA_DataExporter_AttributeSaveInDataModel( CXFA_Node* pNode, XFA_ATTRIBUTE eAttribute) { FX_BOOL bSaveInDataModel = FALSE; - if (pNode->GetClassID() != XFA_Element::Image) { + if (pNode->GetElementType() != XFA_Element::Image) { return bSaveInDataModel; } CXFA_Node* pValueNode = pNode->GetNodeItem(XFA_NODEITEM_Parent); - if (!pValueNode || pValueNode->GetClassID() != XFA_Element::Value) { + if (!pValueNode || pValueNode->GetElementType() != XFA_Element::Value) { return bSaveInDataModel; } CXFA_Node* pFieldNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); @@ -166,7 +166,7 @@ FX_BOOL XFA_DataExporter_ContentNodeNeedtoExport(CXFA_Node* pContentNode) { ASSERT(pContentNode->IsContentNode()); CXFA_Node* pParentNode = pContentNode->GetNodeItem(XFA_NODEITEM_Parent); - if (!pParentNode || pParentNode->GetClassID() != XFA_Element::Value) + if (!pParentNode || pParentNode->GetElementType() != XFA_Element::Value) return TRUE; CXFA_Node* pGrandParentNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); @@ -206,7 +206,8 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( FX_BOOL bSaveXML = FALSE) { CFX_WideString wsAttrs; int32_t iAttrs = 0; - const uint8_t* pAttrs = XFA_GetElementAttributes(pNode->GetClassID(), iAttrs); + const uint8_t* pAttrs = + XFA_GetElementAttributes(pNode->GetElementType(), iAttrs); while (iAttrs--) { const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID((XFA_ATTRIBUTE)pAttrs[iAttrs]); @@ -227,9 +228,9 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( } CXFA_Node* pRawValueNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pRawValueNode && - pRawValueNode->GetClassID() != XFA_Element::SharpxHTML && - pRawValueNode->GetClassID() != XFA_Element::Sharptext && - pRawValueNode->GetClassID() != XFA_Element::Sharpxml) { + pRawValueNode->GetElementType() != XFA_Element::SharpxHTML && + pRawValueNode->GetElementType() != XFA_Element::Sharptext && + pRawValueNode->GetElementType() != XFA_Element::Sharpxml) { pRawValueNode = pRawValueNode->GetNodeItem(XFA_NODEITEM_NextSibling); } if (!pRawValueNode) { @@ -237,7 +238,7 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( } CFX_WideString wsContentType; pNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); - if (pRawValueNode->GetClassID() == XFA_Element::SharpxHTML && + if (pRawValueNode->GetElementType() == XFA_Element::SharpxHTML && wsContentType == FX_WSTRC(L"text/html")) { CFDE_XMLNode* pExDataXML = pNode->GetXMLMappingNode(); if (!pExDataXML) { @@ -259,7 +260,7 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( CFX_ByteStringC(pMemStream->GetBuffer(), pMemStream->GetSize())); pTempStream->Release(); pMemStream->Release(); - } else if (pRawValueNode->GetClassID() == XFA_Element::Sharpxml && + } else if (pRawValueNode->GetElementType() == XFA_Element::Sharpxml && wsContentType == FX_WSTRC(L"text/xml")) { CFX_WideString wsRawValue; pRawValueNode->GetAttribute(XFA_ATTRIBUTE_Value, wsRawValue, FALSE); @@ -313,7 +314,7 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( wsChildren += XFA_ExportEncodeContent(wsValue); } break; default: - if (pNode->GetClassID() == XFA_Element::Items) { + if (pNode->GetElementType() == XFA_Element::Items) { CXFA_Node* pTemplateNode = pNode->GetTemplateNode(); if (!pTemplateNode || pTemplateNode->CountChildren(XFA_Element::Unknown) != @@ -331,7 +332,7 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling); } if (!bSaveXML && !wsChildren.IsEmpty() && - pNode->GetClassID() == XFA_Element::Items) { + pNode->GetElementType() == XFA_Element::Items) { wsChildren.clear(); bSaveXML = TRUE; CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); @@ -370,7 +371,7 @@ static void XFA_DataExporter_RegenerateFormFile_Container( CXFA_Node* pNode, IFX_Stream* pStream, FX_BOOL bSaveXML = FALSE) { - XFA_Element eElement = pNode->GetClassID(); + XFA_Element eElement = pNode->GetElementType(); if (eElement == XFA_Element::Field || eElement == XFA_Element::Draw || !pNode->IsContainerNode()) { CFX_WideTextBuf buf; @@ -390,7 +391,8 @@ static void XFA_DataExporter_RegenerateFormFile_Container( wsOutput); CFX_WideString wsAttrs; int32_t iAttrs = 0; - const uint8_t* pAttrs = XFA_GetElementAttributes(pNode->GetClassID(), iAttrs); + const uint8_t* pAttrs = + XFA_GetElementAttributes(pNode->GetElementType(), iAttrs); while (iAttrs--) { const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID((XFA_ATTRIBUTE)pAttrs[iAttrs]); @@ -551,7 +553,7 @@ FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, return TRUE; } void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode) { - if (!pDataNode || pDataNode->GetClassID() == XFA_Element::DataValue) { + if (!pDataNode || pDataNode->GetElementType() == XFA_Element::DataValue) { return; } int32_t iChildNum = 0; @@ -561,7 +563,7 @@ void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode) { iChildNum++; XFA_DataExporter_DealWithDataGroupNode(pChildNode); } - if (pDataNode->GetClassID() == XFA_Element::DataGroup) { + if (pDataNode->GetElementType() == XFA_Element::DataGroup) { if (iChildNum > 0) { CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); ASSERT(pXMLNode->GetType() == FDE_XMLNODE_Element); diff --git a/xfa/fxfa/parser/xfa_layout_appadapter.cpp b/xfa/fxfa/parser/xfa_layout_appadapter.cpp index 252774ca15..f85f96da2f 100644 --- a/xfa/fxfa/parser/xfa_layout_appadapter.cpp +++ b/xfa/fxfa/parser/xfa_layout_appadapter.cpp @@ -34,7 +34,7 @@ void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) { pNode = pNext; } pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); - if (pLayoutItem->m_pFormNode->GetClassID() == XFA_Element::PageArea) { + if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::PageArea) { pNotify->OnPageEvent(static_cast(pLayoutItem), XFA_PAGEVIEWEVENT_PostRemoved); } diff --git a/xfa/fxfa/parser/xfa_layout_appadapter.h b/xfa/fxfa/parser/xfa_layout_appadapter.h index 118c273f84..685bc4482a 100644 --- a/xfa/fxfa/parser/xfa_layout_appadapter.h +++ b/xfa/fxfa/parser/xfa_layout_appadapter.h @@ -13,7 +13,7 @@ class CXFA_TraverseStrategy_PageAreaContainerLayoutItem { public: static inline CXFA_ContainerLayoutItem* GetFirstChild( CXFA_ContainerLayoutItem* pLayoutItem) { - if (pLayoutItem->m_pFormNode->GetClassID() == XFA_Element::PageSet) { + if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::PageSet) { return static_cast(pLayoutItem->m_pFirstChild); } return NULL; diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index abb888990b..f5857178da 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -73,7 +73,7 @@ CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, m_ePreProcessRs(XFA_ItemLayoutProcessorResult_Done), m_bHasAvailHeight(TRUE) { ASSERT(m_pFormNode && (m_pFormNode->IsContainerNode() || - m_pFormNode->GetClassID() == XFA_Element::Form)); + m_pFormNode->GetElementType() == XFA_Element::Form)); m_pOldLayoutItem = (CXFA_ContentLayoutItem*)m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY); } @@ -200,7 +200,7 @@ static XFA_ATTRIBUTEENUM XFA_ItemLayoutProcessor_GetLayout( return eLayoutMode; } CXFA_Node* pParentNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); - if (pParentNode && pParentNode->GetClassID() == XFA_Element::Form) { + if (pParentNode && pParentNode->GetElementType() == XFA_Element::Form) { bRootForceTb = TRUE; return XFA_ATTRIBUTEENUM_Tb; } @@ -387,7 +387,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) { CXFA_ContainerLayoutItem* CXFA_LayoutItem::GetPage() const { for (CXFA_LayoutItem* pCurNode = const_cast(this); pCurNode; pCurNode = pCurNode->m_pParent) { - if (pCurNode->m_pFormNode->GetClassID() == XFA_Element::PageArea) + if (pCurNode->m_pFormNode->GetElementType() == XFA_Element::PageArea) return static_cast(pCurNode); } return nullptr; @@ -418,7 +418,7 @@ void CXFA_LayoutItem::GetRect(CFX_RectF& rtLayout, FX_BOOL bRelative) const { .ToUnit(XFA_UNIT_Pt)); } } else { - if (pLayoutItem->m_pFormNode->GetClassID() == + if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::ContentArea) { sPos += CFX_PointF(pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_X) @@ -426,7 +426,7 @@ void CXFA_LayoutItem::GetRect(CFX_RectF& rtLayout, FX_BOOL bRelative) const { pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Y) .ToUnit(XFA_UNIT_Pt)); break; - } else if (pLayoutItem->m_pFormNode->GetClassID() == + } else if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::PageArea) { break; } @@ -612,7 +612,7 @@ static FX_BOOL XFA_ItemLayoutProcessor_FindBreakNode( if (!bBreakBefore) { eAttributeType = XFA_ATTRIBUTE_After; } - switch (pBreakNode->GetClassID()) { + switch (pBreakNode->GetElementType()) { case XFA_Element::BreakBefore: { if (bBreakBefore) { pCurActionNode = pBreakNode; @@ -707,7 +707,7 @@ void CXFA_ItemLayoutProcessor::XFA_ItemLayoutProcessor_GotoNextContainerNode( : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); pBookendNode; pBookendNode = pBookendNode->GetNodeItem( XFA_NODEITEM_NextSibling)) { - switch (pBookendNode->GetClassID()) { + switch (pBookendNode->GetElementType()) { case XFA_Element::Bookend: case XFA_Element::Break: pCurActionNode = pBookendNode; @@ -810,7 +810,7 @@ void CXFA_ItemLayoutProcessor::XFA_ItemLayoutProcessor_GotoNextContainerNode( : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); pBookendNode; pBookendNode = pBookendNode->GetNodeItem( XFA_NODEITEM_NextSibling)) { - switch (pBookendNode->GetClassID()) { + switch (pBookendNode->GetElementType()) { case XFA_Element::Bookend: case XFA_Element::Break: pCurActionNode = pBookendNode; @@ -901,7 +901,7 @@ static inline void XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( fContainerHeight = 0; bContainerWidthAutoSize = TRUE; bContainerHeightAutoSize = TRUE; - XFA_Element eClassID = pFormNode->GetClassID(); + XFA_Element eClassID = pFormNode->GetElementType(); CXFA_Measurement mTmpValue; if (bContainerWidthAutoSize && (eClassID == XFA_Element::Subform || eClassID == XFA_Element::ExclGroup) && @@ -1058,7 +1058,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPageArea( if (nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { continue; } - if (pCurChildNode->GetClassID() == XFA_Element::Variables) { + if (pCurChildNode->GetElementType() == XFA_Element::Variables) { continue; } CXFA_ItemLayoutProcessor* pProcessor = @@ -1087,11 +1087,11 @@ void CXFA_ItemLayoutProcessor::DoLayoutPageArea( CXFA_LayoutItem* pLayoutItem = pPageAreaLayoutItem->m_pFirstChild; while (pLayoutItem) { if (!pLayoutItem->IsContentLayoutItem() || - pLayoutItem->m_pFormNode->GetClassID() != XFA_Element::Draw) { + pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::Draw) { pLayoutItem = pLayoutItem->m_pNextSibling; continue; } - if (pLayoutItem->m_pFormNode->GetClassID() == XFA_Element::Draw) { + if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::Draw) { CXFA_LayoutItem* pNextLayoutItem = pLayoutItem->m_pNextSibling; pPageAreaLayoutItem->RemoveChild(pLayoutItem); if (pBeforeItem == NULL) { @@ -1130,7 +1130,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { continue; } - if (m_pCurChildNode->GetClassID() == XFA_Element::Variables) { + if (m_pCurChildNode->GetElementType() == XFA_Element::Variables) { continue; } CXFA_ItemLayoutProcessor* pProcessor = @@ -1178,7 +1178,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( } } else { if (fHiddenContentCalculatedWidth < fChildSuppliedWidth && - m_pCurChildNode->GetClassID() != XFA_Element::Subform) { + m_pCurChildNode->GetElementType() != XFA_Element::Subform) { fHiddenContentCalculatedWidth = fChildSuppliedWidth; } } @@ -1191,7 +1191,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( } } else { if (fHiddenContentCalculatedHeight < fChildSuppliedHeight && - m_pCurChildNode->GetClassID() != XFA_Element::Subform) { + m_pCurChildNode->GetElementType() != XFA_Element::Subform) { fHiddenContentCalculatedHeight = fChildSuppliedHeight; } } @@ -1218,7 +1218,7 @@ static inline void XFA_ItemLayoutProcessor_UpdateWidgetSize( FX_FLOAT& fHeight) { CXFA_Node* pNode = pLayoutItem->m_pFormNode; ASSERT(pNode); - XFA_Element eClassID = pNode->GetClassID(); + XFA_Element eClassID = pNode->GetElementType(); switch (eClassID) { case XFA_Element::Subform: case XFA_Element::Area: @@ -1459,7 +1459,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; pLayoutChild; pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { - if (pLayoutChild->m_pFormNode->GetClassID() != XFA_Element::Subform) { + if (pLayoutChild->m_pFormNode->GetElementType() != XFA_Element::Subform) { continue; } if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) { @@ -1548,7 +1548,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) { continue; } - if (pLayoutChild->m_pFormNode->GetClassID() == XFA_Element::Subform) { + if (pLayoutChild->m_pFormNode->GetElementType() == XFA_Element::Subform) { XFA_ATTRIBUTEENUM eSubformLayout = pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); if (eSubformLayout == XFA_ATTRIBUTEENUM_Row || @@ -1909,8 +1909,8 @@ void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( if (pFormNode == NULL) { return; } - if (pFormNode->GetClassID() == XFA_Element::Overflow || - pFormNode->GetClassID() == XFA_Element::Break) { + if (pFormNode->GetElementType() == XFA_Element::Overflow || + pFormNode->GetElementType() == XFA_Element::Break) { pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); } if (pLeaderNode && pFormNode) { @@ -2469,13 +2469,14 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, TRUE, pLeaderNode, pTrailerNode, bCreatePage) && - m_pFormNode->GetClassID() != XFA_Element::Form && bCreatePage) { + m_pFormNode->GetElementType() != XFA_Element::Form && + bCreatePage) { if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { XFA_ItemLayoutProcessor_AddPendingNode(this, pLeaderNode, TRUE); } if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { - if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)->GetClassID() == - XFA_Element::Form && + if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent) + ->GetElementType() == XFA_Element::Form && m_pLayoutItem == NULL) { XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode, TRUE); @@ -2506,7 +2507,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, FALSE, pLeaderNode, pTrailerNode, bCreatePage) && - m_pFormNode->GetClassID() != XFA_Element::Form) { + m_pFormNode->GetElementType() != XFA_Element::Form) { if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { std::unique_ptr pTempProcessor( new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); @@ -2609,7 +2610,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( } break; case XFA_ItemLayoutProcessorStages_Container: ASSERT(m_pCurChildNode->IsContainerNode()); - if (m_pCurChildNode->GetClassID() == XFA_Element::Variables) { + if (m_pCurChildNode->GetElementType() == XFA_Element::Variables) { break; } if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION && @@ -2870,10 +2871,10 @@ FX_BOOL CXFA_ItemLayoutProcessor::CalculateRowChildPosition( } CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent( CXFA_Node* pSubformSet) { - if (pSubformSet && pSubformSet->GetClassID() == XFA_Element::SubformSet) { + if (pSubformSet && pSubformSet->GetElementType() == XFA_Element::SubformSet) { CXFA_Node* pParent = pSubformSet->GetNodeItem(XFA_NODEITEM_Parent); while (pParent) { - if (pParent->GetClassID() != XFA_Element::SubformSet) { + if (pParent->GetElementType() != XFA_Element::SubformSet) { return pParent; } pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); @@ -2910,7 +2911,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout( FX_FLOAT fHeightLimit, FX_FLOAT fRealHeight, CXFA_LayoutContext* pContext) { - XFA_Element eClassID = m_pFormNode->GetClassID(); + XFA_Element eClassID = m_pFormNode->GetElementType(); switch (eClassID) { case XFA_Element::Subform: case XFA_Element::Area: diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp index 4757ef53a3..f5a3832594 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp @@ -27,13 +27,13 @@ class PageSetContainerLayoutItem { public: static inline CXFA_ContainerLayoutItem* GetFirstChild( CXFA_ContainerLayoutItem* pLayoutItem) { - if (pLayoutItem->m_pFormNode->GetClassID() != XFA_Element::PageSet) + if (pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::PageSet) return nullptr; CXFA_ContainerLayoutItem* pChildItem = static_cast(pLayoutItem->m_pFirstChild); while (pChildItem && - pChildItem->m_pFormNode->GetClassID() != XFA_Element::PageSet) { + pChildItem->m_pFormNode->GetElementType() != XFA_Element::PageSet) { pChildItem = static_cast(pChildItem->m_pNextSibling); } @@ -45,7 +45,7 @@ class PageSetContainerLayoutItem { CXFA_ContainerLayoutItem* pChildItem = static_cast(pLayoutItem->m_pNextSibling); while (pChildItem && - pChildItem->m_pFormNode->GetClassID() != XFA_Element::PageSet) { + pChildItem->m_pFormNode->GetElementType() != XFA_Element::PageSet) { pChildItem = static_cast(pChildItem->m_pNextSibling); } @@ -271,7 +271,7 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { for (pPageArea = m_pTemplatePageSetRoot->GetNodeItem(XFA_NODEITEM_FirstChild); pPageArea; pPageArea = pPageArea->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pPageArea->GetClassID() == XFA_Element::PageArea) { + if (pPageArea->GetElementType() == XFA_Element::PageArea) { iCount++; if (pPageArea->GetFirstChildByClass(XFA_Element::ContentArea)) { return TRUE; @@ -335,7 +335,7 @@ FX_BOOL CXFA_LayoutPageMgr::PrepareFirstPage(CXFA_Node* pRootSubform) { pRootSubform->GetNodeItem(XFA_NODEITEM_FirstChild); pBreakNode; pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - XFA_Element eType = pBreakNode->GetClassID(); + XFA_Element eType = pBreakNode->GetElementType(); if (eType == XFA_Element::BreakBefore || (eType == XFA_Element::Break && pBreakNode->GetEnum(XFA_ATTRIBUTE_Before) != @@ -586,7 +586,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { pPageSetLayoutItem->m_pFirstChild; pPageAreaLayoutItem; pPageAreaLayoutItem = pPageAreaLayoutItem->m_pNextSibling) { - if (pPageAreaLayoutItem->m_pFormNode->GetClassID() != + if (pPageAreaLayoutItem->m_pFormNode->GetElementType() != XFA_Element::PageArea) { continue; } @@ -629,7 +629,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { pLastPageAreaLayoutItem->m_pFirstChild; pChildLayoutItem; pChildLayoutItem = pChildLayoutItem->m_pNextSibling) { - if (pChildLayoutItem->m_pFormNode->GetClassID() != + if (pChildLayoutItem->m_pFormNode->GetElementType() != XFA_Element::ContentArea) { continue; } @@ -652,7 +652,8 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { pContentAreaNode; pContentAreaNode = pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pContentAreaNode->GetClassID() != XFA_Element::ContentArea) { + if (pContentAreaNode->GetElementType() != + XFA_Element::ContentArea) { continue; } iCurContentAreaIndex++; @@ -671,12 +672,13 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { pNode->GetNodeItem(XFA_NODEITEM_FirstChild); pLastPageAreaLayoutItem->m_pFormNode = pNode; while (pChildLayoutItem && pContentAreaNode) { - if (pChildLayoutItem->m_pFormNode->GetClassID() != + if (pChildLayoutItem->m_pFormNode->GetElementType() != XFA_Element::ContentArea) { pChildLayoutItem = pChildLayoutItem->m_pNextSibling; continue; } - if (pContentAreaNode->GetClassID() != XFA_Element::ContentArea) { + if (pContentAreaNode->GetElementType() != + XFA_Element::ContentArea) { pContentAreaNode = pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling); continue; @@ -716,7 +718,7 @@ FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType, FX_BOOL bRet = FALSE; switch (eTargetType) { case XFA_ATTRIBUTEENUM_ContentArea: - if (pTarget && pTarget->GetClassID() != XFA_Element::ContentArea) { + if (pTarget && pTarget->GetElementType() != XFA_Element::ContentArea) { pTarget = NULL; } if (!pTarget || !m_pCurrentContainerRecord || @@ -732,7 +734,7 @@ FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType, } break; case XFA_ATTRIBUTEENUM_PageArea: - if (pTarget && pTarget->GetClassID() != XFA_Element::PageArea) { + if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { pTarget = NULL; } if (!pTarget || !m_pCurrentContainerRecord || @@ -743,12 +745,12 @@ FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType, } break; case XFA_ATTRIBUTEENUM_PageOdd: - if (pTarget && pTarget->GetClassID() != XFA_Element::PageArea) { + if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { pTarget = NULL; } break; case XFA_ATTRIBUTEENUM_PageEven: - if (pTarget && pTarget->GetClassID() != XFA_Element::PageArea) { + if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { pTarget = NULL; } break; @@ -763,7 +765,7 @@ FX_BOOL CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( FX_BOOL bBefore, CXFA_Node*& pBreakLeaderTemplate, CXFA_Node*& pBreakTrailerTemplate) { - XFA_Element eType = pCurNode->GetClassID(); + XFA_Element eType = pCurNode->GetElementType(); switch (eType) { case XFA_Element::BreakBefore: case XFA_Element::BreakAfter: { @@ -802,7 +804,8 @@ FX_BOOL CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( break; } pParentNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); - if (!pParentNode || pParentNode->GetClassID() != XFA_Element::Form) { + if (!pParentNode || + pParentNode->GetElementType() != XFA_Element::Form) { break; } return TRUE; @@ -897,7 +900,7 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, pOverflowNode ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) ->GetTemplateNode(); - if (pOverflowNode->GetClassID() == XFA_Element::Break) { + if (pOverflowNode->GetElementType() == XFA_Element::Break) { CFX_WideStringC wsOverflowLeader; CFX_WideStringC wsOverflowTarget; CFX_WideStringC wsOverflowTrailer; @@ -912,7 +915,7 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); if (pTarget) { m_bCreateOverFlowPage = TRUE; - switch (pTarget->GetClassID()) { + switch (pTarget->GetElementType()) { case XFA_Element::PageArea: RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_PageArea, pTarget, TRUE); @@ -935,7 +938,7 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, return pOverflowNode; } return NULL; - } else if (pOverflowNode->GetClassID() == XFA_Element::Overflow) { + } else if (pOverflowNode->GetElementType() == XFA_Element::Overflow) { CFX_WideStringC wsOverflowLeader; CFX_WideStringC wsOverflowTrailer; CFX_WideStringC wsOverflowTarget; @@ -947,7 +950,7 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); if (pTarget) { m_bCreateOverFlowPage = TRUE; - switch (pTarget->GetClassID()) { + switch (pTarget->GetElementType()) { case XFA_Element::PageArea: RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_PageArea, pTarget, TRUE); @@ -981,8 +984,8 @@ FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, } CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; FX_BOOL bIsOverflowNode = FALSE; - if (pFormNode->GetClassID() == XFA_Element::Overflow || - pFormNode->GetClassID() == XFA_Element::Break) { + if (pFormNode->GetElementType() == XFA_Element::Overflow || + pFormNode->GetElementType() == XFA_Element::Break) { bIsOverflowNode = TRUE; } for (CXFA_Node* pCurNode = @@ -1031,7 +1034,7 @@ FX_BOOL CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( pBookendNode ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) ->GetTemplateNode(); - if (pBookendNode->GetClassID() == XFA_Element::Break) { + if (pBookendNode->GetElementType() == XFA_Element::Break) { pBookendNode->TryCData( bLeader ? XFA_ATTRIBUTE_BookendLeader : XFA_ATTRIBUTE_BookendTrailer, wsBookendLeader); @@ -1041,7 +1044,7 @@ FX_BOOL CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( return TRUE; } return FALSE; - } else if (pBookendNode->GetClassID() == XFA_Element::Bookend) { + } else if (pBookendNode->GetElementType() == XFA_Element::Bookend) { pBookendNode->TryCData( bLeader ? XFA_ATTRIBUTE_Leader : XFA_ATTRIBUTE_Trailer, wsBookendLeader); @@ -1098,7 +1101,7 @@ FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_Ordered( : pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pCurrentNode; pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pCurrentNode->GetClassID() == XFA_Element::PageArea) { + if (pCurrentNode->GetElementType() == XFA_Element::PageArea) { if ((pTargetPageArea == pCurrentNode || pTargetPageArea == NULL)) { if (pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea) == NULL) { @@ -1126,7 +1129,7 @@ FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_Ordered( if (!bQuery) { CreateMinPageRecord(pCurrentNode, FALSE); } - } else if (pCurrentNode->GetClassID() == XFA_Element::PageSet) { + } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { if (FindPageAreaFromPageSet_Ordered(pCurrentNode, NULL, pTargetPageArea, pTargetContentArea, bNewPage, bQuery)) { @@ -1154,14 +1157,14 @@ FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( const XFA_ATTRIBUTEENUM eFallbackPosition = XFA_ATTRIBUTEENUM_Any; CXFA_Node *pPreferredPageArea = NULL, *pFallbackPageArea = NULL; CXFA_Node* pCurrentNode = NULL; - if (!pStartChild || pStartChild->GetClassID() == XFA_Element::PageArea) { + if (!pStartChild || pStartChild->GetElementType() == XFA_Element::PageArea) { pCurrentNode = pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); } else { pCurrentNode = pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling); } for (; pCurrentNode; pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pCurrentNode->GetClassID() == XFA_Element::PageArea) { + if (pCurrentNode->GetElementType() == XFA_Element::PageArea) { if (!MatchPageAreaOddOrEven(pCurrentNode, FALSE)) { continue; } @@ -1221,7 +1224,7 @@ FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( AddContentAreaLayoutItem(pNewRecord, pCurrentNode->GetFirstChildByClass( XFA_Element::ContentArea)); } - } else if (pCurrentNode->GetClassID() == XFA_Element::PageSet) { + } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { if (FindPageAreaFromPageSet_SimplexDuplex( pCurrentNode, NULL, pTargetPageArea, pTargetContentArea, bNewPage, bQuery, ePreferredPosition)) { @@ -1374,7 +1377,7 @@ void CXFA_LayoutPageMgr::InitPageSetMap() { CXFA_NodeIterator sIterator(m_pTemplatePageSetRoot); for (CXFA_Node* pPageSetNode = sIterator.GetCurrent(); pPageSetNode; pPageSetNode = sIterator.MoveToNext()) { - if (pPageSetNode->GetClassID() == XFA_Element::PageSet) { + if (pPageSetNode->GetElementType() == XFA_Element::PageSet) { XFA_ATTRIBUTEENUM eRelation = pPageSetNode->GetEnum(XFA_ATTRIBUTE_Relation); if (eRelation == XFA_ATTRIBUTEENUM_OrderedOccurrence) { @@ -1431,9 +1434,10 @@ void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet, pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); pCurrentPageNode; pCurrentPageNode = pCurrentPageNode->GetNodeItem( XFA_NODEITEM_NextSibling)) { - if (pCurrentPageNode->GetClassID() == XFA_Element::PageArea) { + if (pCurrentPageNode->GetElementType() == XFA_Element::PageArea) { CreateMinPageRecord(pCurrentPageNode, FALSE); - } else if (pCurrentPageNode->GetClassID() == XFA_Element::PageSet) { + } else if (pCurrentPageNode->GetElementType() == + XFA_Element::PageSet) { CreateMinPageSetRecord(pCurrentPageNode, TRUE); } } @@ -1450,9 +1454,9 @@ void CXFA_LayoutPageMgr::CreateNextMinRecord(CXFA_Node* pRecordNode) { pRecordNode->GetNodeItem(XFA_NODEITEM_NextSibling); pCurrentNode; pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pCurrentNode->GetClassID() == XFA_Element::PageArea) { + if (pCurrentNode->GetElementType() == XFA_Element::PageArea) { CreateMinPageRecord(pCurrentNode, FALSE); - } else if (pCurrentNode->GetClassID() == XFA_Element::PageSet) { + } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { CreateMinPageSetRecord(pCurrentNode, TRUE); } } @@ -1596,7 +1600,8 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) { pCurLayoutItem->m_pNextSibling = NULL; pCurLayoutItem->m_pFirstChild = NULL; if (!pCurLayoutItem->IsContentLayoutItem() && - pCurLayoutItem->m_pFormNode->GetClassID() != XFA_Element::PageArea) { + pCurLayoutItem->m_pFormNode->GetElementType() != + XFA_Element::PageArea) { delete pCurLayoutItem; } pCurLayoutItem = pNextLayoutItem; @@ -1607,7 +1612,7 @@ CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( CXFA_LayoutContext* pLayoutContext) { for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { - if (pCurNode->GetClassID() == XFA_Element::Break) { + if (pCurNode->GetElementType() == XFA_Element::Break) { CFX_WideStringC wsOverflowLeader; CFX_WideStringC wsOverflowTarget; CFX_WideStringC wsOverflowTrailer; @@ -1619,7 +1624,7 @@ CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( return pCurNode; } return NULL; - } else if (pCurNode->GetClassID() == XFA_Element::Overflow) { + } else if (pCurNode->GetElementType() == XFA_Element::Overflow) { return pCurNode; } } @@ -1658,7 +1663,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> iterator(pRootLayout); CXFA_ContainerLayoutItem* pRootPageSetContainerItem = iterator.GetCurrent(); - ASSERT(pRootPageSetContainerItem->m_pFormNode->GetClassID() == + ASSERT(pRootPageSetContainerItem->m_pFormNode->GetElementType() == XFA_Element::PageSet); if (iIndex < pDocument->m_pPendingPageSet.GetSize()) { pPendingPageSet = pDocument->m_pPendingPageSet.GetAt(iIndex); @@ -1686,7 +1691,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { if (pNode->GetPacketID() != XFA_XDPPACKET_Template) { continue; } - switch (pNode->GetClassID()) { + switch (pNode->GetElementType()) { case XFA_Element::PageSet: { CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; pContainerItem->m_pFormNode = XFA_NodeMerge_CloneOrMergeContainer( @@ -1716,12 +1721,12 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { if (pContainerItem->m_pOldSubform && pContainerItem->m_pOldSubform != pNewSubform) { CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( - pDocument, pContainerItem->m_pFormNode->GetClassID(), + pDocument, pContainerItem->m_pFormNode->GetElementType(), pContainerItem->m_pFormNode->GetNameHash(), pParentNode); CXFA_ContainerIterator sIterator(pExistingNode); for (CXFA_Node* pIter = sIterator.GetCurrent(); pIter; pIter = sIterator.MoveToNext()) { - if (pIter->GetClassID() != XFA_Element::ContentArea) { + if (pIter->GetElementType() != XFA_Element::ContentArea) { CXFA_LayoutItem* pLayoutItem = static_cast( pIter->GetUserData(XFA_LAYOUTITEMKEY)); if (pLayoutItem) { @@ -1777,7 +1782,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { while (pNode) { if (pNode->IsUnusedNode()) { if (pNode->IsContainerNode()) { - XFA_Element eCurId = pNode->GetClassID(); + XFA_Element eCurId = pNode->GetElementType(); if (eCurId == XFA_Element::PageArea || eCurId == XFA_Element::PageSet) { CXFA_ContainerIterator iteChild(pNode); @@ -1827,7 +1832,7 @@ void CXFA_LayoutPageMgr::LayoutPageSetContents() { for (CXFA_ContainerLayoutItem* pContainerItem = iterator.GetCurrent(); pContainerItem; pContainerItem = iterator.MoveToNext()) { CXFA_Node* pNode = pContainerItem->m_pFormNode; - switch (pNode->GetClassID()) { + switch (pNode->GetElementType()) { case XFA_Element::PageArea: m_pLayoutProcessor->GetRootRootItemLayoutProcessor() ->DoLayoutPageArea(pContainerItem); @@ -1855,7 +1860,7 @@ void CXFA_LayoutPageMgr::SyncLayoutData() { iteratorParent(pRootLayoutItem); for (CXFA_ContainerLayoutItem* pContainerItem = iteratorParent.GetCurrent(); pContainerItem; pContainerItem = iteratorParent.MoveToNext()) { - switch (pContainerItem->m_pFormNode->GetClassID()) { + switch (pContainerItem->m_pFormNode->GetElementType()) { case XFA_Element::PageArea: { nPageIdx++; uint32_t dwRelevant = @@ -1903,7 +1908,7 @@ void XFA_ReleaseLayoutItem_NoPageArea(CXFA_LayoutItem* pLayoutItem) { XFA_ReleaseLayoutItem_NoPageArea(pNode); pNode = pNext; } - if (pLayoutItem->m_pFormNode->GetClassID() != XFA_Element::PageArea) { + if (pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::PageArea) { delete pLayoutItem; } } diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h index 4da2f1045b..67e4a2efad 100644 --- a/xfa/fxfa/parser/xfa_object.h +++ b/xfa/fxfa/parser/xfa_object.h @@ -47,7 +47,9 @@ enum XFA_NodeFlag { class CXFA_Object : public CFXJSE_HostObject { public: - CXFA_Object(CXFA_Document* pDocument, XFA_ObjectType type); + CXFA_Object(CXFA_Document* pDocument, + XFA_ObjectType objectType, + XFA_Element elementType); ~CXFA_Object() override; CXFA_Document* GetDocument() const { return m_pDocument; } @@ -90,7 +92,7 @@ class CXFA_Object : public CFXJSE_HostObject { const CXFA_OrdinaryObject* AsOrdinaryObject() const; const CXFA_NodeList* AsNodeList() const; - XFA_Element GetClassID() const; + XFA_Element GetElementType() const; void GetClassName(CFX_WideStringC& wsName) const; uint32_t GetClassHashCode() const; void Script_ObjectClass_ClassName(CFXJSE_Value* pValue, @@ -101,6 +103,7 @@ class CXFA_Object : public CFXJSE_HostObject { protected: CXFA_Document* const m_pDocument; XFA_ObjectType m_objectType; + XFA_Element m_elementType; }; using CXFA_ObjArray = CFX_ArrayTemplate; @@ -150,7 +153,6 @@ struct XFA_MAPMODULEDATA { class CXFA_Node : public CXFA_Object { public: - XFA_Element GetClassID() const { return m_eNodeClass; } uint32_t GetPacketID() const { return m_ePacket; } void SetFlag(uint32_t dwFlag, bool bNotify); @@ -675,7 +677,6 @@ class CXFA_Node : public CXFA_Object { CXFA_Node* m_pLastChild; CXFA_Node* m_pParent; CFDE_XMLNode* m_pXMLNode; - XFA_Element m_eNodeClass; uint16_t m_ePacket; uint16_t m_uNodeFlags; uint32_t m_dwNameHash; @@ -687,11 +688,6 @@ class CXFA_OrdinaryObject : public CXFA_Object { public: CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_Element eElement); ~CXFA_OrdinaryObject() override; - - XFA_Element GetClassID() const; - - protected: - XFA_Element m_eNodeClass; }; class CXFA_ThisProxy : public CXFA_Object { @@ -712,7 +708,6 @@ class CXFA_NodeList : public CXFA_Object { explicit CXFA_NodeList(CXFA_Document* pDocument); ~CXFA_NodeList() override; - XFA_Element GetClassID() const; CXFA_Node* NamedItem(const CFX_WideStringC& wsName); virtual int32_t GetLength() = 0; virtual FX_BOOL Append(CXFA_Node* pNode) = 0; diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index d71956bed5..d5a9f2f740 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -56,30 +56,25 @@ XFA_MAPDATABLOCKCALLBACKINFO deleteBindItemCallBack = { } // namespace -CXFA_Object::CXFA_Object(CXFA_Document* pDocument, XFA_ObjectType type) - : m_pDocument(pDocument), m_objectType(type) {} +CXFA_Object::CXFA_Object(CXFA_Document* pDocument, + XFA_ObjectType objectType, + XFA_Element elementType) + : m_pDocument(pDocument), + m_objectType(objectType), + m_elementType(elementType) {} CXFA_Object::~CXFA_Object() {} void CXFA_Object::GetClassName(CFX_WideStringC& wsName) const { - wsName = XFA_GetElementByID(GetClassID())->pName; + wsName = XFA_GetElementByID(GetElementType())->pName; } uint32_t CXFA_Object::GetClassHashCode() const { - return XFA_GetElementByID(GetClassID())->uHash; + return XFA_GetElementByID(GetElementType())->uHash; } -XFA_Element CXFA_Object::GetClassID() const { - if (IsNode()) - return AsNode()->GetClassID(); - if (IsOrdinaryObject()) - return AsOrdinaryObject()->GetClassID(); - if (IsNodeList()) - return AsNodeList()->GetClassID(); - if (IsOrdinaryList()) - return XFA_Element::List; - ASSERT(FALSE); - return XFA_Element::Unknown; +XFA_Element CXFA_Object::GetElementType() const { + return m_elementType; } void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, @@ -116,13 +111,12 @@ XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {} CXFA_Node::CXFA_Node(CXFA_Document* pDoc, uint16_t ePacket, XFA_Element eElement) - : CXFA_Object(pDoc, XFA_GetElementObjectType(eElement)), + : CXFA_Object(pDoc, XFA_GetElementObjectType(eElement), eElement), m_pNext(nullptr), m_pChild(nullptr), m_pLastChild(nullptr), m_pParent(nullptr), m_pXMLNode(nullptr), - m_eNodeClass(eElement), m_ePacket(ePacket), m_uNodeFlags(XFA_NodeFlag_None), m_dwNameHash(0), @@ -147,7 +141,7 @@ CXFA_Node::~CXFA_Node() { CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) { CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); - CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_eNodeClass); + CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_elementType); if (!pClone) return nullptr; @@ -254,7 +248,7 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, if (eElementFilter != XFA_Element::Unknown) { CXFA_Node* pChild = m_pChild; while (pChild) { - if (pChild->GetClassID() == eElementFilter) { + if (pChild->GetElementType() == eElementFilter) { nodes.Add(pChild); if (iLevel > 0) { GetNodeList(nodes, dwTypeFilter, eElementFilter, iLevel); @@ -280,7 +274,7 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, CXFA_Node* pChild = m_pChild; while (pChild) { const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( - GetClassID(), pChild->GetClassID(), XFA_XDPPACKET_UNKNOWN); + GetElementType(), pChild->GetElementType(), XFA_XDPPACKET_UNKNOWN); if (pProperty) { if (bFilterProperties) { nodes.Add(pChild); @@ -288,8 +282,8 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) { nodes.Add(pChild); } else if (bFilterChildren && - (pChild->GetClassID() == XFA_Element::Variables || - pChild->GetClassID() == XFA_Element::PageSet)) { + (pChild->GetElementType() == XFA_Element::Variables || + pChild->GetElementType() == XFA_Element::PageSet)) { nodes.Add(pChild); } } else if (bFilterChildren) { @@ -300,7 +294,7 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, if (bFilterOneOfProperties && nodes.GetSize() < 1) { int32_t iProperties = 0; const XFA_PROPERTY* pProperty = - XFA_GetElementProperties(GetClassID(), iProperties); + XFA_GetElementProperties(GetElementType(), iProperties); if (!pProperty || iProperties < 1) return 0; for (int32_t i = 0; i < iProperties; i++) { @@ -333,7 +327,7 @@ CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_Element eElement, CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) { ASSERT(m_ePacket == XFA_XDPPACKET_Template); CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); - CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_eNodeClass); + CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_elementType); if (!pClone) return nullptr; @@ -445,11 +439,11 @@ CXFA_WidgetData* CXFA_Node::GetWidgetData() { CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { if (GetPacketID() != XFA_XDPPACKET_Form) return nullptr; - XFA_Element classID = GetClassID(); + XFA_Element classID = GetElementType(); if (classID == XFA_Element::ExclGroup) return nullptr; CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); - if (pParentNode && pParentNode->GetClassID() == XFA_Element::ExclGroup) + if (pParentNode && pParentNode->GetElementType() == XFA_Element::ExclGroup) return nullptr; if (classID == XFA_Element::Field) { @@ -491,13 +485,14 @@ CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { CXFA_Node* pGrandNode = pParentNode ? pParentNode->GetNodeItem(XFA_NODEITEM_Parent) : nullptr; CXFA_Node* pValueNode = - (pParentNode && pParentNode->GetClassID() == XFA_Element::Value) + (pParentNode && pParentNode->GetElementType() == XFA_Element::Value) ? pParentNode : nullptr; if (!pValueNode) { - pValueNode = (pGrandNode && pGrandNode->GetClassID() == XFA_Element::Value) - ? pGrandNode - : nullptr; + pValueNode = + (pGrandNode && pGrandNode->GetElementType() == XFA_Element::Value) + ? pGrandNode + : nullptr; } CXFA_Node* pParentOfValueNode = pValueNode ? pValueNode->GetNodeItem(XFA_NODEITEM_Parent) : nullptr; @@ -536,7 +531,7 @@ FX_BOOL CXFA_Node::GetLocaleName(CFX_WideString& wsLocaleName) { } XFA_ATTRIBUTEENUM CXFA_Node::GetIntact() { - XFA_Element eElement = GetClassID(); + XFA_Element eElement = GetElementType(); CXFA_Node* pKeep = GetFirstChildByClass(XFA_Element::Keep); XFA_ATTRIBUTEENUM eLayoutType = GetEnum(XFA_ATTRIBUTE_Layout); if (pKeep) { @@ -585,7 +580,8 @@ XFA_ATTRIBUTEENUM CXFA_Node::GetIntact() { break; case XFA_Element::Field: { CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); - if (!pParentNode || pParentNode->GetClassID() == XFA_Element::PageArea) + if (!pParentNode || + pParentNode->GetElementType() == XFA_Element::PageArea) return XFA_ATTRIBUTEENUM_ContentArea; if (pParentNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { XFA_ATTRIBUTEENUM eParLayout = @@ -636,7 +632,7 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { if (!pScriptContext) return; CXFA_Node* refNode = this; - if (refNode->GetClassID() == XFA_Element::Xfa) + if (refNode->GetElementType() == XFA_Element::Xfa) refNode = ToNode(pScriptContext->GetThisObject()); uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | @@ -682,7 +678,7 @@ void CXFA_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) { XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; CXFA_Node* refNode = this; - if (refNode->GetClassID() == XFA_Element::Xfa) + if (refNode->GetElementType() == XFA_Element::Xfa) refNode = ToNode(m_pDocument->GetScriptContext()->GetThisObject()); Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag, refNode); } @@ -1017,7 +1013,7 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { pChild = pItem; } if (GetPacketID() == XFA_XDPPACKET_Form && - GetClassID() == XFA_Element::ExData) { + GetElementType() == XFA_Element::ExData) { CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode(); SetXMLMappingNode(pFakeXMLRoot); SetFlag(XFA_NodeFlag_OwnXMLNode, false); @@ -1176,7 +1172,7 @@ void CXFA_Node::Script_NodeClass_IsNull(CFXJSE_Value* pValue, if (bSetting) { ThrowException(XFA_IDS_INVAlID_PROP_SET); } else { - if (GetClassID() == XFA_Element::Subform) { + if (GetElementType() == XFA_Element::Subform) { pValue->SetBoolean(FALSE); return; } @@ -1290,7 +1286,7 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( } bool bNeedFindContainer = false; - XFA_Element eType = GetClassID(); + XFA_Element eType = GetElementType(); switch (eType) { case XFA_Element::Caption: bNeedFindContainer = true; @@ -1301,7 +1297,7 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( case XFA_Element::Para: { bNeedFindContainer = true; CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); - if (pParentNode->GetClassID() == XFA_Element::Caption) { + if (pParentNode->GetElementType() == XFA_Element::Caption) { pNotify->OnValueChanged(this, eAttribute, pParentNode, pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); } else { @@ -1311,7 +1307,7 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( case XFA_Element::Margin: { bNeedFindContainer = true; CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); - XFA_Element eParentType = pParentNode->GetClassID(); + XFA_Element eParentType = pParentNode->GetElementType(); if (pParentNode->IsContainerNode()) { pNotify->OnValueChanged(this, eAttribute, this, pParentNode); } else if (eParentType == XFA_Element::Caption) { @@ -1319,7 +1315,7 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); } else { CXFA_Node* pNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); - if (pNode && pNode->GetClassID() == XFA_Element::Ui) { + if (pNode && pNode->GetElementType() == XFA_Element::Ui) { pNotify->OnValueChanged(this, eAttribute, pNode, pNode->GetNodeItem(XFA_NODEITEM_Parent)); } @@ -1327,7 +1323,7 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( } break; case XFA_Element::Comb: { CXFA_Node* pEditNode = GetNodeItem(XFA_NODEITEM_Parent); - XFA_Element eUIType = pEditNode->GetClassID(); + XFA_Element eUIType = pEditNode->GetElementType(); if (pEditNode && (eUIType == XFA_Element::DateTimeEdit || eUIType == XFA_Element::NumericEdit || eUIType == XFA_Element::TextEdit)) { @@ -1387,7 +1383,7 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( if (!pValueNode) { return; } - XFA_Element eNodeType = pValueNode->GetClassID(); + XFA_Element eNodeType = pValueNode->GetElementType(); if (eNodeType == XFA_Element::Value) { bNeedFindContainer = true; CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); @@ -1432,7 +1428,8 @@ void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, if (bSetting) { CFX_WideString wsValue = pValue->ToWideString(); SetAttribute(eAttribute, wsValue.AsStringC(), true); - if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_Element::Desc) { + if (eAttribute == XFA_ATTRIBUTE_Use && + GetElementType() == XFA_Element::Desc) { CXFA_Node* pTemplateNode = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); CXFA_Node* pProtoRoot = @@ -1601,7 +1598,7 @@ void CXFA_Node::Script_Field_Length(CFXJSE_Value* pValue, void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - XFA_Element classID = GetClassID(); + XFA_Element classID = GetElementType(); if (classID == XFA_Element::Field) { Script_Field_DefaultValue(pValue, bSetting, eAttribute); return; @@ -1930,7 +1927,7 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, wsNewText = pValue->ToWideString(); CXFA_Node* pUIChild = pWidgetData->GetUIChild(); - if (pUIChild->GetClassID() == XFA_Element::NumericEdit) { + if (pUIChild->GetElementType() == XFA_Element::NumericEdit) { int32_t iLeadDigits = 0; int32_t iFracDigits = 0; pWidgetData->GetLeadDigits(iLeadDigits); @@ -1950,10 +1947,10 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, pValue->SetNull(); } else { CXFA_Node* pUIChild = pWidgetData->GetUIChild(); - XFA_Element eUI = pUIChild->GetClassID(); + XFA_Element eUI = pUIChild->GetElementType(); CXFA_Value defVal = pWidgetData->GetFormValue(); CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); - if (pNode && pNode->GetClassID() == XFA_Element::Decimal) { + if (pNode && pNode->GetElementType() == XFA_Element::Decimal) { if (eUI == XFA_Element::NumericEdit && (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { pValue->SetString( @@ -1962,11 +1959,11 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, CFX_Decimal decimal(content.AsStringC()); pValue->SetFloat((FX_FLOAT)(double)decimal); } - } else if (pNode && pNode->GetClassID() == XFA_Element::Integer) { + } else if (pNode && pNode->GetElementType() == XFA_Element::Integer) { pValue->SetInteger(FXSYS_wtoi(content.c_str())); - } else if (pNode && pNode->GetClassID() == XFA_Element::Boolean) { + } else if (pNode && pNode->GetElementType() == XFA_Element::Boolean) { pValue->SetBoolean(FXSYS_wtoi(content.c_str()) == 0 ? FALSE : TRUE); - } else if (pNode && pNode->GetClassID() == XFA_Element::Float) { + } else if (pNode && pNode->GetElementType() == XFA_Element::Float) { CFX_Decimal decimal(content.AsStringC()); pValue->SetFloat((FX_FLOAT)(double)decimal); } else { @@ -2416,7 +2413,7 @@ static CXFA_Node* XFA_ScriptInstanceManager_GetItem(CXFA_Node* pInstMgrNode, uint32_t dwNameHash = 0; for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - XFA_Element eCurType = pNode->GetClassID(); + XFA_Element eCurType = pNode->GetElementType(); if (eCurType == XFA_Element::InstanceManager) { break; } @@ -2452,7 +2449,7 @@ void CXFA_Node::Script_Som_InstanceIndex(CFXJSE_Value* pValue, CXFA_Node* pManagerNode = nullptr; for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { - if (pNode->GetClassID() == XFA_Element::InstanceManager) { + if (pNode->GetElementType() == XFA_Element::InstanceManager) { pManagerNode = pNode; break; } @@ -2465,13 +2462,14 @@ void CXFA_Node::Script_Som_InstanceIndex(CFXJSE_Value* pValue, } CXFA_Node* pToInstance = XFA_ScriptInstanceManager_GetItem(pManagerNode, iTo); - if (pToInstance && pToInstance->GetClassID() == XFA_Element::Subform) { + if (pToInstance && + pToInstance->GetElementType() == XFA_Element::Subform) { pNotify->RunSubformIndexChange(pToInstance); } CXFA_Node* pFromInstance = XFA_ScriptInstanceManager_GetItem(pManagerNode, iFrom); if (pFromInstance && - pFromInstance->GetClassID() == XFA_Element::Subform) { + pFromInstance->GetElementType() == XFA_Element::Subform) { pNotify->RunSubformIndexChange(pFromInstance); } } @@ -2487,7 +2485,7 @@ void CXFA_Node::Script_Subform_InstanceManager(CFXJSE_Value* pValue, CXFA_Node* pInstanceMgr = nullptr; for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { - if (pNode->GetClassID() == XFA_Element::InstanceManager) { + if (pNode->GetElementType() == XFA_Element::InstanceManager) { CFX_WideStringC wsInstMgrName = pNode->GetCData(XFA_ATTRIBUTE_Name); if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName.GetAt(0) == '_' && wsInstMgrName.Mid(1) == wsName) { @@ -2580,8 +2578,8 @@ int32_t CXFA_Node::Subform_and_SubformSet_InstanceIndex() { int32_t index = 0; for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { - if ((pNode->GetClassID() == XFA_Element::Subform) || - (pNode->GetClassID() == XFA_Element::SubformSet)) { + if ((pNode->GetElementType() == XFA_Element::Subform) || + (pNode->GetElementType() == XFA_Element::SubformSet)) { index++; } else { break; @@ -2734,7 +2732,7 @@ static int32_t XFA_ScriptInstanceManager_GetCount(CXFA_Node* pInstMgrNode) { uint32_t dwNameHash = 0; for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - XFA_Element eCurType = pNode->GetClassID(); + XFA_Element eCurType = pNode->GetElementType(); if (eCurType == XFA_Element::InstanceManager) { break; } @@ -3025,11 +3023,12 @@ void CXFA_Node::Script_InstanceManager_MoveInstance( return; } CXFA_Node* pToInstance = XFA_ScriptInstanceManager_GetItem(this, iTo); - if (pToInstance && pToInstance->GetClassID() == XFA_Element::Subform) { + if (pToInstance && pToInstance->GetElementType() == XFA_Element::Subform) { pNotify->RunSubformIndexChange(pToInstance); } CXFA_Node* pFromInstance = XFA_ScriptInstanceManager_GetItem(this, iFrom); - if (pFromInstance && pFromInstance->GetClassID() == XFA_Element::Subform) { + if (pFromInstance && + pFromInstance->GetElementType() == XFA_Element::Subform) { pNotify->RunSubformIndexChange(pFromInstance); } } @@ -3059,7 +3058,7 @@ void CXFA_Node::Script_InstanceManager_RemoveInstance( for (int32_t i = iIndex; i < iCount - 1; i++) { CXFA_Node* pSubformInstance = XFA_ScriptInstanceManager_GetItem(this, i); if (pSubformInstance && - pSubformInstance->GetClassID() == XFA_Element::Subform) { + pSubformInstance->GetElementType() == XFA_Element::Subform) { pNotify->RunSubformIndexChange(pSubformInstance); } } @@ -3187,11 +3186,11 @@ int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { while (iCount > iDesired) { CXFA_Node* pRemoveInstance = pPrevSibling->GetNodeItem(XFA_NODEITEM_NextSibling); - if (pRemoveInstance->GetClassID() != XFA_Element::Subform && - pRemoveInstance->GetClassID() != XFA_Element::SubformSet) { + if (pRemoveInstance->GetElementType() != XFA_Element::Subform && + pRemoveInstance->GetElementType() != XFA_Element::SubformSet) { continue; } - if (pRemoveInstance->GetClassID() == XFA_Element::InstanceManager) { + if (pRemoveInstance->GetElementType() == XFA_Element::InstanceManager) { ASSERT(FALSE); break; } @@ -3607,7 +3606,7 @@ void* XFA_GetMapKey_Element(XFA_Element eElement, XFA_ATTRIBUTE eAttribute) { (eAttribute << 8) | XFA_KEYTYPE_Element); } FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) { - void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); + void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); return HasMapModuleKey(pKey, bCanInherit); } FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, @@ -3620,7 +3619,7 @@ FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, XFA_ATTRIBUTETYPE eType = pAttr->eType; if (eType == XFA_ATTRIBUTETYPE_NOTSURE) { const XFA_NOTSUREATTRIBUTE* pNotsure = - XFA_GetNotsureAttribute(GetClassID(), pAttr->eName); + XFA_GetNotsureAttribute(GetElementType(), pAttr->eName); eType = pNotsure ? pNotsure->eType : XFA_ATTRIBUTETYPE_Cdata; } switch (eType) { @@ -3657,7 +3656,7 @@ FX_BOOL CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr, XFA_ATTRIBUTETYPE eType = pAttr->eType; if (eType == XFA_ATTRIBUTETYPE_NOTSURE) { const XFA_NOTSUREATTRIBUTE* pNotsure = - XFA_GetNotsureAttribute(GetClassID(), pAttr->eName); + XFA_GetNotsureAttribute(GetElementType(), pAttr->eName); eType = pNotsure ? pNotsure->eType : XFA_ATTRIBUTETYPE_Cdata; } switch (eType) { @@ -3767,7 +3766,7 @@ FX_BOOL CXFA_Node::TryEnum(XFA_ATTRIBUTE eAttr, FX_BOOL CXFA_Node::SetMeasure(XFA_ATTRIBUTE eAttr, CXFA_Measurement mValue, bool bNotify) { - void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); + void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); OnChanging(eAttr, bNotify); SetMapModuleBuffer(pKey, &mValue, sizeof(CXFA_Measurement)); OnChanged(eAttr, bNotify, FALSE); @@ -3777,7 +3776,7 @@ FX_BOOL CXFA_Node::SetMeasure(XFA_ATTRIBUTE eAttr, FX_BOOL CXFA_Node::TryMeasure(XFA_ATTRIBUTE eAttr, CXFA_Measurement& mValue, FX_BOOL bUseDefault) const { - void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); + void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); void* pValue; int32_t iBytes; if (GetMapModuleBuffer(pKey, pValue, iBytes) && iBytes == sizeof(mValue)) { @@ -3785,7 +3784,7 @@ FX_BOOL CXFA_Node::TryMeasure(XFA_ATTRIBUTE eAttr, return TRUE; } if (bUseDefault && - XFA_GetAttributeDefaultValue(pValue, GetClassID(), eAttr, + XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr, XFA_ATTRIBUTETYPE_Measure, m_ePacket)) { FXSYS_memcpy(&mValue, pValue, sizeof(mValue)); return TRUE; @@ -3802,7 +3801,7 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, const CFX_WideString& wsValue, bool bNotify, FX_BOOL bScriptModify) { - void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); + void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); OnChanging(eAttr, bNotify); if (eAttr == XFA_ATTRIBUTE_Value) { CFX_WideString* pClone = new CFX_WideString(wsValue); @@ -3819,8 +3818,9 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, return TRUE; } - if (eAttr == XFA_ATTRIBUTE_Name && (m_eNodeClass == XFA_Element::DataValue || - m_eNodeClass == XFA_Element::DataGroup)) { + if (eAttr == XFA_ATTRIBUTE_Name && + (m_elementType == XFA_Element::DataValue || + m_elementType == XFA_Element::DataGroup)) { return TRUE; } @@ -3877,7 +3877,7 @@ FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, const CFX_WideString& wsXMLValue, bool bNotify, FX_BOOL bScriptModify) { - void* pKey = XFA_GetMapKey_Element(GetClassID(), XFA_ATTRIBUTE_Value); + void* pKey = XFA_GetMapKey_Element(GetElementType(), XFA_ATTRIBUTE_Value); OnChanging(XFA_ATTRIBUTE_Value, bNotify); CFX_WideString* pClone = new CFX_WideString(wsValue); SetUserData(pKey, pClone, &deleteWideStringCallBack); @@ -3923,7 +3923,7 @@ FX_BOOL CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, CFX_WideString& wsValue, FX_BOOL bUseDefault, FX_BOOL bProto) { - void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); + void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); if (eAttr == XFA_ATTRIBUTE_Value) { CFX_WideString* pStr = (CFX_WideString*)GetUserData(pKey, bProto); if (pStr) { @@ -3941,7 +3941,7 @@ FX_BOOL CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, return FALSE; } void* pValue = nullptr; - if (XFA_GetAttributeDefaultValue(pValue, GetClassID(), eAttr, + if (XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr, XFA_ATTRIBUTETYPE_Cdata, m_ePacket)) { wsValue = (const FX_WCHAR*)pValue; return TRUE; @@ -3952,7 +3952,7 @@ FX_BOOL CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, CFX_WideStringC& wsValue, FX_BOOL bUseDefault, FX_BOOL bProto) { - void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); + void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); if (eAttr == XFA_ATTRIBUTE_Value) { CFX_WideString* pStr = (CFX_WideString*)GetUserData(pKey, bProto); if (pStr) { @@ -3968,7 +3968,7 @@ FX_BOOL CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, return FALSE; } void* pValue = nullptr; - if (XFA_GetAttributeDefaultValue(pValue, GetClassID(), eAttr, + if (XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr, XFA_ATTRIBUTETYPE_Cdata, m_ePacket)) { wsValue = (CFX_WideStringC)(const FX_WCHAR*)pValue; return TRUE; @@ -3978,11 +3978,11 @@ FX_BOOL CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, FX_BOOL CXFA_Node::SetObject(XFA_ATTRIBUTE eAttr, void* pData, XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo) { - void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); + void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); return SetUserData(pKey, pData, pCallbackInfo); } FX_BOOL CXFA_Node::TryObject(XFA_ATTRIBUTE eAttr, void*& pData) { - void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); + void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); pData = GetUserData(pKey); return pData != nullptr; } @@ -3990,7 +3990,7 @@ FX_BOOL CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr, XFA_ATTRIBUTETYPE eType, void* pValue, bool bNotify) { - void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); + void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); OnChanging(eAttr, bNotify); SetMapModuleValue(pKey, pValue); OnChanged(eAttr, bNotify, FALSE); @@ -4025,14 +4025,14 @@ FX_BOOL CXFA_Node::GetValue(XFA_ATTRIBUTE eAttr, XFA_ATTRIBUTETYPE eType, FX_BOOL bUseDefault, void*& pValue) { - void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); + void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); if (GetMapModuleValue(pKey, pValue)) { return TRUE; } if (!bUseDefault) { return FALSE; } - return XFA_GetAttributeDefaultValue(pValue, GetClassID(), eAttr, eType, + return XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr, eType, m_ePacket); } static void XFA_DefaultFreeData(void* pData) {} @@ -4136,7 +4136,7 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, } } break; - } else if (GetClassID() == XFA_Element::ExclGroup) { + } else if (GetElementType() == XFA_Element::ExclGroup) { pNode = this; } else { CXFA_Node* pValue = GetProperty(0, XFA_Element::Value); @@ -4163,7 +4163,7 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, } case XFA_ObjectType::ContentNode: { CFX_WideString wsContentType; - if (GetClassID() == XFA_Element::ExData) { + if (GetElementType() == XFA_Element::ExData) { GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); if (wsContentType == FX_WSTRC(L"text/html")) { wsContentType = FX_WSTRC(L""); @@ -4191,7 +4191,7 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, if (pParent) { pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); } - if (pParent && pParent->GetClassID() == XFA_Element::Value) { + if (pParent && pParent->GetElementType() == XFA_Element::Value) { pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); if (pParent && pParent->IsContainerNode()) { pBindNode = pParent->GetBindData(); @@ -4204,7 +4204,7 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, } break; default: - if (GetClassID() == XFA_Element::DataValue) { + if (GetElementType() == XFA_Element::DataValue) { pNode = this; pBindNode = this; } @@ -4245,7 +4245,7 @@ FX_BOOL CXFA_Node::TryContent(CFX_WideString& wsContent, CXFA_Node* pNode = nullptr; switch (GetObjectType()) { case XFA_ObjectType::ContainerNode: - if (GetClassID() == XFA_Element::ExclGroup) { + if (GetElementType() == XFA_Element::ExclGroup) { pNode = this; } else { CXFA_Node* pValue = GetChild(0, XFA_Element::Value); @@ -4266,7 +4266,7 @@ FX_BOOL CXFA_Node::TryContent(CFX_WideString& wsContent, CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); if (!pContentRawDataNode) { XFA_Element element = XFA_Element::Sharptext; - if (GetClassID() == XFA_Element::ExData) { + if (GetElementType() == XFA_Element::ExData) { CFX_WideString wsContentType; GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); if (wsContentType == FX_WSTRC(L"text/html")) { @@ -4285,7 +4285,7 @@ FX_BOOL CXFA_Node::TryContent(CFX_WideString& wsContent, case XFA_ObjectType::TextNode: pNode = this; default: - if (GetClassID() == XFA_Element::DataValue) { + if (GetElementType() == XFA_Element::DataValue) { pNode = this; } break; @@ -4327,7 +4327,7 @@ CXFA_Node* CXFA_Node::GetModelNode() { } FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { wsNamespace.clear(); - if (IsModelNode() || GetClassID() == XFA_Element::Packet) { + if (IsModelNode() || GetElementType() == XFA_Element::Packet) { CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) { return FALSE; @@ -4342,7 +4342,7 @@ FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { if (pXMLNode->GetType() != FDE_XMLNODE_Element) { return TRUE; } - if (GetClassID() == XFA_Element::DataValue && + if (GetElementType() == XFA_Element::DataValue && GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) { return XFA_FDEExtension_ResolveNamespaceQualifier( static_cast(pXMLNode), @@ -4358,7 +4358,7 @@ FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { CXFA_Node* CXFA_Node::GetProperty(int32_t index, XFA_Element eProperty, FX_BOOL bCreateProperty) { - XFA_Element eElement = GetClassID(); + XFA_Element eElement = GetElementType(); uint32_t dwPacket = GetPacketID(); const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement(eElement, eProperty, dwPacket); @@ -4368,7 +4368,7 @@ CXFA_Node* CXFA_Node::GetProperty(int32_t index, CXFA_Node* pNode = m_pChild; int32_t iCount = 0; for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pNode->GetClassID() == eProperty) { + if (pNode->GetElementType() == eProperty) { iCount++; if (iCount > index) { return pNode; @@ -4382,7 +4382,7 @@ CXFA_Node* CXFA_Node::GetProperty(int32_t index, pNode = m_pChild; for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { const XFA_PROPERTY* pExistProperty = - XFA_GetPropertyOfElement(eElement, pNode->GetClassID(), dwPacket); + XFA_GetPropertyOfElement(eElement, pNode->GetElementType(), dwPacket); if (pExistProperty && (pExistProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) return nullptr; } @@ -4403,10 +4403,11 @@ int32_t CXFA_Node::CountChildren(XFA_Element eElement, FX_BOOL bOnlyChild) { CXFA_Node* pNode = m_pChild; int32_t iCount = 0; for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pNode->GetClassID() == eElement || eElement == XFA_Element::Unknown) { + if (pNode->GetElementType() == eElement || + eElement == XFA_Element::Unknown) { if (bOnlyChild) { const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( - GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN); + GetElementType(), pNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); if (pProperty) { continue; } @@ -4423,10 +4424,11 @@ CXFA_Node* CXFA_Node::GetChild(int32_t index, CXFA_Node* pNode = m_pChild; int32_t iCount = 0; for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pNode->GetClassID() == eElement || eElement == XFA_Element::Unknown) { + if (pNode->GetElementType() == eElement || + eElement == XFA_Element::Unknown) { if (bOnlyChild) { const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( - GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN); + GetElementType(), pNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); if (pProperty) { continue; } @@ -4611,7 +4613,7 @@ CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const { CXFA_Node* CXFA_Node::GetFirstChildByClass(XFA_Element eElement) const { for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pNode->GetClassID() == eElement) { + if (pNode->GetElementType() == eElement) { return pNode; } } @@ -4633,7 +4635,7 @@ CXFA_Node* CXFA_Node::GetNextSameNameSibling( CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_Element eElement) const { for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pNode->GetClassID() == eElement) { + if (pNode->GetElementType() == eElement) { return pNode; } } @@ -4664,12 +4666,12 @@ CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() { CXFA_Node* pInstanceMgr = nullptr; if (m_ePacket == XFA_XDPPACKET_Form) { CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); - if (!pParentNode || pParentNode->GetClassID() == XFA_Element::Area) { + if (!pParentNode || pParentNode->GetElementType() == XFA_Element::Area) { return pInstanceMgr; } for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { - XFA_Element eType = pNode->GetClassID(); + XFA_Element eType = pNode->GetElementType(); if ((eType == XFA_Element::Subform || eType == XFA_Element::SubformSet) && pNode->m_dwNameHash != m_dwNameHash) { break; @@ -4768,7 +4770,7 @@ int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, eElementType == XFA_Element::Field) { CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); if (pParentNode && - pParentNode->GetClassID() == XFA_Element::ExclGroup) { + pParentNode->GetElementType() == XFA_Element::ExclGroup) { iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, FALSE, FALSE); } @@ -4784,7 +4786,7 @@ int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, CXFA_WidgetData* pWidgetData = GetWidgetData(); if (pWidgetData) { CXFA_Node* pUINode = pWidgetData->GetUIChild(); - if (pUINode->m_eNodeClass == XFA_Element::Signature) { + if (pUINode->m_elementType == XFA_Element::Signature) { iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, FALSE, FALSE); } @@ -4793,7 +4795,7 @@ int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, CXFA_WidgetData* pWidgetData = GetWidgetData(); if (pWidgetData) { CXFA_Node* pUINode = pWidgetData->GetUIChild(); - if ((pUINode->m_eNodeClass == XFA_Element::ChoiceList) && + if ((pUINode->m_elementType == XFA_Element::ChoiceList) && (!pWidgetData->IsListBox())) { iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, FALSE, FALSE); @@ -4805,7 +4807,7 @@ int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, } void CXFA_Node::UpdateNameHash() { const XFA_NOTSUREATTRIBUTE* pNotsure = - XFA_GetNotsureAttribute(GetClassID(), XFA_ATTRIBUTE_Name); + XFA_GetNotsureAttribute(GetElementType(), XFA_ATTRIBUTE_Name); CFX_WideStringC wsName; if (!pNotsure || pNotsure->eType == XFA_ATTRIBUTETYPE_Cdata) { wsName = GetCData(XFA_ATTRIBUTE_Name); @@ -4825,7 +4827,7 @@ CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { } FX_BOOL CXFA_Node::IsNeedSavingXMLNode() { return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets || - GetClassID() == XFA_Element::Xfa); + GetElementType() == XFA_Element::Xfa); } XFA_MAPMODULEDATA* CXFA_Node::CreateMapModuleData() { @@ -5030,7 +5032,7 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) { if (!pKey) { bNeedMove = FALSE; } - if (pDstModule->GetClassID() != GetClassID()) { + if (pDstModule->GetElementType() != GetElementType()) { bNeedMove = FALSE; } XFA_MAPMODULEDATA* pSrcModuleData = nullptr; @@ -5082,18 +5084,14 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule, CXFA_OrdinaryObject::CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_Element eElement) - : CXFA_Object(pDocument, XFA_ObjectType::OrdinaryObject) { - m_eNodeClass = eElement; -} + : CXFA_Object(pDocument, XFA_ObjectType::OrdinaryObject, eElement) {} CXFA_OrdinaryObject::~CXFA_OrdinaryObject() {} -XFA_Element CXFA_OrdinaryObject::GetClassID() const { - return m_eNodeClass; -} - CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) - : CXFA_Object(pThisNode->GetDocument(), XFA_ObjectType::VariablesThis), + : CXFA_Object(pThisNode->GetDocument(), + XFA_ObjectType::VariablesThis, + XFA_Element::Unknown), m_pThisNode(NULL), m_pScriptNode(NULL) { m_pThisNode = pThisNode; @@ -5111,14 +5109,13 @@ CXFA_Node* CXFA_ThisProxy::GetScriptNode() const { } CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) - : CXFA_Object(pDocument, XFA_ObjectType::NodeList) { + : CXFA_Object(pDocument, XFA_ObjectType::NodeList, XFA_Element::NodeList) { m_pDocument->GetScriptContext()->AddToCacheList( std::unique_ptr(this)); } + CXFA_NodeList::~CXFA_NodeList() {} -XFA_Element CXFA_NodeList::GetClassID() const { - return XFA_Element::NodeList; -} + CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); int32_t iCount = GetLength(); @@ -5265,7 +5262,7 @@ CXFA_AttachNodeList::CXFA_AttachNodeList(CXFA_Document* pDocument, int32_t CXFA_AttachNodeList::GetLength() { return m_pAttachNode->CountChildren( XFA_Element::Unknown, - m_pAttachNode->GetClassID() == XFA_Element::Subform); + m_pAttachNode->GetElementType() == XFA_Element::Subform); } FX_BOOL CXFA_AttachNodeList::Append(CXFA_Node* pNode) { CXFA_Node* pParent = pNode->GetNodeItem(XFA_NODEITEM_Parent); @@ -5288,5 +5285,5 @@ FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { return m_pAttachNode->GetChild( iIndex, XFA_Element::Unknown, - m_pAttachNode->GetClassID() == XFA_Element::Subform); + m_pAttachNode->GetElementType() == XFA_Element::Subform); } diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index daf5b473e2..38fdbbb662 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -152,7 +152,7 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) { XFA_XDPPACKET ePacketID = (XFA_XDPPACKET)pXFANode->GetPacketID(); if (ePacketID == XFA_XDPPACKET_Datasets) { - if (pXFANode->GetClassID() == XFA_Element::DataValue) { + if (pXFANode->GetElementType() == XFA_Element::DataValue) { for (CFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); pXMLChild; @@ -839,7 +839,7 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, continue; } const XFA_PROPERTY* pPropertyInfo = XFA_GetPropertyOfElement( - pXFANode->GetClassID(), pElemInfo->eName, ePacketID); + pXFANode->GetElementType(), pElemInfo->eName, ePacketID); if (pPropertyInfo && ((pPropertyInfo->uFlags & (XFA_PROPERTYFLAG_OneOf | XFA_PROPERTYFLAG_DefaultOneOf)) != 0)) { @@ -980,7 +980,7 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode, XFA_XDPPACKET ePacketID) { XFA_Element element = XFA_Element::Sharptext; - if (pXFANode->GetClassID() == XFA_Element::ExData) { + if (pXFANode->GetElementType() == XFA_Element::ExData) { CFX_WideStringC wsContentType = pXFANode->GetCData(XFA_ATTRIBUTE_ContentType); if (wsContentType == FX_WSTRC(L"text/html")) diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index eeb9ba93c1..b2f9b25ec2 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -308,7 +308,7 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOriginalObject); CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName( - pObject->GetClassID(), wsPropName.AsStringC()); + pObject->GetElementType(), wsPropName.AsStringC()); if (lpAttributeInfo) { (pObject->*(lpAttributeInfo->lpfnCallback))( pReturnValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); @@ -329,7 +329,7 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, if (pPropOrChild) { CFX_WideString wsDefaultName(L"{default}"); const XFA_SCRIPTATTRIBUTEINFO* lpAttrInfo = - XFA_GetScriptAttributeByName(pPropOrChild->GetClassID(), + XFA_GetScriptAttributeByName(pPropOrChild->GetElementType(), wsDefaultName.AsStringC()); if (lpAttrInfo) { (pPropOrChild->*(lpAttrInfo->lpfnCallback))( @@ -357,7 +357,7 @@ int32_t CXFA_ScriptContext::NormalPropTypeGetter( CXFA_ScriptContext* lpScriptContext = pObject->GetDocument()->GetScriptContext(); pObject = lpScriptContext->GetVariablesThis(pObject); - XFA_Element objElement = pObject->GetClassID(); + XFA_Element objElement = pObject->GetElementType(); CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); if (XFA_GetMethodByName(objElement, wsPropName.AsStringC())) { return FXJSE_ClassPropType_Method; @@ -379,7 +379,7 @@ int32_t CXFA_ScriptContext::GlobalPropTypeGetter( CXFA_ScriptContext* lpScriptContext = pObject->GetDocument()->GetScriptContext(); pObject = lpScriptContext->GetVariablesThis(pObject); - XFA_Element objElement = pObject->GetClassID(); + XFA_Element objElement = pObject->GetElementType(); CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); if (XFA_GetMethodByName(objElement, wsPropName.AsStringC())) { return FXJSE_ClassPropType_Method; @@ -398,7 +398,7 @@ void CXFA_ScriptContext::NormalMethodCall(CFXJSE_Value* pThis, pObject = lpScriptContext->GetVariablesThis(pObject); CFX_WideString wsFunName = CFX_WideString::FromUTF8(szFuncName); const XFA_METHODINFO* lpMethodInfo = - XFA_GetMethodByName(pObject->GetClassID(), wsFunName.AsStringC()); + XFA_GetMethodByName(pObject->GetElementType(), wsFunName.AsStringC()); if (!lpMethodInfo) return; @@ -443,11 +443,11 @@ FX_BOOL CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) { if (!pScriptNode) return FALSE; - if (pScriptNode->GetClassID() != XFA_Element::Script) + if (pScriptNode->GetElementType() != XFA_Element::Script) return TRUE; CXFA_Node* pParent = pScriptNode->GetNodeItem(XFA_NODEITEM_Parent); - if (!pParent || pParent->GetClassID() != XFA_Element::Variables) + if (!pParent || pParent->GetElementType() != XFA_Element::Variables) return FALSE; if (m_mapVariableToContext.GetValueAt(pScriptNode)) @@ -480,11 +480,12 @@ FX_BOOL CXFA_ScriptContext::QueryVariableValue( const CFX_ByteStringC& szPropName, CFXJSE_Value* pValue, FX_BOOL bGetter) { - if (!pScriptNode || pScriptNode->GetClassID() != XFA_Element::Script) + if (!pScriptNode || pScriptNode->GetElementType() != XFA_Element::Script) return FALSE; CXFA_Node* variablesNode = pScriptNode->GetNodeItem(XFA_NODEITEM_Parent); - if (!variablesNode || variablesNode->GetClassID() != XFA_Element::Variables) + if (!variablesNode || + variablesNode->GetElementType() != XFA_Element::Variables) return FALSE; void* lpVariables = m_mapVariableToContext.GetValueAt(pScriptNode); diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp index 39ca8028df..128f5e1d47 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp @@ -223,7 +223,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( if (wsType == FX_WSTRC(L"contentArea")) { for (CXFA_LayoutItem* pItem = pLayoutPage->m_pFirstChild; pItem; pItem = pItem->m_pNextSibling) { - if (pItem->m_pFormNode->GetClassID() == XFA_Element::ContentArea) { + if (pItem->m_pFormNode->GetElementType() == XFA_Element::ContentArea) { retArray.Add(pItem->m_pFormNode); } } @@ -236,7 +236,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( } for (CXFA_LayoutItem* pItem = pLayoutPage->m_pFirstChild; pItem; pItem = pItem->m_pNextSibling) { - if (pItem->m_pFormNode->GetClassID() == XFA_Element::ContentArea) { + if (pItem->m_pFormNode->GetElementType() == XFA_Element::ContentArea) { retArray.Add(pItem->m_pFormNode); if (!bOnPageArea) { CXFA_NodeIteratorTemplateIsContentLayoutItem()) { continue; } - XFA_Element eElementType = pItemChild->m_pFormNode->GetClassID(); + XFA_Element eElementType = + pItemChild->m_pFormNode->GetElementType(); if (eElementType != XFA_Element::Field && eElementType != XFA_Element::Draw && eElementType != XFA_Element::Subform && @@ -271,7 +272,8 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( if (!pItemChild->IsContentLayoutItem()) { continue; } - XFA_Element eElementType = pItemChild->m_pFormNode->GetClassID(); + XFA_Element eElementType = + pItemChild->m_pFormNode->GetElementType(); if (eElementType != XFA_Element::Field && eElementType != XFA_Element::Draw && eElementType != XFA_Element::Subform && @@ -301,7 +303,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( if (eType != XFA_Element::Unknown) { for (CXFA_LayoutItem* pItem = pLayoutPage->m_pFirstChild; pItem; pItem = pItem->m_pNextSibling) { - if (pItem->m_pFormNode->GetClassID() == XFA_Element::ContentArea) { + if (pItem->m_pFormNode->GetElementType() == XFA_Element::ContentArea) { if (!bOnPageArea) { CXFA_NodeIteratorTemplate @@ -310,7 +312,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( pItemChild; pItemChild = iterator.MoveToNext()) { if (!pItemChild->IsContentLayoutItem()) continue; - if (pItemChild->m_pFormNode->GetClassID() != eType) + if (pItemChild->m_pFormNode->GetElementType() != eType) continue; if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) continue; @@ -327,7 +329,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( pItemChild; pItemChild = iterator.MoveToNext()) { if (!pItemChild->IsContentLayoutItem()) continue; - if (pItemChild->m_pFormNode->GetClassID() != eType) + if (pItemChild->m_pFormNode->GetElementType() != eType) continue; if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) continue; diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp index 1bf8a12ff1..5c3944371d 100644 --- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp +++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp @@ -53,7 +53,7 @@ int32_t CXFA_NodeHelper::XFA_CountSiblings(CXFA_Node* pNode, if (!parent) return 0; const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( - parent->GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN); + parent->GetElementType(), pNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); if (!pProperty && eLogicType == XFA_LOGIC_Transparent) { parent = XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent); if (parent == NULL) { @@ -154,15 +154,16 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent, } } else { if (child->GetNameHash() == dNameHash) { - if (child->GetClassID() != XFA_Element::PageSet && - child->GetClassID() != XFA_Element::Extras && - child->GetClassID() != XFA_Element::Items) { + if (child->GetElementType() != XFA_Element::PageSet && + child->GetElementType() != XFA_Element::Extras && + child->GetElementType() != XFA_Element::Items) { pSiblings->Add(child); nCount++; } } } - if (child->IsUnnamed() && child->GetClassID() == XFA_Element::PageSet) { + if (child->IsUnnamed() && + child->GetElementType() == XFA_Element::PageSet) { nCount += XFA_NodeAcc_TraverseSiblings(child, dNameHash, pSiblings, eLogicType, bIsClassName, FALSE); } @@ -176,7 +177,7 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent, int32_t nChildren = children.GetSize(); for (i = 0; i < nChildren; i++) { CXFA_Node* child = children[i]; - if (child->GetClassID() == XFA_Element::Variables) { + if (child->GetElementType() == XFA_Element::Variables) { continue; } if (bIsClassName) { @@ -198,7 +199,7 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent, continue; } if (XFA_NodeIsTransparent(child) && - child->GetClassID() != XFA_Element::PageSet) { + child->GetElementType() != XFA_Element::PageSet) { nCount += XFA_NodeAcc_TraverseSiblings(child, dNameHash, pSiblings, eLogicType, bIsClassName, FALSE); } @@ -222,7 +223,7 @@ CXFA_Node* CXFA_NodeHelper::XFA_ResolveNodes_GetParent( if (parent == NULL) { break; } - XFA_Element parentElement = parent->GetClassID(); + XFA_Element parentElement = parent->GetElementType(); if ((!parent->IsUnnamed() && parentElement != XFA_Element::SubformSet) || parentElement == XFA_Element::Variables) { break; @@ -287,7 +288,7 @@ void CXFA_NodeHelper::XFA_GetNameExpression(CXFA_Node* refNode, CFX_WideString ws; FX_BOOL bIsProperty = XFA_NodeIsProperty(refNode); if (refNode->IsUnnamed() || - (bIsProperty && refNode->GetClassID() != XFA_Element::PageSet)) { + (bIsProperty && refNode->GetElementType() != XFA_Element::PageSet)) { refNode->GetClassName(wsTagName); ws = wsTagName; wsName.Format(L"#%s[%d]", ws.c_str(), @@ -304,7 +305,7 @@ FX_BOOL CXFA_NodeHelper::XFA_NodeIsTransparent(CXFA_Node* refNode) { if (refNode == NULL) { return FALSE; } - XFA_Element eRefNode = refNode->GetClassID(); + XFA_Element eRefNode = refNode->GetElementType(); if ((refNode->IsUnnamed() && refNode->IsContainerNode()) || eRefNode == XFA_Element::SubformSet || eRefNode == XFA_Element::Area || eRefNode == XFA_Element::Proto) { @@ -418,13 +419,13 @@ void CXFA_NodeHelper::XFA_SetCreateNodeType(CXFA_Node* refNode) { if (refNode == NULL) { return; } - if (refNode->GetClassID() == XFA_Element::Subform) { + if (refNode->GetElementType() == XFA_Element::Subform) { m_eLastCreateType = XFA_Element::DataGroup; - } else if (refNode->GetClassID() == XFA_Element::Field) { + } else if (refNode->GetElementType() == XFA_Element::Field) { m_eLastCreateType = XFA_FieldIsMultiListBox(refNode) ? XFA_Element::DataGroup : XFA_Element::DataValue; - } else if (refNode->GetClassID() == XFA_Element::ExclGroup) { + } else if (refNode->GetElementType() == XFA_Element::ExclGroup) { m_eLastCreateType = XFA_Element::DataValue; } } @@ -433,6 +434,7 @@ FX_BOOL CXFA_NodeHelper::XFA_NodeIsProperty(CXFA_Node* refNode) { CXFA_Node* parent = XFA_ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); return parent && refNode && - XFA_GetPropertyOfElement(parent->GetClassID(), refNode->GetClassID(), + XFA_GetPropertyOfElement(parent->GetElementType(), + refNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); } diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index 1f24176a84..a78ad7bb6b 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -57,7 +57,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes(CXFA_ResolveNodesData& rnd) { if (rnd.m_uHashName == XFA_HASHCODE_This && rnd.m_nLevel == 0) { rnd.m_Nodes.Add(rnd.m_pSC->GetThisObject()); return 1; - } else if (rnd.m_CurNode->GetClassID() == XFA_Element::Xfa) { + } else if (rnd.m_CurNode->GetElementType() == XFA_Element::Xfa) { CXFA_Object* pObjNode = rnd.m_pSC->GetDocument()->GetXFAObject(rnd.m_uHashName); if (pObjNode) { @@ -194,7 +194,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_ForAttributeRs( CXFA_ResolveNodesData& rnd, const CFX_WideStringC& strAttr) { const XFA_SCRIPTATTRIBUTEINFO* lpScriptAttribute = - XFA_GetScriptAttributeByName(curNode->GetClassID(), strAttr); + XFA_GetScriptAttributeByName(curNode->GetElementType(), strAttr); if (lpScriptAttribute) { rnd.m_pScriptAttribute = lpScriptAttribute; rnd.m_Nodes.Add(curNode); @@ -230,17 +230,18 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( CXFA_Node* pPageSetNode = NULL; CXFA_Node* pChild = curNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pChild) { - if (pChild->GetClassID() == XFA_Element::Variables) { + if (pChild->GetElementType() == XFA_Element::Variables) { pVariablesNode = pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); continue; - } else if (pChild->GetClassID() == XFA_Element::PageSet) { + } else if (pChild->GetElementType() == XFA_Element::PageSet) { pPageSetNode = pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); continue; } else { const XFA_PROPERTY* pPropert = XFA_GetPropertyOfElement( - curNode->GetClassID(), pChild->GetClassID(), XFA_XDPPACKET_UNKNOWN); + curNode->GetElementType(), pChild->GetElementType(), + XFA_XDPPACKET_UNKNOWN); if (pPropert) { properties.Add(pChild); } else { @@ -288,7 +289,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( nodes.Add(child); } if (m_pNodeHelper->XFA_NodeIsTransparent(child) && - child->GetClassID() != XFA_Element::PageSet) { + child->GetElementType() != XFA_Element::PageSet) { if (!bSetFlag) { XFA_ResolveNodes_SetStylesForChild(dwStyles, rndFind); bSetFlag = TRUE; @@ -340,8 +341,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( nodes.Add(childProperty); } } else if (childProperty->GetNameHash() == uNameHash && - childProperty->GetClassID() != XFA_Element::Extras && - childProperty->GetClassID() != XFA_Element::Items) { + childProperty->GetElementType() != XFA_Element::Extras && + childProperty->GetElementType() != XFA_Element::Items) { nodes.Add(childProperty); } } @@ -353,7 +354,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( return 0; } CXFA_Node* pProp = NULL; - if (XFA_Element::Subform == curNode->GetClassID() && + if (XFA_Element::Subform == curNode->GetElementType() && XFA_HASHCODE_Occur == uNameHash) { CXFA_Node* pInstanceManager = curNode->AsNode()->GetInstanceMgrOfSubform(); @@ -424,11 +425,12 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( nodes.Add(child); } const XFA_PROPERTY* pPropert = XFA_GetPropertyOfElement( - parentNode->GetClassID(), child->GetClassID(), XFA_XDPPACKET_UNKNOWN); + parentNode->GetElementType(), child->GetElementType(), + XFA_XDPPACKET_UNKNOWN); FX_BOOL bInnerSearch = FALSE; if (pPropert) { - if ((child->GetClassID() == XFA_Element::Variables || - child->GetClassID() == XFA_Element::PageSet)) { + if ((child->GetElementType() == XFA_Element::Variables || + child->GetElementType() == XFA_Element::PageSet)) { bInnerSearch = TRUE; } } else { @@ -728,7 +730,7 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_FilterCondition( CXFA_Node* curNode = array[iSize - 1]; FX_BOOL bIsProperty = m_pNodeHelper->XFA_NodeIsProperty(curNode); if (curNode->IsUnnamed() || - (bIsProperty && curNode->GetClassID() != XFA_Element::PageSet)) { + (bIsProperty && curNode->GetElementType() != XFA_Element::PageSet)) { iCurrIndex = m_pNodeHelper->XFA_GetIndex(curNode, XFA_LOGIC_Transparent, bIsProperty, TRUE); } else { diff --git a/xfa/fxfa/parser/xfa_utils_imp.cpp b/xfa/fxfa/parser/xfa_utils_imp.cpp index 1e6cc1eb44..9e9788e19f 100644 --- a/xfa/fxfa/parser/xfa_utils_imp.cpp +++ b/xfa/fxfa/parser/xfa_utils_imp.cpp @@ -17,7 +17,7 @@ #include "xfa/fxfa/parser/xfa_script.h" CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { - XFA_Element eType = pNode->GetClassID(); + XFA_Element eType = pNode->GetElementType(); eWidgetType = eType; if (eType != XFA_Element::Field && eType != XFA_Element::Draw) { return NULL; @@ -62,7 +62,7 @@ CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { CXFA_Node* pUI = pNode->GetProperty(0, XFA_Element::Ui, TRUE); CXFA_Node* pChild = pUI->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { - XFA_Element eChild = pChild->GetClassID(); + XFA_Element eChild = pChild->GetElementType(); if (eChild == XFA_Element::Extras || eChild == XFA_Element::Picture) { continue; } @@ -75,7 +75,7 @@ CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { } if (eType == XFA_Element::Draw) { XFA_Element eDraw = - pUIChild ? pUIChild->GetClassID() : XFA_Element::Unknown; + pUIChild ? pUIChild->GetElementType() : XFA_Element::Unknown; switch (eDraw) { case XFA_Element::TextEdit: eWidgetType = XFA_Element::Text; @@ -89,11 +89,11 @@ CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { break; } } else { - if (pUIChild && pUIChild->GetClassID() == XFA_Element::DefaultUi) { + if (pUIChild && pUIChild->GetElementType() == XFA_Element::DefaultUi) { eWidgetType = XFA_Element::TextEdit; } else { eWidgetType = - pUIChild ? pUIChild->GetClassID() + pUIChild ? pUIChild->GetElementType() : (eUIType == XFA_Element::Unknown ? XFA_Element::TextEdit : eUIType); } @@ -105,12 +105,12 @@ CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { } pUIChild = pUI->GetProperty(0, eUIType, TRUE); } else if (eUIType == XFA_Element::Unknown) { - switch (pUIChild->GetClassID()) { + switch (pUIChild->GetElementType()) { case XFA_Element::CheckButton: { eValueType = XFA_Element::Text; if (CXFA_Node* pItems = pNode->GetChild(0, XFA_Element::Items)) { if (CXFA_Node* pItem = pItems->GetChild(0, XFA_Element::Unknown)) { - eValueType = pItem->GetClassID(); + eValueType = pItem->GetElementType(); } } } break; @@ -153,7 +153,7 @@ CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData) { return CXFA_LocaleValue(); } int32_t iVTType = XFA_VT_NULL; - XFA_Element eType = pValueChild->GetClassID(); + XFA_Element eType = pValueChild->GetElementType(); switch (eType) { case XFA_Element::Decimal: iVTType = XFA_VT_DECIMAL; @@ -238,7 +238,8 @@ FX_BOOL XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) { CXFA_Node* pUIChild = pFieldNode->GetChild(0, XFA_Element::Ui); if (pUIChild) { CXFA_Node* pFirstChild = pUIChild->GetNodeItem(XFA_NODEITEM_FirstChild); - if (pFirstChild && pFirstChild->GetClassID() == XFA_Element::ChoiceList) { + if (pFirstChild && + pFirstChild->GetElementType() == XFA_Element::ChoiceList) { bRet = pFirstChild->GetEnum(XFA_ATTRIBUTE_Open) == XFA_ATTRIBUTEENUM_MultiSelect; } -- cgit v1.2.3