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/app/xfa_ffnotify.h" | 7 #include "xfa/fxfa/app/xfa_ffnotify.h" |
8 | 8 |
9 #include "fxjs/include/cfxjse_value.h" | 9 #include "fxjs/include/cfxjse_value.h" |
10 #include "xfa/fxfa/app/xfa_ffbarcode.h" | 10 #include "xfa/fxfa/app/xfa_ffbarcode.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()); | 231 static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()); |
232 if (!pWidgetAcc) { | 232 if (!pWidgetAcc) { |
233 return; | 233 return; |
234 } | 234 } |
235 pDocView->AddCalculateWidgetAcc(pWidgetAcc); | 235 pDocView->AddCalculateWidgetAcc(pWidgetAcc); |
236 pDocView->AddValidateWidget(pWidgetAcc); | 236 pDocView->AddValidateWidget(pWidgetAcc); |
237 } | 237 } |
238 CXFA_FFDoc* CXFA_FFNotify::GetHDOC() { | 238 CXFA_FFDoc* CXFA_FFNotify::GetHDOC() { |
239 return m_pDoc; | 239 return m_pDoc; |
240 } | 240 } |
241 IXFA_DocProvider* CXFA_FFNotify::GetDocProvider() { | 241 IXFA_DocEnvironment* CXFA_FFNotify::GetDocEnvironment() const { |
242 return m_pDoc->GetDocProvider(); | 242 return m_pDoc->GetDocEnvironment(); |
243 } | 243 } |
244 IXFA_AppProvider* CXFA_FFNotify::GetAppProvider() { | 244 IXFA_AppProvider* CXFA_FFNotify::GetAppProvider() { |
245 return m_pDoc->GetApp()->GetAppProvider(); | 245 return m_pDoc->GetApp()->GetAppProvider(); |
246 } | 246 } |
247 CXFA_FFWidgetHandler* CXFA_FFNotify::GetWidgetHandler() { | 247 CXFA_FFWidgetHandler* CXFA_FFNotify::GetWidgetHandler() { |
248 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 248 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
249 return pDocView ? pDocView->GetWidgetHandler() : nullptr; | 249 return pDocView ? pDocView->GetWidgetHandler() : nullptr; |
250 } | 250 } |
251 CXFA_FFWidget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) { | 251 CXFA_FFWidget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) { |
252 return XFA_GetWidgetFromLayoutItem(pLayoutItem); | 252 return XFA_GetWidgetFromLayoutItem(pLayoutItem); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 return; | 437 return; |
438 } | 438 } |
439 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 439 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
440 if (!pDocView) { | 440 if (!pDocView) { |
441 return; | 441 return; |
442 } | 442 } |
443 FX_BOOL bLayoutReady = | 443 FX_BOOL bLayoutReady = |
444 !(pDocView->m_bInLayoutStatus) && | 444 !(pDocView->m_bInLayoutStatus) && |
445 (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); | 445 (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); |
446 if (bLayoutReady) | 446 if (bLayoutReady) |
447 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); | 447 m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc); |
448 } | 448 } |
449 | 449 |
450 void CXFA_FFNotify::OnChildRemoved() { | 450 void CXFA_FFNotify::OnChildRemoved() { |
451 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 451 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
452 if (!pDocView) | 452 if (!pDocView) |
453 return; | 453 return; |
454 | 454 |
455 bool bLayoutReady = | 455 bool bLayoutReady = |
456 !(pDocView->m_bInLayoutStatus) && | 456 !(pDocView->m_bInLayoutStatus) && |
457 (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); | 457 (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); |
458 if (bLayoutReady) | 458 if (bLayoutReady) |
459 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); | 459 m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc); |
460 } | 460 } |
461 | 461 |
462 void CXFA_FFNotify::OnLayoutItemAdded(CXFA_LayoutProcessor* pLayout, | 462 void CXFA_FFNotify::OnLayoutItemAdded(CXFA_LayoutProcessor* pLayout, |
463 CXFA_LayoutItem* pSender, | 463 CXFA_LayoutItem* pSender, |
464 int32_t iPageIdx, | 464 int32_t iPageIdx, |
465 uint32_t dwStatus) { | 465 uint32_t dwStatus) { |
466 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); | 466 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); |
467 if (!pDocView) | 467 if (!pDocView) |
468 return; | 468 return; |
469 | 469 |
470 CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender); | 470 CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender); |
471 if (!pWidget) | 471 if (!pWidget) |
472 return; | 472 return; |
473 | 473 |
474 CXFA_FFPageView* pNewPageView = pDocView->GetPageView(iPageIdx); | 474 CXFA_FFPageView* pNewPageView = pDocView->GetPageView(iPageIdx); |
475 uint32_t dwFilter = XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable | | 475 uint32_t dwFilter = XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable | |
476 XFA_WidgetStatus_Printable; | 476 XFA_WidgetStatus_Printable; |
477 pWidget->ModifyStatus(dwStatus, dwFilter); | 477 pWidget->ModifyStatus(dwStatus, dwFilter); |
478 CXFA_FFPageView* pPrePageView = pWidget->GetPageView(); | 478 CXFA_FFPageView* pPrePageView = pWidget->GetPageView(); |
479 if (pPrePageView != pNewPageView || | 479 if (pPrePageView != pNewPageView || |
480 (dwStatus & (XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable)) == | 480 (dwStatus & (XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable)) == |
481 (XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable)) { | 481 (XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable)) { |
482 pWidget->SetPageView(pNewPageView); | 482 pWidget->SetPageView(pNewPageView); |
483 m_pDoc->GetDocProvider()->WidgetPostAdd(pWidget, pWidget->GetDataAcc()); | 483 m_pDoc->GetDocEnvironment()->WidgetPostAdd(pWidget, pWidget->GetDataAcc()); |
484 } | 484 } |
485 if (pDocView->GetLayoutStatus() != XFA_DOCVIEW_LAYOUTSTATUS_End || | 485 if (pDocView->GetLayoutStatus() != XFA_DOCVIEW_LAYOUTSTATUS_End || |
486 !(dwStatus & XFA_WidgetStatus_Visible)) { | 486 !(dwStatus & XFA_WidgetStatus_Visible)) { |
487 return; | 487 return; |
488 } | 488 } |
489 if (pWidget->IsLoaded()) { | 489 if (pWidget->IsLoaded()) { |
490 CFX_RectF rtOld; | 490 CFX_RectF rtOld; |
491 pWidget->GetWidgetRect(rtOld); | 491 pWidget->GetWidgetRect(rtOld); |
492 if (rtOld != pWidget->ReCacheWidgetRect()) | 492 if (rtOld != pWidget->ReCacheWidgetRect()) |
493 pWidget->PerformLayout(); | 493 pWidget->PerformLayout(); |
494 } else { | 494 } else { |
495 pWidget->LoadWidget(); | 495 pWidget->LoadWidget(); |
496 } | 496 } |
497 pWidget->AddInvalidateRect(nullptr); | 497 pWidget->AddInvalidateRect(nullptr); |
498 } | 498 } |
499 | 499 |
500 void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_LayoutProcessor* pLayout, | 500 void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_LayoutProcessor* pLayout, |
501 CXFA_LayoutItem* pSender) { | 501 CXFA_LayoutItem* pSender) { |
502 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); | 502 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); |
503 if (!pDocView) | 503 if (!pDocView) |
504 return; | 504 return; |
505 | 505 |
506 CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender); | 506 CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender); |
507 if (!pWidget) | 507 if (!pWidget) |
508 return; | 508 return; |
509 | 509 |
510 pDocView->DeleteLayoutItem(pWidget); | 510 pDocView->DeleteLayoutItem(pWidget); |
511 m_pDoc->GetDocProvider()->WidgetPreRemove(pWidget, pWidget->GetDataAcc()); | 511 m_pDoc->GetDocEnvironment()->WidgetPreRemove(pWidget, pWidget->GetDataAcc()); |
512 pWidget->AddInvalidateRect(nullptr); | 512 pWidget->AddInvalidateRect(nullptr); |
513 } | 513 } |
OLD | NEW |