 Chromium Code Reviews
 Chromium Code Reviews Issue 2095653002:
  Remove NULL in xfa/  (Closed) 
  Base URL: https://pdfium.googlesource.com/pdfium.git@master
    
  
    Issue 2095653002:
  Remove NULL in xfa/  (Closed) 
  Base URL: https://pdfium.googlesource.com/pdfium.git@master| 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" | 
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 | 185 | 
| 186 FX_BOOL CheckContentAreaNotUsed( | 186 FX_BOOL CheckContentAreaNotUsed( | 
| 187 CXFA_ContainerLayoutItem* pPageAreaLayoutItem, | 187 CXFA_ContainerLayoutItem* pPageAreaLayoutItem, | 
| 188 CXFA_Node* pContentArea, | 188 CXFA_Node* pContentArea, | 
| 189 CXFA_ContainerLayoutItem*& pContentAreaLayoutItem) { | 189 CXFA_ContainerLayoutItem*& pContentAreaLayoutItem) { | 
| 190 for (CXFA_ContainerLayoutItem* pLayoutItem = | 190 for (CXFA_ContainerLayoutItem* pLayoutItem = | 
| 191 (CXFA_ContainerLayoutItem*)pPageAreaLayoutItem->m_pFirstChild; | 191 (CXFA_ContainerLayoutItem*)pPageAreaLayoutItem->m_pFirstChild; | 
| 192 pLayoutItem; | 192 pLayoutItem; | 
| 193 pLayoutItem = (CXFA_ContainerLayoutItem*)pLayoutItem->m_pNextSibling) { | 193 pLayoutItem = (CXFA_ContainerLayoutItem*)pLayoutItem->m_pNextSibling) { | 
| 194 if (pLayoutItem->m_pFormNode == pContentArea) { | 194 if (pLayoutItem->m_pFormNode == pContentArea) { | 
| 195 if (pLayoutItem->m_pFirstChild == NULL) { | 195 if (!pLayoutItem->m_pFirstChild) { | 
| 196 pContentAreaLayoutItem = pLayoutItem; | 196 pContentAreaLayoutItem = pLayoutItem; | 
| 197 return TRUE; | 197 return TRUE; | 
| 198 } | 198 } | 
| 199 return FALSE; | 199 return FALSE; | 
| 200 } | 200 } | 
| 201 } | 201 } | 
| 202 return TRUE; | 202 return TRUE; | 
| 203 } | 203 } | 
| 204 | 204 | 
| 205 void SyncRemoveLayoutItem(CXFA_LayoutItem* pParentLayoutItem, | 205 void SyncRemoveLayoutItem(CXFA_LayoutItem* pParentLayoutItem, | 
| (...skipping 21 matching lines...) Expand all Loading... | |
| 227 m_pPageSetCurRoot(nullptr), | 227 m_pPageSetCurRoot(nullptr), | 
| 228 m_pCurrentContainerRecord(nullptr), | 228 m_pCurrentContainerRecord(nullptr), | 
| 229 m_pCurPageArea(nullptr), | 229 m_pCurPageArea(nullptr), | 
| 230 m_nAvailPages(0), | 230 m_nAvailPages(0), | 
| 231 m_nCurPageCount(0), | 231 m_nCurPageCount(0), | 
| 232 m_ePageSetMode(XFA_ATTRIBUTEENUM_OrderedOccurrence), | 232 m_ePageSetMode(XFA_ATTRIBUTEENUM_OrderedOccurrence), | 
| 233 m_bCreateOverFlowPage(FALSE) {} | 233 m_bCreateOverFlowPage(FALSE) {} | 
| 234 CXFA_LayoutPageMgr::~CXFA_LayoutPageMgr() { | 234 CXFA_LayoutPageMgr::~CXFA_LayoutPageMgr() { | 
| 235 ClearData(); | 235 ClearData(); | 
| 236 CXFA_LayoutItem* pLayoutItem = GetRootLayoutItem(); | 236 CXFA_LayoutItem* pLayoutItem = GetRootLayoutItem(); | 
| 237 CXFA_LayoutItem* pNextLayout = NULL; | 237 CXFA_LayoutItem* pNextLayout = nullptr; | 
| 238 for (; pLayoutItem; pLayoutItem = pNextLayout) { | 238 for (; pLayoutItem; pLayoutItem = pNextLayout) { | 
| 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 = nullptr; | 
| 253 m_pPageSetLayoutItemRoot->m_pFirstChild = NULL; | 253 m_pPageSetLayoutItemRoot->m_pFirstChild = nullptr; | 
| 254 m_pPageSetLayoutItemRoot->m_pNextSibling = NULL; | 254 m_pPageSetLayoutItemRoot->m_pNextSibling = nullptr; | 
| 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 = nullptr; | 
| 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->GetElementType() == XFA_Element::PageArea) { | 274 if (pPageArea->GetElementType() == 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, nullptr); | 
| 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, nullptr); | 
| 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, nullptr); | 
| 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 = nullptr; | 
| 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->GetElementType(); | 338 XFA_Element eType = pBreakNode->GetElementType(); | 
| 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)) { | 
| (...skipping 19 matching lines...) Expand all Loading... | |
| 362 m_pCurrentContainerRecord = m_rgProposedContainerRecord.GetHeadPosition(); | 362 m_pCurrentContainerRecord = m_rgProposedContainerRecord.GetHeadPosition(); | 
| 363 return TRUE; | 363 return TRUE; | 
| 364 } | 364 } | 
| 365 return AppendNewPage(TRUE); | 365 return AppendNewPage(TRUE); | 
| 366 } | 366 } | 
| 367 FX_BOOL CXFA_LayoutPageMgr::AppendNewPage(FX_BOOL bFirstTemPage) { | 367 FX_BOOL CXFA_LayoutPageMgr::AppendNewPage(FX_BOOL bFirstTemPage) { | 
| 368 if (m_pCurrentContainerRecord != | 368 if (m_pCurrentContainerRecord != | 
| 369 m_rgProposedContainerRecord.GetTailPosition()) { | 369 m_rgProposedContainerRecord.GetTailPosition()) { | 
| 370 return TRUE; | 370 return TRUE; | 
| 371 } | 371 } | 
| 372 CXFA_Node* pPageNode = GetNextAvailPageArea(NULL); | 372 CXFA_Node* pPageNode = GetNextAvailPageArea(nullptr); | 
| 373 if (!pPageNode) { | 373 if (!pPageNode) { | 
| 374 return FALSE; | 374 return FALSE; | 
| 375 } | 375 } | 
| 376 if (bFirstTemPage && m_pCurrentContainerRecord == NULL) { | 376 if (bFirstTemPage && !m_pCurrentContainerRecord) { | 
| 377 m_pCurrentContainerRecord = m_rgProposedContainerRecord.GetHeadPosition(); | 377 m_pCurrentContainerRecord = m_rgProposedContainerRecord.GetHeadPosition(); | 
| 378 } | 378 } | 
| 379 return !bFirstTemPage || m_pCurrentContainerRecord; | 379 return !bFirstTemPage || m_pCurrentContainerRecord; | 
| 380 } | 380 } | 
| 381 | 381 | 
| 382 void CXFA_LayoutPageMgr::RemoveLayoutRecord(CXFA_ContainerRecord* pNewRecord, | 382 void CXFA_LayoutPageMgr::RemoveLayoutRecord(CXFA_ContainerRecord* pNewRecord, | 
| 383 CXFA_ContainerRecord* pPrevRecord) { | 383 CXFA_ContainerRecord* pPrevRecord) { | 
| 384 if (!pNewRecord || !pPrevRecord) { | 384 if (!pNewRecord || !pPrevRecord) { | 
| 385 return; | 385 return; | 
| 386 } | 386 } | 
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 } | 457 } | 
| 458 return pTestScript->GetDocument()->GetParser()->GetNotify()->RunScript( | 458 return pTestScript->GetDocument()->GetParser()->GetNotify()->RunScript( | 
| 459 pTestScript, pTestScript->GetNodeItem(XFA_NODEITEM_Parent, | 459 pTestScript, pTestScript->GetNodeItem(XFA_NODEITEM_Parent, | 
| 460 XFA_ObjectType::ContainerNode)); | 460 XFA_ObjectType::ContainerNode)); | 
| 461 } | 461 } | 
| 462 CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( | 462 CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( | 
| 463 CXFA_Node* pPageNode, | 463 CXFA_Node* pPageNode, | 
| 464 FX_BOOL bCreateNew) { | 464 FX_BOOL bCreateNew) { | 
| 465 CXFA_ContainerRecord* pNewRecord = new CXFA_ContainerRecord(); | 465 CXFA_ContainerRecord* pNewRecord = new CXFA_ContainerRecord(); | 
| 466 if (m_pCurrentContainerRecord) { | 466 if (m_pCurrentContainerRecord) { | 
| 467 if (!IsPageSetRootOrderedOccurrence() || pPageNode == NULL) { | 467 if (!IsPageSetRootOrderedOccurrence() || !pPageNode) { | 
| 468 *pNewRecord = *GetCurrentContainerRecord(); | 468 *pNewRecord = *GetCurrentContainerRecord(); | 
| 469 m_rgProposedContainerRecord.AddTail(pNewRecord); | 469 m_rgProposedContainerRecord.AddTail(pNewRecord); | 
| 470 return pNewRecord; | 470 return pNewRecord; | 
| 471 } | 471 } | 
| 472 CXFA_Node* pPageSet = pPageNode->GetNodeItem(XFA_NODEITEM_Parent); | 472 CXFA_Node* pPageSet = pPageNode->GetNodeItem(XFA_NODEITEM_Parent); | 
| 473 if (!bCreateNew) { | 473 if (!bCreateNew) { | 
| 474 if (pPageSet == m_pTemplatePageSetRoot) { | 474 if (pPageSet == m_pTemplatePageSetRoot) { | 
| 475 pNewRecord->pCurPageSet = m_pPageSetCurRoot; | 475 pNewRecord->pCurPageSet = m_pPageSetCurRoot; | 
| 476 } else { | 476 } else { | 
| 477 CXFA_ContainerLayoutItem* pParentLayoutItem = | 477 CXFA_ContainerLayoutItem* pParentLayoutItem = | 
| 478 (CXFA_ContainerLayoutItem*)pPageSet->GetUserData(XFA_LAYOUTITEMKEY); | 478 (CXFA_ContainerLayoutItem*)pPageSet->GetUserData(XFA_LAYOUTITEMKEY); | 
| 479 if (pParentLayoutItem == NULL) { | 479 if (!pParentLayoutItem) { | 
| 480 pParentLayoutItem = m_pPageSetCurRoot; | 480 pParentLayoutItem = m_pPageSetCurRoot; | 
| 481 } | 481 } | 
| 482 pNewRecord->pCurPageSet = pParentLayoutItem; | 482 pNewRecord->pCurPageSet = pParentLayoutItem; | 
| 483 } | 483 } | 
| 484 } else { | 484 } else { | 
| 485 CXFA_ContainerLayoutItem* pParentPageSetLayout = NULL; | 485 CXFA_ContainerLayoutItem* pParentPageSetLayout = nullptr; | 
| 486 if (pPageSet == GetCurrentContainerRecord()->pCurPageSet->m_pFormNode) { | 486 if (pPageSet == GetCurrentContainerRecord()->pCurPageSet->m_pFormNode) { | 
| 487 pParentPageSetLayout = | 487 pParentPageSetLayout = | 
| 488 (CXFA_ContainerLayoutItem*)GetCurrentContainerRecord() | 488 (CXFA_ContainerLayoutItem*)GetCurrentContainerRecord() | 
| 489 ->pCurPageSet->m_pParent; | 489 ->pCurPageSet->m_pParent; | 
| 490 } else { | 490 } else { | 
| 491 pParentPageSetLayout = | 491 pParentPageSetLayout = | 
| 492 (CXFA_ContainerLayoutItem*)pPageSet->GetNodeItem( | 492 (CXFA_ContainerLayoutItem*)pPageSet->GetNodeItem( | 
| 493 XFA_NODEITEM_Parent) | 493 XFA_NODEITEM_Parent) | 
| 494 ->GetUserData(XFA_LAYOUTITEMKEY); | 494 ->GetUserData(XFA_LAYOUTITEMKEY); | 
| 495 } | 495 } | 
| 496 CXFA_ContainerLayoutItem* pPageSetLayoutItem = | 496 CXFA_ContainerLayoutItem* pPageSetLayoutItem = | 
| 497 new CXFA_ContainerLayoutItem(pPageSet); | 497 new CXFA_ContainerLayoutItem(pPageSet); | 
| 498 pPageSet->SetUserData(XFA_LAYOUTITEMKEY, (void*)pPageSetLayoutItem); | 498 pPageSet->SetUserData(XFA_LAYOUTITEMKEY, (void*)pPageSetLayoutItem); | 
| 499 if (pParentPageSetLayout == NULL) { | 499 if (!pParentPageSetLayout) { | 
| 500 CXFA_ContainerLayoutItem* pPrePageSet = m_pPageSetLayoutItemRoot; | 500 CXFA_ContainerLayoutItem* pPrePageSet = m_pPageSetLayoutItemRoot; | 
| 501 while (pPrePageSet->m_pNextSibling) { | 501 while (pPrePageSet->m_pNextSibling) { | 
| 502 pPrePageSet = (CXFA_ContainerLayoutItem*)pPrePageSet->m_pNextSibling; | 502 pPrePageSet = (CXFA_ContainerLayoutItem*)pPrePageSet->m_pNextSibling; | 
| 503 } | 503 } | 
| 504 pPrePageSet->m_pNextSibling = pPageSetLayoutItem; | 504 pPrePageSet->m_pNextSibling = pPageSetLayoutItem; | 
| 505 m_pPageSetCurRoot = pPageSetLayoutItem; | 505 m_pPageSetCurRoot = pPageSetLayoutItem; | 
| 506 } else { | 506 } else { | 
| 507 pParentPageSetLayout->AddChild(pPageSetLayoutItem); | 507 pParentPageSetLayout->AddChild(pPageSetLayoutItem); | 
| 508 } | 508 } | 
| 509 pNewRecord->pCurPageSet = pPageSetLayoutItem; | 509 pNewRecord->pCurPageSet = pPageSetLayoutItem; | 
| (...skipping 12 matching lines...) Expand all Loading... | |
| 522 } | 522 } | 
| 523 } else { | 523 } else { | 
| 524 pNewRecord->pCurPageSet = m_pPageSetLayoutItemRoot; | 524 pNewRecord->pCurPageSet = m_pPageSetLayoutItemRoot; | 
| 525 } | 525 } | 
| 526 } | 526 } | 
| 527 m_rgProposedContainerRecord.AddTail(pNewRecord); | 527 m_rgProposedContainerRecord.AddTail(pNewRecord); | 
| 528 return pNewRecord; | 528 return pNewRecord; | 
| 529 } | 529 } | 
| 530 void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, | 530 void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, | 
| 531 CXFA_Node* pNewPageArea) { | 531 CXFA_Node* pNewPageArea) { | 
| 532 CXFA_ContainerLayoutItem* pNewPageAreaLayoutItem = NULL; | 532 CXFA_ContainerLayoutItem* pNewPageAreaLayoutItem = nullptr; | 
| 533 if (m_PageArray.GetSize() > m_nAvailPages) { | 533 if (m_PageArray.GetSize() > m_nAvailPages) { | 
| 534 CXFA_ContainerLayoutItem* pContainerItem = m_PageArray[m_nAvailPages]; | 534 CXFA_ContainerLayoutItem* pContainerItem = m_PageArray[m_nAvailPages]; | 
| 535 pContainerItem->m_pFormNode = pNewPageArea; | 535 pContainerItem->m_pFormNode = pNewPageArea; | 
| 536 m_nAvailPages++; | 536 m_nAvailPages++; | 
| 537 pNewPageAreaLayoutItem = pContainerItem; | 537 pNewPageAreaLayoutItem = pContainerItem; | 
| 538 } else { | 538 } else { | 
| 539 CXFA_FFNotify* pNotify = | 539 CXFA_FFNotify* pNotify = | 
| 540 pNewPageArea->GetDocument()->GetParser()->GetNotify(); | 540 pNewPageArea->GetDocument()->GetParser()->GetNotify(); | 
| 541 CXFA_ContainerLayoutItem* pContainerItem = | 541 CXFA_ContainerLayoutItem* pContainerItem = | 
| 542 (CXFA_ContainerLayoutItem*)pNotify->OnCreateLayoutItem(pNewPageArea); | 542 (CXFA_ContainerLayoutItem*)pNotify->OnCreateLayoutItem(pNewPageArea); | 
| 543 m_PageArray.Add(pContainerItem); | 543 m_PageArray.Add(pContainerItem); | 
| 544 m_nAvailPages++; | 544 m_nAvailPages++; | 
| 545 pNotify->OnPageEvent(pContainerItem, XFA_PAGEVIEWEVENT_PostRemoved); | 545 pNotify->OnPageEvent(pContainerItem, XFA_PAGEVIEWEVENT_PostRemoved); | 
| 546 pNewPageAreaLayoutItem = pContainerItem; | 546 pNewPageAreaLayoutItem = pContainerItem; | 
| 547 } | 547 } | 
| 548 pNewRecord->pCurPageSet->AddChild(pNewPageAreaLayoutItem); | 548 pNewRecord->pCurPageSet->AddChild(pNewPageAreaLayoutItem); | 
| 549 pNewRecord->pCurPageArea = pNewPageAreaLayoutItem; | 549 pNewRecord->pCurPageArea = pNewPageAreaLayoutItem; | 
| 550 pNewRecord->pCurContentArea = NULL; | 550 pNewRecord->pCurContentArea = nullptr; | 
| 551 } | 551 } | 
| 552 void CXFA_LayoutPageMgr::AddContentAreaLayoutItem( | 552 void CXFA_LayoutPageMgr::AddContentAreaLayoutItem( | 
| 553 CXFA_ContainerRecord* pNewRecord, | 553 CXFA_ContainerRecord* pNewRecord, | 
| 554 CXFA_Node* pContentArea) { | 554 CXFA_Node* pContentArea) { | 
| 555 if (pContentArea == NULL) { | 555 if (!pContentArea) { | 
| 556 pNewRecord->pCurContentArea = NULL; | 556 pNewRecord->pCurContentArea = nullptr; | 
| 557 return; | 557 return; | 
| 558 } | 558 } | 
| 559 CXFA_ContainerLayoutItem* pNewContentAreaLayoutItem = | 559 CXFA_ContainerLayoutItem* pNewContentAreaLayoutItem = | 
| 560 new CXFA_ContainerLayoutItem(pContentArea); | 560 new CXFA_ContainerLayoutItem(pContentArea); | 
| 561 ASSERT(pNewRecord->pCurPageArea); | 561 ASSERT(pNewRecord->pCurPageArea); | 
| 562 pNewRecord->pCurPageArea->AddChild(pNewContentAreaLayoutItem); | 562 pNewRecord->pCurPageArea->AddChild(pNewContentAreaLayoutItem); | 
| 563 pNewRecord->pCurContentArea = pNewContentAreaLayoutItem; | 563 pNewRecord->pCurContentArea = pNewContentAreaLayoutItem; | 
| 564 } | 564 } | 
| 565 | 565 | 
| 566 void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { | 566 void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { | 
| 567 CXFA_ContainerLayoutItem* pRootPageSetLayoutItem = m_pPageSetLayoutItemRoot; | 567 CXFA_ContainerLayoutItem* pRootPageSetLayoutItem = m_pPageSetLayoutItemRoot; | 
| 568 for (; pRootPageSetLayoutItem; | 568 for (; pRootPageSetLayoutItem; | 
| 569 pRootPageSetLayoutItem = | 569 pRootPageSetLayoutItem = | 
| 570 (CXFA_ContainerLayoutItem*)pRootPageSetLayoutItem->m_pNextSibling) { | 570 (CXFA_ContainerLayoutItem*)pRootPageSetLayoutItem->m_pNextSibling) { | 
| 571 CXFA_NodeIteratorTemplate<CXFA_ContainerLayoutItem, | 571 CXFA_NodeIteratorTemplate<CXFA_ContainerLayoutItem, | 
| 572 PageSetContainerLayoutItem> | 572 PageSetContainerLayoutItem> | 
| 573 sIterator(pRootPageSetLayoutItem); | 573 sIterator(pRootPageSetLayoutItem); | 
| 574 for (CXFA_ContainerLayoutItem* pPageSetLayoutItem = sIterator.GetCurrent(); | 574 for (CXFA_ContainerLayoutItem* pPageSetLayoutItem = sIterator.GetCurrent(); | 
| 575 pPageSetLayoutItem; pPageSetLayoutItem = sIterator.MoveToNext()) { | 575 pPageSetLayoutItem; pPageSetLayoutItem = sIterator.MoveToNext()) { | 
| 576 XFA_ATTRIBUTEENUM ePageRelation = | 576 XFA_ATTRIBUTEENUM ePageRelation = | 
| 577 pPageSetLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Relation); | 577 pPageSetLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Relation); | 
| 578 switch (ePageRelation) { | 578 switch (ePageRelation) { | 
| 579 case XFA_ATTRIBUTEENUM_OrderedOccurrence: | 579 case XFA_ATTRIBUTEENUM_OrderedOccurrence: | 
| 580 default: { ProcessLastPageSet(); } break; | 580 default: { ProcessLastPageSet(); } break; | 
| 581 case XFA_ATTRIBUTEENUM_SimplexPaginated: | 581 case XFA_ATTRIBUTEENUM_SimplexPaginated: | 
| 582 case XFA_ATTRIBUTEENUM_DuplexPaginated: { | 582 case XFA_ATTRIBUTEENUM_DuplexPaginated: { | 
| 583 CXFA_LayoutItem* pLastPageAreaLayoutItem = NULL; | 583 CXFA_LayoutItem* pLastPageAreaLayoutItem = nullptr; | 
| 584 int32_t nPageAreaCount = 0; | 584 int32_t nPageAreaCount = 0; | 
| 585 for (CXFA_LayoutItem* pPageAreaLayoutItem = | 585 for (CXFA_LayoutItem* pPageAreaLayoutItem = | 
| 586 pPageSetLayoutItem->m_pFirstChild; | 586 pPageSetLayoutItem->m_pFirstChild; | 
| 587 pPageAreaLayoutItem; | 587 pPageAreaLayoutItem; | 
| 588 pPageAreaLayoutItem = pPageAreaLayoutItem->m_pNextSibling) { | 588 pPageAreaLayoutItem = pPageAreaLayoutItem->m_pNextSibling) { | 
| 589 if (pPageAreaLayoutItem->m_pFormNode->GetElementType() != | 589 if (pPageAreaLayoutItem->m_pFormNode->GetElementType() != | 
| 590 XFA_Element::PageArea) { | 590 XFA_Element::PageArea) { | 
| 591 continue; | 591 continue; | 
| 592 } | 592 } | 
| 593 nPageAreaCount++; | 593 nPageAreaCount++; | 
| 594 pLastPageAreaLayoutItem = pPageAreaLayoutItem; | 594 pLastPageAreaLayoutItem = pPageAreaLayoutItem; | 
| 595 } | 595 } | 
| 596 if (!pLastPageAreaLayoutItem) { | 596 if (!pLastPageAreaLayoutItem) { | 
| 597 break; | 597 break; | 
| 598 } | 598 } | 
| 599 if (!FindPageAreaFromPageSet_SimplexDuplex( | 599 if (!FindPageAreaFromPageSet_SimplexDuplex( | 
| 600 pPageSetLayoutItem->m_pFormNode, NULL, NULL, NULL, TRUE, TRUE, | 600 pPageSetLayoutItem->m_pFormNode, nullptr, nullptr, nullptr, | 
| 601 nPageAreaCount == 1 ? XFA_ATTRIBUTEENUM_Only | 601 TRUE, TRUE, nPageAreaCount == 1 ? XFA_ATTRIBUTEENUM_Only | 
| 602 : XFA_ATTRIBUTEENUM_Last) && | 602 : XFA_ATTRIBUTEENUM_Last) && | 
| 603 (nPageAreaCount == 1 && | 603 (nPageAreaCount == 1 && | 
| 604 !FindPageAreaFromPageSet_SimplexDuplex( | 604 !FindPageAreaFromPageSet_SimplexDuplex( | 
| 605 pPageSetLayoutItem->m_pFormNode, NULL, NULL, NULL, TRUE, | 605 pPageSetLayoutItem->m_pFormNode, nullptr, nullptr, nullptr, | 
| 606 TRUE, XFA_ATTRIBUTEENUM_Last))) { | 606 TRUE, TRUE, XFA_ATTRIBUTEENUM_Last))) { | 
| 607 break; | 607 break; | 
| 608 } | 608 } | 
| 609 CXFA_Node* pNode = m_pCurPageArea; | 609 CXFA_Node* pNode = m_pCurPageArea; | 
| 610 XFA_ATTRIBUTEENUM eCurChoice = | 610 XFA_ATTRIBUTEENUM eCurChoice = | 
| 611 pNode->GetEnum(XFA_ATTRIBUTE_PagePosition); | 611 pNode->GetEnum(XFA_ATTRIBUTE_PagePosition); | 
| 612 if (eCurChoice == XFA_ATTRIBUTEENUM_Last) { | 612 if (eCurChoice == XFA_ATTRIBUTEENUM_Last) { | 
| 613 XFA_ATTRIBUTEENUM eOddOrEven = XFA_ATTRIBUTEENUM_Any; | 613 XFA_ATTRIBUTEENUM eOddOrEven = XFA_ATTRIBUTEENUM_Any; | 
| 614 pNode->TryEnum(XFA_ATTRIBUTE_OddOrEven, eOddOrEven); | 614 pNode->TryEnum(XFA_ATTRIBUTE_OddOrEven, eOddOrEven); | 
| 615 XFA_ATTRIBUTEENUM eLastChoice = | 615 XFA_ATTRIBUTEENUM eLastChoice = | 
| 616 pLastPageAreaLayoutItem->m_pFormNode->GetEnum( | 616 pLastPageAreaLayoutItem->m_pFormNode->GetEnum( | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 712 return m_PageArray.Find(const_cast<CXFA_ContainerLayoutItem*>(pPage)); | 712 return m_PageArray.Find(const_cast<CXFA_ContainerLayoutItem*>(pPage)); | 
| 713 } | 713 } | 
| 714 FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType, | 714 FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType, | 
| 715 XFA_ATTRIBUTEENUM eTargetType, | 715 XFA_ATTRIBUTEENUM eTargetType, | 
| 716 CXFA_Node* pTarget, | 716 CXFA_Node* pTarget, | 
| 717 FX_BOOL bStartNew) { | 717 FX_BOOL bStartNew) { | 
| 718 FX_BOOL bRet = FALSE; | 718 FX_BOOL bRet = FALSE; | 
| 719 switch (eTargetType) { | 719 switch (eTargetType) { | 
| 720 case XFA_ATTRIBUTEENUM_ContentArea: | 720 case XFA_ATTRIBUTEENUM_ContentArea: | 
| 721 if (pTarget && pTarget->GetElementType() != XFA_Element::ContentArea) { | 721 if (pTarget && pTarget->GetElementType() != XFA_Element::ContentArea) { | 
| 722 pTarget = NULL; | 722 pTarget = nullptr; | 
| 723 } | 723 } | 
| 724 if (!pTarget || !m_pCurrentContainerRecord || | 724 if (!pTarget || !m_pCurrentContainerRecord || | 
| 725 pTarget != | 725 pTarget != | 
| 726 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode || | 726 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode || | 
| 727 bStartNew) { | 727 bStartNew) { | 
| 728 CXFA_Node* pPageArea = NULL; | 728 CXFA_Node* pPageArea = nullptr; | 
| 729 if (pTarget) { | 729 if (pTarget) { | 
| 730 pPageArea = pTarget->GetNodeItem(XFA_NODEITEM_Parent); | 730 pPageArea = pTarget->GetNodeItem(XFA_NODEITEM_Parent); | 
| 731 } | 731 } | 
| 732 pPageArea = GetNextAvailPageArea(pPageArea, pTarget); | 732 pPageArea = GetNextAvailPageArea(pPageArea, pTarget); | 
| 733 bRet = pPageArea != NULL; | 733 bRet = !!pPageArea; | 
| 734 } | 734 } | 
| 735 break; | 735 break; | 
| 736 case XFA_ATTRIBUTEENUM_PageArea: | 736 case XFA_ATTRIBUTEENUM_PageArea: | 
| 737 if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { | 737 if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { | 
| 738 pTarget = NULL; | 738 pTarget = nullptr; | 
| 739 } | 739 } | 
| 740 if (!pTarget || !m_pCurrentContainerRecord || | 740 if (!pTarget || !m_pCurrentContainerRecord || | 
| 741 pTarget != GetCurrentContainerRecord()->pCurPageArea->m_pFormNode || | 741 pTarget != GetCurrentContainerRecord()->pCurPageArea->m_pFormNode || | 
| 742 bStartNew) { | 742 bStartNew) { | 
| 743 CXFA_Node* pPageArea = GetNextAvailPageArea(pTarget, NULL, TRUE); | 743 CXFA_Node* pPageArea = GetNextAvailPageArea(pTarget, nullptr, TRUE); | 
| 744 bRet = pPageArea != NULL; | 744 bRet = !!pPageArea; | 
| 745 } | 745 } | 
| 746 break; | 746 break; | 
| 747 case XFA_ATTRIBUTEENUM_PageOdd: | 747 case XFA_ATTRIBUTEENUM_PageOdd: | 
| 748 if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { | 748 if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { | 
| 749 pTarget = NULL; | 749 pTarget = nullptr; | 
| 750 } | 750 } | 
| 751 break; | 751 break; | 
| 752 case XFA_ATTRIBUTEENUM_PageEven: | 752 case XFA_ATTRIBUTEENUM_PageEven: | 
| 753 if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { | 753 if (pTarget && pTarget->GetElementType() != XFA_Element::PageArea) { | 
| 754 pTarget = NULL; | 754 pTarget = nullptr; | 
| 755 } | 755 } | 
| 756 break; | 756 break; | 
| 757 case XFA_ATTRIBUTEENUM_Auto: | 757 case XFA_ATTRIBUTEENUM_Auto: | 
| 758 default: | 758 default: | 
| 759 break; | 759 break; | 
| 760 } | 760 } | 
| 761 return bRet; | 761 return bRet; | 
| 762 } | 762 } | 
| 763 FX_BOOL CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( | 763 FX_BOOL CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( | 
| 764 CXFA_Node* pCurNode, | 764 CXFA_Node* pCurNode, | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 830 } | 830 } | 
| 831 return FALSE; | 831 return FALSE; | 
| 832 } | 832 } | 
| 833 | 833 | 
| 834 FX_BOOL CXFA_LayoutPageMgr::ProcessBreakBeforeOrAfter( | 834 FX_BOOL CXFA_LayoutPageMgr::ProcessBreakBeforeOrAfter( | 
| 835 CXFA_Node* pBreakNode, | 835 CXFA_Node* pBreakNode, | 
| 836 FX_BOOL bBefore, | 836 FX_BOOL bBefore, | 
| 837 CXFA_Node*& pBreakLeaderNode, | 837 CXFA_Node*& pBreakLeaderNode, | 
| 838 CXFA_Node*& pBreakTrailerNode, | 838 CXFA_Node*& pBreakTrailerNode, | 
| 839 FX_BOOL& bCreatePage) { | 839 FX_BOOL& bCreatePage) { | 
| 840 CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; | 840 CXFA_Node *pLeaderTemplate = nullptr, *pTrailerTemplate = nullptr; | 
| 
Lei Zhang
2016/06/23 18:21:45
One per line
 
dsinclair
2016/06/23 18:46:54
Done.
 | |
| 841 CXFA_Node* pFormNode = pBreakNode->GetNodeItem(XFA_NODEITEM_Parent, | 841 CXFA_Node* pFormNode = pBreakNode->GetNodeItem(XFA_NODEITEM_Parent, | 
| 842 XFA_ObjectType::ContainerNode); | 842 XFA_ObjectType::ContainerNode); | 
| 843 if (XFA_ItemLayoutProcessor_IsTakingSpace(pFormNode)) { | 843 if (XFA_ItemLayoutProcessor_IsTakingSpace(pFormNode)) { | 
| 844 bCreatePage = ExecuteBreakBeforeOrAfter(pBreakNode, bBefore, | 844 bCreatePage = ExecuteBreakBeforeOrAfter(pBreakNode, bBefore, | 
| 845 pLeaderTemplate, pTrailerTemplate); | 845 pLeaderTemplate, pTrailerTemplate); | 
| 846 CXFA_Document* pDocument = pBreakNode->GetDocument(); | 846 CXFA_Document* pDocument = pBreakNode->GetDocument(); | 
| 847 CXFA_Node* pDataScope = NULL; | 847 CXFA_Node* pDataScope = nullptr; | 
| 848 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent, | 848 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent, | 
| 849 XFA_ObjectType::ContainerNode); | 849 XFA_ObjectType::ContainerNode); | 
| 850 if (pLeaderTemplate) { | 850 if (pLeaderTemplate) { | 
| 851 if (!pDataScope) { | 851 if (!pDataScope) { | 
| 852 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 852 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 
| 853 } | 853 } | 
| 854 pBreakLeaderNode = pDocument->DataMerge_CopyContainer( | 854 pBreakLeaderNode = pDocument->DataMerge_CopyContainer( | 
| 855 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 855 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 
| 856 pDocument->DataMerge_UpdateBindingRelations(pBreakLeaderNode); | 856 pDocument->DataMerge_UpdateBindingRelations(pBreakLeaderNode); | 
| 857 SetLayoutGeneratedNodeFlag(pBreakLeaderNode); | 857 SetLayoutGeneratedNodeFlag(pBreakLeaderNode); | 
| 858 } | 858 } | 
| 859 if (pTrailerTemplate) { | 859 if (pTrailerTemplate) { | 
| 860 if (!pDataScope) { | 860 if (!pDataScope) { | 
| 861 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 861 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 
| 862 } | 862 } | 
| 863 pBreakTrailerNode = pDocument->DataMerge_CopyContainer( | 863 pBreakTrailerNode = pDocument->DataMerge_CopyContainer( | 
| 864 pTrailerTemplate, pFormNode, pDataScope, TRUE); | 864 pTrailerTemplate, pFormNode, pDataScope, TRUE); | 
| 865 pDocument->DataMerge_UpdateBindingRelations(pBreakTrailerNode); | 865 pDocument->DataMerge_UpdateBindingRelations(pBreakTrailerNode); | 
| 866 SetLayoutGeneratedNodeFlag(pBreakTrailerNode); | 866 SetLayoutGeneratedNodeFlag(pBreakTrailerNode); | 
| 867 } | 867 } | 
| 868 return TRUE; | 868 return TRUE; | 
| 869 } | 869 } | 
| 870 return FALSE; | 870 return FALSE; | 
| 871 } | 871 } | 
| 872 FX_BOOL CXFA_LayoutPageMgr::ProcessBookendLeaderOrTrailer( | 872 FX_BOOL CXFA_LayoutPageMgr::ProcessBookendLeaderOrTrailer( | 
| 873 CXFA_Node* pBookendNode, | 873 CXFA_Node* pBookendNode, | 
| 874 FX_BOOL bLeader, | 874 FX_BOOL bLeader, | 
| 875 CXFA_Node*& pBookendAppendNode) { | 875 CXFA_Node*& pBookendAppendNode) { | 
| 876 CXFA_Node* pLeaderTemplate = NULL; | 876 CXFA_Node* pLeaderTemplate = nullptr; | 
| 877 CXFA_Node* pFormNode = pBookendNode->GetNodeItem( | 877 CXFA_Node* pFormNode = pBookendNode->GetNodeItem( | 
| 878 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); | 878 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); | 
| 879 if (ResolveBookendLeaderOrTrailer(pBookendNode, bLeader, pLeaderTemplate)) { | 879 if (ResolveBookendLeaderOrTrailer(pBookendNode, bLeader, pLeaderTemplate)) { | 
| 880 CXFA_Document* pDocument = pBookendNode->GetDocument(); | 880 CXFA_Document* pDocument = pBookendNode->GetDocument(); | 
| 881 CXFA_Node* pDataScope = NULL; | 881 CXFA_Node* pDataScope = nullptr; | 
| 882 if (pLeaderTemplate) { | 882 if (pLeaderTemplate) { | 
| 883 if (!pDataScope) { | 883 if (!pDataScope) { | 
| 884 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 884 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 
| 885 } | 885 } | 
| 886 pBookendAppendNode = pDocument->DataMerge_CopyContainer( | 886 pBookendAppendNode = pDocument->DataMerge_CopyContainer( | 
| 887 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 887 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 
| 888 pDocument->DataMerge_UpdateBindingRelations(pBookendAppendNode); | 888 pDocument->DataMerge_UpdateBindingRelations(pBookendAppendNode); | 
| 889 SetLayoutGeneratedNodeFlag(pBookendAppendNode); | 889 SetLayoutGeneratedNodeFlag(pBookendAppendNode); | 
| 890 return TRUE; | 890 return TRUE; | 
| 891 } | 891 } | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 930 } | 930 } | 
| 931 } | 931 } | 
| 932 if (!bCreatePage) { | 932 if (!bCreatePage) { | 
| 933 pLeaderTemplate = | 933 pLeaderTemplate = | 
| 934 ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); | 934 ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); | 
| 935 pTrailerTemplate = | 935 pTrailerTemplate = | 
| 936 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); | 936 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); | 
| 937 } | 937 } | 
| 938 return pOverflowNode; | 938 return pOverflowNode; | 
| 939 } | 939 } | 
| 940 return NULL; | 940 return nullptr; | 
| 941 } else if (pOverflowNode->GetElementType() == XFA_Element::Overflow) { | 941 } else if (pOverflowNode->GetElementType() == XFA_Element::Overflow) { | 
| 
Lei Zhang
2016/06/23 18:21:45
else after return
 
dsinclair
2016/06/23 18:46:54
Done.
 | |
| 942 CFX_WideStringC wsOverflowLeader; | 942 CFX_WideStringC wsOverflowLeader; | 
| 943 CFX_WideStringC wsOverflowTrailer; | 943 CFX_WideStringC wsOverflowTrailer; | 
| 944 CFX_WideStringC wsOverflowTarget; | 944 CFX_WideStringC wsOverflowTarget; | 
| 945 pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); | 945 pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); | 
| 946 pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); | 946 pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); | 
| 947 pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget); | 947 pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget); | 
| 948 if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) { | 948 if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) { | 
| 949 CXFA_Node* pTarget = | 949 CXFA_Node* pTarget = | 
| 950 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); | 950 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); | 
| 951 if (pTarget) { | 951 if (pTarget) { | 
| (...skipping 20 matching lines...) Expand all Loading... | |
| 972 return pOverflowNode; | 972 return pOverflowNode; | 
| 973 } | 973 } | 
| 974 return nullptr; | 974 return nullptr; | 
| 975 } | 975 } | 
| 976 | 976 | 
| 977 FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, | 977 FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, | 
| 978 CXFA_Node*& pLeaderNode, | 978 CXFA_Node*& pLeaderNode, | 
| 979 CXFA_Node*& pTrailerNode, | 979 CXFA_Node*& pTrailerNode, | 
| 980 FX_BOOL bDataMerge, | 980 FX_BOOL bDataMerge, | 
| 981 FX_BOOL bCreatePage) { | 981 FX_BOOL bCreatePage) { | 
| 982 if (pFormNode == NULL) { | 982 if (!pFormNode) { | 
| 983 return FALSE; | 983 return FALSE; | 
| 984 } | 984 } | 
| 985 CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; | 985 CXFA_Node *pLeaderTemplate = nullptr, *pTrailerTemplate = nullptr; | 
| 
Lei Zhang
2016/06/23 18:21:45
One per line
 
dsinclair
2016/06/23 18:46:54
Done.
 | |
| 986 FX_BOOL bIsOverflowNode = FALSE; | 986 FX_BOOL bIsOverflowNode = FALSE; | 
| 987 if (pFormNode->GetElementType() == XFA_Element::Overflow || | 987 if (pFormNode->GetElementType() == XFA_Element::Overflow || | 
| 988 pFormNode->GetElementType() == XFA_Element::Break) { | 988 pFormNode->GetElementType() == XFA_Element::Break) { | 
| 989 bIsOverflowNode = TRUE; | 989 bIsOverflowNode = TRUE; | 
| 990 } | 990 } | 
| 991 for (CXFA_Node* pCurNode = | 991 for (CXFA_Node* pCurNode = | 
| 992 bIsOverflowNode ? pFormNode | 992 bIsOverflowNode ? pFormNode | 
| 993 : pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 993 : pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 
| 994 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { | 994 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { | 
| 995 if (BreakOverflow(pCurNode, pLeaderTemplate, pTrailerTemplate, | 995 if (BreakOverflow(pCurNode, pLeaderTemplate, pTrailerTemplate, | 
| 996 bCreatePage)) { | 996 bCreatePage)) { | 
| 997 if (bIsOverflowNode) { | 997 if (bIsOverflowNode) { | 
| 998 pFormNode = pCurNode->GetNodeItem(XFA_NODEITEM_Parent); | 998 pFormNode = pCurNode->GetNodeItem(XFA_NODEITEM_Parent); | 
| 999 } | 999 } | 
| 1000 CXFA_Document* pDocument = pCurNode->GetDocument(); | 1000 CXFA_Document* pDocument = pCurNode->GetDocument(); | 
| 1001 CXFA_Node* pDataScope = NULL; | 1001 CXFA_Node* pDataScope = nullptr; | 
| 1002 if (pLeaderTemplate) { | 1002 if (pLeaderTemplate) { | 
| 1003 if (!pDataScope) { | 1003 if (!pDataScope) { | 
| 1004 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 1004 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 
| 1005 } | 1005 } | 
| 1006 pLeaderNode = pDocument->DataMerge_CopyContainer( | 1006 pLeaderNode = pDocument->DataMerge_CopyContainer( | 
| 1007 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 1007 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 
| 1008 pDocument->DataMerge_UpdateBindingRelations(pLeaderNode); | 1008 pDocument->DataMerge_UpdateBindingRelations(pLeaderNode); | 
| 1009 SetLayoutGeneratedNodeFlag(pLeaderNode); | 1009 SetLayoutGeneratedNodeFlag(pLeaderNode); | 
| 1010 } | 1010 } | 
| 1011 if (pTrailerTemplate) { | 1011 if (pTrailerTemplate) { | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1054 } | 1054 } | 
| 1055 return FALSE; | 1055 return FALSE; | 
| 1056 } | 1056 } | 
| 1057 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet( | 1057 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet( | 
| 1058 CXFA_Node* pPageSet, | 1058 CXFA_Node* pPageSet, | 
| 1059 CXFA_Node* pStartChild, | 1059 CXFA_Node* pStartChild, | 
| 1060 CXFA_Node* pTargetPageArea, | 1060 CXFA_Node* pTargetPageArea, | 
| 1061 CXFA_Node* pTargetContentArea, | 1061 CXFA_Node* pTargetContentArea, | 
| 1062 FX_BOOL bNewPage, | 1062 FX_BOOL bNewPage, | 
| 1063 FX_BOOL bQuery) { | 1063 FX_BOOL bQuery) { | 
| 1064 if (pPageSet == NULL && pStartChild == NULL) { | 1064 if (!pPageSet && !pStartChild) { | 
| 1065 return FALSE; | 1065 return FALSE; | 
| 1066 } | 1066 } | 
| 1067 if (IsPageSetRootOrderedOccurrence()) { | 1067 if (IsPageSetRootOrderedOccurrence()) { | 
| 1068 return FindPageAreaFromPageSet_Ordered(pPageSet, pStartChild, | 1068 return FindPageAreaFromPageSet_Ordered(pPageSet, pStartChild, | 
| 1069 pTargetPageArea, pTargetContentArea, | 1069 pTargetPageArea, pTargetContentArea, | 
| 1070 bNewPage, bQuery); | 1070 bNewPage, bQuery); | 
| 1071 } | 1071 } | 
| 1072 XFA_ATTRIBUTEENUM ePreferredPosition = m_pCurrentContainerRecord | 1072 XFA_ATTRIBUTEENUM ePreferredPosition = m_pCurrentContainerRecord | 
| 1073 ? XFA_ATTRIBUTEENUM_Rest | 1073 ? XFA_ATTRIBUTEENUM_Rest | 
| 1074 : XFA_ATTRIBUTEENUM_First; | 1074 : XFA_ATTRIBUTEENUM_First; | 
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1095 return FALSE; | 1095 return FALSE; | 
| 1096 } | 1096 } | 
| 1097 } | 1097 } | 
| 1098 FX_BOOL bRes = FALSE; | 1098 FX_BOOL bRes = FALSE; | 
| 1099 CXFA_Node* pCurrentNode = | 1099 CXFA_Node* pCurrentNode = | 
| 1100 pStartChild ? pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling) | 1100 pStartChild ? pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling) | 
| 1101 : pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); | 1101 : pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); | 
| 1102 for (; pCurrentNode; | 1102 for (; pCurrentNode; | 
| 1103 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1103 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 
| 1104 if (pCurrentNode->GetElementType() == XFA_Element::PageArea) { | 1104 if (pCurrentNode->GetElementType() == XFA_Element::PageArea) { | 
| 1105 if ((pTargetPageArea == pCurrentNode || pTargetPageArea == NULL)) { | 1105 if ((pTargetPageArea == pCurrentNode || !pTargetPageArea)) { | 
| 1106 if (pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea) == | 1106 if (!pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea)) { | 
| 1107 NULL) { | |
| 1108 if (pTargetPageArea == pCurrentNode) { | 1107 if (pTargetPageArea == pCurrentNode) { | 
| 1109 CreateMinPageRecord(pCurrentNode, TRUE); | 1108 CreateMinPageRecord(pCurrentNode, TRUE); | 
| 1110 pTargetPageArea = NULL; | 1109 pTargetPageArea = nullptr; | 
| 1111 } | 1110 } | 
| 1112 continue; | 1111 continue; | 
| 1113 } | 1112 } | 
| 1114 if (!bQuery) { | 1113 if (!bQuery) { | 
| 1115 CXFA_ContainerRecord* pNewRecord = | 1114 CXFA_ContainerRecord* pNewRecord = | 
| 1116 CreateContainerRecord(pCurrentNode, pStartChild == NULL); | 1115 CreateContainerRecord(pCurrentNode, !pStartChild); | 
| 1117 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 1116 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 
| 1118 if (pTargetContentArea == NULL) { | 1117 if (!pTargetContentArea) { | 
| 1119 pTargetContentArea = | 1118 pTargetContentArea = | 
| 1120 pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea); | 1119 pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea); | 
| 1121 } | 1120 } | 
| 1122 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); | 1121 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); | 
| 1123 } | 1122 } | 
| 1124 m_pCurPageArea = pCurrentNode; | 1123 m_pCurPageArea = pCurrentNode; | 
| 1125 m_nCurPageCount = 1; | 1124 m_nCurPageCount = 1; | 
| 1126 bRes = TRUE; | 1125 bRes = TRUE; | 
| 1127 break; | 1126 break; | 
| 1128 } | 1127 } | 
| 1129 if (!bQuery) { | 1128 if (!bQuery) { | 
| 1130 CreateMinPageRecord(pCurrentNode, FALSE); | 1129 CreateMinPageRecord(pCurrentNode, FALSE); | 
| 1131 } | 1130 } | 
| 1132 } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { | 1131 } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { | 
| 1133 if (FindPageAreaFromPageSet_Ordered(pCurrentNode, NULL, pTargetPageArea, | 1132 if (FindPageAreaFromPageSet_Ordered(pCurrentNode, nullptr, | 
| 1134 pTargetContentArea, bNewPage, | 1133 pTargetPageArea, pTargetContentArea, | 
| 1135 bQuery)) { | 1134 bNewPage, bQuery)) { | 
| 1136 bRes = TRUE; | 1135 bRes = TRUE; | 
| 1137 break; | 1136 break; | 
| 1138 } | 1137 } | 
| 1139 if (!bQuery) { | 1138 if (!bQuery) { | 
| 1140 CreateMinPageSetRecord(pCurrentNode, TRUE); | 1139 CreateMinPageSetRecord(pCurrentNode, TRUE); | 
| 1141 } | 1140 } | 
| 1142 } | 1141 } | 
| 1143 } | 1142 } | 
| 1144 if (!pStartChild && bRes && !bQuery) { | 1143 if (!pStartChild && bRes && !bQuery) { | 
| 1145 m_pPageSetMap.SetAt(pPageSet, ++iPageSetCount); | 1144 m_pPageSetMap.SetAt(pPageSet, ++iPageSetCount); | 
| 1146 } | 1145 } | 
| 1147 return bRes; | 1146 return bRes; | 
| 1148 } | 1147 } | 
| 1149 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( | 1148 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( | 
| 1150 CXFA_Node* pPageSet, | 1149 CXFA_Node* pPageSet, | 
| 1151 CXFA_Node* pStartChild, | 1150 CXFA_Node* pStartChild, | 
| 1152 CXFA_Node* pTargetPageArea, | 1151 CXFA_Node* pTargetPageArea, | 
| 1153 CXFA_Node* pTargetContentArea, | 1152 CXFA_Node* pTargetContentArea, | 
| 1154 FX_BOOL bNewPage, | 1153 FX_BOOL bNewPage, | 
| 1155 FX_BOOL bQuery, | 1154 FX_BOOL bQuery, | 
| 1156 XFA_ATTRIBUTEENUM ePreferredPosition) { | 1155 XFA_ATTRIBUTEENUM ePreferredPosition) { | 
| 1157 const XFA_ATTRIBUTEENUM eFallbackPosition = XFA_ATTRIBUTEENUM_Any; | 1156 const XFA_ATTRIBUTEENUM eFallbackPosition = XFA_ATTRIBUTEENUM_Any; | 
| 1158 CXFA_Node *pPreferredPageArea = NULL, *pFallbackPageArea = NULL; | 1157 CXFA_Node *pPreferredPageArea = nullptr, *pFallbackPageArea = nullptr; | 
| 
Lei Zhang
2016/06/23 18:21:45
Ditto
 
dsinclair
2016/06/23 18:46:54
Done.
 | |
| 1159 CXFA_Node* pCurrentNode = NULL; | 1158 CXFA_Node* pCurrentNode = nullptr; | 
| 1160 if (!pStartChild || pStartChild->GetElementType() == XFA_Element::PageArea) { | 1159 if (!pStartChild || pStartChild->GetElementType() == XFA_Element::PageArea) { | 
| 1161 pCurrentNode = pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); | 1160 pCurrentNode = pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); | 
| 1162 } else { | 1161 } else { | 
| 1163 pCurrentNode = pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling); | 1162 pCurrentNode = pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling); | 
| 1164 } | 1163 } | 
| 1165 for (; pCurrentNode; | 1164 for (; pCurrentNode; | 
| 1166 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1165 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 
| 1167 if (pCurrentNode->GetElementType() == XFA_Element::PageArea) { | 1166 if (pCurrentNode->GetElementType() == XFA_Element::PageArea) { | 
| 1168 if (!MatchPageAreaOddOrEven(pCurrentNode, FALSE)) { | 1167 if (!MatchPageAreaOddOrEven(pCurrentNode, FALSE)) { | 
| 1169 continue; | 1168 continue; | 
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1191 continue; | 1190 continue; | 
| 1192 } | 1191 } | 
| 1193 if (m_ePageSetMode != XFA_ATTRIBUTEENUM_DuplexPaginated || | 1192 if (m_ePageSetMode != XFA_ATTRIBUTEENUM_DuplexPaginated || | 
| 1194 pCurrentNode->GetEnum(XFA_ATTRIBUTE_OddOrEven) == | 1193 pCurrentNode->GetEnum(XFA_ATTRIBUTE_OddOrEven) == | 
| 1195 XFA_ATTRIBUTEENUM_Any) { | 1194 XFA_ATTRIBUTEENUM_Any) { | 
| 1196 pPreferredPageArea = pCurrentNode; | 1195 pPreferredPageArea = pCurrentNode; | 
| 1197 break; | 1196 break; | 
| 1198 } | 1197 } | 
| 1199 return FALSE; | 1198 return FALSE; | 
| 1200 } | 1199 } | 
| 1201 if ((pTargetPageArea == pCurrentNode || pTargetPageArea == NULL)) { | 1200 if ((pTargetPageArea == pCurrentNode || !pTargetPageArea)) { | 
| 1202 if (pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea) == | 1201 if (!pCurrentNode->GetFirstChildByClass(XFA_Element::ContentArea)) { | 
| 1203 NULL) { | |
| 1204 if (pTargetPageArea == pCurrentNode) { | 1202 if (pTargetPageArea == pCurrentNode) { | 
| 1205 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1203 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 
| 1206 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 1204 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 
| 1207 pTargetPageArea = NULL; | 1205 pTargetPageArea = nullptr; | 
| 1208 } | 1206 } | 
| 1209 continue; | 1207 continue; | 
| 1210 } | 1208 } | 
| 1211 if ((ePreferredPosition == XFA_ATTRIBUTEENUM_Rest && | 1209 if ((ePreferredPosition == XFA_ATTRIBUTEENUM_Rest && | 
| 1212 eCurPagePosition == XFA_ATTRIBUTEENUM_Any) || | 1210 eCurPagePosition == XFA_ATTRIBUTEENUM_Any) || | 
| 1213 eCurPagePosition == ePreferredPosition) { | 1211 eCurPagePosition == ePreferredPosition) { | 
| 1214 pPreferredPageArea = pCurrentNode; | 1212 pPreferredPageArea = pCurrentNode; | 
| 1215 break; | 1213 break; | 
| 1216 } else if (eCurPagePosition == eFallbackPosition && | 1214 } else if (eCurPagePosition == eFallbackPosition && | 
| 1217 !pFallbackPageArea) { | 1215 !pFallbackPageArea) { | 
| 1218 pFallbackPageArea = pCurrentNode; | 1216 pFallbackPageArea = pCurrentNode; | 
| 1219 } | 1217 } | 
| 1220 } else if (pTargetPageArea && | 1218 } else if (pTargetPageArea && | 
| 1221 !MatchPageAreaOddOrEven(pTargetPageArea, FALSE)) { | 1219 !MatchPageAreaOddOrEven(pTargetPageArea, FALSE)) { | 
| 1222 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1220 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 
| 1223 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 1221 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 
| 1224 AddContentAreaLayoutItem(pNewRecord, pCurrentNode->GetFirstChildByClass( | 1222 AddContentAreaLayoutItem(pNewRecord, pCurrentNode->GetFirstChildByClass( | 
| 1225 XFA_Element::ContentArea)); | 1223 XFA_Element::ContentArea)); | 
| 1226 } | 1224 } | 
| 1227 } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { | 1225 } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { | 
| 1228 if (FindPageAreaFromPageSet_SimplexDuplex( | 1226 if (FindPageAreaFromPageSet_SimplexDuplex( | 
| 1229 pCurrentNode, NULL, pTargetPageArea, pTargetContentArea, bNewPage, | 1227 pCurrentNode, nullptr, pTargetPageArea, pTargetContentArea, | 
| 1230 bQuery, ePreferredPosition)) { | 1228 bNewPage, bQuery, ePreferredPosition)) { | 
| 1231 break; | 1229 break; | 
| 1232 } | 1230 } | 
| 1233 } | 1231 } | 
| 1234 } | 1232 } | 
| 1235 CXFA_Node* pCurPageArea = NULL; | 1233 CXFA_Node* pCurPageArea = nullptr; | 
| 1236 if (pPreferredPageArea) { | 1234 if (pPreferredPageArea) { | 
| 1237 pCurPageArea = pPreferredPageArea; | 1235 pCurPageArea = pPreferredPageArea; | 
| 1238 } else if (pFallbackPageArea) { | 1236 } else if (pFallbackPageArea) { | 
| 1239 pCurPageArea = pFallbackPageArea; | 1237 pCurPageArea = pFallbackPageArea; | 
| 1240 } | 1238 } | 
| 1241 if (!pCurPageArea) { | 1239 if (!pCurPageArea) { | 
| 1242 return FALSE; | 1240 return FALSE; | 
| 1243 } | 1241 } | 
| 1244 if (!bQuery) { | 1242 if (!bQuery) { | 
| 1245 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1243 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 
| 1246 AddPageAreaLayoutItem(pNewRecord, pCurPageArea); | 1244 AddPageAreaLayoutItem(pNewRecord, pCurPageArea); | 
| 1247 if (pTargetContentArea == NULL) { | 1245 if (!pTargetContentArea) { | 
| 1248 pTargetContentArea = | 1246 pTargetContentArea = | 
| 1249 pCurPageArea->GetFirstChildByClass(XFA_Element::ContentArea); | 1247 pCurPageArea->GetFirstChildByClass(XFA_Element::ContentArea); | 
| 1250 } | 1248 } | 
| 1251 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); | 1249 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); | 
| 1252 } | 1250 } | 
| 1253 m_pCurPageArea = pCurPageArea; | 1251 m_pCurPageArea = pCurPageArea; | 
| 1254 return TRUE; | 1252 return TRUE; | 
| 1255 } | 1253 } | 
| 1256 FX_BOOL CXFA_LayoutPageMgr::MatchPageAreaOddOrEven(CXFA_Node* pPageArea, | 1254 FX_BOOL CXFA_LayoutPageMgr::MatchPageAreaOddOrEven(CXFA_Node* pPageArea, | 
| 1257 FX_BOOL bLastMatch) { | 1255 FX_BOOL bLastMatch) { | 
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1269 return eOddOrEven == XFA_ATTRIBUTEENUM_Odd ? iPageCount % 2 == 0 | 1267 return eOddOrEven == XFA_ATTRIBUTEENUM_Odd ? iPageCount % 2 == 0 | 
| 1270 : iPageCount % 2 == 1; | 1268 : iPageCount % 2 == 1; | 
| 1271 } | 1269 } | 
| 1272 return TRUE; | 1270 return TRUE; | 
| 1273 } | 1271 } | 
| 1274 CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea( | 1272 CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea( | 
| 1275 CXFA_Node* pTargetPageArea, | 1273 CXFA_Node* pTargetPageArea, | 
| 1276 CXFA_Node* pTargetContentArea, | 1274 CXFA_Node* pTargetContentArea, | 
| 1277 FX_BOOL bNewPage, | 1275 FX_BOOL bNewPage, | 
| 1278 FX_BOOL bQuery) { | 1276 FX_BOOL bQuery) { | 
| 1279 if (m_pCurPageArea == NULL) { | 1277 if (!m_pCurPageArea) { | 
| 1280 FindPageAreaFromPageSet(m_pTemplatePageSetRoot, NULL, pTargetPageArea, | 1278 FindPageAreaFromPageSet(m_pTemplatePageSetRoot, nullptr, pTargetPageArea, | 
| 1281 pTargetContentArea, bNewPage, bQuery); | 1279 pTargetContentArea, bNewPage, bQuery); | 
| 1282 ASSERT(m_pCurPageArea); | 1280 ASSERT(m_pCurPageArea); | 
| 1283 return m_pCurPageArea; | 1281 return m_pCurPageArea; | 
| 1284 } | 1282 } | 
| 1285 if (pTargetPageArea == NULL || pTargetPageArea == m_pCurPageArea) { | 1283 if (!pTargetPageArea || pTargetPageArea == m_pCurPageArea) { | 
| 1286 if (!bNewPage && GetNextContentArea(pTargetContentArea)) { | 1284 if (!bNewPage && GetNextContentArea(pTargetContentArea)) { | 
| 1287 return m_pCurPageArea; | 1285 return m_pCurPageArea; | 
| 1288 } | 1286 } | 
| 1289 if (IsPageSetRootOrderedOccurrence()) { | 1287 if (IsPageSetRootOrderedOccurrence()) { | 
| 1290 int32_t iMax = -1; | 1288 int32_t iMax = -1; | 
| 1291 CXFA_Node* pOccurNode = | 1289 CXFA_Node* pOccurNode = | 
| 1292 m_pCurPageArea->GetFirstChildByClass(XFA_Element::Occur); | 1290 m_pCurPageArea->GetFirstChildByClass(XFA_Element::Occur); | 
| 1293 if (pOccurNode) { | 1291 if (pOccurNode) { | 
| 1294 pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE); | 1292 pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE); | 
| 1295 } | 1293 } | 
| 1296 if ((iMax < 0 || m_nCurPageCount < iMax)) { | 1294 if ((iMax < 0 || m_nCurPageCount < iMax)) { | 
| 1297 if (!bQuery) { | 1295 if (!bQuery) { | 
| 1298 CXFA_ContainerRecord* pNewRecord = | 1296 CXFA_ContainerRecord* pNewRecord = | 
| 1299 CreateContainerRecord(m_pCurPageArea); | 1297 CreateContainerRecord(m_pCurPageArea); | 
| 1300 AddPageAreaLayoutItem(pNewRecord, m_pCurPageArea); | 1298 AddPageAreaLayoutItem(pNewRecord, m_pCurPageArea); | 
| 1301 if (pTargetContentArea == NULL) { | 1299 if (!pTargetContentArea) { | 
| 1302 pTargetContentArea = | 1300 pTargetContentArea = | 
| 1303 m_pCurPageArea->GetFirstChildByClass(XFA_Element::ContentArea); | 1301 m_pCurPageArea->GetFirstChildByClass(XFA_Element::ContentArea); | 
| 1304 } | 1302 } | 
| 1305 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); | 1303 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); | 
| 1306 } | 1304 } | 
| 1307 m_nCurPageCount++; | 1305 m_nCurPageCount++; | 
| 1308 return m_pCurPageArea; | 1306 return m_pCurPageArea; | 
| 1309 } | 1307 } | 
| 1310 } | 1308 } | 
| 1311 } | 1309 } | 
| 1312 if (!bQuery && IsPageSetRootOrderedOccurrence()) { | 1310 if (!bQuery && IsPageSetRootOrderedOccurrence()) { | 
| 1313 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); | 1311 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); | 
| 1314 } | 1312 } | 
| 1315 if (FindPageAreaFromPageSet(m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent), | 1313 if (FindPageAreaFromPageSet(m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent), | 
| 1316 m_pCurPageArea, pTargetPageArea, | 1314 m_pCurPageArea, pTargetPageArea, | 
| 1317 pTargetContentArea, bNewPage, bQuery)) { | 1315 pTargetContentArea, bNewPage, bQuery)) { | 
| 1318 return m_pCurPageArea; | 1316 return m_pCurPageArea; | 
| 1319 } | 1317 } | 
| 1320 CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent); | 1318 CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent); | 
| 1321 while (TRUE) { | 1319 while (TRUE) { | 
| 1322 if (FindPageAreaFromPageSet(pPageSet, NULL, pTargetPageArea, | 1320 if (FindPageAreaFromPageSet(pPageSet, nullptr, pTargetPageArea, | 
| 1323 pTargetContentArea, bNewPage, bQuery)) { | 1321 pTargetContentArea, bNewPage, bQuery)) { | 
| 1324 return m_pCurPageArea; | 1322 return m_pCurPageArea; | 
| 1325 } | 1323 } | 
| 1326 if (!bQuery && IsPageSetRootOrderedOccurrence()) { | 1324 if (!bQuery && IsPageSetRootOrderedOccurrence()) { | 
| 1327 CreateMinPageSetRecord(pPageSet); | 1325 CreateMinPageSetRecord(pPageSet); | 
| 1328 } | 1326 } | 
| 1329 if (FindPageAreaFromPageSet(NULL, pPageSet, pTargetPageArea, | 1327 if (FindPageAreaFromPageSet(nullptr, pPageSet, pTargetPageArea, | 
| 1330 pTargetContentArea, bNewPage, bQuery)) { | 1328 pTargetContentArea, bNewPage, bQuery)) { | 
| 1331 return m_pCurPageArea; | 1329 return m_pCurPageArea; | 
| 1332 } | 1330 } | 
| 1333 if (pPageSet == m_pTemplatePageSetRoot) { | 1331 if (pPageSet == m_pTemplatePageSetRoot) { | 
| 1334 break; | 1332 break; | 
| 1335 } | 1333 } | 
| 1336 pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent); | 1334 pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent); | 
| 1337 } | 1335 } | 
| 1338 return NULL; | 1336 return nullptr; | 
| 1339 } | 1337 } | 
| 1340 | 1338 | 
| 1341 FX_BOOL CXFA_LayoutPageMgr::GetNextContentArea(CXFA_Node* pContentArea) { | 1339 FX_BOOL CXFA_LayoutPageMgr::GetNextContentArea(CXFA_Node* pContentArea) { | 
| 1342 CXFA_Node* pCurContentNode = | 1340 CXFA_Node* pCurContentNode = | 
| 1343 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; | 1341 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; | 
| 1344 if (pContentArea == NULL) { | 1342 if (!pContentArea) { | 
| 1345 pContentArea = | 1343 pContentArea = | 
| 1346 pCurContentNode->GetNextSameClassSibling(XFA_Element::ContentArea); | 1344 pCurContentNode->GetNextSameClassSibling(XFA_Element::ContentArea); | 
| 1347 if (pContentArea == NULL) { | 1345 if (!pContentArea) { | 
| 1348 return FALSE; | 1346 return FALSE; | 
| 1349 } | 1347 } | 
| 1350 } else { | 1348 } else { | 
| 1351 if (pContentArea->GetNodeItem(XFA_NODEITEM_Parent) != m_pCurPageArea) { | 1349 if (pContentArea->GetNodeItem(XFA_NODEITEM_Parent) != m_pCurPageArea) { | 
| 1352 return FALSE; | 1350 return FALSE; | 
| 1353 } | 1351 } | 
| 1354 CXFA_ContainerLayoutItem* pContentAreaLayout = NULL; | 1352 CXFA_ContainerLayoutItem* pContentAreaLayout = nullptr; | 
| 1355 if (!CheckContentAreaNotUsed(GetCurrentContainerRecord()->pCurPageArea, | 1353 if (!CheckContentAreaNotUsed(GetCurrentContainerRecord()->pCurPageArea, | 
| 1356 pContentArea, pContentAreaLayout)) { | 1354 pContentArea, pContentAreaLayout)) { | 
| 1357 return FALSE; | 1355 return FALSE; | 
| 1358 } | 1356 } | 
| 1359 if (pContentAreaLayout) { | 1357 if (pContentAreaLayout) { | 
| 1360 if (pContentAreaLayout->m_pFormNode != pCurContentNode) { | 1358 if (pContentAreaLayout->m_pFormNode != pCurContentNode) { | 
| 1361 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1359 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 
| 1362 pNewRecord->pCurContentArea = pContentAreaLayout; | 1360 pNewRecord->pCurContentArea = pContentAreaLayout; | 
| 1363 return TRUE; | 1361 return TRUE; | 
| 1364 } else { | 1362 } else { | 
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1382 pPageSetNode->GetEnum(XFA_ATTRIBUTE_Relation); | 1380 pPageSetNode->GetEnum(XFA_ATTRIBUTE_Relation); | 
| 1383 if (eRelation == XFA_ATTRIBUTEENUM_OrderedOccurrence) { | 1381 if (eRelation == XFA_ATTRIBUTEENUM_OrderedOccurrence) { | 
| 1384 m_pPageSetMap.SetAt(pPageSetNode, 0); | 1382 m_pPageSetMap.SetAt(pPageSetNode, 0); | 
| 1385 } | 1383 } | 
| 1386 } | 1384 } | 
| 1387 } | 1385 } | 
| 1388 } | 1386 } | 
| 1389 int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea, | 1387 int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea, | 
| 1390 FX_BOOL bTargetPageArea, | 1388 FX_BOOL bTargetPageArea, | 
| 1391 FX_BOOL bCreateLast) { | 1389 FX_BOOL bCreateLast) { | 
| 1392 if (pPageArea == NULL) { | 1390 if (!pPageArea) { | 
| 1393 return 0; | 1391 return 0; | 
| 1394 } | 1392 } | 
| 1395 CXFA_Node* pOccurNode = pPageArea->GetFirstChildByClass(XFA_Element::Occur); | 1393 CXFA_Node* pOccurNode = pPageArea->GetFirstChildByClass(XFA_Element::Occur); | 
| 1396 int32_t iMin = 0; | 1394 int32_t iMin = 0; | 
| 1397 if ((pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE)) || | 1395 if ((pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE)) || | 
| 1398 bTargetPageArea) { | 1396 bTargetPageArea) { | 
| 1399 CXFA_Node* pContentArea = | 1397 CXFA_Node* pContentArea = | 
| 1400 pPageArea->GetFirstChildByClass(XFA_Element::ContentArea); | 1398 pPageArea->GetFirstChildByClass(XFA_Element::ContentArea); | 
| 1401 if (iMin < 1 && bTargetPageArea && !pContentArea) { | 1399 if (iMin < 1 && bTargetPageArea && !pContentArea) { | 
| 1402 iMin = 1; | 1400 iMin = 1; | 
| 1403 } | 1401 } | 
| 1404 int32_t i = 0; | 1402 int32_t i = 0; | 
| 1405 if (bCreateLast) { | 1403 if (bCreateLast) { | 
| 1406 i = m_nCurPageCount; | 1404 i = m_nCurPageCount; | 
| 1407 } | 1405 } | 
| 1408 for (; i < iMin; i++) { | 1406 for (; i < iMin; i++) { | 
| 1409 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1407 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 
| 1410 AddPageAreaLayoutItem(pNewRecord, pPageArea); | 1408 AddPageAreaLayoutItem(pNewRecord, pPageArea); | 
| 1411 AddContentAreaLayoutItem(pNewRecord, pContentArea); | 1409 AddContentAreaLayoutItem(pNewRecord, pContentArea); | 
| 1412 } | 1410 } | 
| 1413 } | 1411 } | 
| 1414 return iMin; | 1412 return iMin; | 
| 1415 } | 1413 } | 
| 1416 void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet, | 1414 void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet, | 
| 1417 FX_BOOL bCreateAll) { | 1415 FX_BOOL bCreateAll) { | 
| 1418 if (pPageSet == NULL) { | 1416 if (!pPageSet) { | 
| 1419 return; | 1417 return; | 
| 1420 } | 1418 } | 
| 1421 int32_t iCurSetCount = 0; | 1419 int32_t iCurSetCount = 0; | 
| 1422 if (!m_pPageSetMap.Lookup(pPageSet, iCurSetCount)) { | 1420 if (!m_pPageSetMap.Lookup(pPageSet, iCurSetCount)) { | 
| 1423 return; | 1421 return; | 
| 1424 } | 1422 } | 
| 1425 if (bCreateAll) { | 1423 if (bCreateAll) { | 
| 1426 iCurSetCount = 0; | 1424 iCurSetCount = 0; | 
| 1427 } | 1425 } | 
| 1428 CXFA_Node* pOccurNode = pPageSet->GetFirstChildByClass(XFA_Element::Occur); | 1426 CXFA_Node* pOccurNode = pPageSet->GetFirstChildByClass(XFA_Element::Occur); | 
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1440 XFA_Element::PageSet) { | 1438 XFA_Element::PageSet) { | 
| 1441 CreateMinPageSetRecord(pCurrentPageNode, TRUE); | 1439 CreateMinPageSetRecord(pCurrentPageNode, TRUE); | 
| 1442 } | 1440 } | 
| 1443 } | 1441 } | 
| 1444 } | 1442 } | 
| 1445 m_pPageSetMap.SetAt(pPageSet, iMin); | 1443 m_pPageSetMap.SetAt(pPageSet, iMin); | 
| 1446 } | 1444 } | 
| 1447 } | 1445 } | 
| 1448 } | 1446 } | 
| 1449 void CXFA_LayoutPageMgr::CreateNextMinRecord(CXFA_Node* pRecordNode) { | 1447 void CXFA_LayoutPageMgr::CreateNextMinRecord(CXFA_Node* pRecordNode) { | 
| 1450 if (pRecordNode == NULL) { | 1448 if (!pRecordNode) { | 
| 1451 return; | 1449 return; | 
| 1452 } | 1450 } | 
| 1453 for (CXFA_Node* pCurrentNode = | 1451 for (CXFA_Node* pCurrentNode = | 
| 1454 pRecordNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 1452 pRecordNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 
| 1455 pCurrentNode; | 1453 pCurrentNode; | 
| 1456 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1454 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 
| 1457 if (pCurrentNode->GetElementType() == XFA_Element::PageArea) { | 1455 if (pCurrentNode->GetElementType() == XFA_Element::PageArea) { | 
| 1458 CreateMinPageRecord(pCurrentNode, FALSE); | 1456 CreateMinPageRecord(pCurrentNode, FALSE); | 
| 1459 } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { | 1457 } else if (pCurrentNode->GetElementType() == XFA_Element::PageSet) { | 
| 1460 CreateMinPageSetRecord(pCurrentNode, TRUE); | 1458 CreateMinPageSetRecord(pCurrentNode, TRUE); | 
| 1461 } | 1459 } | 
| 1462 } | 1460 } | 
| 1463 } | 1461 } | 
| 1464 void CXFA_LayoutPageMgr::ProcessLastPageSet() { | 1462 void CXFA_LayoutPageMgr::ProcessLastPageSet() { | 
| 1465 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); | 1463 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); | 
| 1466 CreateNextMinRecord(m_pCurPageArea); | 1464 CreateNextMinRecord(m_pCurPageArea); | 
| 1467 CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent); | 1465 CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent); | 
| 1468 while (TRUE) { | 1466 while (TRUE) { | 
| 1469 CreateMinPageSetRecord(pPageSet); | 1467 CreateMinPageSetRecord(pPageSet); | 
| 1470 if (pPageSet == m_pTemplatePageSetRoot) { | 1468 if (pPageSet == m_pTemplatePageSetRoot) { | 
| 1471 break; | 1469 break; | 
| 1472 } | 1470 } | 
| 1473 CreateNextMinRecord(pPageSet); | 1471 CreateNextMinRecord(pPageSet); | 
| 1474 pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent); | 1472 pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent); | 
| 1475 } | 1473 } | 
| 1476 } | 1474 } | 
| 1477 FX_BOOL CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) { | 1475 FX_BOOL CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) { | 
| 1478 CXFA_Node* pCurContentNode = | 1476 CXFA_Node* pCurContentNode = | 
| 1479 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; | 1477 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; | 
| 1480 if (pCurContentNode == NULL) { | 1478 if (!pCurContentNode) { | 
| 1481 return FALSE; | 1479 return FALSE; | 
| 1482 } | 1480 } | 
| 1483 pCurContentNode = | 1481 pCurContentNode = | 
| 1484 pCurContentNode->GetNextSameClassSibling(XFA_Element::ContentArea); | 1482 pCurContentNode->GetNextSameClassSibling(XFA_Element::ContentArea); | 
| 1485 if (pCurContentNode) { | 1483 if (pCurContentNode) { | 
| 1486 FX_FLOAT fNextContentHeight = | 1484 FX_FLOAT fNextContentHeight = | 
| 1487 pCurContentNode->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); | 1485 pCurContentNode->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); | 
| 1488 return fNextContentHeight > fChildHeight; | 1486 return fNextContentHeight > fChildHeight; | 
| 1489 } | 1487 } | 
| 1490 CXFA_Node* pPageNode = GetCurrentContainerRecord()->pCurPageArea->m_pFormNode; | 1488 CXFA_Node* pPageNode = GetCurrentContainerRecord()->pCurPageArea->m_pFormNode; | 
| 1491 CXFA_Node* pOccurNode = pPageNode->GetFirstChildByClass(XFA_Element::Occur); | 1489 CXFA_Node* pOccurNode = pPageNode->GetFirstChildByClass(XFA_Element::Occur); | 
| 1492 int32_t iMax = 0; | 1490 int32_t iMax = 0; | 
| 1493 if (pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE)) { | 1491 if (pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE)) { | 
| 1494 if (m_nCurPageCount == iMax) { | 1492 if (m_nCurPageCount == iMax) { | 
| 1495 CXFA_Node* pSrcPage = m_pCurPageArea; | 1493 CXFA_Node* pSrcPage = m_pCurPageArea; | 
| 1496 int32_t nSrcPageCount = m_nCurPageCount; | 1494 int32_t nSrcPageCount = m_nCurPageCount; | 
| 1497 FX_POSITION psSrcRecord = m_rgProposedContainerRecord.GetTailPosition(); | 1495 FX_POSITION psSrcRecord = m_rgProposedContainerRecord.GetTailPosition(); | 
| 1498 CXFA_Node* pNextPage = GetNextAvailPageArea(NULL, NULL, FALSE, TRUE); | 1496 CXFA_Node* pNextPage = | 
| 1497 GetNextAvailPageArea(nullptr, nullptr, FALSE, TRUE); | |
| 1499 m_pCurPageArea = pSrcPage; | 1498 m_pCurPageArea = pSrcPage; | 
| 1500 m_nCurPageCount = nSrcPageCount; | 1499 m_nCurPageCount = nSrcPageCount; | 
| 1501 CXFA_ContainerRecord* pPrevRecord = | 1500 CXFA_ContainerRecord* pPrevRecord = | 
| 1502 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext( | 1501 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext( | 
| 1503 psSrcRecord); | 1502 psSrcRecord); | 
| 1504 while (psSrcRecord) { | 1503 while (psSrcRecord) { | 
| 1505 FX_POSITION psSaveRecord = psSrcRecord; | 1504 FX_POSITION psSaveRecord = psSrcRecord; | 
| 1506 CXFA_ContainerRecord* pInsertRecord = | 1505 CXFA_ContainerRecord* pInsertRecord = | 
| 1507 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext( | 1506 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext( | 
| 1508 psSrcRecord); | 1507 psSrcRecord); | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1546 if (m_rgProposedContainerRecord.GetCount() > 0) { | 1545 if (m_rgProposedContainerRecord.GetCount() > 0) { | 
| 1547 FX_POSITION sPos; | 1546 FX_POSITION sPos; | 
| 1548 sPos = m_rgProposedContainerRecord.GetHeadPosition(); | 1547 sPos = m_rgProposedContainerRecord.GetHeadPosition(); | 
| 1549 while (sPos) { | 1548 while (sPos) { | 
| 1550 CXFA_ContainerRecord* pRecord = | 1549 CXFA_ContainerRecord* pRecord = | 
| 1551 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext(sPos); | 1550 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext(sPos); | 
| 1552 delete pRecord; | 1551 delete pRecord; | 
| 1553 } | 1552 } | 
| 1554 m_rgProposedContainerRecord.RemoveAll(); | 1553 m_rgProposedContainerRecord.RemoveAll(); | 
| 1555 } | 1554 } | 
| 1556 m_pCurrentContainerRecord = NULL; | 1555 m_pCurrentContainerRecord = nullptr; | 
| 1557 m_pCurPageArea = NULL; | 1556 m_pCurPageArea = nullptr; | 
| 1558 m_nCurPageCount = 0; | 1557 m_nCurPageCount = 0; | 
| 1559 m_bCreateOverFlowPage = FALSE; | 1558 m_bCreateOverFlowPage = FALSE; | 
| 1560 m_pPageSetMap.RemoveAll(); | 1559 m_pPageSetMap.RemoveAll(); | 
| 1561 } | 1560 } | 
| 1562 CXFA_LayoutItem* CXFA_LayoutPageMgr::FindOrCreateLayoutItem( | 1561 CXFA_LayoutItem* CXFA_LayoutPageMgr::FindOrCreateLayoutItem( | 
| 1563 CXFA_Node* pFormNode) { | 1562 CXFA_Node* pFormNode) { | 
| 1564 return pFormNode->GetDocument()->GetParser()->GetNotify()->OnCreateLayoutItem( | 1563 return pFormNode->GetDocument()->GetParser()->GetNotify()->OnCreateLayoutItem( | 
| 1565 pFormNode); | 1564 pFormNode); | 
| 1566 } | 1565 } | 
| 1567 | 1566 | 
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1589 sIterator(pCurLayoutItem->m_pFormNode); | 1588 sIterator(pCurLayoutItem->m_pFormNode); | 
| 1590 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; | 1589 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; | 
| 1591 pNode = sIterator.MoveToNext()) { | 1590 pNode = sIterator.MoveToNext()) { | 
| 1592 pNode->SetFlag(XFA_NodeFlag_UnusedNode, false); | 1591 pNode->SetFlag(XFA_NodeFlag_UnusedNode, false); | 
| 1593 } | 1592 } | 
| 1594 } | 1593 } | 
| 1595 } | 1594 } | 
| 1596 if (pCurLayoutItem->m_pFirstChild) { | 1595 if (pCurLayoutItem->m_pFirstChild) { | 
| 1597 SaveLayoutItem(pCurLayoutItem); | 1596 SaveLayoutItem(pCurLayoutItem); | 
| 1598 } | 1597 } | 
| 1599 pCurLayoutItem->m_pParent = NULL; | 1598 pCurLayoutItem->m_pParent = nullptr; | 
| 1600 pCurLayoutItem->m_pNextSibling = NULL; | 1599 pCurLayoutItem->m_pNextSibling = nullptr; | 
| 1601 pCurLayoutItem->m_pFirstChild = NULL; | 1600 pCurLayoutItem->m_pFirstChild = nullptr; | 
| 1602 if (!pCurLayoutItem->IsContentLayoutItem() && | 1601 if (!pCurLayoutItem->IsContentLayoutItem() && | 
| 1603 pCurLayoutItem->m_pFormNode->GetElementType() != | 1602 pCurLayoutItem->m_pFormNode->GetElementType() != | 
| 1604 XFA_Element::PageArea) { | 1603 XFA_Element::PageArea) { | 
| 1605 delete pCurLayoutItem; | 1604 delete pCurLayoutItem; | 
| 1606 } | 1605 } | 
| 1607 pCurLayoutItem = pNextLayoutItem; | 1606 pCurLayoutItem = pNextLayoutItem; | 
| 1608 } | 1607 } | 
| 1609 } | 1608 } | 
| 1610 CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( | 1609 CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( | 
| 1611 CXFA_Node* pFormNode, | 1610 CXFA_Node* pFormNode, | 
| 1612 CXFA_LayoutContext* pLayoutContext) { | 1611 CXFA_LayoutContext* pLayoutContext) { | 
| 1613 for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 1612 for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 
| 1614 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { | 1613 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { | 
| 1615 if (pCurNode->GetElementType() == XFA_Element::Break) { | 1614 if (pCurNode->GetElementType() == XFA_Element::Break) { | 
| 1616 CFX_WideStringC wsOverflowLeader; | 1615 CFX_WideStringC wsOverflowLeader; | 
| 1617 CFX_WideStringC wsOverflowTarget; | 1616 CFX_WideStringC wsOverflowTarget; | 
| 1618 CFX_WideStringC wsOverflowTrailer; | 1617 CFX_WideStringC wsOverflowTrailer; | 
| 1619 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); | 1618 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); | 
| 1620 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); | 1619 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); | 
| 1621 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); | 1620 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); | 
| 1622 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || | 1621 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || | 
| 1623 !wsOverflowTarget.IsEmpty()) { | 1622 !wsOverflowTarget.IsEmpty()) { | 
| 1624 return pCurNode; | 1623 return pCurNode; | 
| 1625 } | 1624 } | 
| 1626 return NULL; | 1625 return nullptr; | 
| 1627 } else if (pCurNode->GetElementType() == XFA_Element::Overflow) { | 1626 } else if (pCurNode->GetElementType() == XFA_Element::Overflow) { | 
| 1628 return pCurNode; | 1627 return pCurNode; | 
| 1629 } | 1628 } | 
| 1630 } | 1629 } | 
| 1631 return NULL; | 1630 return nullptr; | 
| 1632 } | 1631 } | 
| 1633 | 1632 | 
| 1634 void CXFA_LayoutPageMgr::MergePageSetContents() { | 1633 void CXFA_LayoutPageMgr::MergePageSetContents() { | 
| 1635 CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument(); | 1634 CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument(); | 
| 1636 CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); | 1635 CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); | 
| 1637 CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout(); | 1636 CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout(); | 
| 1638 CXFA_ContainerLayoutItem* pRootLayout = GetRootLayoutItem(); | 1637 CXFA_ContainerLayoutItem* pRootLayout = GetRootLayoutItem(); | 
| 1639 { | 1638 { | 
| 1640 for (int32_t iIndex = 0; iIndex < pDocument->m_pPendingPageSet.GetSize(); | 1639 for (int32_t iIndex = 0; iIndex < pDocument->m_pPendingPageSet.GetSize(); | 
| 1641 iIndex++) { | 1640 iIndex++) { | 
| 1642 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> | 1641 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> | 
| 1643 sIterator(pDocument->m_pPendingPageSet.GetAt(iIndex)); | 1642 sIterator(pDocument->m_pPendingPageSet.GetAt(iIndex)); | 
| 1644 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; | 1643 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; | 
| 1645 pNode = sIterator.MoveToNext()) { | 1644 pNode = sIterator.MoveToNext()) { | 
| 1646 if (pNode->IsContainerNode()) { | 1645 if (pNode->IsContainerNode()) { | 
| 1647 CXFA_Node* pBindNode = pNode->GetBindData(); | 1646 CXFA_Node* pBindNode = pNode->GetBindData(); | 
| 1648 if (pBindNode) { | 1647 if (pBindNode) { | 
| 1649 pBindNode->RemoveBindItem(pNode); | 1648 pBindNode->RemoveBindItem(pNode); | 
| 1650 pNode->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); | 1649 pNode->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); | 
| 1651 } | 1650 } | 
| 1652 } | 1651 } | 
| 1653 pNode->SetFlag(XFA_NodeFlag_UnusedNode, true); | 1652 pNode->SetFlag(XFA_NodeFlag_UnusedNode, true); | 
| 1654 } | 1653 } | 
| 1655 } | 1654 } | 
| 1656 } | 1655 } | 
| 1657 int32_t iIndex = 0; | 1656 int32_t iIndex = 0; | 
| 1658 for (; pRootLayout; | 1657 for (; pRootLayout; | 
| 1659 pRootLayout = (CXFA_ContainerLayoutItem*)pRootLayout->m_pNextSibling) { | 1658 pRootLayout = (CXFA_ContainerLayoutItem*)pRootLayout->m_pNextSibling) { | 
| 1660 CXFA_Node* pPendingPageSet = nullptr; | 1659 CXFA_Node* pPendingPageSet = nullptr; | 
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1674 XFA_XDPPACKET_Template) { | 1673 XFA_XDPPACKET_Template) { | 
| 1675 pPendingPageSet = | 1674 pPendingPageSet = | 
| 1676 pRootPageSetContainerItem->m_pFormNode->CloneTemplateToForm(FALSE); | 1675 pRootPageSetContainerItem->m_pFormNode->CloneTemplateToForm(FALSE); | 
| 1677 } else { | 1676 } else { | 
| 1678 pPendingPageSet = pRootPageSetContainerItem->m_pFormNode; | 1677 pPendingPageSet = pRootPageSetContainerItem->m_pFormNode; | 
| 1679 } | 1678 } | 
| 1680 } | 1679 } | 
| 1681 if (pRootPageSetContainerItem->m_pFormNode->GetUserData( | 1680 if (pRootPageSetContainerItem->m_pFormNode->GetUserData( | 
| 1682 XFA_LAYOUTITEMKEY) == pRootPageSetContainerItem) { | 1681 XFA_LAYOUTITEMKEY) == pRootPageSetContainerItem) { | 
| 1683 pRootPageSetContainerItem->m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, | 1682 pRootPageSetContainerItem->m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, | 
| 1684 NULL); | 1683 nullptr); | 
| 1685 } | 1684 } | 
| 1686 pRootPageSetContainerItem->m_pFormNode = pPendingPageSet; | 1685 pRootPageSetContainerItem->m_pFormNode = pPendingPageSet; | 
| 1687 pPendingPageSet->ClearFlag(XFA_NodeFlag_UnusedNode); | 1686 pPendingPageSet->ClearFlag(XFA_NodeFlag_UnusedNode); | 
| 1688 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.MoveToNext(); | 1687 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.MoveToNext(); | 
| 1689 pContainerItem; pContainerItem = iterator.MoveToNext()) { | 1688 pContainerItem; pContainerItem = iterator.MoveToNext()) { | 
| 1690 CXFA_Node* pNode = pContainerItem->m_pFormNode; | 1689 CXFA_Node* pNode = pContainerItem->m_pFormNode; | 
| 1691 if (pNode->GetPacketID() != XFA_XDPPACKET_Template) { | 1690 if (pNode->GetPacketID() != XFA_XDPPACKET_Template) { | 
| 1692 continue; | 1691 continue; | 
| 1693 } | 1692 } | 
| 1694 switch (pNode->GetElementType()) { | 1693 switch (pNode->GetElementType()) { | 
| 1695 case XFA_Element::PageSet: { | 1694 case XFA_Element::PageSet: { | 
| 1696 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; | 1695 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; | 
| 1697 pContainerItem->m_pFormNode = XFA_NodeMerge_CloneOrMergeContainer( | 1696 pContainerItem->m_pFormNode = XFA_NodeMerge_CloneOrMergeContainer( | 
| 1698 pDocument, pParentNode, pContainerItem->m_pFormNode, TRUE); | 1697 pDocument, pParentNode, pContainerItem->m_pFormNode, TRUE); | 
| 1699 } break; | 1698 } break; | 
| 1700 case XFA_Element::PageArea: { | 1699 case XFA_Element::PageArea: { | 
| 1701 CXFA_ContainerLayoutItem* pFormLayout = pContainerItem; | 1700 CXFA_ContainerLayoutItem* pFormLayout = pContainerItem; | 
| 1702 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; | 1701 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; | 
| 1703 FX_BOOL bIsExistForm = TRUE; | 1702 FX_BOOL bIsExistForm = TRUE; | 
| 1704 for (int32_t iLevel = 0; iLevel < 3; iLevel++) { | 1703 for (int32_t iLevel = 0; iLevel < 3; iLevel++) { | 
| 1705 pFormLayout = (CXFA_ContainerLayoutItem*)pFormLayout->m_pFirstChild; | 1704 pFormLayout = (CXFA_ContainerLayoutItem*)pFormLayout->m_pFirstChild; | 
| 1706 if (iLevel == 2) { | 1705 if (iLevel == 2) { | 
| 1707 while (pFormLayout && | 1706 while (pFormLayout && | 
| 1708 !XFA_ItemLayoutProcessor_IsTakingSpace( | 1707 !XFA_ItemLayoutProcessor_IsTakingSpace( | 
| 1709 pFormLayout->m_pFormNode)) { | 1708 pFormLayout->m_pFormNode)) { | 
| 1710 pFormLayout = | 1709 pFormLayout = | 
| 1711 (CXFA_ContainerLayoutItem*)pFormLayout->m_pNextSibling; | 1710 (CXFA_ContainerLayoutItem*)pFormLayout->m_pNextSibling; | 
| 1712 } | 1711 } | 
| 1713 } | 1712 } | 
| 1714 if (pFormLayout == NULL) { | 1713 if (!pFormLayout) { | 
| 1715 bIsExistForm = FALSE; | 1714 bIsExistForm = FALSE; | 
| 1716 break; | 1715 break; | 
| 1717 } | 1716 } | 
| 1718 } | 1717 } | 
| 1719 if (bIsExistForm) { | 1718 if (bIsExistForm) { | 
| 1720 CXFA_Node* pNewSubform = pFormLayout->m_pFormNode; | 1719 CXFA_Node* pNewSubform = pFormLayout->m_pFormNode; | 
| 1721 if (pContainerItem->m_pOldSubform && | 1720 if (pContainerItem->m_pOldSubform && | 
| 1722 pContainerItem->m_pOldSubform != pNewSubform) { | 1721 pContainerItem->m_pOldSubform != pNewSubform) { | 
| 1723 CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( | 1722 CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( | 
| 1724 pDocument, pContainerItem->m_pFormNode->GetElementType(), | 1723 pDocument, pContainerItem->m_pFormNode->GetElementType(), | 
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1896 m_PageArray.RemoveAt(i); | 1895 m_PageArray.RemoveAt(i); | 
| 1897 pNotify->OnPageEvent(pPage, XFA_PAGEVIEWEVENT_PostRemoved); | 1896 pNotify->OnPageEvent(pPage, XFA_PAGEVIEWEVENT_PostRemoved); | 
| 1898 delete pPage; | 1897 delete pPage; | 
| 1899 } | 1898 } | 
| 1900 ClearRecordList(); | 1899 ClearRecordList(); | 
| 1901 } | 1900 } | 
| 1902 void XFA_ReleaseLayoutItem_NoPageArea(CXFA_LayoutItem* pLayoutItem) { | 1901 void XFA_ReleaseLayoutItem_NoPageArea(CXFA_LayoutItem* pLayoutItem) { | 
| 1903 CXFA_LayoutItem *pNext, *pNode = pLayoutItem->m_pFirstChild; | 1902 CXFA_LayoutItem *pNext, *pNode = pLayoutItem->m_pFirstChild; | 
| 1904 while (pNode) { | 1903 while (pNode) { | 
| 1905 pNext = pNode->m_pNextSibling; | 1904 pNext = pNode->m_pNextSibling; | 
| 1906 pNode->m_pParent = NULL; | 1905 pNode->m_pParent = nullptr; | 
| 1907 XFA_ReleaseLayoutItem_NoPageArea(pNode); | 1906 XFA_ReleaseLayoutItem_NoPageArea(pNode); | 
| 1908 pNode = pNext; | 1907 pNode = pNext; | 
| 1909 } | 1908 } | 
| 1910 if (pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::PageArea) { | 1909 if (pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::PageArea) { | 
| 1911 delete pLayoutItem; | 1910 delete pLayoutItem; | 
| 1912 } | 1911 } | 
| 1913 } | 1912 } | 
| 1914 void CXFA_LayoutPageMgr::PrepareLayout() { | 1913 void CXFA_LayoutPageMgr::PrepareLayout() { | 
| 1915 m_pPageSetCurRoot = NULL; | 1914 m_pPageSetCurRoot = nullptr; | 
| 1916 m_ePageSetMode = XFA_ATTRIBUTEENUM_OrderedOccurrence; | 1915 m_ePageSetMode = XFA_ATTRIBUTEENUM_OrderedOccurrence; | 
| 1917 m_nAvailPages = 0; | 1916 m_nAvailPages = 0; | 
| 1918 ClearRecordList(); | 1917 ClearRecordList(); | 
| 1919 if (!m_pPageSetLayoutItemRoot) { | 1918 if (!m_pPageSetLayoutItemRoot) { | 
| 1920 return; | 1919 return; | 
| 1921 } | 1920 } | 
| 1922 CXFA_ContainerLayoutItem* pRootLayoutItem = m_pPageSetLayoutItemRoot; | 1921 CXFA_ContainerLayoutItem* pRootLayoutItem = m_pPageSetLayoutItemRoot; | 
| 1923 if (pRootLayoutItem && | 1922 if (pRootLayoutItem && | 
| 1924 pRootLayoutItem->m_pFormNode->GetPacketID() == XFA_XDPPACKET_Form) { | 1923 pRootLayoutItem->m_pFormNode->GetPacketID() == XFA_XDPPACKET_Form) { | 
| 1925 CXFA_Node* pPageSetFormNode = pRootLayoutItem->m_pFormNode; | 1924 CXFA_Node* pPageSetFormNode = pRootLayoutItem->m_pFormNode; | 
| 1926 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.RemoveAll(); | 1925 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.RemoveAll(); | 
| 1927 if (pPageSetFormNode->HasRemovedChildren()) { | 1926 if (pPageSetFormNode->HasRemovedChildren()) { | 
| 1928 XFA_ReleaseLayoutItem(pRootLayoutItem); | 1927 XFA_ReleaseLayoutItem(pRootLayoutItem); | 
| 1929 m_pPageSetLayoutItemRoot = NULL; | 1928 m_pPageSetLayoutItemRoot = nullptr; | 
| 1930 pRootLayoutItem = NULL; | 1929 pRootLayoutItem = nullptr; | 
| 1931 pPageSetFormNode = NULL; | 1930 pPageSetFormNode = nullptr; | 
| 1932 m_PageArray.RemoveAll(); | 1931 m_PageArray.RemoveAll(); | 
| 1933 } | 1932 } | 
| 1934 while (pPageSetFormNode) { | 1933 while (pPageSetFormNode) { | 
| 1935 CXFA_Node* pNextPageSet = | 1934 CXFA_Node* pNextPageSet = | 
| 1936 pPageSetFormNode->GetNextSameClassSibling(XFA_Element::PageSet); | 1935 pPageSetFormNode->GetNextSameClassSibling(XFA_Element::PageSet); | 
| 1937 pPageSetFormNode->GetNodeItem(XFA_NODEITEM_Parent) | 1936 pPageSetFormNode->GetNodeItem(XFA_NODEITEM_Parent) | 
| 1938 ->RemoveChild(pPageSetFormNode, FALSE); | 1937 ->RemoveChild(pPageSetFormNode, FALSE); | 
| 1939 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.Add( | 1938 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.Add( | 
| 1940 pPageSetFormNode); | 1939 pPageSetFormNode); | 
| 1941 pPageSetFormNode = pNextPageSet; | 1940 pPageSetFormNode = pNextPageSet; | 
| 1942 } | 1941 } | 
| 1943 } | 1942 } | 
| 1944 pRootLayoutItem = m_pPageSetLayoutItemRoot; | 1943 pRootLayoutItem = m_pPageSetLayoutItemRoot; | 
| 1945 CXFA_ContainerLayoutItem* pNextLayout = NULL; | 1944 CXFA_ContainerLayoutItem* pNextLayout = nullptr; | 
| 1946 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { | 1945 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { | 
| 1947 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; | 1946 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; | 
| 1948 SaveLayoutItem(pRootLayoutItem); | 1947 SaveLayoutItem(pRootLayoutItem); | 
| 1949 delete pRootLayoutItem; | 1948 delete pRootLayoutItem; | 
| 1950 } | 1949 } | 
| 1951 m_pPageSetLayoutItemRoot = NULL; | 1950 m_pPageSetLayoutItemRoot = nullptr; | 
| 1952 } | 1951 } | 
| OLD | NEW |