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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( | 80 CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( |
81 CXFA_Node* pFormNode) { | 81 CXFA_Node* pFormNode) { |
82 if (!pFormNode) { | 82 if (!pFormNode) { |
83 return NULL; | 83 return nullptr; |
84 } | 84 } |
85 CXFA_ContentLayoutItem* pLayoutItem = NULL; | 85 CXFA_ContentLayoutItem* pLayoutItem = nullptr; |
86 if (m_pOldLayoutItem) { | 86 if (m_pOldLayoutItem) { |
87 pLayoutItem = m_pOldLayoutItem; | 87 pLayoutItem = m_pOldLayoutItem; |
88 m_pOldLayoutItem = m_pOldLayoutItem->m_pNext; | 88 m_pOldLayoutItem = m_pOldLayoutItem->m_pNext; |
89 return pLayoutItem; | 89 return pLayoutItem; |
90 } | 90 } |
91 pLayoutItem = (CXFA_ContentLayoutItem*)pFormNode->GetDocument() | 91 pLayoutItem = (CXFA_ContentLayoutItem*)pFormNode->GetDocument() |
92 ->GetParser() | 92 ->GetParser() |
93 ->GetNotify() | 93 ->GetNotify() |
94 ->OnCreateLayoutItem(pFormNode); | 94 ->OnCreateLayoutItem(pFormNode); |
95 CXFA_ContentLayoutItem* pPrevLayoutItem = | 95 CXFA_ContentLayoutItem* pPrevLayoutItem = |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 return eLayoutMode; | 197 return eLayoutMode; |
198 } | 198 } |
199 CXFA_Node* pParentNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); | 199 CXFA_Node* pParentNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); |
200 if (pParentNode && pParentNode->GetClassID() == XFA_ELEMENT_Form) { | 200 if (pParentNode && pParentNode->GetClassID() == XFA_ELEMENT_Form) { |
201 bRootForceTb = TRUE; | 201 bRootForceTb = TRUE; |
202 return XFA_ATTRIBUTEENUM_Tb; | 202 return XFA_ATTRIBUTEENUM_Tb; |
203 } | 203 } |
204 return XFA_ATTRIBUTEENUM_Position; | 204 return XFA_ATTRIBUTEENUM_Position; |
205 } | 205 } |
206 static FX_BOOL XFA_ExistContainerKeep(CXFA_Node* pCurNode, FX_BOOL bPreFind) { | 206 static FX_BOOL XFA_ExistContainerKeep(CXFA_Node* pCurNode, FX_BOOL bPreFind) { |
207 if (pCurNode == NULL || !XFA_ItemLayoutProcessor_IsTakingSpace(pCurNode)) { | 207 if (!pCurNode || !XFA_ItemLayoutProcessor_IsTakingSpace(pCurNode)) |
208 return FALSE; | 208 return FALSE; |
209 } | 209 |
210 XFA_NODEITEM eItemType = XFA_NODEITEM_PrevSibling; | 210 XFA_NODEITEM eItemType = XFA_NODEITEM_PrevSibling; |
211 if (!bPreFind) { | 211 if (!bPreFind) { |
212 eItemType = XFA_NODEITEM_NextSibling; | 212 eItemType = XFA_NODEITEM_NextSibling; |
213 } | 213 } |
214 CXFA_Node* pPreContainer = | 214 CXFA_Node* pPreContainer = |
215 pCurNode->GetNodeItem(eItemType, XFA_OBJECTTYPE_ContainerNode); | 215 pCurNode->GetNodeItem(eItemType, XFA_OBJECTTYPE_ContainerNode); |
216 if (pPreContainer == NULL) { | 216 if (!pPreContainer) |
217 return FALSE; | 217 return FALSE; |
218 } | 218 |
219 CXFA_Node* pKeep = pCurNode->GetFirstChildByClass(XFA_ELEMENT_Keep); | 219 CXFA_Node* pKeep = pCurNode->GetFirstChildByClass(XFA_ELEMENT_Keep); |
220 if (pKeep) { | 220 if (pKeep) { |
221 XFA_ATTRIBUTEENUM ePrevious; | 221 XFA_ATTRIBUTEENUM ePrevious; |
222 XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Previous; | 222 XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Previous; |
223 if (!bPreFind) { | 223 if (!bPreFind) { |
224 eKeepType = XFA_ATTRIBUTE_Next; | 224 eKeepType = XFA_ATTRIBUTE_Next; |
225 } | 225 } |
226 if (pKeep->TryEnum(eKeepType, ePrevious, FALSE)) { | 226 if (pKeep->TryEnum(eKeepType, ePrevious, FALSE)) { |
227 if (ePrevious == XFA_ATTRIBUTEENUM_ContentArea || | 227 if (ePrevious == XFA_ATTRIBUTEENUM_ContentArea || |
228 ePrevious == XFA_ATTRIBUTEENUM_PageArea) { | 228 ePrevious == XFA_ATTRIBUTEENUM_PageArea) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 bCalculateMargin = FALSE; | 275 bCalculateMargin = FALSE; |
276 } | 276 } |
277 CXFA_Node* pMarginNode = | 277 CXFA_Node* pMarginNode = |
278 pLayoutItem->m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); | 278 pLayoutItem->m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); |
279 if (pMarginNode && bCalculateMargin) { | 279 if (pMarginNode && bCalculateMargin) { |
280 fCurTopMargin = | 280 fCurTopMargin = |
281 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); | 281 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); |
282 fCurBottomMargin = | 282 fCurBottomMargin = |
283 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); | 283 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); |
284 } | 284 } |
285 CXFA_ContentLayoutItem* pSecondLayoutItem = NULL; | 285 CXFA_ContentLayoutItem* pSecondLayoutItem = nullptr; |
286 if (m_pCurChildPreprocessor && | 286 if (m_pCurChildPreprocessor && |
287 m_pCurChildPreprocessor->m_pFormNode == pLayoutItem->m_pFormNode) { | 287 m_pCurChildPreprocessor->m_pFormNode == pLayoutItem->m_pFormNode) { |
288 pSecondLayoutItem = m_pCurChildPreprocessor->CreateContentLayoutItem( | 288 pSecondLayoutItem = m_pCurChildPreprocessor->CreateContentLayoutItem( |
289 pLayoutItem->m_pFormNode); | 289 pLayoutItem->m_pFormNode); |
290 } else { | 290 } else { |
291 pSecondLayoutItem = CreateContentLayoutItem(pLayoutItem->m_pFormNode); | 291 pSecondLayoutItem = CreateContentLayoutItem(pLayoutItem->m_pFormNode); |
292 } | 292 } |
293 pSecondLayoutItem->m_sPos.x = pLayoutItem->m_sPos.x; | 293 pSecondLayoutItem->m_sPos.x = pLayoutItem->m_sPos.x; |
294 pSecondLayoutItem->m_sSize.x = pLayoutItem->m_sSize.x; | 294 pSecondLayoutItem->m_sSize.x = pLayoutItem->m_sSize.x; |
295 pSecondLayoutItem->m_sPos.y = 0; | 295 pSecondLayoutItem->m_sPos.y = 0; |
(...skipping 13 matching lines...) Expand all Loading... |
309 pParentItem = (CXFA_ContentLayoutItem*)pParentItem->m_pParent; | 309 pParentItem = (CXFA_ContentLayoutItem*)pParentItem->m_pParent; |
310 } | 310 } |
311 } | 311 } |
312 } else { | 312 } else { |
313 pSecondLayoutItem->m_pParent = pLayoutItem->m_pParent; | 313 pSecondLayoutItem->m_pParent = pLayoutItem->m_pParent; |
314 pSecondLayoutItem->m_pNextSibling = pLayoutItem->m_pNextSibling; | 314 pSecondLayoutItem->m_pNextSibling = pLayoutItem->m_pNextSibling; |
315 pLayoutItem->m_pNextSibling = pSecondLayoutItem; | 315 pLayoutItem->m_pNextSibling = pSecondLayoutItem; |
316 } | 316 } |
317 CXFA_ContentLayoutItem* pChildren = | 317 CXFA_ContentLayoutItem* pChildren = |
318 (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; | 318 (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; |
319 pLayoutItem->m_pFirstChild = NULL; | 319 pLayoutItem->m_pFirstChild = nullptr; |
320 FX_FLOAT lHeightForKeep = 0; | 320 FX_FLOAT lHeightForKeep = 0; |
321 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> keepLayoutItems; | 321 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> keepLayoutItems; |
322 FX_FLOAT fAddMarginHeight = 0; | 322 FX_FLOAT fAddMarginHeight = 0; |
323 for (CXFA_ContentLayoutItem *pChildItem = pChildren, *pChildNext = NULL; | 323 for (CXFA_ContentLayoutItem *pChildItem = pChildren, *pChildNext = nullptr; |
324 pChildItem; pChildItem = pChildNext) { | 324 pChildItem; pChildItem = pChildNext) { |
325 pChildNext = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling; | 325 pChildNext = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling; |
326 pChildItem->m_pNextSibling = NULL; | 326 pChildItem->m_pNextSibling = nullptr; |
327 if (fSplitPos <= fCurTopMargin + pChildItem->m_sPos.y + fCurBottomMargin + | 327 if (fSplitPos <= fCurTopMargin + pChildItem->m_sPos.y + fCurBottomMargin + |
328 XFA_LAYOUT_FLOAT_PERCISION) { | 328 XFA_LAYOUT_FLOAT_PERCISION) { |
329 if (!XFA_ExistContainerKeep(pChildItem->m_pFormNode, TRUE)) { | 329 if (!XFA_ExistContainerKeep(pChildItem->m_pFormNode, TRUE)) { |
330 pChildItem->m_sPos.y -= fSplitPos - fCurBottomMargin; | 330 pChildItem->m_sPos.y -= fSplitPos - fCurBottomMargin; |
331 pChildItem->m_sPos.y += lHeightForKeep; | 331 pChildItem->m_sPos.y += lHeightForKeep; |
332 pChildItem->m_sPos.y += fAddMarginHeight; | 332 pChildItem->m_sPos.y += fAddMarginHeight; |
333 pSecondLayoutItem->AddChild(pChildItem); | 333 pSecondLayoutItem->AddChild(pChildItem); |
334 } else { | 334 } else { |
335 if (lHeightForKeep < XFA_LAYOUT_FLOAT_PERCISION) { | 335 if (lHeightForKeep < XFA_LAYOUT_FLOAT_PERCISION) { |
336 for (int32_t iIndex = 0; iIndex < keepLayoutItems.GetSize(); | 336 for (int32_t iIndex = 0; iIndex < keepLayoutItems.GetSize(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 SplitLayoutItem( | 371 SplitLayoutItem( |
372 pChildItem, pSecondLayoutItem, | 372 pChildItem, pSecondLayoutItem, |
373 fSplitPos - fCurTopMargin - fCurBottomMargin - pChildItem->m_sPos.y); | 373 fSplitPos - fCurTopMargin - fCurBottomMargin - pChildItem->m_sPos.y); |
374 fAddMarginHeight = pSecondLayoutItem->m_sSize.y - fOldHeight; | 374 fAddMarginHeight = pSecondLayoutItem->m_sSize.y - fOldHeight; |
375 pLayoutItem->AddChild(pChildItem); | 375 pLayoutItem->AddChild(pChildItem); |
376 } | 376 } |
377 } | 377 } |
378 } | 378 } |
379 void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) { | 379 void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) { |
380 ASSERT(m_pLayoutItem); | 380 ASSERT(m_pLayoutItem); |
381 SplitLayoutItem(m_pLayoutItem, NULL, fSplitPos); | 381 SplitLayoutItem(m_pLayoutItem, nullptr, fSplitPos); |
382 } | 382 } |
383 | 383 |
384 CXFA_ContainerLayoutItem* CXFA_LayoutItem::GetPage() const { | 384 CXFA_ContainerLayoutItem* CXFA_LayoutItem::GetPage() const { |
385 for (CXFA_LayoutItem* pCurNode = const_cast<CXFA_LayoutItem*>(this); pCurNode; | 385 for (CXFA_LayoutItem* pCurNode = const_cast<CXFA_LayoutItem*>(this); pCurNode; |
386 pCurNode = pCurNode->m_pParent) { | 386 pCurNode = pCurNode->m_pParent) { |
387 if (pCurNode->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea) | 387 if (pCurNode->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea) |
388 return static_cast<CXFA_ContainerLayoutItem*>(pCurNode); | 388 return static_cast<CXFA_ContainerLayoutItem*>(pCurNode); |
389 } | 389 } |
390 return nullptr; | 390 return nullptr; |
391 } | 391 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 iCount++; | 506 iCount++; |
507 } | 507 } |
508 return iCount; | 508 return iCount; |
509 } | 509 } |
510 | 510 |
511 void CXFA_LayoutItem::AddChild(CXFA_LayoutItem* pChildItem) { | 511 void CXFA_LayoutItem::AddChild(CXFA_LayoutItem* pChildItem) { |
512 if (pChildItem->m_pParent) { | 512 if (pChildItem->m_pParent) { |
513 pChildItem->m_pParent->RemoveChild(pChildItem); | 513 pChildItem->m_pParent->RemoveChild(pChildItem); |
514 } | 514 } |
515 pChildItem->m_pParent = this; | 515 pChildItem->m_pParent = this; |
516 if (m_pFirstChild == NULL) { | 516 if (m_pFirstChild) { |
517 m_pFirstChild = pChildItem; | |
518 } else { | |
519 CXFA_LayoutItem* pExistingChildItem = m_pFirstChild; | 517 CXFA_LayoutItem* pExistingChildItem = m_pFirstChild; |
520 while (pExistingChildItem->m_pNextSibling) { | 518 while (pExistingChildItem->m_pNextSibling) { |
521 pExistingChildItem = pExistingChildItem->m_pNextSibling; | 519 pExistingChildItem = pExistingChildItem->m_pNextSibling; |
522 } | 520 } |
523 pExistingChildItem->m_pNextSibling = pChildItem; | 521 pExistingChildItem->m_pNextSibling = pChildItem; |
| 522 } else { |
| 523 m_pFirstChild = pChildItem; |
524 } | 524 } |
525 } | 525 } |
526 void CXFA_LayoutItem::AddHeadChild(CXFA_LayoutItem* pChildItem) { | 526 void CXFA_LayoutItem::AddHeadChild(CXFA_LayoutItem* pChildItem) { |
527 if (pChildItem->m_pParent) { | 527 if (pChildItem->m_pParent) { |
528 pChildItem->m_pParent->RemoveChild(pChildItem); | 528 pChildItem->m_pParent->RemoveChild(pChildItem); |
529 } | 529 } |
530 pChildItem->m_pParent = this; | 530 pChildItem->m_pParent = this; |
531 if (m_pFirstChild == NULL) { | 531 if (m_pFirstChild) { |
532 m_pFirstChild = pChildItem; | |
533 } else { | |
534 CXFA_LayoutItem* pExistingChildItem = m_pFirstChild; | 532 CXFA_LayoutItem* pExistingChildItem = m_pFirstChild; |
535 m_pFirstChild = pChildItem; | 533 m_pFirstChild = pChildItem; |
536 m_pFirstChild->m_pNextSibling = pExistingChildItem; | 534 m_pFirstChild->m_pNextSibling = pExistingChildItem; |
| 535 } else { |
| 536 m_pFirstChild = pChildItem; |
537 } | 537 } |
538 } | 538 } |
539 void CXFA_LayoutItem::InsertChild(CXFA_LayoutItem* pBeforeItem, | 539 void CXFA_LayoutItem::InsertChild(CXFA_LayoutItem* pBeforeItem, |
540 CXFA_LayoutItem* pChildItem) { | 540 CXFA_LayoutItem* pChildItem) { |
541 if (pBeforeItem->m_pParent != this) { | 541 if (pBeforeItem->m_pParent != this) { |
542 return; | 542 return; |
543 } | 543 } |
544 if (pChildItem->m_pParent) { | 544 if (pChildItem->m_pParent) { |
545 pChildItem->m_pParent = NULL; | 545 pChildItem->m_pParent = nullptr; |
546 } | 546 } |
547 pChildItem->m_pParent = this; | 547 pChildItem->m_pParent = this; |
548 CXFA_LayoutItem* pExistingChildItem = pBeforeItem->m_pNextSibling; | 548 CXFA_LayoutItem* pExistingChildItem = pBeforeItem->m_pNextSibling; |
549 pBeforeItem->m_pNextSibling = pChildItem; | 549 pBeforeItem->m_pNextSibling = pChildItem; |
550 pChildItem->m_pNextSibling = pExistingChildItem; | 550 pChildItem->m_pNextSibling = pExistingChildItem; |
551 } | 551 } |
552 void CXFA_LayoutItem::RemoveChild(CXFA_LayoutItem* pChildItem) { | 552 void CXFA_LayoutItem::RemoveChild(CXFA_LayoutItem* pChildItem) { |
553 if (pChildItem->m_pParent != this) { | 553 if (pChildItem->m_pParent != this) { |
554 return; | 554 return; |
555 } | 555 } |
556 if (m_pFirstChild == pChildItem) { | 556 if (m_pFirstChild == pChildItem) { |
557 m_pFirstChild = pChildItem->m_pNextSibling; | 557 m_pFirstChild = pChildItem->m_pNextSibling; |
558 } else { | 558 } else { |
559 CXFA_LayoutItem* pExistingChildItem = m_pFirstChild; | 559 CXFA_LayoutItem* pExistingChildItem = m_pFirstChild; |
560 while (pExistingChildItem && | 560 while (pExistingChildItem && |
561 pExistingChildItem->m_pNextSibling != pChildItem) { | 561 pExistingChildItem->m_pNextSibling != pChildItem) { |
562 pExistingChildItem = pExistingChildItem->m_pNextSibling; | 562 pExistingChildItem = pExistingChildItem->m_pNextSibling; |
563 } | 563 } |
564 if (pExistingChildItem) { | 564 if (pExistingChildItem) { |
565 pExistingChildItem->m_pNextSibling = pChildItem->m_pNextSibling; | 565 pExistingChildItem->m_pNextSibling = pChildItem->m_pNextSibling; |
566 } | 566 } |
567 } | 567 } |
568 pChildItem->m_pNextSibling = NULL; | 568 pChildItem->m_pNextSibling = nullptr; |
569 pChildItem->m_pParent = NULL; | 569 pChildItem->m_pParent = nullptr; |
570 } | 570 } |
571 CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() { | 571 CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() { |
572 CXFA_ContentLayoutItem* pLayoutItem = m_pLayoutItem; | 572 CXFA_ContentLayoutItem* pLayoutItem = m_pLayoutItem; |
573 if (pLayoutItem) { | 573 if (pLayoutItem) { |
574 m_pLayoutItem = | 574 m_pLayoutItem = |
575 static_cast<CXFA_ContentLayoutItem*>(pLayoutItem->m_pNextSibling); | 575 static_cast<CXFA_ContentLayoutItem*>(pLayoutItem->m_pNextSibling); |
576 pLayoutItem->m_pNextSibling = nullptr; | 576 pLayoutItem->m_pNextSibling = nullptr; |
577 } | 577 } |
578 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Done || | 578 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Done || |
579 !ToContentLayoutItem(m_pOldLayoutItem)) | 579 !ToContentLayoutItem(m_pOldLayoutItem)) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 CXFA_FFNotify* pNotify = | 646 CXFA_FFNotify* pNotify = |
647 pGenerateNode->GetDocument()->GetParser()->GetNotify(); | 647 pGenerateNode->GetDocument()->GetParser()->GetNotify(); |
648 CXFA_LayoutProcessor* pDocLayout = | 648 CXFA_LayoutProcessor* pDocLayout = |
649 pGenerateNode->GetDocument()->GetDocLayout(); | 649 pGenerateNode->GetDocument()->GetDocLayout(); |
650 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator( | 650 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator( |
651 pGenerateNode); | 651 pGenerateNode); |
652 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; | 652 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; |
653 pNode = sIterator.MoveToNext()) { | 653 pNode = sIterator.MoveToNext()) { |
654 CXFA_ContentLayoutItem* pCurLayoutItem = | 654 CXFA_ContentLayoutItem* pCurLayoutItem = |
655 (CXFA_ContentLayoutItem*)pNode->GetUserData(XFA_LAYOUTITEMKEY); | 655 (CXFA_ContentLayoutItem*)pNode->GetUserData(XFA_LAYOUTITEMKEY); |
656 CXFA_ContentLayoutItem* pNextLayoutItem = NULL; | 656 CXFA_ContentLayoutItem* pNextLayoutItem = nullptr; |
657 while (pCurLayoutItem) { | 657 while (pCurLayoutItem) { |
658 pNextLayoutItem = pCurLayoutItem->m_pNext; | 658 pNextLayoutItem = pCurLayoutItem->m_pNext; |
659 pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem); | 659 pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem); |
660 delete pCurLayoutItem; | 660 delete pCurLayoutItem; |
661 pCurLayoutItem = pNextLayoutItem; | 661 pCurLayoutItem = pNextLayoutItem; |
662 } | 662 } |
663 } | 663 } |
664 pGenerateNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pGenerateNode); | 664 pGenerateNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pGenerateNode); |
665 } | 665 } |
666 void CXFA_ItemLayoutProcessor::XFA_ItemLayoutProcessor_GotoNextContainerNode( | 666 void CXFA_ItemLayoutProcessor::XFA_ItemLayoutProcessor_GotoNextContainerNode( |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 case XFA_ELEMENT_Break: | 812 case XFA_ELEMENT_Break: |
813 pCurActionNode = pBookendNode; | 813 pCurActionNode = pBookendNode; |
814 nCurStage = XFA_ItemLayoutProcessorStages_BookendTrailer; | 814 nCurStage = XFA_ItemLayoutProcessorStages_BookendTrailer; |
815 return; | 815 return; |
816 default: | 816 default: |
817 break; | 817 break; |
818 } | 818 } |
819 } | 819 } |
820 } | 820 } |
821 default: | 821 default: |
822 pCurActionNode = NULL; | 822 pCurActionNode = nullptr; |
823 nCurStage = XFA_ItemLayoutProcessorStages_Done; | 823 nCurStage = XFA_ItemLayoutProcessorStages_Done; |
824 } | 824 } |
825 } | 825 } |
826 FX_BOOL CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext( | 826 FX_BOOL CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext( |
827 CXFA_Node*& pCurActionNode, | 827 CXFA_Node*& pCurActionNode, |
828 XFA_ItemLayoutProcessorStages& nCurStage, | 828 XFA_ItemLayoutProcessorStages& nCurStage, |
829 CXFA_Node*& pNextContainer, | 829 CXFA_Node*& pNextContainer, |
830 FX_BOOL& bLastKeepNode) { | 830 FX_BOOL& bLastKeepNode) { |
831 const bool bCanSplit = pNextContainer->GetIntact() == XFA_ATTRIBUTEENUM_None; | 831 const bool bCanSplit = pNextContainer->GetIntact() == XFA_ATTRIBUTEENUM_None; |
832 FX_BOOL bNextKeep = FALSE; | 832 FX_BOOL bNextKeep = FALSE; |
833 if (XFA_ExistContainerKeep(pNextContainer, FALSE)) { | 833 if (XFA_ExistContainerKeep(pNextContainer, FALSE)) { |
834 bNextKeep = TRUE; | 834 bNextKeep = TRUE; |
835 } | 835 } |
836 if (bNextKeep && !bCanSplit) { | 836 if (bNextKeep && !bCanSplit) { |
837 if (!m_bIsProcessKeep && !m_bKeepBreakFinish) { | 837 if (!m_bIsProcessKeep && !m_bKeepBreakFinish) { |
838 m_pKeepHeadNode = pNextContainer; | 838 m_pKeepHeadNode = pNextContainer; |
839 m_bIsProcessKeep = TRUE; | 839 m_bIsProcessKeep = TRUE; |
840 } | 840 } |
841 } else { | 841 } else { |
842 if (m_bIsProcessKeep && m_pKeepHeadNode) { | 842 if (m_bIsProcessKeep && m_pKeepHeadNode) { |
843 m_pKeepTailNode = pNextContainer; | 843 m_pKeepTailNode = pNextContainer; |
844 if (!m_bKeepBreakFinish && | 844 if (!m_bKeepBreakFinish && |
845 XFA_ItemLayoutProcessor_FindBreakNode( | 845 XFA_ItemLayoutProcessor_FindBreakNode( |
846 pNextContainer->GetNodeItem(XFA_NODEITEM_FirstChild), | 846 pNextContainer->GetNodeItem(XFA_NODEITEM_FirstChild), |
847 pCurActionNode, nCurStage, TRUE)) { | 847 pCurActionNode, nCurStage, TRUE)) { |
848 return TRUE; | 848 return TRUE; |
849 } else { | 849 } else { |
850 pNextContainer = m_pKeepHeadNode; | 850 pNextContainer = m_pKeepHeadNode; |
851 m_bKeepBreakFinish = TRUE; | 851 m_bKeepBreakFinish = TRUE; |
852 m_pKeepHeadNode = NULL; | 852 m_pKeepHeadNode = nullptr; |
853 m_pKeepTailNode = NULL; | 853 m_pKeepTailNode = nullptr; |
854 m_bIsProcessKeep = FALSE; | 854 m_bIsProcessKeep = FALSE; |
855 } | 855 } |
856 } else { | 856 } else { |
857 if (m_bKeepBreakFinish) { | 857 if (m_bKeepBreakFinish) { |
858 bLastKeepNode = TRUE; | 858 bLastKeepNode = TRUE; |
859 } | 859 } |
860 m_bKeepBreakFinish = FALSE; | 860 m_bKeepBreakFinish = FALSE; |
861 } | 861 } |
862 } | 862 } |
863 return FALSE; | 863 return FALSE; |
864 } | 864 } |
865 FX_BOOL CXFA_ItemLayoutProcessor::ProcessKeepNodesForBreakBefore( | 865 FX_BOOL CXFA_ItemLayoutProcessor::ProcessKeepNodesForBreakBefore( |
866 CXFA_Node*& pCurActionNode, | 866 CXFA_Node*& pCurActionNode, |
867 XFA_ItemLayoutProcessorStages& nCurStage, | 867 XFA_ItemLayoutProcessorStages& nCurStage, |
868 CXFA_Node* pContainerNode) { | 868 CXFA_Node* pContainerNode) { |
869 if (m_pKeepTailNode == pContainerNode) { | 869 if (m_pKeepTailNode == pContainerNode) { |
870 pCurActionNode = m_pKeepHeadNode; | 870 pCurActionNode = m_pKeepHeadNode; |
871 m_bKeepBreakFinish = TRUE; | 871 m_bKeepBreakFinish = TRUE; |
872 m_pKeepHeadNode = NULL; | 872 m_pKeepHeadNode = nullptr; |
873 m_pKeepTailNode = NULL; | 873 m_pKeepTailNode = nullptr; |
874 m_bIsProcessKeep = FALSE; | 874 m_bIsProcessKeep = FALSE; |
875 nCurStage = XFA_ItemLayoutProcessorStages_Container; | 875 nCurStage = XFA_ItemLayoutProcessorStages_Container; |
876 return TRUE; | 876 return TRUE; |
877 } | 877 } |
878 CXFA_Node* pBreakAfterNode = | 878 CXFA_Node* pBreakAfterNode = |
879 pContainerNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 879 pContainerNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
880 if (XFA_ItemLayoutProcessor_FindBreakNode(pBreakAfterNode, pCurActionNode, | 880 if (XFA_ItemLayoutProcessor_FindBreakNode(pBreakAfterNode, pCurActionNode, |
881 nCurStage, FALSE)) { | 881 nCurStage, FALSE)) { |
882 return TRUE; | 882 return TRUE; |
883 } | 883 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 CXFA_Node* pNode, | 1040 CXFA_Node* pNode, |
1041 CXFA_Node* pParentNode) { | 1041 CXFA_Node* pParentNode) { |
1042 return FALSE; | 1042 return FALSE; |
1043 } | 1043 } |
1044 void CXFA_ItemLayoutProcessor::DoLayoutPageArea( | 1044 void CXFA_ItemLayoutProcessor::DoLayoutPageArea( |
1045 CXFA_ContainerLayoutItem* pPageAreaLayoutItem) { | 1045 CXFA_ContainerLayoutItem* pPageAreaLayoutItem) { |
1046 CXFA_Node* pFormNode = pPageAreaLayoutItem->m_pFormNode; | 1046 CXFA_Node* pFormNode = pPageAreaLayoutItem->m_pFormNode; |
1047 CXFA_Node* pCurChildNode = XFA_LAYOUT_INVALIDNODE; | 1047 CXFA_Node* pCurChildNode = XFA_LAYOUT_INVALIDNODE; |
1048 XFA_ItemLayoutProcessorStages nCurChildNodeStage = | 1048 XFA_ItemLayoutProcessorStages nCurChildNodeStage = |
1049 XFA_ItemLayoutProcessorStages_None; | 1049 XFA_ItemLayoutProcessorStages_None; |
1050 CXFA_LayoutItem* pBeforeItem = NULL; | 1050 CXFA_LayoutItem* pBeforeItem = nullptr; |
1051 for (XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1051 for (XFA_ItemLayoutProcessor_GotoNextContainerNode( |
1052 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE); | 1052 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE); |
1053 pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1053 pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( |
1054 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE)) { | 1054 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE)) { |
1055 if (nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { | 1055 if (nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { |
1056 continue; | 1056 continue; |
1057 } | 1057 } |
1058 if (pCurChildNode->GetClassID() == XFA_ELEMENT_Variables) { | 1058 if (pCurChildNode->GetClassID() == XFA_ELEMENT_Variables) { |
1059 continue; | 1059 continue; |
1060 } | 1060 } |
1061 CXFA_ItemLayoutProcessor* pProcessor = | 1061 CXFA_ItemLayoutProcessor* pProcessor = |
1062 new CXFA_ItemLayoutProcessor(pCurChildNode, NULL); | 1062 new CXFA_ItemLayoutProcessor(pCurChildNode, nullptr); |
1063 pProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); | 1063 pProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); |
1064 if (!pProcessor->HasLayoutItem()) { | 1064 if (!pProcessor->HasLayoutItem()) { |
1065 delete pProcessor; | 1065 delete pProcessor; |
1066 continue; | 1066 continue; |
1067 } | 1067 } |
1068 FX_FLOAT fWidth, fHeight; | 1068 FX_FLOAT fWidth, fHeight; |
1069 pProcessor->GetCurrentComponentSize(fWidth, fHeight); | 1069 pProcessor->GetCurrentComponentSize(fWidth, fHeight); |
1070 FX_FLOAT fAbsoluteX = 0, fAbsoluteY = 0; | 1070 FX_FLOAT fAbsoluteX = 0, fAbsoluteY = 0; |
1071 CalculatePositionedContainerPos(pCurChildNode, fWidth, fHeight, fAbsoluteX, | 1071 CalculatePositionedContainerPos(pCurChildNode, fWidth, fHeight, fAbsoluteX, |
1072 fAbsoluteY); | 1072 fAbsoluteY); |
1073 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); | 1073 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); |
1074 CXFA_LayoutItem* pProcessItem = pProcessor->ExtractLayoutItem(); | 1074 CXFA_LayoutItem* pProcessItem = pProcessor->ExtractLayoutItem(); |
1075 if (pBeforeItem == NULL) { | 1075 if (pBeforeItem) |
| 1076 pPageAreaLayoutItem->InsertChild(pBeforeItem, pProcessItem); |
| 1077 else |
1076 pPageAreaLayoutItem->AddHeadChild(pProcessItem); | 1078 pPageAreaLayoutItem->AddHeadChild(pProcessItem); |
1077 } else { | |
1078 pPageAreaLayoutItem->InsertChild(pBeforeItem, pProcessItem); | |
1079 } | |
1080 pBeforeItem = pProcessItem; | 1079 pBeforeItem = pProcessItem; |
1081 delete pProcessor; | 1080 delete pProcessor; |
1082 } | 1081 } |
1083 pBeforeItem = NULL; | 1082 pBeforeItem = nullptr; |
1084 CXFA_LayoutItem* pLayoutItem = pPageAreaLayoutItem->m_pFirstChild; | 1083 CXFA_LayoutItem* pLayoutItem = pPageAreaLayoutItem->m_pFirstChild; |
1085 while (pLayoutItem) { | 1084 while (pLayoutItem) { |
1086 if (!pLayoutItem->IsContentLayoutItem() || | 1085 if (!pLayoutItem->IsContentLayoutItem() || |
1087 pLayoutItem->m_pFormNode->GetClassID() != XFA_ELEMENT_Draw) { | 1086 pLayoutItem->m_pFormNode->GetClassID() != XFA_ELEMENT_Draw) { |
1088 pLayoutItem = pLayoutItem->m_pNextSibling; | 1087 pLayoutItem = pLayoutItem->m_pNextSibling; |
1089 continue; | 1088 continue; |
1090 } | 1089 } |
1091 if (pLayoutItem->m_pFormNode->GetClassID() == XFA_ELEMENT_Draw) { | 1090 if (pLayoutItem->m_pFormNode->GetClassID() == XFA_ELEMENT_Draw) { |
1092 CXFA_LayoutItem* pNextLayoutItem = pLayoutItem->m_pNextSibling; | 1091 CXFA_LayoutItem* pNextLayoutItem = pLayoutItem->m_pNextSibling; |
1093 pPageAreaLayoutItem->RemoveChild(pLayoutItem); | 1092 pPageAreaLayoutItem->RemoveChild(pLayoutItem); |
1094 if (pBeforeItem == NULL) { | 1093 if (pBeforeItem) |
| 1094 pPageAreaLayoutItem->InsertChild(pBeforeItem, pLayoutItem); |
| 1095 else |
1095 pPageAreaLayoutItem->AddHeadChild(pLayoutItem); | 1096 pPageAreaLayoutItem->AddHeadChild(pLayoutItem); |
1096 } else { | |
1097 pPageAreaLayoutItem->InsertChild(pBeforeItem, pLayoutItem); | |
1098 } | |
1099 pBeforeItem = pLayoutItem; | 1097 pBeforeItem = pLayoutItem; |
1100 pLayoutItem = pNextLayoutItem; | 1098 pLayoutItem = pNextLayoutItem; |
1101 } | 1099 } |
1102 } | 1100 } |
1103 } | 1101 } |
1104 void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( | 1102 void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( |
1105 CXFA_LayoutContext* pContext) { | 1103 CXFA_LayoutContext* pContext) { |
1106 if (m_pLayoutItem) | 1104 if (m_pLayoutItem) |
1107 return; | 1105 return; |
1108 | 1106 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( | 1370 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( |
1373 pLayoutRow->m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, | 1371 pLayoutRow->m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, |
1374 fContainerWidth, bContainerHeightAutoSize, fContentCalculatedHeight, | 1372 fContainerWidth, bContainerHeightAutoSize, fContentCalculatedHeight, |
1375 fContainerHeight); | 1373 fContainerHeight); |
1376 pLayoutRow->m_sSize = CFX_SizeF(fContainerWidth, fContainerHeight); | 1374 pLayoutRow->m_sSize = CFX_SizeF(fContainerWidth, fContainerHeight); |
1377 } | 1375 } |
1378 void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { | 1376 void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { |
1379 if (m_pLayoutItem) | 1377 if (m_pLayoutItem) |
1380 return; | 1378 return; |
1381 | 1379 |
1382 if (pLayoutNode == NULL) { | 1380 if (!pLayoutNode) |
1383 pLayoutNode = m_pFormNode; | 1381 pLayoutNode = m_pFormNode; |
1384 } | 1382 |
1385 ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE); | 1383 ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE); |
1386 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); | 1384 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); |
1387 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; | 1385 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; |
1388 FX_BOOL bContainerWidthAutoSize = TRUE, bContainerHeightAutoSize = TRUE; | 1386 FX_BOOL bContainerWidthAutoSize = TRUE, bContainerHeightAutoSize = TRUE; |
1389 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( | 1387 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( |
1390 m_pFormNode, fContainerWidth, fContainerHeight, bContainerWidthAutoSize, | 1388 m_pFormNode, fContainerWidth, fContainerHeight, bContainerWidthAutoSize, |
1391 bContainerHeightAutoSize); | 1389 bContainerHeightAutoSize); |
1392 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; | 1390 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; |
1393 CXFA_Node* pMarginNode = | 1391 CXFA_Node* pMarginNode = |
1394 m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); | 1392 m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); |
(...skipping 22 matching lines...) Expand all Loading... |
1417 CXFA_Measurement measure(wsWidth.AsStringC()); | 1415 CXFA_Measurement measure(wsWidth.AsStringC()); |
1418 m_rgSpecifiedColumnWidths.Add(measure.ToUnit(XFA_UNIT_Pt)); | 1416 m_rgSpecifiedColumnWidths.Add(measure.ToUnit(XFA_UNIT_Pt)); |
1419 } | 1417 } |
1420 } | 1418 } |
1421 } | 1419 } |
1422 } | 1420 } |
1423 int32_t iSpecifiedColumnCount = m_rgSpecifiedColumnWidths.GetSize(); | 1421 int32_t iSpecifiedColumnCount = m_rgSpecifiedColumnWidths.GetSize(); |
1424 CXFA_LayoutContext layoutContext; | 1422 CXFA_LayoutContext layoutContext; |
1425 layoutContext.m_prgSpecifiedColumnWidths = &m_rgSpecifiedColumnWidths; | 1423 layoutContext.m_prgSpecifiedColumnWidths = &m_rgSpecifiedColumnWidths; |
1426 CXFA_LayoutContext* pLayoutContext = | 1424 CXFA_LayoutContext* pLayoutContext = |
1427 iSpecifiedColumnCount > 0 ? &layoutContext : NULL; | 1425 iSpecifiedColumnCount > 0 ? &layoutContext : nullptr; |
1428 if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { | 1426 if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { |
1429 XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1427 XFA_ItemLayoutProcessor_GotoNextContainerNode( |
1430 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE); | 1428 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE); |
1431 } | 1429 } |
1432 for (; m_pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1430 for (; m_pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( |
1433 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE)) { | 1431 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE)) { |
1434 layoutContext.m_bCurColumnWidthAvaiable = FALSE; | 1432 layoutContext.m_bCurColumnWidthAvaiable = FALSE; |
1435 layoutContext.m_fCurColumnWidth = 0; | 1433 layoutContext.m_fCurColumnWidth = 0; |
1436 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { | 1434 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { |
1437 continue; | 1435 continue; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 bMoreColumns = FALSE; | 1482 bMoreColumns = FALSE; |
1485 FX_BOOL bAutoCol = FALSE; | 1483 FX_BOOL bAutoCol = FALSE; |
1486 for (int32_t i = 0; i < iRowCount; i++) { | 1484 for (int32_t i = 0; i < iRowCount; i++) { |
1487 while (rgRowItems[i] && (rgRowItemsSpan[i] <= 0 || | 1485 while (rgRowItems[i] && (rgRowItemsSpan[i] <= 0 || |
1488 !XFA_ItemLayoutProcessor_IsTakingSpace( | 1486 !XFA_ItemLayoutProcessor_IsTakingSpace( |
1489 rgRowItems[i]->m_pFormNode))) { | 1487 rgRowItems[i]->m_pFormNode))) { |
1490 CXFA_ContentLayoutItem* pNewCell = | 1488 CXFA_ContentLayoutItem* pNewCell = |
1491 (CXFA_ContentLayoutItem*)rgRowItems[i]->m_pNextSibling; | 1489 (CXFA_ContentLayoutItem*)rgRowItems[i]->m_pNextSibling; |
1492 if (rgRowItemsSpan[i] < 0 && XFA_ItemLayoutProcessor_IsTakingSpace( | 1490 if (rgRowItemsSpan[i] < 0 && XFA_ItemLayoutProcessor_IsTakingSpace( |
1493 rgRowItems[i]->m_pFormNode)) { | 1491 rgRowItems[i]->m_pFormNode)) { |
1494 pNewCell = NULL; | 1492 pNewCell = nullptr; |
1495 } | 1493 } |
1496 rgRowItems[i] = pNewCell; | 1494 rgRowItems[i] = pNewCell; |
1497 rgRowItemsSpan[i] = | 1495 rgRowItemsSpan[i] = |
1498 pNewCell | 1496 pNewCell |
1499 ? pNewCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan) | 1497 ? pNewCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan) |
1500 : 0; | 1498 : 0; |
1501 rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.x : 0; | 1499 rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.x : 0; |
1502 } | 1500 } |
1503 CXFA_ContentLayoutItem* pCell = rgRowItems[i]; | 1501 CXFA_ContentLayoutItem* pCell = rgRowItems[i]; |
1504 if (!pCell) { | 1502 if (!pCell) { |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 CXFA_ItemLayoutProcessor* pParentProcessor, | 1806 CXFA_ItemLayoutProcessor* pParentProcessor, |
1809 CXFA_ItemLayoutProcessor* pChildProcessor, | 1807 CXFA_ItemLayoutProcessor* pChildProcessor, |
1810 XFA_ItemLayoutProcessorResult eRetValue, | 1808 XFA_ItemLayoutProcessorResult eRetValue, |
1811 CFX_ArrayTemplate<CXFA_ContentLayoutItem*>& rgCurLineLayoutItem, | 1809 CFX_ArrayTemplate<CXFA_ContentLayoutItem*>& rgCurLineLayoutItem, |
1812 FX_FLOAT& fContentCurRowAvailWidth, | 1810 FX_FLOAT& fContentCurRowAvailWidth, |
1813 FX_FLOAT& fContentCurRowHeight, | 1811 FX_FLOAT& fContentCurRowHeight, |
1814 FX_FLOAT& fContentCurRowY, | 1812 FX_FLOAT& fContentCurRowY, |
1815 FX_BOOL& bAddedItemInRow, | 1813 FX_BOOL& bAddedItemInRow, |
1816 FX_BOOL& bForceEndPage, | 1814 FX_BOOL& bForceEndPage, |
1817 XFA_ItemLayoutProcessorResult& result) { | 1815 XFA_ItemLayoutProcessorResult& result) { |
1818 if (pParentProcessor == NULL || pChildProcessor == NULL) { | 1816 if (!pParentProcessor || !pChildProcessor) |
1819 return FALSE; | 1817 return FALSE; |
1820 } | 1818 |
1821 if (pParentProcessor->m_pCurChildNode->GetIntact() != | 1819 if (pParentProcessor->m_pCurChildNode->GetIntact() != |
1822 XFA_ATTRIBUTEENUM_None || | 1820 XFA_ATTRIBUTEENUM_None || |
1823 !pChildProcessor->m_bHasAvailHeight) { | 1821 !pChildProcessor->m_bHasAvailHeight) { |
1824 if (XFA_ExistContainerKeep(pParentProcessor->m_pCurChildNode, TRUE)) { | 1822 if (XFA_ExistContainerKeep(pParentProcessor->m_pCurChildNode, TRUE)) { |
1825 FX_FLOAT fChildWidth, fChildHeight; | 1823 FX_FLOAT fChildWidth, fChildHeight; |
1826 pChildProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); | 1824 pChildProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); |
1827 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> keepLayoutItems; | 1825 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> keepLayoutItems; |
1828 if (pParentProcessor->JudgePutNextPage(pParentProcessor->m_pLayoutItem, | 1826 if (pParentProcessor->JudgePutNextPage(pParentProcessor->m_pLayoutItem, |
1829 fChildHeight, keepLayoutItems)) { | 1827 fChildHeight, keepLayoutItems)) { |
1830 m_arrayKeepItems.RemoveAll(); | 1828 m_arrayKeepItems.RemoveAll(); |
(...skipping 17 matching lines...) Expand all Loading... |
1848 result = eRetValue; | 1846 result = eRetValue; |
1849 return TRUE; | 1847 return TRUE; |
1850 } | 1848 } |
1851 } | 1849 } |
1852 return FALSE; | 1850 return FALSE; |
1853 } | 1851 } |
1854 FX_BOOL CXFA_ItemLayoutProcessor::JudgePutNextPage( | 1852 FX_BOOL CXFA_ItemLayoutProcessor::JudgePutNextPage( |
1855 CXFA_ContentLayoutItem* pParentLayoutItem, | 1853 CXFA_ContentLayoutItem* pParentLayoutItem, |
1856 FX_FLOAT fChildHeight, | 1854 FX_FLOAT fChildHeight, |
1857 CFX_ArrayTemplate<CXFA_ContentLayoutItem*>& pKeepItems) { | 1855 CFX_ArrayTemplate<CXFA_ContentLayoutItem*>& pKeepItems) { |
1858 if (pParentLayoutItem == NULL) { | 1856 if (!pParentLayoutItem) |
1859 return FALSE; | 1857 return FALSE; |
1860 } | 1858 |
1861 FX_FLOAT fItemsHeight = 0; | 1859 FX_FLOAT fItemsHeight = 0; |
1862 for (CXFA_ContentLayoutItem* pChildLayoutItem = | 1860 for (CXFA_ContentLayoutItem* pChildLayoutItem = |
1863 (CXFA_ContentLayoutItem*)pParentLayoutItem->m_pFirstChild; | 1861 (CXFA_ContentLayoutItem*)pParentLayoutItem->m_pFirstChild; |
1864 pChildLayoutItem; | 1862 pChildLayoutItem; |
1865 pChildLayoutItem = | 1863 pChildLayoutItem = |
1866 (CXFA_ContentLayoutItem*)pChildLayoutItem->m_pNextSibling) { | 1864 (CXFA_ContentLayoutItem*)pChildLayoutItem->m_pNextSibling) { |
1867 if (XFA_ExistContainerKeep(pChildLayoutItem->m_pFormNode, FALSE)) { | 1865 if (XFA_ExistContainerKeep(pChildLayoutItem->m_pFormNode, FALSE)) { |
1868 pKeepItems.Add(pChildLayoutItem); | 1866 pKeepItems.Add(pChildLayoutItem); |
1869 fItemsHeight += pChildLayoutItem->m_sSize.y; | 1867 fItemsHeight += pChildLayoutItem->m_sSize.y; |
1870 } else { | 1868 } else { |
(...skipping 12 matching lines...) Expand all Loading... |
1883 return; | 1881 return; |
1884 } | 1882 } |
1885 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator( | 1883 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator( |
1886 pFormNode); | 1884 pFormNode); |
1887 for (CXFA_Node* pNode = sIterator.MoveToNext(); pNode; | 1885 for (CXFA_Node* pNode = sIterator.MoveToNext(); pNode; |
1888 pNode = sIterator.MoveToNext()) { | 1886 pNode = sIterator.MoveToNext()) { |
1889 if (pNode->IsContainerNode()) { | 1887 if (pNode->IsContainerNode()) { |
1890 CXFA_Node* pBindNode = pNode->GetBindData(); | 1888 CXFA_Node* pBindNode = pNode->GetBindData(); |
1891 if (pBindNode) { | 1889 if (pBindNode) { |
1892 pBindNode->RemoveBindItem(pNode); | 1890 pBindNode->RemoveBindItem(pNode); |
1893 pNode->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); | 1891 pNode->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); |
1894 } | 1892 } |
1895 } | 1893 } |
1896 pNode->SetFlag(XFA_NODEFLAG_UnusedNode, true); | 1894 pNode->SetFlag(XFA_NODEFLAG_UnusedNode, true); |
1897 } | 1895 } |
1898 } | 1896 } |
1899 void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( | 1897 void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( |
1900 CXFA_Node* pLeaderNode, | 1898 CXFA_Node* pLeaderNode, |
1901 CXFA_Node* pTrailerNode, | 1899 CXFA_Node* pTrailerNode, |
1902 CXFA_ContentLayoutItem* pTrailerItem, | 1900 CXFA_ContentLayoutItem* pTrailerItem, |
1903 CXFA_Node* pFormNode) { | 1901 CXFA_Node* pFormNode) { |
1904 ProcessUnUseBinds(pLeaderNode); | 1902 ProcessUnUseBinds(pLeaderNode); |
1905 ProcessUnUseBinds(pTrailerNode); | 1903 ProcessUnUseBinds(pTrailerNode); |
1906 if (pFormNode == NULL) { | 1904 if (!pFormNode) |
1907 return; | 1905 return; |
1908 } | 1906 |
1909 if (pFormNode->GetClassID() == XFA_ELEMENT_Overflow || | 1907 if (pFormNode->GetClassID() == XFA_ELEMENT_Overflow || |
1910 pFormNode->GetClassID() == XFA_ELEMENT_Break) { | 1908 pFormNode->GetClassID() == XFA_ELEMENT_Break) { |
1911 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); | 1909 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); |
1912 } | 1910 } |
1913 if (pLeaderNode && pFormNode) { | 1911 if (pLeaderNode && pFormNode) { |
1914 pFormNode->RemoveChild(pLeaderNode); | 1912 pFormNode->RemoveChild(pLeaderNode); |
1915 } | 1913 } |
1916 if (pTrailerNode && pFormNode) { | 1914 if (pTrailerNode && pFormNode) { |
1917 pFormNode->RemoveChild(pTrailerNode); | 1915 pFormNode->RemoveChild(pTrailerNode); |
1918 } | 1916 } |
(...skipping 12 matching lines...) Expand all Loading... |
1931 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3], | 1929 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3], |
1932 FX_BOOL bUseBreakControl, | 1930 FX_BOOL bUseBreakControl, |
1933 FX_FLOAT fAvailHeight, | 1931 FX_FLOAT fAvailHeight, |
1934 FX_FLOAT fRealHeight, | 1932 FX_FLOAT fRealHeight, |
1935 FX_FLOAT& fContentCurRowY, | 1933 FX_FLOAT& fContentCurRowY, |
1936 FX_FLOAT& fContentWidthLimit, | 1934 FX_FLOAT& fContentWidthLimit, |
1937 FX_FLOAT& fContentCurRowAvailWidth, | 1935 FX_FLOAT& fContentCurRowAvailWidth, |
1938 FX_FLOAT& fContentCurRowHeight, | 1936 FX_FLOAT& fContentCurRowHeight, |
1939 FX_BOOL& bAddedItemInRow, | 1937 FX_BOOL& bAddedItemInRow, |
1940 FX_BOOL& bForceEndPage, | 1938 FX_BOOL& bForceEndPage, |
1941 CXFA_LayoutContext* pLayoutContext = NULL, | 1939 CXFA_LayoutContext* pLayoutContext = nullptr, |
1942 FX_BOOL bNewRow = FALSE) { | 1940 FX_BOOL bNewRow = FALSE) { |
1943 FX_BOOL bTakeSpace = | 1941 FX_BOOL bTakeSpace = |
1944 XFA_ItemLayoutProcessor_IsTakingSpace(pProcessor->m_pFormNode); | 1942 XFA_ItemLayoutProcessor_IsTakingSpace(pProcessor->m_pFormNode); |
1945 uint8_t uHAlign = XFA_ItemLayoutProcessor_HAlignEnumToInt( | 1943 uint8_t uHAlign = XFA_ItemLayoutProcessor_HAlignEnumToInt( |
1946 pThis->m_pCurChildNode->GetEnum(XFA_ATTRIBUTE_HAlign)); | 1944 pThis->m_pCurChildNode->GetEnum(XFA_ATTRIBUTE_HAlign)); |
1947 if (bContainerWidthAutoSize) { | 1945 if (bContainerWidthAutoSize) { |
1948 uHAlign = 0; | 1946 uHAlign = 0; |
1949 } | 1947 } |
1950 if ((eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb && uHAlign < uCurHAlignState) || | 1948 if ((eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb && uHAlign < uCurHAlignState) || |
1951 (eFlowStrategy == XFA_ATTRIBUTEENUM_Rl_tb && uHAlign > uCurHAlignState)) { | 1949 (eFlowStrategy == XFA_ATTRIBUTEENUM_Rl_tb && uHAlign > uCurHAlignState)) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1998 FX_FLOAT fChildWidth, fChildHeight; | 1996 FX_FLOAT fChildWidth, fChildHeight; |
1999 pProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); | 1997 pProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); |
2000 if (bUseRealHeight && fRealHeight < XFA_LAYOUT_FLOAT_PERCISION) { | 1998 if (bUseRealHeight && fRealHeight < XFA_LAYOUT_FLOAT_PERCISION) { |
2001 fRealHeight = XFA_LAYOUT_FLOAT_MAX; | 1999 fRealHeight = XFA_LAYOUT_FLOAT_MAX; |
2002 fAvailHeight = XFA_LAYOUT_FLOAT_MAX; | 2000 fAvailHeight = XFA_LAYOUT_FLOAT_MAX; |
2003 } | 2001 } |
2004 if (!bTakeSpace || | 2002 if (!bTakeSpace || |
2005 (fChildWidth <= fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) || | 2003 (fChildWidth <= fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) || |
2006 (fContentWidthLimit - fContentCurRowAvailWidth <= | 2004 (fContentWidthLimit - fContentCurRowAvailWidth <= |
2007 XFA_LAYOUT_FLOAT_PERCISION)) { | 2005 XFA_LAYOUT_FLOAT_PERCISION)) { |
2008 CXFA_Node *pOverflowLeaderNode = NULL, *pOverflowTrailerNode = NULL, | 2006 CXFA_Node *pOverflowLeaderNode = nullptr, *pOverflowTrailerNode = nullptr, |
2009 *pFormNode = NULL; | 2007 *pFormNode = nullptr; |
2010 CXFA_ContentLayoutItem* pTrailerLayoutItem = NULL; | 2008 CXFA_ContentLayoutItem* pTrailerLayoutItem = nullptr; |
2011 FX_BOOL bIsAddTrailerHeight = FALSE; | 2009 FX_BOOL bIsAddTrailerHeight = FALSE; |
2012 if (pThis->m_pPageMgr && | 2010 if (pThis->m_pPageMgr && |
2013 pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { | 2011 pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { |
2014 pFormNode = pThis->m_pPageMgr->QueryOverflow(pProcessor->m_pFormNode); | 2012 pFormNode = pThis->m_pPageMgr->QueryOverflow(pProcessor->m_pFormNode); |
2015 if (pFormNode == NULL && pLayoutContext && | 2013 if (!pFormNode && pLayoutContext && |
2016 pLayoutContext->m_pOverflowProcessor) { | 2014 pLayoutContext->m_pOverflowProcessor) { |
2017 pFormNode = pLayoutContext->m_pOverflowNode; | 2015 pFormNode = pLayoutContext->m_pOverflowNode; |
2018 bUseInherited = TRUE; | 2016 bUseInherited = TRUE; |
2019 } | 2017 } |
2020 if (pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, | 2018 if (pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, |
2021 pOverflowTrailerNode, FALSE, | 2019 pOverflowTrailerNode, FALSE, |
2022 FALSE)) { | 2020 FALSE)) { |
2023 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowTrailerNode)) { | 2021 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowTrailerNode)) { |
2024 if (pOverflowTrailerNode) { | 2022 if (pOverflowTrailerNode) { |
2025 CXFA_ItemLayoutProcessor* pOverflowLeaderProcessor = | 2023 CXFA_ItemLayoutProcessor* pOverflowLeaderProcessor = |
2026 new CXFA_ItemLayoutProcessor(pOverflowTrailerNode, NULL); | 2024 new CXFA_ItemLayoutProcessor(pOverflowTrailerNode, nullptr); |
2027 pOverflowLeaderProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); | 2025 pOverflowLeaderProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); |
2028 pTrailerLayoutItem = | 2026 pTrailerLayoutItem = |
2029 pOverflowLeaderProcessor->HasLayoutItem() | 2027 pOverflowLeaderProcessor->HasLayoutItem() |
2030 ? pOverflowLeaderProcessor->ExtractLayoutItem() | 2028 ? pOverflowLeaderProcessor->ExtractLayoutItem() |
2031 : NULL; | 2029 : nullptr; |
2032 delete pOverflowLeaderProcessor; | 2030 delete pOverflowLeaderProcessor; |
2033 } | 2031 } |
2034 if (bUseInherited) { | 2032 if (bUseInherited) { |
2035 bIsAddTrailerHeight = | 2033 bIsAddTrailerHeight = |
2036 pThis->IsAddNewRowForTrailer(pTrailerLayoutItem); | 2034 pThis->IsAddNewRowForTrailer(pTrailerLayoutItem); |
2037 } else { | 2035 } else { |
2038 bIsAddTrailerHeight = | 2036 bIsAddTrailerHeight = |
2039 pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem); | 2037 pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem); |
2040 } | 2038 } |
2041 if (bIsAddTrailerHeight) { | 2039 if (bIsAddTrailerHeight) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); | 2137 rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); |
2140 bAddedItemInRow = TRUE; | 2138 bAddedItemInRow = TRUE; |
2141 if (bTakeSpace) { | 2139 if (bTakeSpace) { |
2142 fContentCurRowAvailWidth -= fChildWidth; | 2140 fContentCurRowAvailWidth -= fChildWidth; |
2143 if (fContentCurRowHeight < fChildHeight) { | 2141 if (fContentCurRowHeight < fChildHeight) { |
2144 fContentCurRowHeight = fChildHeight; | 2142 fContentCurRowHeight = fChildHeight; |
2145 } | 2143 } |
2146 } | 2144 } |
2147 return XFA_ItemLayoutProcessorResult_PageFullBreak; | 2145 return XFA_ItemLayoutProcessorResult_PageFullBreak; |
2148 } | 2146 } |
2149 CXFA_Node *pTempLeaderNode = NULL, *pTempTrailerNode = NULL; | 2147 CXFA_Node *pTempLeaderNode = nullptr, *pTempTrailerNode = nullptr; |
2150 if (pThis->m_pPageMgr && !pProcessor->m_bUseInheriated && | 2148 if (pThis->m_pPageMgr && !pProcessor->m_bUseInheriated && |
2151 eRetValue != XFA_ItemLayoutProcessorResult_PageFullBreak) { | 2149 eRetValue != XFA_ItemLayoutProcessorResult_PageFullBreak) { |
2152 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, | 2150 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, |
2153 pTempTrailerNode, FALSE, TRUE); | 2151 pTempTrailerNode, FALSE, TRUE); |
2154 } | 2152 } |
2155 if (pTrailerLayoutItem && bIsAddTrailerHeight) { | 2153 if (pTrailerLayoutItem && bIsAddTrailerHeight) { |
2156 XFA_ItemLayoutProcessor_AddTrailerBeforeSplit( | 2154 XFA_ItemLayoutProcessor_AddTrailerBeforeSplit( |
2157 pProcessor, fSplitPos, pTrailerLayoutItem, bUseInherited); | 2155 pProcessor, fSplitPos, pTrailerLayoutItem, bUseInherited); |
2158 } else { | 2156 } else { |
2159 pProcessor->SplitLayoutItem(fSplitPos); | 2157 pProcessor->SplitLayoutItem(fSplitPos); |
2160 } | 2158 } |
2161 if (bUseInherited) { | 2159 if (bUseInherited) { |
2162 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, | 2160 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, |
2163 pOverflowTrailerNode, | 2161 pOverflowTrailerNode, |
2164 pTrailerLayoutItem, pFormNode); | 2162 pTrailerLayoutItem, pFormNode); |
2165 pThis->m_bUseInheriated = TRUE; | 2163 pThis->m_bUseInheriated = TRUE; |
2166 } else { | 2164 } else { |
2167 if (pProcessor->m_pLayoutItem->m_pFirstChild && | 2165 if (pProcessor->m_pLayoutItem->m_pFirstChild && |
2168 pProcessor->m_pLayoutItem->m_pFirstChild->m_pNextSibling == | 2166 pProcessor->m_pLayoutItem->m_pFirstChild->m_pNextSibling == |
2169 NULL && | 2167 nullptr && |
2170 pProcessor->m_pLayoutItem->m_pFirstChild->m_pFormNode->HasFlag( | 2168 pProcessor->m_pLayoutItem->m_pFirstChild->m_pFormNode->HasFlag( |
2171 XFA_NODEFLAG_LayoutGeneratedNode)) { | 2169 XFA_NODEFLAG_LayoutGeneratedNode)) { |
2172 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, | 2170 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, |
2173 pOverflowTrailerNode, | 2171 pOverflowTrailerNode, |
2174 pTrailerLayoutItem, pFormNode); | 2172 pTrailerLayoutItem, pFormNode); |
2175 } else { | 2173 } else { |
2176 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) { | 2174 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) { |
2177 XFA_ItemLayoutProcessor_AddPendingNode( | 2175 XFA_ItemLayoutProcessor_AddPendingNode( |
2178 pProcessor, pOverflowLeaderNode, FALSE); | 2176 pProcessor, pOverflowLeaderNode, FALSE); |
2179 } | 2177 } |
2180 } | 2178 } |
2181 } | 2179 } |
2182 if (pProcessor->m_pLayoutItem->m_pNextSibling) { | 2180 if (pProcessor->m_pLayoutItem->m_pNextSibling) { |
2183 pProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); | 2181 pProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); |
2184 rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); | 2182 rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); |
2185 bAddedItemInRow = TRUE; | 2183 bAddedItemInRow = TRUE; |
2186 if (bTakeSpace) { | 2184 if (bTakeSpace) { |
2187 fContentCurRowAvailWidth -= fChildWidth; | 2185 fContentCurRowAvailWidth -= fChildWidth; |
2188 if (fContentCurRowHeight < fChildHeight) { | 2186 if (fContentCurRowHeight < fChildHeight) { |
2189 fContentCurRowHeight = fChildHeight; | 2187 fContentCurRowHeight = fChildHeight; |
2190 } | 2188 } |
2191 } | 2189 } |
2192 } | 2190 } |
2193 return XFA_ItemLayoutProcessorResult_PageFullBreak; | 2191 return XFA_ItemLayoutProcessorResult_PageFullBreak; |
2194 } else if (fContentCurRowY <= XFA_LAYOUT_FLOAT_PERCISION) { | 2192 } else if (fContentCurRowY <= XFA_LAYOUT_FLOAT_PERCISION) { |
2195 pProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); | 2193 pProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); |
2196 if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(fChildHeight)) { | 2194 if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(fChildHeight)) { |
2197 CXFA_Node *pTempLeaderNode = NULL, *pTempTrailerNode = NULL; | 2195 CXFA_Node *pTempLeaderNode = nullptr, *pTempTrailerNode = nullptr; |
2198 if (pThis->m_pPageMgr) { | 2196 if (pThis->m_pPageMgr) { |
2199 if (pFormNode == NULL && pLayoutContext) { | 2197 if (!pFormNode && pLayoutContext) { |
2200 pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; | 2198 pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; |
2201 } | 2199 } |
2202 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, | 2200 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, |
2203 pTempTrailerNode, FALSE, TRUE); | 2201 pTempTrailerNode, FALSE, TRUE); |
2204 } | 2202 } |
2205 if (bUseInherited) { | 2203 if (bUseInherited) { |
2206 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, | 2204 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, |
2207 pOverflowTrailerNode, | 2205 pOverflowTrailerNode, |
2208 pTrailerLayoutItem, pFormNode); | 2206 pTrailerLayoutItem, pFormNode); |
2209 pThis->m_bUseInheriated = TRUE; | 2207 pThis->m_bUseInheriated = TRUE; |
(...skipping 25 matching lines...) Expand all Loading... |
2235 if (pTrailerLayoutItem) { | 2233 if (pTrailerLayoutItem) { |
2236 XFA_ItemLayoutProcessor_AddTrailerBeforeSplit(pProcessor, fSplitPos, | 2234 XFA_ItemLayoutProcessor_AddTrailerBeforeSplit(pProcessor, fSplitPos, |
2237 pTrailerLayoutItem); | 2235 pTrailerLayoutItem); |
2238 } | 2236 } |
2239 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) { | 2237 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) { |
2240 XFA_ItemLayoutProcessor_AddPendingNode(pProcessor, | 2238 XFA_ItemLayoutProcessor_AddPendingNode(pProcessor, |
2241 pOverflowLeaderNode, FALSE); | 2239 pOverflowLeaderNode, FALSE); |
2242 } | 2240 } |
2243 } else { | 2241 } else { |
2244 if (eRetValue == XFA_ItemLayoutProcessorResult_Done) { | 2242 if (eRetValue == XFA_ItemLayoutProcessorResult_Done) { |
2245 if (pFormNode == NULL && pLayoutContext) { | 2243 if (!pFormNode && pLayoutContext) { |
2246 pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; | 2244 pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; |
2247 } | 2245 } |
2248 if (pThis->m_pPageMgr) { | 2246 if (pThis->m_pPageMgr) { |
2249 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, | 2247 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, |
2250 pOverflowTrailerNode, FALSE, | 2248 pOverflowTrailerNode, FALSE, |
2251 TRUE); | 2249 TRUE); |
2252 } | 2250 } |
2253 if (bUseInherited) { | 2251 if (bUseInherited) { |
2254 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, | 2252 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, |
2255 pOverflowTrailerNode, | 2253 pOverflowTrailerNode, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2326 FX_FLOAT fContentWidthLimit = | 2324 FX_FLOAT fContentWidthLimit = |
2327 bContainerWidthAutoSize ? XFA_LAYOUT_FLOAT_MAX | 2325 bContainerWidthAutoSize ? XFA_LAYOUT_FLOAT_MAX |
2328 : fContainerWidth - fLeftInset - fRightInset; | 2326 : fContainerWidth - fLeftInset - fRightInset; |
2329 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; | 2327 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; |
2330 FX_FLOAT fAvailHeight = fHeightLimit - fTopInset - fBottomInset; | 2328 FX_FLOAT fAvailHeight = fHeightLimit - fTopInset - fBottomInset; |
2331 if (fAvailHeight < 0) { | 2329 if (fAvailHeight < 0) { |
2332 m_bHasAvailHeight = FALSE; | 2330 m_bHasAvailHeight = FALSE; |
2333 } | 2331 } |
2334 fRealHeight = fRealHeight - fTopInset - fBottomInset; | 2332 fRealHeight = fRealHeight - fTopInset - fBottomInset; |
2335 FX_FLOAT fContentCurRowY = 0; | 2333 FX_FLOAT fContentCurRowY = 0; |
2336 CXFA_ContentLayoutItem* pLayoutChild = NULL; | 2334 CXFA_ContentLayoutItem* pLayoutChild = nullptr; |
2337 if (m_pLayoutItem) { | 2335 if (m_pLayoutItem) { |
2338 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Done && | 2336 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Done && |
2339 eFlowStrategy != XFA_ATTRIBUTEENUM_Tb) { | 2337 eFlowStrategy != XFA_ATTRIBUTEENUM_Tb) { |
2340 pLayoutChild = (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; | 2338 pLayoutChild = (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; |
2341 for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext; | 2339 for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext; |
2342 pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { | 2340 pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { |
2343 if (pLayoutNext->m_sPos.y != pLayoutChild->m_sPos.y) { | 2341 if (pLayoutNext->m_sPos.y != pLayoutChild->m_sPos.y) { |
2344 pLayoutChild = pLayoutNext; | 2342 pLayoutChild = pLayoutNext; |
2345 } | 2343 } |
2346 } | 2344 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2388 while (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Done) { | 2386 while (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Done) { |
2389 FX_FLOAT fContentCurRowHeight = 0; | 2387 FX_FLOAT fContentCurRowHeight = 0; |
2390 FX_FLOAT fContentCurRowAvailWidth = fContentWidthLimit; | 2388 FX_FLOAT fContentCurRowAvailWidth = fContentWidthLimit; |
2391 m_fWidthLimite = fContentCurRowAvailWidth; | 2389 m_fWidthLimite = fContentCurRowAvailWidth; |
2392 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> rgCurLineLayoutItems[3]; | 2390 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> rgCurLineLayoutItems[3]; |
2393 uint8_t uCurHAlignState = | 2391 uint8_t uCurHAlignState = |
2394 (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb ? 0 : 2); | 2392 (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb ? 0 : 2); |
2395 if (pLayoutChild) { | 2393 if (pLayoutChild) { |
2396 for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext; | 2394 for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext; |
2397 pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { | 2395 pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { |
2398 if (pLayoutNext->m_pNextSibling == NULL && m_pCurChildPreprocessor && | 2396 if (!pLayoutNext->m_pNextSibling && m_pCurChildPreprocessor && |
2399 m_pCurChildPreprocessor->m_pFormNode == pLayoutNext->m_pFormNode) { | 2397 m_pCurChildPreprocessor->m_pFormNode == pLayoutNext->m_pFormNode) { |
2400 pLayoutNext->m_pNext = m_pCurChildPreprocessor->m_pLayoutItem; | 2398 pLayoutNext->m_pNext = m_pCurChildPreprocessor->m_pLayoutItem; |
2401 m_pCurChildPreprocessor->m_pLayoutItem = pLayoutNext; | 2399 m_pCurChildPreprocessor->m_pLayoutItem = pLayoutNext; |
2402 break; | 2400 break; |
2403 } | 2401 } |
2404 uint8_t uHAlign = XFA_ItemLayoutProcessor_HAlignEnumToInt( | 2402 uint8_t uHAlign = XFA_ItemLayoutProcessor_HAlignEnumToInt( |
2405 pLayoutNext->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)); | 2403 pLayoutNext->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)); |
2406 rgCurLineLayoutItems[uHAlign].Add(pLayoutNext); | 2404 rgCurLineLayoutItems[uHAlign].Add(pLayoutNext); |
2407 if (eFlowStrategy == XFA_ATTRIBUTEENUM_Lr_tb) { | 2405 if (eFlowStrategy == XFA_ATTRIBUTEENUM_Lr_tb) { |
2408 if (uHAlign > uCurHAlignState) { | 2406 if (uHAlign > uCurHAlignState) { |
2409 uCurHAlignState = uHAlign; | 2407 uCurHAlignState = uHAlign; |
2410 } | 2408 } |
2411 } else if (uHAlign < uCurHAlignState) { | 2409 } else if (uHAlign < uCurHAlignState) { |
2412 uCurHAlignState = uHAlign; | 2410 uCurHAlignState = uHAlign; |
2413 } | 2411 } |
2414 if (XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutNext->m_pFormNode)) { | 2412 if (XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutNext->m_pFormNode)) { |
2415 if (pLayoutNext->m_sSize.y > fContentCurRowHeight) { | 2413 if (pLayoutNext->m_sSize.y > fContentCurRowHeight) { |
2416 fContentCurRowHeight = pLayoutNext->m_sSize.y; | 2414 fContentCurRowHeight = pLayoutNext->m_sSize.y; |
2417 } | 2415 } |
2418 fContentCurRowAvailWidth -= pLayoutNext->m_sSize.x; | 2416 fContentCurRowAvailWidth -= pLayoutNext->m_sSize.x; |
2419 } | 2417 } |
2420 } | 2418 } |
2421 if ((CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild == | 2419 if ((CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild == |
2422 pLayoutChild) { | 2420 pLayoutChild) { |
2423 m_pLayoutItem->m_pFirstChild = NULL; | 2421 m_pLayoutItem->m_pFirstChild = nullptr; |
2424 } else { | 2422 } else { |
2425 CXFA_ContentLayoutItem* pLayoutNext = | 2423 CXFA_ContentLayoutItem* pLayoutNext = |
2426 (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; | 2424 (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; |
2427 for (; pLayoutNext; | 2425 for (; pLayoutNext; |
2428 pLayoutNext = | 2426 pLayoutNext = |
2429 (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { | 2427 (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { |
2430 if ((CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling == | 2428 if ((CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling == |
2431 pLayoutChild) { | 2429 pLayoutChild) { |
2432 pLayoutNext->m_pNextSibling = NULL; | 2430 pLayoutNext->m_pNextSibling = nullptr; |
2433 break; | 2431 break; |
2434 } | 2432 } |
2435 } | 2433 } |
2436 } | 2434 } |
2437 CXFA_ContentLayoutItem* pLayoutNextTemp = | 2435 CXFA_ContentLayoutItem* pLayoutNextTemp = |
2438 (CXFA_ContentLayoutItem*)pLayoutChild; | 2436 (CXFA_ContentLayoutItem*)pLayoutChild; |
2439 while (pLayoutNextTemp) { | 2437 while (pLayoutNextTemp) { |
2440 pLayoutNextTemp->m_pParent = NULL; | 2438 pLayoutNextTemp->m_pParent = nullptr; |
2441 CXFA_ContentLayoutItem* pSaveLayoutNext = | 2439 CXFA_ContentLayoutItem* pSaveLayoutNext = |
2442 (CXFA_ContentLayoutItem*)pLayoutNextTemp->m_pNextSibling; | 2440 (CXFA_ContentLayoutItem*)pLayoutNextTemp->m_pNextSibling; |
2443 pLayoutNextTemp->m_pNextSibling = NULL; | 2441 pLayoutNextTemp->m_pNextSibling = nullptr; |
2444 pLayoutNextTemp = pSaveLayoutNext; | 2442 pLayoutNextTemp = pSaveLayoutNext; |
2445 } | 2443 } |
2446 pLayoutChild = NULL; | 2444 pLayoutChild = nullptr; |
2447 } | 2445 } |
2448 while (m_pCurChildNode) { | 2446 while (m_pCurChildNode) { |
2449 CXFA_ItemLayoutProcessor* pProcessor = nullptr; | 2447 CXFA_ItemLayoutProcessor* pProcessor = nullptr; |
2450 FX_BOOL bAddedItemInRow = FALSE; | 2448 FX_BOOL bAddedItemInRow = FALSE; |
2451 fContentCurRowY += | 2449 fContentCurRowY += |
2452 XFA_ItemLayoutProcessor_InsertPendingItems(this, m_pFormNode); | 2450 XFA_ItemLayoutProcessor_InsertPendingItems(this, m_pFormNode); |
2453 switch (m_nCurChildNodeStage) { | 2451 switch (m_nCurChildNodeStage) { |
2454 case XFA_ItemLayoutProcessorStages_Keep: | 2452 case XFA_ItemLayoutProcessorStages_Keep: |
2455 case XFA_ItemLayoutProcessorStages_None: | 2453 case XFA_ItemLayoutProcessorStages_None: |
2456 break; | 2454 break; |
2457 case XFA_ItemLayoutProcessorStages_BreakBefore: { | 2455 case XFA_ItemLayoutProcessorStages_BreakBefore: { |
2458 for (int32_t iIndex = 0; iIndex < m_arrayKeepItems.GetSize(); | 2456 for (int32_t iIndex = 0; iIndex < m_arrayKeepItems.GetSize(); |
2459 iIndex++) { | 2457 iIndex++) { |
2460 CXFA_ContentLayoutItem* pItem = m_arrayKeepItems.GetAt(iIndex); | 2458 CXFA_ContentLayoutItem* pItem = m_arrayKeepItems.GetAt(iIndex); |
2461 m_pLayoutItem->RemoveChild(pItem); | 2459 m_pLayoutItem->RemoveChild(pItem); |
2462 fContentCalculatedHeight -= pItem->m_sSize.y; | 2460 fContentCalculatedHeight -= pItem->m_sSize.y; |
2463 } | 2461 } |
2464 CXFA_Node *pLeaderNode = NULL, *pTrailerNode = NULL; | 2462 CXFA_Node *pLeaderNode = nullptr, *pTrailerNode = nullptr; |
2465 FX_BOOL bCreatePage = FALSE; | 2463 FX_BOOL bCreatePage = FALSE; |
2466 if (bUseBreakControl && m_pPageMgr && | 2464 if (bUseBreakControl && m_pPageMgr && |
2467 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, TRUE, | 2465 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, TRUE, |
2468 pLeaderNode, pTrailerNode, | 2466 pLeaderNode, pTrailerNode, |
2469 bCreatePage) && | 2467 bCreatePage) && |
2470 m_pFormNode->GetClassID() != XFA_ELEMENT_Form && bCreatePage) { | 2468 m_pFormNode->GetClassID() != XFA_ELEMENT_Form && bCreatePage) { |
2471 if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { | 2469 if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { |
2472 XFA_ItemLayoutProcessor_AddPendingNode(this, pLeaderNode, TRUE); | 2470 XFA_ItemLayoutProcessor_AddPendingNode(this, pLeaderNode, TRUE); |
2473 } | 2471 } |
2474 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { | 2472 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { |
2475 if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)->GetClassID() == | 2473 if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)->GetClassID() == |
2476 XFA_ELEMENT_Form && | 2474 XFA_ELEMENT_Form && |
2477 m_pLayoutItem == NULL) { | 2475 !m_pLayoutItem) { |
2478 XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode, | 2476 XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode, |
2479 TRUE); | 2477 TRUE); |
2480 } else { | 2478 } else { |
2481 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( | 2479 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( |
2482 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); | 2480 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); |
2483 XFA_ItemLayoutProcessor_InsertFlowedItem( | 2481 XFA_ItemLayoutProcessor_InsertFlowedItem( |
2484 this, pTempProcessor.get(), bContainerWidthAutoSize, | 2482 this, pTempProcessor.get(), bContainerWidthAutoSize, |
2485 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2483 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
2486 uCurHAlignState, rgCurLineLayoutItems, FALSE, | 2484 uCurHAlignState, rgCurLineLayoutItems, FALSE, |
2487 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, | 2485 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, |
2488 fContentWidthLimit, fContentCurRowAvailWidth, | 2486 fContentWidthLimit, fContentCurRowAvailWidth, |
2489 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, | 2487 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, |
2490 pContext); | 2488 pContext); |
2491 } | 2489 } |
2492 } | 2490 } |
2493 XFA_ItemLayoutProcessor_GotoNextContainerNode( | 2491 XFA_ItemLayoutProcessor_GotoNextContainerNode( |
2494 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, TRUE); | 2492 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, TRUE); |
2495 bForceEndPage = TRUE; | 2493 bForceEndPage = TRUE; |
2496 bIsManualBreak = TRUE; | 2494 bIsManualBreak = TRUE; |
2497 goto SuspendAndCreateNewRow; | 2495 goto SuspendAndCreateNewRow; |
2498 } | 2496 } |
2499 } break; | 2497 } break; |
2500 case XFA_ItemLayoutProcessorStages_BreakAfter: { | 2498 case XFA_ItemLayoutProcessorStages_BreakAfter: { |
2501 CXFA_Node *pLeaderNode = NULL, *pTrailerNode = NULL; | 2499 CXFA_Node *pLeaderNode = nullptr, *pTrailerNode = nullptr; |
2502 FX_BOOL bCreatePage = FALSE; | 2500 FX_BOOL bCreatePage = FALSE; |
2503 if (bUseBreakControl && m_pPageMgr && | 2501 if (bUseBreakControl && m_pPageMgr && |
2504 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, FALSE, | 2502 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, FALSE, |
2505 pLeaderNode, pTrailerNode, | 2503 pLeaderNode, pTrailerNode, |
2506 bCreatePage) && | 2504 bCreatePage) && |
2507 m_pFormNode->GetClassID() != XFA_ELEMENT_Form) { | 2505 m_pFormNode->GetClassID() != XFA_ELEMENT_Form) { |
2508 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { | 2506 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { |
2509 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( | 2507 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( |
2510 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); | 2508 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); |
2511 XFA_ItemLayoutProcessor_InsertFlowedItem( | 2509 XFA_ItemLayoutProcessor_InsertFlowedItem( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2547 bForceEndPage = TRUE; | 2545 bForceEndPage = TRUE; |
2548 bIsManualBreak = TRUE; | 2546 bIsManualBreak = TRUE; |
2549 if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Done) { | 2547 if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Done) { |
2550 bBreakDone = TRUE; | 2548 bBreakDone = TRUE; |
2551 } | 2549 } |
2552 } | 2550 } |
2553 goto SuspendAndCreateNewRow; | 2551 goto SuspendAndCreateNewRow; |
2554 } | 2552 } |
2555 } break; | 2553 } break; |
2556 case XFA_ItemLayoutProcessorStages_BookendLeader: { | 2554 case XFA_ItemLayoutProcessorStages_BookendLeader: { |
2557 CXFA_Node* pLeaderNode = NULL; | 2555 CXFA_Node* pLeaderNode = nullptr; |
2558 if (m_pCurChildPreprocessor) { | 2556 if (m_pCurChildPreprocessor) { |
2559 pProcessor = m_pCurChildPreprocessor; | 2557 pProcessor = m_pCurChildPreprocessor; |
2560 m_pCurChildPreprocessor = NULL; | 2558 m_pCurChildPreprocessor = nullptr; |
2561 } else if (m_pPageMgr && | 2559 } else if (m_pPageMgr && |
2562 m_pPageMgr->ProcessBookendLeaderOrTrailer( | 2560 m_pPageMgr->ProcessBookendLeaderOrTrailer( |
2563 m_pCurChildNode, TRUE, pLeaderNode)) { | 2561 m_pCurChildNode, TRUE, pLeaderNode)) { |
2564 pProcessor = new CXFA_ItemLayoutProcessor(pLeaderNode, m_pPageMgr); | 2562 pProcessor = new CXFA_ItemLayoutProcessor(pLeaderNode, m_pPageMgr); |
2565 } | 2563 } |
2566 if (pProcessor) { | 2564 if (pProcessor) { |
2567 if (XFA_ItemLayoutProcessor_InsertFlowedItem( | 2565 if (XFA_ItemLayoutProcessor_InsertFlowedItem( |
2568 this, pProcessor, bContainerWidthAutoSize, | 2566 this, pProcessor, bContainerWidthAutoSize, |
2569 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2567 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
2570 uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, | 2568 uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, |
2571 fAvailHeight, fRealHeight, fContentCurRowY, | 2569 fAvailHeight, fRealHeight, fContentCurRowY, |
2572 fContentWidthLimit, fContentCurRowAvailWidth, | 2570 fContentWidthLimit, fContentCurRowAvailWidth, |
2573 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, | 2571 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, |
2574 pContext) != XFA_ItemLayoutProcessorResult_Done) { | 2572 pContext) != XFA_ItemLayoutProcessorResult_Done) { |
2575 goto SuspendAndCreateNewRow; | 2573 goto SuspendAndCreateNewRow; |
2576 } else { | 2574 } else { |
2577 delete pProcessor; | 2575 delete pProcessor; |
2578 pProcessor = NULL; | 2576 pProcessor = nullptr; |
2579 } | 2577 } |
2580 } | 2578 } |
2581 } break; | 2579 } break; |
2582 case XFA_ItemLayoutProcessorStages_BookendTrailer: { | 2580 case XFA_ItemLayoutProcessorStages_BookendTrailer: { |
2583 CXFA_Node* pTrailerNode = NULL; | 2581 CXFA_Node* pTrailerNode = nullptr; |
2584 if (m_pCurChildPreprocessor) { | 2582 if (m_pCurChildPreprocessor) { |
2585 pProcessor = m_pCurChildPreprocessor; | 2583 pProcessor = m_pCurChildPreprocessor; |
2586 m_pCurChildPreprocessor = NULL; | 2584 m_pCurChildPreprocessor = nullptr; |
2587 } else if (m_pPageMgr && | 2585 } else if (m_pPageMgr && |
2588 m_pPageMgr->ProcessBookendLeaderOrTrailer( | 2586 m_pPageMgr->ProcessBookendLeaderOrTrailer( |
2589 m_pCurChildNode, FALSE, pTrailerNode)) { | 2587 m_pCurChildNode, FALSE, pTrailerNode)) { |
2590 pProcessor = new CXFA_ItemLayoutProcessor(pTrailerNode, m_pPageMgr); | 2588 pProcessor = new CXFA_ItemLayoutProcessor(pTrailerNode, m_pPageMgr); |
2591 } | 2589 } |
2592 if (pProcessor) { | 2590 if (pProcessor) { |
2593 if (XFA_ItemLayoutProcessor_InsertFlowedItem( | 2591 if (XFA_ItemLayoutProcessor_InsertFlowedItem( |
2594 this, pProcessor, bContainerWidthAutoSize, | 2592 this, pProcessor, bContainerWidthAutoSize, |
2595 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2593 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
2596 uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, | 2594 uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, |
2597 fAvailHeight, fRealHeight, fContentCurRowY, | 2595 fAvailHeight, fRealHeight, fContentCurRowY, |
2598 fContentWidthLimit, fContentCurRowAvailWidth, | 2596 fContentWidthLimit, fContentCurRowAvailWidth, |
2599 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, | 2597 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, |
2600 pContext) != XFA_ItemLayoutProcessorResult_Done) { | 2598 pContext) != XFA_ItemLayoutProcessorResult_Done) { |
2601 goto SuspendAndCreateNewRow; | 2599 goto SuspendAndCreateNewRow; |
2602 } else { | 2600 } else { |
2603 delete pProcessor; | 2601 delete pProcessor; |
2604 pProcessor = NULL; | 2602 pProcessor = nullptr; |
2605 } | 2603 } |
2606 } | 2604 } |
2607 } break; | 2605 } break; |
2608 case XFA_ItemLayoutProcessorStages_Container: | 2606 case XFA_ItemLayoutProcessorStages_Container: |
2609 ASSERT(m_pCurChildNode->IsContainerNode()); | 2607 ASSERT(m_pCurChildNode->IsContainerNode()); |
2610 if (m_pCurChildNode->GetClassID() == XFA_ELEMENT_Variables) { | 2608 if (m_pCurChildNode->GetClassID() == XFA_ELEMENT_Variables) { |
2611 break; | 2609 break; |
2612 } | 2610 } |
2613 if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION && | 2611 if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION && |
2614 XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) { | 2612 XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) { |
2615 bForceEndPage = TRUE; | 2613 bForceEndPage = TRUE; |
2616 goto SuspendAndCreateNewRow; | 2614 goto SuspendAndCreateNewRow; |
2617 } | 2615 } |
2618 if (m_pCurChildNode->IsContainerNode()) { | 2616 if (m_pCurChildNode->IsContainerNode()) { |
2619 FX_BOOL bNewRow = FALSE; | 2617 FX_BOOL bNewRow = FALSE; |
2620 if (m_pCurChildPreprocessor) { | 2618 if (m_pCurChildPreprocessor) { |
2621 pProcessor = m_pCurChildPreprocessor; | 2619 pProcessor = m_pCurChildPreprocessor; |
2622 m_pCurChildPreprocessor = NULL; | 2620 m_pCurChildPreprocessor = nullptr; |
2623 bNewRow = TRUE; | 2621 bNewRow = TRUE; |
2624 } else { | 2622 } else { |
2625 pProcessor = | 2623 pProcessor = |
2626 new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); | 2624 new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); |
2627 } | 2625 } |
2628 XFA_ItemLayoutProcessor_InsertPendingItems(pProcessor, | 2626 XFA_ItemLayoutProcessor_InsertPendingItems(pProcessor, |
2629 m_pCurChildNode); | 2627 m_pCurChildNode); |
2630 XFA_ItemLayoutProcessorResult rs = | 2628 XFA_ItemLayoutProcessorResult rs = |
2631 XFA_ItemLayoutProcessor_InsertFlowedItem( | 2629 XFA_ItemLayoutProcessor_InsertFlowedItem( |
2632 this, pProcessor, bContainerWidthAutoSize, | 2630 this, pProcessor, bContainerWidthAutoSize, |
2633 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2631 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
2634 uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, | 2632 uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, |
2635 fAvailHeight, fRealHeight, fContentCurRowY, | 2633 fAvailHeight, fRealHeight, fContentCurRowY, |
2636 fContentWidthLimit, fContentCurRowAvailWidth, | 2634 fContentWidthLimit, fContentCurRowAvailWidth, |
2637 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, | 2635 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, |
2638 pContext, bNewRow); | 2636 pContext, bNewRow); |
2639 switch (rs) { | 2637 switch (rs) { |
2640 case XFA_ItemLayoutProcessorResult_ManualBreak: | 2638 case XFA_ItemLayoutProcessorResult_ManualBreak: |
2641 bIsManualBreak = TRUE; | 2639 bIsManualBreak = TRUE; |
2642 case XFA_ItemLayoutProcessorResult_PageFullBreak: | 2640 case XFA_ItemLayoutProcessorResult_PageFullBreak: |
2643 bForceEndPage = TRUE; | 2641 bForceEndPage = TRUE; |
2644 case XFA_ItemLayoutProcessorResult_RowFullBreak: | 2642 case XFA_ItemLayoutProcessorResult_RowFullBreak: |
2645 goto SuspendAndCreateNewRow; | 2643 goto SuspendAndCreateNewRow; |
2646 case XFA_ItemLayoutProcessorResult_Done: | 2644 case XFA_ItemLayoutProcessorResult_Done: |
2647 default: | 2645 default: |
2648 fContentCurRowY += XFA_ItemLayoutProcessor_InsertPendingItems( | 2646 fContentCurRowY += XFA_ItemLayoutProcessor_InsertPendingItems( |
2649 pProcessor, m_pCurChildNode); | 2647 pProcessor, m_pCurChildNode); |
2650 delete pProcessor; | 2648 delete pProcessor; |
2651 pProcessor = NULL; | 2649 pProcessor = nullptr; |
2652 } | 2650 } |
2653 } | 2651 } |
2654 break; | 2652 break; |
2655 case XFA_ItemLayoutProcessorStages_Done: | 2653 case XFA_ItemLayoutProcessorStages_Done: |
2656 break; | 2654 break; |
2657 default: | 2655 default: |
2658 break; | 2656 break; |
2659 } | 2657 } |
2660 XFA_ItemLayoutProcessor_GotoNextContainerNode( | 2658 XFA_ItemLayoutProcessor_GotoNextContainerNode( |
2661 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, TRUE); | 2659 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, TRUE); |
(...skipping 23 matching lines...) Expand all Loading... |
2685 m_PendingNodes.empty(); | 2683 m_PendingNodes.empty(); |
2686 if (bBreakDone) { | 2684 if (bBreakDone) { |
2687 bRetValue = FALSE; | 2685 bRetValue = FALSE; |
2688 } | 2686 } |
2689 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( | 2687 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( |
2690 m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, | 2688 m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, |
2691 fContainerWidth, bContainerHeightAutoSize, fContentCalculatedHeight, | 2689 fContainerWidth, bContainerHeightAutoSize, fContentCalculatedHeight, |
2692 fContainerHeight); | 2690 fContainerHeight); |
2693 if (fContainerHeight >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem || | 2691 if (fContainerHeight >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem || |
2694 bRetValue) { | 2692 bRetValue) { |
2695 if (m_pLayoutItem == NULL) { | 2693 if (!m_pLayoutItem) |
2696 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); | 2694 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); |
2697 } | |
2698 if (fContainerHeight < 0) { | 2695 if (fContainerHeight < 0) { |
2699 fContainerHeight = 0; | 2696 fContainerHeight = 0; |
2700 } | 2697 } |
2701 SetCurrentComponentSize(fContainerWidth, fContainerHeight); | 2698 SetCurrentComponentSize(fContainerWidth, fContainerHeight); |
2702 if (bForceEndPage) { | 2699 if (bForceEndPage) { |
2703 m_fUsedSize = 0; | 2700 m_fUsedSize = 0; |
2704 } else { | 2701 } else { |
2705 m_fUsedSize += m_pLayoutItem->m_sSize.y; | 2702 m_fUsedSize += m_pLayoutItem->m_sSize.y; |
2706 } | 2703 } |
2707 } | 2704 } |
(...skipping 29 matching lines...) Expand all Loading... |
2737 } | 2734 } |
2738 if (!nTotalLength) { | 2735 if (!nTotalLength) { |
2739 if (bContainerHeightAutoSize) { | 2736 if (bContainerHeightAutoSize) { |
2740 FX_FLOAT fNewHeight = fContentCurRowY; | 2737 FX_FLOAT fNewHeight = fContentCurRowY; |
2741 if (fContentCalculatedHeight > fNewHeight) { | 2738 if (fContentCalculatedHeight > fNewHeight) { |
2742 fContentCalculatedHeight = fNewHeight; | 2739 fContentCalculatedHeight = fNewHeight; |
2743 } | 2740 } |
2744 } | 2741 } |
2745 return FALSE; | 2742 return FALSE; |
2746 } | 2743 } |
2747 if (m_pLayoutItem == NULL) { | 2744 if (!m_pLayoutItem) |
2748 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); | 2745 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); |
2749 } | 2746 |
2750 if (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb) { | 2747 if (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb) { |
2751 FX_FLOAT fCurPos; | 2748 FX_FLOAT fCurPos; |
2752 fCurPos = 0; | 2749 fCurPos = 0; |
2753 for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) { | 2750 for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) { |
2754 if (bRootForceTb) { | 2751 if (bRootForceTb) { |
2755 FX_FLOAT fAbsoluteX, fAbsoluteY; | 2752 FX_FLOAT fAbsoluteX, fAbsoluteY; |
2756 CalculatePositionedContainerPos(rgCurLineLayoutItems[0][j]->m_pFormNode, | 2753 CalculatePositionedContainerPos(rgCurLineLayoutItems[0][j]->m_pFormNode, |
2757 rgCurLineLayoutItems[0][j]->m_sSize.x, | 2754 rgCurLineLayoutItems[0][j]->m_sSize.x, |
2758 rgCurLineLayoutItems[0][j]->m_sSize.y, | 2755 rgCurLineLayoutItems[0][j]->m_sSize.y, |
2759 fAbsoluteX, fAbsoluteY); | 2756 fAbsoluteX, fAbsoluteY); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2984 if (iMax < 0) | 2981 if (iMax < 0) |
2985 return TRUE; | 2982 return TRUE; |
2986 | 2983 |
2987 int32_t iCount = m_PendingNodesCount[pTemplate]; | 2984 int32_t iCount = m_PendingNodesCount[pTemplate]; |
2988 if (iCount >= iMax) | 2985 if (iCount >= iMax) |
2989 return FALSE; | 2986 return FALSE; |
2990 | 2987 |
2991 m_PendingNodesCount[pTemplate] = iCount + 1; | 2988 m_PendingNodesCount[pTemplate] = iCount + 1; |
2992 return TRUE; | 2989 return TRUE; |
2993 } | 2990 } |
OLD | NEW |