| 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" |
| 11 #include "xfa/fxfa/parser/xfa_document.h" | 11 #include "xfa/fxfa/parser/xfa_document.h" |
| 12 #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" | 12 #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" |
| 13 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" | 13 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" |
| 14 #include "xfa/fxfa/parser/xfa_layout_appadapter.h" | 14 #include "xfa/fxfa/parser/xfa_layout_appadapter.h" |
| 15 #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" | 15 #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" |
| 16 #include "xfa/fxfa/parser/xfa_localemgr.h" | 16 #include "xfa/fxfa/parser/xfa_localemgr.h" |
| 17 #include "xfa/fxfa/parser/xfa_object.h" | 17 #include "xfa/fxfa/parser/xfa_object.h" |
| 18 #include "xfa/fxfa/parser/xfa_parser.h" | 18 #include "xfa/fxfa/parser/xfa_parser.h" |
| 19 #include "xfa/fxfa/parser/xfa_parser_imp.h" | 19 #include "xfa/fxfa/parser/xfa_parser_imp.h" |
| 20 #include "xfa/fxfa/parser/xfa_script.h" | 20 #include "xfa/fxfa/parser/xfa_script.h" |
| 21 #include "xfa/fxfa/parser/xfa_script_imp.h" | 21 #include "xfa/fxfa/parser/xfa_script_imp.h" |
| 22 #include "xfa/fxfa/parser/xfa_utils.h" | 22 #include "xfa/fxfa/parser/xfa_utils.h" |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 class PageSetContainerLayoutItem { | 26 class PageSetContainerLayoutItem { |
| 27 public: | 27 public: |
| 28 static inline CXFA_ContainerLayoutItem* GetFirstChild( | 28 static inline CXFA_ContainerLayoutItem* GetFirstChild( |
| 29 CXFA_ContainerLayoutItem* pLayoutItem) { | 29 CXFA_ContainerLayoutItem* pLayoutItem) { |
| 30 if (pLayoutItem->m_pFormNode->GetClassID() != XFA_Element::PageSet) | 30 if (pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::PageSet) |
| 31 return nullptr; | 31 return nullptr; |
| 32 | 32 |
| 33 CXFA_ContainerLayoutItem* pChildItem = | 33 CXFA_ContainerLayoutItem* pChildItem = |
| 34 static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pFirstChild); | 34 static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pFirstChild); |
| 35 while (pChildItem && | 35 while (pChildItem && |
| 36 pChildItem->m_pFormNode->GetClassID() != XFA_Element::PageSet) { | 36 pChildItem->m_pFormNode->GetElementType() != XFA_Element::PageSet) { |
| 37 pChildItem = | 37 pChildItem = |
| 38 static_cast<CXFA_ContainerLayoutItem*>(pChildItem->m_pNextSibling); | 38 static_cast<CXFA_ContainerLayoutItem*>(pChildItem->m_pNextSibling); |
| 39 } | 39 } |
| 40 return pChildItem; | 40 return pChildItem; |
| 41 } | 41 } |
| 42 | 42 |
| 43 static inline CXFA_ContainerLayoutItem* GetNextSibling( | 43 static inline CXFA_ContainerLayoutItem* GetNextSibling( |
| 44 CXFA_ContainerLayoutItem* pLayoutItem) { | 44 CXFA_ContainerLayoutItem* pLayoutItem) { |
| 45 CXFA_ContainerLayoutItem* pChildItem = | 45 CXFA_ContainerLayoutItem* pChildItem = |
| 46 static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pNextSibling); | 46 static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pNextSibling); |
| 47 while (pChildItem && | 47 while (pChildItem && |
| 48 pChildItem->m_pFormNode->GetClassID() != XFA_Element::PageSet) { | 48 pChildItem->m_pFormNode->GetElementType() != XFA_Element::PageSet) { |
| 49 pChildItem = | 49 pChildItem = |
| 50 static_cast<CXFA_ContainerLayoutItem*>(pChildItem->m_pNextSibling); | 50 static_cast<CXFA_ContainerLayoutItem*>(pChildItem->m_pNextSibling); |
| 51 } | 51 } |
| 52 return pChildItem; | 52 return pChildItem; |
| 53 } | 53 } |
| 54 | 54 |
| 55 static inline CXFA_ContainerLayoutItem* GetParent( | 55 static inline CXFA_ContainerLayoutItem* GetParent( |
| 56 CXFA_ContainerLayoutItem* pLayoutItem) { | 56 CXFA_ContainerLayoutItem* pLayoutItem) { |
| 57 return static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pParent); | 57 return static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pParent); |
| 58 } | 58 } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 m_pTemplatePageSetRoot->GetEnum(XFA_ATTRIBUTE_Relation); | 264 m_pTemplatePageSetRoot->GetEnum(XFA_ATTRIBUTE_Relation); |
| 265 if (eRelation != XFA_ATTRIBUTEENUM_Unknown) { | 265 if (eRelation != XFA_ATTRIBUTEENUM_Unknown) { |
| 266 m_ePageSetMode = eRelation; | 266 m_ePageSetMode = eRelation; |
| 267 } | 267 } |
| 268 InitPageSetMap(); | 268 InitPageSetMap(); |
| 269 CXFA_Node* pPageArea = NULL; | 269 CXFA_Node* pPageArea = NULL; |
| 270 int32_t iCount = 0; | 270 int32_t iCount = 0; |
| 271 for (pPageArea = m_pTemplatePageSetRoot->GetNodeItem(XFA_NODEITEM_FirstChild); | 271 for (pPageArea = m_pTemplatePageSetRoot->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 272 pPageArea; | 272 pPageArea; |
| 273 pPageArea = pPageArea->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 273 pPageArea = pPageArea->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 274 if (pPageArea->GetClassID() == XFA_Element::PageArea) { | 274 if (pPageArea->GetElementType() == XFA_Element::PageArea) { |
| 275 iCount++; | 275 iCount++; |
| 276 if (pPageArea->GetFirstChildByClass(XFA_Element::ContentArea)) { | 276 if (pPageArea->GetFirstChildByClass(XFA_Element::ContentArea)) { |
| 277 return TRUE; | 277 return TRUE; |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 if (iCount > 0) { | 281 if (iCount > 0) { |
| 282 return FALSE; | 282 return FALSE; |
| 283 } | 283 } |
| 284 CXFA_Document* pDocument = pTemplateNode->GetDocument(); | 284 CXFA_Document* pDocument = pTemplateNode->GetDocument(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 return TRUE; | 328 return TRUE; |
| 329 } | 329 } |
| 330 FX_BOOL CXFA_LayoutPageMgr::PrepareFirstPage(CXFA_Node* pRootSubform) { | 330 FX_BOOL CXFA_LayoutPageMgr::PrepareFirstPage(CXFA_Node* pRootSubform) { |
| 331 FX_BOOL bProBreakBefore = FALSE; | 331 FX_BOOL bProBreakBefore = FALSE; |
| 332 CXFA_Node* pBreakBeforeNode = NULL; | 332 CXFA_Node* pBreakBeforeNode = NULL; |
| 333 while (pRootSubform) { | 333 while (pRootSubform) { |
| 334 for (CXFA_Node* pBreakNode = | 334 for (CXFA_Node* pBreakNode = |
| 335 pRootSubform->GetNodeItem(XFA_NODEITEM_FirstChild); | 335 pRootSubform->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 336 pBreakNode; | 336 pBreakNode; |
| 337 pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 337 pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 338 XFA_Element eType = pBreakNode->GetClassID(); | 338 XFA_Element eType = pBreakNode->GetElementType(); |
| 339 if (eType == XFA_Element::BreakBefore || | 339 if (eType == XFA_Element::BreakBefore || |
| 340 (eType == XFA_Element::Break && | 340 (eType == XFA_Element::Break && |
| 341 pBreakNode->GetEnum(XFA_ATTRIBUTE_Before) != | 341 pBreakNode->GetEnum(XFA_ATTRIBUTE_Before) != |
| 342 XFA_ATTRIBUTEENUM_Auto)) { | 342 XFA_ATTRIBUTEENUM_Auto)) { |
| 343 bProBreakBefore = TRUE; | 343 bProBreakBefore = TRUE; |
| 344 pBreakBeforeNode = pBreakNode; | 344 pBreakBeforeNode = pBreakNode; |
| 345 break; | 345 break; |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 if (bProBreakBefore) { | 348 if (bProBreakBefore) { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 case XFA_ATTRIBUTEENUM_OrderedOccurrence: | 579 case XFA_ATTRIBUTEENUM_OrderedOccurrence: |
| 580 default: { ProcessLastPageSet(); } break; | 580 default: { ProcessLastPageSet(); } break; |
| 581 case XFA_ATTRIBUTEENUM_SimplexPaginated: | 581 case XFA_ATTRIBUTEENUM_SimplexPaginated: |
| 582 case XFA_ATTRIBUTEENUM_DuplexPaginated: { | 582 case XFA_ATTRIBUTEENUM_DuplexPaginated: { |
| 583 CXFA_LayoutItem* pLastPageAreaLayoutItem = NULL; | 583 CXFA_LayoutItem* pLastPageAreaLayoutItem = NULL; |
| 584 int32_t nPageAreaCount = 0; | 584 int32_t nPageAreaCount = 0; |
| 585 for (CXFA_LayoutItem* pPageAreaLayoutItem = | 585 for (CXFA_LayoutItem* pPageAreaLayoutItem = |
| 586 pPageSetLayoutItem->m_pFirstChild; | 586 pPageSetLayoutItem->m_pFirstChild; |
| 587 pPageAreaLayoutItem; | 587 pPageAreaLayoutItem; |
| 588 pPageAreaLayoutItem = pPageAreaLayoutItem->m_pNextSibling) { | 588 pPageAreaLayoutItem = pPageAreaLayoutItem->m_pNextSibling) { |
| 589 if (pPageAreaLayoutItem->m_pFormNode->GetClassID() != | 589 if (pPageAreaLayoutItem->m_pFormNode->GetElementType() != |
| 590 XFA_Element::PageArea) { | 590 XFA_Element::PageArea) { |
| 591 continue; | 591 continue; |
| 592 } | 592 } |
| 593 nPageAreaCount++; | 593 nPageAreaCount++; |
| 594 pLastPageAreaLayoutItem = pPageAreaLayoutItem; | 594 pLastPageAreaLayoutItem = pPageAreaLayoutItem; |
| 595 } | 595 } |
| 596 if (!pLastPageAreaLayoutItem) { | 596 if (!pLastPageAreaLayoutItem) { |
| 597 break; | 597 break; |
| 598 } | 598 } |
| 599 if (!FindPageAreaFromPageSet_SimplexDuplex( | 599 if (!FindPageAreaFromPageSet_SimplexDuplex( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 622 AddPageAreaLayoutItem(pRecord, pNode); | 622 AddPageAreaLayoutItem(pRecord, pNode); |
| 623 break; | 623 break; |
| 624 } | 624 } |
| 625 } | 625 } |
| 626 FX_BOOL bUsable = TRUE; | 626 FX_BOOL bUsable = TRUE; |
| 627 CFX_ArrayTemplate<FX_FLOAT> rgUsedHeights; | 627 CFX_ArrayTemplate<FX_FLOAT> rgUsedHeights; |
| 628 for (CXFA_LayoutItem* pChildLayoutItem = | 628 for (CXFA_LayoutItem* pChildLayoutItem = |
| 629 pLastPageAreaLayoutItem->m_pFirstChild; | 629 pLastPageAreaLayoutItem->m_pFirstChild; |
| 630 pChildLayoutItem; | 630 pChildLayoutItem; |
| 631 pChildLayoutItem = pChildLayoutItem->m_pNextSibling) { | 631 pChildLayoutItem = pChildLayoutItem->m_pNextSibling) { |
| 632 if (pChildLayoutItem->m_pFormNode->GetClassID() != | 632 if (pChildLayoutItem->m_pFormNode->GetElementType() != |
| 633 XFA_Element::ContentArea) { | 633 XFA_Element::ContentArea) { |
| 634 continue; | 634 continue; |
| 635 } | 635 } |
| 636 FX_FLOAT fUsedHeight = 0; | 636 FX_FLOAT fUsedHeight = 0; |
| 637 for (CXFA_LayoutItem* pContentChildLayoutItem = | 637 for (CXFA_LayoutItem* pContentChildLayoutItem = |
| 638 pChildLayoutItem->m_pFirstChild; | 638 pChildLayoutItem->m_pFirstChild; |
| 639 pContentChildLayoutItem; | 639 pContentChildLayoutItem; |
| 640 pContentChildLayoutItem = | 640 pContentChildLayoutItem = |
| 641 pContentChildLayoutItem->m_pNextSibling) { | 641 pContentChildLayoutItem->m_pNextSibling) { |
| 642 if (CXFA_ContentLayoutItem* pContent = | 642 if (CXFA_ContentLayoutItem* pContent = |
| 643 pContentChildLayoutItem->AsContentLayoutItem()) { | 643 pContentChildLayoutItem->AsContentLayoutItem()) { |
| 644 fUsedHeight += pContent->m_sSize.y; | 644 fUsedHeight += pContent->m_sSize.y; |
| 645 } | 645 } |
| 646 } | 646 } |
| 647 rgUsedHeights.Add(fUsedHeight); | 647 rgUsedHeights.Add(fUsedHeight); |
| 648 } | 648 } |
| 649 int32_t iCurContentAreaIndex = -1; | 649 int32_t iCurContentAreaIndex = -1; |
| 650 for (CXFA_Node* pContentAreaNode = | 650 for (CXFA_Node* pContentAreaNode = |
| 651 pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 651 pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 652 pContentAreaNode; | 652 pContentAreaNode; |
| 653 pContentAreaNode = | 653 pContentAreaNode = |
| 654 pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 654 pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 655 if (pContentAreaNode->GetClassID() != XFA_Element::ContentArea) { | 655 if (pContentAreaNode->GetElementType() != |
| 656 XFA_Element::ContentArea) { |
| 656 continue; | 657 continue; |
| 657 } | 658 } |
| 658 iCurContentAreaIndex++; | 659 iCurContentAreaIndex++; |
| 659 if (rgUsedHeights[iCurContentAreaIndex] > | 660 if (rgUsedHeights[iCurContentAreaIndex] > |
| 660 pContentAreaNode->GetMeasure(XFA_ATTRIBUTE_H) | 661 pContentAreaNode->GetMeasure(XFA_ATTRIBUTE_H) |
| 661 .ToUnit(XFA_UNIT_Pt) + | 662 .ToUnit(XFA_UNIT_Pt) + |
| 662 XFA_LAYOUT_FLOAT_PERCISION) { | 663 XFA_LAYOUT_FLOAT_PERCISION) { |
| 663 bUsable = FALSE; | 664 bUsable = FALSE; |
| 664 break; | 665 break; |
| 665 } | 666 } |
| 666 } | 667 } |
| 667 if (bUsable) { | 668 if (bUsable) { |
| 668 CXFA_LayoutItem* pChildLayoutItem = | 669 CXFA_LayoutItem* pChildLayoutItem = |
| 669 pLastPageAreaLayoutItem->m_pFirstChild; | 670 pLastPageAreaLayoutItem->m_pFirstChild; |
| 670 CXFA_Node* pContentAreaNode = | 671 CXFA_Node* pContentAreaNode = |
| 671 pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 672 pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 672 pLastPageAreaLayoutItem->m_pFormNode = pNode; | 673 pLastPageAreaLayoutItem->m_pFormNode = pNode; |
| 673 while (pChildLayoutItem && pContentAreaNode) { | 674 while (pChildLayoutItem && pContentAreaNode) { |
| 674 if (pChildLayoutItem->m_pFormNode->GetClassID() != | 675 if (pChildLayoutItem->m_pFormNode->GetElementType() != |
| 675 XFA_Element::ContentArea) { | 676 XFA_Element::ContentArea) { |
| 676 pChildLayoutItem = pChildLayoutItem->m_pNextSibling; | 677 pChildLayoutItem = pChildLayoutItem->m_pNextSibling; |
| 677 continue; | 678 continue; |
| 678 } | 679 } |
| 679 if (pContentAreaNode->GetClassID() != XFA_Element::ContentArea) { | 680 if (pContentAreaNode->GetElementType() != |
| 681 XFA_Element::ContentArea) { |
| 680 pContentAreaNode = | 682 pContentAreaNode = |
| 681 pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 683 pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 682 continue; | 684 continue; |
| 683 } | 685 } |
| 684 pChildLayoutItem->m_pFormNode = pContentAreaNode; | 686 pChildLayoutItem->m_pFormNode = pContentAreaNode; |
| 685 pChildLayoutItem = pChildLayoutItem->m_pNextSibling; | 687 pChildLayoutItem = pChildLayoutItem->m_pNextSibling; |
| 686 pContentAreaNode = | 688 pContentAreaNode = |
| 687 pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 689 pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 688 } | 690 } |
| 689 } else if (pNode->GetEnum(XFA_ATTRIBUTE_PagePosition) == | 691 } else if (pNode->GetEnum(XFA_ATTRIBUTE_PagePosition) == |
| (...skipping 19 matching lines...) Expand all Loading... |
| 709 // FIXME: Find() method should take const. | 711 // FIXME: Find() method should take const. |
| 710 return m_PageArray.Find(const_cast<CXFA_ContainerLayoutItem*>(pPage)); | 712 return m_PageArray.Find(const_cast<CXFA_ContainerLayoutItem*>(pPage)); |
| 711 } | 713 } |
| 712 FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType, | 714 FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType, |
| 713 XFA_ATTRIBUTEENUM eTargetType, | 715 XFA_ATTRIBUTEENUM eTargetType, |
| 714 CXFA_Node* pTarget, | 716 CXFA_Node* pTarget, |
| 715 FX_BOOL bStartNew) { | 717 FX_BOOL bStartNew) { |
| 716 FX_BOOL bRet = FALSE; | 718 FX_BOOL bRet = FALSE; |
| 717 switch (eTargetType) { | 719 switch (eTargetType) { |
| 718 case XFA_ATTRIBUTEENUM_ContentArea: | 720 case XFA_ATTRIBUTEENUM_ContentArea: |
| 719 if (pTarget && pTarget->GetClassID() != XFA_Element::ContentArea) { | 721 if (pTarget && pTarget->GetElementType() != XFA_Element::ContentArea) { |
| 720 pTarget = NULL; | 722 pTarget = NULL; |
| 721 } | 723 } |
| 722 if (!pTarget || !m_pCurrentContainerRecord || | 724 if (!pTarget || !m_pCurrentContainerRecord || |
| 723 pTarget != | 725 pTarget != |
| 724 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode || | 726 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode || |
| 725 bStartNew) { | 727 bStartNew) { |
| 726 CXFA_Node* pPageArea = NULL; | 728 CXFA_Node* pPageArea = NULL; |
| 727 if (pTarget) { | 729 if (pTarget) { |
| 728 pPageArea = pTarget->GetNodeItem(XFA_NODEITEM_Parent); | 730 pPageArea = pTarget->GetNodeItem(XFA_NODEITEM_Parent); |
| 729 } | 731 } |
| 730 pPageArea = GetNextAvailPageArea(pPageArea, pTarget); | 732 pPageArea = GetNextAvailPageArea(pPageArea, pTarget); |
| 731 bRet = pPageArea != NULL; | 733 bRet = pPageArea != NULL; |
| 732 } | 734 } |
| 733 break; | 735 break; |
| 734 case XFA_ATTRIBUTEENUM_PageArea: | 736 case XFA_ATTRIBUTEENUM_PageArea: |
| 735 if (pTarget && pTarget->GetClassID() != XFA_Element::PageArea) { | 737 if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { |
| 736 pTarget = NULL; | 738 pTarget = NULL; |
| 737 } | 739 } |
| 738 if (!pTarget || !m_pCurrentContainerRecord || | 740 if (!pTarget || !m_pCurrentContainerRecord || |
| 739 pTarget != GetCurrentContainerRecord()->pCurPageArea->m_pFormNode || | 741 pTarget != GetCurrentContainerRecord()->pCurPageArea->m_pFormNode || |
| 740 bStartNew) { | 742 bStartNew) { |
| 741 CXFA_Node* pPageArea = GetNextAvailPageArea(pTarget, NULL, TRUE); | 743 CXFA_Node* pPageArea = GetNextAvailPageArea(pTarget, NULL, TRUE); |
| 742 bRet = pPageArea != NULL; | 744 bRet = pPageArea != NULL; |
| 743 } | 745 } |
| 744 break; | 746 break; |
| 745 case XFA_ATTRIBUTEENUM_PageOdd: | 747 case XFA_ATTRIBUTEENUM_PageOdd: |
| 746 if (pTarget && pTarget->GetClassID() != XFA_Element::PageArea) { | 748 if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { |
| 747 pTarget = NULL; | 749 pTarget = NULL; |
| 748 } | 750 } |
| 749 break; | 751 break; |
| 750 case XFA_ATTRIBUTEENUM_PageEven: | 752 case XFA_ATTRIBUTEENUM_PageEven: |
| 751 if (pTarget && pTarget->GetClassID() != XFA_Element::PageArea) { | 753 if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { |
| 752 pTarget = NULL; | 754 pTarget = NULL; |
| 753 } | 755 } |
| 754 break; | 756 break; |
| 755 case XFA_ATTRIBUTEENUM_Auto: | 757 case XFA_ATTRIBUTEENUM_Auto: |
| 756 default: | 758 default: |
| 757 break; | 759 break; |
| 758 } | 760 } |
| 759 return bRet; | 761 return bRet; |
| 760 } | 762 } |
| 761 FX_BOOL CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( | 763 FX_BOOL CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( |
| 762 CXFA_Node* pCurNode, | 764 CXFA_Node* pCurNode, |
| 763 FX_BOOL bBefore, | 765 FX_BOOL bBefore, |
| 764 CXFA_Node*& pBreakLeaderTemplate, | 766 CXFA_Node*& pBreakLeaderTemplate, |
| 765 CXFA_Node*& pBreakTrailerTemplate) { | 767 CXFA_Node*& pBreakTrailerTemplate) { |
| 766 XFA_Element eType = pCurNode->GetClassID(); | 768 XFA_Element eType = pCurNode->GetElementType(); |
| 767 switch (eType) { | 769 switch (eType) { |
| 768 case XFA_Element::BreakBefore: | 770 case XFA_Element::BreakBefore: |
| 769 case XFA_Element::BreakAfter: { | 771 case XFA_Element::BreakAfter: { |
| 770 CFX_WideStringC wsBreakLeader, wsBreakTrailer; | 772 CFX_WideStringC wsBreakLeader, wsBreakTrailer; |
| 771 CXFA_Node* pFormNode = pCurNode->GetNodeItem( | 773 CXFA_Node* pFormNode = pCurNode->GetNodeItem( |
| 772 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); | 774 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); |
| 773 CXFA_Node* pContainer = pFormNode->GetTemplateNode(); | 775 CXFA_Node* pContainer = pFormNode->GetTemplateNode(); |
| 774 FX_BOOL bStartNew = pCurNode->GetInteger(XFA_ATTRIBUTE_StartNew) != 0; | 776 FX_BOOL bStartNew = pCurNode->GetInteger(XFA_ATTRIBUTE_StartNew) != 0; |
| 775 CXFA_Node* pScript = pCurNode->GetFirstChildByClass(XFA_Element::Script); | 777 CXFA_Node* pScript = pCurNode->GetFirstChildByClass(XFA_Element::Script); |
| 776 if (pScript && !XFA_LayoutPageMgr_RunBreakTestScript(pScript)) { | 778 if (pScript && !XFA_LayoutPageMgr_RunBreakTestScript(pScript)) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 795 eType == XFA_Element::BreakBefore) { | 797 eType == XFA_Element::BreakBefore) { |
| 796 CXFA_Node* pParentNode = pFormNode->GetNodeItem( | 798 CXFA_Node* pParentNode = pFormNode->GetNodeItem( |
| 797 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); | 799 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); |
| 798 if (!pParentNode || | 800 if (!pParentNode || |
| 799 pFormNode != | 801 pFormNode != |
| 800 pParentNode->GetNodeItem(XFA_NODEITEM_FirstChild, | 802 pParentNode->GetNodeItem(XFA_NODEITEM_FirstChild, |
| 801 XFA_ObjectType::ContainerNode)) { | 803 XFA_ObjectType::ContainerNode)) { |
| 802 break; | 804 break; |
| 803 } | 805 } |
| 804 pParentNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); | 806 pParentNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 805 if (!pParentNode || pParentNode->GetClassID() != XFA_Element::Form) { | 807 if (!pParentNode || |
| 808 pParentNode->GetElementType() != XFA_Element::Form) { |
| 806 break; | 809 break; |
| 807 } | 810 } |
| 808 return TRUE; | 811 return TRUE; |
| 809 } | 812 } |
| 810 } | 813 } |
| 811 } break; | 814 } break; |
| 812 case XFA_Element::Break: { | 815 case XFA_Element::Break: { |
| 813 FX_BOOL bStartNew = pCurNode->GetInteger(XFA_ATTRIBUTE_StartNew) != 0; | 816 FX_BOOL bStartNew = pCurNode->GetInteger(XFA_ATTRIBUTE_StartNew) != 0; |
| 814 CFX_WideStringC wsTarget = pCurNode->GetCData( | 817 CFX_WideStringC wsTarget = pCurNode->GetCData( |
| 815 bBefore ? XFA_ATTRIBUTE_BeforeTarget : XFA_ATTRIBUTE_AfterTarget); | 818 bBefore ? XFA_ATTRIBUTE_BeforeTarget : XFA_ATTRIBUTE_AfterTarget); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 return FALSE; | 893 return FALSE; |
| 891 } | 894 } |
| 892 CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, | 895 CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, |
| 893 CXFA_Node*& pLeaderTemplate, | 896 CXFA_Node*& pLeaderTemplate, |
| 894 CXFA_Node*& pTrailerTemplate, | 897 CXFA_Node*& pTrailerTemplate, |
| 895 FX_BOOL bCreatePage) { | 898 FX_BOOL bCreatePage) { |
| 896 CXFA_Node* pContainer = | 899 CXFA_Node* pContainer = |
| 897 pOverflowNode | 900 pOverflowNode |
| 898 ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) | 901 ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) |
| 899 ->GetTemplateNode(); | 902 ->GetTemplateNode(); |
| 900 if (pOverflowNode->GetClassID() == XFA_Element::Break) { | 903 if (pOverflowNode->GetElementType() == XFA_Element::Break) { |
| 901 CFX_WideStringC wsOverflowLeader; | 904 CFX_WideStringC wsOverflowLeader; |
| 902 CFX_WideStringC wsOverflowTarget; | 905 CFX_WideStringC wsOverflowTarget; |
| 903 CFX_WideStringC wsOverflowTrailer; | 906 CFX_WideStringC wsOverflowTrailer; |
| 904 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); | 907 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); |
| 905 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); | 908 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); |
| 906 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); | 909 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); |
| 907 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || | 910 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || |
| 908 !wsOverflowTarget.IsEmpty()) { | 911 !wsOverflowTarget.IsEmpty()) { |
| 909 if (!wsOverflowTarget.IsEmpty() && bCreatePage && | 912 if (!wsOverflowTarget.IsEmpty() && bCreatePage && |
| 910 !m_bCreateOverFlowPage) { | 913 !m_bCreateOverFlowPage) { |
| 911 CXFA_Node* pTarget = | 914 CXFA_Node* pTarget = |
| 912 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); | 915 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); |
| 913 if (pTarget) { | 916 if (pTarget) { |
| 914 m_bCreateOverFlowPage = TRUE; | 917 m_bCreateOverFlowPage = TRUE; |
| 915 switch (pTarget->GetClassID()) { | 918 switch (pTarget->GetElementType()) { |
| 916 case XFA_Element::PageArea: | 919 case XFA_Element::PageArea: |
| 917 RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_PageArea, | 920 RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_PageArea, |
| 918 pTarget, TRUE); | 921 pTarget, TRUE); |
| 919 break; | 922 break; |
| 920 case XFA_Element::ContentArea: | 923 case XFA_Element::ContentArea: |
| 921 RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_ContentArea, | 924 RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_ContentArea, |
| 922 pTarget, TRUE); | 925 pTarget, TRUE); |
| 923 break; | 926 break; |
| 924 default: | 927 default: |
| 925 break; | 928 break; |
| 926 } | 929 } |
| 927 } | 930 } |
| 928 } | 931 } |
| 929 if (!bCreatePage) { | 932 if (!bCreatePage) { |
| 930 pLeaderTemplate = | 933 pLeaderTemplate = |
| 931 ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); | 934 ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); |
| 932 pTrailerTemplate = | 935 pTrailerTemplate = |
| 933 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); | 936 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); |
| 934 } | 937 } |
| 935 return pOverflowNode; | 938 return pOverflowNode; |
| 936 } | 939 } |
| 937 return NULL; | 940 return NULL; |
| 938 } else if (pOverflowNode->GetClassID() == XFA_Element::Overflow) { | 941 } else if (pOverflowNode->GetElementType() == XFA_Element::Overflow) { |
| 939 CFX_WideStringC wsOverflowLeader; | 942 CFX_WideStringC wsOverflowLeader; |
| 940 CFX_WideStringC wsOverflowTrailer; | 943 CFX_WideStringC wsOverflowTrailer; |
| 941 CFX_WideStringC wsOverflowTarget; | 944 CFX_WideStringC wsOverflowTarget; |
| 942 pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); | 945 pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); |
| 943 pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); | 946 pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); |
| 944 pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget); | 947 pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget); |
| 945 if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) { | 948 if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) { |
| 946 CXFA_Node* pTarget = | 949 CXFA_Node* pTarget = |
| 947 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); | 950 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); |
| 948 if (pTarget) { | 951 if (pTarget) { |
| 949 m_bCreateOverFlowPage = TRUE; | 952 m_bCreateOverFlowPage = TRUE; |
| 950 switch (pTarget->GetClassID()) { | 953 switch (pTarget->GetElementType()) { |
| 951 case XFA_Element::PageArea: | 954 case XFA_Element::PageArea: |
| 952 RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_PageArea, pTarget, | 955 RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_PageArea, pTarget, |
| 953 TRUE); | 956 TRUE); |
| 954 break; | 957 break; |
| 955 case XFA_Element::ContentArea: | 958 case XFA_Element::ContentArea: |
| 956 RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_ContentArea, | 959 RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_ContentArea, |
| 957 pTarget, TRUE); | 960 pTarget, TRUE); |
| 958 break; | 961 break; |
| 959 default: | 962 default: |
| 960 break; | 963 break; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 974 FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, | 977 FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, |
| 975 CXFA_Node*& pLeaderNode, | 978 CXFA_Node*& pLeaderNode, |
| 976 CXFA_Node*& pTrailerNode, | 979 CXFA_Node*& pTrailerNode, |
| 977 FX_BOOL bDataMerge, | 980 FX_BOOL bDataMerge, |
| 978 FX_BOOL bCreatePage) { | 981 FX_BOOL bCreatePage) { |
| 979 if (pFormNode == NULL) { | 982 if (pFormNode == NULL) { |
| 980 return FALSE; | 983 return FALSE; |
| 981 } | 984 } |
| 982 CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; | 985 CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; |
| 983 FX_BOOL bIsOverflowNode = FALSE; | 986 FX_BOOL bIsOverflowNode = FALSE; |
| 984 if (pFormNode->GetClassID() == XFA_Element::Overflow || | 987 if (pFormNode->GetElementType() == XFA_Element::Overflow || |
| 985 pFormNode->GetClassID() == XFA_Element::Break) { | 988 pFormNode->GetElementType() == XFA_Element::Break) { |
| 986 bIsOverflowNode = TRUE; | 989 bIsOverflowNode = TRUE; |
| 987 } | 990 } |
| 988 for (CXFA_Node* pCurNode = | 991 for (CXFA_Node* pCurNode = |
| 989 bIsOverflowNode ? pFormNode | 992 bIsOverflowNode ? pFormNode |
| 990 : pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 993 : pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 991 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { | 994 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { |
| 992 if (BreakOverflow(pCurNode, pLeaderTemplate, pTrailerTemplate, | 995 if (BreakOverflow(pCurNode, pLeaderTemplate, pTrailerTemplate, |
| 993 bCreatePage)) { | 996 bCreatePage)) { |
| 994 if (bIsOverflowNode) { | 997 if (bIsOverflowNode) { |
| 995 pFormNode = pCurNode->GetNodeItem(XFA_NODEITEM_Parent); | 998 pFormNode = pCurNode->GetNodeItem(XFA_NODEITEM_Parent); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1024 } | 1027 } |
| 1025 FX_BOOL CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( | 1028 FX_BOOL CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( |
| 1026 CXFA_Node* pBookendNode, | 1029 CXFA_Node* pBookendNode, |
| 1027 FX_BOOL bLeader, | 1030 FX_BOOL bLeader, |
| 1028 CXFA_Node*& pBookendAppendTemplate) { | 1031 CXFA_Node*& pBookendAppendTemplate) { |
| 1029 CFX_WideStringC wsBookendLeader; | 1032 CFX_WideStringC wsBookendLeader; |
| 1030 CXFA_Node* pContainer = | 1033 CXFA_Node* pContainer = |
| 1031 pBookendNode | 1034 pBookendNode |
| 1032 ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) | 1035 ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) |
| 1033 ->GetTemplateNode(); | 1036 ->GetTemplateNode(); |
| 1034 if (pBookendNode->GetClassID() == XFA_Element::Break) { | 1037 if (pBookendNode->GetElementType() == XFA_Element::Break) { |
| 1035 pBookendNode->TryCData( | 1038 pBookendNode->TryCData( |
| 1036 bLeader ? XFA_ATTRIBUTE_BookendLeader : XFA_ATTRIBUTE_BookendTrailer, | 1039 bLeader ? XFA_ATTRIBUTE_BookendLeader : XFA_ATTRIBUTE_BookendTrailer, |
| 1037 wsBookendLeader); | 1040 wsBookendLeader); |
| 1038 if (!wsBookendLeader.IsEmpty()) { | 1041 if (!wsBookendLeader.IsEmpty()) { |
| 1039 pBookendAppendTemplate = | 1042 pBookendAppendTemplate = |
| 1040 ResolveBreakTarget(pContainer, FALSE, wsBookendLeader); | 1043 ResolveBreakTarget(pContainer, FALSE, wsBookendLeader); |
| 1041 return TRUE; | 1044 return TRUE; |
| 1042 } | 1045 } |
| 1043 return FALSE; | 1046 return FALSE; |
| 1044 } else if (pBookendNode->GetClassID() == XFA_Element::Bookend) { | 1047 } else if (pBookendNode->GetElementType() == XFA_Element::Bookend) { |
| 1045 pBookendNode->TryCData( | 1048 pBookendNode->TryCData( |
| 1046 bLeader ? XFA_ATTRIBUTE_Leader : XFA_ATTRIBUTE_Trailer, | 1049 bLeader ? XFA_ATTRIBUTE_Leader : XFA_ATTRIBUTE_Trailer, |
| 1047 wsBookendLeader); | 1050 wsBookendLeader); |
| 1048 pBookendAppendTemplate = | 1051 pBookendAppendTemplate = |
| 1049 ResolveBreakTarget(pContainer, TRUE, wsBookendLeader); | 1052 ResolveBreakTarget(pContainer, TRUE, wsBookendLeader); |
| 1050 return TRUE; | 1053 return TRUE; |
| 1051 } | 1054 } |
| 1052 return FALSE; | 1055 return FALSE; |
| 1053 } | 1056 } |
| 1054 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet( | 1057 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 if (iMax >= 0 && iMax <= iPageSetCount) { | 1094 if (iMax >= 0 && iMax <= iPageSetCount) { |
| 1092 return FALSE; | 1095 return FALSE; |
| 1093 } | 1096 } |
| 1094 } | 1097 } |
| 1095 FX_BOOL bRes = FALSE; | 1098 FX_BOOL bRes = FALSE; |
| 1096 CXFA_Node* pCurrentNode = | 1099 CXFA_Node* pCurrentNode = |
| 1097 pStartChild ? pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling) | 1100 pStartChild ? pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling) |
| 1098 : pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); | 1101 : pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1099 for (; pCurrentNode; | 1102 for (; pCurrentNode; |
| 1100 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1103 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1101 if (pCurrentNode->GetClassID() == XFA_Element::PageArea) { | 1104 if (pCurrentNode->GetElementType() == XFA_Element::PageArea) { |
| 1102 if ((pTargetPageArea == pCurrentNode || pTargetPageArea == NULL)) { | 1105 if ((pTargetPageArea == pCurrentNode || pTargetPageArea == NULL)) { |
| 1103 if (pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea) == | 1106 if (pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea) == |
| 1104 NULL) { | 1107 NULL) { |
| 1105 if (pTargetPageArea == pCurrentNode) { | 1108 if (pTargetPageArea == pCurrentNode) { |
| 1106 CreateMinPageRecord(pCurrentNode, TRUE); | 1109 CreateMinPageRecord(pCurrentNode, TRUE); |
| 1107 pTargetPageArea = NULL; | 1110 pTargetPageArea = NULL; |
| 1108 } | 1111 } |
| 1109 continue; | 1112 continue; |
| 1110 } | 1113 } |
| 1111 if (!bQuery) { | 1114 if (!bQuery) { |
| 1112 CXFA_ContainerRecord* pNewRecord = | 1115 CXFA_ContainerRecord* pNewRecord = |
| 1113 CreateContainerRecord(pCurrentNode, pStartChild == NULL); | 1116 CreateContainerRecord(pCurrentNode, pStartChild == NULL); |
| 1114 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 1117 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); |
| 1115 if (pTargetContentArea == NULL) { | 1118 if (pTargetContentArea == NULL) { |
| 1116 pTargetContentArea = | 1119 pTargetContentArea = |
| 1117 pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea); | 1120 pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea); |
| 1118 } | 1121 } |
| 1119 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); | 1122 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); |
| 1120 } | 1123 } |
| 1121 m_pCurPageArea = pCurrentNode; | 1124 m_pCurPageArea = pCurrentNode; |
| 1122 m_nCurPageCount = 1; | 1125 m_nCurPageCount = 1; |
| 1123 bRes = TRUE; | 1126 bRes = TRUE; |
| 1124 break; | 1127 break; |
| 1125 } | 1128 } |
| 1126 if (!bQuery) { | 1129 if (!bQuery) { |
| 1127 CreateMinPageRecord(pCurrentNode, FALSE); | 1130 CreateMinPageRecord(pCurrentNode, FALSE); |
| 1128 } | 1131 } |
| 1129 } else if (pCurrentNode->GetClassID() == XFA_Element::PageSet) { | 1132 } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { |
| 1130 if (FindPageAreaFromPageSet_Ordered(pCurrentNode, NULL, pTargetPageArea, | 1133 if (FindPageAreaFromPageSet_Ordered(pCurrentNode, NULL, pTargetPageArea, |
| 1131 pTargetContentArea, bNewPage, | 1134 pTargetContentArea, bNewPage, |
| 1132 bQuery)) { | 1135 bQuery)) { |
| 1133 bRes = TRUE; | 1136 bRes = TRUE; |
| 1134 break; | 1137 break; |
| 1135 } | 1138 } |
| 1136 if (!bQuery) { | 1139 if (!bQuery) { |
| 1137 CreateMinPageSetRecord(pCurrentNode, TRUE); | 1140 CreateMinPageSetRecord(pCurrentNode, TRUE); |
| 1138 } | 1141 } |
| 1139 } | 1142 } |
| 1140 } | 1143 } |
| 1141 if (!pStartChild && bRes && !bQuery) { | 1144 if (!pStartChild && bRes && !bQuery) { |
| 1142 m_pPageSetMap.SetAt(pPageSet, ++iPageSetCount); | 1145 m_pPageSetMap.SetAt(pPageSet, ++iPageSetCount); |
| 1143 } | 1146 } |
| 1144 return bRes; | 1147 return bRes; |
| 1145 } | 1148 } |
| 1146 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( | 1149 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( |
| 1147 CXFA_Node* pPageSet, | 1150 CXFA_Node* pPageSet, |
| 1148 CXFA_Node* pStartChild, | 1151 CXFA_Node* pStartChild, |
| 1149 CXFA_Node* pTargetPageArea, | 1152 CXFA_Node* pTargetPageArea, |
| 1150 CXFA_Node* pTargetContentArea, | 1153 CXFA_Node* pTargetContentArea, |
| 1151 FX_BOOL bNewPage, | 1154 FX_BOOL bNewPage, |
| 1152 FX_BOOL bQuery, | 1155 FX_BOOL bQuery, |
| 1153 XFA_ATTRIBUTEENUM ePreferredPosition) { | 1156 XFA_ATTRIBUTEENUM ePreferredPosition) { |
| 1154 const XFA_ATTRIBUTEENUM eFallbackPosition = XFA_ATTRIBUTEENUM_Any; | 1157 const XFA_ATTRIBUTEENUM eFallbackPosition = XFA_ATTRIBUTEENUM_Any; |
| 1155 CXFA_Node *pPreferredPageArea = NULL, *pFallbackPageArea = NULL; | 1158 CXFA_Node *pPreferredPageArea = NULL, *pFallbackPageArea = NULL; |
| 1156 CXFA_Node* pCurrentNode = NULL; | 1159 CXFA_Node* pCurrentNode = NULL; |
| 1157 if (!pStartChild || pStartChild->GetClassID() == XFA_Element::PageArea) { | 1160 if (!pStartChild || pStartChild->GetElementType() == XFA_Element::PageArea) { |
| 1158 pCurrentNode = pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); | 1161 pCurrentNode = pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1159 } else { | 1162 } else { |
| 1160 pCurrentNode = pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling); | 1163 pCurrentNode = pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 1161 } | 1164 } |
| 1162 for (; pCurrentNode; | 1165 for (; pCurrentNode; |
| 1163 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1166 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1164 if (pCurrentNode->GetClassID() == XFA_Element::PageArea) { | 1167 if (pCurrentNode->GetElementType() == XFA_Element::PageArea) { |
| 1165 if (!MatchPageAreaOddOrEven(pCurrentNode, FALSE)) { | 1168 if (!MatchPageAreaOddOrEven(pCurrentNode, FALSE)) { |
| 1166 continue; | 1169 continue; |
| 1167 } | 1170 } |
| 1168 XFA_ATTRIBUTEENUM eCurPagePosition = | 1171 XFA_ATTRIBUTEENUM eCurPagePosition = |
| 1169 pCurrentNode->GetEnum(XFA_ATTRIBUTE_PagePosition); | 1172 pCurrentNode->GetEnum(XFA_ATTRIBUTE_PagePosition); |
| 1170 if (ePreferredPosition == XFA_ATTRIBUTEENUM_Last) { | 1173 if (ePreferredPosition == XFA_ATTRIBUTEENUM_Last) { |
| 1171 if (eCurPagePosition != ePreferredPosition) { | 1174 if (eCurPagePosition != ePreferredPosition) { |
| 1172 continue; | 1175 continue; |
| 1173 } | 1176 } |
| 1174 if (m_ePageSetMode == XFA_ATTRIBUTEENUM_SimplexPaginated || | 1177 if (m_ePageSetMode == XFA_ATTRIBUTEENUM_SimplexPaginated || |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 !pFallbackPageArea) { | 1217 !pFallbackPageArea) { |
| 1215 pFallbackPageArea = pCurrentNode; | 1218 pFallbackPageArea = pCurrentNode; |
| 1216 } | 1219 } |
| 1217 } else if (pTargetPageArea && | 1220 } else if (pTargetPageArea && |
| 1218 !MatchPageAreaOddOrEven(pTargetPageArea, FALSE)) { | 1221 !MatchPageAreaOddOrEven(pTargetPageArea, FALSE)) { |
| 1219 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1222 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); |
| 1220 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 1223 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); |
| 1221 AddContentAreaLayoutItem(pNewRecord, pCurrentNode->GetFirstChildByClass( | 1224 AddContentAreaLayoutItem(pNewRecord, pCurrentNode->GetFirstChildByClass( |
| 1222 XFA_Element::ContentArea)); | 1225 XFA_Element::ContentArea)); |
| 1223 } | 1226 } |
| 1224 } else if (pCurrentNode->GetClassID() == XFA_Element::PageSet) { | 1227 } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { |
| 1225 if (FindPageAreaFromPageSet_SimplexDuplex( | 1228 if (FindPageAreaFromPageSet_SimplexDuplex( |
| 1226 pCurrentNode, NULL, pTargetPageArea, pTargetContentArea, bNewPage, | 1229 pCurrentNode, NULL, pTargetPageArea, pTargetContentArea, bNewPage, |
| 1227 bQuery, ePreferredPosition)) { | 1230 bQuery, ePreferredPosition)) { |
| 1228 break; | 1231 break; |
| 1229 } | 1232 } |
| 1230 } | 1233 } |
| 1231 } | 1234 } |
| 1232 CXFA_Node* pCurPageArea = NULL; | 1235 CXFA_Node* pCurPageArea = NULL; |
| 1233 if (pPreferredPageArea) { | 1236 if (pPreferredPageArea) { |
| 1234 pCurPageArea = pPreferredPageArea; | 1237 pCurPageArea = pPreferredPageArea; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 AddContentAreaLayoutItem(pNewRecord, pContentArea); | 1370 AddContentAreaLayoutItem(pNewRecord, pContentArea); |
| 1368 return TRUE; | 1371 return TRUE; |
| 1369 } | 1372 } |
| 1370 void CXFA_LayoutPageMgr::InitPageSetMap() { | 1373 void CXFA_LayoutPageMgr::InitPageSetMap() { |
| 1371 if (!IsPageSetRootOrderedOccurrence()) { | 1374 if (!IsPageSetRootOrderedOccurrence()) { |
| 1372 return; | 1375 return; |
| 1373 } | 1376 } |
| 1374 CXFA_NodeIterator sIterator(m_pTemplatePageSetRoot); | 1377 CXFA_NodeIterator sIterator(m_pTemplatePageSetRoot); |
| 1375 for (CXFA_Node* pPageSetNode = sIterator.GetCurrent(); pPageSetNode; | 1378 for (CXFA_Node* pPageSetNode = sIterator.GetCurrent(); pPageSetNode; |
| 1376 pPageSetNode = sIterator.MoveToNext()) { | 1379 pPageSetNode = sIterator.MoveToNext()) { |
| 1377 if (pPageSetNode->GetClassID() == XFA_Element::PageSet) { | 1380 if (pPageSetNode->GetElementType() == XFA_Element::PageSet) { |
| 1378 XFA_ATTRIBUTEENUM eRelation = | 1381 XFA_ATTRIBUTEENUM eRelation = |
| 1379 pPageSetNode->GetEnum(XFA_ATTRIBUTE_Relation); | 1382 pPageSetNode->GetEnum(XFA_ATTRIBUTE_Relation); |
| 1380 if (eRelation == XFA_ATTRIBUTEENUM_OrderedOccurrence) { | 1383 if (eRelation == XFA_ATTRIBUTEENUM_OrderedOccurrence) { |
| 1381 m_pPageSetMap.SetAt(pPageSetNode, 0); | 1384 m_pPageSetMap.SetAt(pPageSetNode, 0); |
| 1382 } | 1385 } |
| 1383 } | 1386 } |
| 1384 } | 1387 } |
| 1385 } | 1388 } |
| 1386 int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea, | 1389 int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea, |
| 1387 FX_BOOL bTargetPageArea, | 1390 FX_BOOL bTargetPageArea, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1424 } | 1427 } |
| 1425 CXFA_Node* pOccurNode = pPageSet->GetFirstChildByClass(XFA_Element::Occur); | 1428 CXFA_Node* pOccurNode = pPageSet->GetFirstChildByClass(XFA_Element::Occur); |
| 1426 int32_t iMin = 0; | 1429 int32_t iMin = 0; |
| 1427 if (pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE)) { | 1430 if (pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE)) { |
| 1428 if (iCurSetCount < iMin) { | 1431 if (iCurSetCount < iMin) { |
| 1429 for (int32_t i = 0; i < iMin - iCurSetCount; i++) { | 1432 for (int32_t i = 0; i < iMin - iCurSetCount; i++) { |
| 1430 for (CXFA_Node* pCurrentPageNode = | 1433 for (CXFA_Node* pCurrentPageNode = |
| 1431 pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); | 1434 pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1432 pCurrentPageNode; pCurrentPageNode = pCurrentPageNode->GetNodeItem( | 1435 pCurrentPageNode; pCurrentPageNode = pCurrentPageNode->GetNodeItem( |
| 1433 XFA_NODEITEM_NextSibling)) { | 1436 XFA_NODEITEM_NextSibling)) { |
| 1434 if (pCurrentPageNode->GetClassID() == XFA_Element::PageArea) { | 1437 if (pCurrentPageNode->GetElementType() == XFA_Element::PageArea) { |
| 1435 CreateMinPageRecord(pCurrentPageNode, FALSE); | 1438 CreateMinPageRecord(pCurrentPageNode, FALSE); |
| 1436 } else if (pCurrentPageNode->GetClassID() == XFA_Element::PageSet) { | 1439 } else if (pCurrentPageNode->GetElementType() == |
| 1440 XFA_Element::PageSet) { |
| 1437 CreateMinPageSetRecord(pCurrentPageNode, TRUE); | 1441 CreateMinPageSetRecord(pCurrentPageNode, TRUE); |
| 1438 } | 1442 } |
| 1439 } | 1443 } |
| 1440 } | 1444 } |
| 1441 m_pPageSetMap.SetAt(pPageSet, iMin); | 1445 m_pPageSetMap.SetAt(pPageSet, iMin); |
| 1442 } | 1446 } |
| 1443 } | 1447 } |
| 1444 } | 1448 } |
| 1445 void CXFA_LayoutPageMgr::CreateNextMinRecord(CXFA_Node* pRecordNode) { | 1449 void CXFA_LayoutPageMgr::CreateNextMinRecord(CXFA_Node* pRecordNode) { |
| 1446 if (pRecordNode == NULL) { | 1450 if (pRecordNode == NULL) { |
| 1447 return; | 1451 return; |
| 1448 } | 1452 } |
| 1449 for (CXFA_Node* pCurrentNode = | 1453 for (CXFA_Node* pCurrentNode = |
| 1450 pRecordNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 1454 pRecordNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 1451 pCurrentNode; | 1455 pCurrentNode; |
| 1452 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1456 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1453 if (pCurrentNode->GetClassID() == XFA_Element::PageArea) { | 1457 if (pCurrentNode->GetElementType() == XFA_Element::PageArea) { |
| 1454 CreateMinPageRecord(pCurrentNode, FALSE); | 1458 CreateMinPageRecord(pCurrentNode, FALSE); |
| 1455 } else if (pCurrentNode->GetClassID() == XFA_Element::PageSet) { | 1459 } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { |
| 1456 CreateMinPageSetRecord(pCurrentNode, TRUE); | 1460 CreateMinPageSetRecord(pCurrentNode, TRUE); |
| 1457 } | 1461 } |
| 1458 } | 1462 } |
| 1459 } | 1463 } |
| 1460 void CXFA_LayoutPageMgr::ProcessLastPageSet() { | 1464 void CXFA_LayoutPageMgr::ProcessLastPageSet() { |
| 1461 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); | 1465 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); |
| 1462 CreateNextMinRecord(m_pCurPageArea); | 1466 CreateNextMinRecord(m_pCurPageArea); |
| 1463 CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent); | 1467 CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent); |
| 1464 while (TRUE) { | 1468 while (TRUE) { |
| 1465 CreateMinPageSetRecord(pPageSet); | 1469 CreateMinPageSetRecord(pPageSet); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 } | 1593 } |
| 1590 } | 1594 } |
| 1591 } | 1595 } |
| 1592 if (pCurLayoutItem->m_pFirstChild) { | 1596 if (pCurLayoutItem->m_pFirstChild) { |
| 1593 SaveLayoutItem(pCurLayoutItem); | 1597 SaveLayoutItem(pCurLayoutItem); |
| 1594 } | 1598 } |
| 1595 pCurLayoutItem->m_pParent = NULL; | 1599 pCurLayoutItem->m_pParent = NULL; |
| 1596 pCurLayoutItem->m_pNextSibling = NULL; | 1600 pCurLayoutItem->m_pNextSibling = NULL; |
| 1597 pCurLayoutItem->m_pFirstChild = NULL; | 1601 pCurLayoutItem->m_pFirstChild = NULL; |
| 1598 if (!pCurLayoutItem->IsContentLayoutItem() && | 1602 if (!pCurLayoutItem->IsContentLayoutItem() && |
| 1599 pCurLayoutItem->m_pFormNode->GetClassID() != XFA_Element::PageArea) { | 1603 pCurLayoutItem->m_pFormNode->GetElementType() != |
| 1604 XFA_Element::PageArea) { |
| 1600 delete pCurLayoutItem; | 1605 delete pCurLayoutItem; |
| 1601 } | 1606 } |
| 1602 pCurLayoutItem = pNextLayoutItem; | 1607 pCurLayoutItem = pNextLayoutItem; |
| 1603 } | 1608 } |
| 1604 } | 1609 } |
| 1605 CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( | 1610 CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( |
| 1606 CXFA_Node* pFormNode, | 1611 CXFA_Node* pFormNode, |
| 1607 CXFA_LayoutContext* pLayoutContext) { | 1612 CXFA_LayoutContext* pLayoutContext) { |
| 1608 for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 1613 for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1609 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { | 1614 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { |
| 1610 if (pCurNode->GetClassID() == XFA_Element::Break) { | 1615 if (pCurNode->GetElementType() == XFA_Element::Break) { |
| 1611 CFX_WideStringC wsOverflowLeader; | 1616 CFX_WideStringC wsOverflowLeader; |
| 1612 CFX_WideStringC wsOverflowTarget; | 1617 CFX_WideStringC wsOverflowTarget; |
| 1613 CFX_WideStringC wsOverflowTrailer; | 1618 CFX_WideStringC wsOverflowTrailer; |
| 1614 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); | 1619 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); |
| 1615 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); | 1620 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); |
| 1616 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); | 1621 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); |
| 1617 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || | 1622 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || |
| 1618 !wsOverflowTarget.IsEmpty()) { | 1623 !wsOverflowTarget.IsEmpty()) { |
| 1619 return pCurNode; | 1624 return pCurNode; |
| 1620 } | 1625 } |
| 1621 return NULL; | 1626 return NULL; |
| 1622 } else if (pCurNode->GetClassID() == XFA_Element::Overflow) { | 1627 } else if (pCurNode->GetElementType() == XFA_Element::Overflow) { |
| 1623 return pCurNode; | 1628 return pCurNode; |
| 1624 } | 1629 } |
| 1625 } | 1630 } |
| 1626 return NULL; | 1631 return NULL; |
| 1627 } | 1632 } |
| 1628 | 1633 |
| 1629 void CXFA_LayoutPageMgr::MergePageSetContents() { | 1634 void CXFA_LayoutPageMgr::MergePageSetContents() { |
| 1630 CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument(); | 1635 CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument(); |
| 1631 CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); | 1636 CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); |
| 1632 CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout(); | 1637 CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1651 } | 1656 } |
| 1652 int32_t iIndex = 0; | 1657 int32_t iIndex = 0; |
| 1653 for (; pRootLayout; | 1658 for (; pRootLayout; |
| 1654 pRootLayout = (CXFA_ContainerLayoutItem*)pRootLayout->m_pNextSibling) { | 1659 pRootLayout = (CXFA_ContainerLayoutItem*)pRootLayout->m_pNextSibling) { |
| 1655 CXFA_Node* pPendingPageSet = nullptr; | 1660 CXFA_Node* pPendingPageSet = nullptr; |
| 1656 CXFA_NodeIteratorTemplate< | 1661 CXFA_NodeIteratorTemplate< |
| 1657 CXFA_ContainerLayoutItem, | 1662 CXFA_ContainerLayoutItem, |
| 1658 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> | 1663 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> |
| 1659 iterator(pRootLayout); | 1664 iterator(pRootLayout); |
| 1660 CXFA_ContainerLayoutItem* pRootPageSetContainerItem = iterator.GetCurrent(); | 1665 CXFA_ContainerLayoutItem* pRootPageSetContainerItem = iterator.GetCurrent(); |
| 1661 ASSERT(pRootPageSetContainerItem->m_pFormNode->GetClassID() == | 1666 ASSERT(pRootPageSetContainerItem->m_pFormNode->GetElementType() == |
| 1662 XFA_Element::PageSet); | 1667 XFA_Element::PageSet); |
| 1663 if (iIndex < pDocument->m_pPendingPageSet.GetSize()) { | 1668 if (iIndex < pDocument->m_pPendingPageSet.GetSize()) { |
| 1664 pPendingPageSet = pDocument->m_pPendingPageSet.GetAt(iIndex); | 1669 pPendingPageSet = pDocument->m_pPendingPageSet.GetAt(iIndex); |
| 1665 iIndex++; | 1670 iIndex++; |
| 1666 } | 1671 } |
| 1667 if (!pPendingPageSet) { | 1672 if (!pPendingPageSet) { |
| 1668 if (pRootPageSetContainerItem->m_pFormNode->GetPacketID() == | 1673 if (pRootPageSetContainerItem->m_pFormNode->GetPacketID() == |
| 1669 XFA_XDPPACKET_Template) { | 1674 XFA_XDPPACKET_Template) { |
| 1670 pPendingPageSet = | 1675 pPendingPageSet = |
| 1671 pRootPageSetContainerItem->m_pFormNode->CloneTemplateToForm(FALSE); | 1676 pRootPageSetContainerItem->m_pFormNode->CloneTemplateToForm(FALSE); |
| 1672 } else { | 1677 } else { |
| 1673 pPendingPageSet = pRootPageSetContainerItem->m_pFormNode; | 1678 pPendingPageSet = pRootPageSetContainerItem->m_pFormNode; |
| 1674 } | 1679 } |
| 1675 } | 1680 } |
| 1676 if (pRootPageSetContainerItem->m_pFormNode->GetUserData( | 1681 if (pRootPageSetContainerItem->m_pFormNode->GetUserData( |
| 1677 XFA_LAYOUTITEMKEY) == pRootPageSetContainerItem) { | 1682 XFA_LAYOUTITEMKEY) == pRootPageSetContainerItem) { |
| 1678 pRootPageSetContainerItem->m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, | 1683 pRootPageSetContainerItem->m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, |
| 1679 NULL); | 1684 NULL); |
| 1680 } | 1685 } |
| 1681 pRootPageSetContainerItem->m_pFormNode = pPendingPageSet; | 1686 pRootPageSetContainerItem->m_pFormNode = pPendingPageSet; |
| 1682 pPendingPageSet->ClearFlag(XFA_NodeFlag_UnusedNode); | 1687 pPendingPageSet->ClearFlag(XFA_NodeFlag_UnusedNode); |
| 1683 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.MoveToNext(); | 1688 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.MoveToNext(); |
| 1684 pContainerItem; pContainerItem = iterator.MoveToNext()) { | 1689 pContainerItem; pContainerItem = iterator.MoveToNext()) { |
| 1685 CXFA_Node* pNode = pContainerItem->m_pFormNode; | 1690 CXFA_Node* pNode = pContainerItem->m_pFormNode; |
| 1686 if (pNode->GetPacketID() != XFA_XDPPACKET_Template) { | 1691 if (pNode->GetPacketID() != XFA_XDPPACKET_Template) { |
| 1687 continue; | 1692 continue; |
| 1688 } | 1693 } |
| 1689 switch (pNode->GetClassID()) { | 1694 switch (pNode->GetElementType()) { |
| 1690 case XFA_Element::PageSet: { | 1695 case XFA_Element::PageSet: { |
| 1691 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; | 1696 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; |
| 1692 pContainerItem->m_pFormNode = XFA_NodeMerge_CloneOrMergeContainer( | 1697 pContainerItem->m_pFormNode = XFA_NodeMerge_CloneOrMergeContainer( |
| 1693 pDocument, pParentNode, pContainerItem->m_pFormNode, TRUE); | 1698 pDocument, pParentNode, pContainerItem->m_pFormNode, TRUE); |
| 1694 } break; | 1699 } break; |
| 1695 case XFA_Element::PageArea: { | 1700 case XFA_Element::PageArea: { |
| 1696 CXFA_ContainerLayoutItem* pFormLayout = pContainerItem; | 1701 CXFA_ContainerLayoutItem* pFormLayout = pContainerItem; |
| 1697 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; | 1702 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; |
| 1698 FX_BOOL bIsExistForm = TRUE; | 1703 FX_BOOL bIsExistForm = TRUE; |
| 1699 for (int32_t iLevel = 0; iLevel < 3; iLevel++) { | 1704 for (int32_t iLevel = 0; iLevel < 3; iLevel++) { |
| 1700 pFormLayout = (CXFA_ContainerLayoutItem*)pFormLayout->m_pFirstChild; | 1705 pFormLayout = (CXFA_ContainerLayoutItem*)pFormLayout->m_pFirstChild; |
| 1701 if (iLevel == 2) { | 1706 if (iLevel == 2) { |
| 1702 while (pFormLayout && | 1707 while (pFormLayout && |
| 1703 !XFA_ItemLayoutProcessor_IsTakingSpace( | 1708 !XFA_ItemLayoutProcessor_IsTakingSpace( |
| 1704 pFormLayout->m_pFormNode)) { | 1709 pFormLayout->m_pFormNode)) { |
| 1705 pFormLayout = | 1710 pFormLayout = |
| 1706 (CXFA_ContainerLayoutItem*)pFormLayout->m_pNextSibling; | 1711 (CXFA_ContainerLayoutItem*)pFormLayout->m_pNextSibling; |
| 1707 } | 1712 } |
| 1708 } | 1713 } |
| 1709 if (pFormLayout == NULL) { | 1714 if (pFormLayout == NULL) { |
| 1710 bIsExistForm = FALSE; | 1715 bIsExistForm = FALSE; |
| 1711 break; | 1716 break; |
| 1712 } | 1717 } |
| 1713 } | 1718 } |
| 1714 if (bIsExistForm) { | 1719 if (bIsExistForm) { |
| 1715 CXFA_Node* pNewSubform = pFormLayout->m_pFormNode; | 1720 CXFA_Node* pNewSubform = pFormLayout->m_pFormNode; |
| 1716 if (pContainerItem->m_pOldSubform && | 1721 if (pContainerItem->m_pOldSubform && |
| 1717 pContainerItem->m_pOldSubform != pNewSubform) { | 1722 pContainerItem->m_pOldSubform != pNewSubform) { |
| 1718 CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( | 1723 CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( |
| 1719 pDocument, pContainerItem->m_pFormNode->GetClassID(), | 1724 pDocument, pContainerItem->m_pFormNode->GetElementType(), |
| 1720 pContainerItem->m_pFormNode->GetNameHash(), pParentNode); | 1725 pContainerItem->m_pFormNode->GetNameHash(), pParentNode); |
| 1721 CXFA_ContainerIterator sIterator(pExistingNode); | 1726 CXFA_ContainerIterator sIterator(pExistingNode); |
| 1722 for (CXFA_Node* pIter = sIterator.GetCurrent(); pIter; | 1727 for (CXFA_Node* pIter = sIterator.GetCurrent(); pIter; |
| 1723 pIter = sIterator.MoveToNext()) { | 1728 pIter = sIterator.MoveToNext()) { |
| 1724 if (pIter->GetClassID() != XFA_Element::ContentArea) { | 1729 if (pIter->GetElementType() != XFA_Element::ContentArea) { |
| 1725 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( | 1730 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( |
| 1726 pIter->GetUserData(XFA_LAYOUTITEMKEY)); | 1731 pIter->GetUserData(XFA_LAYOUTITEMKEY)); |
| 1727 if (pLayoutItem) { | 1732 if (pLayoutItem) { |
| 1728 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); | 1733 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); |
| 1729 delete pLayoutItem; | 1734 delete pLayoutItem; |
| 1730 } | 1735 } |
| 1731 } | 1736 } |
| 1732 } | 1737 } |
| 1733 if (pExistingNode) { | 1738 if (pExistingNode) { |
| 1734 pParentNode->RemoveChild(pExistingNode); | 1739 pParentNode->RemoveChild(pExistingNode); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 CXFA_Node* pPageSet = GetRootLayoutItem()->m_pFormNode; | 1775 CXFA_Node* pPageSet = GetRootLayoutItem()->m_pFormNode; |
| 1771 while (pPageSet) { | 1776 while (pPageSet) { |
| 1772 CXFA_Node* pNextPageSet = | 1777 CXFA_Node* pNextPageSet = |
| 1773 pPageSet->GetNextSameClassSibling(XFA_Element::PageSet); | 1778 pPageSet->GetNextSameClassSibling(XFA_Element::PageSet); |
| 1774 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> | 1779 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> |
| 1775 sIterator(pPageSet); | 1780 sIterator(pPageSet); |
| 1776 CXFA_Node* pNode = sIterator.GetCurrent(); | 1781 CXFA_Node* pNode = sIterator.GetCurrent(); |
| 1777 while (pNode) { | 1782 while (pNode) { |
| 1778 if (pNode->IsUnusedNode()) { | 1783 if (pNode->IsUnusedNode()) { |
| 1779 if (pNode->IsContainerNode()) { | 1784 if (pNode->IsContainerNode()) { |
| 1780 XFA_Element eCurId = pNode->GetClassID(); | 1785 XFA_Element eCurId = pNode->GetElementType(); |
| 1781 if (eCurId == XFA_Element::PageArea || | 1786 if (eCurId == XFA_Element::PageArea || |
| 1782 eCurId == XFA_Element::PageSet) { | 1787 eCurId == XFA_Element::PageSet) { |
| 1783 CXFA_ContainerIterator iteChild(pNode); | 1788 CXFA_ContainerIterator iteChild(pNode); |
| 1784 CXFA_Node* pChildNode = iteChild.MoveToNext(); | 1789 CXFA_Node* pChildNode = iteChild.MoveToNext(); |
| 1785 for (; pChildNode; pChildNode = iteChild.MoveToNext()) { | 1790 for (; pChildNode; pChildNode = iteChild.MoveToNext()) { |
| 1786 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( | 1791 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( |
| 1787 pChildNode->GetUserData(XFA_LAYOUTITEMKEY)); | 1792 pChildNode->GetUserData(XFA_LAYOUTITEMKEY)); |
| 1788 if (pLayoutItem) { | 1793 if (pLayoutItem) { |
| 1789 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); | 1794 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); |
| 1790 delete pLayoutItem; | 1795 delete pLayoutItem; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1820 for (; pRootLayoutItem; | 1825 for (; pRootLayoutItem; |
| 1821 pRootLayoutItem = | 1826 pRootLayoutItem = |
| 1822 (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling) { | 1827 (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling) { |
| 1823 CXFA_NodeIteratorTemplate< | 1828 CXFA_NodeIteratorTemplate< |
| 1824 CXFA_ContainerLayoutItem, | 1829 CXFA_ContainerLayoutItem, |
| 1825 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> | 1830 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> |
| 1826 iterator(pRootLayoutItem); | 1831 iterator(pRootLayoutItem); |
| 1827 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.GetCurrent(); | 1832 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.GetCurrent(); |
| 1828 pContainerItem; pContainerItem = iterator.MoveToNext()) { | 1833 pContainerItem; pContainerItem = iterator.MoveToNext()) { |
| 1829 CXFA_Node* pNode = pContainerItem->m_pFormNode; | 1834 CXFA_Node* pNode = pContainerItem->m_pFormNode; |
| 1830 switch (pNode->GetClassID()) { | 1835 switch (pNode->GetElementType()) { |
| 1831 case XFA_Element::PageArea: | 1836 case XFA_Element::PageArea: |
| 1832 m_pLayoutProcessor->GetRootRootItemLayoutProcessor() | 1837 m_pLayoutProcessor->GetRootRootItemLayoutProcessor() |
| 1833 ->DoLayoutPageArea(pContainerItem); | 1838 ->DoLayoutPageArea(pContainerItem); |
| 1834 break; | 1839 break; |
| 1835 default: | 1840 default: |
| 1836 break; | 1841 break; |
| 1837 } | 1842 } |
| 1838 } | 1843 } |
| 1839 } | 1844 } |
| 1840 } | 1845 } |
| 1841 | 1846 |
| 1842 void CXFA_LayoutPageMgr::SyncLayoutData() { | 1847 void CXFA_LayoutPageMgr::SyncLayoutData() { |
| 1843 MergePageSetContents(); | 1848 MergePageSetContents(); |
| 1844 LayoutPageSetContents(); | 1849 LayoutPageSetContents(); |
| 1845 CXFA_FFNotify* pNotify = | 1850 CXFA_FFNotify* pNotify = |
| 1846 m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); | 1851 m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); |
| 1847 int32_t nPageIdx = -1; | 1852 int32_t nPageIdx = -1; |
| 1848 CXFA_ContainerLayoutItem* pRootLayoutItem = GetRootLayoutItem(); | 1853 CXFA_ContainerLayoutItem* pRootLayoutItem = GetRootLayoutItem(); |
| 1849 for (; pRootLayoutItem; | 1854 for (; pRootLayoutItem; |
| 1850 pRootLayoutItem = | 1855 pRootLayoutItem = |
| 1851 (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling) { | 1856 (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling) { |
| 1852 CXFA_NodeIteratorTemplate< | 1857 CXFA_NodeIteratorTemplate< |
| 1853 CXFA_ContainerLayoutItem, | 1858 CXFA_ContainerLayoutItem, |
| 1854 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> | 1859 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> |
| 1855 iteratorParent(pRootLayoutItem); | 1860 iteratorParent(pRootLayoutItem); |
| 1856 for (CXFA_ContainerLayoutItem* pContainerItem = iteratorParent.GetCurrent(); | 1861 for (CXFA_ContainerLayoutItem* pContainerItem = iteratorParent.GetCurrent(); |
| 1857 pContainerItem; pContainerItem = iteratorParent.MoveToNext()) { | 1862 pContainerItem; pContainerItem = iteratorParent.MoveToNext()) { |
| 1858 switch (pContainerItem->m_pFormNode->GetClassID()) { | 1863 switch (pContainerItem->m_pFormNode->GetElementType()) { |
| 1859 case XFA_Element::PageArea: { | 1864 case XFA_Element::PageArea: { |
| 1860 nPageIdx++; | 1865 nPageIdx++; |
| 1861 uint32_t dwRelevant = | 1866 uint32_t dwRelevant = |
| 1862 XFA_WidgetStatus_Viewable | XFA_WidgetStatus_Printable; | 1867 XFA_WidgetStatus_Viewable | XFA_WidgetStatus_Printable; |
| 1863 CXFA_NodeIteratorTemplate<CXFA_LayoutItem, | 1868 CXFA_NodeIteratorTemplate<CXFA_LayoutItem, |
| 1864 CXFA_TraverseStrategy_LayoutItem> | 1869 CXFA_TraverseStrategy_LayoutItem> |
| 1865 iterator(pContainerItem); | 1870 iterator(pContainerItem); |
| 1866 CXFA_LayoutItem* pChildLayoutItem = iterator.GetCurrent(); | 1871 CXFA_LayoutItem* pChildLayoutItem = iterator.GetCurrent(); |
| 1867 while (pChildLayoutItem) { | 1872 while (pChildLayoutItem) { |
| 1868 CXFA_ContentLayoutItem* pContentItem = | 1873 CXFA_ContentLayoutItem* pContentItem = |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1896 ClearRecordList(); | 1901 ClearRecordList(); |
| 1897 } | 1902 } |
| 1898 void XFA_ReleaseLayoutItem_NoPageArea(CXFA_LayoutItem* pLayoutItem) { | 1903 void XFA_ReleaseLayoutItem_NoPageArea(CXFA_LayoutItem* pLayoutItem) { |
| 1899 CXFA_LayoutItem *pNext, *pNode = pLayoutItem->m_pFirstChild; | 1904 CXFA_LayoutItem *pNext, *pNode = pLayoutItem->m_pFirstChild; |
| 1900 while (pNode) { | 1905 while (pNode) { |
| 1901 pNext = pNode->m_pNextSibling; | 1906 pNext = pNode->m_pNextSibling; |
| 1902 pNode->m_pParent = NULL; | 1907 pNode->m_pParent = NULL; |
| 1903 XFA_ReleaseLayoutItem_NoPageArea(pNode); | 1908 XFA_ReleaseLayoutItem_NoPageArea(pNode); |
| 1904 pNode = pNext; | 1909 pNode = pNext; |
| 1905 } | 1910 } |
| 1906 if (pLayoutItem->m_pFormNode->GetClassID() != XFA_Element::PageArea) { | 1911 if (pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::PageArea) { |
| 1907 delete pLayoutItem; | 1912 delete pLayoutItem; |
| 1908 } | 1913 } |
| 1909 } | 1914 } |
| 1910 void CXFA_LayoutPageMgr::PrepareLayout() { | 1915 void CXFA_LayoutPageMgr::PrepareLayout() { |
| 1911 m_pPageSetCurRoot = NULL; | 1916 m_pPageSetCurRoot = NULL; |
| 1912 m_ePageSetMode = XFA_ATTRIBUTEENUM_OrderedOccurrence; | 1917 m_ePageSetMode = XFA_ATTRIBUTEENUM_OrderedOccurrence; |
| 1913 m_nAvailPages = 0; | 1918 m_nAvailPages = 0; |
| 1914 ClearRecordList(); | 1919 ClearRecordList(); |
| 1915 if (!m_pPageSetLayoutItemRoot) { | 1920 if (!m_pPageSetLayoutItemRoot) { |
| 1916 return; | 1921 return; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1939 } | 1944 } |
| 1940 pRootLayoutItem = m_pPageSetLayoutItemRoot; | 1945 pRootLayoutItem = m_pPageSetLayoutItemRoot; |
| 1941 CXFA_ContainerLayoutItem* pNextLayout = NULL; | 1946 CXFA_ContainerLayoutItem* pNextLayout = NULL; |
| 1942 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { | 1947 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { |
| 1943 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; | 1948 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; |
| 1944 SaveLayoutItem(pRootLayoutItem); | 1949 SaveLayoutItem(pRootLayoutItem); |
| 1945 delete pRootLayoutItem; | 1950 delete pRootLayoutItem; |
| 1946 } | 1951 } |
| 1947 m_pPageSetLayoutItemRoot = NULL; | 1952 m_pPageSetLayoutItemRoot = NULL; |
| 1948 } | 1953 } |
| OLD | NEW |