diff options
author | dsinclair <dsinclair@chromium.org> | 2016-05-16 13:37:46 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-16 13:37:46 -0700 |
commit | c6450bb06b69528406a2a261c70c4ea769965a8d (patch) | |
tree | 8647dafb8464c0ee22a64a4a8f100d40714af34a /fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | |
parent | cc4d6d85b58a7a1d9d7b798c63d3343f3dac06a9 (diff) | |
download | pdfium-c6450bb06b69528406a2a261c70c4ea769965a8d.tar.xz |
Remove XFA_WIDGETEVENT defines
The XFA_WIDGETEVENT defines were used to allow one method to handle the PostAdd
and PreRemove calls. The calls only shared setup code. This CL splits the
WidgetEvent method into two, one for PostAdd and one for PreRemove and updates
the only two callers to call the correct variant.
Review-Url: https://codereview.chromium.org/1982033002
Diffstat (limited to 'fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp')
-rw-r--r-- | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index b2f752e8b9..4d2a559a39 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -527,14 +527,25 @@ void CPDFXFA_Document::PageViewEvent(CXFA_FFPageView* pPageView, } } -void CPDFXFA_Document::WidgetEvent(CXFA_FFWidget* hWidget, - CXFA_WidgetAcc* pWidgetData, - uint32_t dwEvent) { +void CPDFXFA_Document::WidgetPostAdd(CXFA_FFWidget* hWidget, + CXFA_WidgetAcc* pWidgetData) { if (m_iDocType != DOCTYPE_DYNAMIC_XFA || !hWidget) return; - CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); - if (!pEnv) + CXFA_FFPageView* pPageView = hWidget->GetPageView(); + if (!pPageView) + return; + + CPDFXFA_Page* pXFAPage = GetPage(pPageView); + if (!pXFAPage) + return; + + m_pSDKDoc->GetPageView(pXFAPage)->AddAnnot(hWidget); +} + +void CPDFXFA_Document::WidgetPreRemove(CXFA_FFWidget* hWidget, + CXFA_WidgetAcc* pWidgetData) { + if (m_iDocType != DOCTYPE_DYNAMIC_XFA || !hWidget) return; CXFA_FFPageView* pPageView = hWidget->GetPageView(); @@ -546,13 +557,8 @@ void CPDFXFA_Document::WidgetEvent(CXFA_FFWidget* hWidget, return; CPDFSDK_PageView* pSdkPageView = m_pSDKDoc->GetPageView(pXFAPage); - if (dwEvent == XFA_WIDGETEVENT_PostAdded) { - pSdkPageView->AddAnnot(hWidget); - } else if (dwEvent == XFA_WIDGETEVENT_PreRemoved) { - CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget); - if (pAnnot) - pSdkPageView->DeleteAnnot(pAnnot); - } + if (CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget)) + pSdkPageView->DeleteAnnot(pAnnot); } int32_t CPDFXFA_Document::CountPages(CXFA_FFDoc* hDoc) { |