diff options
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 8 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_serialize.cpp | 9 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 38 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp | 35 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_object_imp.cpp | 26 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_imp.cpp | 14 |
6 files changed, 61 insertions, 69 deletions
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 03643cd988..7d7b50fb3f 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -811,7 +811,7 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( sNodeIterator.MoveToNext(); } else { CFX_MapPtrTemplate<CXFA_Node*, CXFA_Node*> subformMapArray; - CXFA_NodeArray subformArray; + CXFA_NodeArray nodeArray; for (; iMax < 0 || iCurRepeatIndex < iMax; iCurRepeatIndex++) { FX_BOOL bSelfMatch = FALSE; XFA_ATTRIBUTEENUM eBindMatch = XFA_ATTRIBUTEENUM_None; @@ -830,11 +830,11 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( XFA_DataMerge_CreateDataBinding(pSubformNode, pDataNode); ASSERT(pSubformNode); subformMapArray.SetAt(pSubformNode, pDataNode); - subformArray.Add(pSubformNode); + nodeArray.Add(pSubformNode); } subformMapArray.GetStartPosition(); - for (int32_t iIndex = 0; iIndex < subformArray.GetSize(); iIndex++) { - CXFA_Node* pSubform = subformArray[iIndex]; + for (int32_t iIndex = 0; iIndex < nodeArray.GetSize(); iIndex++) { + CXFA_Node* pSubform = nodeArray[iIndex]; CXFA_Node* pDataNode = reinterpret_cast<CXFA_Node*>(subformMapArray.GetValueAt(pSubform)); for (CXFA_Node* pTemplateChild = diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index 497c8216dd..d7b8bf04d9 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -336,13 +336,12 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( pNode->GetClassID() == XFA_ELEMENT_Items) { wsChildren.clear(); bSaveXML = TRUE; - CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); - while (pChildNode) { - XFA_DataExporter_RegenerateFormFile_Changed(pChildNode, newBuf, - bSaveXML); + CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); + while (pChild) { + XFA_DataExporter_RegenerateFormFile_Changed(pChild, newBuf, bSaveXML); wsChildren += newBuf.AsStringC(); newBuf.Clear(); - pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling); + pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); } } break; diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index 7b7ecf4ba7..509bf630e9 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -154,11 +154,11 @@ FX_BOOL CXFA_ItemLayoutProcessor::FindLayoutItemSplitPos( (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) { FX_FLOAT fChildOffset = fCurVerticalOffset + fCurTopMargin + pChildItem->m_sPos.y; - FX_BOOL bAppChange = FALSE; + FX_BOOL bChange = FALSE; if (FindLayoutItemSplitPos(pChildItem, fChildOffset, fRelSplitPos, - bAppChange, bCalculateMargin)) { + bChange, bCalculateMargin)) { if (fRelSplitPos - fChildOffset < XFA_LAYOUT_FLOAT_PERCISION && - bAppChange) { + bChange) { fProposedSplitPos = fRelSplitPos - fCurTopMargin; } else { fProposedSplitPos = fRelSplitPos + fCurBottomMargin; @@ -1922,13 +1922,13 @@ void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( } static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( CXFA_ItemLayoutProcessor* pThis, - CXFA_ItemLayoutProcessor*& pProcessor, + CXFA_ItemLayoutProcessor* pProcessor, FX_BOOL bContainerWidthAutoSize, FX_BOOL bContainerHeightAutoSize, FX_FLOAT fContainerHeight, XFA_ATTRIBUTEENUM eFlowStrategy, uint8_t& uCurHAlignState, - CFX_ArrayTemplate<CXFA_ContentLayoutItem*>(&rgCurLineLayoutItems)[3], + CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3], FX_BOOL bUseBreakControl, FX_FLOAT fAvailHeight, FX_FLOAT fRealHeight, @@ -2266,6 +2266,7 @@ static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( } return XFA_ItemLayoutProcessorResult_Done; } + XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( FX_BOOL bUseBreakControl, XFA_ATTRIBUTEENUM eFlowStrategy, @@ -2445,7 +2446,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( pLayoutChild = NULL; } while (m_pCurChildNode) { - CXFA_ItemLayoutProcessor* pProcessor = NULL; + CXFA_ItemLayoutProcessor* pProcessor = nullptr; FX_BOOL bAddedItemInRow = FALSE; fContentCurRowY += XFA_ItemLayoutProcessor_InsertPendingItems(this, m_pFormNode); @@ -2477,18 +2478,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode, TRUE); } else { - CXFA_ItemLayoutProcessor* pProcessor = - new CXFA_ItemLayoutProcessor(pTrailerNode, NULL); + std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( + new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); XFA_ItemLayoutProcessor_InsertFlowedItem( - this, pProcessor, bContainerWidthAutoSize, + this, pTempProcessor.get(), bContainerWidthAutoSize, bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, uCurHAlignState, rgCurLineLayoutItems, FALSE, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, fContentWidthLimit, fContentCurRowAvailWidth, fContentCurRowHeight, bAddedItemInRow, bForceEndPage, pContext); - delete pProcessor; - pProcessor = NULL; } } XFA_ItemLayoutProcessor_GotoNextContainerNode( @@ -2507,18 +2506,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( bCreatePage) && m_pFormNode->GetClassID() != XFA_ELEMENT_Form) { if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { - CXFA_ItemLayoutProcessor* pProcessor = - new CXFA_ItemLayoutProcessor(pTrailerNode, NULL); + std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( + new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); XFA_ItemLayoutProcessor_InsertFlowedItem( - this, pProcessor, bContainerWidthAutoSize, + this, pTempProcessor.get(), bContainerWidthAutoSize, bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, uCurHAlignState, rgCurLineLayoutItems, FALSE, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, fContentWidthLimit, fContentCurRowAvailWidth, fContentCurRowHeight, bAddedItemInRow, bForceEndPage, pContext); - delete pProcessor; - pProcessor = NULL; } if (!bCreatePage) { if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { @@ -2528,18 +2525,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( fContentCalculatedWidth, fContentCalculatedHeight, fContentCurRowY, fContentCurRowHeight, fContentWidthLimit); rgCurLineLayoutItems->RemoveAll(); - CXFA_ItemLayoutProcessor* pProcessor = - new CXFA_ItemLayoutProcessor(pLeaderNode, NULL); + std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( + new CXFA_ItemLayoutProcessor(pLeaderNode, nullptr)); XFA_ItemLayoutProcessor_InsertFlowedItem( - this, pProcessor, bContainerWidthAutoSize, + this, pTempProcessor.get(), bContainerWidthAutoSize, bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, uCurHAlignState, rgCurLineLayoutItems, FALSE, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, fContentWidthLimit, fContentCurRowAvailWidth, fContentCurRowHeight, bAddedItemInRow, bForceEndPage, pContext); - delete pProcessor; - pProcessor = NULL; } } else { if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { @@ -2715,6 +2710,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( : (bIsManualBreak ? XFA_ItemLayoutProcessorResult_ManualBreak : XFA_ItemLayoutProcessorResult_PageFullBreak); } + FX_BOOL CXFA_ItemLayoutProcessor::CalculateRowChildPosition( CFX_ArrayTemplate<CXFA_ContentLayoutItem*>(&rgCurLineLayoutItems)[3], XFA_ATTRIBUTEENUM eFlowStrategy, diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp index 02bc0a8469..4b36bc8e4c 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp @@ -140,30 +140,29 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot, int32_t iSpliteIndex = 0; FX_BOOL bTargetAllFind = TRUE; while (iSpliteIndex != -1) { - CFX_WideString wsTargetExpr; + CFX_WideString wsExpr; int32_t iSpliteNextIndex = 0; if (!bTargetAllFind) { iSpliteNextIndex = wsTargetAll.Find(' ', iSpliteIndex); - wsTargetExpr = - wsTargetAll.Mid(iSpliteIndex, iSpliteNextIndex - iSpliteIndex); + wsExpr = wsTargetAll.Mid(iSpliteIndex, iSpliteNextIndex - iSpliteIndex); } else { - wsTargetExpr = wsTargetAll; + wsExpr = wsTargetAll; } - if (wsTargetExpr.IsEmpty()) + if (wsExpr.IsEmpty()) return nullptr; bTargetAllFind = FALSE; - if (wsTargetExpr.GetAt(0) == '#') { + if (wsExpr.GetAt(0) == '#') { CXFA_Node* pNode = pDocument->GetNodeByID( ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Template)), - wsTargetExpr.Mid(1).AsStringC()); + wsExpr.Mid(1).AsStringC()); if (pNode) return pNode; } else if (bNewExprStyle) { - CFX_WideString wsProcessedTarget = wsTargetExpr; - if (wsTargetExpr.Left(4) == FX_WSTRC(L"som(") && - wsTargetExpr.Right(1) == FX_WSTRC(L")")) { - wsProcessedTarget = wsTargetExpr.Mid(4, wsTargetExpr.GetLength() - 5); + CFX_WideString wsProcessedTarget = wsExpr; + if (wsExpr.Left(4) == FX_WSTRC(L"som(") && + wsExpr.Right(1) == FX_WSTRC(L")")) { + wsProcessedTarget = wsExpr.Mid(4, wsExpr.GetLength() - 5); } XFA_RESOLVENODE_RS rs; int32_t iCount = pDocument->GetScriptContext()->ResolveObjects( @@ -893,7 +892,6 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, CXFA_Node*& pLeaderTemplate, CXFA_Node*& pTrailerTemplate, FX_BOOL bCreatePage) { - CFX_WideStringC wsOverflowLeader, wsOverflowTrailer; CXFA_Node* pContainer = pOverflowNode->GetNodeItem(XFA_NODEITEM_Parent, XFA_OBJECTTYPE_ContainerNode) @@ -937,6 +935,8 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, } return NULL; } else if (pOverflowNode->GetClassID() == XFA_ELEMENT_Overflow) { + CFX_WideStringC wsOverflowLeader; + CFX_WideStringC wsOverflowTrailer; CFX_WideStringC wsOverflowTarget; pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); @@ -967,8 +967,9 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, } return pOverflowNode; } - return NULL; + return nullptr; } + FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, CXFA_Node*& pLeaderNode, CXFA_Node*& pTrailerNode, @@ -1718,11 +1719,11 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { pDocument, pContainerItem->m_pFormNode->GetClassID(), pContainerItem->m_pFormNode->GetNameHash(), pParentNode); CXFA_ContainerIterator sIterator(pExistingNode); - for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; - pNode = sIterator.MoveToNext()) { - if (pNode->GetClassID() != XFA_ELEMENT_ContentArea) { + for (CXFA_Node* pIter = sIterator.GetCurrent(); pIter; + pIter = sIterator.MoveToNext()) { + if (pIter->GetClassID() != XFA_ELEMENT_ContentArea) { CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( - pNode->GetUserData(XFA_LAYOUTITEMKEY)); + pIter->GetUserData(XFA_LAYOUTITEMKEY)); if (pLayoutItem) { pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); delete pLayoutItem; diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index f3bb4fefb2..cfe65ed864 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -1393,8 +1393,8 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( if (!pValueNode) { return; } - XFA_ELEMENT eType = pValueNode->GetClassID(); - if (eType == XFA_ELEMENT_Value) { + XFA_ELEMENT eNodeType = pValueNode->GetClassID(); + if (eNodeType == XFA_ELEMENT_Value) { bNeedFindContainer = true; CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); if (pNode && pNode->IsContainerNode()) { @@ -1407,7 +1407,7 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( pNode->GetNodeItem(XFA_NODEITEM_Parent)); } } else { - if (eType == XFA_ELEMENT_Items) { + if (eNodeType == XFA_ELEMENT_Items) { CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); if (pNode && pNode->IsContainerNode()) { pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); @@ -4190,12 +4190,10 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, CXFA_NodeArray nodeArray; pBind->GetBindItems(nodeArray); for (int32_t i = 0; i < nodeArray.GetSize(); i++) { - CXFA_Node* pNode = nodeArray[i]; - if (pNode == this) { - continue; + if (nodeArray[i] != this) { + nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, + bScriptModify, FALSE); } - pNode->SetScriptContent(wsContent, wsContent, bNotify, - bScriptModify, FALSE); } } break; @@ -4215,11 +4213,10 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, CXFA_NodeArray nodeArray; pBindNode->GetBindItems(nodeArray); for (int32_t i = 0; i < nodeArray.GetSize(); i++) { - CXFA_Node* pNode = nodeArray[i]; - if (pNode == this) { - continue; + if (nodeArray[i] != this) { + nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, true, + FALSE); } - pNode->SetScriptContent(wsContent, wsContent, bNotify, true, FALSE); } } pBindNode = nullptr; @@ -4280,9 +4277,8 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, CXFA_NodeArray nodeArray; pBindNode->GetBindItems(nodeArray); for (int32_t i = 0; i < nodeArray.GetSize(); i++) { - CXFA_Node* pNode = nodeArray[i]; - pNode->SetScriptContent(wsContent, wsContent, bNotify, bScriptModify, - FALSE); + nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, + bScriptModify, FALSE); } } return TRUE; diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index 357566ed9c..528758f6f8 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -219,10 +219,10 @@ void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject, XFA_HashCode uHashCode = static_cast<XFA_HashCode>( FX_HashCode_GetW(wsPropName.AsStringC(), false)); if (uHashCode != XFA_HASHCODE_Layout) { - CXFA_Object* pObject = + CXFA_Object* pObj = lpScriptContext->GetDocument()->GetXFAObject(uHashCode); - if (pObject) { - FXJSE_Value_Set(pValue, lpScriptContext->GetJSValueFromMap(pObject)); + if (pObj) { + FXJSE_Value_Set(pValue, lpScriptContext->GetJSValueFromMap(pObj)); return; } } @@ -335,12 +335,12 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, } if (pPropOrChild) { CFX_WideString wsDefaultName(L"{default}"); - const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = + const XFA_SCRIPTATTRIBUTEINFO* lpAttrInfo = XFA_GetScriptAttributeByName(pPropOrChild->GetClassID(), wsDefaultName.AsStringC()); - if (lpAttributeInfo) { - (pPropOrChild->*(lpAttributeInfo->lpfnCallback))( - pReturnValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); + if (lpAttrInfo) { + (pPropOrChild->*(lpAttrInfo->lpfnCallback))( + pReturnValue, TRUE, (XFA_ATTRIBUTE)lpAttrInfo->eAttribute); return; } } |