Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: xfa/fxfa/app/xfa_ffnotify.cpp

Issue 1846993002: Remove IXFA_* interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "xfa/fxfa/app/xfa_ffapp.h" 9 #include "xfa/include/fxfa/xfa_ffapp.h"
10 #include "xfa/fxfa/app/xfa_ffbarcode.h" 10 #include "xfa/fxfa/app/xfa_ffbarcode.h"
11 #include "xfa/fxfa/app/xfa_ffcheckbutton.h" 11 #include "xfa/fxfa/app/xfa_ffcheckbutton.h"
12 #include "xfa/fxfa/app/xfa_ffchoicelist.h" 12 #include "xfa/fxfa/app/xfa_ffchoicelist.h"
13 #include "xfa/fxfa/app/xfa_ffdoc.h" 13 #include "xfa/include/fxfa/xfa_ffdoc.h"
14 #include "xfa/fxfa/app/xfa_ffdocview.h" 14 #include "xfa/include/fxfa/xfa_ffdocview.h"
15 #include "xfa/fxfa/app/xfa_ffdraw.h" 15 #include "xfa/fxfa/app/xfa_ffdraw.h"
16 #include "xfa/fxfa/app/xfa_ffexclgroup.h" 16 #include "xfa/fxfa/app/xfa_ffexclgroup.h"
17 #include "xfa/fxfa/app/xfa_fffield.h" 17 #include "xfa/fxfa/app/xfa_fffield.h"
18 #include "xfa/fxfa/app/xfa_ffimage.h" 18 #include "xfa/fxfa/app/xfa_ffimage.h"
19 #include "xfa/fxfa/app/xfa_ffimageedit.h" 19 #include "xfa/fxfa/app/xfa_ffimageedit.h"
20 #include "xfa/fxfa/app/xfa_ffpageview.h" 20 #include "xfa/include/fxfa/xfa_ffpageview.h"
21 #include "xfa/fxfa/app/xfa_ffpath.h" 21 #include "xfa/fxfa/app/xfa_ffpath.h"
22 #include "xfa/fxfa/app/xfa_ffpushbutton.h" 22 #include "xfa/fxfa/app/xfa_ffpushbutton.h"
23 #include "xfa/fxfa/app/xfa_ffsignature.h" 23 #include "xfa/fxfa/app/xfa_ffsignature.h"
24 #include "xfa/fxfa/app/xfa_ffsubform.h" 24 #include "xfa/fxfa/app/xfa_ffsubform.h"
25 #include "xfa/fxfa/app/xfa_fftext.h" 25 #include "xfa/fxfa/app/xfa_fftext.h"
26 #include "xfa/fxfa/app/xfa_fftextedit.h" 26 #include "xfa/fxfa/app/xfa_fftextedit.h"
27 #include "xfa/fxfa/app/xfa_ffwidget.h" 27 #include "xfa/fxfa/app/xfa_ffwidget.h"
28 #include "xfa/fxfa/app/xfa_ffwidgetacc.h" 28 #include "xfa/fxfa/app/xfa_ffwidgetacc.h"
29 #include "xfa/fxfa/app/xfa_ffwidgethandler.h" 29 #include "xfa/include/fxfa/xfa_ffwidgethandler.h"
30 #include "xfa/fxfa/app/xfa_fwladapter.h" 30 #include "xfa/fxfa/app/xfa_fwladapter.h"
31 #include "xfa/fxfa/app/xfa_textlayout.h" 31 #include "xfa/fxfa/app/xfa_textlayout.h"
32 32
33 static void XFA_FFDeleteWidgetAcc(void* pData) { 33 static void XFA_FFDeleteWidgetAcc(void* pData) {
34 delete static_cast<CXFA_WidgetAcc*>(pData); 34 delete static_cast<CXFA_WidgetAcc*>(pData);
35 } 35 }
36
36 static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADeleteWidgetAcc = { 37 static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADeleteWidgetAcc = {
37 XFA_FFDeleteWidgetAcc, NULL}; 38 XFA_FFDeleteWidgetAcc, nullptr};
39
38 CXFA_FFNotify::CXFA_FFNotify(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {} 40 CXFA_FFNotify::CXFA_FFNotify(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {}
39 CXFA_FFNotify::~CXFA_FFNotify() {} 41 CXFA_FFNotify::~CXFA_FFNotify() {}
40 void CXFA_FFNotify::OnPageEvent(IXFA_LayoutPage* pSender, 42 void CXFA_FFNotify::OnPageEvent(CXFA_ContainerLayoutItem* pSender,
41 XFA_PAGEEVENT eEvent, 43 XFA_PAGEEVENT eEvent,
42 void* pParam) { 44 void* pParam) {
43 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pSender->GetLayout()); 45 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pSender->GetLayout());
44 if (!pDocView) { 46 if (!pDocView) {
45 return; 47 return;
46 } 48 }
47 pDocView->OnPageEvent(pSender, eEvent, (int32_t)(uintptr_t)pParam); 49 pDocView->OnPageEvent(pSender, eEvent, (int32_t)(uintptr_t)pParam);
48 } 50 }
49 void CXFA_FFNotify::OnNodeEvent(CXFA_Node* pSender, 51 void CXFA_FFNotify::OnNodeEvent(CXFA_Node* pSender,
50 XFA_NODEEVENT eEvent, 52 XFA_NODEEVENT eEvent,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent( 141 pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent(
140 pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemRemoved, pParam, 142 pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemRemoved, pParam,
141 pAdditional); 143 pAdditional);
142 } 144 }
143 pWidget = pWidgetAcc->GetNextWidget(pWidget); 145 pWidget = pWidgetAcc->GetNextWidget(pWidget);
144 } 146 }
145 } break; 147 } break;
146 } 148 }
147 } 149 }
148 CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) { 150 CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) {
149 IXFA_DocLayout* pLayout = m_pDoc->GetXFADoc()->GetDocLayout(); 151 CXFA_LayoutProcessor* pLayout = m_pDoc->GetXFADoc()->GetDocLayout();
150 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); 152 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout);
151 XFA_ELEMENT eType = pNode->GetClassID(); 153 XFA_ELEMENT eType = pNode->GetClassID();
152 if (eType == XFA_ELEMENT_PageArea) { 154 if (eType == XFA_ELEMENT_PageArea) {
153 return new CXFA_FFPageView(pDocView, pNode); 155 return new CXFA_FFPageView(pDocView, pNode);
154 } 156 }
155 if (eType == XFA_ELEMENT_ContentArea) { 157 if (eType == XFA_ELEMENT_ContentArea) {
156 return new CXFA_ContainerLayoutItem(pNode); 158 return new CXFA_ContainerLayoutItem(pNode);
157 } 159 }
158 CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()); 160 CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData());
159 if (!pAcc) { 161 if (!pAcc) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 default: 226 default:
225 pWidget = NULL; 227 pWidget = NULL;
226 break; 228 break;
227 } 229 }
228 if (!pWidget) { 230 if (!pWidget) {
229 return NULL; 231 return NULL;
230 } 232 }
231 pWidget->SetDocView(pDocView); 233 pWidget->SetDocView(pDocView);
232 return pWidget; 234 return pWidget;
233 } 235 }
234 void CXFA_FFNotify::OnLayoutEvent(IXFA_DocLayout* pLayout, 236 void CXFA_FFNotify::OnLayoutEvent(CXFA_LayoutProcessor* pLayout,
235 CXFA_LayoutItem* pSender, 237 CXFA_LayoutItem* pSender,
236 XFA_LAYOUTEVENT eEvent, 238 XFA_LAYOUTEVENT eEvent,
237 void* pParam, 239 void* pParam,
238 void* pParam2) { 240 void* pParam2) {
239 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); 241 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout);
240 if (!pDocView || !XFA_GetWidgetFromLayoutItem(pSender)) { 242 if (!pDocView || !XFA_GetWidgetFromLayoutItem(pSender)) {
241 return; 243 return;
242 } 244 }
243 switch (eEvent) { 245 switch (eEvent) {
244 case XFA_LAYOUTEVENT_ItemAdded: 246 case XFA_LAYOUTEVENT_ItemAdded:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 return; 316 return;
315 } 317 }
316 CXFA_WidgetAcc* pWidgetAcc = 318 CXFA_WidgetAcc* pWidgetAcc =
317 static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()); 319 static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData());
318 if (!pWidgetAcc) { 320 if (!pWidgetAcc) {
319 return; 321 return;
320 } 322 }
321 pDocView->AddCalculateWidgetAcc(pWidgetAcc); 323 pDocView->AddCalculateWidgetAcc(pWidgetAcc);
322 pDocView->AddValidateWidget(pWidgetAcc); 324 pDocView->AddValidateWidget(pWidgetAcc);
323 } 325 }
324 IXFA_Doc* CXFA_FFNotify::GetHDOC() { 326 CXFA_FFDoc* CXFA_FFNotify::GetHDOC() {
325 return m_pDoc; 327 return m_pDoc;
326 } 328 }
327 IXFA_DocProvider* CXFA_FFNotify::GetDocProvider() { 329 IXFA_DocProvider* CXFA_FFNotify::GetDocProvider() {
328 return m_pDoc->GetDocProvider(); 330 return m_pDoc->GetDocProvider();
329 } 331 }
330 IXFA_AppProvider* CXFA_FFNotify::GetAppProvider() { 332 IXFA_AppProvider* CXFA_FFNotify::GetAppProvider() {
331 return m_pDoc->GetApp()->GetAppProvider(); 333 return m_pDoc->GetApp()->GetAppProvider();
332 } 334 }
333 IXFA_WidgetHandler* CXFA_FFNotify::GetWidgetHandler() { 335 CXFA_FFWidgetHandler* CXFA_FFNotify::GetWidgetHandler() {
334 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); 336 CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
335 return pDocView ? pDocView->GetWidgetHandler() : NULL; 337 return pDocView ? pDocView->GetWidgetHandler() : NULL;
336 } 338 }
337 IXFA_Widget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) { 339 CXFA_FFWidget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) {
338 return XFA_GetWidgetFromLayoutItem(pLayoutItem); 340 return XFA_GetWidgetFromLayoutItem(pLayoutItem);
339 } 341 }
340 void CXFA_FFNotify::OpenDropDownList(IXFA_Widget* hWidget) { 342 void CXFA_FFNotify::OpenDropDownList(CXFA_FFWidget* hWidget) {
341 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(hWidget); 343 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(hWidget);
342 if (pWidget->GetDataAcc()->GetUIType() != XFA_ELEMENT_ChoiceList) { 344 if (pWidget->GetDataAcc()->GetUIType() != XFA_ELEMENT_ChoiceList) {
343 return; 345 return;
344 } 346 }
345 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); 347 CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
346 pDocView->LockUpdate(); 348 pDocView->LockUpdate();
347 static_cast<CXFA_FFComboBox*>(pWidget)->OpenDropDownList(); 349 static_cast<CXFA_FFComboBox*>(pWidget)->OpenDropDownList();
348 pDocView->UnlockUpdate(); 350 pDocView->UnlockUpdate();
349 pDocView->UpdateDocView(); 351 pDocView->UpdateDocView();
350 } 352 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 if (CXFA_FFDocView* pDocView = m_pDoc->GetDocView()) { 563 if (CXFA_FFDocView* pDocView = m_pDoc->GetDocView()) {
562 FX_BOOL bLayoutReady = 564 FX_BOOL bLayoutReady =
563 !(pDocView->m_bInLayoutStatus) && 565 !(pDocView->m_bInLayoutStatus) &&
564 (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); 566 (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End);
565 if (bLayoutReady) { 567 if (bLayoutReady) {
566 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); 568 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc);
567 } 569 }
568 } 570 }
569 } 571 }
570 void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView, 572 void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView,
571 IXFA_DocLayout* pLayout, 573 CXFA_LayoutProcessor* pLayout,
572 CXFA_LayoutItem* pSender, 574 CXFA_LayoutItem* pSender,
573 void* pParam, 575 void* pParam,
574 void* pParam2) { 576 void* pParam2) {
575 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender); 577 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender);
576 int32_t iPageIdx = (int32_t)(uintptr_t)pParam; 578 int32_t iPageIdx = (int32_t)(uintptr_t)pParam;
577 IXFA_PageView* pNewPageView = pDocView->GetPageView(iPageIdx); 579 CXFA_FFPageView* pNewPageView = pDocView->GetPageView(iPageIdx);
578 uint32_t dwStatus = (uint32_t)(uintptr_t)pParam2; 580 uint32_t dwStatus = (uint32_t)(uintptr_t)pParam2;
579 uint32_t dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable | 581 uint32_t dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable |
580 XFA_WIDGETSTATUS_Printable; 582 XFA_WIDGETSTATUS_Printable;
581 pWidget->ModifyStatus(dwStatus, dwFilter); 583 pWidget->ModifyStatus(dwStatus, dwFilter);
582 IXFA_PageView* pPrePageView = pWidget->GetPageView(); 584 CXFA_FFPageView* pPrePageView = pWidget->GetPageView();
583 if (pPrePageView != pNewPageView || 585 if (pPrePageView != pNewPageView ||
584 (dwStatus & (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) == 586 (dwStatus & (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) ==
585 (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) { 587 (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) {
586 pWidget->SetPageView(pNewPageView); 588 pWidget->SetPageView(pNewPageView);
587 m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(), 589 m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(),
588 XFA_WIDGETEVENT_PostAdded, 590 XFA_WIDGETEVENT_PostAdded,
589 pNewPageView, pPrePageView); 591 pNewPageView, pPrePageView);
590 } 592 }
591 if (pDocView->GetLayoutStatus() != XFA_DOCVIEW_LAYOUTSTATUS_End || 593 if (pDocView->GetLayoutStatus() != XFA_DOCVIEW_LAYOUTSTATUS_End ||
592 !(dwStatus & XFA_WIDGETSTATUS_Visible)) { 594 !(dwStatus & XFA_WIDGETSTATUS_Visible)) {
593 return; 595 return;
594 } 596 }
595 if (pWidget->IsLoaded()) { 597 if (pWidget->IsLoaded()) {
596 CFX_RectF rtOld; 598 CFX_RectF rtOld;
597 pWidget->GetWidgetRect(rtOld); 599 pWidget->GetWidgetRect(rtOld);
598 if (rtOld != pWidget->ReCacheWidgetRect()) 600 if (rtOld != pWidget->ReCacheWidgetRect())
599 pWidget->PerformLayout(); 601 pWidget->PerformLayout();
600 } else { 602 } else {
601 pWidget->LoadWidget(); 603 pWidget->LoadWidget();
602 } 604 }
603 pWidget->AddInvalidateRect(nullptr); 605 pWidget->AddInvalidateRect(nullptr);
604 } 606 }
605 void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView, 607 void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView,
606 IXFA_DocLayout* pLayout, 608 CXFA_LayoutProcessor* pLayout,
607 CXFA_LayoutItem* pSender, 609 CXFA_LayoutItem* pSender,
608 void* pParam, 610 void* pParam,
609 void* pParam2) { 611 void* pParam2) {
610 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender); 612 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender);
611 pDocView->DeleteLayoutItem(pWidget); 613 pDocView->DeleteLayoutItem(pWidget);
612 m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(), 614 m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(),
613 XFA_WIDGETEVENT_PreRemoved, nullptr, 615 XFA_WIDGETEVENT_PreRemoved, nullptr,
614 pWidget->GetPageView()); 616 pWidget->GetPageView());
615 pWidget->AddInvalidateRect(nullptr); 617 pWidget->AddInvalidateRect(nullptr);
616 } 618 }
617 void CXFA_FFNotify::OnLayoutItemRectChanged(CXFA_FFDocView* pDocView, 619 void CXFA_FFNotify::OnLayoutItemRectChanged(CXFA_FFDocView* pDocView,
618 IXFA_DocLayout* pLayout, 620 CXFA_LayoutProcessor* pLayout,
619 CXFA_LayoutItem* pSender, 621 CXFA_LayoutItem* pSender,
620 void* pParam, 622 void* pParam,
621 void* pParam2) {} 623 void* pParam2) {}
622 void CXFA_FFNotify::OnLayoutItemStatustChanged(CXFA_FFDocView* pDocView, 624 void CXFA_FFNotify::OnLayoutItemStatustChanged(CXFA_FFDocView* pDocView,
623 IXFA_DocLayout* pLayout, 625 CXFA_LayoutProcessor* pLayout,
624 CXFA_LayoutItem* pSender, 626 CXFA_LayoutItem* pSender,
625 void* pParam, 627 void* pParam,
626 void* pParam2) { 628 void* pParam2) {
627 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender); 629 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender);
628 if (!pWidget) { 630 if (!pWidget) {
629 return; 631 return;
630 } 632 }
631 uint32_t dwStatus = (uint32_t)(uintptr_t)pParam; 633 uint32_t dwStatus = (uint32_t)(uintptr_t)pParam;
632 if (dwStatus == 0) { 634 if (dwStatus == 0) {
633 CXFA_LayoutItem* pPreItem = pSender->GetPrev(); 635 CXFA_LayoutItem* pPreItem = pSender->GetPrev();
634 if (pPreItem) { 636 if (pPreItem) {
635 CXFA_FFWidget* pPreWidget = static_cast<CXFA_FFWidget*>(pPreItem); 637 CXFA_FFWidget* pPreWidget = static_cast<CXFA_FFWidget*>(pPreItem);
636 if (pPreWidget) { 638 if (pPreWidget) {
637 dwStatus = pPreWidget->GetStatus(); 639 dwStatus = pPreWidget->GetStatus();
638 } 640 }
639 } 641 }
640 } 642 }
641 uint32_t dwOldStatus = pWidget->GetStatus(); 643 uint32_t dwOldStatus = pWidget->GetStatus();
642 uint32_t dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable | 644 uint32_t dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable |
643 XFA_WIDGETSTATUS_Printable; 645 XFA_WIDGETSTATUS_Printable;
644 if ((dwOldStatus & dwFilter) == dwStatus) { 646 if ((dwOldStatus & dwFilter) == dwStatus) {
645 return; 647 return;
646 } 648 }
647 pWidget->ModifyStatus(dwStatus, dwFilter); 649 pWidget->ModifyStatus(dwStatus, dwFilter);
648 } 650 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698