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_itemlayout.h" | 7 #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 m_fUsedSize(0), | 66 m_fUsedSize(0), |
67 m_pPageMgr(pPageMgr), | 67 m_pPageMgr(pPageMgr), |
68 m_bBreakPending(TRUE), | 68 m_bBreakPending(TRUE), |
69 m_fLastRowWidth(0), | 69 m_fLastRowWidth(0), |
70 m_fLastRowY(0), | 70 m_fLastRowY(0), |
71 m_fWidthLimite(0), | 71 m_fWidthLimite(0), |
72 m_bUseInheriated(FALSE), | 72 m_bUseInheriated(FALSE), |
73 m_ePreProcessRs(XFA_ItemLayoutProcessorResult_Done), | 73 m_ePreProcessRs(XFA_ItemLayoutProcessorResult_Done), |
74 m_bHasAvailHeight(TRUE) { | 74 m_bHasAvailHeight(TRUE) { |
75 ASSERT(m_pFormNode && (m_pFormNode->IsContainerNode() || | 75 ASSERT(m_pFormNode && (m_pFormNode->IsContainerNode() || |
76 m_pFormNode->GetClassID() == XFA_Element::Form)); | 76 m_pFormNode->GetElementType() == XFA_Element::Form)); |
77 m_pOldLayoutItem = | 77 m_pOldLayoutItem = |
78 (CXFA_ContentLayoutItem*)m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY); | 78 (CXFA_ContentLayoutItem*)m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY); |
79 } | 79 } |
80 | 80 |
81 CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {} | 81 CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {} |
82 | 82 |
83 CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( | 83 CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( |
84 CXFA_Node* pFormNode) { | 84 CXFA_Node* pFormNode) { |
85 if (!pFormNode) { | 85 if (!pFormNode) { |
86 return NULL; | 86 return NULL; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 } | 193 } |
194 static XFA_ATTRIBUTEENUM XFA_ItemLayoutProcessor_GetLayout( | 194 static XFA_ATTRIBUTEENUM XFA_ItemLayoutProcessor_GetLayout( |
195 CXFA_Node* pFormNode, | 195 CXFA_Node* pFormNode, |
196 FX_BOOL& bRootForceTb) { | 196 FX_BOOL& bRootForceTb) { |
197 bRootForceTb = FALSE; | 197 bRootForceTb = FALSE; |
198 XFA_ATTRIBUTEENUM eLayoutMode; | 198 XFA_ATTRIBUTEENUM eLayoutMode; |
199 if (pFormNode->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, FALSE)) { | 199 if (pFormNode->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, FALSE)) { |
200 return eLayoutMode; | 200 return eLayoutMode; |
201 } | 201 } |
202 CXFA_Node* pParentNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); | 202 CXFA_Node* pParentNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); |
203 if (pParentNode && pParentNode->GetClassID() == XFA_Element::Form) { | 203 if (pParentNode && pParentNode->GetElementType() == XFA_Element::Form) { |
204 bRootForceTb = TRUE; | 204 bRootForceTb = TRUE; |
205 return XFA_ATTRIBUTEENUM_Tb; | 205 return XFA_ATTRIBUTEENUM_Tb; |
206 } | 206 } |
207 return XFA_ATTRIBUTEENUM_Position; | 207 return XFA_ATTRIBUTEENUM_Position; |
208 } | 208 } |
209 static FX_BOOL XFA_ExistContainerKeep(CXFA_Node* pCurNode, FX_BOOL bPreFind) { | 209 static FX_BOOL XFA_ExistContainerKeep(CXFA_Node* pCurNode, FX_BOOL bPreFind) { |
210 if (pCurNode == NULL || !XFA_ItemLayoutProcessor_IsTakingSpace(pCurNode)) { | 210 if (pCurNode == NULL || !XFA_ItemLayoutProcessor_IsTakingSpace(pCurNode)) { |
211 return FALSE; | 211 return FALSE; |
212 } | 212 } |
213 XFA_NODEITEM eItemType = XFA_NODEITEM_PrevSibling; | 213 XFA_NODEITEM eItemType = XFA_NODEITEM_PrevSibling; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 } | 380 } |
381 } | 381 } |
382 void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) { | 382 void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) { |
383 ASSERT(m_pLayoutItem); | 383 ASSERT(m_pLayoutItem); |
384 SplitLayoutItem(m_pLayoutItem, NULL, fSplitPos); | 384 SplitLayoutItem(m_pLayoutItem, NULL, fSplitPos); |
385 } | 385 } |
386 | 386 |
387 CXFA_ContainerLayoutItem* CXFA_LayoutItem::GetPage() const { | 387 CXFA_ContainerLayoutItem* CXFA_LayoutItem::GetPage() const { |
388 for (CXFA_LayoutItem* pCurNode = const_cast<CXFA_LayoutItem*>(this); pCurNode; | 388 for (CXFA_LayoutItem* pCurNode = const_cast<CXFA_LayoutItem*>(this); pCurNode; |
389 pCurNode = pCurNode->m_pParent) { | 389 pCurNode = pCurNode->m_pParent) { |
390 if (pCurNode->m_pFormNode->GetClassID() == XFA_Element::PageArea) | 390 if (pCurNode->m_pFormNode->GetElementType() == XFA_Element::PageArea) |
391 return static_cast<CXFA_ContainerLayoutItem*>(pCurNode); | 391 return static_cast<CXFA_ContainerLayoutItem*>(pCurNode); |
392 } | 392 } |
393 return nullptr; | 393 return nullptr; |
394 } | 394 } |
395 | 395 |
396 CXFA_Node* CXFA_LayoutItem::GetFormNode() const { | 396 CXFA_Node* CXFA_LayoutItem::GetFormNode() const { |
397 return m_pFormNode; | 397 return m_pFormNode; |
398 } | 398 } |
399 | 399 |
400 void CXFA_LayoutItem::GetRect(CFX_RectF& rtLayout, FX_BOOL bRelative) const { | 400 void CXFA_LayoutItem::GetRect(CFX_RectF& rtLayout, FX_BOOL bRelative) const { |
(...skipping 10 matching lines...) Expand all Loading... | |
411 sPos += pContent->m_sPos; | 411 sPos += pContent->m_sPos; |
412 if (CXFA_Node* pMarginNode = | 412 if (CXFA_Node* pMarginNode = |
413 pLayoutItem->m_pFormNode->GetFirstChildByClass( | 413 pLayoutItem->m_pFormNode->GetFirstChildByClass( |
414 XFA_Element::Margin)) { | 414 XFA_Element::Margin)) { |
415 sPos += CFX_PointF(pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset) | 415 sPos += CFX_PointF(pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset) |
416 .ToUnit(XFA_UNIT_Pt), | 416 .ToUnit(XFA_UNIT_Pt), |
417 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset) | 417 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset) |
418 .ToUnit(XFA_UNIT_Pt)); | 418 .ToUnit(XFA_UNIT_Pt)); |
419 } | 419 } |
420 } else { | 420 } else { |
421 if (pLayoutItem->m_pFormNode->GetClassID() == | 421 if (pLayoutItem->m_pFormNode->GetElementType() == |
422 XFA_Element::ContentArea) { | 422 XFA_Element::ContentArea) { |
423 sPos += | 423 sPos += |
424 CFX_PointF(pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_X) | 424 CFX_PointF(pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_X) |
425 .ToUnit(XFA_UNIT_Pt), | 425 .ToUnit(XFA_UNIT_Pt), |
426 pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Y) | 426 pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Y) |
427 .ToUnit(XFA_UNIT_Pt)); | 427 .ToUnit(XFA_UNIT_Pt)); |
428 break; | 428 break; |
429 } else if (pLayoutItem->m_pFormNode->GetClassID() == | 429 } else if (pLayoutItem->m_pFormNode->GetElementType() == |
430 XFA_Element::PageArea) { | 430 XFA_Element::PageArea) { |
431 break; | 431 break; |
432 } | 432 } |
433 } | 433 } |
434 } | 434 } |
435 } | 435 } |
436 rtLayout.Set(sPos.x, sPos.y, sSize.x, sSize.y); | 436 rtLayout.Set(sPos.x, sPos.y, sSize.x, sSize.y); |
437 } | 437 } |
438 | 438 |
439 CXFA_LayoutItem* CXFA_LayoutItem::GetParent() const { | 439 CXFA_LayoutItem* CXFA_LayoutItem::GetParent() const { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
605 CXFA_Node*& pCurActionNode, | 605 CXFA_Node*& pCurActionNode, |
606 XFA_ItemLayoutProcessorStages& nCurStage, | 606 XFA_ItemLayoutProcessorStages& nCurStage, |
607 FX_BOOL bBreakBefore) { | 607 FX_BOOL bBreakBefore) { |
608 FX_BOOL bFindRs = FALSE; | 608 FX_BOOL bFindRs = FALSE; |
609 for (CXFA_Node* pBreakNode = pContainerNode; pBreakNode; | 609 for (CXFA_Node* pBreakNode = pContainerNode; pBreakNode; |
610 pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 610 pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
611 XFA_ATTRIBUTE eAttributeType = XFA_ATTRIBUTE_Before; | 611 XFA_ATTRIBUTE eAttributeType = XFA_ATTRIBUTE_Before; |
612 if (!bBreakBefore) { | 612 if (!bBreakBefore) { |
613 eAttributeType = XFA_ATTRIBUTE_After; | 613 eAttributeType = XFA_ATTRIBUTE_After; |
614 } | 614 } |
615 switch (pBreakNode->GetClassID()) { | 615 switch (pBreakNode->GetElementType()) { |
616 case XFA_Element::BreakBefore: { | 616 case XFA_Element::BreakBefore: { |
617 if (bBreakBefore) { | 617 if (bBreakBefore) { |
618 pCurActionNode = pBreakNode; | 618 pCurActionNode = pBreakNode; |
619 nCurStage = XFA_ItemLayoutProcessorStages_BreakBefore; | 619 nCurStage = XFA_ItemLayoutProcessorStages_BreakBefore; |
620 bFindRs = TRUE; | 620 bFindRs = TRUE; |
621 } | 621 } |
622 } break; | 622 } break; |
623 case XFA_Element::BreakAfter: { | 623 case XFA_Element::BreakAfter: { |
624 if (!bBreakBefore) { | 624 if (!bBreakBefore) { |
625 pCurActionNode = pBreakNode; | 625 pCurActionNode = pBreakNode; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
700 } | 700 } |
701 case XFA_ItemLayoutProcessorStages_None: { | 701 case XFA_ItemLayoutProcessorStages_None: { |
702 pCurActionNode = XFA_LAYOUT_INVALIDNODE; | 702 pCurActionNode = XFA_LAYOUT_INVALIDNODE; |
703 case XFA_ItemLayoutProcessorStages_BookendLeader: | 703 case XFA_ItemLayoutProcessorStages_BookendLeader: |
704 for (CXFA_Node* pBookendNode = | 704 for (CXFA_Node* pBookendNode = |
705 pCurActionNode == XFA_LAYOUT_INVALIDNODE | 705 pCurActionNode == XFA_LAYOUT_INVALIDNODE |
706 ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) | 706 ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) |
707 : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 707 : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
708 pBookendNode; pBookendNode = pBookendNode->GetNodeItem( | 708 pBookendNode; pBookendNode = pBookendNode->GetNodeItem( |
709 XFA_NODEITEM_NextSibling)) { | 709 XFA_NODEITEM_NextSibling)) { |
710 switch (pBookendNode->GetClassID()) { | 710 switch (pBookendNode->GetElementType()) { |
711 case XFA_Element::Bookend: | 711 case XFA_Element::Bookend: |
712 case XFA_Element::Break: | 712 case XFA_Element::Break: |
713 pCurActionNode = pBookendNode; | 713 pCurActionNode = pBookendNode; |
714 nCurStage = XFA_ItemLayoutProcessorStages_BookendLeader; | 714 nCurStage = XFA_ItemLayoutProcessorStages_BookendLeader; |
715 return; | 715 return; |
716 default: | 716 default: |
717 break; | 717 break; |
718 } | 718 } |
719 } | 719 } |
720 } | 720 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
803 } | 803 } |
804 NoMoreChildContainer : { | 804 NoMoreChildContainer : { |
805 pCurActionNode = XFA_LAYOUT_INVALIDNODE; | 805 pCurActionNode = XFA_LAYOUT_INVALIDNODE; |
806 case XFA_ItemLayoutProcessorStages_BookendTrailer: | 806 case XFA_ItemLayoutProcessorStages_BookendTrailer: |
807 for (CXFA_Node* pBookendNode = | 807 for (CXFA_Node* pBookendNode = |
808 pCurActionNode == XFA_LAYOUT_INVALIDNODE | 808 pCurActionNode == XFA_LAYOUT_INVALIDNODE |
809 ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) | 809 ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) |
810 : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 810 : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
811 pBookendNode; pBookendNode = pBookendNode->GetNodeItem( | 811 pBookendNode; pBookendNode = pBookendNode->GetNodeItem( |
812 XFA_NODEITEM_NextSibling)) { | 812 XFA_NODEITEM_NextSibling)) { |
813 switch (pBookendNode->GetClassID()) { | 813 switch (pBookendNode->GetElementType()) { |
814 case XFA_Element::Bookend: | 814 case XFA_Element::Bookend: |
815 case XFA_Element::Break: | 815 case XFA_Element::Break: |
816 pCurActionNode = pBookendNode; | 816 pCurActionNode = pBookendNode; |
817 nCurStage = XFA_ItemLayoutProcessorStages_BookendTrailer; | 817 nCurStage = XFA_ItemLayoutProcessorStages_BookendTrailer; |
818 return; | 818 return; |
819 default: | 819 default: |
820 break; | 820 break; |
821 } | 821 } |
822 } | 822 } |
823 } | 823 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
894 static inline void XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( | 894 static inline void XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( |
895 CXFA_Node* pFormNode, | 895 CXFA_Node* pFormNode, |
896 FX_FLOAT& fContainerWidth, | 896 FX_FLOAT& fContainerWidth, |
897 FX_FLOAT& fContainerHeight, | 897 FX_FLOAT& fContainerHeight, |
898 FX_BOOL& bContainerWidthAutoSize, | 898 FX_BOOL& bContainerWidthAutoSize, |
899 FX_BOOL& bContainerHeightAutoSize) { | 899 FX_BOOL& bContainerHeightAutoSize) { |
900 fContainerWidth = 0; | 900 fContainerWidth = 0; |
901 fContainerHeight = 0; | 901 fContainerHeight = 0; |
902 bContainerWidthAutoSize = TRUE; | 902 bContainerWidthAutoSize = TRUE; |
903 bContainerHeightAutoSize = TRUE; | 903 bContainerHeightAutoSize = TRUE; |
904 XFA_Element eClassID = pFormNode->GetClassID(); | 904 XFA_Element eClassID = pFormNode->GetElementType(); |
905 CXFA_Measurement mTmpValue; | 905 CXFA_Measurement mTmpValue; |
906 if (bContainerWidthAutoSize && (eClassID == XFA_Element::Subform || | 906 if (bContainerWidthAutoSize && (eClassID == XFA_Element::Subform || |
907 eClassID == XFA_Element::ExclGroup) && | 907 eClassID == XFA_Element::ExclGroup) && |
908 pFormNode->TryMeasure(XFA_ATTRIBUTE_W, mTmpValue, FALSE) && | 908 pFormNode->TryMeasure(XFA_ATTRIBUTE_W, mTmpValue, FALSE) && |
909 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { | 909 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { |
910 fContainerWidth = mTmpValue.ToUnit(XFA_UNIT_Pt); | 910 fContainerWidth = mTmpValue.ToUnit(XFA_UNIT_Pt); |
911 bContainerWidthAutoSize = FALSE; | 911 bContainerWidthAutoSize = FALSE; |
912 } | 912 } |
913 if (bContainerHeightAutoSize && (eClassID == XFA_Element::Subform || | 913 if (bContainerHeightAutoSize && (eClassID == XFA_Element::Subform || |
914 eClassID == XFA_Element::ExclGroup) && | 914 eClassID == XFA_Element::ExclGroup) && |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1051 XFA_ItemLayoutProcessorStages nCurChildNodeStage = | 1051 XFA_ItemLayoutProcessorStages nCurChildNodeStage = |
1052 XFA_ItemLayoutProcessorStages_None; | 1052 XFA_ItemLayoutProcessorStages_None; |
1053 CXFA_LayoutItem* pBeforeItem = NULL; | 1053 CXFA_LayoutItem* pBeforeItem = NULL; |
1054 for (XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1054 for (XFA_ItemLayoutProcessor_GotoNextContainerNode( |
1055 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE); | 1055 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE); |
1056 pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1056 pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( |
1057 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE)) { | 1057 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE)) { |
1058 if (nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { | 1058 if (nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { |
1059 continue; | 1059 continue; |
1060 } | 1060 } |
1061 if (pCurChildNode->GetClassID() == XFA_Element::Variables) { | 1061 if (pCurChildNode->GetElementType() == XFA_Element::Variables) { |
1062 continue; | 1062 continue; |
1063 } | 1063 } |
1064 CXFA_ItemLayoutProcessor* pProcessor = | 1064 CXFA_ItemLayoutProcessor* pProcessor = |
1065 new CXFA_ItemLayoutProcessor(pCurChildNode, NULL); | 1065 new CXFA_ItemLayoutProcessor(pCurChildNode, NULL); |
1066 pProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); | 1066 pProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); |
1067 if (!pProcessor->HasLayoutItem()) { | 1067 if (!pProcessor->HasLayoutItem()) { |
1068 delete pProcessor; | 1068 delete pProcessor; |
1069 continue; | 1069 continue; |
1070 } | 1070 } |
1071 FX_FLOAT fWidth, fHeight; | 1071 FX_FLOAT fWidth, fHeight; |
1072 pProcessor->GetCurrentComponentSize(fWidth, fHeight); | 1072 pProcessor->GetCurrentComponentSize(fWidth, fHeight); |
1073 FX_FLOAT fAbsoluteX = 0, fAbsoluteY = 0; | 1073 FX_FLOAT fAbsoluteX = 0, fAbsoluteY = 0; |
1074 CalculatePositionedContainerPos(pCurChildNode, fWidth, fHeight, fAbsoluteX, | 1074 CalculatePositionedContainerPos(pCurChildNode, fWidth, fHeight, fAbsoluteX, |
1075 fAbsoluteY); | 1075 fAbsoluteY); |
1076 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); | 1076 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); |
1077 CXFA_LayoutItem* pProcessItem = pProcessor->ExtractLayoutItem(); | 1077 CXFA_LayoutItem* pProcessItem = pProcessor->ExtractLayoutItem(); |
1078 if (pBeforeItem == NULL) { | 1078 if (pBeforeItem == NULL) { |
1079 pPageAreaLayoutItem->AddHeadChild(pProcessItem); | 1079 pPageAreaLayoutItem->AddHeadChild(pProcessItem); |
1080 } else { | 1080 } else { |
1081 pPageAreaLayoutItem->InsertChild(pBeforeItem, pProcessItem); | 1081 pPageAreaLayoutItem->InsertChild(pBeforeItem, pProcessItem); |
1082 } | 1082 } |
1083 pBeforeItem = pProcessItem; | 1083 pBeforeItem = pProcessItem; |
1084 delete pProcessor; | 1084 delete pProcessor; |
1085 } | 1085 } |
1086 pBeforeItem = NULL; | 1086 pBeforeItem = NULL; |
1087 CXFA_LayoutItem* pLayoutItem = pPageAreaLayoutItem->m_pFirstChild; | 1087 CXFA_LayoutItem* pLayoutItem = pPageAreaLayoutItem->m_pFirstChild; |
1088 while (pLayoutItem) { | 1088 while (pLayoutItem) { |
1089 if (!pLayoutItem->IsContentLayoutItem() || | 1089 if (!pLayoutItem->IsContentLayoutItem() || |
1090 pLayoutItem->m_pFormNode->GetClassID() != XFA_Element::Draw) { | 1090 pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::Draw) { |
1091 pLayoutItem = pLayoutItem->m_pNextSibling; | 1091 pLayoutItem = pLayoutItem->m_pNextSibling; |
1092 continue; | 1092 continue; |
1093 } | 1093 } |
1094 if (pLayoutItem->m_pFormNode->GetClassID() == XFA_Element::Draw) { | 1094 if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::Draw) { |
1095 CXFA_LayoutItem* pNextLayoutItem = pLayoutItem->m_pNextSibling; | 1095 CXFA_LayoutItem* pNextLayoutItem = pLayoutItem->m_pNextSibling; |
1096 pPageAreaLayoutItem->RemoveChild(pLayoutItem); | 1096 pPageAreaLayoutItem->RemoveChild(pLayoutItem); |
1097 if (pBeforeItem == NULL) { | 1097 if (pBeforeItem == NULL) { |
1098 pPageAreaLayoutItem->AddHeadChild(pLayoutItem); | 1098 pPageAreaLayoutItem->AddHeadChild(pLayoutItem); |
1099 } else { | 1099 } else { |
1100 pPageAreaLayoutItem->InsertChild(pBeforeItem, pLayoutItem); | 1100 pPageAreaLayoutItem->InsertChild(pBeforeItem, pLayoutItem); |
1101 } | 1101 } |
1102 pBeforeItem = pLayoutItem; | 1102 pBeforeItem = pLayoutItem; |
1103 pLayoutItem = pNextLayoutItem; | 1103 pLayoutItem = pNextLayoutItem; |
1104 } | 1104 } |
(...skipping 18 matching lines...) Expand all Loading... | |
1123 if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { | 1123 if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { |
1124 XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1124 XFA_ItemLayoutProcessor_GotoNextContainerNode( |
1125 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE); | 1125 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE); |
1126 } | 1126 } |
1127 int32_t iColIndex = 0; | 1127 int32_t iColIndex = 0; |
1128 for (; m_pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1128 for (; m_pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( |
1129 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE)) { | 1129 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE)) { |
1130 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { | 1130 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { |
1131 continue; | 1131 continue; |
1132 } | 1132 } |
1133 if (m_pCurChildNode->GetClassID() == XFA_Element::Variables) { | 1133 if (m_pCurChildNode->GetElementType() == XFA_Element::Variables) { |
1134 continue; | 1134 continue; |
1135 } | 1135 } |
1136 CXFA_ItemLayoutProcessor* pProcessor = | 1136 CXFA_ItemLayoutProcessor* pProcessor = |
1137 new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); | 1137 new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); |
1138 if (pContext && pContext->m_prgSpecifiedColumnWidths) { | 1138 if (pContext && pContext->m_prgSpecifiedColumnWidths) { |
1139 int32_t iColSpan = m_pCurChildNode->GetInteger(XFA_ATTRIBUTE_ColSpan); | 1139 int32_t iColSpan = m_pCurChildNode->GetInteger(XFA_ATTRIBUTE_ColSpan); |
1140 if (iColSpan <= | 1140 if (iColSpan <= |
1141 pContext->m_prgSpecifiedColumnWidths->GetSize() - iColIndex) { | 1141 pContext->m_prgSpecifiedColumnWidths->GetSize() - iColIndex) { |
1142 pContext->m_fCurColumnWidth = 0; | 1142 pContext->m_fCurColumnWidth = 0; |
1143 pContext->m_bCurColumnWidthAvaiable = TRUE; | 1143 pContext->m_bCurColumnWidthAvaiable = TRUE; |
(...skipping 27 matching lines...) Expand all Loading... | |
1171 } | 1171 } |
1172 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); | 1172 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); |
1173 if (bContainerWidthAutoSize) { | 1173 if (bContainerWidthAutoSize) { |
1174 FX_FLOAT fChildSuppliedWidth = fAbsoluteX + fWidth; | 1174 FX_FLOAT fChildSuppliedWidth = fAbsoluteX + fWidth; |
1175 if (bChangeParentSize) { | 1175 if (bChangeParentSize) { |
1176 if (fContentCalculatedWidth < fChildSuppliedWidth) { | 1176 if (fContentCalculatedWidth < fChildSuppliedWidth) { |
1177 fContentCalculatedWidth = fChildSuppliedWidth; | 1177 fContentCalculatedWidth = fChildSuppliedWidth; |
1178 } | 1178 } |
1179 } else { | 1179 } else { |
1180 if (fHiddenContentCalculatedWidth < fChildSuppliedWidth && | 1180 if (fHiddenContentCalculatedWidth < fChildSuppliedWidth && |
1181 m_pCurChildNode->GetClassID() != XFA_Element::Subform) { | 1181 m_pCurChildNode->GetElementType() != XFA_Element::Subform) { |
1182 fHiddenContentCalculatedWidth = fChildSuppliedWidth; | 1182 fHiddenContentCalculatedWidth = fChildSuppliedWidth; |
1183 } | 1183 } |
1184 } | 1184 } |
1185 } | 1185 } |
1186 if (bContainerHeightAutoSize) { | 1186 if (bContainerHeightAutoSize) { |
1187 FX_FLOAT fChildSuppliedHeight = fAbsoluteY + fHeight; | 1187 FX_FLOAT fChildSuppliedHeight = fAbsoluteY + fHeight; |
1188 if (bChangeParentSize) { | 1188 if (bChangeParentSize) { |
1189 if (fContentCalculatedHeight < fChildSuppliedHeight) { | 1189 if (fContentCalculatedHeight < fChildSuppliedHeight) { |
1190 fContentCalculatedHeight = fChildSuppliedHeight; | 1190 fContentCalculatedHeight = fChildSuppliedHeight; |
1191 } | 1191 } |
1192 } else { | 1192 } else { |
1193 if (fHiddenContentCalculatedHeight < fChildSuppliedHeight && | 1193 if (fHiddenContentCalculatedHeight < fChildSuppliedHeight && |
1194 m_pCurChildNode->GetClassID() != XFA_Element::Subform) { | 1194 m_pCurChildNode->GetElementType() != XFA_Element::Subform) { |
1195 fHiddenContentCalculatedHeight = fChildSuppliedHeight; | 1195 fHiddenContentCalculatedHeight = fChildSuppliedHeight; |
1196 } | 1196 } |
1197 } | 1197 } |
1198 } | 1198 } |
1199 m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem()); | 1199 m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem()); |
1200 delete pProcessor; | 1200 delete pProcessor; |
1201 } | 1201 } |
1202 XFA_VERSION eVersion = m_pFormNode->GetDocument()->GetCurVersionMode(); | 1202 XFA_VERSION eVersion = m_pFormNode->GetDocument()->GetCurVersionMode(); |
1203 if (fContentCalculatedWidth == 0 && eVersion < XFA_VERSION_207) { | 1203 if (fContentCalculatedWidth == 0 && eVersion < XFA_VERSION_207) { |
1204 fContentCalculatedWidth = fHiddenContentCalculatedWidth; | 1204 fContentCalculatedWidth = fHiddenContentCalculatedWidth; |
1205 } | 1205 } |
1206 if (fContentCalculatedHeight == 0 && eVersion < XFA_VERSION_207) { | 1206 if (fContentCalculatedHeight == 0 && eVersion < XFA_VERSION_207) { |
1207 fContentCalculatedHeight = fHiddenContentCalculatedHeight; | 1207 fContentCalculatedHeight = fHiddenContentCalculatedHeight; |
1208 } | 1208 } |
1209 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( | 1209 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( |
1210 m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, | 1210 m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, |
1211 fContainerWidth, bContainerHeightAutoSize, fContentCalculatedHeight, | 1211 fContainerWidth, bContainerHeightAutoSize, fContentCalculatedHeight, |
1212 fContainerHeight); | 1212 fContainerHeight); |
1213 SetCurrentComponentSize(fContainerWidth, fContainerHeight); | 1213 SetCurrentComponentSize(fContainerWidth, fContainerHeight); |
1214 } | 1214 } |
1215 static inline void XFA_ItemLayoutProcessor_UpdateWidgetSize( | 1215 static inline void XFA_ItemLayoutProcessor_UpdateWidgetSize( |
1216 CXFA_ContentLayoutItem* pLayoutItem, | 1216 CXFA_ContentLayoutItem* pLayoutItem, |
1217 FX_FLOAT& fWidth, | 1217 FX_FLOAT& fWidth, |
1218 FX_FLOAT& fHeight) { | 1218 FX_FLOAT& fHeight) { |
1219 CXFA_Node* pNode = pLayoutItem->m_pFormNode; | 1219 CXFA_Node* pNode = pLayoutItem->m_pFormNode; |
1220 ASSERT(pNode); | 1220 ASSERT(pNode); |
1221 XFA_Element eClassID = pNode->GetClassID(); | 1221 XFA_Element eClassID = pNode->GetElementType(); |
1222 switch (eClassID) { | 1222 switch (eClassID) { |
1223 case XFA_Element::Subform: | 1223 case XFA_Element::Subform: |
1224 case XFA_Element::Area: | 1224 case XFA_Element::Area: |
1225 case XFA_Element::ExclGroup: | 1225 case XFA_Element::ExclGroup: |
1226 case XFA_Element::SubformSet: { | 1226 case XFA_Element::SubformSet: { |
1227 if (fWidth < -XFA_LAYOUT_FLOAT_PERCISION) { | 1227 if (fWidth < -XFA_LAYOUT_FLOAT_PERCISION) { |
1228 fWidth = pLayoutItem->m_sSize.x; | 1228 fWidth = pLayoutItem->m_sSize.x; |
1229 } | 1229 } |
1230 if (fHeight < -XFA_LAYOUT_FLOAT_PERCISION) { | 1230 if (fHeight < -XFA_LAYOUT_FLOAT_PERCISION) { |
1231 fHeight = pLayoutItem->m_sSize.y; | 1231 fHeight = pLayoutItem->m_sSize.y; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1452 } | 1452 } |
1453 int32_t iRowCount = 0, iColCount = 0; | 1453 int32_t iRowCount = 0, iColCount = 0; |
1454 { | 1454 { |
1455 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> rgRowItems; | 1455 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> rgRowItems; |
1456 CFX_ArrayTemplate<int32_t> rgRowItemsSpan; | 1456 CFX_ArrayTemplate<int32_t> rgRowItemsSpan; |
1457 CFX_ArrayTemplate<FX_FLOAT> rgRowItemsWidth; | 1457 CFX_ArrayTemplate<FX_FLOAT> rgRowItemsWidth; |
1458 for (CXFA_ContentLayoutItem* pLayoutChild = | 1458 for (CXFA_ContentLayoutItem* pLayoutChild = |
1459 (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; | 1459 (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; |
1460 pLayoutChild; | 1460 pLayoutChild; |
1461 pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { | 1461 pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { |
1462 if (pLayoutChild->m_pFormNode->GetClassID() != XFA_Element::Subform) { | 1462 if (pLayoutChild->m_pFormNode->GetElementType() != XFA_Element::Subform) { |
1463 continue; | 1463 continue; |
1464 } | 1464 } |
1465 if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) { | 1465 if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) { |
1466 continue; | 1466 continue; |
1467 } | 1467 } |
1468 XFA_ATTRIBUTEENUM eLayout = | 1468 XFA_ATTRIBUTEENUM eLayout = |
1469 pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); | 1469 pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); |
1470 if (eLayout != XFA_ATTRIBUTEENUM_Row && | 1470 if (eLayout != XFA_ATTRIBUTEENUM_Row && |
1471 eLayout != XFA_ATTRIBUTEENUM_Rl_row) { | 1471 eLayout != XFA_ATTRIBUTEENUM_Rl_row) { |
1472 continue; | 1472 continue; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1541 } | 1541 } |
1542 } | 1542 } |
1543 FX_FLOAT fCurrentRowY = 0; | 1543 FX_FLOAT fCurrentRowY = 0; |
1544 for (CXFA_ContentLayoutItem* pLayoutChild = | 1544 for (CXFA_ContentLayoutItem* pLayoutChild = |
1545 (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; | 1545 (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; |
1546 pLayoutChild; | 1546 pLayoutChild; |
1547 pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { | 1547 pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { |
1548 if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) { | 1548 if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) { |
1549 continue; | 1549 continue; |
1550 } | 1550 } |
1551 if (pLayoutChild->m_pFormNode->GetClassID() == XFA_Element::Subform) { | 1551 if (pLayoutChild->m_pFormNode->GetElementType() == XFA_Element::Subform) { |
1552 XFA_ATTRIBUTEENUM eSubformLayout = | 1552 XFA_ATTRIBUTEENUM eSubformLayout = |
1553 pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); | 1553 pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); |
1554 if (eSubformLayout == XFA_ATTRIBUTEENUM_Row || | 1554 if (eSubformLayout == XFA_ATTRIBUTEENUM_Row || |
1555 eSubformLayout == XFA_ATTRIBUTEENUM_Rl_row) { | 1555 eSubformLayout == XFA_ATTRIBUTEENUM_Rl_row) { |
1556 XFA_ItemLayoutProcessor_RelocateTableRowCells( | 1556 XFA_ItemLayoutProcessor_RelocateTableRowCells( |
1557 pLayoutChild, m_rgSpecifiedColumnWidths, eSubformLayout); | 1557 pLayoutChild, m_rgSpecifiedColumnWidths, eSubformLayout); |
1558 } | 1558 } |
1559 } | 1559 } |
1560 pLayoutChild->m_sPos.y = fCurrentRowY; | 1560 pLayoutChild->m_sPos.y = fCurrentRowY; |
1561 if (bContainerWidthAutoSize) { | 1561 if (bContainerWidthAutoSize) { |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1902 void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( | 1902 void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( |
1903 CXFA_Node* pLeaderNode, | 1903 CXFA_Node* pLeaderNode, |
1904 CXFA_Node* pTrailerNode, | 1904 CXFA_Node* pTrailerNode, |
1905 CXFA_ContentLayoutItem* pTrailerItem, | 1905 CXFA_ContentLayoutItem* pTrailerItem, |
1906 CXFA_Node* pFormNode) { | 1906 CXFA_Node* pFormNode) { |
1907 ProcessUnUseBinds(pLeaderNode); | 1907 ProcessUnUseBinds(pLeaderNode); |
1908 ProcessUnUseBinds(pTrailerNode); | 1908 ProcessUnUseBinds(pTrailerNode); |
1909 if (pFormNode == NULL) { | 1909 if (pFormNode == NULL) { |
1910 return; | 1910 return; |
1911 } | 1911 } |
1912 if (pFormNode->GetClassID() == XFA_Element::Overflow || | 1912 if (pFormNode->GetElementType() == XFA_Element::Overflow || |
1913 pFormNode->GetClassID() == XFA_Element::Break) { | 1913 pFormNode->GetElementType() == XFA_Element::Break) { |
1914 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); | 1914 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); |
1915 } | 1915 } |
1916 if (pLeaderNode && pFormNode) { | 1916 if (pLeaderNode && pFormNode) { |
1917 pFormNode->RemoveChild(pLeaderNode); | 1917 pFormNode->RemoveChild(pLeaderNode); |
1918 } | 1918 } |
1919 if (pTrailerNode && pFormNode) { | 1919 if (pTrailerNode && pFormNode) { |
1920 pFormNode->RemoveChild(pTrailerNode); | 1920 pFormNode->RemoveChild(pTrailerNode); |
1921 } | 1921 } |
1922 if (pTrailerItem) { | 1922 if (pTrailerItem) { |
1923 XFA_ReleaseLayoutItem(pTrailerItem); | 1923 XFA_ReleaseLayoutItem(pTrailerItem); |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2462 CXFA_ContentLayoutItem* pItem = m_arrayKeepItems.GetAt(iIndex); | 2462 CXFA_ContentLayoutItem* pItem = m_arrayKeepItems.GetAt(iIndex); |
2463 m_pLayoutItem->RemoveChild(pItem); | 2463 m_pLayoutItem->RemoveChild(pItem); |
2464 fContentCalculatedHeight -= pItem->m_sSize.y; | 2464 fContentCalculatedHeight -= pItem->m_sSize.y; |
2465 } | 2465 } |
2466 CXFA_Node *pLeaderNode = NULL, *pTrailerNode = NULL; | 2466 CXFA_Node *pLeaderNode = NULL, *pTrailerNode = NULL; |
2467 FX_BOOL bCreatePage = FALSE; | 2467 FX_BOOL bCreatePage = FALSE; |
2468 if (bUseBreakControl && m_pPageMgr && | 2468 if (bUseBreakControl && m_pPageMgr && |
2469 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, TRUE, | 2469 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, TRUE, |
2470 pLeaderNode, pTrailerNode, | 2470 pLeaderNode, pTrailerNode, |
2471 bCreatePage) && | 2471 bCreatePage) && |
2472 m_pFormNode->GetClassID() != XFA_Element::Form && bCreatePage) { | 2472 m_pFormNode->GetElementType() != XFA_Element::Form && |
Lei Zhang
2016/06/23 05:04:19
Wow, the conditionals just keep coming.
| |
2473 bCreatePage) { | |
2473 if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { | 2474 if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { |
2474 XFA_ItemLayoutProcessor_AddPendingNode(this, pLeaderNode, TRUE); | 2475 XFA_ItemLayoutProcessor_AddPendingNode(this, pLeaderNode, TRUE); |
2475 } | 2476 } |
2476 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { | 2477 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { |
2477 if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)->GetClassID() == | 2478 if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent) |
2478 XFA_Element::Form && | 2479 ->GetElementType() == XFA_Element::Form && |
2479 m_pLayoutItem == NULL) { | 2480 m_pLayoutItem == NULL) { |
2480 XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode, | 2481 XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode, |
2481 TRUE); | 2482 TRUE); |
2482 } else { | 2483 } else { |
2483 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( | 2484 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( |
2484 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); | 2485 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); |
2485 XFA_ItemLayoutProcessor_InsertFlowedItem( | 2486 XFA_ItemLayoutProcessor_InsertFlowedItem( |
2486 this, pTempProcessor.get(), bContainerWidthAutoSize, | 2487 this, pTempProcessor.get(), bContainerWidthAutoSize, |
2487 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2488 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
2488 uCurHAlignState, rgCurLineLayoutItems, FALSE, | 2489 uCurHAlignState, rgCurLineLayoutItems, FALSE, |
2489 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, | 2490 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, |
2490 fContentWidthLimit, fContentCurRowAvailWidth, | 2491 fContentWidthLimit, fContentCurRowAvailWidth, |
2491 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, | 2492 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, |
2492 pContext); | 2493 pContext); |
2493 } | 2494 } |
2494 } | 2495 } |
2495 XFA_ItemLayoutProcessor_GotoNextContainerNode( | 2496 XFA_ItemLayoutProcessor_GotoNextContainerNode( |
2496 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, TRUE); | 2497 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, TRUE); |
2497 bForceEndPage = TRUE; | 2498 bForceEndPage = TRUE; |
2498 bIsManualBreak = TRUE; | 2499 bIsManualBreak = TRUE; |
2499 goto SuspendAndCreateNewRow; | 2500 goto SuspendAndCreateNewRow; |
Lei Zhang
2016/06/23 05:04:19
Gah!
| |
2500 } | 2501 } |
2501 } break; | 2502 } break; |
2502 case XFA_ItemLayoutProcessorStages_BreakAfter: { | 2503 case XFA_ItemLayoutProcessorStages_BreakAfter: { |
2503 CXFA_Node *pLeaderNode = NULL, *pTrailerNode = NULL; | 2504 CXFA_Node *pLeaderNode = NULL, *pTrailerNode = NULL; |
2504 FX_BOOL bCreatePage = FALSE; | 2505 FX_BOOL bCreatePage = FALSE; |
2505 if (bUseBreakControl && m_pPageMgr && | 2506 if (bUseBreakControl && m_pPageMgr && |
2506 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, FALSE, | 2507 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, FALSE, |
2507 pLeaderNode, pTrailerNode, | 2508 pLeaderNode, pTrailerNode, |
2508 bCreatePage) && | 2509 bCreatePage) && |
2509 m_pFormNode->GetClassID() != XFA_Element::Form) { | 2510 m_pFormNode->GetElementType() != XFA_Element::Form) { |
2510 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { | 2511 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { |
2511 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( | 2512 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( |
2512 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); | 2513 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); |
2513 XFA_ItemLayoutProcessor_InsertFlowedItem( | 2514 XFA_ItemLayoutProcessor_InsertFlowedItem( |
2514 this, pTempProcessor.get(), bContainerWidthAutoSize, | 2515 this, pTempProcessor.get(), bContainerWidthAutoSize, |
2515 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2516 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
2516 uCurHAlignState, rgCurLineLayoutItems, FALSE, | 2517 uCurHAlignState, rgCurLineLayoutItems, FALSE, |
2517 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, | 2518 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, |
2518 fContentWidthLimit, fContentCurRowAvailWidth, | 2519 fContentWidthLimit, fContentCurRowAvailWidth, |
2519 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, | 2520 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2602 pContext) != XFA_ItemLayoutProcessorResult_Done) { | 2603 pContext) != XFA_ItemLayoutProcessorResult_Done) { |
2603 goto SuspendAndCreateNewRow; | 2604 goto SuspendAndCreateNewRow; |
2604 } else { | 2605 } else { |
2605 delete pProcessor; | 2606 delete pProcessor; |
2606 pProcessor = NULL; | 2607 pProcessor = NULL; |
2607 } | 2608 } |
2608 } | 2609 } |
2609 } break; | 2610 } break; |
2610 case XFA_ItemLayoutProcessorStages_Container: | 2611 case XFA_ItemLayoutProcessorStages_Container: |
2611 ASSERT(m_pCurChildNode->IsContainerNode()); | 2612 ASSERT(m_pCurChildNode->IsContainerNode()); |
2612 if (m_pCurChildNode->GetClassID() == XFA_Element::Variables) { | 2613 if (m_pCurChildNode->GetElementType() == XFA_Element::Variables) { |
2613 break; | 2614 break; |
2614 } | 2615 } |
2615 if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION && | 2616 if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION && |
2616 XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) { | 2617 XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) { |
2617 bForceEndPage = TRUE; | 2618 bForceEndPage = TRUE; |
2618 goto SuspendAndCreateNewRow; | 2619 goto SuspendAndCreateNewRow; |
2619 } | 2620 } |
2620 if (m_pCurChildNode->IsContainerNode()) { | 2621 if (m_pCurChildNode->IsContainerNode()) { |
2621 FX_BOOL bNewRow = FALSE; | 2622 FX_BOOL bNewRow = FALSE; |
2622 if (m_pCurChildPreprocessor) { | 2623 if (m_pCurChildPreprocessor) { |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2863 if (bContainerHeightAutoSize) { | 2864 if (bContainerHeightAutoSize) { |
2864 FX_FLOAT fChildSuppliedHeight = fContentCurRowY; | 2865 FX_FLOAT fChildSuppliedHeight = fContentCurRowY; |
2865 if (fContentCalculatedHeight < fChildSuppliedHeight) { | 2866 if (fContentCalculatedHeight < fChildSuppliedHeight) { |
2866 fContentCalculatedHeight = fChildSuppliedHeight; | 2867 fContentCalculatedHeight = fChildSuppliedHeight; |
2867 } | 2868 } |
2868 } | 2869 } |
2869 return TRUE; | 2870 return TRUE; |
2870 } | 2871 } |
2871 CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent( | 2872 CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent( |
2872 CXFA_Node* pSubformSet) { | 2873 CXFA_Node* pSubformSet) { |
2873 if (pSubformSet && pSubformSet->GetClassID() == XFA_Element::SubformSet) { | 2874 if (pSubformSet && pSubformSet->GetElementType() == XFA_Element::SubformSet) { |
2874 CXFA_Node* pParent = pSubformSet->GetNodeItem(XFA_NODEITEM_Parent); | 2875 CXFA_Node* pParent = pSubformSet->GetNodeItem(XFA_NODEITEM_Parent); |
2875 while (pParent) { | 2876 while (pParent) { |
2876 if (pParent->GetClassID() != XFA_Element::SubformSet) { | 2877 if (pParent->GetElementType() != XFA_Element::SubformSet) { |
2877 return pParent; | 2878 return pParent; |
2878 } | 2879 } |
2879 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); | 2880 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); |
2880 } | 2881 } |
2881 } | 2882 } |
2882 return pSubformSet; | 2883 return pSubformSet; |
2883 } | 2884 } |
2884 void CXFA_ItemLayoutProcessor::DoLayoutField() { | 2885 void CXFA_ItemLayoutProcessor::DoLayoutField() { |
2885 if (m_pLayoutItem) | 2886 if (m_pLayoutItem) |
2886 return; | 2887 return; |
(...skipping 16 matching lines...) Expand all Loading... | |
2903 fWidth = fHeight; | 2904 fWidth = fHeight; |
2904 fHeight = fTmp; | 2905 fHeight = fTmp; |
2905 } | 2906 } |
2906 SetCurrentComponentSize(fWidth, fHeight); | 2907 SetCurrentComponentSize(fWidth, fHeight); |
2907 } | 2908 } |
2908 XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout( | 2909 XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout( |
2909 FX_BOOL bUseBreakControl, | 2910 FX_BOOL bUseBreakControl, |
2910 FX_FLOAT fHeightLimit, | 2911 FX_FLOAT fHeightLimit, |
2911 FX_FLOAT fRealHeight, | 2912 FX_FLOAT fRealHeight, |
2912 CXFA_LayoutContext* pContext) { | 2913 CXFA_LayoutContext* pContext) { |
2913 XFA_Element eClassID = m_pFormNode->GetClassID(); | 2914 XFA_Element eClassID = m_pFormNode->GetElementType(); |
2914 switch (eClassID) { | 2915 switch (eClassID) { |
2915 case XFA_Element::Subform: | 2916 case XFA_Element::Subform: |
2916 case XFA_Element::Area: | 2917 case XFA_Element::Area: |
2917 case XFA_Element::ExclGroup: | 2918 case XFA_Element::ExclGroup: |
2918 case XFA_Element::SubformSet: { | 2919 case XFA_Element::SubformSet: { |
2919 FX_BOOL bRootForceTb = FALSE; | 2920 FX_BOOL bRootForceTb = FALSE; |
2920 CXFA_Node* pLayoutNode = GetSubformSetParent(m_pFormNode); | 2921 CXFA_Node* pLayoutNode = GetSubformSetParent(m_pFormNode); |
2921 XFA_ATTRIBUTEENUM eLayoutStrategy = | 2922 XFA_ATTRIBUTEENUM eLayoutStrategy = |
2922 XFA_ItemLayoutProcessor_GetLayout(pLayoutNode, bRootForceTb); | 2923 XFA_ItemLayoutProcessor_GetLayout(pLayoutNode, bRootForceTb); |
2923 switch (eLayoutStrategy) { | 2924 switch (eLayoutStrategy) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2986 if (iMax < 0) | 2987 if (iMax < 0) |
2987 return TRUE; | 2988 return TRUE; |
2988 | 2989 |
2989 int32_t iCount = m_PendingNodesCount[pTemplate]; | 2990 int32_t iCount = m_PendingNodesCount[pTemplate]; |
2990 if (iCount >= iMax) | 2991 if (iCount >= iMax) |
2991 return FALSE; | 2992 return FALSE; |
2992 | 2993 |
2993 m_PendingNodesCount[pTemplate] = iCount + 1; | 2994 m_PendingNodesCount[pTemplate] = iCount + 1; |
2994 return TRUE; | 2995 return TRUE; |
2995 } | 2996 } |
OLD | NEW |