OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" | 7 #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" |
8 | 8 |
9 #include "xfa/fxfa/app/xfa_ffnotify.h" | 9 #include "xfa/fxfa/app/xfa_ffnotify.h" |
10 #include "xfa/fxfa/parser/xfa_doclayout.h" | 10 #include "xfa/fxfa/parser/xfa_doclayout.h" |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 pLeaderTemplate, pTrailerTemplate); | 842 pLeaderTemplate, pTrailerTemplate); |
843 CXFA_Document* pDocument = pBreakNode->GetDocument(); | 843 CXFA_Document* pDocument = pBreakNode->GetDocument(); |
844 CXFA_Node* pDataScope = nullptr; | 844 CXFA_Node* pDataScope = nullptr; |
845 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent, | 845 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent, |
846 XFA_ObjectType::ContainerNode); | 846 XFA_ObjectType::ContainerNode); |
847 if (pLeaderTemplate) { | 847 if (pLeaderTemplate) { |
848 if (!pDataScope) { | 848 if (!pDataScope) { |
849 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 849 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); |
850 } | 850 } |
851 pBreakLeaderNode = pDocument->DataMerge_CopyContainer( | 851 pBreakLeaderNode = pDocument->DataMerge_CopyContainer( |
852 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 852 pLeaderTemplate, pFormNode, pDataScope, TRUE, TRUE, TRUE); |
853 pDocument->DataMerge_UpdateBindingRelations(pBreakLeaderNode); | 853 pDocument->DataMerge_UpdateBindingRelations(pBreakLeaderNode); |
854 SetLayoutGeneratedNodeFlag(pBreakLeaderNode); | 854 SetLayoutGeneratedNodeFlag(pBreakLeaderNode); |
855 } | 855 } |
856 if (pTrailerTemplate) { | 856 if (pTrailerTemplate) { |
857 if (!pDataScope) { | 857 if (!pDataScope) { |
858 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 858 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); |
859 } | 859 } |
860 pBreakTrailerNode = pDocument->DataMerge_CopyContainer( | 860 pBreakTrailerNode = pDocument->DataMerge_CopyContainer( |
861 pTrailerTemplate, pFormNode, pDataScope, TRUE); | 861 pTrailerTemplate, pFormNode, pDataScope, TRUE, TRUE, TRUE); |
862 pDocument->DataMerge_UpdateBindingRelations(pBreakTrailerNode); | 862 pDocument->DataMerge_UpdateBindingRelations(pBreakTrailerNode); |
863 SetLayoutGeneratedNodeFlag(pBreakTrailerNode); | 863 SetLayoutGeneratedNodeFlag(pBreakTrailerNode); |
864 } | 864 } |
865 return TRUE; | 865 return TRUE; |
866 } | 866 } |
867 return FALSE; | 867 return FALSE; |
868 } | 868 } |
869 FX_BOOL CXFA_LayoutPageMgr::ProcessBookendLeaderOrTrailer( | 869 FX_BOOL CXFA_LayoutPageMgr::ProcessBookendLeaderOrTrailer( |
870 CXFA_Node* pBookendNode, | 870 CXFA_Node* pBookendNode, |
871 FX_BOOL bLeader, | 871 FX_BOOL bLeader, |
872 CXFA_Node*& pBookendAppendNode) { | 872 CXFA_Node*& pBookendAppendNode) { |
873 CXFA_Node* pLeaderTemplate = nullptr; | 873 CXFA_Node* pLeaderTemplate = nullptr; |
874 CXFA_Node* pFormNode = pBookendNode->GetNodeItem( | 874 CXFA_Node* pFormNode = pBookendNode->GetNodeItem( |
875 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); | 875 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); |
876 if (ResolveBookendLeaderOrTrailer(pBookendNode, bLeader, pLeaderTemplate)) { | 876 if (ResolveBookendLeaderOrTrailer(pBookendNode, bLeader, pLeaderTemplate)) { |
877 CXFA_Document* pDocument = pBookendNode->GetDocument(); | 877 CXFA_Document* pDocument = pBookendNode->GetDocument(); |
878 CXFA_Node* pDataScope = nullptr; | 878 CXFA_Node* pDataScope = nullptr; |
879 if (pLeaderTemplate) { | 879 if (pLeaderTemplate) { |
880 if (!pDataScope) { | 880 if (!pDataScope) { |
881 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 881 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); |
882 } | 882 } |
883 pBookendAppendNode = pDocument->DataMerge_CopyContainer( | 883 pBookendAppendNode = pDocument->DataMerge_CopyContainer( |
884 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 884 pLeaderTemplate, pFormNode, pDataScope, TRUE, TRUE, TRUE); |
885 pDocument->DataMerge_UpdateBindingRelations(pBookendAppendNode); | 885 pDocument->DataMerge_UpdateBindingRelations(pBookendAppendNode); |
886 SetLayoutGeneratedNodeFlag(pBookendAppendNode); | 886 SetLayoutGeneratedNodeFlag(pBookendAppendNode); |
887 return TRUE; | 887 return TRUE; |
888 } | 888 } |
889 } | 889 } |
890 return FALSE; | 890 return FALSE; |
891 } | 891 } |
892 CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, | 892 CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, |
893 CXFA_Node*& pLeaderTemplate, | 893 CXFA_Node*& pLeaderTemplate, |
894 CXFA_Node*& pTrailerTemplate, | 894 CXFA_Node*& pTrailerTemplate, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 if (bIsOverflowNode) { | 996 if (bIsOverflowNode) { |
997 pFormNode = pCurNode->GetNodeItem(XFA_NODEITEM_Parent); | 997 pFormNode = pCurNode->GetNodeItem(XFA_NODEITEM_Parent); |
998 } | 998 } |
999 CXFA_Document* pDocument = pCurNode->GetDocument(); | 999 CXFA_Document* pDocument = pCurNode->GetDocument(); |
1000 CXFA_Node* pDataScope = nullptr; | 1000 CXFA_Node* pDataScope = nullptr; |
1001 if (pLeaderTemplate) { | 1001 if (pLeaderTemplate) { |
1002 if (!pDataScope) { | 1002 if (!pDataScope) { |
1003 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 1003 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); |
1004 } | 1004 } |
1005 pLeaderNode = pDocument->DataMerge_CopyContainer( | 1005 pLeaderNode = pDocument->DataMerge_CopyContainer( |
1006 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 1006 pLeaderTemplate, pFormNode, pDataScope, TRUE, TRUE, TRUE); |
1007 pDocument->DataMerge_UpdateBindingRelations(pLeaderNode); | 1007 pDocument->DataMerge_UpdateBindingRelations(pLeaderNode); |
1008 SetLayoutGeneratedNodeFlag(pLeaderNode); | 1008 SetLayoutGeneratedNodeFlag(pLeaderNode); |
1009 } | 1009 } |
1010 if (pTrailerTemplate) { | 1010 if (pTrailerTemplate) { |
1011 if (!pDataScope) { | 1011 if (!pDataScope) { |
1012 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 1012 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); |
1013 } | 1013 } |
1014 pTrailerNode = pDocument->DataMerge_CopyContainer( | 1014 pTrailerNode = pDocument->DataMerge_CopyContainer( |
1015 pTrailerTemplate, pFormNode, pDataScope, TRUE); | 1015 pTrailerTemplate, pFormNode, pDataScope, TRUE, TRUE, TRUE); |
1016 pDocument->DataMerge_UpdateBindingRelations(pTrailerNode); | 1016 pDocument->DataMerge_UpdateBindingRelations(pTrailerNode); |
1017 SetLayoutGeneratedNodeFlag(pTrailerNode); | 1017 SetLayoutGeneratedNodeFlag(pTrailerNode); |
1018 } | 1018 } |
1019 return TRUE; | 1019 return TRUE; |
1020 } | 1020 } |
1021 if (bIsOverflowNode) { | 1021 if (bIsOverflowNode) { |
1022 break; | 1022 break; |
1023 } | 1023 } |
1024 } | 1024 } |
1025 return FALSE; | 1025 return FALSE; |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1735 } | 1735 } |
1736 } | 1736 } |
1737 if (pExistingNode) { | 1737 if (pExistingNode) { |
1738 pParentNode->RemoveChild(pExistingNode); | 1738 pParentNode->RemoveChild(pExistingNode); |
1739 } | 1739 } |
1740 } | 1740 } |
1741 pContainerItem->m_pOldSubform = pNewSubform; | 1741 pContainerItem->m_pOldSubform = pNewSubform; |
1742 } | 1742 } |
1743 pContainerItem->m_pFormNode = pDocument->DataMerge_CopyContainer( | 1743 pContainerItem->m_pFormNode = pDocument->DataMerge_CopyContainer( |
1744 pContainerItem->m_pFormNode, pParentNode, | 1744 pContainerItem->m_pFormNode, pParentNode, |
1745 ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record)), TRUE); | 1745 ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record)), TRUE, TRUE, |
| 1746 TRUE); |
1746 } break; | 1747 } break; |
1747 case XFA_Element::ContentArea: { | 1748 case XFA_Element::ContentArea: { |
1748 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; | 1749 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; |
1749 for (CXFA_Node* pChildNode = | 1750 for (CXFA_Node* pChildNode = |
1750 pParentNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 1751 pParentNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
1751 pChildNode; | 1752 pChildNode; |
1752 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1753 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
1753 if (pChildNode->GetTemplateNode() != pContainerItem->m_pFormNode) { | 1754 if (pChildNode->GetTemplateNode() != pContainerItem->m_pFormNode) { |
1754 continue; | 1755 continue; |
1755 } | 1756 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1941 } | 1942 } |
1942 pRootLayoutItem = m_pPageSetLayoutItemRoot; | 1943 pRootLayoutItem = m_pPageSetLayoutItemRoot; |
1943 CXFA_ContainerLayoutItem* pNextLayout = nullptr; | 1944 CXFA_ContainerLayoutItem* pNextLayout = nullptr; |
1944 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { | 1945 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { |
1945 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; | 1946 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; |
1946 SaveLayoutItem(pRootLayoutItem); | 1947 SaveLayoutItem(pRootLayoutItem); |
1947 delete pRootLayoutItem; | 1948 delete pRootLayoutItem; |
1948 } | 1949 } |
1949 m_pPageSetLayoutItemRoot = nullptr; | 1950 m_pPageSetLayoutItemRoot = nullptr; |
1950 } | 1951 } |
OLD | NEW |