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->GetClassID() == 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (fProposedSplitPos > fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION && | 118 if (fProposedSplitPos > fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION && |
119 fProposedSplitPos <= fCurVerticalOffset + pLayoutItem->m_sSize.y - | 119 fProposedSplitPos <= fCurVerticalOffset + pLayoutItem->m_sSize.y - |
120 XFA_LAYOUT_FLOAT_PERCISION) { | 120 XFA_LAYOUT_FLOAT_PERCISION) { |
121 switch (pFormNode->GetIntact()) { | 121 switch (pFormNode->GetIntact()) { |
122 case XFA_ATTRIBUTEENUM_None: { | 122 case XFA_ATTRIBUTEENUM_None: { |
123 FX_BOOL bAnyChanged = FALSE; | 123 FX_BOOL bAnyChanged = FALSE; |
124 CXFA_Document* pDocument = pFormNode->GetDocument(); | 124 CXFA_Document* pDocument = pFormNode->GetDocument(); |
125 CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); | 125 CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); |
126 FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; | 126 FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; |
127 CXFA_Node* pMarginNode = | 127 CXFA_Node* pMarginNode = |
128 pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); | 128 pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
129 if (pMarginNode && bCalculateMargin) { | 129 if (pMarginNode && bCalculateMargin) { |
130 fCurTopMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset) | 130 fCurTopMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset) |
131 .ToUnit(XFA_UNIT_Pt); | 131 .ToUnit(XFA_UNIT_Pt); |
132 fCurBottomMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset) | 132 fCurBottomMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset) |
133 .ToUnit(XFA_UNIT_Pt); | 133 .ToUnit(XFA_UNIT_Pt); |
134 } | 134 } |
135 FX_BOOL bChanged = TRUE; | 135 FX_BOOL bChanged = TRUE; |
136 while (bChanged) { | 136 while (bChanged) { |
137 bChanged = FALSE; | 137 bChanged = FALSE; |
138 { | 138 { |
(...skipping 54 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->GetClassID() == 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; |
214 if (!bPreFind) { | 214 if (!bPreFind) { |
215 eItemType = XFA_NODEITEM_NextSibling; | 215 eItemType = XFA_NODEITEM_NextSibling; |
216 } | 216 } |
217 CXFA_Node* pPreContainer = | 217 CXFA_Node* pPreContainer = |
218 pCurNode->GetNodeItem(eItemType, XFA_ObjectType::ContainerNode); | 218 pCurNode->GetNodeItem(eItemType, XFA_ObjectType::ContainerNode); |
219 if (pPreContainer == NULL) { | 219 if (pPreContainer == NULL) { |
220 return FALSE; | 220 return FALSE; |
221 } | 221 } |
222 CXFA_Node* pKeep = pCurNode->GetFirstChildByClass(XFA_ELEMENT_Keep); | 222 CXFA_Node* pKeep = pCurNode->GetFirstChildByClass(XFA_Element::Keep); |
223 if (pKeep) { | 223 if (pKeep) { |
224 XFA_ATTRIBUTEENUM ePrevious; | 224 XFA_ATTRIBUTEENUM ePrevious; |
225 XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Previous; | 225 XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Previous; |
226 if (!bPreFind) { | 226 if (!bPreFind) { |
227 eKeepType = XFA_ATTRIBUTE_Next; | 227 eKeepType = XFA_ATTRIBUTE_Next; |
228 } | 228 } |
229 if (pKeep->TryEnum(eKeepType, ePrevious, FALSE)) { | 229 if (pKeep->TryEnum(eKeepType, ePrevious, FALSE)) { |
230 if (ePrevious == XFA_ATTRIBUTEENUM_ContentArea || | 230 if (ePrevious == XFA_ATTRIBUTEENUM_ContentArea || |
231 ePrevious == XFA_ATTRIBUTEENUM_PageArea) { | 231 ePrevious == XFA_ATTRIBUTEENUM_PageArea) { |
232 return TRUE; | 232 return TRUE; |
233 } | 233 } |
234 } | 234 } |
235 } | 235 } |
236 pKeep = pPreContainer->GetFirstChildByClass(XFA_ELEMENT_Keep); | 236 pKeep = pPreContainer->GetFirstChildByClass(XFA_Element::Keep); |
237 if (!pKeep) { | 237 if (!pKeep) { |
238 return FALSE; | 238 return FALSE; |
239 } | 239 } |
240 XFA_ATTRIBUTEENUM eNext; | 240 XFA_ATTRIBUTEENUM eNext; |
241 XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Next; | 241 XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Next; |
242 if (!bPreFind) { | 242 if (!bPreFind) { |
243 eKeepType = XFA_ATTRIBUTE_Previous; | 243 eKeepType = XFA_ATTRIBUTE_Previous; |
244 } | 244 } |
245 if (!pKeep->TryEnum(eKeepType, eNext, FALSE)) { | 245 if (!pKeep->TryEnum(eKeepType, eNext, FALSE)) { |
246 return FALSE; | 246 return FALSE; |
(...skipping 24 matching lines...) Expand all Loading... |
271 CXFA_ContentLayoutItem* pLayoutItem, | 271 CXFA_ContentLayoutItem* pLayoutItem, |
272 CXFA_ContentLayoutItem* pSecondParent, | 272 CXFA_ContentLayoutItem* pSecondParent, |
273 FX_FLOAT fSplitPos) { | 273 FX_FLOAT fSplitPos) { |
274 FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; | 274 FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; |
275 XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); | 275 XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); |
276 FX_BOOL bCalculateMargin = TRUE; | 276 FX_BOOL bCalculateMargin = TRUE; |
277 if (eLayout == XFA_ATTRIBUTEENUM_Position) { | 277 if (eLayout == XFA_ATTRIBUTEENUM_Position) { |
278 bCalculateMargin = FALSE; | 278 bCalculateMargin = FALSE; |
279 } | 279 } |
280 CXFA_Node* pMarginNode = | 280 CXFA_Node* pMarginNode = |
281 pLayoutItem->m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); | 281 pLayoutItem->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
282 if (pMarginNode && bCalculateMargin) { | 282 if (pMarginNode && bCalculateMargin) { |
283 fCurTopMargin = | 283 fCurTopMargin = |
284 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); | 284 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); |
285 fCurBottomMargin = | 285 fCurBottomMargin = |
286 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); | 286 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); |
287 } | 287 } |
288 CXFA_ContentLayoutItem* pSecondLayoutItem = NULL; | 288 CXFA_ContentLayoutItem* pSecondLayoutItem = NULL; |
289 if (m_pCurChildPreprocessor && | 289 if (m_pCurChildPreprocessor && |
290 m_pCurChildPreprocessor->m_pFormNode == pLayoutItem->m_pFormNode) { | 290 m_pCurChildPreprocessor->m_pFormNode == pLayoutItem->m_pFormNode) { |
291 pSecondLayoutItem = m_pCurChildPreprocessor->CreateContentLayoutItem( | 291 pSecondLayoutItem = m_pCurChildPreprocessor->CreateContentLayoutItem( |
(...skipping 88 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->GetClassID() == 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 { |
401 ASSERT(m_bIsContentLayoutItem); | 401 ASSERT(m_bIsContentLayoutItem); |
402 const CXFA_ContentLayoutItem* pThis = | 402 const CXFA_ContentLayoutItem* pThis = |
403 static_cast<const CXFA_ContentLayoutItem*>(this); | 403 static_cast<const CXFA_ContentLayoutItem*>(this); |
404 CFX_PointF sPos = pThis->m_sPos; | 404 CFX_PointF sPos = pThis->m_sPos; |
405 CFX_SizeF sSize = pThis->m_sSize; | 405 CFX_SizeF sSize = pThis->m_sSize; |
406 if (!bRelative) { | 406 if (!bRelative) { |
407 for (CXFA_LayoutItem* pLayoutItem = pThis->m_pParent; pLayoutItem; | 407 for (CXFA_LayoutItem* pLayoutItem = pThis->m_pParent; pLayoutItem; |
408 pLayoutItem = pLayoutItem->m_pParent) { | 408 pLayoutItem = pLayoutItem->m_pParent) { |
409 if (CXFA_ContentLayoutItem* pContent = | 409 if (CXFA_ContentLayoutItem* pContent = |
410 pLayoutItem->AsContentLayoutItem()) { | 410 pLayoutItem->AsContentLayoutItem()) { |
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() == XFA_ELEMENT_ContentArea) { | 421 if (pLayoutItem->m_pFormNode->GetClassID() == |
| 422 XFA_Element::ContentArea) { |
422 sPos += | 423 sPos += |
423 CFX_PointF(pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_X) | 424 CFX_PointF(pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_X) |
424 .ToUnit(XFA_UNIT_Pt), | 425 .ToUnit(XFA_UNIT_Pt), |
425 pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Y) | 426 pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Y) |
426 .ToUnit(XFA_UNIT_Pt)); | 427 .ToUnit(XFA_UNIT_Pt)); |
427 break; | 428 break; |
428 } else if (pLayoutItem->m_pFormNode->GetClassID() == | 429 } else if (pLayoutItem->m_pFormNode->GetClassID() == |
429 XFA_ELEMENT_PageArea) { | 430 XFA_Element::PageArea) { |
430 break; | 431 break; |
431 } | 432 } |
432 } | 433 } |
433 } | 434 } |
434 } | 435 } |
435 rtLayout.Set(sPos.x, sPos.y, sSize.x, sSize.y); | 436 rtLayout.Set(sPos.x, sPos.y, sSize.x, sSize.y); |
436 } | 437 } |
437 | 438 |
438 CXFA_LayoutItem* CXFA_LayoutItem::GetParent() const { | 439 CXFA_LayoutItem* CXFA_LayoutItem::GetParent() const { |
439 return m_pParent; | 440 return m_pParent; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 XFA_ItemLayoutProcessorStages& nCurStage, | 606 XFA_ItemLayoutProcessorStages& nCurStage, |
606 FX_BOOL bBreakBefore) { | 607 FX_BOOL bBreakBefore) { |
607 FX_BOOL bFindRs = FALSE; | 608 FX_BOOL bFindRs = FALSE; |
608 for (CXFA_Node* pBreakNode = pContainerNode; pBreakNode; | 609 for (CXFA_Node* pBreakNode = pContainerNode; pBreakNode; |
609 pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 610 pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
610 XFA_ATTRIBUTE eAttributeType = XFA_ATTRIBUTE_Before; | 611 XFA_ATTRIBUTE eAttributeType = XFA_ATTRIBUTE_Before; |
611 if (!bBreakBefore) { | 612 if (!bBreakBefore) { |
612 eAttributeType = XFA_ATTRIBUTE_After; | 613 eAttributeType = XFA_ATTRIBUTE_After; |
613 } | 614 } |
614 switch (pBreakNode->GetClassID()) { | 615 switch (pBreakNode->GetClassID()) { |
615 case XFA_ELEMENT_BreakBefore: { | 616 case XFA_Element::BreakBefore: { |
616 if (bBreakBefore) { | 617 if (bBreakBefore) { |
617 pCurActionNode = pBreakNode; | 618 pCurActionNode = pBreakNode; |
618 nCurStage = XFA_ItemLayoutProcessorStages_BreakBefore; | 619 nCurStage = XFA_ItemLayoutProcessorStages_BreakBefore; |
619 bFindRs = TRUE; | 620 bFindRs = TRUE; |
620 } | 621 } |
621 } break; | 622 } break; |
622 case XFA_ELEMENT_BreakAfter: { | 623 case XFA_Element::BreakAfter: { |
623 if (!bBreakBefore) { | 624 if (!bBreakBefore) { |
624 pCurActionNode = pBreakNode; | 625 pCurActionNode = pBreakNode; |
625 nCurStage = XFA_ItemLayoutProcessorStages_BreakAfter; | 626 nCurStage = XFA_ItemLayoutProcessorStages_BreakAfter; |
626 bFindRs = TRUE; | 627 bFindRs = TRUE; |
627 } | 628 } |
628 } break; | 629 } break; |
629 case XFA_ELEMENT_Break: | 630 case XFA_Element::Break: |
630 if (pBreakNode->GetEnum(eAttributeType) != XFA_ATTRIBUTEENUM_Auto) { | 631 if (pBreakNode->GetEnum(eAttributeType) != XFA_ATTRIBUTEENUM_Auto) { |
631 pCurActionNode = pBreakNode; | 632 pCurActionNode = pBreakNode; |
632 nCurStage = XFA_ItemLayoutProcessorStages_BreakBefore; | 633 nCurStage = XFA_ItemLayoutProcessorStages_BreakBefore; |
633 if (!bBreakBefore) { | 634 if (!bBreakBefore) { |
634 nCurStage = XFA_ItemLayoutProcessorStages_BreakAfter; | 635 nCurStage = XFA_ItemLayoutProcessorStages_BreakAfter; |
635 } | 636 } |
636 bFindRs = TRUE; | 637 bFindRs = TRUE; |
637 break; | 638 break; |
638 } | 639 } |
639 default: | 640 default: |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 case XFA_ItemLayoutProcessorStages_None: { | 701 case XFA_ItemLayoutProcessorStages_None: { |
701 pCurActionNode = XFA_LAYOUT_INVALIDNODE; | 702 pCurActionNode = XFA_LAYOUT_INVALIDNODE; |
702 case XFA_ItemLayoutProcessorStages_BookendLeader: | 703 case XFA_ItemLayoutProcessorStages_BookendLeader: |
703 for (CXFA_Node* pBookendNode = | 704 for (CXFA_Node* pBookendNode = |
704 pCurActionNode == XFA_LAYOUT_INVALIDNODE | 705 pCurActionNode == XFA_LAYOUT_INVALIDNODE |
705 ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) | 706 ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) |
706 : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 707 : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
707 pBookendNode; pBookendNode = pBookendNode->GetNodeItem( | 708 pBookendNode; pBookendNode = pBookendNode->GetNodeItem( |
708 XFA_NODEITEM_NextSibling)) { | 709 XFA_NODEITEM_NextSibling)) { |
709 switch (pBookendNode->GetClassID()) { | 710 switch (pBookendNode->GetClassID()) { |
710 case XFA_ELEMENT_Bookend: | 711 case XFA_Element::Bookend: |
711 case XFA_ELEMENT_Break: | 712 case XFA_Element::Break: |
712 pCurActionNode = pBookendNode; | 713 pCurActionNode = pBookendNode; |
713 nCurStage = XFA_ItemLayoutProcessorStages_BookendLeader; | 714 nCurStage = XFA_ItemLayoutProcessorStages_BookendLeader; |
714 return; | 715 return; |
715 default: | 716 default: |
716 break; | 717 break; |
717 } | 718 } |
718 } | 719 } |
719 } | 720 } |
720 { | 721 { |
721 pCurActionNode = XFA_LAYOUT_INVALIDNODE; | 722 pCurActionNode = XFA_LAYOUT_INVALIDNODE; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 NoMoreChildContainer : { | 804 NoMoreChildContainer : { |
804 pCurActionNode = XFA_LAYOUT_INVALIDNODE; | 805 pCurActionNode = XFA_LAYOUT_INVALIDNODE; |
805 case XFA_ItemLayoutProcessorStages_BookendTrailer: | 806 case XFA_ItemLayoutProcessorStages_BookendTrailer: |
806 for (CXFA_Node* pBookendNode = | 807 for (CXFA_Node* pBookendNode = |
807 pCurActionNode == XFA_LAYOUT_INVALIDNODE | 808 pCurActionNode == XFA_LAYOUT_INVALIDNODE |
808 ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) | 809 ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) |
809 : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 810 : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
810 pBookendNode; pBookendNode = pBookendNode->GetNodeItem( | 811 pBookendNode; pBookendNode = pBookendNode->GetNodeItem( |
811 XFA_NODEITEM_NextSibling)) { | 812 XFA_NODEITEM_NextSibling)) { |
812 switch (pBookendNode->GetClassID()) { | 813 switch (pBookendNode->GetClassID()) { |
813 case XFA_ELEMENT_Bookend: | 814 case XFA_Element::Bookend: |
814 case XFA_ELEMENT_Break: | 815 case XFA_Element::Break: |
815 pCurActionNode = pBookendNode; | 816 pCurActionNode = pBookendNode; |
816 nCurStage = XFA_ItemLayoutProcessorStages_BookendTrailer; | 817 nCurStage = XFA_ItemLayoutProcessorStages_BookendTrailer; |
817 return; | 818 return; |
818 default: | 819 default: |
819 break; | 820 break; |
820 } | 821 } |
821 } | 822 } |
822 } | 823 } |
823 default: | 824 default: |
824 pCurActionNode = NULL; | 825 pCurActionNode = NULL; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 static inline void XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( | 894 static inline void XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( |
894 CXFA_Node* pFormNode, | 895 CXFA_Node* pFormNode, |
895 FX_FLOAT& fContainerWidth, | 896 FX_FLOAT& fContainerWidth, |
896 FX_FLOAT& fContainerHeight, | 897 FX_FLOAT& fContainerHeight, |
897 FX_BOOL& bContainerWidthAutoSize, | 898 FX_BOOL& bContainerWidthAutoSize, |
898 FX_BOOL& bContainerHeightAutoSize) { | 899 FX_BOOL& bContainerHeightAutoSize) { |
899 fContainerWidth = 0; | 900 fContainerWidth = 0; |
900 fContainerHeight = 0; | 901 fContainerHeight = 0; |
901 bContainerWidthAutoSize = TRUE; | 902 bContainerWidthAutoSize = TRUE; |
902 bContainerHeightAutoSize = TRUE; | 903 bContainerHeightAutoSize = TRUE; |
903 XFA_ELEMENT eClassID = pFormNode->GetClassID(); | 904 XFA_Element eClassID = pFormNode->GetClassID(); |
904 CXFA_Measurement mTmpValue; | 905 CXFA_Measurement mTmpValue; |
905 if (bContainerWidthAutoSize && | 906 if (bContainerWidthAutoSize && (eClassID == XFA_Element::Subform || |
906 (eClassID == XFA_ELEMENT_Subform || eClassID == XFA_ELEMENT_ExclGroup) && | 907 eClassID == XFA_Element::ExclGroup) && |
907 pFormNode->TryMeasure(XFA_ATTRIBUTE_W, mTmpValue, FALSE) && | 908 pFormNode->TryMeasure(XFA_ATTRIBUTE_W, mTmpValue, FALSE) && |
908 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { | 909 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { |
909 fContainerWidth = mTmpValue.ToUnit(XFA_UNIT_Pt); | 910 fContainerWidth = mTmpValue.ToUnit(XFA_UNIT_Pt); |
910 bContainerWidthAutoSize = FALSE; | 911 bContainerWidthAutoSize = FALSE; |
911 } | 912 } |
912 if (bContainerHeightAutoSize && | 913 if (bContainerHeightAutoSize && (eClassID == XFA_Element::Subform || |
913 (eClassID == XFA_ELEMENT_Subform || eClassID == XFA_ELEMENT_ExclGroup) && | 914 eClassID == XFA_Element::ExclGroup) && |
914 pFormNode->TryMeasure(XFA_ATTRIBUTE_H, mTmpValue, FALSE) && | 915 pFormNode->TryMeasure(XFA_ATTRIBUTE_H, mTmpValue, FALSE) && |
915 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { | 916 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { |
916 fContainerHeight = mTmpValue.ToUnit(XFA_UNIT_Pt); | 917 fContainerHeight = mTmpValue.ToUnit(XFA_UNIT_Pt); |
917 bContainerHeightAutoSize = FALSE; | 918 bContainerHeightAutoSize = FALSE; |
918 } | 919 } |
919 if (bContainerWidthAutoSize && eClassID == XFA_ELEMENT_Subform && | 920 if (bContainerWidthAutoSize && eClassID == XFA_Element::Subform && |
920 pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxW, mTmpValue, FALSE) && | 921 pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxW, mTmpValue, FALSE) && |
921 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { | 922 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { |
922 fContainerWidth = mTmpValue.ToUnit(XFA_UNIT_Pt); | 923 fContainerWidth = mTmpValue.ToUnit(XFA_UNIT_Pt); |
923 bContainerWidthAutoSize = FALSE; | 924 bContainerWidthAutoSize = FALSE; |
924 } | 925 } |
925 if (bContainerHeightAutoSize && eClassID == XFA_ELEMENT_Subform && | 926 if (bContainerHeightAutoSize && eClassID == XFA_Element::Subform && |
926 pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxH, mTmpValue, FALSE) && | 927 pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxH, mTmpValue, FALSE) && |
927 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { | 928 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { |
928 fContainerHeight = mTmpValue.ToUnit(XFA_UNIT_Pt); | 929 fContainerHeight = mTmpValue.ToUnit(XFA_UNIT_Pt); |
929 bContainerHeightAutoSize = FALSE; | 930 bContainerHeightAutoSize = FALSE; |
930 } | 931 } |
931 } | 932 } |
932 static inline void | 933 static inline void |
933 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( | 934 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( |
934 CXFA_Node* pFormNode, | 935 CXFA_Node* pFormNode, |
935 FX_BOOL bContainerWidthAutoSize, | 936 FX_BOOL bContainerWidthAutoSize, |
936 FX_FLOAT fContentCalculatedWidth, | 937 FX_FLOAT fContentCalculatedWidth, |
937 FX_FLOAT& fContainerWidth, | 938 FX_FLOAT& fContainerWidth, |
938 FX_BOOL bContainerHeightAutoSize, | 939 FX_BOOL bContainerHeightAutoSize, |
939 FX_FLOAT fContentCalculatedHeight, | 940 FX_FLOAT fContentCalculatedHeight, |
940 FX_FLOAT& fContainerHeight) { | 941 FX_FLOAT& fContainerHeight) { |
941 CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); | 942 CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
942 CXFA_Measurement mTmpValue; | 943 CXFA_Measurement mTmpValue; |
943 if (bContainerWidthAutoSize) { | 944 if (bContainerWidthAutoSize) { |
944 fContainerWidth = fContentCalculatedWidth; | 945 fContainerWidth = fContentCalculatedWidth; |
945 if (pMarginNode) { | 946 if (pMarginNode) { |
946 if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_LeftInset, mTmpValue, FALSE)) { | 947 if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_LeftInset, mTmpValue, FALSE)) { |
947 fContainerWidth += mTmpValue.ToUnit(XFA_UNIT_Pt); | 948 fContainerWidth += mTmpValue.ToUnit(XFA_UNIT_Pt); |
948 } | 949 } |
949 if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_RightInset, mTmpValue, FALSE)) { | 950 if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_RightInset, mTmpValue, FALSE)) { |
950 fContainerWidth += mTmpValue.ToUnit(XFA_UNIT_Pt); | 951 fContainerWidth += mTmpValue.ToUnit(XFA_UNIT_Pt); |
951 } | 952 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 XFA_ItemLayoutProcessorStages nCurChildNodeStage = | 1051 XFA_ItemLayoutProcessorStages nCurChildNodeStage = |
1051 XFA_ItemLayoutProcessorStages_None; | 1052 XFA_ItemLayoutProcessorStages_None; |
1052 CXFA_LayoutItem* pBeforeItem = NULL; | 1053 CXFA_LayoutItem* pBeforeItem = NULL; |
1053 for (XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1054 for (XFA_ItemLayoutProcessor_GotoNextContainerNode( |
1054 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE); | 1055 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE); |
1055 pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1056 pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( |
1056 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE)) { | 1057 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE)) { |
1057 if (nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { | 1058 if (nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { |
1058 continue; | 1059 continue; |
1059 } | 1060 } |
1060 if (pCurChildNode->GetClassID() == XFA_ELEMENT_Variables) { | 1061 if (pCurChildNode->GetClassID() == XFA_Element::Variables) { |
1061 continue; | 1062 continue; |
1062 } | 1063 } |
1063 CXFA_ItemLayoutProcessor* pProcessor = | 1064 CXFA_ItemLayoutProcessor* pProcessor = |
1064 new CXFA_ItemLayoutProcessor(pCurChildNode, NULL); | 1065 new CXFA_ItemLayoutProcessor(pCurChildNode, NULL); |
1065 pProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); | 1066 pProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); |
1066 if (!pProcessor->HasLayoutItem()) { | 1067 if (!pProcessor->HasLayoutItem()) { |
1067 delete pProcessor; | 1068 delete pProcessor; |
1068 continue; | 1069 continue; |
1069 } | 1070 } |
1070 FX_FLOAT fWidth, fHeight; | 1071 FX_FLOAT fWidth, fHeight; |
1071 pProcessor->GetCurrentComponentSize(fWidth, fHeight); | 1072 pProcessor->GetCurrentComponentSize(fWidth, fHeight); |
1072 FX_FLOAT fAbsoluteX = 0, fAbsoluteY = 0; | 1073 FX_FLOAT fAbsoluteX = 0, fAbsoluteY = 0; |
1073 CalculatePositionedContainerPos(pCurChildNode, fWidth, fHeight, fAbsoluteX, | 1074 CalculatePositionedContainerPos(pCurChildNode, fWidth, fHeight, fAbsoluteX, |
1074 fAbsoluteY); | 1075 fAbsoluteY); |
1075 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); | 1076 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); |
1076 CXFA_LayoutItem* pProcessItem = pProcessor->ExtractLayoutItem(); | 1077 CXFA_LayoutItem* pProcessItem = pProcessor->ExtractLayoutItem(); |
1077 if (pBeforeItem == NULL) { | 1078 if (pBeforeItem == NULL) { |
1078 pPageAreaLayoutItem->AddHeadChild(pProcessItem); | 1079 pPageAreaLayoutItem->AddHeadChild(pProcessItem); |
1079 } else { | 1080 } else { |
1080 pPageAreaLayoutItem->InsertChild(pBeforeItem, pProcessItem); | 1081 pPageAreaLayoutItem->InsertChild(pBeforeItem, pProcessItem); |
1081 } | 1082 } |
1082 pBeforeItem = pProcessItem; | 1083 pBeforeItem = pProcessItem; |
1083 delete pProcessor; | 1084 delete pProcessor; |
1084 } | 1085 } |
1085 pBeforeItem = NULL; | 1086 pBeforeItem = NULL; |
1086 CXFA_LayoutItem* pLayoutItem = pPageAreaLayoutItem->m_pFirstChild; | 1087 CXFA_LayoutItem* pLayoutItem = pPageAreaLayoutItem->m_pFirstChild; |
1087 while (pLayoutItem) { | 1088 while (pLayoutItem) { |
1088 if (!pLayoutItem->IsContentLayoutItem() || | 1089 if (!pLayoutItem->IsContentLayoutItem() || |
1089 pLayoutItem->m_pFormNode->GetClassID() != XFA_ELEMENT_Draw) { | 1090 pLayoutItem->m_pFormNode->GetClassID() != XFA_Element::Draw) { |
1090 pLayoutItem = pLayoutItem->m_pNextSibling; | 1091 pLayoutItem = pLayoutItem->m_pNextSibling; |
1091 continue; | 1092 continue; |
1092 } | 1093 } |
1093 if (pLayoutItem->m_pFormNode->GetClassID() == XFA_ELEMENT_Draw) { | 1094 if (pLayoutItem->m_pFormNode->GetClassID() == XFA_Element::Draw) { |
1094 CXFA_LayoutItem* pNextLayoutItem = pLayoutItem->m_pNextSibling; | 1095 CXFA_LayoutItem* pNextLayoutItem = pLayoutItem->m_pNextSibling; |
1095 pPageAreaLayoutItem->RemoveChild(pLayoutItem); | 1096 pPageAreaLayoutItem->RemoveChild(pLayoutItem); |
1096 if (pBeforeItem == NULL) { | 1097 if (pBeforeItem == NULL) { |
1097 pPageAreaLayoutItem->AddHeadChild(pLayoutItem); | 1098 pPageAreaLayoutItem->AddHeadChild(pLayoutItem); |
1098 } else { | 1099 } else { |
1099 pPageAreaLayoutItem->InsertChild(pBeforeItem, pLayoutItem); | 1100 pPageAreaLayoutItem->InsertChild(pBeforeItem, pLayoutItem); |
1100 } | 1101 } |
1101 pBeforeItem = pLayoutItem; | 1102 pBeforeItem = pLayoutItem; |
1102 pLayoutItem = pNextLayoutItem; | 1103 pLayoutItem = pNextLayoutItem; |
1103 } | 1104 } |
(...skipping 18 matching lines...) Expand all Loading... |
1122 if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { | 1123 if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { |
1123 XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1124 XFA_ItemLayoutProcessor_GotoNextContainerNode( |
1124 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE); | 1125 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE); |
1125 } | 1126 } |
1126 int32_t iColIndex = 0; | 1127 int32_t iColIndex = 0; |
1127 for (; m_pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1128 for (; m_pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( |
1128 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE)) { | 1129 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE)) { |
1129 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { | 1130 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { |
1130 continue; | 1131 continue; |
1131 } | 1132 } |
1132 if (m_pCurChildNode->GetClassID() == XFA_ELEMENT_Variables) { | 1133 if (m_pCurChildNode->GetClassID() == XFA_Element::Variables) { |
1133 continue; | 1134 continue; |
1134 } | 1135 } |
1135 CXFA_ItemLayoutProcessor* pProcessor = | 1136 CXFA_ItemLayoutProcessor* pProcessor = |
1136 new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); | 1137 new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); |
1137 if (pContext && pContext->m_prgSpecifiedColumnWidths) { | 1138 if (pContext && pContext->m_prgSpecifiedColumnWidths) { |
1138 int32_t iColSpan = m_pCurChildNode->GetInteger(XFA_ATTRIBUTE_ColSpan); | 1139 int32_t iColSpan = m_pCurChildNode->GetInteger(XFA_ATTRIBUTE_ColSpan); |
1139 if (iColSpan <= | 1140 if (iColSpan <= |
1140 pContext->m_prgSpecifiedColumnWidths->GetSize() - iColIndex) { | 1141 pContext->m_prgSpecifiedColumnWidths->GetSize() - iColIndex) { |
1141 pContext->m_fCurColumnWidth = 0; | 1142 pContext->m_fCurColumnWidth = 0; |
1142 pContext->m_bCurColumnWidthAvaiable = TRUE; | 1143 pContext->m_bCurColumnWidthAvaiable = TRUE; |
(...skipping 27 matching lines...) Expand all Loading... |
1170 } | 1171 } |
1171 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); | 1172 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); |
1172 if (bContainerWidthAutoSize) { | 1173 if (bContainerWidthAutoSize) { |
1173 FX_FLOAT fChildSuppliedWidth = fAbsoluteX + fWidth; | 1174 FX_FLOAT fChildSuppliedWidth = fAbsoluteX + fWidth; |
1174 if (bChangeParentSize) { | 1175 if (bChangeParentSize) { |
1175 if (fContentCalculatedWidth < fChildSuppliedWidth) { | 1176 if (fContentCalculatedWidth < fChildSuppliedWidth) { |
1176 fContentCalculatedWidth = fChildSuppliedWidth; | 1177 fContentCalculatedWidth = fChildSuppliedWidth; |
1177 } | 1178 } |
1178 } else { | 1179 } else { |
1179 if (fHiddenContentCalculatedWidth < fChildSuppliedWidth && | 1180 if (fHiddenContentCalculatedWidth < fChildSuppliedWidth && |
1180 m_pCurChildNode->GetClassID() != XFA_ELEMENT_Subform) { | 1181 m_pCurChildNode->GetClassID() != XFA_Element::Subform) { |
1181 fHiddenContentCalculatedWidth = fChildSuppliedWidth; | 1182 fHiddenContentCalculatedWidth = fChildSuppliedWidth; |
1182 } | 1183 } |
1183 } | 1184 } |
1184 } | 1185 } |
1185 if (bContainerHeightAutoSize) { | 1186 if (bContainerHeightAutoSize) { |
1186 FX_FLOAT fChildSuppliedHeight = fAbsoluteY + fHeight; | 1187 FX_FLOAT fChildSuppliedHeight = fAbsoluteY + fHeight; |
1187 if (bChangeParentSize) { | 1188 if (bChangeParentSize) { |
1188 if (fContentCalculatedHeight < fChildSuppliedHeight) { | 1189 if (fContentCalculatedHeight < fChildSuppliedHeight) { |
1189 fContentCalculatedHeight = fChildSuppliedHeight; | 1190 fContentCalculatedHeight = fChildSuppliedHeight; |
1190 } | 1191 } |
1191 } else { | 1192 } else { |
1192 if (fHiddenContentCalculatedHeight < fChildSuppliedHeight && | 1193 if (fHiddenContentCalculatedHeight < fChildSuppliedHeight && |
1193 m_pCurChildNode->GetClassID() != XFA_ELEMENT_Subform) { | 1194 m_pCurChildNode->GetClassID() != XFA_Element::Subform) { |
1194 fHiddenContentCalculatedHeight = fChildSuppliedHeight; | 1195 fHiddenContentCalculatedHeight = fChildSuppliedHeight; |
1195 } | 1196 } |
1196 } | 1197 } |
1197 } | 1198 } |
1198 m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem()); | 1199 m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem()); |
1199 delete pProcessor; | 1200 delete pProcessor; |
1200 } | 1201 } |
1201 XFA_VERSION eVersion = m_pFormNode->GetDocument()->GetCurVersionMode(); | 1202 XFA_VERSION eVersion = m_pFormNode->GetDocument()->GetCurVersionMode(); |
1202 if (fContentCalculatedWidth == 0 && eVersion < XFA_VERSION_207) { | 1203 if (fContentCalculatedWidth == 0 && eVersion < XFA_VERSION_207) { |
1203 fContentCalculatedWidth = fHiddenContentCalculatedWidth; | 1204 fContentCalculatedWidth = fHiddenContentCalculatedWidth; |
1204 } | 1205 } |
1205 if (fContentCalculatedHeight == 0 && eVersion < XFA_VERSION_207) { | 1206 if (fContentCalculatedHeight == 0 && eVersion < XFA_VERSION_207) { |
1206 fContentCalculatedHeight = fHiddenContentCalculatedHeight; | 1207 fContentCalculatedHeight = fHiddenContentCalculatedHeight; |
1207 } | 1208 } |
1208 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( | 1209 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( |
1209 m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, | 1210 m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, |
1210 fContainerWidth, bContainerHeightAutoSize, fContentCalculatedHeight, | 1211 fContainerWidth, bContainerHeightAutoSize, fContentCalculatedHeight, |
1211 fContainerHeight); | 1212 fContainerHeight); |
1212 SetCurrentComponentSize(fContainerWidth, fContainerHeight); | 1213 SetCurrentComponentSize(fContainerWidth, fContainerHeight); |
1213 } | 1214 } |
1214 static inline void XFA_ItemLayoutProcessor_UpdateWidgetSize( | 1215 static inline void XFA_ItemLayoutProcessor_UpdateWidgetSize( |
1215 CXFA_ContentLayoutItem* pLayoutItem, | 1216 CXFA_ContentLayoutItem* pLayoutItem, |
1216 FX_FLOAT& fWidth, | 1217 FX_FLOAT& fWidth, |
1217 FX_FLOAT& fHeight) { | 1218 FX_FLOAT& fHeight) { |
1218 CXFA_Node* pNode = pLayoutItem->m_pFormNode; | 1219 CXFA_Node* pNode = pLayoutItem->m_pFormNode; |
1219 ASSERT(pNode); | 1220 ASSERT(pNode); |
1220 XFA_ELEMENT eClassID = pNode->GetClassID(); | 1221 XFA_Element eClassID = pNode->GetClassID(); |
1221 switch (eClassID) { | 1222 switch (eClassID) { |
1222 case XFA_ELEMENT_Subform: | 1223 case XFA_Element::Subform: |
1223 case XFA_ELEMENT_Area: | 1224 case XFA_Element::Area: |
1224 case XFA_ELEMENT_ExclGroup: | 1225 case XFA_Element::ExclGroup: |
1225 case XFA_ELEMENT_SubformSet: { | 1226 case XFA_Element::SubformSet: { |
1226 if (fWidth < -XFA_LAYOUT_FLOAT_PERCISION) { | 1227 if (fWidth < -XFA_LAYOUT_FLOAT_PERCISION) { |
1227 fWidth = pLayoutItem->m_sSize.x; | 1228 fWidth = pLayoutItem->m_sSize.x; |
1228 } | 1229 } |
1229 if (fHeight < -XFA_LAYOUT_FLOAT_PERCISION) { | 1230 if (fHeight < -XFA_LAYOUT_FLOAT_PERCISION) { |
1230 fHeight = pLayoutItem->m_sSize.y; | 1231 fHeight = pLayoutItem->m_sSize.y; |
1231 } | 1232 } |
1232 break; | 1233 break; |
1233 } | 1234 } |
1234 case XFA_ELEMENT_Draw: | 1235 case XFA_Element::Draw: |
1235 case XFA_ELEMENT_Field: { | 1236 case XFA_Element::Field: { |
1236 pNode->GetDocument()->GetParser()->GetNotify()->StartFieldDrawLayout( | 1237 pNode->GetDocument()->GetParser()->GetNotify()->StartFieldDrawLayout( |
1237 pNode, fWidth, fHeight); | 1238 pNode, fWidth, fHeight); |
1238 break; | 1239 break; |
1239 } | 1240 } |
1240 default: | 1241 default: |
1241 ASSERT(FALSE); | 1242 ASSERT(FALSE); |
1242 } | 1243 } |
1243 } | 1244 } |
1244 static inline void XFA_ItemLayoutProcessor_RelocateTableRowCells( | 1245 static inline void XFA_ItemLayoutProcessor_RelocateTableRowCells( |
1245 CXFA_ContentLayoutItem* pLayoutRow, | 1246 CXFA_ContentLayoutItem* pLayoutRow, |
1246 const CFX_ArrayTemplate<FX_FLOAT>& rgSpecifiedColumnWidths, | 1247 const CFX_ArrayTemplate<FX_FLOAT>& rgSpecifiedColumnWidths, |
1247 XFA_ATTRIBUTEENUM eLayout) { | 1248 XFA_ATTRIBUTEENUM eLayout) { |
1248 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; | 1249 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; |
1249 FX_BOOL bContainerWidthAutoSize = TRUE, bContainerHeightAutoSize = TRUE; | 1250 FX_BOOL bContainerWidthAutoSize = TRUE, bContainerHeightAutoSize = TRUE; |
1250 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( | 1251 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( |
1251 pLayoutRow->m_pFormNode, fContainerWidth, fContainerHeight, | 1252 pLayoutRow->m_pFormNode, fContainerWidth, fContainerHeight, |
1252 bContainerWidthAutoSize, bContainerHeightAutoSize); | 1253 bContainerWidthAutoSize, bContainerHeightAutoSize); |
1253 CXFA_Node* pMarginNode = | 1254 CXFA_Node* pMarginNode = |
1254 pLayoutRow->m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); | 1255 pLayoutRow->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
1255 FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; | 1256 FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; |
1256 if (pMarginNode) { | 1257 if (pMarginNode) { |
1257 fLeftInset = | 1258 fLeftInset = |
1258 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); | 1259 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); |
1259 fTopInset = | 1260 fTopInset = |
1260 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); | 1261 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); |
1261 fRightInset = | 1262 fRightInset = |
1262 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); | 1263 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); |
1263 fBottomInset = | 1264 fBottomInset = |
1264 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); | 1265 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 if (bContainerHeightAutoSize) { | 1316 if (bContainerHeightAutoSize) { |
1316 for (CXFA_ContentLayoutItem* pLayoutChild = | 1317 for (CXFA_ContentLayoutItem* pLayoutChild = |
1317 (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild; | 1318 (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild; |
1318 pLayoutChild; | 1319 pLayoutChild; |
1319 pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { | 1320 pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { |
1320 XFA_ItemLayoutProcessor_UpdateWidgetSize( | 1321 XFA_ItemLayoutProcessor_UpdateWidgetSize( |
1321 pLayoutChild, pLayoutChild->m_sSize.x, fContentCalculatedHeight); | 1322 pLayoutChild, pLayoutChild->m_sSize.x, fContentCalculatedHeight); |
1322 FX_FLOAT fOldChildHeight = pLayoutChild->m_sSize.y; | 1323 FX_FLOAT fOldChildHeight = pLayoutChild->m_sSize.y; |
1323 pLayoutChild->m_sSize.y = fContentCalculatedHeight; | 1324 pLayoutChild->m_sSize.y = fContentCalculatedHeight; |
1324 CXFA_Node* pParaNode = | 1325 CXFA_Node* pParaNode = |
1325 pLayoutChild->m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Para); | 1326 pLayoutChild->m_pFormNode->GetFirstChildByClass(XFA_Element::Para); |
1326 if (pParaNode && pLayoutChild->m_pFirstChild) { | 1327 if (pParaNode && pLayoutChild->m_pFirstChild) { |
1327 FX_FLOAT fOffHeight = fContentCalculatedHeight - fOldChildHeight; | 1328 FX_FLOAT fOffHeight = fContentCalculatedHeight - fOldChildHeight; |
1328 XFA_ATTRIBUTEENUM eVType = pParaNode->GetEnum(XFA_ATTRIBUTE_VAlign); | 1329 XFA_ATTRIBUTEENUM eVType = pParaNode->GetEnum(XFA_ATTRIBUTE_VAlign); |
1329 switch (eVType) { | 1330 switch (eVType) { |
1330 case XFA_ATTRIBUTEENUM_Middle: | 1331 case XFA_ATTRIBUTEENUM_Middle: |
1331 fOffHeight = fOffHeight / 2; | 1332 fOffHeight = fOffHeight / 2; |
1332 break; | 1333 break; |
1333 case XFA_ATTRIBUTEENUM_Bottom: | 1334 case XFA_ATTRIBUTEENUM_Bottom: |
1334 break; | 1335 break; |
1335 case XFA_ATTRIBUTEENUM_Top: | 1336 case XFA_ATTRIBUTEENUM_Top: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 } | 1387 } |
1387 ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE); | 1388 ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE); |
1388 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); | 1389 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); |
1389 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; | 1390 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; |
1390 FX_BOOL bContainerWidthAutoSize = TRUE, bContainerHeightAutoSize = TRUE; | 1391 FX_BOOL bContainerWidthAutoSize = TRUE, bContainerHeightAutoSize = TRUE; |
1391 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( | 1392 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( |
1392 m_pFormNode, fContainerWidth, fContainerHeight, bContainerWidthAutoSize, | 1393 m_pFormNode, fContainerWidth, fContainerHeight, bContainerWidthAutoSize, |
1393 bContainerHeightAutoSize); | 1394 bContainerHeightAutoSize); |
1394 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; | 1395 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; |
1395 CXFA_Node* pMarginNode = | 1396 CXFA_Node* pMarginNode = |
1396 m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); | 1397 m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
1397 FX_FLOAT fLeftInset = 0; | 1398 FX_FLOAT fLeftInset = 0; |
1398 FX_FLOAT fRightInset = 0; | 1399 FX_FLOAT fRightInset = 0; |
1399 if (pMarginNode) { | 1400 if (pMarginNode) { |
1400 fLeftInset = | 1401 fLeftInset = |
1401 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); | 1402 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); |
1402 fRightInset = | 1403 fRightInset = |
1403 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); | 1404 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); |
1404 } | 1405 } |
1405 FX_FLOAT fContentWidthLimit = | 1406 FX_FLOAT fContentWidthLimit = |
1406 bContainerWidthAutoSize ? XFA_LAYOUT_FLOAT_MAX | 1407 bContainerWidthAutoSize ? XFA_LAYOUT_FLOAT_MAX |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 } | 1452 } |
1452 int32_t iRowCount = 0, iColCount = 0; | 1453 int32_t iRowCount = 0, iColCount = 0; |
1453 { | 1454 { |
1454 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> rgRowItems; | 1455 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> rgRowItems; |
1455 CFX_ArrayTemplate<int32_t> rgRowItemsSpan; | 1456 CFX_ArrayTemplate<int32_t> rgRowItemsSpan; |
1456 CFX_ArrayTemplate<FX_FLOAT> rgRowItemsWidth; | 1457 CFX_ArrayTemplate<FX_FLOAT> rgRowItemsWidth; |
1457 for (CXFA_ContentLayoutItem* pLayoutChild = | 1458 for (CXFA_ContentLayoutItem* pLayoutChild = |
1458 (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; | 1459 (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; |
1459 pLayoutChild; | 1460 pLayoutChild; |
1460 pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { | 1461 pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { |
1461 if (pLayoutChild->m_pFormNode->GetClassID() != XFA_ELEMENT_Subform) { | 1462 if (pLayoutChild->m_pFormNode->GetClassID() != XFA_Element::Subform) { |
1462 continue; | 1463 continue; |
1463 } | 1464 } |
1464 if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) { | 1465 if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) { |
1465 continue; | 1466 continue; |
1466 } | 1467 } |
1467 XFA_ATTRIBUTEENUM eLayout = | 1468 XFA_ATTRIBUTEENUM eLayout = |
1468 pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); | 1469 pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); |
1469 if (eLayout != XFA_ATTRIBUTEENUM_Row && | 1470 if (eLayout != XFA_ATTRIBUTEENUM_Row && |
1470 eLayout != XFA_ATTRIBUTEENUM_Rl_row) { | 1471 eLayout != XFA_ATTRIBUTEENUM_Rl_row) { |
1471 continue; | 1472 continue; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 } | 1541 } |
1541 } | 1542 } |
1542 FX_FLOAT fCurrentRowY = 0; | 1543 FX_FLOAT fCurrentRowY = 0; |
1543 for (CXFA_ContentLayoutItem* pLayoutChild = | 1544 for (CXFA_ContentLayoutItem* pLayoutChild = |
1544 (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; | 1545 (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; |
1545 pLayoutChild; | 1546 pLayoutChild; |
1546 pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { | 1547 pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { |
1547 if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) { | 1548 if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) { |
1548 continue; | 1549 continue; |
1549 } | 1550 } |
1550 if (pLayoutChild->m_pFormNode->GetClassID() == XFA_ELEMENT_Subform) { | 1551 if (pLayoutChild->m_pFormNode->GetClassID() == XFA_Element::Subform) { |
1551 XFA_ATTRIBUTEENUM eSubformLayout = | 1552 XFA_ATTRIBUTEENUM eSubformLayout = |
1552 pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); | 1553 pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); |
1553 if (eSubformLayout == XFA_ATTRIBUTEENUM_Row || | 1554 if (eSubformLayout == XFA_ATTRIBUTEENUM_Row || |
1554 eSubformLayout == XFA_ATTRIBUTEENUM_Rl_row) { | 1555 eSubformLayout == XFA_ATTRIBUTEENUM_Rl_row) { |
1555 XFA_ItemLayoutProcessor_RelocateTableRowCells( | 1556 XFA_ItemLayoutProcessor_RelocateTableRowCells( |
1556 pLayoutChild, m_rgSpecifiedColumnWidths, eSubformLayout); | 1557 pLayoutChild, m_rgSpecifiedColumnWidths, eSubformLayout); |
1557 } | 1558 } |
1558 } | 1559 } |
1559 pLayoutChild->m_sPos.y = fCurrentRowY; | 1560 pLayoutChild->m_sPos.y = fCurrentRowY; |
1560 if (bContainerWidthAutoSize) { | 1561 if (bContainerWidthAutoSize) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight); | 1654 fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight); |
1654 } | 1655 } |
1655 if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { | 1656 if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { |
1656 pProcessor->SplitLayoutItem(fNewSplitPos); | 1657 pProcessor->SplitLayoutItem(fNewSplitPos); |
1657 } | 1658 } |
1658 return; | 1659 return; |
1659 } | 1660 } |
1660 XFA_ItemLayoutProcessor_UpdatePendedItemLayout(pProcessor, | 1661 XFA_ItemLayoutProcessor_UpdatePendedItemLayout(pProcessor, |
1661 pTrailerLayoutItem); | 1662 pTrailerLayoutItem); |
1662 CXFA_Node* pMarginNode = | 1663 CXFA_Node* pMarginNode = |
1663 pProcessor->m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); | 1664 pProcessor->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
1664 FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; | 1665 FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; |
1665 if (pMarginNode) { | 1666 if (pMarginNode) { |
1666 fLeftInset = | 1667 fLeftInset = |
1667 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); | 1668 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); |
1668 fTopInset = | 1669 fTopInset = |
1669 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); | 1670 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); |
1670 fRightInset = | 1671 fRightInset = |
1671 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); | 1672 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); |
1672 fBottomInset = | 1673 fBottomInset = |
1673 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); | 1674 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 break; | 1708 break; |
1708 } | 1709 } |
1709 pProcessor->m_pLayoutItem->m_sSize.y += fHeight; | 1710 pProcessor->m_pLayoutItem->m_sSize.y += fHeight; |
1710 pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem); | 1711 pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem); |
1711 } | 1712 } |
1712 static void XFA_ItemLayoutProcessor_AddLeaderAfterSplit( | 1713 static void XFA_ItemLayoutProcessor_AddLeaderAfterSplit( |
1713 CXFA_ItemLayoutProcessor* pProcessor, | 1714 CXFA_ItemLayoutProcessor* pProcessor, |
1714 CXFA_ContentLayoutItem* pLeaderLayoutItem) { | 1715 CXFA_ContentLayoutItem* pLeaderLayoutItem) { |
1715 XFA_ItemLayoutProcessor_UpdatePendedItemLayout(pProcessor, pLeaderLayoutItem); | 1716 XFA_ItemLayoutProcessor_UpdatePendedItemLayout(pProcessor, pLeaderLayoutItem); |
1716 CXFA_Node* pMarginNode = | 1717 CXFA_Node* pMarginNode = |
1717 pProcessor->m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); | 1718 pProcessor->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
1718 FX_FLOAT fLeftInset = 0; | 1719 FX_FLOAT fLeftInset = 0; |
1719 FX_FLOAT fRightInset = 0; | 1720 FX_FLOAT fRightInset = 0; |
1720 if (pMarginNode) { | 1721 if (pMarginNode) { |
1721 fLeftInset = | 1722 fLeftInset = |
1722 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); | 1723 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); |
1723 fRightInset = | 1724 fRightInset = |
1724 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); | 1725 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); |
1725 } | 1726 } |
1726 FX_FLOAT fHeight = pLeaderLayoutItem->m_sSize.y; | 1727 FX_FLOAT fHeight = pLeaderLayoutItem->m_sSize.y; |
1727 for (CXFA_ContentLayoutItem* pChildItem = | 1728 for (CXFA_ContentLayoutItem* pChildItem = |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( | 1902 void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( |
1902 CXFA_Node* pLeaderNode, | 1903 CXFA_Node* pLeaderNode, |
1903 CXFA_Node* pTrailerNode, | 1904 CXFA_Node* pTrailerNode, |
1904 CXFA_ContentLayoutItem* pTrailerItem, | 1905 CXFA_ContentLayoutItem* pTrailerItem, |
1905 CXFA_Node* pFormNode) { | 1906 CXFA_Node* pFormNode) { |
1906 ProcessUnUseBinds(pLeaderNode); | 1907 ProcessUnUseBinds(pLeaderNode); |
1907 ProcessUnUseBinds(pTrailerNode); | 1908 ProcessUnUseBinds(pTrailerNode); |
1908 if (pFormNode == NULL) { | 1909 if (pFormNode == NULL) { |
1909 return; | 1910 return; |
1910 } | 1911 } |
1911 if (pFormNode->GetClassID() == XFA_ELEMENT_Overflow || | 1912 if (pFormNode->GetClassID() == XFA_Element::Overflow || |
1912 pFormNode->GetClassID() == XFA_ELEMENT_Break) { | 1913 pFormNode->GetClassID() == XFA_Element::Break) { |
1913 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); | 1914 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); |
1914 } | 1915 } |
1915 if (pLeaderNode && pFormNode) { | 1916 if (pLeaderNode && pFormNode) { |
1916 pFormNode->RemoveChild(pLeaderNode); | 1917 pFormNode->RemoveChild(pLeaderNode); |
1917 } | 1918 } |
1918 if (pTrailerNode && pFormNode) { | 1919 if (pTrailerNode && pFormNode) { |
1919 pFormNode->RemoveChild(pTrailerNode); | 1920 pFormNode->RemoveChild(pTrailerNode); |
1920 } | 1921 } |
1921 if (pTrailerItem) { | 1922 if (pTrailerItem) { |
1922 XFA_ReleaseLayoutItem(pTrailerItem); | 1923 XFA_ReleaseLayoutItem(pTrailerItem); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2305 XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode); | 2306 XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode); |
2306 if (pChildContainer && | 2307 if (pChildContainer && |
2307 pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling, | 2308 pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling, |
2308 XFA_ObjectType::ContainerNode)) { | 2309 XFA_ObjectType::ContainerNode)) { |
2309 fContainerHeight = 0; | 2310 fContainerHeight = 0; |
2310 bContainerHeightAutoSize = TRUE; | 2311 bContainerHeightAutoSize = TRUE; |
2311 } | 2312 } |
2312 } | 2313 } |
2313 } | 2314 } |
2314 CXFA_Node* pMarginNode = | 2315 CXFA_Node* pMarginNode = |
2315 m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); | 2316 m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
2316 FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; | 2317 FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; |
2317 if (pMarginNode) { | 2318 if (pMarginNode) { |
2318 fLeftInset = | 2319 fLeftInset = |
2319 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); | 2320 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); |
2320 fTopInset = | 2321 fTopInset = |
2321 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); | 2322 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); |
2322 fRightInset = | 2323 fRightInset = |
2323 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); | 2324 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); |
2324 fBottomInset = | 2325 fBottomInset = |
2325 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); | 2326 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2461 CXFA_ContentLayoutItem* pItem = m_arrayKeepItems.GetAt(iIndex); | 2462 CXFA_ContentLayoutItem* pItem = m_arrayKeepItems.GetAt(iIndex); |
2462 m_pLayoutItem->RemoveChild(pItem); | 2463 m_pLayoutItem->RemoveChild(pItem); |
2463 fContentCalculatedHeight -= pItem->m_sSize.y; | 2464 fContentCalculatedHeight -= pItem->m_sSize.y; |
2464 } | 2465 } |
2465 CXFA_Node *pLeaderNode = NULL, *pTrailerNode = NULL; | 2466 CXFA_Node *pLeaderNode = NULL, *pTrailerNode = NULL; |
2466 FX_BOOL bCreatePage = FALSE; | 2467 FX_BOOL bCreatePage = FALSE; |
2467 if (bUseBreakControl && m_pPageMgr && | 2468 if (bUseBreakControl && m_pPageMgr && |
2468 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, TRUE, | 2469 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, TRUE, |
2469 pLeaderNode, pTrailerNode, | 2470 pLeaderNode, pTrailerNode, |
2470 bCreatePage) && | 2471 bCreatePage) && |
2471 m_pFormNode->GetClassID() != XFA_ELEMENT_Form && bCreatePage) { | 2472 m_pFormNode->GetClassID() != XFA_Element::Form && bCreatePage) { |
2472 if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { | 2473 if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { |
2473 XFA_ItemLayoutProcessor_AddPendingNode(this, pLeaderNode, TRUE); | 2474 XFA_ItemLayoutProcessor_AddPendingNode(this, pLeaderNode, TRUE); |
2474 } | 2475 } |
2475 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { | 2476 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { |
2476 if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)->GetClassID() == | 2477 if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)->GetClassID() == |
2477 XFA_ELEMENT_Form && | 2478 XFA_Element::Form && |
2478 m_pLayoutItem == NULL) { | 2479 m_pLayoutItem == NULL) { |
2479 XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode, | 2480 XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode, |
2480 TRUE); | 2481 TRUE); |
2481 } else { | 2482 } else { |
2482 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( | 2483 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( |
2483 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); | 2484 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); |
2484 XFA_ItemLayoutProcessor_InsertFlowedItem( | 2485 XFA_ItemLayoutProcessor_InsertFlowedItem( |
2485 this, pTempProcessor.get(), bContainerWidthAutoSize, | 2486 this, pTempProcessor.get(), bContainerWidthAutoSize, |
2486 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2487 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
2487 uCurHAlignState, rgCurLineLayoutItems, FALSE, | 2488 uCurHAlignState, rgCurLineLayoutItems, FALSE, |
(...skipping 10 matching lines...) Expand all Loading... |
2498 goto SuspendAndCreateNewRow; | 2499 goto SuspendAndCreateNewRow; |
2499 } | 2500 } |
2500 } break; | 2501 } break; |
2501 case XFA_ItemLayoutProcessorStages_BreakAfter: { | 2502 case XFA_ItemLayoutProcessorStages_BreakAfter: { |
2502 CXFA_Node *pLeaderNode = NULL, *pTrailerNode = NULL; | 2503 CXFA_Node *pLeaderNode = NULL, *pTrailerNode = NULL; |
2503 FX_BOOL bCreatePage = FALSE; | 2504 FX_BOOL bCreatePage = FALSE; |
2504 if (bUseBreakControl && m_pPageMgr && | 2505 if (bUseBreakControl && m_pPageMgr && |
2505 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, FALSE, | 2506 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, FALSE, |
2506 pLeaderNode, pTrailerNode, | 2507 pLeaderNode, pTrailerNode, |
2507 bCreatePage) && | 2508 bCreatePage) && |
2508 m_pFormNode->GetClassID() != XFA_ELEMENT_Form) { | 2509 m_pFormNode->GetClassID() != XFA_Element::Form) { |
2509 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { | 2510 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { |
2510 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( | 2511 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( |
2511 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); | 2512 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); |
2512 XFA_ItemLayoutProcessor_InsertFlowedItem( | 2513 XFA_ItemLayoutProcessor_InsertFlowedItem( |
2513 this, pTempProcessor.get(), bContainerWidthAutoSize, | 2514 this, pTempProcessor.get(), bContainerWidthAutoSize, |
2514 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2515 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
2515 uCurHAlignState, rgCurLineLayoutItems, FALSE, | 2516 uCurHAlignState, rgCurLineLayoutItems, FALSE, |
2516 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, | 2517 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, |
2517 fContentWidthLimit, fContentCurRowAvailWidth, | 2518 fContentWidthLimit, fContentCurRowAvailWidth, |
2518 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, | 2519 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2601 pContext) != XFA_ItemLayoutProcessorResult_Done) { | 2602 pContext) != XFA_ItemLayoutProcessorResult_Done) { |
2602 goto SuspendAndCreateNewRow; | 2603 goto SuspendAndCreateNewRow; |
2603 } else { | 2604 } else { |
2604 delete pProcessor; | 2605 delete pProcessor; |
2605 pProcessor = NULL; | 2606 pProcessor = NULL; |
2606 } | 2607 } |
2607 } | 2608 } |
2608 } break; | 2609 } break; |
2609 case XFA_ItemLayoutProcessorStages_Container: | 2610 case XFA_ItemLayoutProcessorStages_Container: |
2610 ASSERT(m_pCurChildNode->IsContainerNode()); | 2611 ASSERT(m_pCurChildNode->IsContainerNode()); |
2611 if (m_pCurChildNode->GetClassID() == XFA_ELEMENT_Variables) { | 2612 if (m_pCurChildNode->GetClassID() == XFA_Element::Variables) { |
2612 break; | 2613 break; |
2613 } | 2614 } |
2614 if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION && | 2615 if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION && |
2615 XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) { | 2616 XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) { |
2616 bForceEndPage = TRUE; | 2617 bForceEndPage = TRUE; |
2617 goto SuspendAndCreateNewRow; | 2618 goto SuspendAndCreateNewRow; |
2618 } | 2619 } |
2619 if (m_pCurChildNode->IsContainerNode()) { | 2620 if (m_pCurChildNode->IsContainerNode()) { |
2620 FX_BOOL bNewRow = FALSE; | 2621 FX_BOOL bNewRow = FALSE; |
2621 if (m_pCurChildPreprocessor) { | 2622 if (m_pCurChildPreprocessor) { |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2862 if (bContainerHeightAutoSize) { | 2863 if (bContainerHeightAutoSize) { |
2863 FX_FLOAT fChildSuppliedHeight = fContentCurRowY; | 2864 FX_FLOAT fChildSuppliedHeight = fContentCurRowY; |
2864 if (fContentCalculatedHeight < fChildSuppliedHeight) { | 2865 if (fContentCalculatedHeight < fChildSuppliedHeight) { |
2865 fContentCalculatedHeight = fChildSuppliedHeight; | 2866 fContentCalculatedHeight = fChildSuppliedHeight; |
2866 } | 2867 } |
2867 } | 2868 } |
2868 return TRUE; | 2869 return TRUE; |
2869 } | 2870 } |
2870 CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent( | 2871 CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent( |
2871 CXFA_Node* pSubformSet) { | 2872 CXFA_Node* pSubformSet) { |
2872 if (pSubformSet && pSubformSet->GetClassID() == XFA_ELEMENT_SubformSet) { | 2873 if (pSubformSet && pSubformSet->GetClassID() == XFA_Element::SubformSet) { |
2873 CXFA_Node* pParent = pSubformSet->GetNodeItem(XFA_NODEITEM_Parent); | 2874 CXFA_Node* pParent = pSubformSet->GetNodeItem(XFA_NODEITEM_Parent); |
2874 while (pParent) { | 2875 while (pParent) { |
2875 if (pParent->GetClassID() != XFA_ELEMENT_SubformSet) { | 2876 if (pParent->GetClassID() != XFA_Element::SubformSet) { |
2876 return pParent; | 2877 return pParent; |
2877 } | 2878 } |
2878 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); | 2879 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); |
2879 } | 2880 } |
2880 } | 2881 } |
2881 return pSubformSet; | 2882 return pSubformSet; |
2882 } | 2883 } |
2883 void CXFA_ItemLayoutProcessor::DoLayoutField() { | 2884 void CXFA_ItemLayoutProcessor::DoLayoutField() { |
2884 if (m_pLayoutItem) | 2885 if (m_pLayoutItem) |
2885 return; | 2886 return; |
(...skipping 16 matching lines...) Expand all Loading... |
2902 fWidth = fHeight; | 2903 fWidth = fHeight; |
2903 fHeight = fTmp; | 2904 fHeight = fTmp; |
2904 } | 2905 } |
2905 SetCurrentComponentSize(fWidth, fHeight); | 2906 SetCurrentComponentSize(fWidth, fHeight); |
2906 } | 2907 } |
2907 XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout( | 2908 XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout( |
2908 FX_BOOL bUseBreakControl, | 2909 FX_BOOL bUseBreakControl, |
2909 FX_FLOAT fHeightLimit, | 2910 FX_FLOAT fHeightLimit, |
2910 FX_FLOAT fRealHeight, | 2911 FX_FLOAT fRealHeight, |
2911 CXFA_LayoutContext* pContext) { | 2912 CXFA_LayoutContext* pContext) { |
2912 XFA_ELEMENT eClassID = m_pFormNode->GetClassID(); | 2913 XFA_Element eClassID = m_pFormNode->GetClassID(); |
2913 switch (eClassID) { | 2914 switch (eClassID) { |
2914 case XFA_ELEMENT_Subform: | 2915 case XFA_Element::Subform: |
2915 case XFA_ELEMENT_Area: | 2916 case XFA_Element::Area: |
2916 case XFA_ELEMENT_ExclGroup: | 2917 case XFA_Element::ExclGroup: |
2917 case XFA_ELEMENT_SubformSet: { | 2918 case XFA_Element::SubformSet: { |
2918 FX_BOOL bRootForceTb = FALSE; | 2919 FX_BOOL bRootForceTb = FALSE; |
2919 CXFA_Node* pLayoutNode = GetSubformSetParent(m_pFormNode); | 2920 CXFA_Node* pLayoutNode = GetSubformSetParent(m_pFormNode); |
2920 XFA_ATTRIBUTEENUM eLayoutStrategy = | 2921 XFA_ATTRIBUTEENUM eLayoutStrategy = |
2921 XFA_ItemLayoutProcessor_GetLayout(pLayoutNode, bRootForceTb); | 2922 XFA_ItemLayoutProcessor_GetLayout(pLayoutNode, bRootForceTb); |
2922 switch (eLayoutStrategy) { | 2923 switch (eLayoutStrategy) { |
2923 case XFA_ATTRIBUTEENUM_Tb: | 2924 case XFA_ATTRIBUTEENUM_Tb: |
2924 case XFA_ATTRIBUTEENUM_Lr_tb: | 2925 case XFA_ATTRIBUTEENUM_Lr_tb: |
2925 case XFA_ATTRIBUTEENUM_Rl_tb: | 2926 case XFA_ATTRIBUTEENUM_Rl_tb: |
2926 return DoLayoutFlowedContainer(bUseBreakControl, eLayoutStrategy, | 2927 return DoLayoutFlowedContainer(bUseBreakControl, eLayoutStrategy, |
2927 fHeightLimit, fRealHeight, pContext, | 2928 fHeightLimit, fRealHeight, pContext, |
2928 bRootForceTb); | 2929 bRootForceTb); |
2929 case XFA_ATTRIBUTEENUM_Position: | 2930 case XFA_ATTRIBUTEENUM_Position: |
2930 case XFA_ATTRIBUTEENUM_Row: | 2931 case XFA_ATTRIBUTEENUM_Row: |
2931 case XFA_ATTRIBUTEENUM_Rl_row: | 2932 case XFA_ATTRIBUTEENUM_Rl_row: |
2932 default: | 2933 default: |
2933 DoLayoutPositionedContainer(pContext); | 2934 DoLayoutPositionedContainer(pContext); |
2934 m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages_Done; | 2935 m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages_Done; |
2935 return XFA_ItemLayoutProcessorResult_Done; | 2936 return XFA_ItemLayoutProcessorResult_Done; |
2936 case XFA_ATTRIBUTEENUM_Table: | 2937 case XFA_ATTRIBUTEENUM_Table: |
2937 DoLayoutTableContainer(pLayoutNode); | 2938 DoLayoutTableContainer(pLayoutNode); |
2938 m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages_Done; | 2939 m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages_Done; |
2939 return XFA_ItemLayoutProcessorResult_Done; | 2940 return XFA_ItemLayoutProcessorResult_Done; |
2940 } | 2941 } |
2941 } | 2942 } |
2942 case XFA_ELEMENT_Draw: | 2943 case XFA_Element::Draw: |
2943 case XFA_ELEMENT_Field: | 2944 case XFA_Element::Field: |
2944 DoLayoutField(); | 2945 DoLayoutField(); |
2945 m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages_Done; | 2946 m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages_Done; |
2946 return XFA_ItemLayoutProcessorResult_Done; | 2947 return XFA_ItemLayoutProcessorResult_Done; |
2947 case XFA_ELEMENT_ContentArea: | 2948 case XFA_Element::ContentArea: |
2948 return XFA_ItemLayoutProcessorResult_Done; | 2949 return XFA_ItemLayoutProcessorResult_Done; |
2949 default: | 2950 default: |
2950 return XFA_ItemLayoutProcessorResult_Done; | 2951 return XFA_ItemLayoutProcessorResult_Done; |
2951 } | 2952 } |
2952 } | 2953 } |
2953 void CXFA_ItemLayoutProcessor::GetCurrentComponentPos(FX_FLOAT& fAbsoluteX, | 2954 void CXFA_ItemLayoutProcessor::GetCurrentComponentPos(FX_FLOAT& fAbsoluteX, |
2954 FX_FLOAT& fAbsoluteY) { | 2955 FX_FLOAT& fAbsoluteY) { |
2955 ASSERT(m_pLayoutItem); | 2956 ASSERT(m_pLayoutItem); |
2956 fAbsoluteX = m_pLayoutItem->m_sPos.x; | 2957 fAbsoluteX = m_pLayoutItem->m_sPos.x; |
2957 fAbsoluteY = m_pLayoutItem->m_sPos.y; | 2958 fAbsoluteY = m_pLayoutItem->m_sPos.y; |
(...skipping 15 matching lines...) Expand all Loading... |
2973 | 2974 |
2974 FX_BOOL CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur( | 2975 FX_BOOL CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur( |
2975 CXFA_Node* pFormNode) { | 2976 CXFA_Node* pFormNode) { |
2976 if (!pFormNode) | 2977 if (!pFormNode) |
2977 return FALSE; | 2978 return FALSE; |
2978 | 2979 |
2979 CXFA_Node* pTemplate = pFormNode->GetTemplateNode(); | 2980 CXFA_Node* pTemplate = pFormNode->GetTemplateNode(); |
2980 if (!pTemplate) | 2981 if (!pTemplate) |
2981 pTemplate = pFormNode; | 2982 pTemplate = pFormNode; |
2982 | 2983 |
2983 CXFA_Occur NodeOccur(pTemplate->GetFirstChildByClass(XFA_ELEMENT_Occur)); | 2984 CXFA_Occur NodeOccur(pTemplate->GetFirstChildByClass(XFA_Element::Occur)); |
2984 int32_t iMax = NodeOccur.GetMax(); | 2985 int32_t iMax = NodeOccur.GetMax(); |
2985 if (iMax < 0) | 2986 if (iMax < 0) |
2986 return TRUE; | 2987 return TRUE; |
2987 | 2988 |
2988 int32_t iCount = m_PendingNodesCount[pTemplate]; | 2989 int32_t iCount = m_PendingNodesCount[pTemplate]; |
2989 if (iCount >= iMax) | 2990 if (iCount >= iMax) |
2990 return FALSE; | 2991 return FALSE; |
2991 | 2992 |
2992 m_PendingNodesCount[pTemplate] = iCount + 1; | 2993 m_PendingNodesCount[pTemplate] = iCount + 1; |
2993 return TRUE; | 2994 return TRUE; |
2994 } | 2995 } |
OLD | NEW |