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/src/foxitlib.h" | 7 #include "xfa/src/foxitlib.h" |
8 #include "xfa/src/fxfa/src/common/xfa_common.h" | 8 #include "xfa/src/fxfa/src/common/xfa_common.h" |
9 #include "xfa_fwladapter.h" | 9 #include "xfa_fwladapter.h" |
10 #include "xfa_ffdocview.h" | 10 #include "xfa_ffdocview.h" |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 void* pParam2) { | 544 void* pParam2) { |
545 if (!pSender->IsFormContainer()) { | 545 if (!pSender->IsFormContainer()) { |
546 return; | 546 return; |
547 } | 547 } |
548 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 548 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
549 if (!pDocView) { | 549 if (!pDocView) { |
550 return; | 550 return; |
551 } | 551 } |
552 FX_BOOL bLayoutReady = | 552 FX_BOOL bLayoutReady = |
553 !(pDocView->m_bInLayoutStatus) && | 553 !(pDocView->m_bInLayoutStatus) && |
554 (pDocView->GetLayoutStatus() >= XFA_DOCVIEW_LAYOUTSTATUS_End); | 554 (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); |
555 if (bLayoutReady) { | 555 if (bLayoutReady) { |
556 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); | 556 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); |
557 } | 557 } |
558 } | 558 } |
559 void CXFA_FFNotify::OnChildRemoved(CXFA_Node* pSender, | 559 void CXFA_FFNotify::OnChildRemoved(CXFA_Node* pSender, |
560 void* pParam, | 560 void* pParam, |
561 void* pParam2) { | 561 void* pParam2) { |
562 if (CXFA_FFDocView* pDocView = m_pDoc->GetDocView()) { | 562 if (CXFA_FFDocView* pDocView = m_pDoc->GetDocView()) { |
563 FX_BOOL bLayoutReady = | 563 FX_BOOL bLayoutReady = |
564 !(pDocView->m_bInLayoutStatus) && | 564 !(pDocView->m_bInLayoutStatus) && |
565 (pDocView->GetLayoutStatus() >= XFA_DOCVIEW_LAYOUTSTATUS_End); | 565 (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); |
566 if (bLayoutReady) { | 566 if (bLayoutReady) { |
567 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); | 567 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); |
568 } | 568 } |
569 } | 569 } |
570 } | 570 } |
571 void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView, | 571 void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView, |
572 IXFA_DocLayout* pLayout, | 572 IXFA_DocLayout* pLayout, |
573 CXFA_LayoutItem* pSender, | 573 CXFA_LayoutItem* pSender, |
574 void* pParam, | 574 void* pParam, |
575 void* pParam2) { | 575 void* pParam2) { |
576 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender); | 576 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender); |
577 int32_t iPageIdx = (int32_t)(uintptr_t)pParam; | 577 int32_t iPageIdx = (int32_t)(uintptr_t)pParam; |
578 IXFA_PageView* pNewPageView = pDocView->GetPageView(iPageIdx); | 578 IXFA_PageView* pNewPageView = pDocView->GetPageView(iPageIdx); |
579 FX_DWORD dwStatus = (FX_DWORD)(uintptr_t)pParam2; | 579 FX_DWORD dwStatus = (FX_DWORD)(uintptr_t)pParam2; |
580 FX_DWORD dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable | | 580 FX_DWORD dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable | |
581 XFA_WIDGETSTATUS_Printable; | 581 XFA_WIDGETSTATUS_Printable; |
582 pWidget->ModifyStatus(dwStatus, dwFilter); | 582 pWidget->ModifyStatus(dwStatus, dwFilter); |
583 if (pDocView->GetLayoutStatus() >= XFA_DOCVIEW_LAYOUTSTATUS_End) { | 583 IXFA_PageView* pPrePageView = pWidget->GetPageView(); |
584 IXFA_PageView* pPrePageView = pWidget->GetPageView(); | 584 if (pPrePageView != pNewPageView || |
585 if (pPrePageView != pNewPageView || | 585 (dwStatus & (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) == |
586 (dwStatus & (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) == | 586 (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) { |
587 (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) { | 587 pWidget->SetPageView(pNewPageView); |
588 pWidget->SetPageView(pNewPageView); | 588 m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(), |
589 m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(), | 589 XFA_WIDGETEVENT_PostAdded, |
590 XFA_WIDGETEVENT_PostAdded, | 590 pNewPageView, pPrePageView); |
591 pNewPageView, pPrePageView); | 591 } |
592 } | 592 if (pDocView->GetLayoutStatus() != XFA_DOCVIEW_LAYOUTSTATUS_End || |
593 if ((dwStatus & XFA_WIDGETSTATUS_Visible) == 0) { | 593 !(dwStatus & XFA_WIDGETSTATUS_Visible)) { |
594 return; | 594 return; |
595 } | 595 } |
596 if (pWidget->IsLoaded()) { | 596 if (pWidget->IsLoaded()) { |
597 CFX_RectF rtOld; | 597 CFX_RectF rtOld; |
598 pWidget->GetWidgetRect(rtOld); | 598 pWidget->GetWidgetRect(rtOld); |
599 CFX_RectF rtNew = pWidget->ReCacheWidgetRect(); | 599 if (rtOld != pWidget->ReCacheWidgetRect()) |
600 if (rtOld != rtNew) { | 600 pWidget->PerformLayout(); |
601 pWidget->PerformLayout(); | |
602 } | |
603 } else { | |
604 pWidget->LoadWidget(); | |
605 } | |
606 pWidget->AddInvalidateRect(NULL); | |
607 } else { | 601 } else { |
608 pWidget->SetPageView(pNewPageView); | 602 pWidget->LoadWidget(); |
609 } | 603 } |
| 604 pWidget->AddInvalidateRect(nullptr); |
610 } | 605 } |
611 void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView, | 606 void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView, |
612 IXFA_DocLayout* pLayout, | 607 IXFA_DocLayout* pLayout, |
613 CXFA_LayoutItem* pSender, | 608 CXFA_LayoutItem* pSender, |
614 void* pParam, | 609 void* pParam, |
615 void* pParam2) { | 610 void* pParam2) { |
616 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender); | 611 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender); |
617 pDocView->DeleteLayoutItem(pWidget); | 612 pDocView->DeleteLayoutItem(pWidget); |
618 if (pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End) | |
619 return; | |
620 m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(), | 613 m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(), |
621 XFA_WIDGETEVENT_PreRemoved, nullptr, | 614 XFA_WIDGETEVENT_PreRemoved, nullptr, |
622 pWidget->GetPageView()); | 615 pWidget->GetPageView()); |
623 pWidget->AddInvalidateRect(nullptr); | 616 pWidget->AddInvalidateRect(nullptr); |
624 } | 617 } |
625 void CXFA_FFNotify::OnLayoutItemRectChanged(CXFA_FFDocView* pDocView, | 618 void CXFA_FFNotify::OnLayoutItemRectChanged(CXFA_FFDocView* pDocView, |
626 IXFA_DocLayout* pLayout, | 619 IXFA_DocLayout* pLayout, |
627 CXFA_LayoutItem* pSender, | 620 CXFA_LayoutItem* pSender, |
628 void* pParam, | 621 void* pParam, |
629 void* pParam2) { | 622 void* pParam2) { |
(...skipping 18 matching lines...) Expand all Loading... |
648 } | 641 } |
649 } | 642 } |
650 FX_DWORD dwOldStatus = pWidget->GetStatus(); | 643 FX_DWORD dwOldStatus = pWidget->GetStatus(); |
651 FX_DWORD dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable | | 644 FX_DWORD dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable | |
652 XFA_WIDGETSTATUS_Printable; | 645 XFA_WIDGETSTATUS_Printable; |
653 if ((dwOldStatus & dwFilter) == dwStatus) { | 646 if ((dwOldStatus & dwFilter) == dwStatus) { |
654 return; | 647 return; |
655 } | 648 } |
656 pWidget->ModifyStatus(dwStatus, dwFilter); | 649 pWidget->ModifyStatus(dwStatus, dwFilter); |
657 } | 650 } |
OLD | NEW |