diff options
author | dsinclair <dsinclair@chromium.org> | 2016-06-22 22:04:54 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-22 22:04:54 -0700 |
commit | 070fcdfeafb17a9d3ada1418f48fd7f19aa4cf83 (patch) | |
tree | 2e9d0daaf76b0d2ac13f8b6d0b10dec11d1c6264 /xfa/fxfa/app | |
parent | a5ab26b8aa9ed12af8bdf323cb297f61cbfeb1fa (diff) | |
download | pdfium-070fcdfeafb17a9d3ada1418f48fd7f19aa4cf83.tar.xz |
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
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r-- | xfa/fxfa/app/xfa_ffdocview.cpp | 16 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fffield.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffnotify.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffpageview.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidget.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidgetacc.cpp | 16 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidgethandler.cpp | 4 |
7 files changed, 29 insertions, 28 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<CXFA_WidgetAcc*>(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<CXFA_FFWidget*>(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<CXFA_WidgetAcc*>(pExcl->GetWidgetData()); @@ -300,7 +300,7 @@ IXFA_AppProvider* CXFA_WidgetAcc::GetAppProvider() { } int32_t CXFA_WidgetAcc::ProcessEvent(int32_t iActivity, CXFA_EventParam* pEventParam) { - if (GetClassID() == XFA_Element::Draw) { + if (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) { |