| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" | 7 #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" |
| 8 | 8 |
| 9 #include "xfa/fxfa/app/xfa_ffnotify.h" | 9 #include "xfa/fxfa/app/xfa_ffnotify.h" |
| 10 #include "xfa/fxfa/parser/xfa_doclayout.h" | 10 #include "xfa/fxfa/parser/xfa_doclayout.h" |
| 11 #include "xfa/fxfa/parser/xfa_document.h" | 11 #include "xfa/fxfa/parser/xfa_document.h" |
| 12 #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" | 12 #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" |
| 13 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" | 13 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" |
| 14 #include "xfa/fxfa/parser/xfa_layout_appadapter.h" | 14 #include "xfa/fxfa/parser/xfa_layout_appadapter.h" |
| 15 #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" | 15 #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" |
| 16 #include "xfa/fxfa/parser/xfa_localemgr.h" | 16 #include "xfa/fxfa/parser/xfa_localemgr.h" |
| 17 #include "xfa/fxfa/parser/xfa_object.h" | 17 #include "xfa/fxfa/parser/xfa_object.h" |
| 18 #include "xfa/fxfa/parser/xfa_parser.h" | 18 #include "xfa/fxfa/parser/xfa_parser.h" |
| 19 #include "xfa/fxfa/parser/xfa_parser_imp.h" | 19 #include "xfa/fxfa/parser/xfa_parser_imp.h" |
| 20 #include "xfa/fxfa/parser/xfa_script.h" | 20 #include "xfa/fxfa/parser/xfa_script.h" |
| 21 #include "xfa/fxfa/parser/xfa_script_imp.h" | 21 #include "xfa/fxfa/parser/xfa_script_imp.h" |
| 22 #include "xfa/fxfa/parser/xfa_utils.h" | 22 #include "xfa/fxfa/parser/xfa_utils.h" |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 class PageSetContainerLayoutItem { | 26 class PageSetContainerLayoutItem { |
| 27 public: | 27 public: |
| 28 static inline CXFA_ContainerLayoutItem* GetFirstChild( | 28 static inline CXFA_ContainerLayoutItem* GetFirstChild( |
| 29 CXFA_ContainerLayoutItem* pLayoutItem) { | 29 CXFA_ContainerLayoutItem* pLayoutItem) { |
| 30 if (pLayoutItem->m_pFormNode->GetClassID() != XFA_ELEMENT_PageSet) | 30 if (pLayoutItem->m_pFormNode->GetClassID() != XFA_Element::PageSet) |
| 31 return nullptr; | 31 return nullptr; |
| 32 | 32 |
| 33 CXFA_ContainerLayoutItem* pChildItem = | 33 CXFA_ContainerLayoutItem* pChildItem = |
| 34 static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pFirstChild); | 34 static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pFirstChild); |
| 35 while (pChildItem && | 35 while (pChildItem && |
| 36 pChildItem->m_pFormNode->GetClassID() != XFA_ELEMENT_PageSet) { | 36 pChildItem->m_pFormNode->GetClassID() != XFA_Element::PageSet) { |
| 37 pChildItem = | 37 pChildItem = |
| 38 static_cast<CXFA_ContainerLayoutItem*>(pChildItem->m_pNextSibling); | 38 static_cast<CXFA_ContainerLayoutItem*>(pChildItem->m_pNextSibling); |
| 39 } | 39 } |
| 40 return pChildItem; | 40 return pChildItem; |
| 41 } | 41 } |
| 42 | 42 |
| 43 static inline CXFA_ContainerLayoutItem* GetNextSibling( | 43 static inline CXFA_ContainerLayoutItem* GetNextSibling( |
| 44 CXFA_ContainerLayoutItem* pLayoutItem) { | 44 CXFA_ContainerLayoutItem* pLayoutItem) { |
| 45 CXFA_ContainerLayoutItem* pChildItem = | 45 CXFA_ContainerLayoutItem* pChildItem = |
| 46 static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pNextSibling); | 46 static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pNextSibling); |
| 47 while (pChildItem && | 47 while (pChildItem && |
| 48 pChildItem->m_pFormNode->GetClassID() != XFA_ELEMENT_PageSet) { | 48 pChildItem->m_pFormNode->GetClassID() != XFA_Element::PageSet) { |
| 49 pChildItem = | 49 pChildItem = |
| 50 static_cast<CXFA_ContainerLayoutItem*>(pChildItem->m_pNextSibling); | 50 static_cast<CXFA_ContainerLayoutItem*>(pChildItem->m_pNextSibling); |
| 51 } | 51 } |
| 52 return pChildItem; | 52 return pChildItem; |
| 53 } | 53 } |
| 54 | 54 |
| 55 static inline CXFA_ContainerLayoutItem* GetParent( | 55 static inline CXFA_ContainerLayoutItem* GetParent( |
| 56 CXFA_ContainerLayoutItem* pLayoutItem) { | 56 CXFA_ContainerLayoutItem* pLayoutItem) { |
| 57 return static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pParent); | 57 return static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pParent); |
| 58 } | 58 } |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 pNextLayout = pLayoutItem->m_pNextSibling; | 239 pNextLayout = pLayoutItem->m_pNextSibling; |
| 240 XFA_ReleaseLayoutItem(pLayoutItem); | 240 XFA_ReleaseLayoutItem(pLayoutItem); |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { | 243 FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { |
| 244 PrepareLayout(); | 244 PrepareLayout(); |
| 245 CXFA_Node* pTemplateNode = pFormNode->GetTemplateNode(); | 245 CXFA_Node* pTemplateNode = pFormNode->GetTemplateNode(); |
| 246 if (!pTemplateNode) { | 246 if (!pTemplateNode) { |
| 247 return FALSE; | 247 return FALSE; |
| 248 } | 248 } |
| 249 m_pTemplatePageSetRoot = pTemplateNode->GetProperty(0, XFA_ELEMENT_PageSet); | 249 m_pTemplatePageSetRoot = pTemplateNode->GetProperty(0, XFA_Element::PageSet); |
| 250 ASSERT(m_pTemplatePageSetRoot); | 250 ASSERT(m_pTemplatePageSetRoot); |
| 251 if (m_pPageSetLayoutItemRoot) { | 251 if (m_pPageSetLayoutItemRoot) { |
| 252 m_pPageSetLayoutItemRoot->m_pParent = NULL; | 252 m_pPageSetLayoutItemRoot->m_pParent = NULL; |
| 253 m_pPageSetLayoutItemRoot->m_pFirstChild = NULL; | 253 m_pPageSetLayoutItemRoot->m_pFirstChild = NULL; |
| 254 m_pPageSetLayoutItemRoot->m_pNextSibling = NULL; | 254 m_pPageSetLayoutItemRoot->m_pNextSibling = NULL; |
| 255 m_pPageSetLayoutItemRoot->m_pFormNode = m_pTemplatePageSetRoot; | 255 m_pPageSetLayoutItemRoot->m_pFormNode = m_pTemplatePageSetRoot; |
| 256 } else { | 256 } else { |
| 257 m_pPageSetLayoutItemRoot = | 257 m_pPageSetLayoutItemRoot = |
| 258 new CXFA_ContainerLayoutItem(m_pTemplatePageSetRoot); | 258 new CXFA_ContainerLayoutItem(m_pTemplatePageSetRoot); |
| 259 } | 259 } |
| 260 m_pPageSetCurRoot = m_pPageSetLayoutItemRoot; | 260 m_pPageSetCurRoot = m_pPageSetLayoutItemRoot; |
| 261 m_pTemplatePageSetRoot->SetUserData(XFA_LAYOUTITEMKEY, | 261 m_pTemplatePageSetRoot->SetUserData(XFA_LAYOUTITEMKEY, |
| 262 (void*)m_pPageSetLayoutItemRoot); | 262 (void*)m_pPageSetLayoutItemRoot); |
| 263 XFA_ATTRIBUTEENUM eRelation = | 263 XFA_ATTRIBUTEENUM eRelation = |
| 264 m_pTemplatePageSetRoot->GetEnum(XFA_ATTRIBUTE_Relation); | 264 m_pTemplatePageSetRoot->GetEnum(XFA_ATTRIBUTE_Relation); |
| 265 if (eRelation != XFA_ATTRIBUTEENUM_Unknown) { | 265 if (eRelation != XFA_ATTRIBUTEENUM_Unknown) { |
| 266 m_ePageSetMode = eRelation; | 266 m_ePageSetMode = eRelation; |
| 267 } | 267 } |
| 268 InitPageSetMap(); | 268 InitPageSetMap(); |
| 269 CXFA_Node* pPageArea = NULL; | 269 CXFA_Node* pPageArea = NULL; |
| 270 int32_t iCount = 0; | 270 int32_t iCount = 0; |
| 271 for (pPageArea = m_pTemplatePageSetRoot->GetNodeItem(XFA_NODEITEM_FirstChild); | 271 for (pPageArea = m_pTemplatePageSetRoot->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 272 pPageArea; | 272 pPageArea; |
| 273 pPageArea = pPageArea->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 273 pPageArea = pPageArea->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 274 if (pPageArea->GetClassID() == XFA_ELEMENT_PageArea) { | 274 if (pPageArea->GetClassID() == XFA_Element::PageArea) { |
| 275 iCount++; | 275 iCount++; |
| 276 if (pPageArea->GetFirstChildByClass(XFA_ELEMENT_ContentArea)) { | 276 if (pPageArea->GetFirstChildByClass(XFA_Element::ContentArea)) { |
| 277 return TRUE; | 277 return TRUE; |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 if (iCount > 0) { | 281 if (iCount > 0) { |
| 282 return FALSE; | 282 return FALSE; |
| 283 } | 283 } |
| 284 CXFA_Document* pDocument = pTemplateNode->GetDocument(); | 284 CXFA_Document* pDocument = pTemplateNode->GetDocument(); |
| 285 CXFA_Document* pObjFactory = pDocument->GetParser()->GetFactory(); | 285 CXFA_Document* pObjFactory = pDocument->GetParser()->GetFactory(); |
| 286 pPageArea = m_pTemplatePageSetRoot->GetChild(0, XFA_ELEMENT_PageArea); | 286 pPageArea = m_pTemplatePageSetRoot->GetChild(0, XFA_Element::PageArea); |
| 287 if (!pPageArea) { | 287 if (!pPageArea) { |
| 288 pPageArea = pObjFactory->CreateNode(m_pTemplatePageSetRoot->GetPacketID(), | 288 pPageArea = pObjFactory->CreateNode(m_pTemplatePageSetRoot->GetPacketID(), |
| 289 XFA_ELEMENT_PageArea); | 289 XFA_Element::PageArea); |
| 290 if (!pPageArea) { | 290 if (!pPageArea) { |
| 291 return FALSE; | 291 return FALSE; |
| 292 } | 292 } |
| 293 m_pTemplatePageSetRoot->InsertChild(pPageArea, NULL); | 293 m_pTemplatePageSetRoot->InsertChild(pPageArea, NULL); |
| 294 pPageArea->SetFlag(XFA_NodeFlag_Initialized, true); | 294 pPageArea->SetFlag(XFA_NodeFlag_Initialized, true); |
| 295 } | 295 } |
| 296 CXFA_Node* pContentArea = pPageArea->GetChild(0, XFA_ELEMENT_ContentArea); | 296 CXFA_Node* pContentArea = pPageArea->GetChild(0, XFA_Element::ContentArea); |
| 297 if (!pContentArea) { | 297 if (!pContentArea) { |
| 298 pContentArea = pObjFactory->CreateNode(pPageArea->GetPacketID(), | 298 pContentArea = pObjFactory->CreateNode(pPageArea->GetPacketID(), |
| 299 XFA_ELEMENT_ContentArea); | 299 XFA_Element::ContentArea); |
| 300 if (!pContentArea) { | 300 if (!pContentArea) { |
| 301 return FALSE; | 301 return FALSE; |
| 302 } | 302 } |
| 303 pPageArea->InsertChild(pContentArea, NULL); | 303 pPageArea->InsertChild(pContentArea, NULL); |
| 304 pContentArea->SetFlag(XFA_NodeFlag_Initialized, true); | 304 pContentArea->SetFlag(XFA_NodeFlag_Initialized, true); |
| 305 pContentArea->SetMeasure(XFA_ATTRIBUTE_X, | 305 pContentArea->SetMeasure(XFA_ATTRIBUTE_X, |
| 306 CXFA_Measurement(0.25f, XFA_UNIT_In)); | 306 CXFA_Measurement(0.25f, XFA_UNIT_In)); |
| 307 pContentArea->SetMeasure(XFA_ATTRIBUTE_Y, | 307 pContentArea->SetMeasure(XFA_ATTRIBUTE_Y, |
| 308 CXFA_Measurement(0.25f, XFA_UNIT_In)); | 308 CXFA_Measurement(0.25f, XFA_UNIT_In)); |
| 309 pContentArea->SetMeasure(XFA_ATTRIBUTE_W, | 309 pContentArea->SetMeasure(XFA_ATTRIBUTE_W, |
| 310 CXFA_Measurement(8.0f, XFA_UNIT_In)); | 310 CXFA_Measurement(8.0f, XFA_UNIT_In)); |
| 311 pContentArea->SetMeasure(XFA_ATTRIBUTE_H, | 311 pContentArea->SetMeasure(XFA_ATTRIBUTE_H, |
| 312 CXFA_Measurement(10.5f, XFA_UNIT_In)); | 312 CXFA_Measurement(10.5f, XFA_UNIT_In)); |
| 313 } | 313 } |
| 314 CXFA_Node* pMedium = pPageArea->GetChild(0, XFA_ELEMENT_Medium); | 314 CXFA_Node* pMedium = pPageArea->GetChild(0, XFA_Element::Medium); |
| 315 if (!pMedium) { | 315 if (!pMedium) { |
| 316 pMedium = | 316 pMedium = |
| 317 pObjFactory->CreateNode(pPageArea->GetPacketID(), XFA_ELEMENT_Medium); | 317 pObjFactory->CreateNode(pPageArea->GetPacketID(), XFA_Element::Medium); |
| 318 if (!pContentArea) { | 318 if (!pContentArea) { |
| 319 return FALSE; | 319 return FALSE; |
| 320 } | 320 } |
| 321 pPageArea->InsertChild(pMedium, NULL); | 321 pPageArea->InsertChild(pMedium, NULL); |
| 322 pMedium->SetFlag(XFA_NodeFlag_Initialized, true); | 322 pMedium->SetFlag(XFA_NodeFlag_Initialized, true); |
| 323 pMedium->SetMeasure(XFA_ATTRIBUTE_Short, | 323 pMedium->SetMeasure(XFA_ATTRIBUTE_Short, |
| 324 CXFA_Measurement(8.5f, XFA_UNIT_In)); | 324 CXFA_Measurement(8.5f, XFA_UNIT_In)); |
| 325 pMedium->SetMeasure(XFA_ATTRIBUTE_Long, | 325 pMedium->SetMeasure(XFA_ATTRIBUTE_Long, |
| 326 CXFA_Measurement(11.0f, XFA_UNIT_In)); | 326 CXFA_Measurement(11.0f, XFA_UNIT_In)); |
| 327 } | 327 } |
| 328 return TRUE; | 328 return TRUE; |
| 329 } | 329 } |
| 330 FX_BOOL CXFA_LayoutPageMgr::PrepareFirstPage(CXFA_Node* pRootSubform) { | 330 FX_BOOL CXFA_LayoutPageMgr::PrepareFirstPage(CXFA_Node* pRootSubform) { |
| 331 FX_BOOL bProBreakBefore = FALSE; | 331 FX_BOOL bProBreakBefore = FALSE; |
| 332 CXFA_Node* pBreakBeforeNode = NULL; | 332 CXFA_Node* pBreakBeforeNode = NULL; |
| 333 while (pRootSubform) { | 333 while (pRootSubform) { |
| 334 for (CXFA_Node* pBreakNode = | 334 for (CXFA_Node* pBreakNode = |
| 335 pRootSubform->GetNodeItem(XFA_NODEITEM_FirstChild); | 335 pRootSubform->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 336 pBreakNode; | 336 pBreakNode; |
| 337 pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 337 pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 338 XFA_ELEMENT eType = pBreakNode->GetClassID(); | 338 XFA_Element eType = pBreakNode->GetClassID(); |
| 339 if (eType == XFA_ELEMENT_BreakBefore || | 339 if (eType == XFA_Element::BreakBefore || |
| 340 (eType == XFA_ELEMENT_Break && | 340 (eType == XFA_Element::Break && |
| 341 pBreakNode->GetEnum(XFA_ATTRIBUTE_Before) != | 341 pBreakNode->GetEnum(XFA_ATTRIBUTE_Before) != |
| 342 XFA_ATTRIBUTEENUM_Auto)) { | 342 XFA_ATTRIBUTEENUM_Auto)) { |
| 343 bProBreakBefore = TRUE; | 343 bProBreakBefore = TRUE; |
| 344 pBreakBeforeNode = pBreakNode; | 344 pBreakBeforeNode = pBreakNode; |
| 345 break; | 345 break; |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 if (bProBreakBefore) { | 348 if (bProBreakBefore) { |
| 349 break; | 349 break; |
| 350 } | 350 } |
| 351 bProBreakBefore = TRUE; | 351 bProBreakBefore = TRUE; |
| 352 pRootSubform = pRootSubform->GetFirstChildByClass(XFA_ELEMENT_Subform); | 352 pRootSubform = pRootSubform->GetFirstChildByClass(XFA_Element::Subform); |
| 353 while (pRootSubform && | 353 while (pRootSubform && |
| 354 !XFA_ItemLayoutProcessor_IsTakingSpace(pRootSubform)) { | 354 !XFA_ItemLayoutProcessor_IsTakingSpace(pRootSubform)) { |
| 355 pRootSubform = pRootSubform->GetNextSameClassSibling(XFA_ELEMENT_Subform); | 355 pRootSubform = |
| 356 pRootSubform->GetNextSameClassSibling(XFA_Element::Subform); |
| 356 } | 357 } |
| 357 } | 358 } |
| 358 CXFA_Node *pLeader, *pTrailer; | 359 CXFA_Node *pLeader, *pTrailer; |
| 359 if (pBreakBeforeNode && | 360 if (pBreakBeforeNode && |
| 360 ExecuteBreakBeforeOrAfter(pBreakBeforeNode, TRUE, pLeader, pTrailer)) { | 361 ExecuteBreakBeforeOrAfter(pBreakBeforeNode, TRUE, pLeader, pTrailer)) { |
| 361 m_pCurrentContainerRecord = m_rgProposedContainerRecord.GetHeadPosition(); | 362 m_pCurrentContainerRecord = m_rgProposedContainerRecord.GetHeadPosition(); |
| 362 return TRUE; | 363 return TRUE; |
| 363 } | 364 } |
| 364 return AppendNewPage(TRUE); | 365 return AppendNewPage(TRUE); |
| 365 } | 366 } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 default: { ProcessLastPageSet(); } break; | 580 default: { ProcessLastPageSet(); } break; |
| 580 case XFA_ATTRIBUTEENUM_SimplexPaginated: | 581 case XFA_ATTRIBUTEENUM_SimplexPaginated: |
| 581 case XFA_ATTRIBUTEENUM_DuplexPaginated: { | 582 case XFA_ATTRIBUTEENUM_DuplexPaginated: { |
| 582 CXFA_LayoutItem* pLastPageAreaLayoutItem = NULL; | 583 CXFA_LayoutItem* pLastPageAreaLayoutItem = NULL; |
| 583 int32_t nPageAreaCount = 0; | 584 int32_t nPageAreaCount = 0; |
| 584 for (CXFA_LayoutItem* pPageAreaLayoutItem = | 585 for (CXFA_LayoutItem* pPageAreaLayoutItem = |
| 585 pPageSetLayoutItem->m_pFirstChild; | 586 pPageSetLayoutItem->m_pFirstChild; |
| 586 pPageAreaLayoutItem; | 587 pPageAreaLayoutItem; |
| 587 pPageAreaLayoutItem = pPageAreaLayoutItem->m_pNextSibling) { | 588 pPageAreaLayoutItem = pPageAreaLayoutItem->m_pNextSibling) { |
| 588 if (pPageAreaLayoutItem->m_pFormNode->GetClassID() != | 589 if (pPageAreaLayoutItem->m_pFormNode->GetClassID() != |
| 589 XFA_ELEMENT_PageArea) { | 590 XFA_Element::PageArea) { |
| 590 continue; | 591 continue; |
| 591 } | 592 } |
| 592 nPageAreaCount++; | 593 nPageAreaCount++; |
| 593 pLastPageAreaLayoutItem = pPageAreaLayoutItem; | 594 pLastPageAreaLayoutItem = pPageAreaLayoutItem; |
| 594 } | 595 } |
| 595 if (!pLastPageAreaLayoutItem) { | 596 if (!pLastPageAreaLayoutItem) { |
| 596 break; | 597 break; |
| 597 } | 598 } |
| 598 if (!FindPageAreaFromPageSet_SimplexDuplex( | 599 if (!FindPageAreaFromPageSet_SimplexDuplex( |
| 599 pPageSetLayoutItem->m_pFormNode, NULL, NULL, NULL, TRUE, TRUE, | 600 pPageSetLayoutItem->m_pFormNode, NULL, NULL, NULL, TRUE, TRUE, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 622 break; | 623 break; |
| 623 } | 624 } |
| 624 } | 625 } |
| 625 FX_BOOL bUsable = TRUE; | 626 FX_BOOL bUsable = TRUE; |
| 626 CFX_ArrayTemplate<FX_FLOAT> rgUsedHeights; | 627 CFX_ArrayTemplate<FX_FLOAT> rgUsedHeights; |
| 627 for (CXFA_LayoutItem* pChildLayoutItem = | 628 for (CXFA_LayoutItem* pChildLayoutItem = |
| 628 pLastPageAreaLayoutItem->m_pFirstChild; | 629 pLastPageAreaLayoutItem->m_pFirstChild; |
| 629 pChildLayoutItem; | 630 pChildLayoutItem; |
| 630 pChildLayoutItem = pChildLayoutItem->m_pNextSibling) { | 631 pChildLayoutItem = pChildLayoutItem->m_pNextSibling) { |
| 631 if (pChildLayoutItem->m_pFormNode->GetClassID() != | 632 if (pChildLayoutItem->m_pFormNode->GetClassID() != |
| 632 XFA_ELEMENT_ContentArea) { | 633 XFA_Element::ContentArea) { |
| 633 continue; | 634 continue; |
| 634 } | 635 } |
| 635 FX_FLOAT fUsedHeight = 0; | 636 FX_FLOAT fUsedHeight = 0; |
| 636 for (CXFA_LayoutItem* pContentChildLayoutItem = | 637 for (CXFA_LayoutItem* pContentChildLayoutItem = |
| 637 pChildLayoutItem->m_pFirstChild; | 638 pChildLayoutItem->m_pFirstChild; |
| 638 pContentChildLayoutItem; | 639 pContentChildLayoutItem; |
| 639 pContentChildLayoutItem = | 640 pContentChildLayoutItem = |
| 640 pContentChildLayoutItem->m_pNextSibling) { | 641 pContentChildLayoutItem->m_pNextSibling) { |
| 641 if (CXFA_ContentLayoutItem* pContent = | 642 if (CXFA_ContentLayoutItem* pContent = |
| 642 pContentChildLayoutItem->AsContentLayoutItem()) { | 643 pContentChildLayoutItem->AsContentLayoutItem()) { |
| 643 fUsedHeight += pContent->m_sSize.y; | 644 fUsedHeight += pContent->m_sSize.y; |
| 644 } | 645 } |
| 645 } | 646 } |
| 646 rgUsedHeights.Add(fUsedHeight); | 647 rgUsedHeights.Add(fUsedHeight); |
| 647 } | 648 } |
| 648 int32_t iCurContentAreaIndex = -1; | 649 int32_t iCurContentAreaIndex = -1; |
| 649 for (CXFA_Node* pContentAreaNode = | 650 for (CXFA_Node* pContentAreaNode = |
| 650 pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 651 pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 651 pContentAreaNode; | 652 pContentAreaNode; |
| 652 pContentAreaNode = | 653 pContentAreaNode = |
| 653 pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 654 pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 654 if (pContentAreaNode->GetClassID() != XFA_ELEMENT_ContentArea) { | 655 if (pContentAreaNode->GetClassID() != XFA_Element::ContentArea) { |
| 655 continue; | 656 continue; |
| 656 } | 657 } |
| 657 iCurContentAreaIndex++; | 658 iCurContentAreaIndex++; |
| 658 if (rgUsedHeights[iCurContentAreaIndex] > | 659 if (rgUsedHeights[iCurContentAreaIndex] > |
| 659 pContentAreaNode->GetMeasure(XFA_ATTRIBUTE_H) | 660 pContentAreaNode->GetMeasure(XFA_ATTRIBUTE_H) |
| 660 .ToUnit(XFA_UNIT_Pt) + | 661 .ToUnit(XFA_UNIT_Pt) + |
| 661 XFA_LAYOUT_FLOAT_PERCISION) { | 662 XFA_LAYOUT_FLOAT_PERCISION) { |
| 662 bUsable = FALSE; | 663 bUsable = FALSE; |
| 663 break; | 664 break; |
| 664 } | 665 } |
| 665 } | 666 } |
| 666 if (bUsable) { | 667 if (bUsable) { |
| 667 CXFA_LayoutItem* pChildLayoutItem = | 668 CXFA_LayoutItem* pChildLayoutItem = |
| 668 pLastPageAreaLayoutItem->m_pFirstChild; | 669 pLastPageAreaLayoutItem->m_pFirstChild; |
| 669 CXFA_Node* pContentAreaNode = | 670 CXFA_Node* pContentAreaNode = |
| 670 pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 671 pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 671 pLastPageAreaLayoutItem->m_pFormNode = pNode; | 672 pLastPageAreaLayoutItem->m_pFormNode = pNode; |
| 672 while (pChildLayoutItem && pContentAreaNode) { | 673 while (pChildLayoutItem && pContentAreaNode) { |
| 673 if (pChildLayoutItem->m_pFormNode->GetClassID() != | 674 if (pChildLayoutItem->m_pFormNode->GetClassID() != |
| 674 XFA_ELEMENT_ContentArea) { | 675 XFA_Element::ContentArea) { |
| 675 pChildLayoutItem = pChildLayoutItem->m_pNextSibling; | 676 pChildLayoutItem = pChildLayoutItem->m_pNextSibling; |
| 676 continue; | 677 continue; |
| 677 } | 678 } |
| 678 if (pContentAreaNode->GetClassID() != XFA_ELEMENT_ContentArea) { | 679 if (pContentAreaNode->GetClassID() != XFA_Element::ContentArea) { |
| 679 pContentAreaNode = | 680 pContentAreaNode = |
| 680 pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 681 pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 681 continue; | 682 continue; |
| 682 } | 683 } |
| 683 pChildLayoutItem->m_pFormNode = pContentAreaNode; | 684 pChildLayoutItem->m_pFormNode = pContentAreaNode; |
| 684 pChildLayoutItem = pChildLayoutItem->m_pNextSibling; | 685 pChildLayoutItem = pChildLayoutItem->m_pNextSibling; |
| 685 pContentAreaNode = | 686 pContentAreaNode = |
| 686 pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 687 pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 687 } | 688 } |
| 688 } else if (pNode->GetEnum(XFA_ATTRIBUTE_PagePosition) == | 689 } else if (pNode->GetEnum(XFA_ATTRIBUTE_PagePosition) == |
| (...skipping 12 matching lines...) Expand all Loading... |
| 701 CXFA_ContainerLayoutItem* CXFA_LayoutPageMgr::GetPage(int32_t index) const { | 702 CXFA_ContainerLayoutItem* CXFA_LayoutPageMgr::GetPage(int32_t index) const { |
| 702 if (index < 0 || index >= m_PageArray.GetSize()) | 703 if (index < 0 || index >= m_PageArray.GetSize()) |
| 703 return nullptr; | 704 return nullptr; |
| 704 return m_PageArray[index]; | 705 return m_PageArray[index]; |
| 705 } | 706 } |
| 706 int32_t CXFA_LayoutPageMgr::GetPageIndex( | 707 int32_t CXFA_LayoutPageMgr::GetPageIndex( |
| 707 const CXFA_ContainerLayoutItem* pPage) const { | 708 const CXFA_ContainerLayoutItem* pPage) const { |
| 708 // FIXME: Find() method should take const. | 709 // FIXME: Find() method should take const. |
| 709 return m_PageArray.Find(const_cast<CXFA_ContainerLayoutItem*>(pPage)); | 710 return m_PageArray.Find(const_cast<CXFA_ContainerLayoutItem*>(pPage)); |
| 710 } | 711 } |
| 711 FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_ELEMENT eBreakType, | 712 FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType, |
| 712 XFA_ATTRIBUTEENUM eTargetType, | 713 XFA_ATTRIBUTEENUM eTargetType, |
| 713 CXFA_Node* pTarget, | 714 CXFA_Node* pTarget, |
| 714 FX_BOOL bStartNew) { | 715 FX_BOOL bStartNew) { |
| 715 FX_BOOL bRet = FALSE; | 716 FX_BOOL bRet = FALSE; |
| 716 switch (eTargetType) { | 717 switch (eTargetType) { |
| 717 case XFA_ATTRIBUTEENUM_ContentArea: | 718 case XFA_ATTRIBUTEENUM_ContentArea: |
| 718 if (pTarget && pTarget->GetClassID() != XFA_ELEMENT_ContentArea) { | 719 if (pTarget && pTarget->GetClassID() != XFA_Element::ContentArea) { |
| 719 pTarget = NULL; | 720 pTarget = NULL; |
| 720 } | 721 } |
| 721 if (!pTarget || !m_pCurrentContainerRecord || | 722 if (!pTarget || !m_pCurrentContainerRecord || |
| 722 pTarget != | 723 pTarget != |
| 723 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode || | 724 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode || |
| 724 bStartNew) { | 725 bStartNew) { |
| 725 CXFA_Node* pPageArea = NULL; | 726 CXFA_Node* pPageArea = NULL; |
| 726 if (pTarget) { | 727 if (pTarget) { |
| 727 pPageArea = pTarget->GetNodeItem(XFA_NODEITEM_Parent); | 728 pPageArea = pTarget->GetNodeItem(XFA_NODEITEM_Parent); |
| 728 } | 729 } |
| 729 pPageArea = GetNextAvailPageArea(pPageArea, pTarget); | 730 pPageArea = GetNextAvailPageArea(pPageArea, pTarget); |
| 730 bRet = pPageArea != NULL; | 731 bRet = pPageArea != NULL; |
| 731 } | 732 } |
| 732 break; | 733 break; |
| 733 case XFA_ATTRIBUTEENUM_PageArea: | 734 case XFA_ATTRIBUTEENUM_PageArea: |
| 734 if (pTarget && pTarget->GetClassID() != XFA_ELEMENT_PageArea) { | 735 if (pTarget && pTarget->GetClassID() != XFA_Element::PageArea) { |
| 735 pTarget = NULL; | 736 pTarget = NULL; |
| 736 } | 737 } |
| 737 if (!pTarget || !m_pCurrentContainerRecord || | 738 if (!pTarget || !m_pCurrentContainerRecord || |
| 738 pTarget != GetCurrentContainerRecord()->pCurPageArea->m_pFormNode || | 739 pTarget != GetCurrentContainerRecord()->pCurPageArea->m_pFormNode || |
| 739 bStartNew) { | 740 bStartNew) { |
| 740 CXFA_Node* pPageArea = GetNextAvailPageArea(pTarget, NULL, TRUE); | 741 CXFA_Node* pPageArea = GetNextAvailPageArea(pTarget, NULL, TRUE); |
| 741 bRet = pPageArea != NULL; | 742 bRet = pPageArea != NULL; |
| 742 } | 743 } |
| 743 break; | 744 break; |
| 744 case XFA_ATTRIBUTEENUM_PageOdd: | 745 case XFA_ATTRIBUTEENUM_PageOdd: |
| 745 if (pTarget && pTarget->GetClassID() != XFA_ELEMENT_PageArea) { | 746 if (pTarget && pTarget->GetClassID() != XFA_Element::PageArea) { |
| 746 pTarget = NULL; | 747 pTarget = NULL; |
| 747 } | 748 } |
| 748 break; | 749 break; |
| 749 case XFA_ATTRIBUTEENUM_PageEven: | 750 case XFA_ATTRIBUTEENUM_PageEven: |
| 750 if (pTarget && pTarget->GetClassID() != XFA_ELEMENT_PageArea) { | 751 if (pTarget && pTarget->GetClassID() != XFA_Element::PageArea) { |
| 751 pTarget = NULL; | 752 pTarget = NULL; |
| 752 } | 753 } |
| 753 break; | 754 break; |
| 754 case XFA_ATTRIBUTEENUM_Auto: | 755 case XFA_ATTRIBUTEENUM_Auto: |
| 755 default: | 756 default: |
| 756 break; | 757 break; |
| 757 } | 758 } |
| 758 return bRet; | 759 return bRet; |
| 759 } | 760 } |
| 760 FX_BOOL CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( | 761 FX_BOOL CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( |
| 761 CXFA_Node* pCurNode, | 762 CXFA_Node* pCurNode, |
| 762 FX_BOOL bBefore, | 763 FX_BOOL bBefore, |
| 763 CXFA_Node*& pBreakLeaderTemplate, | 764 CXFA_Node*& pBreakLeaderTemplate, |
| 764 CXFA_Node*& pBreakTrailerTemplate) { | 765 CXFA_Node*& pBreakTrailerTemplate) { |
| 765 XFA_ELEMENT eType = pCurNode->GetClassID(); | 766 XFA_Element eType = pCurNode->GetClassID(); |
| 766 switch (eType) { | 767 switch (eType) { |
| 767 case XFA_ELEMENT_BreakBefore: | 768 case XFA_Element::BreakBefore: |
| 768 case XFA_ELEMENT_BreakAfter: { | 769 case XFA_Element::BreakAfter: { |
| 769 CFX_WideStringC wsBreakLeader, wsBreakTrailer; | 770 CFX_WideStringC wsBreakLeader, wsBreakTrailer; |
| 770 CXFA_Node* pFormNode = pCurNode->GetNodeItem( | 771 CXFA_Node* pFormNode = pCurNode->GetNodeItem( |
| 771 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); | 772 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); |
| 772 CXFA_Node* pContainer = pFormNode->GetTemplateNode(); | 773 CXFA_Node* pContainer = pFormNode->GetTemplateNode(); |
| 773 FX_BOOL bStartNew = pCurNode->GetInteger(XFA_ATTRIBUTE_StartNew) != 0; | 774 FX_BOOL bStartNew = pCurNode->GetInteger(XFA_ATTRIBUTE_StartNew) != 0; |
| 774 CXFA_Node* pScript = pCurNode->GetFirstChildByClass(XFA_ELEMENT_Script); | 775 CXFA_Node* pScript = pCurNode->GetFirstChildByClass(XFA_Element::Script); |
| 775 if (pScript && !XFA_LayoutPageMgr_RunBreakTestScript(pScript)) { | 776 if (pScript && !XFA_LayoutPageMgr_RunBreakTestScript(pScript)) { |
| 776 return FALSE; | 777 return FALSE; |
| 777 } | 778 } |
| 778 CFX_WideStringC wsTarget = pCurNode->GetCData(XFA_ATTRIBUTE_Target); | 779 CFX_WideStringC wsTarget = pCurNode->GetCData(XFA_ATTRIBUTE_Target); |
| 779 CXFA_Node* pTarget = | 780 CXFA_Node* pTarget = |
| 780 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsTarget); | 781 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsTarget); |
| 781 wsBreakTrailer = pCurNode->GetCData(XFA_ATTRIBUTE_Trailer); | 782 wsBreakTrailer = pCurNode->GetCData(XFA_ATTRIBUTE_Trailer); |
| 782 wsBreakLeader = pCurNode->GetCData(XFA_ATTRIBUTE_Leader); | 783 wsBreakLeader = pCurNode->GetCData(XFA_ATTRIBUTE_Leader); |
| 783 pBreakLeaderTemplate = | 784 pBreakLeaderTemplate = |
| 784 ResolveBreakTarget(pContainer, TRUE, wsBreakLeader); | 785 ResolveBreakTarget(pContainer, TRUE, wsBreakLeader); |
| 785 pBreakTrailerTemplate = | 786 pBreakTrailerTemplate = |
| 786 ResolveBreakTarget(pContainer, TRUE, wsBreakTrailer); | 787 ResolveBreakTarget(pContainer, TRUE, wsBreakTrailer); |
| 787 if (RunBreak(eType, pCurNode->GetEnum(XFA_ATTRIBUTE_TargetType), pTarget, | 788 if (RunBreak(eType, pCurNode->GetEnum(XFA_ATTRIBUTE_TargetType), pTarget, |
| 788 bStartNew)) { | 789 bStartNew)) { |
| 789 return TRUE; | 790 return TRUE; |
| 790 } else { | 791 } else { |
| 791 if (m_rgProposedContainerRecord.GetCount() > 0 && | 792 if (m_rgProposedContainerRecord.GetCount() > 0 && |
| 792 m_pCurrentContainerRecord == | 793 m_pCurrentContainerRecord == |
| 793 m_rgProposedContainerRecord.GetHeadPosition() && | 794 m_rgProposedContainerRecord.GetHeadPosition() && |
| 794 eType == XFA_ELEMENT_BreakBefore) { | 795 eType == XFA_Element::BreakBefore) { |
| 795 CXFA_Node* pParentNode = pFormNode->GetNodeItem( | 796 CXFA_Node* pParentNode = pFormNode->GetNodeItem( |
| 796 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); | 797 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); |
| 797 if (!pParentNode || | 798 if (!pParentNode || |
| 798 pFormNode != | 799 pFormNode != |
| 799 pParentNode->GetNodeItem(XFA_NODEITEM_FirstChild, | 800 pParentNode->GetNodeItem(XFA_NODEITEM_FirstChild, |
| 800 XFA_ObjectType::ContainerNode)) { | 801 XFA_ObjectType::ContainerNode)) { |
| 801 break; | 802 break; |
| 802 } | 803 } |
| 803 pParentNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); | 804 pParentNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 804 if (!pParentNode || pParentNode->GetClassID() != XFA_ELEMENT_Form) { | 805 if (!pParentNode || pParentNode->GetClassID() != XFA_Element::Form) { |
| 805 break; | 806 break; |
| 806 } | 807 } |
| 807 return TRUE; | 808 return TRUE; |
| 808 } | 809 } |
| 809 } | 810 } |
| 810 } break; | 811 } break; |
| 811 case XFA_ELEMENT_Break: { | 812 case XFA_Element::Break: { |
| 812 FX_BOOL bStartNew = pCurNode->GetInteger(XFA_ATTRIBUTE_StartNew) != 0; | 813 FX_BOOL bStartNew = pCurNode->GetInteger(XFA_ATTRIBUTE_StartNew) != 0; |
| 813 CFX_WideStringC wsTarget = pCurNode->GetCData( | 814 CFX_WideStringC wsTarget = pCurNode->GetCData( |
| 814 bBefore ? XFA_ATTRIBUTE_BeforeTarget : XFA_ATTRIBUTE_AfterTarget); | 815 bBefore ? XFA_ATTRIBUTE_BeforeTarget : XFA_ATTRIBUTE_AfterTarget); |
| 815 CXFA_Node* pTarget = | 816 CXFA_Node* pTarget = |
| 816 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsTarget); | 817 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsTarget); |
| 817 if (RunBreak(bBefore ? XFA_ELEMENT_BreakBefore : XFA_ELEMENT_BreakAfter, | 818 if (RunBreak(bBefore ? XFA_Element::BreakBefore : XFA_Element::BreakAfter, |
| 818 pCurNode->GetEnum(bBefore ? XFA_ATTRIBUTE_Before | 819 pCurNode->GetEnum(bBefore ? XFA_ATTRIBUTE_Before |
| 819 : XFA_ATTRIBUTE_After), | 820 : XFA_ATTRIBUTE_After), |
| 820 pTarget, bStartNew)) { | 821 pTarget, bStartNew)) { |
| 821 return TRUE; | 822 return TRUE; |
| 822 } | 823 } |
| 823 } break; | 824 } break; |
| 824 default: | 825 default: |
| 825 break; | 826 break; |
| 826 } | 827 } |
| 827 return FALSE; | 828 return FALSE; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 return FALSE; | 890 return FALSE; |
| 890 } | 891 } |
| 891 CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, | 892 CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, |
| 892 CXFA_Node*& pLeaderTemplate, | 893 CXFA_Node*& pLeaderTemplate, |
| 893 CXFA_Node*& pTrailerTemplate, | 894 CXFA_Node*& pTrailerTemplate, |
| 894 FX_BOOL bCreatePage) { | 895 FX_BOOL bCreatePage) { |
| 895 CXFA_Node* pContainer = | 896 CXFA_Node* pContainer = |
| 896 pOverflowNode | 897 pOverflowNode |
| 897 ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) | 898 ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) |
| 898 ->GetTemplateNode(); | 899 ->GetTemplateNode(); |
| 899 if (pOverflowNode->GetClassID() == XFA_ELEMENT_Break) { | 900 if (pOverflowNode->GetClassID() == XFA_Element::Break) { |
| 900 CFX_WideStringC wsOverflowLeader; | 901 CFX_WideStringC wsOverflowLeader; |
| 901 CFX_WideStringC wsOverflowTarget; | 902 CFX_WideStringC wsOverflowTarget; |
| 902 CFX_WideStringC wsOverflowTrailer; | 903 CFX_WideStringC wsOverflowTrailer; |
| 903 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); | 904 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); |
| 904 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); | 905 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); |
| 905 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); | 906 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); |
| 906 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || | 907 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || |
| 907 !wsOverflowTarget.IsEmpty()) { | 908 !wsOverflowTarget.IsEmpty()) { |
| 908 if (!wsOverflowTarget.IsEmpty() && bCreatePage && | 909 if (!wsOverflowTarget.IsEmpty() && bCreatePage && |
| 909 !m_bCreateOverFlowPage) { | 910 !m_bCreateOverFlowPage) { |
| 910 CXFA_Node* pTarget = | 911 CXFA_Node* pTarget = |
| 911 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); | 912 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); |
| 912 if (pTarget) { | 913 if (pTarget) { |
| 913 m_bCreateOverFlowPage = TRUE; | 914 m_bCreateOverFlowPage = TRUE; |
| 914 switch (pTarget->GetClassID()) { | 915 switch (pTarget->GetClassID()) { |
| 915 case XFA_ELEMENT_PageArea: | 916 case XFA_Element::PageArea: |
| 916 RunBreak(XFA_ELEMENT_Overflow, XFA_ATTRIBUTEENUM_PageArea, | 917 RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_PageArea, |
| 917 pTarget, TRUE); | 918 pTarget, TRUE); |
| 918 break; | 919 break; |
| 919 case XFA_ELEMENT_ContentArea: | 920 case XFA_Element::ContentArea: |
| 920 RunBreak(XFA_ELEMENT_Overflow, XFA_ATTRIBUTEENUM_ContentArea, | 921 RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_ContentArea, |
| 921 pTarget, TRUE); | 922 pTarget, TRUE); |
| 922 break; | 923 break; |
| 923 default: | 924 default: |
| 924 break; | 925 break; |
| 925 } | 926 } |
| 926 } | 927 } |
| 927 } | 928 } |
| 928 if (!bCreatePage) { | 929 if (!bCreatePage) { |
| 929 pLeaderTemplate = | 930 pLeaderTemplate = |
| 930 ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); | 931 ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); |
| 931 pTrailerTemplate = | 932 pTrailerTemplate = |
| 932 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); | 933 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); |
| 933 } | 934 } |
| 934 return pOverflowNode; | 935 return pOverflowNode; |
| 935 } | 936 } |
| 936 return NULL; | 937 return NULL; |
| 937 } else if (pOverflowNode->GetClassID() == XFA_ELEMENT_Overflow) { | 938 } else if (pOverflowNode->GetClassID() == XFA_Element::Overflow) { |
| 938 CFX_WideStringC wsOverflowLeader; | 939 CFX_WideStringC wsOverflowLeader; |
| 939 CFX_WideStringC wsOverflowTrailer; | 940 CFX_WideStringC wsOverflowTrailer; |
| 940 CFX_WideStringC wsOverflowTarget; | 941 CFX_WideStringC wsOverflowTarget; |
| 941 pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); | 942 pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); |
| 942 pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); | 943 pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); |
| 943 pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget); | 944 pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget); |
| 944 if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) { | 945 if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) { |
| 945 CXFA_Node* pTarget = | 946 CXFA_Node* pTarget = |
| 946 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); | 947 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); |
| 947 if (pTarget) { | 948 if (pTarget) { |
| 948 m_bCreateOverFlowPage = TRUE; | 949 m_bCreateOverFlowPage = TRUE; |
| 949 switch (pTarget->GetClassID()) { | 950 switch (pTarget->GetClassID()) { |
| 950 case XFA_ELEMENT_PageArea: | 951 case XFA_Element::PageArea: |
| 951 RunBreak(XFA_ELEMENT_Overflow, XFA_ATTRIBUTEENUM_PageArea, pTarget, | 952 RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_PageArea, pTarget, |
| 952 TRUE); | 953 TRUE); |
| 953 break; | 954 break; |
| 954 case XFA_ELEMENT_ContentArea: | 955 case XFA_Element::ContentArea: |
| 955 RunBreak(XFA_ELEMENT_Overflow, XFA_ATTRIBUTEENUM_ContentArea, | 956 RunBreak(XFA_Element::Overflow, XFA_ATTRIBUTEENUM_ContentArea, |
| 956 pTarget, TRUE); | 957 pTarget, TRUE); |
| 957 break; | 958 break; |
| 958 default: | 959 default: |
| 959 break; | 960 break; |
| 960 } | 961 } |
| 961 } | 962 } |
| 962 } | 963 } |
| 963 if (!bCreatePage) { | 964 if (!bCreatePage) { |
| 964 pLeaderTemplate = ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); | 965 pLeaderTemplate = ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); |
| 965 pTrailerTemplate = | 966 pTrailerTemplate = |
| 966 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); | 967 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); |
| 967 } | 968 } |
| 968 return pOverflowNode; | 969 return pOverflowNode; |
| 969 } | 970 } |
| 970 return nullptr; | 971 return nullptr; |
| 971 } | 972 } |
| 972 | 973 |
| 973 FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, | 974 FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, |
| 974 CXFA_Node*& pLeaderNode, | 975 CXFA_Node*& pLeaderNode, |
| 975 CXFA_Node*& pTrailerNode, | 976 CXFA_Node*& pTrailerNode, |
| 976 FX_BOOL bDataMerge, | 977 FX_BOOL bDataMerge, |
| 977 FX_BOOL bCreatePage) { | 978 FX_BOOL bCreatePage) { |
| 978 if (pFormNode == NULL) { | 979 if (pFormNode == NULL) { |
| 979 return FALSE; | 980 return FALSE; |
| 980 } | 981 } |
| 981 CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; | 982 CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; |
| 982 FX_BOOL bIsOverflowNode = FALSE; | 983 FX_BOOL bIsOverflowNode = FALSE; |
| 983 if (pFormNode->GetClassID() == XFA_ELEMENT_Overflow || | 984 if (pFormNode->GetClassID() == XFA_Element::Overflow || |
| 984 pFormNode->GetClassID() == XFA_ELEMENT_Break) { | 985 pFormNode->GetClassID() == XFA_Element::Break) { |
| 985 bIsOverflowNode = TRUE; | 986 bIsOverflowNode = TRUE; |
| 986 } | 987 } |
| 987 for (CXFA_Node* pCurNode = | 988 for (CXFA_Node* pCurNode = |
| 988 bIsOverflowNode ? pFormNode | 989 bIsOverflowNode ? pFormNode |
| 989 : pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 990 : pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 990 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { | 991 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { |
| 991 if (BreakOverflow(pCurNode, pLeaderTemplate, pTrailerTemplate, | 992 if (BreakOverflow(pCurNode, pLeaderTemplate, pTrailerTemplate, |
| 992 bCreatePage)) { | 993 bCreatePage)) { |
| 993 if (bIsOverflowNode) { | 994 if (bIsOverflowNode) { |
| 994 pFormNode = pCurNode->GetNodeItem(XFA_NODEITEM_Parent); | 995 pFormNode = pCurNode->GetNodeItem(XFA_NODEITEM_Parent); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1023 } | 1024 } |
| 1024 FX_BOOL CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( | 1025 FX_BOOL CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( |
| 1025 CXFA_Node* pBookendNode, | 1026 CXFA_Node* pBookendNode, |
| 1026 FX_BOOL bLeader, | 1027 FX_BOOL bLeader, |
| 1027 CXFA_Node*& pBookendAppendTemplate) { | 1028 CXFA_Node*& pBookendAppendTemplate) { |
| 1028 CFX_WideStringC wsBookendLeader; | 1029 CFX_WideStringC wsBookendLeader; |
| 1029 CXFA_Node* pContainer = | 1030 CXFA_Node* pContainer = |
| 1030 pBookendNode | 1031 pBookendNode |
| 1031 ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) | 1032 ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) |
| 1032 ->GetTemplateNode(); | 1033 ->GetTemplateNode(); |
| 1033 if (pBookendNode->GetClassID() == XFA_ELEMENT_Break) { | 1034 if (pBookendNode->GetClassID() == XFA_Element::Break) { |
| 1034 pBookendNode->TryCData( | 1035 pBookendNode->TryCData( |
| 1035 bLeader ? XFA_ATTRIBUTE_BookendLeader : XFA_ATTRIBUTE_BookendTrailer, | 1036 bLeader ? XFA_ATTRIBUTE_BookendLeader : XFA_ATTRIBUTE_BookendTrailer, |
| 1036 wsBookendLeader); | 1037 wsBookendLeader); |
| 1037 if (!wsBookendLeader.IsEmpty()) { | 1038 if (!wsBookendLeader.IsEmpty()) { |
| 1038 pBookendAppendTemplate = | 1039 pBookendAppendTemplate = |
| 1039 ResolveBreakTarget(pContainer, FALSE, wsBookendLeader); | 1040 ResolveBreakTarget(pContainer, FALSE, wsBookendLeader); |
| 1040 return TRUE; | 1041 return TRUE; |
| 1041 } | 1042 } |
| 1042 return FALSE; | 1043 return FALSE; |
| 1043 } else if (pBookendNode->GetClassID() == XFA_ELEMENT_Bookend) { | 1044 } else if (pBookendNode->GetClassID() == XFA_Element::Bookend) { |
| 1044 pBookendNode->TryCData( | 1045 pBookendNode->TryCData( |
| 1045 bLeader ? XFA_ATTRIBUTE_Leader : XFA_ATTRIBUTE_Trailer, | 1046 bLeader ? XFA_ATTRIBUTE_Leader : XFA_ATTRIBUTE_Trailer, |
| 1046 wsBookendLeader); | 1047 wsBookendLeader); |
| 1047 pBookendAppendTemplate = | 1048 pBookendAppendTemplate = |
| 1048 ResolveBreakTarget(pContainer, TRUE, wsBookendLeader); | 1049 ResolveBreakTarget(pContainer, TRUE, wsBookendLeader); |
| 1049 return TRUE; | 1050 return TRUE; |
| 1050 } | 1051 } |
| 1051 return FALSE; | 1052 return FALSE; |
| 1052 } | 1053 } |
| 1053 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet( | 1054 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1076 CXFA_Node* pPageSet, | 1077 CXFA_Node* pPageSet, |
| 1077 CXFA_Node* pStartChild, | 1078 CXFA_Node* pStartChild, |
| 1078 CXFA_Node* pTargetPageArea, | 1079 CXFA_Node* pTargetPageArea, |
| 1079 CXFA_Node* pTargetContentArea, | 1080 CXFA_Node* pTargetContentArea, |
| 1080 FX_BOOL bNewPage, | 1081 FX_BOOL bNewPage, |
| 1081 FX_BOOL bQuery) { | 1082 FX_BOOL bQuery) { |
| 1082 int32_t iPageSetCount = 0; | 1083 int32_t iPageSetCount = 0; |
| 1083 if (!pStartChild && !bQuery) { | 1084 if (!pStartChild && !bQuery) { |
| 1084 m_pPageSetMap.Lookup(pPageSet, iPageSetCount); | 1085 m_pPageSetMap.Lookup(pPageSet, iPageSetCount); |
| 1085 int32_t iMax = -1; | 1086 int32_t iMax = -1; |
| 1086 CXFA_Node* pOccurNode = pPageSet->GetFirstChildByClass(XFA_ELEMENT_Occur); | 1087 CXFA_Node* pOccurNode = pPageSet->GetFirstChildByClass(XFA_Element::Occur); |
| 1087 if (pOccurNode) { | 1088 if (pOccurNode) { |
| 1088 pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE); | 1089 pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE); |
| 1089 } | 1090 } |
| 1090 if (iMax >= 0 && iMax <= iPageSetCount) { | 1091 if (iMax >= 0 && iMax <= iPageSetCount) { |
| 1091 return FALSE; | 1092 return FALSE; |
| 1092 } | 1093 } |
| 1093 } | 1094 } |
| 1094 FX_BOOL bRes = FALSE; | 1095 FX_BOOL bRes = FALSE; |
| 1095 CXFA_Node* pCurrentNode = | 1096 CXFA_Node* pCurrentNode = |
| 1096 pStartChild ? pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling) | 1097 pStartChild ? pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling) |
| 1097 : pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); | 1098 : pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1098 for (; pCurrentNode; | 1099 for (; pCurrentNode; |
| 1099 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1100 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1100 if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageArea) { | 1101 if (pCurrentNode->GetClassID() == XFA_Element::PageArea) { |
| 1101 if ((pTargetPageArea == pCurrentNode || pTargetPageArea == NULL)) { | 1102 if ((pTargetPageArea == pCurrentNode || pTargetPageArea == NULL)) { |
| 1102 if (pCurrentNode->GetFirstChildByClass(XFA_ELEMENT_ContentArea) == | 1103 if (pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea) == |
| 1103 NULL) { | 1104 NULL) { |
| 1104 if (pTargetPageArea == pCurrentNode) { | 1105 if (pTargetPageArea == pCurrentNode) { |
| 1105 CreateMinPageRecord(pCurrentNode, TRUE); | 1106 CreateMinPageRecord(pCurrentNode, TRUE); |
| 1106 pTargetPageArea = NULL; | 1107 pTargetPageArea = NULL; |
| 1107 } | 1108 } |
| 1108 continue; | 1109 continue; |
| 1109 } | 1110 } |
| 1110 if (!bQuery) { | 1111 if (!bQuery) { |
| 1111 CXFA_ContainerRecord* pNewRecord = | 1112 CXFA_ContainerRecord* pNewRecord = |
| 1112 CreateContainerRecord(pCurrentNode, pStartChild == NULL); | 1113 CreateContainerRecord(pCurrentNode, pStartChild == NULL); |
| 1113 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 1114 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); |
| 1114 if (pTargetContentArea == NULL) { | 1115 if (pTargetContentArea == NULL) { |
| 1115 pTargetContentArea = | 1116 pTargetContentArea = |
| 1116 pCurrentNode->GetFirstChildByClass(XFA_ELEMENT_ContentArea); | 1117 pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea); |
| 1117 } | 1118 } |
| 1118 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); | 1119 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); |
| 1119 } | 1120 } |
| 1120 m_pCurPageArea = pCurrentNode; | 1121 m_pCurPageArea = pCurrentNode; |
| 1121 m_nCurPageCount = 1; | 1122 m_nCurPageCount = 1; |
| 1122 bRes = TRUE; | 1123 bRes = TRUE; |
| 1123 break; | 1124 break; |
| 1124 } | 1125 } |
| 1125 if (!bQuery) { | 1126 if (!bQuery) { |
| 1126 CreateMinPageRecord(pCurrentNode, FALSE); | 1127 CreateMinPageRecord(pCurrentNode, FALSE); |
| 1127 } | 1128 } |
| 1128 } else if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageSet) { | 1129 } else if (pCurrentNode->GetClassID() == XFA_Element::PageSet) { |
| 1129 if (FindPageAreaFromPageSet_Ordered(pCurrentNode, NULL, pTargetPageArea, | 1130 if (FindPageAreaFromPageSet_Ordered(pCurrentNode, NULL, pTargetPageArea, |
| 1130 pTargetContentArea, bNewPage, | 1131 pTargetContentArea, bNewPage, |
| 1131 bQuery)) { | 1132 bQuery)) { |
| 1132 bRes = TRUE; | 1133 bRes = TRUE; |
| 1133 break; | 1134 break; |
| 1134 } | 1135 } |
| 1135 if (!bQuery) { | 1136 if (!bQuery) { |
| 1136 CreateMinPageSetRecord(pCurrentNode, TRUE); | 1137 CreateMinPageSetRecord(pCurrentNode, TRUE); |
| 1137 } | 1138 } |
| 1138 } | 1139 } |
| 1139 } | 1140 } |
| 1140 if (!pStartChild && bRes && !bQuery) { | 1141 if (!pStartChild && bRes && !bQuery) { |
| 1141 m_pPageSetMap.SetAt(pPageSet, ++iPageSetCount); | 1142 m_pPageSetMap.SetAt(pPageSet, ++iPageSetCount); |
| 1142 } | 1143 } |
| 1143 return bRes; | 1144 return bRes; |
| 1144 } | 1145 } |
| 1145 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( | 1146 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( |
| 1146 CXFA_Node* pPageSet, | 1147 CXFA_Node* pPageSet, |
| 1147 CXFA_Node* pStartChild, | 1148 CXFA_Node* pStartChild, |
| 1148 CXFA_Node* pTargetPageArea, | 1149 CXFA_Node* pTargetPageArea, |
| 1149 CXFA_Node* pTargetContentArea, | 1150 CXFA_Node* pTargetContentArea, |
| 1150 FX_BOOL bNewPage, | 1151 FX_BOOL bNewPage, |
| 1151 FX_BOOL bQuery, | 1152 FX_BOOL bQuery, |
| 1152 XFA_ATTRIBUTEENUM ePreferredPosition) { | 1153 XFA_ATTRIBUTEENUM ePreferredPosition) { |
| 1153 const XFA_ATTRIBUTEENUM eFallbackPosition = XFA_ATTRIBUTEENUM_Any; | 1154 const XFA_ATTRIBUTEENUM eFallbackPosition = XFA_ATTRIBUTEENUM_Any; |
| 1154 CXFA_Node *pPreferredPageArea = NULL, *pFallbackPageArea = NULL; | 1155 CXFA_Node *pPreferredPageArea = NULL, *pFallbackPageArea = NULL; |
| 1155 CXFA_Node* pCurrentNode = NULL; | 1156 CXFA_Node* pCurrentNode = NULL; |
| 1156 if (!pStartChild || pStartChild->GetClassID() == XFA_ELEMENT_PageArea) { | 1157 if (!pStartChild || pStartChild->GetClassID() == XFA_Element::PageArea) { |
| 1157 pCurrentNode = pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); | 1158 pCurrentNode = pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1158 } else { | 1159 } else { |
| 1159 pCurrentNode = pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling); | 1160 pCurrentNode = pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 1160 } | 1161 } |
| 1161 for (; pCurrentNode; | 1162 for (; pCurrentNode; |
| 1162 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1163 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1163 if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageArea) { | 1164 if (pCurrentNode->GetClassID() == XFA_Element::PageArea) { |
| 1164 if (!MatchPageAreaOddOrEven(pCurrentNode, FALSE)) { | 1165 if (!MatchPageAreaOddOrEven(pCurrentNode, FALSE)) { |
| 1165 continue; | 1166 continue; |
| 1166 } | 1167 } |
| 1167 XFA_ATTRIBUTEENUM eCurPagePosition = | 1168 XFA_ATTRIBUTEENUM eCurPagePosition = |
| 1168 pCurrentNode->GetEnum(XFA_ATTRIBUTE_PagePosition); | 1169 pCurrentNode->GetEnum(XFA_ATTRIBUTE_PagePosition); |
| 1169 if (ePreferredPosition == XFA_ATTRIBUTEENUM_Last) { | 1170 if (ePreferredPosition == XFA_ATTRIBUTEENUM_Last) { |
| 1170 if (eCurPagePosition != ePreferredPosition) { | 1171 if (eCurPagePosition != ePreferredPosition) { |
| 1171 continue; | 1172 continue; |
| 1172 } | 1173 } |
| 1173 if (m_ePageSetMode == XFA_ATTRIBUTEENUM_SimplexPaginated || | 1174 if (m_ePageSetMode == XFA_ATTRIBUTEENUM_SimplexPaginated || |
| 1174 pCurrentNode->GetEnum(XFA_ATTRIBUTE_OddOrEven) == | 1175 pCurrentNode->GetEnum(XFA_ATTRIBUTE_OddOrEven) == |
| 1175 XFA_ATTRIBUTEENUM_Any) { | 1176 XFA_ATTRIBUTEENUM_Any) { |
| 1176 pPreferredPageArea = pCurrentNode; | 1177 pPreferredPageArea = pCurrentNode; |
| 1177 break; | 1178 break; |
| 1178 } | 1179 } |
| 1179 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1180 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); |
| 1180 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 1181 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); |
| 1181 AddContentAreaLayoutItem(pNewRecord, pCurrentNode->GetFirstChildByClass( | 1182 AddContentAreaLayoutItem(pNewRecord, pCurrentNode->GetFirstChildByClass( |
| 1182 XFA_ELEMENT_ContentArea)); | 1183 XFA_Element::ContentArea)); |
| 1183 pPreferredPageArea = pCurrentNode; | 1184 pPreferredPageArea = pCurrentNode; |
| 1184 return FALSE; | 1185 return FALSE; |
| 1185 } else if (ePreferredPosition == XFA_ATTRIBUTEENUM_Only) { | 1186 } else if (ePreferredPosition == XFA_ATTRIBUTEENUM_Only) { |
| 1186 if (eCurPagePosition != ePreferredPosition) { | 1187 if (eCurPagePosition != ePreferredPosition) { |
| 1187 continue; | 1188 continue; |
| 1188 } | 1189 } |
| 1189 if (m_ePageSetMode != XFA_ATTRIBUTEENUM_DuplexPaginated || | 1190 if (m_ePageSetMode != XFA_ATTRIBUTEENUM_DuplexPaginated || |
| 1190 pCurrentNode->GetEnum(XFA_ATTRIBUTE_OddOrEven) == | 1191 pCurrentNode->GetEnum(XFA_ATTRIBUTE_OddOrEven) == |
| 1191 XFA_ATTRIBUTEENUM_Any) { | 1192 XFA_ATTRIBUTEENUM_Any) { |
| 1192 pPreferredPageArea = pCurrentNode; | 1193 pPreferredPageArea = pCurrentNode; |
| 1193 break; | 1194 break; |
| 1194 } | 1195 } |
| 1195 return FALSE; | 1196 return FALSE; |
| 1196 } | 1197 } |
| 1197 if ((pTargetPageArea == pCurrentNode || pTargetPageArea == NULL)) { | 1198 if ((pTargetPageArea == pCurrentNode || pTargetPageArea == NULL)) { |
| 1198 if (pCurrentNode->GetFirstChildByClass(XFA_ELEMENT_ContentArea) == | 1199 if (pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea) == |
| 1199 NULL) { | 1200 NULL) { |
| 1200 if (pTargetPageArea == pCurrentNode) { | 1201 if (pTargetPageArea == pCurrentNode) { |
| 1201 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1202 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); |
| 1202 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 1203 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); |
| 1203 pTargetPageArea = NULL; | 1204 pTargetPageArea = NULL; |
| 1204 } | 1205 } |
| 1205 continue; | 1206 continue; |
| 1206 } | 1207 } |
| 1207 if ((ePreferredPosition == XFA_ATTRIBUTEENUM_Rest && | 1208 if ((ePreferredPosition == XFA_ATTRIBUTEENUM_Rest && |
| 1208 eCurPagePosition == XFA_ATTRIBUTEENUM_Any) || | 1209 eCurPagePosition == XFA_ATTRIBUTEENUM_Any) || |
| 1209 eCurPagePosition == ePreferredPosition) { | 1210 eCurPagePosition == ePreferredPosition) { |
| 1210 pPreferredPageArea = pCurrentNode; | 1211 pPreferredPageArea = pCurrentNode; |
| 1211 break; | 1212 break; |
| 1212 } else if (eCurPagePosition == eFallbackPosition && | 1213 } else if (eCurPagePosition == eFallbackPosition && |
| 1213 !pFallbackPageArea) { | 1214 !pFallbackPageArea) { |
| 1214 pFallbackPageArea = pCurrentNode; | 1215 pFallbackPageArea = pCurrentNode; |
| 1215 } | 1216 } |
| 1216 } else if (pTargetPageArea && | 1217 } else if (pTargetPageArea && |
| 1217 !MatchPageAreaOddOrEven(pTargetPageArea, FALSE)) { | 1218 !MatchPageAreaOddOrEven(pTargetPageArea, FALSE)) { |
| 1218 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1219 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); |
| 1219 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 1220 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); |
| 1220 AddContentAreaLayoutItem(pNewRecord, pCurrentNode->GetFirstChildByClass( | 1221 AddContentAreaLayoutItem(pNewRecord, pCurrentNode->GetFirstChildByClass( |
| 1221 XFA_ELEMENT_ContentArea)); | 1222 XFA_Element::ContentArea)); |
| 1222 } | 1223 } |
| 1223 } else if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageSet) { | 1224 } else if (pCurrentNode->GetClassID() == XFA_Element::PageSet) { |
| 1224 if (FindPageAreaFromPageSet_SimplexDuplex( | 1225 if (FindPageAreaFromPageSet_SimplexDuplex( |
| 1225 pCurrentNode, NULL, pTargetPageArea, pTargetContentArea, bNewPage, | 1226 pCurrentNode, NULL, pTargetPageArea, pTargetContentArea, bNewPage, |
| 1226 bQuery, ePreferredPosition)) { | 1227 bQuery, ePreferredPosition)) { |
| 1227 break; | 1228 break; |
| 1228 } | 1229 } |
| 1229 } | 1230 } |
| 1230 } | 1231 } |
| 1231 CXFA_Node* pCurPageArea = NULL; | 1232 CXFA_Node* pCurPageArea = NULL; |
| 1232 if (pPreferredPageArea) { | 1233 if (pPreferredPageArea) { |
| 1233 pCurPageArea = pPreferredPageArea; | 1234 pCurPageArea = pPreferredPageArea; |
| 1234 } else if (pFallbackPageArea) { | 1235 } else if (pFallbackPageArea) { |
| 1235 pCurPageArea = pFallbackPageArea; | 1236 pCurPageArea = pFallbackPageArea; |
| 1236 } | 1237 } |
| 1237 if (!pCurPageArea) { | 1238 if (!pCurPageArea) { |
| 1238 return FALSE; | 1239 return FALSE; |
| 1239 } | 1240 } |
| 1240 if (!bQuery) { | 1241 if (!bQuery) { |
| 1241 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1242 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); |
| 1242 AddPageAreaLayoutItem(pNewRecord, pCurPageArea); | 1243 AddPageAreaLayoutItem(pNewRecord, pCurPageArea); |
| 1243 if (pTargetContentArea == NULL) { | 1244 if (pTargetContentArea == NULL) { |
| 1244 pTargetContentArea = | 1245 pTargetContentArea = |
| 1245 pCurPageArea->GetFirstChildByClass(XFA_ELEMENT_ContentArea); | 1246 pCurPageArea->GetFirstChildByClass(XFA_Element::ContentArea); |
| 1246 } | 1247 } |
| 1247 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); | 1248 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); |
| 1248 } | 1249 } |
| 1249 m_pCurPageArea = pCurPageArea; | 1250 m_pCurPageArea = pCurPageArea; |
| 1250 return TRUE; | 1251 return TRUE; |
| 1251 } | 1252 } |
| 1252 FX_BOOL CXFA_LayoutPageMgr::MatchPageAreaOddOrEven(CXFA_Node* pPageArea, | 1253 FX_BOOL CXFA_LayoutPageMgr::MatchPageAreaOddOrEven(CXFA_Node* pPageArea, |
| 1253 FX_BOOL bLastMatch) { | 1254 FX_BOOL bLastMatch) { |
| 1254 if (m_ePageSetMode != XFA_ATTRIBUTEENUM_DuplexPaginated) { | 1255 if (m_ePageSetMode != XFA_ATTRIBUTEENUM_DuplexPaginated) { |
| 1255 return TRUE; | 1256 return TRUE; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1278 ASSERT(m_pCurPageArea); | 1279 ASSERT(m_pCurPageArea); |
| 1279 return m_pCurPageArea; | 1280 return m_pCurPageArea; |
| 1280 } | 1281 } |
| 1281 if (pTargetPageArea == NULL || pTargetPageArea == m_pCurPageArea) { | 1282 if (pTargetPageArea == NULL || pTargetPageArea == m_pCurPageArea) { |
| 1282 if (!bNewPage && GetNextContentArea(pTargetContentArea)) { | 1283 if (!bNewPage && GetNextContentArea(pTargetContentArea)) { |
| 1283 return m_pCurPageArea; | 1284 return m_pCurPageArea; |
| 1284 } | 1285 } |
| 1285 if (IsPageSetRootOrderedOccurrence()) { | 1286 if (IsPageSetRootOrderedOccurrence()) { |
| 1286 int32_t iMax = -1; | 1287 int32_t iMax = -1; |
| 1287 CXFA_Node* pOccurNode = | 1288 CXFA_Node* pOccurNode = |
| 1288 m_pCurPageArea->GetFirstChildByClass(XFA_ELEMENT_Occur); | 1289 m_pCurPageArea->GetFirstChildByClass(XFA_Element::Occur); |
| 1289 if (pOccurNode) { | 1290 if (pOccurNode) { |
| 1290 pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE); | 1291 pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE); |
| 1291 } | 1292 } |
| 1292 if ((iMax < 0 || m_nCurPageCount < iMax)) { | 1293 if ((iMax < 0 || m_nCurPageCount < iMax)) { |
| 1293 if (!bQuery) { | 1294 if (!bQuery) { |
| 1294 CXFA_ContainerRecord* pNewRecord = | 1295 CXFA_ContainerRecord* pNewRecord = |
| 1295 CreateContainerRecord(m_pCurPageArea); | 1296 CreateContainerRecord(m_pCurPageArea); |
| 1296 AddPageAreaLayoutItem(pNewRecord, m_pCurPageArea); | 1297 AddPageAreaLayoutItem(pNewRecord, m_pCurPageArea); |
| 1297 if (pTargetContentArea == NULL) { | 1298 if (pTargetContentArea == NULL) { |
| 1298 pTargetContentArea = | 1299 pTargetContentArea = |
| 1299 m_pCurPageArea->GetFirstChildByClass(XFA_ELEMENT_ContentArea); | 1300 m_pCurPageArea->GetFirstChildByClass(XFA_Element::ContentArea); |
| 1300 } | 1301 } |
| 1301 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); | 1302 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); |
| 1302 } | 1303 } |
| 1303 m_nCurPageCount++; | 1304 m_nCurPageCount++; |
| 1304 return m_pCurPageArea; | 1305 return m_pCurPageArea; |
| 1305 } | 1306 } |
| 1306 } | 1307 } |
| 1307 } | 1308 } |
| 1308 if (!bQuery && IsPageSetRootOrderedOccurrence()) { | 1309 if (!bQuery && IsPageSetRootOrderedOccurrence()) { |
| 1309 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); | 1310 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1332 pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent); | 1333 pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent); |
| 1333 } | 1334 } |
| 1334 return NULL; | 1335 return NULL; |
| 1335 } | 1336 } |
| 1336 | 1337 |
| 1337 FX_BOOL CXFA_LayoutPageMgr::GetNextContentArea(CXFA_Node* pContentArea) { | 1338 FX_BOOL CXFA_LayoutPageMgr::GetNextContentArea(CXFA_Node* pContentArea) { |
| 1338 CXFA_Node* pCurContentNode = | 1339 CXFA_Node* pCurContentNode = |
| 1339 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; | 1340 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; |
| 1340 if (pContentArea == NULL) { | 1341 if (pContentArea == NULL) { |
| 1341 pContentArea = | 1342 pContentArea = |
| 1342 pCurContentNode->GetNextSameClassSibling(XFA_ELEMENT_ContentArea); | 1343 pCurContentNode->GetNextSameClassSibling(XFA_Element::ContentArea); |
| 1343 if (pContentArea == NULL) { | 1344 if (pContentArea == NULL) { |
| 1344 return FALSE; | 1345 return FALSE; |
| 1345 } | 1346 } |
| 1346 } else { | 1347 } else { |
| 1347 if (pContentArea->GetNodeItem(XFA_NODEITEM_Parent) != m_pCurPageArea) { | 1348 if (pContentArea->GetNodeItem(XFA_NODEITEM_Parent) != m_pCurPageArea) { |
| 1348 return FALSE; | 1349 return FALSE; |
| 1349 } | 1350 } |
| 1350 CXFA_ContainerLayoutItem* pContentAreaLayout = NULL; | 1351 CXFA_ContainerLayoutItem* pContentAreaLayout = NULL; |
| 1351 if (!CheckContentAreaNotUsed(GetCurrentContainerRecord()->pCurPageArea, | 1352 if (!CheckContentAreaNotUsed(GetCurrentContainerRecord()->pCurPageArea, |
| 1352 pContentArea, pContentAreaLayout)) { | 1353 pContentArea, pContentAreaLayout)) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1366 AddContentAreaLayoutItem(pNewRecord, pContentArea); | 1367 AddContentAreaLayoutItem(pNewRecord, pContentArea); |
| 1367 return TRUE; | 1368 return TRUE; |
| 1368 } | 1369 } |
| 1369 void CXFA_LayoutPageMgr::InitPageSetMap() { | 1370 void CXFA_LayoutPageMgr::InitPageSetMap() { |
| 1370 if (!IsPageSetRootOrderedOccurrence()) { | 1371 if (!IsPageSetRootOrderedOccurrence()) { |
| 1371 return; | 1372 return; |
| 1372 } | 1373 } |
| 1373 CXFA_NodeIterator sIterator(m_pTemplatePageSetRoot); | 1374 CXFA_NodeIterator sIterator(m_pTemplatePageSetRoot); |
| 1374 for (CXFA_Node* pPageSetNode = sIterator.GetCurrent(); pPageSetNode; | 1375 for (CXFA_Node* pPageSetNode = sIterator.GetCurrent(); pPageSetNode; |
| 1375 pPageSetNode = sIterator.MoveToNext()) { | 1376 pPageSetNode = sIterator.MoveToNext()) { |
| 1376 if (pPageSetNode->GetClassID() == XFA_ELEMENT_PageSet) { | 1377 if (pPageSetNode->GetClassID() == XFA_Element::PageSet) { |
| 1377 XFA_ATTRIBUTEENUM eRelation = | 1378 XFA_ATTRIBUTEENUM eRelation = |
| 1378 pPageSetNode->GetEnum(XFA_ATTRIBUTE_Relation); | 1379 pPageSetNode->GetEnum(XFA_ATTRIBUTE_Relation); |
| 1379 if (eRelation == XFA_ATTRIBUTEENUM_OrderedOccurrence) { | 1380 if (eRelation == XFA_ATTRIBUTEENUM_OrderedOccurrence) { |
| 1380 m_pPageSetMap.SetAt(pPageSetNode, 0); | 1381 m_pPageSetMap.SetAt(pPageSetNode, 0); |
| 1381 } | 1382 } |
| 1382 } | 1383 } |
| 1383 } | 1384 } |
| 1384 } | 1385 } |
| 1385 int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea, | 1386 int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea, |
| 1386 FX_BOOL bTargetPageArea, | 1387 FX_BOOL bTargetPageArea, |
| 1387 FX_BOOL bCreateLast) { | 1388 FX_BOOL bCreateLast) { |
| 1388 if (pPageArea == NULL) { | 1389 if (pPageArea == NULL) { |
| 1389 return 0; | 1390 return 0; |
| 1390 } | 1391 } |
| 1391 CXFA_Node* pOccurNode = pPageArea->GetFirstChildByClass(XFA_ELEMENT_Occur); | 1392 CXFA_Node* pOccurNode = pPageArea->GetFirstChildByClass(XFA_Element::Occur); |
| 1392 int32_t iMin = 0; | 1393 int32_t iMin = 0; |
| 1393 if ((pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE)) || | 1394 if ((pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE)) || |
| 1394 bTargetPageArea) { | 1395 bTargetPageArea) { |
| 1395 CXFA_Node* pContentArea = | 1396 CXFA_Node* pContentArea = |
| 1396 pPageArea->GetFirstChildByClass(XFA_ELEMENT_ContentArea); | 1397 pPageArea->GetFirstChildByClass(XFA_Element::ContentArea); |
| 1397 if (iMin < 1 && bTargetPageArea && !pContentArea) { | 1398 if (iMin < 1 && bTargetPageArea && !pContentArea) { |
| 1398 iMin = 1; | 1399 iMin = 1; |
| 1399 } | 1400 } |
| 1400 int32_t i = 0; | 1401 int32_t i = 0; |
| 1401 if (bCreateLast) { | 1402 if (bCreateLast) { |
| 1402 i = m_nCurPageCount; | 1403 i = m_nCurPageCount; |
| 1403 } | 1404 } |
| 1404 for (; i < iMin; i++) { | 1405 for (; i < iMin; i++) { |
| 1405 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1406 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); |
| 1406 AddPageAreaLayoutItem(pNewRecord, pPageArea); | 1407 AddPageAreaLayoutItem(pNewRecord, pPageArea); |
| 1407 AddContentAreaLayoutItem(pNewRecord, pContentArea); | 1408 AddContentAreaLayoutItem(pNewRecord, pContentArea); |
| 1408 } | 1409 } |
| 1409 } | 1410 } |
| 1410 return iMin; | 1411 return iMin; |
| 1411 } | 1412 } |
| 1412 void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet, | 1413 void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet, |
| 1413 FX_BOOL bCreateAll) { | 1414 FX_BOOL bCreateAll) { |
| 1414 if (pPageSet == NULL) { | 1415 if (pPageSet == NULL) { |
| 1415 return; | 1416 return; |
| 1416 } | 1417 } |
| 1417 int32_t iCurSetCount = 0; | 1418 int32_t iCurSetCount = 0; |
| 1418 if (!m_pPageSetMap.Lookup(pPageSet, iCurSetCount)) { | 1419 if (!m_pPageSetMap.Lookup(pPageSet, iCurSetCount)) { |
| 1419 return; | 1420 return; |
| 1420 } | 1421 } |
| 1421 if (bCreateAll) { | 1422 if (bCreateAll) { |
| 1422 iCurSetCount = 0; | 1423 iCurSetCount = 0; |
| 1423 } | 1424 } |
| 1424 CXFA_Node* pOccurNode = pPageSet->GetFirstChildByClass(XFA_ELEMENT_Occur); | 1425 CXFA_Node* pOccurNode = pPageSet->GetFirstChildByClass(XFA_Element::Occur); |
| 1425 int32_t iMin = 0; | 1426 int32_t iMin = 0; |
| 1426 if (pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE)) { | 1427 if (pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE)) { |
| 1427 if (iCurSetCount < iMin) { | 1428 if (iCurSetCount < iMin) { |
| 1428 for (int32_t i = 0; i < iMin - iCurSetCount; i++) { | 1429 for (int32_t i = 0; i < iMin - iCurSetCount; i++) { |
| 1429 for (CXFA_Node* pCurrentPageNode = | 1430 for (CXFA_Node* pCurrentPageNode = |
| 1430 pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); | 1431 pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1431 pCurrentPageNode; pCurrentPageNode = pCurrentPageNode->GetNodeItem( | 1432 pCurrentPageNode; pCurrentPageNode = pCurrentPageNode->GetNodeItem( |
| 1432 XFA_NODEITEM_NextSibling)) { | 1433 XFA_NODEITEM_NextSibling)) { |
| 1433 if (pCurrentPageNode->GetClassID() == XFA_ELEMENT_PageArea) { | 1434 if (pCurrentPageNode->GetClassID() == XFA_Element::PageArea) { |
| 1434 CreateMinPageRecord(pCurrentPageNode, FALSE); | 1435 CreateMinPageRecord(pCurrentPageNode, FALSE); |
| 1435 } else if (pCurrentPageNode->GetClassID() == XFA_ELEMENT_PageSet) { | 1436 } else if (pCurrentPageNode->GetClassID() == XFA_Element::PageSet) { |
| 1436 CreateMinPageSetRecord(pCurrentPageNode, TRUE); | 1437 CreateMinPageSetRecord(pCurrentPageNode, TRUE); |
| 1437 } | 1438 } |
| 1438 } | 1439 } |
| 1439 } | 1440 } |
| 1440 m_pPageSetMap.SetAt(pPageSet, iMin); | 1441 m_pPageSetMap.SetAt(pPageSet, iMin); |
| 1441 } | 1442 } |
| 1442 } | 1443 } |
| 1443 } | 1444 } |
| 1444 void CXFA_LayoutPageMgr::CreateNextMinRecord(CXFA_Node* pRecordNode) { | 1445 void CXFA_LayoutPageMgr::CreateNextMinRecord(CXFA_Node* pRecordNode) { |
| 1445 if (pRecordNode == NULL) { | 1446 if (pRecordNode == NULL) { |
| 1446 return; | 1447 return; |
| 1447 } | 1448 } |
| 1448 for (CXFA_Node* pCurrentNode = | 1449 for (CXFA_Node* pCurrentNode = |
| 1449 pRecordNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 1450 pRecordNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 1450 pCurrentNode; | 1451 pCurrentNode; |
| 1451 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1452 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1452 if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageArea) { | 1453 if (pCurrentNode->GetClassID() == XFA_Element::PageArea) { |
| 1453 CreateMinPageRecord(pCurrentNode, FALSE); | 1454 CreateMinPageRecord(pCurrentNode, FALSE); |
| 1454 } else if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageSet) { | 1455 } else if (pCurrentNode->GetClassID() == XFA_Element::PageSet) { |
| 1455 CreateMinPageSetRecord(pCurrentNode, TRUE); | 1456 CreateMinPageSetRecord(pCurrentNode, TRUE); |
| 1456 } | 1457 } |
| 1457 } | 1458 } |
| 1458 } | 1459 } |
| 1459 void CXFA_LayoutPageMgr::ProcessLastPageSet() { | 1460 void CXFA_LayoutPageMgr::ProcessLastPageSet() { |
| 1460 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); | 1461 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); |
| 1461 CreateNextMinRecord(m_pCurPageArea); | 1462 CreateNextMinRecord(m_pCurPageArea); |
| 1462 CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent); | 1463 CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent); |
| 1463 while (TRUE) { | 1464 while (TRUE) { |
| 1464 CreateMinPageSetRecord(pPageSet); | 1465 CreateMinPageSetRecord(pPageSet); |
| 1465 if (pPageSet == m_pTemplatePageSetRoot) { | 1466 if (pPageSet == m_pTemplatePageSetRoot) { |
| 1466 break; | 1467 break; |
| 1467 } | 1468 } |
| 1468 CreateNextMinRecord(pPageSet); | 1469 CreateNextMinRecord(pPageSet); |
| 1469 pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent); | 1470 pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent); |
| 1470 } | 1471 } |
| 1471 } | 1472 } |
| 1472 FX_BOOL CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) { | 1473 FX_BOOL CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) { |
| 1473 CXFA_Node* pCurContentNode = | 1474 CXFA_Node* pCurContentNode = |
| 1474 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; | 1475 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; |
| 1475 if (pCurContentNode == NULL) { | 1476 if (pCurContentNode == NULL) { |
| 1476 return FALSE; | 1477 return FALSE; |
| 1477 } | 1478 } |
| 1478 pCurContentNode = | 1479 pCurContentNode = |
| 1479 pCurContentNode->GetNextSameClassSibling(XFA_ELEMENT_ContentArea); | 1480 pCurContentNode->GetNextSameClassSibling(XFA_Element::ContentArea); |
| 1480 if (pCurContentNode) { | 1481 if (pCurContentNode) { |
| 1481 FX_FLOAT fNextContentHeight = | 1482 FX_FLOAT fNextContentHeight = |
| 1482 pCurContentNode->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); | 1483 pCurContentNode->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); |
| 1483 return fNextContentHeight > fChildHeight; | 1484 return fNextContentHeight > fChildHeight; |
| 1484 } | 1485 } |
| 1485 CXFA_Node* pPageNode = GetCurrentContainerRecord()->pCurPageArea->m_pFormNode; | 1486 CXFA_Node* pPageNode = GetCurrentContainerRecord()->pCurPageArea->m_pFormNode; |
| 1486 CXFA_Node* pOccurNode = pPageNode->GetFirstChildByClass(XFA_ELEMENT_Occur); | 1487 CXFA_Node* pOccurNode = pPageNode->GetFirstChildByClass(XFA_Element::Occur); |
| 1487 int32_t iMax = 0; | 1488 int32_t iMax = 0; |
| 1488 if (pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE)) { | 1489 if (pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE)) { |
| 1489 if (m_nCurPageCount == iMax) { | 1490 if (m_nCurPageCount == iMax) { |
| 1490 CXFA_Node* pSrcPage = m_pCurPageArea; | 1491 CXFA_Node* pSrcPage = m_pCurPageArea; |
| 1491 int32_t nSrcPageCount = m_nCurPageCount; | 1492 int32_t nSrcPageCount = m_nCurPageCount; |
| 1492 FX_POSITION psSrcRecord = m_rgProposedContainerRecord.GetTailPosition(); | 1493 FX_POSITION psSrcRecord = m_rgProposedContainerRecord.GetTailPosition(); |
| 1493 CXFA_Node* pNextPage = GetNextAvailPageArea(NULL, NULL, FALSE, TRUE); | 1494 CXFA_Node* pNextPage = GetNextAvailPageArea(NULL, NULL, FALSE, TRUE); |
| 1494 m_pCurPageArea = pSrcPage; | 1495 m_pCurPageArea = pSrcPage; |
| 1495 m_nCurPageCount = nSrcPageCount; | 1496 m_nCurPageCount = nSrcPageCount; |
| 1496 CXFA_ContainerRecord* pPrevRecord = | 1497 CXFA_ContainerRecord* pPrevRecord = |
| 1497 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext( | 1498 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext( |
| 1498 psSrcRecord); | 1499 psSrcRecord); |
| 1499 while (psSrcRecord) { | 1500 while (psSrcRecord) { |
| 1500 FX_POSITION psSaveRecord = psSrcRecord; | 1501 FX_POSITION psSaveRecord = psSrcRecord; |
| 1501 CXFA_ContainerRecord* pInsertRecord = | 1502 CXFA_ContainerRecord* pInsertRecord = |
| 1502 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext( | 1503 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext( |
| 1503 psSrcRecord); | 1504 psSrcRecord); |
| 1504 RemoveLayoutRecord(pInsertRecord, pPrevRecord); | 1505 RemoveLayoutRecord(pInsertRecord, pPrevRecord); |
| 1505 delete pInsertRecord; | 1506 delete pInsertRecord; |
| 1506 m_rgProposedContainerRecord.RemoveAt(psSaveRecord); | 1507 m_rgProposedContainerRecord.RemoveAt(psSaveRecord); |
| 1507 } | 1508 } |
| 1508 if (pNextPage) { | 1509 if (pNextPage) { |
| 1509 CXFA_Node* pContentArea = | 1510 CXFA_Node* pContentArea = |
| 1510 pNextPage->GetFirstChildByClass(XFA_ELEMENT_ContentArea); | 1511 pNextPage->GetFirstChildByClass(XFA_Element::ContentArea); |
| 1511 if (pContentArea) { | 1512 if (pContentArea) { |
| 1512 FX_FLOAT fNextContentHeight = | 1513 FX_FLOAT fNextContentHeight = |
| 1513 pContentArea->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); | 1514 pContentArea->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); |
| 1514 if (fNextContentHeight > fChildHeight) { | 1515 if (fNextContentHeight > fChildHeight) { |
| 1515 return TRUE; | 1516 return TRUE; |
| 1516 } | 1517 } |
| 1517 } | 1518 } |
| 1518 } | 1519 } |
| 1519 return FALSE; | 1520 return FALSE; |
| 1520 } | 1521 } |
| 1521 } | 1522 } |
| 1522 CXFA_Node* pContentArea = | 1523 CXFA_Node* pContentArea = |
| 1523 pPageNode->GetFirstChildByClass(XFA_ELEMENT_ContentArea); | 1524 pPageNode->GetFirstChildByClass(XFA_Element::ContentArea); |
| 1524 FX_FLOAT fNextContentHeight = | 1525 FX_FLOAT fNextContentHeight = |
| 1525 pContentArea->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); | 1526 pContentArea->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); |
| 1526 if (fNextContentHeight < XFA_LAYOUT_FLOAT_PERCISION) { | 1527 if (fNextContentHeight < XFA_LAYOUT_FLOAT_PERCISION) { |
| 1527 return TRUE; | 1528 return TRUE; |
| 1528 } | 1529 } |
| 1529 if (fNextContentHeight > fChildHeight) { | 1530 if (fNextContentHeight > fChildHeight) { |
| 1530 return TRUE; | 1531 return TRUE; |
| 1531 } | 1532 } |
| 1532 return FALSE; | 1533 return FALSE; |
| 1533 } | 1534 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 } | 1589 } |
| 1589 } | 1590 } |
| 1590 } | 1591 } |
| 1591 if (pCurLayoutItem->m_pFirstChild) { | 1592 if (pCurLayoutItem->m_pFirstChild) { |
| 1592 SaveLayoutItem(pCurLayoutItem); | 1593 SaveLayoutItem(pCurLayoutItem); |
| 1593 } | 1594 } |
| 1594 pCurLayoutItem->m_pParent = NULL; | 1595 pCurLayoutItem->m_pParent = NULL; |
| 1595 pCurLayoutItem->m_pNextSibling = NULL; | 1596 pCurLayoutItem->m_pNextSibling = NULL; |
| 1596 pCurLayoutItem->m_pFirstChild = NULL; | 1597 pCurLayoutItem->m_pFirstChild = NULL; |
| 1597 if (!pCurLayoutItem->IsContentLayoutItem() && | 1598 if (!pCurLayoutItem->IsContentLayoutItem() && |
| 1598 pCurLayoutItem->m_pFormNode->GetClassID() != XFA_ELEMENT_PageArea) { | 1599 pCurLayoutItem->m_pFormNode->GetClassID() != XFA_Element::PageArea) { |
| 1599 delete pCurLayoutItem; | 1600 delete pCurLayoutItem; |
| 1600 } | 1601 } |
| 1601 pCurLayoutItem = pNextLayoutItem; | 1602 pCurLayoutItem = pNextLayoutItem; |
| 1602 } | 1603 } |
| 1603 } | 1604 } |
| 1604 CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( | 1605 CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( |
| 1605 CXFA_Node* pFormNode, | 1606 CXFA_Node* pFormNode, |
| 1606 CXFA_LayoutContext* pLayoutContext) { | 1607 CXFA_LayoutContext* pLayoutContext) { |
| 1607 for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 1608 for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1608 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { | 1609 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { |
| 1609 if (pCurNode->GetClassID() == XFA_ELEMENT_Break) { | 1610 if (pCurNode->GetClassID() == XFA_Element::Break) { |
| 1610 CFX_WideStringC wsOverflowLeader; | 1611 CFX_WideStringC wsOverflowLeader; |
| 1611 CFX_WideStringC wsOverflowTarget; | 1612 CFX_WideStringC wsOverflowTarget; |
| 1612 CFX_WideStringC wsOverflowTrailer; | 1613 CFX_WideStringC wsOverflowTrailer; |
| 1613 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); | 1614 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); |
| 1614 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); | 1615 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); |
| 1615 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); | 1616 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); |
| 1616 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || | 1617 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || |
| 1617 !wsOverflowTarget.IsEmpty()) { | 1618 !wsOverflowTarget.IsEmpty()) { |
| 1618 return pCurNode; | 1619 return pCurNode; |
| 1619 } | 1620 } |
| 1620 return NULL; | 1621 return NULL; |
| 1621 } else if (pCurNode->GetClassID() == XFA_ELEMENT_Overflow) { | 1622 } else if (pCurNode->GetClassID() == XFA_Element::Overflow) { |
| 1622 return pCurNode; | 1623 return pCurNode; |
| 1623 } | 1624 } |
| 1624 } | 1625 } |
| 1625 return NULL; | 1626 return NULL; |
| 1626 } | 1627 } |
| 1627 | 1628 |
| 1628 void CXFA_LayoutPageMgr::MergePageSetContents() { | 1629 void CXFA_LayoutPageMgr::MergePageSetContents() { |
| 1629 CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument(); | 1630 CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument(); |
| 1630 CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); | 1631 CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); |
| 1631 CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout(); | 1632 CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1651 int32_t iIndex = 0; | 1652 int32_t iIndex = 0; |
| 1652 for (; pRootLayout; | 1653 for (; pRootLayout; |
| 1653 pRootLayout = (CXFA_ContainerLayoutItem*)pRootLayout->m_pNextSibling) { | 1654 pRootLayout = (CXFA_ContainerLayoutItem*)pRootLayout->m_pNextSibling) { |
| 1654 CXFA_Node* pPendingPageSet = nullptr; | 1655 CXFA_Node* pPendingPageSet = nullptr; |
| 1655 CXFA_NodeIteratorTemplate< | 1656 CXFA_NodeIteratorTemplate< |
| 1656 CXFA_ContainerLayoutItem, | 1657 CXFA_ContainerLayoutItem, |
| 1657 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> | 1658 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> |
| 1658 iterator(pRootLayout); | 1659 iterator(pRootLayout); |
| 1659 CXFA_ContainerLayoutItem* pRootPageSetContainerItem = iterator.GetCurrent(); | 1660 CXFA_ContainerLayoutItem* pRootPageSetContainerItem = iterator.GetCurrent(); |
| 1660 ASSERT(pRootPageSetContainerItem->m_pFormNode->GetClassID() == | 1661 ASSERT(pRootPageSetContainerItem->m_pFormNode->GetClassID() == |
| 1661 XFA_ELEMENT_PageSet); | 1662 XFA_Element::PageSet); |
| 1662 if (iIndex < pDocument->m_pPendingPageSet.GetSize()) { | 1663 if (iIndex < pDocument->m_pPendingPageSet.GetSize()) { |
| 1663 pPendingPageSet = pDocument->m_pPendingPageSet.GetAt(iIndex); | 1664 pPendingPageSet = pDocument->m_pPendingPageSet.GetAt(iIndex); |
| 1664 iIndex++; | 1665 iIndex++; |
| 1665 } | 1666 } |
| 1666 if (!pPendingPageSet) { | 1667 if (!pPendingPageSet) { |
| 1667 if (pRootPageSetContainerItem->m_pFormNode->GetPacketID() == | 1668 if (pRootPageSetContainerItem->m_pFormNode->GetPacketID() == |
| 1668 XFA_XDPPACKET_Template) { | 1669 XFA_XDPPACKET_Template) { |
| 1669 pPendingPageSet = | 1670 pPendingPageSet = |
| 1670 pRootPageSetContainerItem->m_pFormNode->CloneTemplateToForm(FALSE); | 1671 pRootPageSetContainerItem->m_pFormNode->CloneTemplateToForm(FALSE); |
| 1671 } else { | 1672 } else { |
| 1672 pPendingPageSet = pRootPageSetContainerItem->m_pFormNode; | 1673 pPendingPageSet = pRootPageSetContainerItem->m_pFormNode; |
| 1673 } | 1674 } |
| 1674 } | 1675 } |
| 1675 if (pRootPageSetContainerItem->m_pFormNode->GetUserData( | 1676 if (pRootPageSetContainerItem->m_pFormNode->GetUserData( |
| 1676 XFA_LAYOUTITEMKEY) == pRootPageSetContainerItem) { | 1677 XFA_LAYOUTITEMKEY) == pRootPageSetContainerItem) { |
| 1677 pRootPageSetContainerItem->m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, | 1678 pRootPageSetContainerItem->m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, |
| 1678 NULL); | 1679 NULL); |
| 1679 } | 1680 } |
| 1680 pRootPageSetContainerItem->m_pFormNode = pPendingPageSet; | 1681 pRootPageSetContainerItem->m_pFormNode = pPendingPageSet; |
| 1681 pPendingPageSet->ClearFlag(XFA_NodeFlag_UnusedNode); | 1682 pPendingPageSet->ClearFlag(XFA_NodeFlag_UnusedNode); |
| 1682 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.MoveToNext(); | 1683 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.MoveToNext(); |
| 1683 pContainerItem; pContainerItem = iterator.MoveToNext()) { | 1684 pContainerItem; pContainerItem = iterator.MoveToNext()) { |
| 1684 CXFA_Node* pNode = pContainerItem->m_pFormNode; | 1685 CXFA_Node* pNode = pContainerItem->m_pFormNode; |
| 1685 if (pNode->GetPacketID() != XFA_XDPPACKET_Template) { | 1686 if (pNode->GetPacketID() != XFA_XDPPACKET_Template) { |
| 1686 continue; | 1687 continue; |
| 1687 } | 1688 } |
| 1688 switch (pNode->GetClassID()) { | 1689 switch (pNode->GetClassID()) { |
| 1689 case XFA_ELEMENT_PageSet: { | 1690 case XFA_Element::PageSet: { |
| 1690 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; | 1691 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; |
| 1691 pContainerItem->m_pFormNode = XFA_NodeMerge_CloneOrMergeContainer( | 1692 pContainerItem->m_pFormNode = XFA_NodeMerge_CloneOrMergeContainer( |
| 1692 pDocument, pParentNode, pContainerItem->m_pFormNode, TRUE); | 1693 pDocument, pParentNode, pContainerItem->m_pFormNode, TRUE); |
| 1693 } break; | 1694 } break; |
| 1694 case XFA_ELEMENT_PageArea: { | 1695 case XFA_Element::PageArea: { |
| 1695 CXFA_ContainerLayoutItem* pFormLayout = pContainerItem; | 1696 CXFA_ContainerLayoutItem* pFormLayout = pContainerItem; |
| 1696 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; | 1697 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; |
| 1697 FX_BOOL bIsExistForm = TRUE; | 1698 FX_BOOL bIsExistForm = TRUE; |
| 1698 for (int32_t iLevel = 0; iLevel < 3; iLevel++) { | 1699 for (int32_t iLevel = 0; iLevel < 3; iLevel++) { |
| 1699 pFormLayout = (CXFA_ContainerLayoutItem*)pFormLayout->m_pFirstChild; | 1700 pFormLayout = (CXFA_ContainerLayoutItem*)pFormLayout->m_pFirstChild; |
| 1700 if (iLevel == 2) { | 1701 if (iLevel == 2) { |
| 1701 while (pFormLayout && | 1702 while (pFormLayout && |
| 1702 !XFA_ItemLayoutProcessor_IsTakingSpace( | 1703 !XFA_ItemLayoutProcessor_IsTakingSpace( |
| 1703 pFormLayout->m_pFormNode)) { | 1704 pFormLayout->m_pFormNode)) { |
| 1704 pFormLayout = | 1705 pFormLayout = |
| 1705 (CXFA_ContainerLayoutItem*)pFormLayout->m_pNextSibling; | 1706 (CXFA_ContainerLayoutItem*)pFormLayout->m_pNextSibling; |
| 1706 } | 1707 } |
| 1707 } | 1708 } |
| 1708 if (pFormLayout == NULL) { | 1709 if (pFormLayout == NULL) { |
| 1709 bIsExistForm = FALSE; | 1710 bIsExistForm = FALSE; |
| 1710 break; | 1711 break; |
| 1711 } | 1712 } |
| 1712 } | 1713 } |
| 1713 if (bIsExistForm) { | 1714 if (bIsExistForm) { |
| 1714 CXFA_Node* pNewSubform = pFormLayout->m_pFormNode; | 1715 CXFA_Node* pNewSubform = pFormLayout->m_pFormNode; |
| 1715 if (pContainerItem->m_pOldSubform && | 1716 if (pContainerItem->m_pOldSubform && |
| 1716 pContainerItem->m_pOldSubform != pNewSubform) { | 1717 pContainerItem->m_pOldSubform != pNewSubform) { |
| 1717 CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( | 1718 CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( |
| 1718 pDocument, pContainerItem->m_pFormNode->GetClassID(), | 1719 pDocument, pContainerItem->m_pFormNode->GetClassID(), |
| 1719 pContainerItem->m_pFormNode->GetNameHash(), pParentNode); | 1720 pContainerItem->m_pFormNode->GetNameHash(), pParentNode); |
| 1720 CXFA_ContainerIterator sIterator(pExistingNode); | 1721 CXFA_ContainerIterator sIterator(pExistingNode); |
| 1721 for (CXFA_Node* pIter = sIterator.GetCurrent(); pIter; | 1722 for (CXFA_Node* pIter = sIterator.GetCurrent(); pIter; |
| 1722 pIter = sIterator.MoveToNext()) { | 1723 pIter = sIterator.MoveToNext()) { |
| 1723 if (pIter->GetClassID() != XFA_ELEMENT_ContentArea) { | 1724 if (pIter->GetClassID() != XFA_Element::ContentArea) { |
| 1724 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( | 1725 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( |
| 1725 pIter->GetUserData(XFA_LAYOUTITEMKEY)); | 1726 pIter->GetUserData(XFA_LAYOUTITEMKEY)); |
| 1726 if (pLayoutItem) { | 1727 if (pLayoutItem) { |
| 1727 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); | 1728 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); |
| 1728 delete pLayoutItem; | 1729 delete pLayoutItem; |
| 1729 } | 1730 } |
| 1730 } | 1731 } |
| 1731 } | 1732 } |
| 1732 if (pExistingNode) { | 1733 if (pExistingNode) { |
| 1733 pParentNode->RemoveChild(pExistingNode); | 1734 pParentNode->RemoveChild(pExistingNode); |
| 1734 } | 1735 } |
| 1735 } | 1736 } |
| 1736 pContainerItem->m_pOldSubform = pNewSubform; | 1737 pContainerItem->m_pOldSubform = pNewSubform; |
| 1737 } | 1738 } |
| 1738 pContainerItem->m_pFormNode = pDocument->DataMerge_CopyContainer( | 1739 pContainerItem->m_pFormNode = pDocument->DataMerge_CopyContainer( |
| 1739 pContainerItem->m_pFormNode, pParentNode, | 1740 pContainerItem->m_pFormNode, pParentNode, |
| 1740 ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record)), TRUE); | 1741 ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record)), TRUE); |
| 1741 } break; | 1742 } break; |
| 1742 case XFA_ELEMENT_ContentArea: { | 1743 case XFA_Element::ContentArea: { |
| 1743 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; | 1744 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; |
| 1744 for (CXFA_Node* pChildNode = | 1745 for (CXFA_Node* pChildNode = |
| 1745 pParentNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 1746 pParentNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1746 pChildNode; | 1747 pChildNode; |
| 1747 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1748 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1748 if (pChildNode->GetTemplateNode() != pContainerItem->m_pFormNode) { | 1749 if (pChildNode->GetTemplateNode() != pContainerItem->m_pFormNode) { |
| 1749 continue; | 1750 continue; |
| 1750 } | 1751 } |
| 1751 pContainerItem->m_pFormNode = pChildNode; | 1752 pContainerItem->m_pFormNode = pChildNode; |
| 1752 break; | 1753 break; |
| 1753 } | 1754 } |
| 1754 } break; | 1755 } break; |
| 1755 default: | 1756 default: |
| 1756 break; | 1757 break; |
| 1757 } | 1758 } |
| 1758 } | 1759 } |
| 1759 if (!pPendingPageSet->GetNodeItem(XFA_NODEITEM_Parent)) { | 1760 if (!pPendingPageSet->GetNodeItem(XFA_NODEITEM_Parent)) { |
| 1760 CXFA_Node* pFormToplevelSubform = | 1761 CXFA_Node* pFormToplevelSubform = |
| 1761 pDocument->GetXFAObject(XFA_HASHCODE_Form) | 1762 pDocument->GetXFAObject(XFA_HASHCODE_Form) |
| 1762 ->AsNode() | 1763 ->AsNode() |
| 1763 ->GetFirstChildByClass(XFA_ELEMENT_Subform); | 1764 ->GetFirstChildByClass(XFA_Element::Subform); |
| 1764 pFormToplevelSubform->InsertChild(pPendingPageSet); | 1765 pFormToplevelSubform->InsertChild(pPendingPageSet); |
| 1765 } | 1766 } |
| 1766 pDocument->DataMerge_UpdateBindingRelations(pPendingPageSet); | 1767 pDocument->DataMerge_UpdateBindingRelations(pPendingPageSet); |
| 1767 pPendingPageSet->SetFlag(XFA_NodeFlag_Initialized, true); | 1768 pPendingPageSet->SetFlag(XFA_NodeFlag_Initialized, true); |
| 1768 } | 1769 } |
| 1769 CXFA_Node* pPageSet = GetRootLayoutItem()->m_pFormNode; | 1770 CXFA_Node* pPageSet = GetRootLayoutItem()->m_pFormNode; |
| 1770 while (pPageSet) { | 1771 while (pPageSet) { |
| 1771 CXFA_Node* pNextPageSet = | 1772 CXFA_Node* pNextPageSet = |
| 1772 pPageSet->GetNextSameClassSibling(XFA_ELEMENT_PageSet); | 1773 pPageSet->GetNextSameClassSibling(XFA_Element::PageSet); |
| 1773 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> | 1774 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> |
| 1774 sIterator(pPageSet); | 1775 sIterator(pPageSet); |
| 1775 CXFA_Node* pNode = sIterator.GetCurrent(); | 1776 CXFA_Node* pNode = sIterator.GetCurrent(); |
| 1776 while (pNode) { | 1777 while (pNode) { |
| 1777 if (pNode->IsUnusedNode()) { | 1778 if (pNode->IsUnusedNode()) { |
| 1778 if (pNode->IsContainerNode()) { | 1779 if (pNode->IsContainerNode()) { |
| 1779 XFA_ELEMENT eCurId = pNode->GetClassID(); | 1780 XFA_Element eCurId = pNode->GetClassID(); |
| 1780 if (eCurId == XFA_ELEMENT_PageArea || eCurId == XFA_ELEMENT_PageSet) { | 1781 if (eCurId == XFA_Element::PageArea || |
| 1782 eCurId == XFA_Element::PageSet) { |
| 1781 CXFA_ContainerIterator iteChild(pNode); | 1783 CXFA_ContainerIterator iteChild(pNode); |
| 1782 CXFA_Node* pChildNode = iteChild.MoveToNext(); | 1784 CXFA_Node* pChildNode = iteChild.MoveToNext(); |
| 1783 for (; pChildNode; pChildNode = iteChild.MoveToNext()) { | 1785 for (; pChildNode; pChildNode = iteChild.MoveToNext()) { |
| 1784 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( | 1786 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( |
| 1785 pChildNode->GetUserData(XFA_LAYOUTITEMKEY)); | 1787 pChildNode->GetUserData(XFA_LAYOUTITEMKEY)); |
| 1786 if (pLayoutItem) { | 1788 if (pLayoutItem) { |
| 1787 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); | 1789 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); |
| 1788 delete pLayoutItem; | 1790 delete pLayoutItem; |
| 1789 } | 1791 } |
| 1790 } | 1792 } |
| 1791 } else if (eCurId != XFA_ELEMENT_ContentArea) { | 1793 } else if (eCurId != XFA_Element::ContentArea) { |
| 1792 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( | 1794 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( |
| 1793 pNode->GetUserData(XFA_LAYOUTITEMKEY)); | 1795 pNode->GetUserData(XFA_LAYOUTITEMKEY)); |
| 1794 if (pLayoutItem) { | 1796 if (pLayoutItem) { |
| 1795 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); | 1797 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); |
| 1796 delete pLayoutItem; | 1798 delete pLayoutItem; |
| 1797 } | 1799 } |
| 1798 } | 1800 } |
| 1799 CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext(); | 1801 CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext(); |
| 1800 pNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pNode); | 1802 pNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pNode); |
| 1801 pNode = pNext; | 1803 pNode = pNext; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1819 pRootLayoutItem = | 1821 pRootLayoutItem = |
| 1820 (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling) { | 1822 (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling) { |
| 1821 CXFA_NodeIteratorTemplate< | 1823 CXFA_NodeIteratorTemplate< |
| 1822 CXFA_ContainerLayoutItem, | 1824 CXFA_ContainerLayoutItem, |
| 1823 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> | 1825 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> |
| 1824 iterator(pRootLayoutItem); | 1826 iterator(pRootLayoutItem); |
| 1825 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.GetCurrent(); | 1827 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.GetCurrent(); |
| 1826 pContainerItem; pContainerItem = iterator.MoveToNext()) { | 1828 pContainerItem; pContainerItem = iterator.MoveToNext()) { |
| 1827 CXFA_Node* pNode = pContainerItem->m_pFormNode; | 1829 CXFA_Node* pNode = pContainerItem->m_pFormNode; |
| 1828 switch (pNode->GetClassID()) { | 1830 switch (pNode->GetClassID()) { |
| 1829 case XFA_ELEMENT_PageArea: | 1831 case XFA_Element::PageArea: |
| 1830 m_pLayoutProcessor->GetRootRootItemLayoutProcessor() | 1832 m_pLayoutProcessor->GetRootRootItemLayoutProcessor() |
| 1831 ->DoLayoutPageArea(pContainerItem); | 1833 ->DoLayoutPageArea(pContainerItem); |
| 1832 break; | 1834 break; |
| 1833 default: | 1835 default: |
| 1834 break; | 1836 break; |
| 1835 } | 1837 } |
| 1836 } | 1838 } |
| 1837 } | 1839 } |
| 1838 } | 1840 } |
| 1839 | 1841 |
| 1840 void CXFA_LayoutPageMgr::SyncLayoutData() { | 1842 void CXFA_LayoutPageMgr::SyncLayoutData() { |
| 1841 MergePageSetContents(); | 1843 MergePageSetContents(); |
| 1842 LayoutPageSetContents(); | 1844 LayoutPageSetContents(); |
| 1843 CXFA_FFNotify* pNotify = | 1845 CXFA_FFNotify* pNotify = |
| 1844 m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); | 1846 m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); |
| 1845 int32_t nPageIdx = -1; | 1847 int32_t nPageIdx = -1; |
| 1846 CXFA_ContainerLayoutItem* pRootLayoutItem = GetRootLayoutItem(); | 1848 CXFA_ContainerLayoutItem* pRootLayoutItem = GetRootLayoutItem(); |
| 1847 for (; pRootLayoutItem; | 1849 for (; pRootLayoutItem; |
| 1848 pRootLayoutItem = | 1850 pRootLayoutItem = |
| 1849 (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling) { | 1851 (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling) { |
| 1850 CXFA_NodeIteratorTemplate< | 1852 CXFA_NodeIteratorTemplate< |
| 1851 CXFA_ContainerLayoutItem, | 1853 CXFA_ContainerLayoutItem, |
| 1852 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> | 1854 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> |
| 1853 iteratorParent(pRootLayoutItem); | 1855 iteratorParent(pRootLayoutItem); |
| 1854 for (CXFA_ContainerLayoutItem* pContainerItem = iteratorParent.GetCurrent(); | 1856 for (CXFA_ContainerLayoutItem* pContainerItem = iteratorParent.GetCurrent(); |
| 1855 pContainerItem; pContainerItem = iteratorParent.MoveToNext()) { | 1857 pContainerItem; pContainerItem = iteratorParent.MoveToNext()) { |
| 1856 switch (pContainerItem->m_pFormNode->GetClassID()) { | 1858 switch (pContainerItem->m_pFormNode->GetClassID()) { |
| 1857 case XFA_ELEMENT_PageArea: { | 1859 case XFA_Element::PageArea: { |
| 1858 nPageIdx++; | 1860 nPageIdx++; |
| 1859 uint32_t dwRelevant = | 1861 uint32_t dwRelevant = |
| 1860 XFA_WidgetStatus_Viewable | XFA_WidgetStatus_Printable; | 1862 XFA_WidgetStatus_Viewable | XFA_WidgetStatus_Printable; |
| 1861 CXFA_NodeIteratorTemplate<CXFA_LayoutItem, | 1863 CXFA_NodeIteratorTemplate<CXFA_LayoutItem, |
| 1862 CXFA_TraverseStrategy_LayoutItem> | 1864 CXFA_TraverseStrategy_LayoutItem> |
| 1863 iterator(pContainerItem); | 1865 iterator(pContainerItem); |
| 1864 CXFA_LayoutItem* pChildLayoutItem = iterator.GetCurrent(); | 1866 CXFA_LayoutItem* pChildLayoutItem = iterator.GetCurrent(); |
| 1865 while (pChildLayoutItem) { | 1867 while (pChildLayoutItem) { |
| 1866 CXFA_ContentLayoutItem* pContentItem = | 1868 CXFA_ContentLayoutItem* pContentItem = |
| 1867 pChildLayoutItem->AsContentLayoutItem(); | 1869 pChildLayoutItem->AsContentLayoutItem(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1894 ClearRecordList(); | 1896 ClearRecordList(); |
| 1895 } | 1897 } |
| 1896 void XFA_ReleaseLayoutItem_NoPageArea(CXFA_LayoutItem* pLayoutItem) { | 1898 void XFA_ReleaseLayoutItem_NoPageArea(CXFA_LayoutItem* pLayoutItem) { |
| 1897 CXFA_LayoutItem *pNext, *pNode = pLayoutItem->m_pFirstChild; | 1899 CXFA_LayoutItem *pNext, *pNode = pLayoutItem->m_pFirstChild; |
| 1898 while (pNode) { | 1900 while (pNode) { |
| 1899 pNext = pNode->m_pNextSibling; | 1901 pNext = pNode->m_pNextSibling; |
| 1900 pNode->m_pParent = NULL; | 1902 pNode->m_pParent = NULL; |
| 1901 XFA_ReleaseLayoutItem_NoPageArea(pNode); | 1903 XFA_ReleaseLayoutItem_NoPageArea(pNode); |
| 1902 pNode = pNext; | 1904 pNode = pNext; |
| 1903 } | 1905 } |
| 1904 if (pLayoutItem->m_pFormNode->GetClassID() != XFA_ELEMENT_PageArea) { | 1906 if (pLayoutItem->m_pFormNode->GetClassID() != XFA_Element::PageArea) { |
| 1905 delete pLayoutItem; | 1907 delete pLayoutItem; |
| 1906 } | 1908 } |
| 1907 } | 1909 } |
| 1908 void CXFA_LayoutPageMgr::PrepareLayout() { | 1910 void CXFA_LayoutPageMgr::PrepareLayout() { |
| 1909 m_pPageSetCurRoot = NULL; | 1911 m_pPageSetCurRoot = NULL; |
| 1910 m_ePageSetMode = XFA_ATTRIBUTEENUM_OrderedOccurrence; | 1912 m_ePageSetMode = XFA_ATTRIBUTEENUM_OrderedOccurrence; |
| 1911 m_nAvailPages = 0; | 1913 m_nAvailPages = 0; |
| 1912 ClearRecordList(); | 1914 ClearRecordList(); |
| 1913 if (!m_pPageSetLayoutItemRoot) { | 1915 if (!m_pPageSetLayoutItemRoot) { |
| 1914 return; | 1916 return; |
| 1915 } | 1917 } |
| 1916 CXFA_ContainerLayoutItem* pRootLayoutItem = m_pPageSetLayoutItemRoot; | 1918 CXFA_ContainerLayoutItem* pRootLayoutItem = m_pPageSetLayoutItemRoot; |
| 1917 if (pRootLayoutItem && | 1919 if (pRootLayoutItem && |
| 1918 pRootLayoutItem->m_pFormNode->GetPacketID() == XFA_XDPPACKET_Form) { | 1920 pRootLayoutItem->m_pFormNode->GetPacketID() == XFA_XDPPACKET_Form) { |
| 1919 CXFA_Node* pPageSetFormNode = pRootLayoutItem->m_pFormNode; | 1921 CXFA_Node* pPageSetFormNode = pRootLayoutItem->m_pFormNode; |
| 1920 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.RemoveAll(); | 1922 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.RemoveAll(); |
| 1921 if (pPageSetFormNode->HasRemovedChildren()) { | 1923 if (pPageSetFormNode->HasRemovedChildren()) { |
| 1922 XFA_ReleaseLayoutItem(pRootLayoutItem); | 1924 XFA_ReleaseLayoutItem(pRootLayoutItem); |
| 1923 m_pPageSetLayoutItemRoot = NULL; | 1925 m_pPageSetLayoutItemRoot = NULL; |
| 1924 pRootLayoutItem = NULL; | 1926 pRootLayoutItem = NULL; |
| 1925 pPageSetFormNode = NULL; | 1927 pPageSetFormNode = NULL; |
| 1926 m_PageArray.RemoveAll(); | 1928 m_PageArray.RemoveAll(); |
| 1927 } | 1929 } |
| 1928 while (pPageSetFormNode) { | 1930 while (pPageSetFormNode) { |
| 1929 CXFA_Node* pNextPageSet = | 1931 CXFA_Node* pNextPageSet = |
| 1930 pPageSetFormNode->GetNextSameClassSibling(XFA_ELEMENT_PageSet); | 1932 pPageSetFormNode->GetNextSameClassSibling(XFA_Element::PageSet); |
| 1931 pPageSetFormNode->GetNodeItem(XFA_NODEITEM_Parent) | 1933 pPageSetFormNode->GetNodeItem(XFA_NODEITEM_Parent) |
| 1932 ->RemoveChild(pPageSetFormNode, FALSE); | 1934 ->RemoveChild(pPageSetFormNode, FALSE); |
| 1933 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.Add( | 1935 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.Add( |
| 1934 pPageSetFormNode); | 1936 pPageSetFormNode); |
| 1935 pPageSetFormNode = pNextPageSet; | 1937 pPageSetFormNode = pNextPageSet; |
| 1936 } | 1938 } |
| 1937 } | 1939 } |
| 1938 pRootLayoutItem = m_pPageSetLayoutItemRoot; | 1940 pRootLayoutItem = m_pPageSetLayoutItemRoot; |
| 1939 CXFA_ContainerLayoutItem* pNextLayout = NULL; | 1941 CXFA_ContainerLayoutItem* pNextLayout = NULL; |
| 1940 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { | 1942 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { |
| 1941 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; | 1943 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; |
| 1942 SaveLayoutItem(pRootLayoutItem); | 1944 SaveLayoutItem(pRootLayoutItem); |
| 1943 delete pRootLayoutItem; | 1945 delete pRootLayoutItem; |
| 1944 } | 1946 } |
| 1945 m_pPageSetLayoutItemRoot = NULL; | 1947 m_pPageSetLayoutItemRoot = NULL; |
| 1946 } | 1948 } |
| OLD | NEW |