| 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 return FALSE; |
| 197 return TRUE; | 197 pContentAreaLayoutItem = pLayoutItem; |
| 198 } | 198 return TRUE; |
| 199 return FALSE; | |
| 200 } | 199 } |
| 201 } | 200 } |
| 202 return TRUE; | 201 return TRUE; |
| 203 } | 202 } |
| 204 | 203 |
| 205 void SyncRemoveLayoutItem(CXFA_LayoutItem* pParentLayoutItem, | 204 void SyncRemoveLayoutItem(CXFA_LayoutItem* pParentLayoutItem, |
| 206 CXFA_FFNotify* pNotify, | 205 CXFA_FFNotify* pNotify, |
| 207 CXFA_LayoutProcessor* pDocLayout) { | 206 CXFA_LayoutProcessor* pDocLayout) { |
| 208 CXFA_LayoutItem* pNextLayoutItem; | 207 CXFA_LayoutItem* pNextLayoutItem; |
| 209 CXFA_LayoutItem* pCurLayoutItem = pParentLayoutItem->m_pFirstChild; | 208 CXFA_LayoutItem* pCurLayoutItem = pParentLayoutItem->m_pFirstChild; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 227 m_pPageSetCurRoot(nullptr), | 226 m_pPageSetCurRoot(nullptr), |
| 228 m_pCurrentContainerRecord(nullptr), | 227 m_pCurrentContainerRecord(nullptr), |
| 229 m_pCurPageArea(nullptr), | 228 m_pCurPageArea(nullptr), |
| 230 m_nAvailPages(0), | 229 m_nAvailPages(0), |
| 231 m_nCurPageCount(0), | 230 m_nCurPageCount(0), |
| 232 m_ePageSetMode(XFA_ATTRIBUTEENUM_OrderedOccurrence), | 231 m_ePageSetMode(XFA_ATTRIBUTEENUM_OrderedOccurrence), |
| 233 m_bCreateOverFlowPage(FALSE) {} | 232 m_bCreateOverFlowPage(FALSE) {} |
| 234 CXFA_LayoutPageMgr::~CXFA_LayoutPageMgr() { | 233 CXFA_LayoutPageMgr::~CXFA_LayoutPageMgr() { |
| 235 ClearData(); | 234 ClearData(); |
| 236 CXFA_LayoutItem* pLayoutItem = GetRootLayoutItem(); | 235 CXFA_LayoutItem* pLayoutItem = GetRootLayoutItem(); |
| 237 CXFA_LayoutItem* pNextLayout = NULL; | 236 CXFA_LayoutItem* pNextLayout = nullptr; |
| 238 for (; pLayoutItem; pLayoutItem = pNextLayout) { | 237 for (; pLayoutItem; pLayoutItem = pNextLayout) { |
| 239 pNextLayout = pLayoutItem->m_pNextSibling; | 238 pNextLayout = pLayoutItem->m_pNextSibling; |
| 240 XFA_ReleaseLayoutItem(pLayoutItem); | 239 XFA_ReleaseLayoutItem(pLayoutItem); |
| 241 } | 240 } |
| 242 } | 241 } |
| 243 FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { | 242 FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { |
| 244 PrepareLayout(); | 243 PrepareLayout(); |
| 245 CXFA_Node* pTemplateNode = pFormNode->GetTemplateNode(); | 244 CXFA_Node* pTemplateNode = pFormNode->GetTemplateNode(); |
| 246 if (!pTemplateNode) { | 245 if (!pTemplateNode) { |
| 247 return FALSE; | 246 return FALSE; |
| 248 } | 247 } |
| 249 m_pTemplatePageSetRoot = pTemplateNode->GetProperty(0, XFA_ELEMENT_PageSet); | 248 m_pTemplatePageSetRoot = pTemplateNode->GetProperty(0, XFA_ELEMENT_PageSet); |
| 250 ASSERT(m_pTemplatePageSetRoot); | 249 ASSERT(m_pTemplatePageSetRoot); |
| 251 if (m_pPageSetLayoutItemRoot) { | 250 if (m_pPageSetLayoutItemRoot) { |
| 252 m_pPageSetLayoutItemRoot->m_pParent = NULL; | 251 m_pPageSetLayoutItemRoot->m_pParent = nullptr; |
| 253 m_pPageSetLayoutItemRoot->m_pFirstChild = NULL; | 252 m_pPageSetLayoutItemRoot->m_pFirstChild = nullptr; |
| 254 m_pPageSetLayoutItemRoot->m_pNextSibling = NULL; | 253 m_pPageSetLayoutItemRoot->m_pNextSibling = nullptr; |
| 255 m_pPageSetLayoutItemRoot->m_pFormNode = m_pTemplatePageSetRoot; | 254 m_pPageSetLayoutItemRoot->m_pFormNode = m_pTemplatePageSetRoot; |
| 256 } else { | 255 } else { |
| 257 m_pPageSetLayoutItemRoot = | 256 m_pPageSetLayoutItemRoot = |
| 258 new CXFA_ContainerLayoutItem(m_pTemplatePageSetRoot); | 257 new CXFA_ContainerLayoutItem(m_pTemplatePageSetRoot); |
| 259 } | 258 } |
| 260 m_pPageSetCurRoot = m_pPageSetLayoutItemRoot; | 259 m_pPageSetCurRoot = m_pPageSetLayoutItemRoot; |
| 261 m_pTemplatePageSetRoot->SetUserData(XFA_LAYOUTITEMKEY, | 260 m_pTemplatePageSetRoot->SetUserData(XFA_LAYOUTITEMKEY, |
| 262 (void*)m_pPageSetLayoutItemRoot); | 261 (void*)m_pPageSetLayoutItemRoot); |
| 263 XFA_ATTRIBUTEENUM eRelation = | 262 XFA_ATTRIBUTEENUM eRelation = |
| 264 m_pTemplatePageSetRoot->GetEnum(XFA_ATTRIBUTE_Relation); | 263 m_pTemplatePageSetRoot->GetEnum(XFA_ATTRIBUTE_Relation); |
| 265 if (eRelation != XFA_ATTRIBUTEENUM_Unknown) { | 264 if (eRelation != XFA_ATTRIBUTEENUM_Unknown) { |
| 266 m_ePageSetMode = eRelation; | 265 m_ePageSetMode = eRelation; |
| 267 } | 266 } |
| 268 InitPageSetMap(); | 267 InitPageSetMap(); |
| 269 CXFA_Node* pPageArea = NULL; | 268 CXFA_Node* pPageArea = nullptr; |
| 270 int32_t iCount = 0; | 269 int32_t iCount = 0; |
| 271 for (pPageArea = m_pTemplatePageSetRoot->GetNodeItem(XFA_NODEITEM_FirstChild); | 270 for (pPageArea = m_pTemplatePageSetRoot->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 272 pPageArea; | 271 pPageArea; |
| 273 pPageArea = pPageArea->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 272 pPageArea = pPageArea->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 274 if (pPageArea->GetClassID() == XFA_ELEMENT_PageArea) { | 273 if (pPageArea->GetClassID() == XFA_ELEMENT_PageArea) { |
| 275 iCount++; | 274 iCount++; |
| 276 if (pPageArea->GetFirstChildByClass(XFA_ELEMENT_ContentArea)) { | 275 if (pPageArea->GetFirstChildByClass(XFA_ELEMENT_ContentArea)) { |
| 277 return TRUE; | 276 return TRUE; |
| 278 } | 277 } |
| 279 } | 278 } |
| 280 } | 279 } |
| 281 if (iCount > 0) { | 280 if (iCount > 0) { |
| 282 return FALSE; | 281 return FALSE; |
| 283 } | 282 } |
| 284 CXFA_Document* pDocument = pTemplateNode->GetDocument(); | 283 CXFA_Document* pDocument = pTemplateNode->GetDocument(); |
| 285 CXFA_Document* pObjFactory = pDocument->GetParser()->GetFactory(); | 284 CXFA_Document* pObjFactory = pDocument->GetParser()->GetFactory(); |
| 286 pPageArea = m_pTemplatePageSetRoot->GetChild(0, XFA_ELEMENT_PageArea); | 285 pPageArea = m_pTemplatePageSetRoot->GetChild(0, XFA_ELEMENT_PageArea); |
| 287 if (!pPageArea) { | 286 if (!pPageArea) { |
| 288 pPageArea = pObjFactory->CreateNode(m_pTemplatePageSetRoot->GetPacketID(), | 287 pPageArea = pObjFactory->CreateNode(m_pTemplatePageSetRoot->GetPacketID(), |
| 289 XFA_ELEMENT_PageArea); | 288 XFA_ELEMENT_PageArea); |
| 290 if (!pPageArea) { | 289 if (!pPageArea) { |
| 291 return FALSE; | 290 return FALSE; |
| 292 } | 291 } |
| 293 m_pTemplatePageSetRoot->InsertChild(pPageArea, NULL); | 292 m_pTemplatePageSetRoot->InsertChild(pPageArea, nullptr); |
| 294 pPageArea->SetFlag(XFA_NODEFLAG_Initialized, true); | 293 pPageArea->SetFlag(XFA_NODEFLAG_Initialized, true); |
| 295 } | 294 } |
| 296 CXFA_Node* pContentArea = pPageArea->GetChild(0, XFA_ELEMENT_ContentArea); | 295 CXFA_Node* pContentArea = pPageArea->GetChild(0, XFA_ELEMENT_ContentArea); |
| 297 if (!pContentArea) { | 296 if (!pContentArea) { |
| 298 pContentArea = pObjFactory->CreateNode(pPageArea->GetPacketID(), | 297 pContentArea = pObjFactory->CreateNode(pPageArea->GetPacketID(), |
| 299 XFA_ELEMENT_ContentArea); | 298 XFA_ELEMENT_ContentArea); |
| 300 if (!pContentArea) { | 299 if (!pContentArea) { |
| 301 return FALSE; | 300 return FALSE; |
| 302 } | 301 } |
| 303 pPageArea->InsertChild(pContentArea, NULL); | 302 pPageArea->InsertChild(pContentArea, nullptr); |
| 304 pContentArea->SetFlag(XFA_NODEFLAG_Initialized, true); | 303 pContentArea->SetFlag(XFA_NODEFLAG_Initialized, true); |
| 305 pContentArea->SetMeasure(XFA_ATTRIBUTE_X, | 304 pContentArea->SetMeasure(XFA_ATTRIBUTE_X, |
| 306 CXFA_Measurement(0.25f, XFA_UNIT_In)); | 305 CXFA_Measurement(0.25f, XFA_UNIT_In)); |
| 307 pContentArea->SetMeasure(XFA_ATTRIBUTE_Y, | 306 pContentArea->SetMeasure(XFA_ATTRIBUTE_Y, |
| 308 CXFA_Measurement(0.25f, XFA_UNIT_In)); | 307 CXFA_Measurement(0.25f, XFA_UNIT_In)); |
| 309 pContentArea->SetMeasure(XFA_ATTRIBUTE_W, | 308 pContentArea->SetMeasure(XFA_ATTRIBUTE_W, |
| 310 CXFA_Measurement(8.0f, XFA_UNIT_In)); | 309 CXFA_Measurement(8.0f, XFA_UNIT_In)); |
| 311 pContentArea->SetMeasure(XFA_ATTRIBUTE_H, | 310 pContentArea->SetMeasure(XFA_ATTRIBUTE_H, |
| 312 CXFA_Measurement(10.5f, XFA_UNIT_In)); | 311 CXFA_Measurement(10.5f, XFA_UNIT_In)); |
| 313 } | 312 } |
| 314 CXFA_Node* pMedium = pPageArea->GetChild(0, XFA_ELEMENT_Medium); | 313 CXFA_Node* pMedium = pPageArea->GetChild(0, XFA_ELEMENT_Medium); |
| 315 if (!pMedium) { | 314 if (!pMedium) { |
| 316 pMedium = | 315 pMedium = |
| 317 pObjFactory->CreateNode(pPageArea->GetPacketID(), XFA_ELEMENT_Medium); | 316 pObjFactory->CreateNode(pPageArea->GetPacketID(), XFA_ELEMENT_Medium); |
| 318 if (!pContentArea) { | 317 if (!pContentArea) { |
| 319 return FALSE; | 318 return FALSE; |
| 320 } | 319 } |
| 321 pPageArea->InsertChild(pMedium, NULL); | 320 pPageArea->InsertChild(pMedium, nullptr); |
| 322 pMedium->SetFlag(XFA_NODEFLAG_Initialized, true); | 321 pMedium->SetFlag(XFA_NODEFLAG_Initialized, true); |
| 323 pMedium->SetMeasure(XFA_ATTRIBUTE_Short, | 322 pMedium->SetMeasure(XFA_ATTRIBUTE_Short, |
| 324 CXFA_Measurement(8.5f, XFA_UNIT_In)); | 323 CXFA_Measurement(8.5f, XFA_UNIT_In)); |
| 325 pMedium->SetMeasure(XFA_ATTRIBUTE_Long, | 324 pMedium->SetMeasure(XFA_ATTRIBUTE_Long, |
| 326 CXFA_Measurement(11.0f, XFA_UNIT_In)); | 325 CXFA_Measurement(11.0f, XFA_UNIT_In)); |
| 327 } | 326 } |
| 328 return TRUE; | 327 return TRUE; |
| 329 } | 328 } |
| 330 FX_BOOL CXFA_LayoutPageMgr::PrepareFirstPage(CXFA_Node* pRootSubform) { | 329 FX_BOOL CXFA_LayoutPageMgr::PrepareFirstPage(CXFA_Node* pRootSubform) { |
| 331 FX_BOOL bProBreakBefore = FALSE; | 330 FX_BOOL bProBreakBefore = FALSE; |
| 332 CXFA_Node* pBreakBeforeNode = NULL; | 331 CXFA_Node* pBreakBeforeNode = nullptr; |
| 333 while (pRootSubform) { | 332 while (pRootSubform) { |
| 334 for (CXFA_Node* pBreakNode = | 333 for (CXFA_Node* pBreakNode = |
| 335 pRootSubform->GetNodeItem(XFA_NODEITEM_FirstChild); | 334 pRootSubform->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 336 pBreakNode; | 335 pBreakNode; |
| 337 pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 336 pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 338 XFA_ELEMENT eType = pBreakNode->GetClassID(); | 337 XFA_ELEMENT eType = pBreakNode->GetClassID(); |
| 339 if (eType == XFA_ELEMENT_BreakBefore || | 338 if (eType == XFA_ELEMENT_BreakBefore || |
| 340 (eType == XFA_ELEMENT_Break && | 339 (eType == XFA_ELEMENT_Break && |
| 341 pBreakNode->GetEnum(XFA_ATTRIBUTE_Before) != | 340 pBreakNode->GetEnum(XFA_ATTRIBUTE_Before) != |
| 342 XFA_ATTRIBUTEENUM_Auto)) { | 341 XFA_ATTRIBUTEENUM_Auto)) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 361 m_pCurrentContainerRecord = m_rgProposedContainerRecord.GetHeadPosition(); | 360 m_pCurrentContainerRecord = m_rgProposedContainerRecord.GetHeadPosition(); |
| 362 return TRUE; | 361 return TRUE; |
| 363 } | 362 } |
| 364 return AppendNewPage(TRUE); | 363 return AppendNewPage(TRUE); |
| 365 } | 364 } |
| 366 FX_BOOL CXFA_LayoutPageMgr::AppendNewPage(FX_BOOL bFirstTemPage) { | 365 FX_BOOL CXFA_LayoutPageMgr::AppendNewPage(FX_BOOL bFirstTemPage) { |
| 367 if (m_pCurrentContainerRecord != | 366 if (m_pCurrentContainerRecord != |
| 368 m_rgProposedContainerRecord.GetTailPosition()) { | 367 m_rgProposedContainerRecord.GetTailPosition()) { |
| 369 return TRUE; | 368 return TRUE; |
| 370 } | 369 } |
| 371 CXFA_Node* pPageNode = GetNextAvailPageArea(NULL); | 370 CXFA_Node* pPageNode = GetNextAvailPageArea(nullptr); |
| 372 if (!pPageNode) { | 371 if (!pPageNode) { |
| 373 return FALSE; | 372 return FALSE; |
| 374 } | 373 } |
| 375 if (bFirstTemPage && m_pCurrentContainerRecord == NULL) { | 374 if (bFirstTemPage && !m_pCurrentContainerRecord) |
| 376 m_pCurrentContainerRecord = m_rgProposedContainerRecord.GetHeadPosition(); | 375 m_pCurrentContainerRecord = m_rgProposedContainerRecord.GetHeadPosition(); |
| 377 } | |
| 378 return !bFirstTemPage || m_pCurrentContainerRecord; | 376 return !bFirstTemPage || m_pCurrentContainerRecord; |
| 379 } | 377 } |
| 380 | 378 |
| 381 void CXFA_LayoutPageMgr::RemoveLayoutRecord(CXFA_ContainerRecord* pNewRecord, | 379 void CXFA_LayoutPageMgr::RemoveLayoutRecord(CXFA_ContainerRecord* pNewRecord, |
| 382 CXFA_ContainerRecord* pPrevRecord) { | 380 CXFA_ContainerRecord* pPrevRecord) { |
| 383 if (!pNewRecord || !pPrevRecord) { | 381 if (!pNewRecord || !pPrevRecord) { |
| 384 return; | 382 return; |
| 385 } | 383 } |
| 386 if (pNewRecord->pCurPageSet != pPrevRecord->pCurPageSet) { | 384 if (pNewRecord->pCurPageSet != pPrevRecord->pCurPageSet) { |
| 387 RemoveLayoutItem(pNewRecord->pCurPageSet); | 385 RemoveLayoutItem(pNewRecord->pCurPageSet); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } | 454 } |
| 457 return pTestScript->GetDocument()->GetParser()->GetNotify()->RunScript( | 455 return pTestScript->GetDocument()->GetParser()->GetNotify()->RunScript( |
| 458 pTestScript, pTestScript->GetNodeItem(XFA_NODEITEM_Parent, | 456 pTestScript, pTestScript->GetNodeItem(XFA_NODEITEM_Parent, |
| 459 XFA_OBJECTTYPE_ContainerNode)); | 457 XFA_OBJECTTYPE_ContainerNode)); |
| 460 } | 458 } |
| 461 CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( | 459 CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( |
| 462 CXFA_Node* pPageNode, | 460 CXFA_Node* pPageNode, |
| 463 FX_BOOL bCreateNew) { | 461 FX_BOOL bCreateNew) { |
| 464 CXFA_ContainerRecord* pNewRecord = new CXFA_ContainerRecord(); | 462 CXFA_ContainerRecord* pNewRecord = new CXFA_ContainerRecord(); |
| 465 if (m_pCurrentContainerRecord) { | 463 if (m_pCurrentContainerRecord) { |
| 466 if (!IsPageSetRootOrderedOccurrence() || pPageNode == NULL) { | 464 if (!IsPageSetRootOrderedOccurrence() || !pPageNode) { |
| 467 *pNewRecord = *GetCurrentContainerRecord(); | 465 *pNewRecord = *GetCurrentContainerRecord(); |
| 468 m_rgProposedContainerRecord.AddTail(pNewRecord); | 466 m_rgProposedContainerRecord.AddTail(pNewRecord); |
| 469 return pNewRecord; | 467 return pNewRecord; |
| 470 } | 468 } |
| 471 CXFA_Node* pPageSet = pPageNode->GetNodeItem(XFA_NODEITEM_Parent); | 469 CXFA_Node* pPageSet = pPageNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 472 if (!bCreateNew) { | 470 if (!bCreateNew) { |
| 473 if (pPageSet == m_pTemplatePageSetRoot) { | 471 if (pPageSet == m_pTemplatePageSetRoot) { |
| 474 pNewRecord->pCurPageSet = m_pPageSetCurRoot; | 472 pNewRecord->pCurPageSet = m_pPageSetCurRoot; |
| 475 } else { | 473 } else { |
| 476 CXFA_ContainerLayoutItem* pParentLayoutItem = | 474 CXFA_ContainerLayoutItem* pParentLayoutItem = |
| 477 (CXFA_ContainerLayoutItem*)pPageSet->GetUserData(XFA_LAYOUTITEMKEY); | 475 (CXFA_ContainerLayoutItem*)pPageSet->GetUserData(XFA_LAYOUTITEMKEY); |
| 478 if (pParentLayoutItem == NULL) { | 476 if (!pParentLayoutItem) |
| 479 pParentLayoutItem = m_pPageSetCurRoot; | 477 pParentLayoutItem = m_pPageSetCurRoot; |
| 480 } | |
| 481 pNewRecord->pCurPageSet = pParentLayoutItem; | 478 pNewRecord->pCurPageSet = pParentLayoutItem; |
| 482 } | 479 } |
| 483 } else { | 480 } else { |
| 484 CXFA_ContainerLayoutItem* pParentPageSetLayout = NULL; | 481 CXFA_ContainerLayoutItem* pParentPageSetLayout = nullptr; |
| 485 if (pPageSet == GetCurrentContainerRecord()->pCurPageSet->m_pFormNode) { | 482 if (pPageSet == GetCurrentContainerRecord()->pCurPageSet->m_pFormNode) { |
| 486 pParentPageSetLayout = | 483 pParentPageSetLayout = |
| 487 (CXFA_ContainerLayoutItem*)GetCurrentContainerRecord() | 484 (CXFA_ContainerLayoutItem*)GetCurrentContainerRecord() |
| 488 ->pCurPageSet->m_pParent; | 485 ->pCurPageSet->m_pParent; |
| 489 } else { | 486 } else { |
| 490 pParentPageSetLayout = | 487 pParentPageSetLayout = |
| 491 (CXFA_ContainerLayoutItem*)pPageSet->GetNodeItem( | 488 (CXFA_ContainerLayoutItem*)pPageSet->GetNodeItem( |
| 492 XFA_NODEITEM_Parent) | 489 XFA_NODEITEM_Parent) |
| 493 ->GetUserData(XFA_LAYOUTITEMKEY); | 490 ->GetUserData(XFA_LAYOUTITEMKEY); |
| 494 } | 491 } |
| 495 CXFA_ContainerLayoutItem* pPageSetLayoutItem = | 492 CXFA_ContainerLayoutItem* pPageSetLayoutItem = |
| 496 new CXFA_ContainerLayoutItem(pPageSet); | 493 new CXFA_ContainerLayoutItem(pPageSet); |
| 497 pPageSet->SetUserData(XFA_LAYOUTITEMKEY, (void*)pPageSetLayoutItem); | 494 pPageSet->SetUserData(XFA_LAYOUTITEMKEY, (void*)pPageSetLayoutItem); |
| 498 if (pParentPageSetLayout == NULL) { | 495 if (pParentPageSetLayout) { |
| 496 pParentPageSetLayout->AddChild(pPageSetLayoutItem); |
| 497 } else { |
| 499 CXFA_ContainerLayoutItem* pPrePageSet = m_pPageSetLayoutItemRoot; | 498 CXFA_ContainerLayoutItem* pPrePageSet = m_pPageSetLayoutItemRoot; |
| 500 while (pPrePageSet->m_pNextSibling) { | 499 while (pPrePageSet->m_pNextSibling) { |
| 501 pPrePageSet = (CXFA_ContainerLayoutItem*)pPrePageSet->m_pNextSibling; | 500 pPrePageSet = (CXFA_ContainerLayoutItem*)pPrePageSet->m_pNextSibling; |
| 502 } | 501 } |
| 503 pPrePageSet->m_pNextSibling = pPageSetLayoutItem; | 502 pPrePageSet->m_pNextSibling = pPageSetLayoutItem; |
| 504 m_pPageSetCurRoot = pPageSetLayoutItem; | 503 m_pPageSetCurRoot = pPageSetLayoutItem; |
| 505 } else { | |
| 506 pParentPageSetLayout->AddChild(pPageSetLayoutItem); | |
| 507 } | 504 } |
| 508 pNewRecord->pCurPageSet = pPageSetLayoutItem; | 505 pNewRecord->pCurPageSet = pPageSetLayoutItem; |
| 509 } | 506 } |
| 510 } else { | 507 } else { |
| 511 if (pPageNode) { | 508 if (pPageNode) { |
| 512 CXFA_Node* pPageSet = pPageNode->GetNodeItem(XFA_NODEITEM_Parent); | 509 CXFA_Node* pPageSet = pPageNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 513 if (pPageSet == m_pTemplatePageSetRoot) { | 510 if (pPageSet == m_pTemplatePageSetRoot) { |
| 514 pNewRecord->pCurPageSet = m_pPageSetLayoutItemRoot; | 511 pNewRecord->pCurPageSet = m_pPageSetLayoutItemRoot; |
| 515 } else { | 512 } else { |
| 516 CXFA_ContainerLayoutItem* pPageSetLayoutItem = | 513 CXFA_ContainerLayoutItem* pPageSetLayoutItem = |
| 517 new CXFA_ContainerLayoutItem(pPageSet); | 514 new CXFA_ContainerLayoutItem(pPageSet); |
| 518 pPageSet->SetUserData(XFA_LAYOUTITEMKEY, (void*)pPageSetLayoutItem); | 515 pPageSet->SetUserData(XFA_LAYOUTITEMKEY, (void*)pPageSetLayoutItem); |
| 519 m_pPageSetLayoutItemRoot->AddChild(pPageSetLayoutItem); | 516 m_pPageSetLayoutItemRoot->AddChild(pPageSetLayoutItem); |
| 520 pNewRecord->pCurPageSet = pPageSetLayoutItem; | 517 pNewRecord->pCurPageSet = pPageSetLayoutItem; |
| 521 } | 518 } |
| 522 } else { | 519 } else { |
| 523 pNewRecord->pCurPageSet = m_pPageSetLayoutItemRoot; | 520 pNewRecord->pCurPageSet = m_pPageSetLayoutItemRoot; |
| 524 } | 521 } |
| 525 } | 522 } |
| 526 m_rgProposedContainerRecord.AddTail(pNewRecord); | 523 m_rgProposedContainerRecord.AddTail(pNewRecord); |
| 527 return pNewRecord; | 524 return pNewRecord; |
| 528 } | 525 } |
| 529 void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, | 526 void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, |
| 530 CXFA_Node* pNewPageArea) { | 527 CXFA_Node* pNewPageArea) { |
| 531 CXFA_ContainerLayoutItem* pNewPageAreaLayoutItem = NULL; | 528 CXFA_ContainerLayoutItem* pNewPageAreaLayoutItem = nullptr; |
| 532 if (m_PageArray.GetSize() > m_nAvailPages) { | 529 if (m_PageArray.GetSize() > m_nAvailPages) { |
| 533 CXFA_ContainerLayoutItem* pContainerItem = m_PageArray[m_nAvailPages]; | 530 CXFA_ContainerLayoutItem* pContainerItem = m_PageArray[m_nAvailPages]; |
| 534 pContainerItem->m_pFormNode = pNewPageArea; | 531 pContainerItem->m_pFormNode = pNewPageArea; |
| 535 m_nAvailPages++; | 532 m_nAvailPages++; |
| 536 pNewPageAreaLayoutItem = pContainerItem; | 533 pNewPageAreaLayoutItem = pContainerItem; |
| 537 } else { | 534 } else { |
| 538 CXFA_FFNotify* pNotify = | 535 CXFA_FFNotify* pNotify = |
| 539 pNewPageArea->GetDocument()->GetParser()->GetNotify(); | 536 pNewPageArea->GetDocument()->GetParser()->GetNotify(); |
| 540 CXFA_ContainerLayoutItem* pContainerItem = | 537 CXFA_ContainerLayoutItem* pContainerItem = |
| 541 (CXFA_ContainerLayoutItem*)pNotify->OnCreateLayoutItem(pNewPageArea); | 538 (CXFA_ContainerLayoutItem*)pNotify->OnCreateLayoutItem(pNewPageArea); |
| 542 m_PageArray.Add(pContainerItem); | 539 m_PageArray.Add(pContainerItem); |
| 543 m_nAvailPages++; | 540 m_nAvailPages++; |
| 544 pNotify->OnPageEvent(pContainerItem, XFA_PAGEVIEWEVENT_PostRemoved); | 541 pNotify->OnPageEvent(pContainerItem, XFA_PAGEVIEWEVENT_PostRemoved); |
| 545 pNewPageAreaLayoutItem = pContainerItem; | 542 pNewPageAreaLayoutItem = pContainerItem; |
| 546 } | 543 } |
| 547 pNewRecord->pCurPageSet->AddChild(pNewPageAreaLayoutItem); | 544 pNewRecord->pCurPageSet->AddChild(pNewPageAreaLayoutItem); |
| 548 pNewRecord->pCurPageArea = pNewPageAreaLayoutItem; | 545 pNewRecord->pCurPageArea = pNewPageAreaLayoutItem; |
| 549 pNewRecord->pCurContentArea = NULL; | 546 pNewRecord->pCurContentArea = nullptr; |
| 550 } | 547 } |
| 551 void CXFA_LayoutPageMgr::AddContentAreaLayoutItem( | 548 void CXFA_LayoutPageMgr::AddContentAreaLayoutItem( |
| 552 CXFA_ContainerRecord* pNewRecord, | 549 CXFA_ContainerRecord* pNewRecord, |
| 553 CXFA_Node* pContentArea) { | 550 CXFA_Node* pContentArea) { |
| 554 if (pContentArea == NULL) { | 551 if (!pContentArea) { |
| 555 pNewRecord->pCurContentArea = NULL; | 552 pNewRecord->pCurContentArea = nullptr; |
| 556 return; | 553 return; |
| 557 } | 554 } |
| 558 CXFA_ContainerLayoutItem* pNewContentAreaLayoutItem = | 555 CXFA_ContainerLayoutItem* pNewContentAreaLayoutItem = |
| 559 new CXFA_ContainerLayoutItem(pContentArea); | 556 new CXFA_ContainerLayoutItem(pContentArea); |
| 560 ASSERT(pNewRecord->pCurPageArea); | 557 ASSERT(pNewRecord->pCurPageArea); |
| 561 pNewRecord->pCurPageArea->AddChild(pNewContentAreaLayoutItem); | 558 pNewRecord->pCurPageArea->AddChild(pNewContentAreaLayoutItem); |
| 562 pNewRecord->pCurContentArea = pNewContentAreaLayoutItem; | 559 pNewRecord->pCurContentArea = pNewContentAreaLayoutItem; |
| 563 } | 560 } |
| 564 | 561 |
| 565 void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { | 562 void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { |
| 566 CXFA_ContainerLayoutItem* pRootPageSetLayoutItem = m_pPageSetLayoutItemRoot; | 563 CXFA_ContainerLayoutItem* pRootPageSetLayoutItem = m_pPageSetLayoutItemRoot; |
| 567 for (; pRootPageSetLayoutItem; | 564 for (; pRootPageSetLayoutItem; |
| 568 pRootPageSetLayoutItem = | 565 pRootPageSetLayoutItem = |
| 569 (CXFA_ContainerLayoutItem*)pRootPageSetLayoutItem->m_pNextSibling) { | 566 (CXFA_ContainerLayoutItem*)pRootPageSetLayoutItem->m_pNextSibling) { |
| 570 CXFA_NodeIteratorTemplate<CXFA_ContainerLayoutItem, | 567 CXFA_NodeIteratorTemplate<CXFA_ContainerLayoutItem, |
| 571 PageSetContainerLayoutItem> | 568 PageSetContainerLayoutItem> |
| 572 sIterator(pRootPageSetLayoutItem); | 569 sIterator(pRootPageSetLayoutItem); |
| 573 for (CXFA_ContainerLayoutItem* pPageSetLayoutItem = sIterator.GetCurrent(); | 570 for (CXFA_ContainerLayoutItem* pPageSetLayoutItem = sIterator.GetCurrent(); |
| 574 pPageSetLayoutItem; pPageSetLayoutItem = sIterator.MoveToNext()) { | 571 pPageSetLayoutItem; pPageSetLayoutItem = sIterator.MoveToNext()) { |
| 575 XFA_ATTRIBUTEENUM ePageRelation = | 572 XFA_ATTRIBUTEENUM ePageRelation = |
| 576 pPageSetLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Relation); | 573 pPageSetLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Relation); |
| 577 switch (ePageRelation) { | 574 switch (ePageRelation) { |
| 578 case XFA_ATTRIBUTEENUM_OrderedOccurrence: | 575 case XFA_ATTRIBUTEENUM_OrderedOccurrence: |
| 579 default: { ProcessLastPageSet(); } break; | 576 default: { ProcessLastPageSet(); } break; |
| 580 case XFA_ATTRIBUTEENUM_SimplexPaginated: | 577 case XFA_ATTRIBUTEENUM_SimplexPaginated: |
| 581 case XFA_ATTRIBUTEENUM_DuplexPaginated: { | 578 case XFA_ATTRIBUTEENUM_DuplexPaginated: { |
| 582 CXFA_LayoutItem* pLastPageAreaLayoutItem = NULL; | 579 CXFA_LayoutItem* pLastPageAreaLayoutItem = nullptr; |
| 583 int32_t nPageAreaCount = 0; | 580 int32_t nPageAreaCount = 0; |
| 584 for (CXFA_LayoutItem* pPageAreaLayoutItem = | 581 for (CXFA_LayoutItem* pPageAreaLayoutItem = |
| 585 pPageSetLayoutItem->m_pFirstChild; | 582 pPageSetLayoutItem->m_pFirstChild; |
| 586 pPageAreaLayoutItem; | 583 pPageAreaLayoutItem; |
| 587 pPageAreaLayoutItem = pPageAreaLayoutItem->m_pNextSibling) { | 584 pPageAreaLayoutItem = pPageAreaLayoutItem->m_pNextSibling) { |
| 588 if (pPageAreaLayoutItem->m_pFormNode->GetClassID() != | 585 if (pPageAreaLayoutItem->m_pFormNode->GetClassID() != |
| 589 XFA_ELEMENT_PageArea) { | 586 XFA_ELEMENT_PageArea) { |
| 590 continue; | 587 continue; |
| 591 } | 588 } |
| 592 nPageAreaCount++; | 589 nPageAreaCount++; |
| 593 pLastPageAreaLayoutItem = pPageAreaLayoutItem; | 590 pLastPageAreaLayoutItem = pPageAreaLayoutItem; |
| 594 } | 591 } |
| 595 if (!pLastPageAreaLayoutItem) { | 592 if (!pLastPageAreaLayoutItem) { |
| 596 break; | 593 break; |
| 597 } | 594 } |
| 598 if (!FindPageAreaFromPageSet_SimplexDuplex( | 595 if (!FindPageAreaFromPageSet_SimplexDuplex( |
| 599 pPageSetLayoutItem->m_pFormNode, NULL, NULL, NULL, TRUE, TRUE, | 596 pPageSetLayoutItem->m_pFormNode, nullptr, nullptr, nullptr, |
| 600 nPageAreaCount == 1 ? XFA_ATTRIBUTEENUM_Only | 597 TRUE, TRUE, nPageAreaCount == 1 ? XFA_ATTRIBUTEENUM_Only |
| 601 : XFA_ATTRIBUTEENUM_Last) && | 598 : XFA_ATTRIBUTEENUM_Last) && |
| 602 (nPageAreaCount == 1 && | 599 (nPageAreaCount == 1 && |
| 603 !FindPageAreaFromPageSet_SimplexDuplex( | 600 !FindPageAreaFromPageSet_SimplexDuplex( |
| 604 pPageSetLayoutItem->m_pFormNode, NULL, NULL, NULL, TRUE, | 601 pPageSetLayoutItem->m_pFormNode, nullptr, nullptr, nullptr, |
| 605 TRUE, XFA_ATTRIBUTEENUM_Last))) { | 602 TRUE, TRUE, XFA_ATTRIBUTEENUM_Last))) { |
| 606 break; | 603 break; |
| 607 } | 604 } |
| 608 CXFA_Node* pNode = m_pCurPageArea; | 605 CXFA_Node* pNode = m_pCurPageArea; |
| 609 XFA_ATTRIBUTEENUM eCurChoice = | 606 XFA_ATTRIBUTEENUM eCurChoice = |
| 610 pNode->GetEnum(XFA_ATTRIBUTE_PagePosition); | 607 pNode->GetEnum(XFA_ATTRIBUTE_PagePosition); |
| 611 if (eCurChoice == XFA_ATTRIBUTEENUM_Last) { | 608 if (eCurChoice == XFA_ATTRIBUTEENUM_Last) { |
| 612 XFA_ATTRIBUTEENUM eOddOrEven = XFA_ATTRIBUTEENUM_Any; | 609 XFA_ATTRIBUTEENUM eOddOrEven = XFA_ATTRIBUTEENUM_Any; |
| 613 pNode->TryEnum(XFA_ATTRIBUTE_OddOrEven, eOddOrEven); | 610 pNode->TryEnum(XFA_ATTRIBUTE_OddOrEven, eOddOrEven); |
| 614 XFA_ATTRIBUTEENUM eLastChoice = | 611 XFA_ATTRIBUTEENUM eLastChoice = |
| 615 pLastPageAreaLayoutItem->m_pFormNode->GetEnum( | 612 pLastPageAreaLayoutItem->m_pFormNode->GetEnum( |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 return m_PageArray.Find(const_cast<CXFA_ContainerLayoutItem*>(pPage)); | 706 return m_PageArray.Find(const_cast<CXFA_ContainerLayoutItem*>(pPage)); |
| 710 } | 707 } |
| 711 FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_ELEMENT eBreakType, | 708 FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_ELEMENT eBreakType, |
| 712 XFA_ATTRIBUTEENUM eTargetType, | 709 XFA_ATTRIBUTEENUM eTargetType, |
| 713 CXFA_Node* pTarget, | 710 CXFA_Node* pTarget, |
| 714 FX_BOOL bStartNew) { | 711 FX_BOOL bStartNew) { |
| 715 FX_BOOL bRet = FALSE; | 712 FX_BOOL bRet = FALSE; |
| 716 switch (eTargetType) { | 713 switch (eTargetType) { |
| 717 case XFA_ATTRIBUTEENUM_ContentArea: | 714 case XFA_ATTRIBUTEENUM_ContentArea: |
| 718 if (pTarget && pTarget->GetClassID() != XFA_ELEMENT_ContentArea) { | 715 if (pTarget && pTarget->GetClassID() != XFA_ELEMENT_ContentArea) { |
| 719 pTarget = NULL; | 716 pTarget = nullptr; |
| 720 } | 717 } |
| 721 if (!pTarget || !m_pCurrentContainerRecord || | 718 if (!pTarget || !m_pCurrentContainerRecord || |
| 722 pTarget != | 719 pTarget != |
| 723 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode || | 720 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode || |
| 724 bStartNew) { | 721 bStartNew) { |
| 725 CXFA_Node* pPageArea = NULL; | 722 CXFA_Node* pPageArea = nullptr; |
| 726 if (pTarget) { | 723 if (pTarget) { |
| 727 pPageArea = pTarget->GetNodeItem(XFA_NODEITEM_Parent); | 724 pPageArea = pTarget->GetNodeItem(XFA_NODEITEM_Parent); |
| 728 } | 725 } |
| 729 pPageArea = GetNextAvailPageArea(pPageArea, pTarget); | 726 pPageArea = GetNextAvailPageArea(pPageArea, pTarget); |
| 730 bRet = pPageArea != NULL; | 727 bRet = !!pPageArea; |
| 731 } | 728 } |
| 732 break; | 729 break; |
| 733 case XFA_ATTRIBUTEENUM_PageArea: | 730 case XFA_ATTRIBUTEENUM_PageArea: |
| 734 if (pTarget && pTarget->GetClassID() != XFA_ELEMENT_PageArea) { | 731 if (pTarget && pTarget->GetClassID() != XFA_ELEMENT_PageArea) { |
| 735 pTarget = NULL; | 732 pTarget = nullptr; |
| 736 } | 733 } |
| 737 if (!pTarget || !m_pCurrentContainerRecord || | 734 if (!pTarget || !m_pCurrentContainerRecord || |
| 738 pTarget != GetCurrentContainerRecord()->pCurPageArea->m_pFormNode || | 735 pTarget != GetCurrentContainerRecord()->pCurPageArea->m_pFormNode || |
| 739 bStartNew) { | 736 bStartNew) { |
| 740 CXFA_Node* pPageArea = GetNextAvailPageArea(pTarget, NULL, TRUE); | 737 CXFA_Node* pPageArea = GetNextAvailPageArea(pTarget, nullptr, TRUE); |
| 741 bRet = pPageArea != NULL; | 738 bRet = !!pPageArea; |
| 742 } | 739 } |
| 743 break; | 740 break; |
| 744 case XFA_ATTRIBUTEENUM_PageOdd: | 741 case XFA_ATTRIBUTEENUM_PageOdd: |
| 745 if (pTarget && pTarget->GetClassID() != XFA_ELEMENT_PageArea) { | 742 if (pTarget && pTarget->GetClassID() != XFA_ELEMENT_PageArea) { |
| 746 pTarget = NULL; | 743 pTarget = nullptr; |
| 747 } | 744 } |
| 748 break; | 745 break; |
| 749 case XFA_ATTRIBUTEENUM_PageEven: | 746 case XFA_ATTRIBUTEENUM_PageEven: |
| 750 if (pTarget && pTarget->GetClassID() != XFA_ELEMENT_PageArea) { | 747 if (pTarget && pTarget->GetClassID() != XFA_ELEMENT_PageArea) { |
| 751 pTarget = NULL; | 748 pTarget = nullptr; |
| 752 } | 749 } |
| 753 break; | 750 break; |
| 754 case XFA_ATTRIBUTEENUM_Auto: | 751 case XFA_ATTRIBUTEENUM_Auto: |
| 755 default: | 752 default: |
| 756 break; | 753 break; |
| 757 } | 754 } |
| 758 return bRet; | 755 return bRet; |
| 759 } | 756 } |
| 760 FX_BOOL CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( | 757 FX_BOOL CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( |
| 761 CXFA_Node* pCurNode, | 758 CXFA_Node* pCurNode, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 } | 823 } |
| 827 return FALSE; | 824 return FALSE; |
| 828 } | 825 } |
| 829 | 826 |
| 830 FX_BOOL CXFA_LayoutPageMgr::ProcessBreakBeforeOrAfter( | 827 FX_BOOL CXFA_LayoutPageMgr::ProcessBreakBeforeOrAfter( |
| 831 CXFA_Node* pBreakNode, | 828 CXFA_Node* pBreakNode, |
| 832 FX_BOOL bBefore, | 829 FX_BOOL bBefore, |
| 833 CXFA_Node*& pBreakLeaderNode, | 830 CXFA_Node*& pBreakLeaderNode, |
| 834 CXFA_Node*& pBreakTrailerNode, | 831 CXFA_Node*& pBreakTrailerNode, |
| 835 FX_BOOL& bCreatePage) { | 832 FX_BOOL& bCreatePage) { |
| 836 CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; | 833 CXFA_Node *pLeaderTemplate = nullptr, *pTrailerTemplate = nullptr; |
| 837 CXFA_Node* pFormNode = pBreakNode->GetNodeItem(XFA_NODEITEM_Parent, | 834 CXFA_Node* pFormNode = pBreakNode->GetNodeItem(XFA_NODEITEM_Parent, |
| 838 XFA_OBJECTTYPE_ContainerNode); | 835 XFA_OBJECTTYPE_ContainerNode); |
| 839 if (XFA_ItemLayoutProcessor_IsTakingSpace(pFormNode)) { | 836 if (XFA_ItemLayoutProcessor_IsTakingSpace(pFormNode)) { |
| 840 bCreatePage = ExecuteBreakBeforeOrAfter(pBreakNode, bBefore, | 837 bCreatePage = ExecuteBreakBeforeOrAfter(pBreakNode, bBefore, |
| 841 pLeaderTemplate, pTrailerTemplate); | 838 pLeaderTemplate, pTrailerTemplate); |
| 842 CXFA_Document* pDocument = pBreakNode->GetDocument(); | 839 CXFA_Document* pDocument = pBreakNode->GetDocument(); |
| 843 CXFA_Node* pDataScope = NULL; | 840 CXFA_Node* pDataScope = nullptr; |
| 844 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent, | 841 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent, |
| 845 XFA_OBJECTTYPE_ContainerNode); | 842 XFA_OBJECTTYPE_ContainerNode); |
| 846 if (pLeaderTemplate) { | 843 if (pLeaderTemplate) { |
| 847 if (!pDataScope) { | 844 if (!pDataScope) { |
| 848 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 845 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); |
| 849 } | 846 } |
| 850 pBreakLeaderNode = pDocument->DataMerge_CopyContainer( | 847 pBreakLeaderNode = pDocument->DataMerge_CopyContainer( |
| 851 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 848 pLeaderTemplate, pFormNode, pDataScope, TRUE); |
| 852 pDocument->DataMerge_UpdateBindingRelations(pBreakLeaderNode); | 849 pDocument->DataMerge_UpdateBindingRelations(pBreakLeaderNode); |
| 853 SetLayoutGeneratedNodeFlag(pBreakLeaderNode); | 850 SetLayoutGeneratedNodeFlag(pBreakLeaderNode); |
| 854 } | 851 } |
| 855 if (pTrailerTemplate) { | 852 if (pTrailerTemplate) { |
| 856 if (!pDataScope) { | 853 if (!pDataScope) { |
| 857 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 854 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); |
| 858 } | 855 } |
| 859 pBreakTrailerNode = pDocument->DataMerge_CopyContainer( | 856 pBreakTrailerNode = pDocument->DataMerge_CopyContainer( |
| 860 pTrailerTemplate, pFormNode, pDataScope, TRUE); | 857 pTrailerTemplate, pFormNode, pDataScope, TRUE); |
| 861 pDocument->DataMerge_UpdateBindingRelations(pBreakTrailerNode); | 858 pDocument->DataMerge_UpdateBindingRelations(pBreakTrailerNode); |
| 862 SetLayoutGeneratedNodeFlag(pBreakTrailerNode); | 859 SetLayoutGeneratedNodeFlag(pBreakTrailerNode); |
| 863 } | 860 } |
| 864 return TRUE; | 861 return TRUE; |
| 865 } | 862 } |
| 866 return FALSE; | 863 return FALSE; |
| 867 } | 864 } |
| 868 FX_BOOL CXFA_LayoutPageMgr::ProcessBookendLeaderOrTrailer( | 865 FX_BOOL CXFA_LayoutPageMgr::ProcessBookendLeaderOrTrailer( |
| 869 CXFA_Node* pBookendNode, | 866 CXFA_Node* pBookendNode, |
| 870 FX_BOOL bLeader, | 867 FX_BOOL bLeader, |
| 871 CXFA_Node*& pBookendAppendNode) { | 868 CXFA_Node*& pBookendAppendNode) { |
| 872 CXFA_Node* pLeaderTemplate = NULL; | 869 CXFA_Node* pLeaderTemplate = nullptr; |
| 873 CXFA_Node* pFormNode = pBookendNode->GetNodeItem( | 870 CXFA_Node* pFormNode = pBookendNode->GetNodeItem( |
| 874 XFA_NODEITEM_Parent, XFA_OBJECTTYPE_ContainerNode); | 871 XFA_NODEITEM_Parent, XFA_OBJECTTYPE_ContainerNode); |
| 875 if (ResolveBookendLeaderOrTrailer(pBookendNode, bLeader, pLeaderTemplate)) { | 872 if (ResolveBookendLeaderOrTrailer(pBookendNode, bLeader, pLeaderTemplate)) { |
| 876 CXFA_Document* pDocument = pBookendNode->GetDocument(); | 873 CXFA_Document* pDocument = pBookendNode->GetDocument(); |
| 877 CXFA_Node* pDataScope = NULL; | 874 CXFA_Node* pDataScope = nullptr; |
| 878 if (pLeaderTemplate) { | 875 if (pLeaderTemplate) { |
| 879 if (!pDataScope) { | 876 if (!pDataScope) { |
| 880 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 877 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); |
| 881 } | 878 } |
| 882 pBookendAppendNode = pDocument->DataMerge_CopyContainer( | 879 pBookendAppendNode = pDocument->DataMerge_CopyContainer( |
| 883 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 880 pLeaderTemplate, pFormNode, pDataScope, TRUE); |
| 884 pDocument->DataMerge_UpdateBindingRelations(pBookendAppendNode); | 881 pDocument->DataMerge_UpdateBindingRelations(pBookendAppendNode); |
| 885 SetLayoutGeneratedNodeFlag(pBookendAppendNode); | 882 SetLayoutGeneratedNodeFlag(pBookendAppendNode); |
| 886 return TRUE; | 883 return TRUE; |
| 887 } | 884 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 } | 923 } |
| 927 } | 924 } |
| 928 if (!bCreatePage) { | 925 if (!bCreatePage) { |
| 929 pLeaderTemplate = | 926 pLeaderTemplate = |
| 930 ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); | 927 ResolveBreakTarget(pContainer, TRUE, wsOverflowLeader); |
| 931 pTrailerTemplate = | 928 pTrailerTemplate = |
| 932 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); | 929 ResolveBreakTarget(pContainer, TRUE, wsOverflowTrailer); |
| 933 } | 930 } |
| 934 return pOverflowNode; | 931 return pOverflowNode; |
| 935 } | 932 } |
| 936 return NULL; | 933 return nullptr; |
| 937 } else if (pOverflowNode->GetClassID() == XFA_ELEMENT_Overflow) { | 934 } else if (pOverflowNode->GetClassID() == XFA_ELEMENT_Overflow) { |
| 938 CFX_WideStringC wsOverflowLeader; | 935 CFX_WideStringC wsOverflowLeader; |
| 939 CFX_WideStringC wsOverflowTrailer; | 936 CFX_WideStringC wsOverflowTrailer; |
| 940 CFX_WideStringC wsOverflowTarget; | 937 CFX_WideStringC wsOverflowTarget; |
| 941 pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); | 938 pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); |
| 942 pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); | 939 pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); |
| 943 pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget); | 940 pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget); |
| 944 if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) { | 941 if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) { |
| 945 CXFA_Node* pTarget = | 942 CXFA_Node* pTarget = |
| 946 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); | 943 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsOverflowTarget); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 968 return pOverflowNode; | 965 return pOverflowNode; |
| 969 } | 966 } |
| 970 return nullptr; | 967 return nullptr; |
| 971 } | 968 } |
| 972 | 969 |
| 973 FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, | 970 FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, |
| 974 CXFA_Node*& pLeaderNode, | 971 CXFA_Node*& pLeaderNode, |
| 975 CXFA_Node*& pTrailerNode, | 972 CXFA_Node*& pTrailerNode, |
| 976 FX_BOOL bDataMerge, | 973 FX_BOOL bDataMerge, |
| 977 FX_BOOL bCreatePage) { | 974 FX_BOOL bCreatePage) { |
| 978 if (pFormNode == NULL) { | 975 if (!pFormNode) |
| 979 return FALSE; | 976 return FALSE; |
| 980 } | 977 |
| 981 CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; | 978 CXFA_Node *pLeaderTemplate = nullptr, *pTrailerTemplate = nullptr; |
| 982 FX_BOOL bIsOverflowNode = FALSE; | 979 FX_BOOL bIsOverflowNode = FALSE; |
| 983 if (pFormNode->GetClassID() == XFA_ELEMENT_Overflow || | 980 if (pFormNode->GetClassID() == XFA_ELEMENT_Overflow || |
| 984 pFormNode->GetClassID() == XFA_ELEMENT_Break) { | 981 pFormNode->GetClassID() == XFA_ELEMENT_Break) { |
| 985 bIsOverflowNode = TRUE; | 982 bIsOverflowNode = TRUE; |
| 986 } | 983 } |
| 987 for (CXFA_Node* pCurNode = | 984 for (CXFA_Node* pCurNode = |
| 988 bIsOverflowNode ? pFormNode | 985 bIsOverflowNode ? pFormNode |
| 989 : pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 986 : pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 990 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { | 987 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { |
| 991 if (BreakOverflow(pCurNode, pLeaderTemplate, pTrailerTemplate, | 988 if (BreakOverflow(pCurNode, pLeaderTemplate, pTrailerTemplate, |
| 992 bCreatePage)) { | 989 bCreatePage)) { |
| 993 if (bIsOverflowNode) { | 990 if (bIsOverflowNode) { |
| 994 pFormNode = pCurNode->GetNodeItem(XFA_NODEITEM_Parent); | 991 pFormNode = pCurNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 995 } | 992 } |
| 996 CXFA_Document* pDocument = pCurNode->GetDocument(); | 993 CXFA_Document* pDocument = pCurNode->GetDocument(); |
| 997 CXFA_Node* pDataScope = NULL; | 994 CXFA_Node* pDataScope = nullptr; |
| 998 if (pLeaderTemplate) { | 995 if (pLeaderTemplate) { |
| 999 if (!pDataScope) { | 996 if (!pDataScope) { |
| 1000 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 997 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); |
| 1001 } | 998 } |
| 1002 pLeaderNode = pDocument->DataMerge_CopyContainer( | 999 pLeaderNode = pDocument->DataMerge_CopyContainer( |
| 1003 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 1000 pLeaderTemplate, pFormNode, pDataScope, TRUE); |
| 1004 pDocument->DataMerge_UpdateBindingRelations(pLeaderNode); | 1001 pDocument->DataMerge_UpdateBindingRelations(pLeaderNode); |
| 1005 SetLayoutGeneratedNodeFlag(pLeaderNode); | 1002 SetLayoutGeneratedNodeFlag(pLeaderNode); |
| 1006 } | 1003 } |
| 1007 if (pTrailerTemplate) { | 1004 if (pTrailerTemplate) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 } | 1047 } |
| 1051 return FALSE; | 1048 return FALSE; |
| 1052 } | 1049 } |
| 1053 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet( | 1050 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet( |
| 1054 CXFA_Node* pPageSet, | 1051 CXFA_Node* pPageSet, |
| 1055 CXFA_Node* pStartChild, | 1052 CXFA_Node* pStartChild, |
| 1056 CXFA_Node* pTargetPageArea, | 1053 CXFA_Node* pTargetPageArea, |
| 1057 CXFA_Node* pTargetContentArea, | 1054 CXFA_Node* pTargetContentArea, |
| 1058 FX_BOOL bNewPage, | 1055 FX_BOOL bNewPage, |
| 1059 FX_BOOL bQuery) { | 1056 FX_BOOL bQuery) { |
| 1060 if (pPageSet == NULL && pStartChild == NULL) { | 1057 if (!pPageSet && !pStartChild) |
| 1061 return FALSE; | 1058 return FALSE; |
| 1062 } | 1059 |
| 1063 if (IsPageSetRootOrderedOccurrence()) { | 1060 if (IsPageSetRootOrderedOccurrence()) { |
| 1064 return FindPageAreaFromPageSet_Ordered(pPageSet, pStartChild, | 1061 return FindPageAreaFromPageSet_Ordered(pPageSet, pStartChild, |
| 1065 pTargetPageArea, pTargetContentArea, | 1062 pTargetPageArea, pTargetContentArea, |
| 1066 bNewPage, bQuery); | 1063 bNewPage, bQuery); |
| 1067 } | 1064 } |
| 1068 XFA_ATTRIBUTEENUM ePreferredPosition = m_pCurrentContainerRecord | 1065 XFA_ATTRIBUTEENUM ePreferredPosition = m_pCurrentContainerRecord |
| 1069 ? XFA_ATTRIBUTEENUM_Rest | 1066 ? XFA_ATTRIBUTEENUM_Rest |
| 1070 : XFA_ATTRIBUTEENUM_First; | 1067 : XFA_ATTRIBUTEENUM_First; |
| 1071 return FindPageAreaFromPageSet_SimplexDuplex( | 1068 return FindPageAreaFromPageSet_SimplexDuplex( |
| 1072 pPageSet, pStartChild, pTargetPageArea, pTargetContentArea, bNewPage, | 1069 pPageSet, pStartChild, pTargetPageArea, pTargetContentArea, bNewPage, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1091 return FALSE; | 1088 return FALSE; |
| 1092 } | 1089 } |
| 1093 } | 1090 } |
| 1094 FX_BOOL bRes = FALSE; | 1091 FX_BOOL bRes = FALSE; |
| 1095 CXFA_Node* pCurrentNode = | 1092 CXFA_Node* pCurrentNode = |
| 1096 pStartChild ? pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling) | 1093 pStartChild ? pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling) |
| 1097 : pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); | 1094 : pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1098 for (; pCurrentNode; | 1095 for (; pCurrentNode; |
| 1099 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1096 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1100 if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageArea) { | 1097 if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageArea) { |
| 1101 if ((pTargetPageArea == pCurrentNode || pTargetPageArea == NULL)) { | 1098 if ((pTargetPageArea == pCurrentNode || !pTargetPageArea)) { |
| 1102 if (pCurrentNode->GetFirstChildByClass(XFA_ELEMENT_ContentArea) == | 1099 if (!pCurrentNode->GetFirstChildByClass(XFA_ELEMENT_ContentArea)) { |
| 1103 NULL) { | |
| 1104 if (pTargetPageArea == pCurrentNode) { | 1100 if (pTargetPageArea == pCurrentNode) { |
| 1105 CreateMinPageRecord(pCurrentNode, TRUE); | 1101 CreateMinPageRecord(pCurrentNode, TRUE); |
| 1106 pTargetPageArea = NULL; | 1102 pTargetPageArea = nullptr; |
| 1107 } | 1103 } |
| 1108 continue; | 1104 continue; |
| 1109 } | 1105 } |
| 1110 if (!bQuery) { | 1106 if (!bQuery) { |
| 1111 CXFA_ContainerRecord* pNewRecord = | 1107 CXFA_ContainerRecord* pNewRecord = |
| 1112 CreateContainerRecord(pCurrentNode, pStartChild == NULL); | 1108 CreateContainerRecord(pCurrentNode, !pStartChild); |
| 1113 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 1109 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); |
| 1114 if (pTargetContentArea == NULL) { | 1110 if (!pTargetContentArea) { |
| 1115 pTargetContentArea = | 1111 pTargetContentArea = |
| 1116 pCurrentNode->GetFirstChildByClass(XFA_ELEMENT_ContentArea); | 1112 pCurrentNode->GetFirstChildByClass(XFA_ELEMENT_ContentArea); |
| 1117 } | 1113 } |
| 1118 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); | 1114 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); |
| 1119 } | 1115 } |
| 1120 m_pCurPageArea = pCurrentNode; | 1116 m_pCurPageArea = pCurrentNode; |
| 1121 m_nCurPageCount = 1; | 1117 m_nCurPageCount = 1; |
| 1122 bRes = TRUE; | 1118 bRes = TRUE; |
| 1123 break; | 1119 break; |
| 1124 } | 1120 } |
| 1125 if (!bQuery) { | 1121 if (!bQuery) { |
| 1126 CreateMinPageRecord(pCurrentNode, FALSE); | 1122 CreateMinPageRecord(pCurrentNode, FALSE); |
| 1127 } | 1123 } |
| 1128 } else if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageSet) { | 1124 } else if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageSet) { |
| 1129 if (FindPageAreaFromPageSet_Ordered(pCurrentNode, NULL, pTargetPageArea, | 1125 if (FindPageAreaFromPageSet_Ordered(pCurrentNode, nullptr, |
| 1130 pTargetContentArea, bNewPage, | 1126 pTargetPageArea, pTargetContentArea, |
| 1131 bQuery)) { | 1127 bNewPage, bQuery)) { |
| 1132 bRes = TRUE; | 1128 bRes = TRUE; |
| 1133 break; | 1129 break; |
| 1134 } | 1130 } |
| 1135 if (!bQuery) { | 1131 if (!bQuery) { |
| 1136 CreateMinPageSetRecord(pCurrentNode, TRUE); | 1132 CreateMinPageSetRecord(pCurrentNode, TRUE); |
| 1137 } | 1133 } |
| 1138 } | 1134 } |
| 1139 } | 1135 } |
| 1140 if (!pStartChild && bRes && !bQuery) { | 1136 if (!pStartChild && bRes && !bQuery) { |
| 1141 m_pPageSetMap.SetAt(pPageSet, ++iPageSetCount); | 1137 m_pPageSetMap.SetAt(pPageSet, ++iPageSetCount); |
| 1142 } | 1138 } |
| 1143 return bRes; | 1139 return bRes; |
| 1144 } | 1140 } |
| 1145 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( | 1141 FX_BOOL CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( |
| 1146 CXFA_Node* pPageSet, | 1142 CXFA_Node* pPageSet, |
| 1147 CXFA_Node* pStartChild, | 1143 CXFA_Node* pStartChild, |
| 1148 CXFA_Node* pTargetPageArea, | 1144 CXFA_Node* pTargetPageArea, |
| 1149 CXFA_Node* pTargetContentArea, | 1145 CXFA_Node* pTargetContentArea, |
| 1150 FX_BOOL bNewPage, | 1146 FX_BOOL bNewPage, |
| 1151 FX_BOOL bQuery, | 1147 FX_BOOL bQuery, |
| 1152 XFA_ATTRIBUTEENUM ePreferredPosition) { | 1148 XFA_ATTRIBUTEENUM ePreferredPosition) { |
| 1153 const XFA_ATTRIBUTEENUM eFallbackPosition = XFA_ATTRIBUTEENUM_Any; | 1149 const XFA_ATTRIBUTEENUM eFallbackPosition = XFA_ATTRIBUTEENUM_Any; |
| 1154 CXFA_Node *pPreferredPageArea = NULL, *pFallbackPageArea = NULL; | 1150 CXFA_Node *pPreferredPageArea = nullptr, *pFallbackPageArea = nullptr; |
| 1155 CXFA_Node* pCurrentNode = NULL; | 1151 CXFA_Node* pCurrentNode = nullptr; |
| 1156 if (!pStartChild || pStartChild->GetClassID() == XFA_ELEMENT_PageArea) { | 1152 if (!pStartChild || pStartChild->GetClassID() == XFA_ELEMENT_PageArea) { |
| 1157 pCurrentNode = pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); | 1153 pCurrentNode = pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1158 } else { | 1154 } else { |
| 1159 pCurrentNode = pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling); | 1155 pCurrentNode = pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 1160 } | 1156 } |
| 1161 for (; pCurrentNode; | 1157 for (; pCurrentNode; |
| 1162 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1158 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1163 if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageArea) { | 1159 if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageArea) { |
| 1164 if (!MatchPageAreaOddOrEven(pCurrentNode, FALSE)) { | 1160 if (!MatchPageAreaOddOrEven(pCurrentNode, FALSE)) { |
| 1165 continue; | 1161 continue; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1187 continue; | 1183 continue; |
| 1188 } | 1184 } |
| 1189 if (m_ePageSetMode != XFA_ATTRIBUTEENUM_DuplexPaginated || | 1185 if (m_ePageSetMode != XFA_ATTRIBUTEENUM_DuplexPaginated || |
| 1190 pCurrentNode->GetEnum(XFA_ATTRIBUTE_OddOrEven) == | 1186 pCurrentNode->GetEnum(XFA_ATTRIBUTE_OddOrEven) == |
| 1191 XFA_ATTRIBUTEENUM_Any) { | 1187 XFA_ATTRIBUTEENUM_Any) { |
| 1192 pPreferredPageArea = pCurrentNode; | 1188 pPreferredPageArea = pCurrentNode; |
| 1193 break; | 1189 break; |
| 1194 } | 1190 } |
| 1195 return FALSE; | 1191 return FALSE; |
| 1196 } | 1192 } |
| 1197 if ((pTargetPageArea == pCurrentNode || pTargetPageArea == NULL)) { | 1193 if ((pTargetPageArea == pCurrentNode || !pTargetPageArea)) { |
| 1198 if (pCurrentNode->GetFirstChildByClass(XFA_ELEMENT_ContentArea) == | 1194 if (pCurrentNode->GetFirstChildByClass(XFA_ELEMENT_ContentArea) == |
| 1199 NULL) { | 1195 nullptr) { |
| 1200 if (pTargetPageArea == pCurrentNode) { | 1196 if (pTargetPageArea == pCurrentNode) { |
| 1201 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1197 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); |
| 1202 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 1198 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); |
| 1203 pTargetPageArea = NULL; | 1199 pTargetPageArea = nullptr; |
| 1204 } | 1200 } |
| 1205 continue; | 1201 continue; |
| 1206 } | 1202 } |
| 1207 if ((ePreferredPosition == XFA_ATTRIBUTEENUM_Rest && | 1203 if ((ePreferredPosition == XFA_ATTRIBUTEENUM_Rest && |
| 1208 eCurPagePosition == XFA_ATTRIBUTEENUM_Any) || | 1204 eCurPagePosition == XFA_ATTRIBUTEENUM_Any) || |
| 1209 eCurPagePosition == ePreferredPosition) { | 1205 eCurPagePosition == ePreferredPosition) { |
| 1210 pPreferredPageArea = pCurrentNode; | 1206 pPreferredPageArea = pCurrentNode; |
| 1211 break; | 1207 break; |
| 1212 } else if (eCurPagePosition == eFallbackPosition && | 1208 } else if (eCurPagePosition == eFallbackPosition && |
| 1213 !pFallbackPageArea) { | 1209 !pFallbackPageArea) { |
| 1214 pFallbackPageArea = pCurrentNode; | 1210 pFallbackPageArea = pCurrentNode; |
| 1215 } | 1211 } |
| 1216 } else if (pTargetPageArea && | 1212 } else if (pTargetPageArea && |
| 1217 !MatchPageAreaOddOrEven(pTargetPageArea, FALSE)) { | 1213 !MatchPageAreaOddOrEven(pTargetPageArea, FALSE)) { |
| 1218 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1214 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); |
| 1219 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); | 1215 AddPageAreaLayoutItem(pNewRecord, pCurrentNode); |
| 1220 AddContentAreaLayoutItem(pNewRecord, pCurrentNode->GetFirstChildByClass( | 1216 AddContentAreaLayoutItem(pNewRecord, pCurrentNode->GetFirstChildByClass( |
| 1221 XFA_ELEMENT_ContentArea)); | 1217 XFA_ELEMENT_ContentArea)); |
| 1222 } | 1218 } |
| 1223 } else if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageSet) { | 1219 } else if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageSet) { |
| 1224 if (FindPageAreaFromPageSet_SimplexDuplex( | 1220 if (FindPageAreaFromPageSet_SimplexDuplex( |
| 1225 pCurrentNode, NULL, pTargetPageArea, pTargetContentArea, bNewPage, | 1221 pCurrentNode, nullptr, pTargetPageArea, pTargetContentArea, |
| 1226 bQuery, ePreferredPosition)) { | 1222 bNewPage, bQuery, ePreferredPosition)) { |
| 1227 break; | 1223 break; |
| 1228 } | 1224 } |
| 1229 } | 1225 } |
| 1230 } | 1226 } |
| 1231 CXFA_Node* pCurPageArea = NULL; | 1227 CXFA_Node* pCurPageArea = nullptr; |
| 1232 if (pPreferredPageArea) { | 1228 if (pPreferredPageArea) { |
| 1233 pCurPageArea = pPreferredPageArea; | 1229 pCurPageArea = pPreferredPageArea; |
| 1234 } else if (pFallbackPageArea) { | 1230 } else if (pFallbackPageArea) { |
| 1235 pCurPageArea = pFallbackPageArea; | 1231 pCurPageArea = pFallbackPageArea; |
| 1236 } | 1232 } |
| 1237 if (!pCurPageArea) { | 1233 if (!pCurPageArea) { |
| 1238 return FALSE; | 1234 return FALSE; |
| 1239 } | 1235 } |
| 1240 if (!bQuery) { | 1236 if (!bQuery) { |
| 1241 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1237 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); |
| 1242 AddPageAreaLayoutItem(pNewRecord, pCurPageArea); | 1238 AddPageAreaLayoutItem(pNewRecord, pCurPageArea); |
| 1243 if (pTargetContentArea == NULL) { | 1239 if (!pTargetContentArea) { |
| 1244 pTargetContentArea = | 1240 pTargetContentArea = |
| 1245 pCurPageArea->GetFirstChildByClass(XFA_ELEMENT_ContentArea); | 1241 pCurPageArea->GetFirstChildByClass(XFA_ELEMENT_ContentArea); |
| 1246 } | 1242 } |
| 1247 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); | 1243 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); |
| 1248 } | 1244 } |
| 1249 m_pCurPageArea = pCurPageArea; | 1245 m_pCurPageArea = pCurPageArea; |
| 1250 return TRUE; | 1246 return TRUE; |
| 1251 } | 1247 } |
| 1252 FX_BOOL CXFA_LayoutPageMgr::MatchPageAreaOddOrEven(CXFA_Node* pPageArea, | 1248 FX_BOOL CXFA_LayoutPageMgr::MatchPageAreaOddOrEven(CXFA_Node* pPageArea, |
| 1253 FX_BOOL bLastMatch) { | 1249 FX_BOOL bLastMatch) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1265 return eOddOrEven == XFA_ATTRIBUTEENUM_Odd ? iPageCount % 2 == 0 | 1261 return eOddOrEven == XFA_ATTRIBUTEENUM_Odd ? iPageCount % 2 == 0 |
| 1266 : iPageCount % 2 == 1; | 1262 : iPageCount % 2 == 1; |
| 1267 } | 1263 } |
| 1268 return TRUE; | 1264 return TRUE; |
| 1269 } | 1265 } |
| 1270 CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea( | 1266 CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea( |
| 1271 CXFA_Node* pTargetPageArea, | 1267 CXFA_Node* pTargetPageArea, |
| 1272 CXFA_Node* pTargetContentArea, | 1268 CXFA_Node* pTargetContentArea, |
| 1273 FX_BOOL bNewPage, | 1269 FX_BOOL bNewPage, |
| 1274 FX_BOOL bQuery) { | 1270 FX_BOOL bQuery) { |
| 1275 if (m_pCurPageArea == NULL) { | 1271 if (!m_pCurPageArea) { |
| 1276 FindPageAreaFromPageSet(m_pTemplatePageSetRoot, NULL, pTargetPageArea, | 1272 FindPageAreaFromPageSet(m_pTemplatePageSetRoot, nullptr, pTargetPageArea, |
| 1277 pTargetContentArea, bNewPage, bQuery); | 1273 pTargetContentArea, bNewPage, bQuery); |
| 1278 ASSERT(m_pCurPageArea); | 1274 ASSERT(m_pCurPageArea); |
| 1279 return m_pCurPageArea; | 1275 return m_pCurPageArea; |
| 1280 } | 1276 } |
| 1281 if (pTargetPageArea == NULL || pTargetPageArea == m_pCurPageArea) { | 1277 if (!pTargetPageArea || pTargetPageArea == m_pCurPageArea) { |
| 1282 if (!bNewPage && GetNextContentArea(pTargetContentArea)) { | 1278 if (!bNewPage && GetNextContentArea(pTargetContentArea)) { |
| 1283 return m_pCurPageArea; | 1279 return m_pCurPageArea; |
| 1284 } | 1280 } |
| 1285 if (IsPageSetRootOrderedOccurrence()) { | 1281 if (IsPageSetRootOrderedOccurrence()) { |
| 1286 int32_t iMax = -1; | 1282 int32_t iMax = -1; |
| 1287 CXFA_Node* pOccurNode = | 1283 CXFA_Node* pOccurNode = |
| 1288 m_pCurPageArea->GetFirstChildByClass(XFA_ELEMENT_Occur); | 1284 m_pCurPageArea->GetFirstChildByClass(XFA_ELEMENT_Occur); |
| 1289 if (pOccurNode) { | 1285 if (pOccurNode) { |
| 1290 pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE); | 1286 pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE); |
| 1291 } | 1287 } |
| 1292 if ((iMax < 0 || m_nCurPageCount < iMax)) { | 1288 if ((iMax < 0 || m_nCurPageCount < iMax)) { |
| 1293 if (!bQuery) { | 1289 if (!bQuery) { |
| 1294 CXFA_ContainerRecord* pNewRecord = | 1290 CXFA_ContainerRecord* pNewRecord = |
| 1295 CreateContainerRecord(m_pCurPageArea); | 1291 CreateContainerRecord(m_pCurPageArea); |
| 1296 AddPageAreaLayoutItem(pNewRecord, m_pCurPageArea); | 1292 AddPageAreaLayoutItem(pNewRecord, m_pCurPageArea); |
| 1297 if (pTargetContentArea == NULL) { | 1293 if (!pTargetContentArea) { |
| 1298 pTargetContentArea = | 1294 pTargetContentArea = |
| 1299 m_pCurPageArea->GetFirstChildByClass(XFA_ELEMENT_ContentArea); | 1295 m_pCurPageArea->GetFirstChildByClass(XFA_ELEMENT_ContentArea); |
| 1300 } | 1296 } |
| 1301 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); | 1297 AddContentAreaLayoutItem(pNewRecord, pTargetContentArea); |
| 1302 } | 1298 } |
| 1303 m_nCurPageCount++; | 1299 m_nCurPageCount++; |
| 1304 return m_pCurPageArea; | 1300 return m_pCurPageArea; |
| 1305 } | 1301 } |
| 1306 } | 1302 } |
| 1307 } | 1303 } |
| 1308 if (!bQuery && IsPageSetRootOrderedOccurrence()) { | 1304 if (!bQuery && IsPageSetRootOrderedOccurrence()) { |
| 1309 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); | 1305 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); |
| 1310 } | 1306 } |
| 1311 if (FindPageAreaFromPageSet(m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent), | 1307 if (FindPageAreaFromPageSet(m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent), |
| 1312 m_pCurPageArea, pTargetPageArea, | 1308 m_pCurPageArea, pTargetPageArea, |
| 1313 pTargetContentArea, bNewPage, bQuery)) { | 1309 pTargetContentArea, bNewPage, bQuery)) { |
| 1314 return m_pCurPageArea; | 1310 return m_pCurPageArea; |
| 1315 } | 1311 } |
| 1316 CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent); | 1312 CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent); |
| 1317 while (TRUE) { | 1313 while (TRUE) { |
| 1318 if (FindPageAreaFromPageSet(pPageSet, NULL, pTargetPageArea, | 1314 if (FindPageAreaFromPageSet(pPageSet, nullptr, pTargetPageArea, |
| 1319 pTargetContentArea, bNewPage, bQuery)) { | 1315 pTargetContentArea, bNewPage, bQuery)) { |
| 1320 return m_pCurPageArea; | 1316 return m_pCurPageArea; |
| 1321 } | 1317 } |
| 1322 if (!bQuery && IsPageSetRootOrderedOccurrence()) { | 1318 if (!bQuery && IsPageSetRootOrderedOccurrence()) { |
| 1323 CreateMinPageSetRecord(pPageSet); | 1319 CreateMinPageSetRecord(pPageSet); |
| 1324 } | 1320 } |
| 1325 if (FindPageAreaFromPageSet(NULL, pPageSet, pTargetPageArea, | 1321 if (FindPageAreaFromPageSet(nullptr, pPageSet, pTargetPageArea, |
| 1326 pTargetContentArea, bNewPage, bQuery)) { | 1322 pTargetContentArea, bNewPage, bQuery)) { |
| 1327 return m_pCurPageArea; | 1323 return m_pCurPageArea; |
| 1328 } | 1324 } |
| 1329 if (pPageSet == m_pTemplatePageSetRoot) { | 1325 if (pPageSet == m_pTemplatePageSetRoot) { |
| 1330 break; | 1326 break; |
| 1331 } | 1327 } |
| 1332 pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent); | 1328 pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent); |
| 1333 } | 1329 } |
| 1334 return NULL; | 1330 return nullptr; |
| 1335 } | 1331 } |
| 1336 | 1332 |
| 1337 FX_BOOL CXFA_LayoutPageMgr::GetNextContentArea(CXFA_Node* pContentArea) { | 1333 FX_BOOL CXFA_LayoutPageMgr::GetNextContentArea(CXFA_Node* pContentArea) { |
| 1338 CXFA_Node* pCurContentNode = | 1334 CXFA_Node* pCurContentNode = |
| 1339 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; | 1335 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; |
| 1340 if (pContentArea == NULL) { | 1336 if (!pContentArea) { |
| 1341 pContentArea = | 1337 pContentArea = |
| 1342 pCurContentNode->GetNextSameClassSibling(XFA_ELEMENT_ContentArea); | 1338 pCurContentNode->GetNextSameClassSibling(XFA_ELEMENT_ContentArea); |
| 1343 if (pContentArea == NULL) { | 1339 if (!pContentArea) |
| 1344 return FALSE; | 1340 return FALSE; |
| 1345 } | |
| 1346 } else { | 1341 } else { |
| 1347 if (pContentArea->GetNodeItem(XFA_NODEITEM_Parent) != m_pCurPageArea) { | 1342 if (pContentArea->GetNodeItem(XFA_NODEITEM_Parent) != m_pCurPageArea) { |
| 1348 return FALSE; | 1343 return FALSE; |
| 1349 } | 1344 } |
| 1350 CXFA_ContainerLayoutItem* pContentAreaLayout = NULL; | 1345 CXFA_ContainerLayoutItem* pContentAreaLayout = nullptr; |
| 1351 if (!CheckContentAreaNotUsed(GetCurrentContainerRecord()->pCurPageArea, | 1346 if (!CheckContentAreaNotUsed(GetCurrentContainerRecord()->pCurPageArea, |
| 1352 pContentArea, pContentAreaLayout)) { | 1347 pContentArea, pContentAreaLayout)) { |
| 1353 return FALSE; | 1348 return FALSE; |
| 1354 } | 1349 } |
| 1355 if (pContentAreaLayout) { | 1350 if (pContentAreaLayout) { |
| 1356 if (pContentAreaLayout->m_pFormNode != pCurContentNode) { | 1351 if (pContentAreaLayout->m_pFormNode != pCurContentNode) { |
| 1357 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1352 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); |
| 1358 pNewRecord->pCurContentArea = pContentAreaLayout; | 1353 pNewRecord->pCurContentArea = pContentAreaLayout; |
| 1359 return TRUE; | 1354 return TRUE; |
| 1360 } else { | 1355 } else { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1378 pPageSetNode->GetEnum(XFA_ATTRIBUTE_Relation); | 1373 pPageSetNode->GetEnum(XFA_ATTRIBUTE_Relation); |
| 1379 if (eRelation == XFA_ATTRIBUTEENUM_OrderedOccurrence) { | 1374 if (eRelation == XFA_ATTRIBUTEENUM_OrderedOccurrence) { |
| 1380 m_pPageSetMap.SetAt(pPageSetNode, 0); | 1375 m_pPageSetMap.SetAt(pPageSetNode, 0); |
| 1381 } | 1376 } |
| 1382 } | 1377 } |
| 1383 } | 1378 } |
| 1384 } | 1379 } |
| 1385 int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea, | 1380 int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea, |
| 1386 FX_BOOL bTargetPageArea, | 1381 FX_BOOL bTargetPageArea, |
| 1387 FX_BOOL bCreateLast) { | 1382 FX_BOOL bCreateLast) { |
| 1388 if (pPageArea == NULL) { | 1383 if (!pPageArea) |
| 1389 return 0; | 1384 return 0; |
| 1390 } | 1385 |
| 1391 CXFA_Node* pOccurNode = pPageArea->GetFirstChildByClass(XFA_ELEMENT_Occur); | 1386 CXFA_Node* pOccurNode = pPageArea->GetFirstChildByClass(XFA_ELEMENT_Occur); |
| 1392 int32_t iMin = 0; | 1387 int32_t iMin = 0; |
| 1393 if ((pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE)) || | 1388 if ((pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE)) || |
| 1394 bTargetPageArea) { | 1389 bTargetPageArea) { |
| 1395 CXFA_Node* pContentArea = | 1390 CXFA_Node* pContentArea = |
| 1396 pPageArea->GetFirstChildByClass(XFA_ELEMENT_ContentArea); | 1391 pPageArea->GetFirstChildByClass(XFA_ELEMENT_ContentArea); |
| 1397 if (iMin < 1 && bTargetPageArea && !pContentArea) { | 1392 if (iMin < 1 && bTargetPageArea && !pContentArea) { |
| 1398 iMin = 1; | 1393 iMin = 1; |
| 1399 } | 1394 } |
| 1400 int32_t i = 0; | 1395 int32_t i = 0; |
| 1401 if (bCreateLast) { | 1396 if (bCreateLast) { |
| 1402 i = m_nCurPageCount; | 1397 i = m_nCurPageCount; |
| 1403 } | 1398 } |
| 1404 for (; i < iMin; i++) { | 1399 for (; i < iMin; i++) { |
| 1405 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); | 1400 CXFA_ContainerRecord* pNewRecord = CreateContainerRecord(); |
| 1406 AddPageAreaLayoutItem(pNewRecord, pPageArea); | 1401 AddPageAreaLayoutItem(pNewRecord, pPageArea); |
| 1407 AddContentAreaLayoutItem(pNewRecord, pContentArea); | 1402 AddContentAreaLayoutItem(pNewRecord, pContentArea); |
| 1408 } | 1403 } |
| 1409 } | 1404 } |
| 1410 return iMin; | 1405 return iMin; |
| 1411 } | 1406 } |
| 1412 void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet, | 1407 void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet, |
| 1413 FX_BOOL bCreateAll) { | 1408 FX_BOOL bCreateAll) { |
| 1414 if (pPageSet == NULL) { | 1409 if (!pPageSet) |
| 1415 return; | 1410 return; |
| 1416 } | 1411 |
| 1417 int32_t iCurSetCount = 0; | 1412 int32_t iCurSetCount = 0; |
| 1418 if (!m_pPageSetMap.Lookup(pPageSet, iCurSetCount)) { | 1413 if (!m_pPageSetMap.Lookup(pPageSet, iCurSetCount)) { |
| 1419 return; | 1414 return; |
| 1420 } | 1415 } |
| 1421 if (bCreateAll) { | 1416 if (bCreateAll) { |
| 1422 iCurSetCount = 0; | 1417 iCurSetCount = 0; |
| 1423 } | 1418 } |
| 1424 CXFA_Node* pOccurNode = pPageSet->GetFirstChildByClass(XFA_ELEMENT_Occur); | 1419 CXFA_Node* pOccurNode = pPageSet->GetFirstChildByClass(XFA_ELEMENT_Occur); |
| 1425 int32_t iMin = 0; | 1420 int32_t iMin = 0; |
| 1426 if (pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE)) { | 1421 if (pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE)) { |
| 1427 if (iCurSetCount < iMin) { | 1422 if (iCurSetCount < iMin) { |
| 1428 for (int32_t i = 0; i < iMin - iCurSetCount; i++) { | 1423 for (int32_t i = 0; i < iMin - iCurSetCount; i++) { |
| 1429 for (CXFA_Node* pCurrentPageNode = | 1424 for (CXFA_Node* pCurrentPageNode = |
| 1430 pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); | 1425 pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1431 pCurrentPageNode; pCurrentPageNode = pCurrentPageNode->GetNodeItem( | 1426 pCurrentPageNode; pCurrentPageNode = pCurrentPageNode->GetNodeItem( |
| 1432 XFA_NODEITEM_NextSibling)) { | 1427 XFA_NODEITEM_NextSibling)) { |
| 1433 if (pCurrentPageNode->GetClassID() == XFA_ELEMENT_PageArea) { | 1428 if (pCurrentPageNode->GetClassID() == XFA_ELEMENT_PageArea) { |
| 1434 CreateMinPageRecord(pCurrentPageNode, FALSE); | 1429 CreateMinPageRecord(pCurrentPageNode, FALSE); |
| 1435 } else if (pCurrentPageNode->GetClassID() == XFA_ELEMENT_PageSet) { | 1430 } else if (pCurrentPageNode->GetClassID() == XFA_ELEMENT_PageSet) { |
| 1436 CreateMinPageSetRecord(pCurrentPageNode, TRUE); | 1431 CreateMinPageSetRecord(pCurrentPageNode, TRUE); |
| 1437 } | 1432 } |
| 1438 } | 1433 } |
| 1439 } | 1434 } |
| 1440 m_pPageSetMap.SetAt(pPageSet, iMin); | 1435 m_pPageSetMap.SetAt(pPageSet, iMin); |
| 1441 } | 1436 } |
| 1442 } | 1437 } |
| 1443 } | 1438 } |
| 1444 void CXFA_LayoutPageMgr::CreateNextMinRecord(CXFA_Node* pRecordNode) { | 1439 void CXFA_LayoutPageMgr::CreateNextMinRecord(CXFA_Node* pRecordNode) { |
| 1445 if (pRecordNode == NULL) { | 1440 if (!pRecordNode) |
| 1446 return; | 1441 return; |
| 1447 } | 1442 |
| 1448 for (CXFA_Node* pCurrentNode = | 1443 for (CXFA_Node* pCurrentNode = |
| 1449 pRecordNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 1444 pRecordNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 1450 pCurrentNode; | 1445 pCurrentNode; |
| 1451 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1446 pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1452 if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageArea) { | 1447 if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageArea) { |
| 1453 CreateMinPageRecord(pCurrentNode, FALSE); | 1448 CreateMinPageRecord(pCurrentNode, FALSE); |
| 1454 } else if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageSet) { | 1449 } else if (pCurrentNode->GetClassID() == XFA_ELEMENT_PageSet) { |
| 1455 CreateMinPageSetRecord(pCurrentNode, TRUE); | 1450 CreateMinPageSetRecord(pCurrentNode, TRUE); |
| 1456 } | 1451 } |
| 1457 } | 1452 } |
| 1458 } | 1453 } |
| 1459 void CXFA_LayoutPageMgr::ProcessLastPageSet() { | 1454 void CXFA_LayoutPageMgr::ProcessLastPageSet() { |
| 1460 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); | 1455 CreateMinPageRecord(m_pCurPageArea, FALSE, TRUE); |
| 1461 CreateNextMinRecord(m_pCurPageArea); | 1456 CreateNextMinRecord(m_pCurPageArea); |
| 1462 CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent); | 1457 CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent); |
| 1463 while (TRUE) { | 1458 while (TRUE) { |
| 1464 CreateMinPageSetRecord(pPageSet); | 1459 CreateMinPageSetRecord(pPageSet); |
| 1465 if (pPageSet == m_pTemplatePageSetRoot) { | 1460 if (pPageSet == m_pTemplatePageSetRoot) { |
| 1466 break; | 1461 break; |
| 1467 } | 1462 } |
| 1468 CreateNextMinRecord(pPageSet); | 1463 CreateNextMinRecord(pPageSet); |
| 1469 pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent); | 1464 pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent); |
| 1470 } | 1465 } |
| 1471 } | 1466 } |
| 1472 FX_BOOL CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) { | 1467 FX_BOOL CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) { |
| 1473 CXFA_Node* pCurContentNode = | 1468 CXFA_Node* pCurContentNode = |
| 1474 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; | 1469 GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; |
| 1475 if (pCurContentNode == NULL) { | 1470 if (!pCurContentNode) |
| 1476 return FALSE; | 1471 return FALSE; |
| 1477 } | 1472 |
| 1478 pCurContentNode = | 1473 pCurContentNode = |
| 1479 pCurContentNode->GetNextSameClassSibling(XFA_ELEMENT_ContentArea); | 1474 pCurContentNode->GetNextSameClassSibling(XFA_ELEMENT_ContentArea); |
| 1480 if (pCurContentNode) { | 1475 if (pCurContentNode) { |
| 1481 FX_FLOAT fNextContentHeight = | 1476 FX_FLOAT fNextContentHeight = |
| 1482 pCurContentNode->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); | 1477 pCurContentNode->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); |
| 1483 return fNextContentHeight > fChildHeight; | 1478 return fNextContentHeight > fChildHeight; |
| 1484 } | 1479 } |
| 1485 CXFA_Node* pPageNode = GetCurrentContainerRecord()->pCurPageArea->m_pFormNode; | 1480 CXFA_Node* pPageNode = GetCurrentContainerRecord()->pCurPageArea->m_pFormNode; |
| 1486 CXFA_Node* pOccurNode = pPageNode->GetFirstChildByClass(XFA_ELEMENT_Occur); | 1481 CXFA_Node* pOccurNode = pPageNode->GetFirstChildByClass(XFA_ELEMENT_Occur); |
| 1487 int32_t iMax = 0; | 1482 int32_t iMax = 0; |
| 1488 if (pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE)) { | 1483 if (pOccurNode && pOccurNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE)) { |
| 1489 if (m_nCurPageCount == iMax) { | 1484 if (m_nCurPageCount == iMax) { |
| 1490 CXFA_Node* pSrcPage = m_pCurPageArea; | 1485 CXFA_Node* pSrcPage = m_pCurPageArea; |
| 1491 int32_t nSrcPageCount = m_nCurPageCount; | 1486 int32_t nSrcPageCount = m_nCurPageCount; |
| 1492 FX_POSITION psSrcRecord = m_rgProposedContainerRecord.GetTailPosition(); | 1487 FX_POSITION psSrcRecord = m_rgProposedContainerRecord.GetTailPosition(); |
| 1493 CXFA_Node* pNextPage = GetNextAvailPageArea(NULL, NULL, FALSE, TRUE); | 1488 CXFA_Node* pNextPage = |
| 1489 GetNextAvailPageArea(nullptr, nullptr, FALSE, TRUE); |
| 1494 m_pCurPageArea = pSrcPage; | 1490 m_pCurPageArea = pSrcPage; |
| 1495 m_nCurPageCount = nSrcPageCount; | 1491 m_nCurPageCount = nSrcPageCount; |
| 1496 CXFA_ContainerRecord* pPrevRecord = | 1492 CXFA_ContainerRecord* pPrevRecord = |
| 1497 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext( | 1493 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext( |
| 1498 psSrcRecord); | 1494 psSrcRecord); |
| 1499 while (psSrcRecord) { | 1495 while (psSrcRecord) { |
| 1500 FX_POSITION psSaveRecord = psSrcRecord; | 1496 FX_POSITION psSaveRecord = psSrcRecord; |
| 1501 CXFA_ContainerRecord* pInsertRecord = | 1497 CXFA_ContainerRecord* pInsertRecord = |
| 1502 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext( | 1498 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext( |
| 1503 psSrcRecord); | 1499 psSrcRecord); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 if (m_rgProposedContainerRecord.GetCount() > 0) { | 1537 if (m_rgProposedContainerRecord.GetCount() > 0) { |
| 1542 FX_POSITION sPos; | 1538 FX_POSITION sPos; |
| 1543 sPos = m_rgProposedContainerRecord.GetHeadPosition(); | 1539 sPos = m_rgProposedContainerRecord.GetHeadPosition(); |
| 1544 while (sPos) { | 1540 while (sPos) { |
| 1545 CXFA_ContainerRecord* pRecord = | 1541 CXFA_ContainerRecord* pRecord = |
| 1546 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext(sPos); | 1542 (CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetNext(sPos); |
| 1547 delete pRecord; | 1543 delete pRecord; |
| 1548 } | 1544 } |
| 1549 m_rgProposedContainerRecord.RemoveAll(); | 1545 m_rgProposedContainerRecord.RemoveAll(); |
| 1550 } | 1546 } |
| 1551 m_pCurrentContainerRecord = NULL; | 1547 m_pCurrentContainerRecord = nullptr; |
| 1552 m_pCurPageArea = NULL; | 1548 m_pCurPageArea = nullptr; |
| 1553 m_nCurPageCount = 0; | 1549 m_nCurPageCount = 0; |
| 1554 m_bCreateOverFlowPage = FALSE; | 1550 m_bCreateOverFlowPage = FALSE; |
| 1555 m_pPageSetMap.RemoveAll(); | 1551 m_pPageSetMap.RemoveAll(); |
| 1556 } | 1552 } |
| 1557 CXFA_LayoutItem* CXFA_LayoutPageMgr::FindOrCreateLayoutItem( | 1553 CXFA_LayoutItem* CXFA_LayoutPageMgr::FindOrCreateLayoutItem( |
| 1558 CXFA_Node* pFormNode) { | 1554 CXFA_Node* pFormNode) { |
| 1559 return pFormNode->GetDocument()->GetParser()->GetNotify()->OnCreateLayoutItem( | 1555 return pFormNode->GetDocument()->GetParser()->GetNotify()->OnCreateLayoutItem( |
| 1560 pFormNode); | 1556 pFormNode); |
| 1561 } | 1557 } |
| 1562 | 1558 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1585 sIterator(pCurLayoutItem->m_pFormNode); | 1581 sIterator(pCurLayoutItem->m_pFormNode); |
| 1586 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; | 1582 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; |
| 1587 pNode = sIterator.MoveToNext()) { | 1583 pNode = sIterator.MoveToNext()) { |
| 1588 pNode->SetFlag(XFA_NODEFLAG_UnusedNode, false); | 1584 pNode->SetFlag(XFA_NODEFLAG_UnusedNode, false); |
| 1589 } | 1585 } |
| 1590 } | 1586 } |
| 1591 } | 1587 } |
| 1592 if (pCurLayoutItem->m_pFirstChild) { | 1588 if (pCurLayoutItem->m_pFirstChild) { |
| 1593 SaveLayoutItem(pCurLayoutItem); | 1589 SaveLayoutItem(pCurLayoutItem); |
| 1594 } | 1590 } |
| 1595 pCurLayoutItem->m_pParent = NULL; | 1591 pCurLayoutItem->m_pParent = nullptr; |
| 1596 pCurLayoutItem->m_pNextSibling = NULL; | 1592 pCurLayoutItem->m_pNextSibling = nullptr; |
| 1597 pCurLayoutItem->m_pFirstChild = NULL; | 1593 pCurLayoutItem->m_pFirstChild = nullptr; |
| 1598 if (!pCurLayoutItem->IsContentLayoutItem() && | 1594 if (!pCurLayoutItem->IsContentLayoutItem() && |
| 1599 pCurLayoutItem->m_pFormNode->GetClassID() != XFA_ELEMENT_PageArea) { | 1595 pCurLayoutItem->m_pFormNode->GetClassID() != XFA_ELEMENT_PageArea) { |
| 1600 delete pCurLayoutItem; | 1596 delete pCurLayoutItem; |
| 1601 } | 1597 } |
| 1602 pCurLayoutItem = pNextLayoutItem; | 1598 pCurLayoutItem = pNextLayoutItem; |
| 1603 } | 1599 } |
| 1604 } | 1600 } |
| 1605 CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( | 1601 CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( |
| 1606 CXFA_Node* pFormNode, | 1602 CXFA_Node* pFormNode, |
| 1607 CXFA_LayoutContext* pLayoutContext) { | 1603 CXFA_LayoutContext* pLayoutContext) { |
| 1608 for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 1604 for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1609 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { | 1605 pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { |
| 1610 if (pCurNode->GetClassID() == XFA_ELEMENT_Break) { | 1606 if (pCurNode->GetClassID() == XFA_ELEMENT_Break) { |
| 1611 CFX_WideStringC wsOverflowLeader; | 1607 CFX_WideStringC wsOverflowLeader; |
| 1612 CFX_WideStringC wsOverflowTarget; | 1608 CFX_WideStringC wsOverflowTarget; |
| 1613 CFX_WideStringC wsOverflowTrailer; | 1609 CFX_WideStringC wsOverflowTrailer; |
| 1614 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); | 1610 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); |
| 1615 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); | 1611 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); |
| 1616 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); | 1612 pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); |
| 1617 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || | 1613 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || |
| 1618 !wsOverflowTarget.IsEmpty()) { | 1614 !wsOverflowTarget.IsEmpty()) { |
| 1619 return pCurNode; | 1615 return pCurNode; |
| 1620 } | 1616 } |
| 1621 return NULL; | 1617 return nullptr; |
| 1622 } else if (pCurNode->GetClassID() == XFA_ELEMENT_Overflow) { | 1618 } else if (pCurNode->GetClassID() == XFA_ELEMENT_Overflow) { |
| 1623 return pCurNode; | 1619 return pCurNode; |
| 1624 } | 1620 } |
| 1625 } | 1621 } |
| 1626 return NULL; | 1622 return nullptr; |
| 1627 } | 1623 } |
| 1628 | 1624 |
| 1629 void CXFA_LayoutPageMgr::MergePageSetContents() { | 1625 void CXFA_LayoutPageMgr::MergePageSetContents() { |
| 1630 CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument(); | 1626 CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument(); |
| 1631 CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); | 1627 CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); |
| 1632 CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout(); | 1628 CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout(); |
| 1633 CXFA_ContainerLayoutItem* pRootLayout = GetRootLayoutItem(); | 1629 CXFA_ContainerLayoutItem* pRootLayout = GetRootLayoutItem(); |
| 1634 { | 1630 { |
| 1635 for (int32_t iIndex = 0; iIndex < pDocument->m_pPendingPageSet.GetSize(); | 1631 for (int32_t iIndex = 0; iIndex < pDocument->m_pPendingPageSet.GetSize(); |
| 1636 iIndex++) { | 1632 iIndex++) { |
| 1637 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> | 1633 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> |
| 1638 sIterator(pDocument->m_pPendingPageSet.GetAt(iIndex)); | 1634 sIterator(pDocument->m_pPendingPageSet.GetAt(iIndex)); |
| 1639 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; | 1635 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; |
| 1640 pNode = sIterator.MoveToNext()) { | 1636 pNode = sIterator.MoveToNext()) { |
| 1641 if (pNode->IsContainerNode()) { | 1637 if (pNode->IsContainerNode()) { |
| 1642 CXFA_Node* pBindNode = pNode->GetBindData(); | 1638 CXFA_Node* pBindNode = pNode->GetBindData(); |
| 1643 if (pBindNode) { | 1639 if (pBindNode) { |
| 1644 pBindNode->RemoveBindItem(pNode); | 1640 pBindNode->RemoveBindItem(pNode); |
| 1645 pNode->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); | 1641 pNode->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); |
| 1646 } | 1642 } |
| 1647 } | 1643 } |
| 1648 pNode->SetFlag(XFA_NODEFLAG_UnusedNode, true); | 1644 pNode->SetFlag(XFA_NODEFLAG_UnusedNode, true); |
| 1649 } | 1645 } |
| 1650 } | 1646 } |
| 1651 } | 1647 } |
| 1652 int32_t iIndex = 0; | 1648 int32_t iIndex = 0; |
| 1653 for (; pRootLayout; | 1649 for (; pRootLayout; |
| 1654 pRootLayout = (CXFA_ContainerLayoutItem*)pRootLayout->m_pNextSibling) { | 1650 pRootLayout = (CXFA_ContainerLayoutItem*)pRootLayout->m_pNextSibling) { |
| 1655 CXFA_Node* pPendingPageSet = nullptr; | 1651 CXFA_Node* pPendingPageSet = nullptr; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1669 XFA_XDPPACKET_Template) { | 1665 XFA_XDPPACKET_Template) { |
| 1670 pPendingPageSet = | 1666 pPendingPageSet = |
| 1671 pRootPageSetContainerItem->m_pFormNode->CloneTemplateToForm(FALSE); | 1667 pRootPageSetContainerItem->m_pFormNode->CloneTemplateToForm(FALSE); |
| 1672 } else { | 1668 } else { |
| 1673 pPendingPageSet = pRootPageSetContainerItem->m_pFormNode; | 1669 pPendingPageSet = pRootPageSetContainerItem->m_pFormNode; |
| 1674 } | 1670 } |
| 1675 } | 1671 } |
| 1676 if (pRootPageSetContainerItem->m_pFormNode->GetUserData( | 1672 if (pRootPageSetContainerItem->m_pFormNode->GetUserData( |
| 1677 XFA_LAYOUTITEMKEY) == pRootPageSetContainerItem) { | 1673 XFA_LAYOUTITEMKEY) == pRootPageSetContainerItem) { |
| 1678 pRootPageSetContainerItem->m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, | 1674 pRootPageSetContainerItem->m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, |
| 1679 NULL); | 1675 nullptr); |
| 1680 } | 1676 } |
| 1681 pRootPageSetContainerItem->m_pFormNode = pPendingPageSet; | 1677 pRootPageSetContainerItem->m_pFormNode = pPendingPageSet; |
| 1682 pPendingPageSet->ClearFlag(XFA_NODEFLAG_UnusedNode); | 1678 pPendingPageSet->ClearFlag(XFA_NODEFLAG_UnusedNode); |
| 1683 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.MoveToNext(); | 1679 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.MoveToNext(); |
| 1684 pContainerItem; pContainerItem = iterator.MoveToNext()) { | 1680 pContainerItem; pContainerItem = iterator.MoveToNext()) { |
| 1685 CXFA_Node* pNode = pContainerItem->m_pFormNode; | 1681 CXFA_Node* pNode = pContainerItem->m_pFormNode; |
| 1686 if (pNode->GetPacketID() != XFA_XDPPACKET_Template) { | 1682 if (pNode->GetPacketID() != XFA_XDPPACKET_Template) { |
| 1687 continue; | 1683 continue; |
| 1688 } | 1684 } |
| 1689 switch (pNode->GetClassID()) { | 1685 switch (pNode->GetClassID()) { |
| 1690 case XFA_ELEMENT_PageSet: { | 1686 case XFA_ELEMENT_PageSet: { |
| 1691 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; | 1687 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; |
| 1692 pContainerItem->m_pFormNode = XFA_NodeMerge_CloneOrMergeContainer( | 1688 pContainerItem->m_pFormNode = XFA_NodeMerge_CloneOrMergeContainer( |
| 1693 pDocument, pParentNode, pContainerItem->m_pFormNode, TRUE); | 1689 pDocument, pParentNode, pContainerItem->m_pFormNode, TRUE); |
| 1694 } break; | 1690 } break; |
| 1695 case XFA_ELEMENT_PageArea: { | 1691 case XFA_ELEMENT_PageArea: { |
| 1696 CXFA_ContainerLayoutItem* pFormLayout = pContainerItem; | 1692 CXFA_ContainerLayoutItem* pFormLayout = pContainerItem; |
| 1697 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; | 1693 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; |
| 1698 FX_BOOL bIsExistForm = TRUE; | 1694 FX_BOOL bIsExistForm = TRUE; |
| 1699 for (int32_t iLevel = 0; iLevel < 3; iLevel++) { | 1695 for (int32_t iLevel = 0; iLevel < 3; iLevel++) { |
| 1700 pFormLayout = (CXFA_ContainerLayoutItem*)pFormLayout->m_pFirstChild; | 1696 pFormLayout = (CXFA_ContainerLayoutItem*)pFormLayout->m_pFirstChild; |
| 1701 if (iLevel == 2) { | 1697 if (iLevel == 2) { |
| 1702 while (pFormLayout && | 1698 while (pFormLayout && |
| 1703 !XFA_ItemLayoutProcessor_IsTakingSpace( | 1699 !XFA_ItemLayoutProcessor_IsTakingSpace( |
| 1704 pFormLayout->m_pFormNode)) { | 1700 pFormLayout->m_pFormNode)) { |
| 1705 pFormLayout = | 1701 pFormLayout = |
| 1706 (CXFA_ContainerLayoutItem*)pFormLayout->m_pNextSibling; | 1702 (CXFA_ContainerLayoutItem*)pFormLayout->m_pNextSibling; |
| 1707 } | 1703 } |
| 1708 } | 1704 } |
| 1709 if (pFormLayout == NULL) { | 1705 if (!pFormLayout) { |
| 1710 bIsExistForm = FALSE; | 1706 bIsExistForm = FALSE; |
| 1711 break; | 1707 break; |
| 1712 } | 1708 } |
| 1713 } | 1709 } |
| 1714 if (bIsExistForm) { | 1710 if (bIsExistForm) { |
| 1715 CXFA_Node* pNewSubform = pFormLayout->m_pFormNode; | 1711 CXFA_Node* pNewSubform = pFormLayout->m_pFormNode; |
| 1716 if (pContainerItem->m_pOldSubform && | 1712 if (pContainerItem->m_pOldSubform && |
| 1717 pContainerItem->m_pOldSubform != pNewSubform) { | 1713 pContainerItem->m_pOldSubform != pNewSubform) { |
| 1718 CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( | 1714 CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( |
| 1719 pDocument, pContainerItem->m_pFormNode->GetClassID(), | 1715 pDocument, pContainerItem->m_pFormNode->GetClassID(), |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1891 m_PageArray.RemoveAt(i); | 1887 m_PageArray.RemoveAt(i); |
| 1892 pNotify->OnPageEvent(pPage, XFA_PAGEVIEWEVENT_PostRemoved); | 1888 pNotify->OnPageEvent(pPage, XFA_PAGEVIEWEVENT_PostRemoved); |
| 1893 delete pPage; | 1889 delete pPage; |
| 1894 } | 1890 } |
| 1895 ClearRecordList(); | 1891 ClearRecordList(); |
| 1896 } | 1892 } |
| 1897 void XFA_ReleaseLayoutItem_NoPageArea(CXFA_LayoutItem* pLayoutItem) { | 1893 void XFA_ReleaseLayoutItem_NoPageArea(CXFA_LayoutItem* pLayoutItem) { |
| 1898 CXFA_LayoutItem *pNext, *pNode = pLayoutItem->m_pFirstChild; | 1894 CXFA_LayoutItem *pNext, *pNode = pLayoutItem->m_pFirstChild; |
| 1899 while (pNode) { | 1895 while (pNode) { |
| 1900 pNext = pNode->m_pNextSibling; | 1896 pNext = pNode->m_pNextSibling; |
| 1901 pNode->m_pParent = NULL; | 1897 pNode->m_pParent = nullptr; |
| 1902 XFA_ReleaseLayoutItem_NoPageArea(pNode); | 1898 XFA_ReleaseLayoutItem_NoPageArea(pNode); |
| 1903 pNode = pNext; | 1899 pNode = pNext; |
| 1904 } | 1900 } |
| 1905 if (pLayoutItem->m_pFormNode->GetClassID() != XFA_ELEMENT_PageArea) { | 1901 if (pLayoutItem->m_pFormNode->GetClassID() != XFA_ELEMENT_PageArea) { |
| 1906 delete pLayoutItem; | 1902 delete pLayoutItem; |
| 1907 } | 1903 } |
| 1908 } | 1904 } |
| 1909 void CXFA_LayoutPageMgr::PrepareLayout() { | 1905 void CXFA_LayoutPageMgr::PrepareLayout() { |
| 1910 m_pPageSetCurRoot = NULL; | 1906 m_pPageSetCurRoot = nullptr; |
| 1911 m_ePageSetMode = XFA_ATTRIBUTEENUM_OrderedOccurrence; | 1907 m_ePageSetMode = XFA_ATTRIBUTEENUM_OrderedOccurrence; |
| 1912 m_nAvailPages = 0; | 1908 m_nAvailPages = 0; |
| 1913 ClearRecordList(); | 1909 ClearRecordList(); |
| 1914 if (!m_pPageSetLayoutItemRoot) { | 1910 if (!m_pPageSetLayoutItemRoot) { |
| 1915 return; | 1911 return; |
| 1916 } | 1912 } |
| 1917 CXFA_ContainerLayoutItem* pRootLayoutItem = m_pPageSetLayoutItemRoot; | 1913 CXFA_ContainerLayoutItem* pRootLayoutItem = m_pPageSetLayoutItemRoot; |
| 1918 if (pRootLayoutItem && | 1914 if (pRootLayoutItem && |
| 1919 pRootLayoutItem->m_pFormNode->GetPacketID() == XFA_XDPPACKET_Form) { | 1915 pRootLayoutItem->m_pFormNode->GetPacketID() == XFA_XDPPACKET_Form) { |
| 1920 CXFA_Node* pPageSetFormNode = pRootLayoutItem->m_pFormNode; | 1916 CXFA_Node* pPageSetFormNode = pRootLayoutItem->m_pFormNode; |
| 1921 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.RemoveAll(); | 1917 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.RemoveAll(); |
| 1922 if (pPageSetFormNode->HasFlag(XFA_NODEFLAG_HasRemoved)) { | 1918 if (pPageSetFormNode->HasFlag(XFA_NODEFLAG_HasRemoved)) { |
| 1923 XFA_ReleaseLayoutItem(pRootLayoutItem); | 1919 XFA_ReleaseLayoutItem(pRootLayoutItem); |
| 1924 m_pPageSetLayoutItemRoot = NULL; | 1920 m_pPageSetLayoutItemRoot = nullptr; |
| 1925 pRootLayoutItem = NULL; | 1921 pRootLayoutItem = nullptr; |
| 1926 pPageSetFormNode = NULL; | 1922 pPageSetFormNode = nullptr; |
| 1927 m_PageArray.RemoveAll(); | 1923 m_PageArray.RemoveAll(); |
| 1928 } | 1924 } |
| 1929 while (pPageSetFormNode) { | 1925 while (pPageSetFormNode) { |
| 1930 CXFA_Node* pNextPageSet = | 1926 CXFA_Node* pNextPageSet = |
| 1931 pPageSetFormNode->GetNextSameClassSibling(XFA_ELEMENT_PageSet); | 1927 pPageSetFormNode->GetNextSameClassSibling(XFA_ELEMENT_PageSet); |
| 1932 pPageSetFormNode->GetNodeItem(XFA_NODEITEM_Parent) | 1928 pPageSetFormNode->GetNodeItem(XFA_NODEITEM_Parent) |
| 1933 ->RemoveChild(pPageSetFormNode, FALSE); | 1929 ->RemoveChild(pPageSetFormNode, FALSE); |
| 1934 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.Add( | 1930 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.Add( |
| 1935 pPageSetFormNode); | 1931 pPageSetFormNode); |
| 1936 pPageSetFormNode = pNextPageSet; | 1932 pPageSetFormNode = pNextPageSet; |
| 1937 } | 1933 } |
| 1938 } | 1934 } |
| 1939 pRootLayoutItem = m_pPageSetLayoutItemRoot; | 1935 pRootLayoutItem = m_pPageSetLayoutItemRoot; |
| 1940 CXFA_ContainerLayoutItem* pNextLayout = NULL; | 1936 CXFA_ContainerLayoutItem* pNextLayout = nullptr; |
| 1941 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { | 1937 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { |
| 1942 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; | 1938 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; |
| 1943 SaveLayoutItem(pRootLayoutItem); | 1939 SaveLayoutItem(pRootLayoutItem); |
| 1944 delete pRootLayoutItem; | 1940 delete pRootLayoutItem; |
| 1945 } | 1941 } |
| 1946 m_pPageSetLayoutItemRoot = NULL; | 1942 m_pPageSetLayoutItemRoot = nullptr; |
| 1947 } | 1943 } |
| OLD | NEW |