void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) { CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild; CXFA_FFNotify* pNotify = pLayoutItem->m_pFormNode->GetDocument()->GetNotify(); CXFA_LayoutProcessor* pDocLayout = pLayoutItem->m_pFormNode->GetDocument()->GetDocLayout(); while (pNode) { CXFA_LayoutItem* pNext = pNode->m_pNextSibling; pNode->m_pParent = nullptr; pNotify->OnLayoutItemRemoving(pDocLayout, static_cast<CXFA_LayoutItem*>(pNode)); XFA_ReleaseLayoutItem(pNode); pNode = pNext; } pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::PageArea) { pNotify->OnPageEvent(static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem), XFA_PAGEVIEWEVENT_PostRemoved); } delete pLayoutItem; }
void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) { CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild; IXFA_Notify* pNotify = pLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify(); IXFA_DocLayout* pDocLayout = pLayoutItem->m_pFormNode->GetDocument()->GetDocLayout(); while (pNode) { CXFA_LayoutItem* pNext = pNode->m_pNextSibling; pNode->m_pParent = nullptr; pNotify->OnLayoutEvent(pDocLayout, static_cast<CXFA_LayoutItem*>(pNode), XFA_LAYOUTEVENT_ItemRemoving); XFA_ReleaseLayoutItem(pNode); pNode = pNext; } pNotify->OnLayoutEvent(pDocLayout, pLayoutItem, XFA_LAYOUTEVENT_ItemRemoving); if (pLayoutItem->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea) { pNotify->OnPageEvent(static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem), XFA_PAGEEVENT_PageRemoved); } delete pLayoutItem; }