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_script_layoutpseudomodel.h" | 7 #include "xfa/fxfa/parser/xfa_script_layoutpseudomodel.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 retArray.Add(pItem->m_pFormNode); | 240 retArray.Add(pItem->m_pFormNode); |
241 if (!bOnPageArea) { | 241 if (!bOnPageArea) { |
242 CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem, | 242 CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem, |
243 CXFA_TraverseStrategy_ContentLayoutItem> | 243 CXFA_TraverseStrategy_ContentLayoutItem> |
244 iterator(static_cast<CXFA_ContentLayoutItem*>(pItem->m_pFirstChild)); | 244 iterator(static_cast<CXFA_ContentLayoutItem*>(pItem->m_pFirstChild)); |
245 for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); | 245 for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); |
246 pItemChild; pItemChild = iterator.MoveToNext()) { | 246 pItemChild; pItemChild = iterator.MoveToNext()) { |
247 if (!pItemChild->IsContentLayoutItem()) { | 247 if (!pItemChild->IsContentLayoutItem()) { |
248 continue; | 248 continue; |
249 } | 249 } |
250 XFA_Element eElementType = | 250 XFA_Element eType = pItemChild->m_pFormNode->GetElementType(); |
251 pItemChild->m_pFormNode->GetElementType(); | 251 if (eType != XFA_Element::Field && eType != XFA_Element::Draw && |
252 if (eElementType != XFA_Element::Field && | 252 eType != XFA_Element::Subform && eType != XFA_Element::Area) { |
253 eElementType != XFA_Element::Draw && | |
254 eElementType != XFA_Element::Subform && | |
255 eElementType != XFA_Element::Area) { | |
256 continue; | 253 continue; |
257 } | 254 } |
258 if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) | 255 if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) |
259 continue; | 256 continue; |
260 | 257 |
261 formItems.insert(pItemChild->m_pFormNode); | 258 formItems.insert(pItemChild->m_pFormNode); |
262 retArray.Add(pItemChild->m_pFormNode); | 259 retArray.Add(pItemChild->m_pFormNode); |
263 } | 260 } |
264 } | 261 } |
265 } else { | 262 } else { |
266 if (bOnPageArea) { | 263 if (bOnPageArea) { |
267 CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem, | 264 CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem, |
268 CXFA_TraverseStrategy_ContentLayoutItem> | 265 CXFA_TraverseStrategy_ContentLayoutItem> |
269 iterator(static_cast<CXFA_ContentLayoutItem*>(pItem)); | 266 iterator(static_cast<CXFA_ContentLayoutItem*>(pItem)); |
270 for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); | 267 for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); |
271 pItemChild; pItemChild = iterator.MoveToNext()) { | 268 pItemChild; pItemChild = iterator.MoveToNext()) { |
272 if (!pItemChild->IsContentLayoutItem()) { | 269 if (!pItemChild->IsContentLayoutItem()) { |
273 continue; | 270 continue; |
274 } | 271 } |
275 XFA_Element eElementType = | 272 XFA_Element eType = pItemChild->m_pFormNode->GetElementType(); |
276 pItemChild->m_pFormNode->GetElementType(); | 273 if (eType != XFA_Element::Field && eType != XFA_Element::Draw && |
277 if (eElementType != XFA_Element::Field && | 274 eType != XFA_Element::Subform && eType != XFA_Element::Area) { |
278 eElementType != XFA_Element::Draw && | |
279 eElementType != XFA_Element::Subform && | |
280 eElementType != XFA_Element::Area) { | |
281 continue; | 275 continue; |
282 } | 276 } |
283 if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) | 277 if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) |
284 continue; | 278 continue; |
285 formItems.insert(pItemChild->m_pFormNode); | 279 formItems.insert(pItemChild->m_pFormNode); |
286 retArray.Add(pItemChild->m_pFormNode); | 280 retArray.Add(pItemChild->m_pFormNode); |
287 } | 281 } |
288 } | 282 } |
289 } | 283 } |
290 } | 284 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 } | 525 } |
532 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); | 526 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); |
533 if (!pLayoutItem) { | 527 if (!pLayoutItem) { |
534 pValue->SetInteger(-1); | 528 pValue->SetInteger(-1); |
535 return; | 529 return; |
536 } | 530 } |
537 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); | 531 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); |
538 if (pValue) | 532 if (pValue) |
539 pValue->SetInteger(bAbsPage ? iPage : iPage + 1); | 533 pValue->SetInteger(bAbsPage ? iPage : iPage + 1); |
540 } | 534 } |
OLD | NEW |