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