Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp

Issue 2027273002: Fix all the code which has duplicate variable declarations (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/xfa_layout_itemlayout.cpp ('k') | xfa/fxfa/parser/xfa_object_imp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 CXFA_Document* pDocument = pPageSetRoot->GetDocument(); 133 CXFA_Document* pDocument = pPageSetRoot->GetDocument();
134 if (wsTargetExpr.IsEmpty()) 134 if (wsTargetExpr.IsEmpty())
135 return nullptr; 135 return nullptr;
136 136
137 CFX_WideString wsTargetAll(wsTargetExpr); 137 CFX_WideString wsTargetAll(wsTargetExpr);
138 wsTargetAll.TrimLeft(); 138 wsTargetAll.TrimLeft();
139 wsTargetAll.TrimRight(); 139 wsTargetAll.TrimRight();
140 int32_t iSpliteIndex = 0; 140 int32_t iSpliteIndex = 0;
141 FX_BOOL bTargetAllFind = TRUE; 141 FX_BOOL bTargetAllFind = TRUE;
142 while (iSpliteIndex != -1) { 142 while (iSpliteIndex != -1) {
143 CFX_WideString wsTargetExpr; 143 CFX_WideString wsExpr;
144 int32_t iSpliteNextIndex = 0; 144 int32_t iSpliteNextIndex = 0;
145 if (!bTargetAllFind) { 145 if (!bTargetAllFind) {
146 iSpliteNextIndex = wsTargetAll.Find(' ', iSpliteIndex); 146 iSpliteNextIndex = wsTargetAll.Find(' ', iSpliteIndex);
147 wsTargetExpr = 147 wsExpr = wsTargetAll.Mid(iSpliteIndex, iSpliteNextIndex - iSpliteIndex);
148 wsTargetAll.Mid(iSpliteIndex, iSpliteNextIndex - iSpliteIndex);
149 } else { 148 } else {
150 wsTargetExpr = wsTargetAll; 149 wsExpr = wsTargetAll;
151 } 150 }
152 if (wsTargetExpr.IsEmpty()) 151 if (wsExpr.IsEmpty())
153 return nullptr; 152 return nullptr;
154 153
155 bTargetAllFind = FALSE; 154 bTargetAllFind = FALSE;
156 if (wsTargetExpr.GetAt(0) == '#') { 155 if (wsExpr.GetAt(0) == '#') {
157 CXFA_Node* pNode = pDocument->GetNodeByID( 156 CXFA_Node* pNode = pDocument->GetNodeByID(
158 ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Template)), 157 ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Template)),
159 wsTargetExpr.Mid(1).AsStringC()); 158 wsExpr.Mid(1).AsStringC());
160 if (pNode) 159 if (pNode)
161 return pNode; 160 return pNode;
162 } else if (bNewExprStyle) { 161 } else if (bNewExprStyle) {
163 CFX_WideString wsProcessedTarget = wsTargetExpr; 162 CFX_WideString wsProcessedTarget = wsExpr;
164 if (wsTargetExpr.Left(4) == FX_WSTRC(L"som(") && 163 if (wsExpr.Left(4) == FX_WSTRC(L"som(") &&
165 wsTargetExpr.Right(1) == FX_WSTRC(L")")) { 164 wsExpr.Right(1) == FX_WSTRC(L")")) {
166 wsProcessedTarget = wsTargetExpr.Mid(4, wsTargetExpr.GetLength() - 5); 165 wsProcessedTarget = wsExpr.Mid(4, wsExpr.GetLength() - 5);
167 } 166 }
168 XFA_RESOLVENODE_RS rs; 167 XFA_RESOLVENODE_RS rs;
169 int32_t iCount = pDocument->GetScriptContext()->ResolveObjects( 168 int32_t iCount = pDocument->GetScriptContext()->ResolveObjects(
170 pPageSetRoot, wsProcessedTarget.AsStringC(), rs, 169 pPageSetRoot, wsProcessedTarget.AsStringC(), rs,
171 XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | 170 XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
172 XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Siblings | 171 XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Siblings |
173 XFA_RESOLVENODE_Parent); 172 XFA_RESOLVENODE_Parent);
174 if (iCount > 0 && rs.nodes[0]->IsNode()) 173 if (iCount > 0 && rs.nodes[0]->IsNode())
175 return rs.nodes[0]->AsNode(); 174 return rs.nodes[0]->AsNode();
176 } 175 }
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 SetLayoutGeneratedNodeFlag(pBookendAppendNode); 885 SetLayoutGeneratedNodeFlag(pBookendAppendNode);
887 return TRUE; 886 return TRUE;
888 } 887 }
889 } 888 }
890 return FALSE; 889 return FALSE;
891 } 890 }
892 CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, 891 CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode,
893 CXFA_Node*& pLeaderTemplate, 892 CXFA_Node*& pLeaderTemplate,
894 CXFA_Node*& pTrailerTemplate, 893 CXFA_Node*& pTrailerTemplate,
895 FX_BOOL bCreatePage) { 894 FX_BOOL bCreatePage) {
896 CFX_WideStringC wsOverflowLeader, wsOverflowTrailer;
897 CXFA_Node* pContainer = 895 CXFA_Node* pContainer =
898 pOverflowNode->GetNodeItem(XFA_NODEITEM_Parent, 896 pOverflowNode->GetNodeItem(XFA_NODEITEM_Parent,
899 XFA_OBJECTTYPE_ContainerNode) 897 XFA_OBJECTTYPE_ContainerNode)
900 ->GetTemplateNode(); 898 ->GetTemplateNode();
901 if (pOverflowNode->GetClassID() == XFA_ELEMENT_Break) { 899 if (pOverflowNode->GetClassID() == XFA_ELEMENT_Break) {
902 CFX_WideStringC wsOverflowLeader; 900 CFX_WideStringC wsOverflowLeader;
903 CFX_WideStringC wsOverflowTarget; 901 CFX_WideStringC wsOverflowTarget;
904 CFX_WideStringC wsOverflowTrailer; 902 CFX_WideStringC wsOverflowTrailer;
905 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); 903 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader);
906 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); 904 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer);
(...skipping 23 matching lines...) Expand all
930 if (!bCreatePage) { 928 if (!bCreatePage) {
931 pLeaderTemplate = 929 pLeaderTemplate =
932 ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); 930 ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader);
933 pTrailerTemplate = 931 pTrailerTemplate =
934 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); 932 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer);
935 } 933 }
936 return pOverflowNode; 934 return pOverflowNode;
937 } 935 }
938 return NULL; 936 return NULL;
939 } else if (pOverflowNode->GetClassID() == XFA_ELEMENT_Overflow) { 937 } else if (pOverflowNode->GetClassID() == XFA_ELEMENT_Overflow) {
938 CFX_WideStringC wsOverflowLeader;
939 CFX_WideStringC wsOverflowTrailer;
940 CFX_WideStringC wsOverflowTarget; 940 CFX_WideStringC wsOverflowTarget;
941 pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); 941 pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader);
942 pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); 942 pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer);
943 pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget); 943 pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget);
944 if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) { 944 if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) {
945 CXFA_Node* pTarget = 945 CXFA_Node* pTarget =
946 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); 946 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget);
947 if (pTarget) { 947 if (pTarget) {
948 m_bCreateOverFlowPage = TRUE; 948 m_bCreateOverFlowPage = TRUE;
949 switch (pTarget->GetClassID()) { 949 switch (pTarget->GetClassID()) {
(...skipping 10 matching lines...) Expand all
960 } 960 }
961 } 961 }
962 } 962 }
963 if (!bCreatePage) { 963 if (!bCreatePage) {
964 pLeaderTemplate = ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); 964 pLeaderTemplate = ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader);
965 pTrailerTemplate = 965 pTrailerTemplate =
966 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); 966 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer);
967 } 967 }
968 return pOverflowNode; 968 return pOverflowNode;
969 } 969 }
970 return NULL; 970 return nullptr;
971 } 971 }
972
972 FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, 973 FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode,
973 CXFA_Node*& pLeaderNode, 974 CXFA_Node*& pLeaderNode,
974 CXFA_Node*& pTrailerNode, 975 CXFA_Node*& pTrailerNode,
975 FX_BOOL bDataMerge, 976 FX_BOOL bDataMerge,
976 FX_BOOL bCreatePage) { 977 FX_BOOL bCreatePage) {
977 if (pFormNode == NULL) { 978 if (pFormNode == NULL) {
978 return FALSE; 979 return FALSE;
979 } 980 }
980 CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; 981 CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL;
981 FX_BOOL bIsOverflowNode = FALSE; 982 FX_BOOL bIsOverflowNode = FALSE;
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 } 1712 }
1712 } 1713 }
1713 if (bIsExistForm) { 1714 if (bIsExistForm) {
1714 CXFA_Node* pNewSubform = pFormLayout->m_pFormNode; 1715 CXFA_Node* pNewSubform = pFormLayout->m_pFormNode;
1715 if (pContainerItem->m_pOldSubform && 1716 if (pContainerItem->m_pOldSubform &&
1716 pContainerItem->m_pOldSubform != pNewSubform) { 1717 pContainerItem->m_pOldSubform != pNewSubform) {
1717 CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( 1718 CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance(
1718 pDocument, pContainerItem->m_pFormNode->GetClassID(), 1719 pDocument, pContainerItem->m_pFormNode->GetClassID(),
1719 pContainerItem->m_pFormNode->GetNameHash(), pParentNode); 1720 pContainerItem->m_pFormNode->GetNameHash(), pParentNode);
1720 CXFA_ContainerIterator sIterator(pExistingNode); 1721 CXFA_ContainerIterator sIterator(pExistingNode);
1721 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; 1722 for (CXFA_Node* pIter = sIterator.GetCurrent(); pIter;
1722 pNode = sIterator.MoveToNext()) { 1723 pIter = sIterator.MoveToNext()) {
1723 if (pNode->GetClassID() != XFA_ELEMENT_ContentArea) { 1724 if (pIter->GetClassID() != XFA_ELEMENT_ContentArea) {
1724 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( 1725 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>(
1725 pNode->GetUserData(XFA_LAYOUTITEMKEY)); 1726 pIter->GetUserData(XFA_LAYOUTITEMKEY));
1726 if (pLayoutItem) { 1727 if (pLayoutItem) {
1727 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); 1728 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem);
1728 delete pLayoutItem; 1729 delete pLayoutItem;
1729 } 1730 }
1730 } 1731 }
1731 } 1732 }
1732 if (pExistingNode) { 1733 if (pExistingNode) {
1733 pParentNode->RemoveChild(pExistingNode); 1734 pParentNode->RemoveChild(pExistingNode);
1734 } 1735 }
1735 } 1736 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 } 1938 }
1938 pRootLayoutItem = m_pPageSetLayoutItemRoot; 1939 pRootLayoutItem = m_pPageSetLayoutItemRoot;
1939 CXFA_ContainerLayoutItem* pNextLayout = NULL; 1940 CXFA_ContainerLayoutItem* pNextLayout = NULL;
1940 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { 1941 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) {
1941 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; 1942 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling;
1942 SaveLayoutItem(pRootLayoutItem); 1943 SaveLayoutItem(pRootLayoutItem);
1943 delete pRootLayoutItem; 1944 delete pRootLayoutItem;
1944 } 1945 }
1945 m_pPageSetLayoutItemRoot = NULL; 1946 m_pPageSetLayoutItemRoot = NULL;
1946 } 1947 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_layout_itemlayout.cpp ('k') | xfa/fxfa/parser/xfa_object_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698