• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef XFA_FXFA_CXFA_FFNOTIFY_H_
8 #define XFA_FXFA_CXFA_FFNOTIFY_H_
9 
10 #include "core/fxcrt/mask.h"
11 #include "fxjs/gc/heap.h"
12 #include "v8/include/cppgc/garbage-collected.h"
13 #include "v8/include/cppgc/member.h"
14 #include "v8/include/cppgc/visitor.h"
15 #include "xfa/fxfa/cxfa_eventparam.h"
16 #include "xfa/fxfa/cxfa_ffapp.h"
17 #include "xfa/fxfa/cxfa_ffdoc.h"
18 #include "xfa/fxfa/cxfa_ffdocview.h"
19 #include "xfa/fxfa/parser/cxfa_document.h"
20 
21 class CXFA_LayoutItem;
22 class CXFA_LayoutProcessor;
23 class CXFA_Script;
24 class CXFA_ViewLayoutItem;
25 
26 class CXFA_FFNotify : public cppgc::GarbageCollected<CXFA_FFNotify> {
27  public:
28   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
29   ~CXFA_FFNotify();
30 
31   void Trace(cppgc::Visitor* visitor) const;
32 
33   void OnPageViewEvent(CXFA_ViewLayoutItem* pSender,
34                        CXFA_FFDoc::PageViewEvent eEvent);
35 
36   void OnWidgetListItemAdded(CXFA_Node* pSender,
37                              const WideString& wsLabel,
38                              int32_t iIndex);
39   void OnWidgetListItemRemoved(CXFA_Node* pSender, int32_t iIndex);
40 
41   // Node events
42   void OnNodeReady(CXFA_Node* pNode);
43   void OnValueChanging(CXFA_Node* pSender, XFA_Attribute eAttr);
44   void OnValueChanged(CXFA_Node* pSender,
45                       XFA_Attribute eAttr,
46                       CXFA_Node* pParentNode,
47                       CXFA_Node* pWidgetNode);
48   void OnContainerChanged();
49   void OnChildAdded(CXFA_Node* pSender);
50   void OnChildRemoved();
51 
52   // These two return new views/widgets from cppgc heap.
53   CXFA_FFPageView* OnCreateViewLayoutItem(CXFA_Node* pNode);
54   CXFA_FFWidget* OnCreateContentLayoutItem(CXFA_Node* pNode);
55 
56   void OnLayoutItemAdded(CXFA_LayoutProcessor* pLayout,
57                          CXFA_LayoutItem* pSender,
58                          int32_t iPageIdx,
59                          Mask<XFA_WidgetStatus> dwStatus);
60   void OnLayoutItemRemoving(CXFA_LayoutProcessor* pLayout,
61                             CXFA_LayoutItem* pSender);
62   void StartFieldDrawLayout(CXFA_Node* pItem,
63                             float* pCalcWidth,
64                             float* pCalcHeight);
65   bool RunScript(CXFA_Script* pScript, CXFA_Node* pFormItem);
66   XFA_EventError ExecEventByDeepFirst(CXFA_Node* pFormNode,
67                                       XFA_EVENTTYPE eEventType,
68                                       bool bIsFormReady,
69                                       bool bRecursive);
70   void AddCalcValidate(CXFA_Node* pNode);
GetFFDoc()71   CXFA_FFDoc* GetFFDoc() const { return m_pDoc; }
72   CXFA_FFApp::CallbackIface* GetAppProvider();
73   void HandleWidgetEvent(CXFA_Node* pNode, CXFA_EventParam* pParam);
74   void OpenDropDownList(CXFA_Node* pNode);
75   void ResetData(CXFA_Node* pNode);
76   CXFA_FFDocView::LayoutStatus GetLayoutStatus();
77   void RunNodeInitialize(CXFA_Node* pNode);
78   void RunSubformIndexChange(CXFA_Subform* pSubformNode);
79   CXFA_Node* GetFocusWidgetNode();
80   void SetFocusWidgetNode(CXFA_Node* pNode);
81 
82  private:
83   explicit CXFA_FFNotify(CXFA_FFDoc* pDoc);
84 
85   cppgc::Member<CXFA_FFDoc> const m_pDoc;
86 };
87 
88 #endif  // XFA_FXFA_CXFA_FFNOTIFY_H_
89