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