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 #ifndef XFA_FXFA_PARSER_XFA_DOCUMENT_H_ | 7 #ifndef XFA_FXFA_PARSER_XFA_DOCUMENT_H_ |
8 #define XFA_FXFA_PARSER_XFA_DOCUMENT_H_ | 8 #define XFA_FXFA_PARSER_XFA_DOCUMENT_H_ |
9 | 9 |
10 #include "xfa/fxfa/parser/xfa_localemgr.h" | 10 #include "xfa/fxfa/parser/xfa_localemgr.h" |
11 #include "xfa/fxfa/parser/xfa_object.h" | 11 #include "xfa/fxfa/parser/xfa_object.h" |
12 #include "xfa/include/fxfa/fxfa.h" | 12 #include "xfa/include/fxfa/fxfa.h" |
13 | 13 |
14 class CXFA_Document; | 14 class CXFA_Document; |
15 class CXFA_LayoutItem; | 15 class CXFA_LayoutItem; |
16 class CXFA_LayoutProcessor; | 16 class CXFA_LayoutProcessor; |
17 class CXFA_Node; | 17 class CXFA_Node; |
18 class IXFA_DocLayout; | 18 class CXFA_LayoutProcessor; |
19 class IXFA_DocParser; | 19 class CXFA_DocumentParser; |
20 class IXFA_LayoutPage; | 20 class CXFA_ContainerLayoutItem; |
21 class IXFA_Notify; | 21 class CXFA_FFNotify; |
22 class IXFA_ObjFactory; | 22 class CXFA_ScriptContext; |
23 class IXFA_ScriptContext; | |
24 | 23 |
25 enum XFA_VERSION { | 24 enum XFA_VERSION { |
26 XFA_VERSION_UNKNOWN = 0, | 25 XFA_VERSION_UNKNOWN = 0, |
27 XFA_VERSION_200 = 200, | 26 XFA_VERSION_200 = 200, |
28 XFA_VERSION_202 = 202, | 27 XFA_VERSION_202 = 202, |
29 XFA_VERSION_204 = 204, | 28 XFA_VERSION_204 = 204, |
30 XFA_VERSION_205 = 205, | 29 XFA_VERSION_205 = 205, |
31 XFA_VERSION_206 = 206, | 30 XFA_VERSION_206 = 206, |
32 XFA_VERSION_207 = 207, | 31 XFA_VERSION_207 = 207, |
33 XFA_VERSION_208 = 208, | 32 XFA_VERSION_208 = 208, |
(...skipping 27 matching lines...) Expand all Loading... |
61 XFA_LAYOUTEVENT_StatusChanged, | 60 XFA_LAYOUTEVENT_StatusChanged, |
62 }; | 61 }; |
63 enum XFA_LAYOUTRESULT { | 62 enum XFA_LAYOUTRESULT { |
64 XFA_LAYOUTRESULT_Continue, | 63 XFA_LAYOUTRESULT_Continue, |
65 XFA_LAYOUTRESULT_Done, | 64 XFA_LAYOUTRESULT_Done, |
66 XFA_LAYOUTRESULT_NextContent, | 65 XFA_LAYOUTRESULT_NextContent, |
67 }; | 66 }; |
68 #define XFA_LAYOUTNOTIFY_StrictHeight 0x0001 | 67 #define XFA_LAYOUTNOTIFY_StrictHeight 0x0001 |
69 #define XFA_LAYOUTNOTIFY_NoParentBreak 0x0002 | 68 #define XFA_LAYOUTNOTIFY_NoParentBreak 0x0002 |
70 | 69 |
71 class IXFA_Notify { | |
72 public: | |
73 virtual ~IXFA_Notify() {} | |
74 virtual void OnPageEvent(IXFA_LayoutPage* pSender, | |
75 XFA_PAGEEVENT eEvent, | |
76 void* pParam = NULL) = 0; | |
77 | |
78 virtual void OnNodeEvent(CXFA_Node* pSender, | |
79 XFA_NODEEVENT eEvent, | |
80 void* pParam = NULL, | |
81 void* pParam2 = NULL, | |
82 void* pParam3 = NULL, | |
83 void* pParam4 = NULL) = 0; | |
84 virtual void OnWidgetDataEvent(CXFA_WidgetData* pSender, | |
85 uint32_t dwEvent, | |
86 void* pParam = NULL, | |
87 void* pAdditional = NULL, | |
88 void* pAdditional2 = NULL) = 0; | |
89 | |
90 virtual CXFA_LayoutItem* OnCreateLayoutItem(CXFA_Node* pNode) = 0; | |
91 virtual void OnLayoutEvent(IXFA_DocLayout* pLayout, | |
92 CXFA_LayoutItem* pSender, | |
93 XFA_LAYOUTEVENT eEvent, | |
94 void* pParam = NULL, | |
95 void* pParam2 = NULL) = 0; | |
96 virtual void StartFieldDrawLayout(CXFA_Node* pItem, | |
97 FX_FLOAT& fCalcWidth, | |
98 FX_FLOAT& fCalcHeight) = 0; | |
99 virtual FX_BOOL FindSplitPos(CXFA_Node* pItem, | |
100 int32_t iBlockIndex, | |
101 FX_FLOAT& fCalcHeightPos) = 0; | |
102 virtual FX_BOOL RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem) = 0; | |
103 virtual int32_t ExecEventByDeepFirst(CXFA_Node* pFormNode, | |
104 XFA_EVENTTYPE eEventType, | |
105 FX_BOOL bIsFormReady = FALSE, | |
106 FX_BOOL bRecursive = TRUE, | |
107 CXFA_WidgetAcc* pExclude = NULL) = 0; | |
108 virtual void AddCalcValidate(CXFA_Node* pNode) = 0; | |
109 virtual IXFA_Doc* GetHDOC() = 0; | |
110 virtual IXFA_DocProvider* GetDocProvider() = 0; | |
111 virtual IXFA_AppProvider* GetAppProvider() = 0; | |
112 virtual IXFA_WidgetHandler* GetWidgetHandler() = 0; | |
113 virtual IXFA_Widget* GetHWidget(CXFA_LayoutItem* pLayoutItem) = 0; | |
114 virtual void OpenDropDownList(IXFA_Widget* hWidget) = 0; | |
115 virtual CFX_WideString GetCurrentDateTime() = 0; | |
116 virtual void ResetData(CXFA_WidgetData* pWidgetData = NULL) = 0; | |
117 virtual int32_t GetLayoutStatus() = 0; | |
118 virtual void RunNodeInitialize(CXFA_Node* pNode) = 0; | |
119 virtual void RunSubformIndexChange(CXFA_Node* pSubformNode) = 0; | |
120 virtual CXFA_Node* GetFocusWidgetNode() = 0; | |
121 virtual void SetFocusWidgetNode(CXFA_Node* pNode) = 0; | |
122 }; | |
123 class IXFA_ObjFactory { | |
124 public: | |
125 virtual ~IXFA_ObjFactory() {} | |
126 virtual CXFA_Node* CreateNode(uint32_t dwPacket, XFA_ELEMENT eElement) = 0; | |
127 virtual CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, | |
128 XFA_ELEMENT eElement) = 0; | |
129 }; | |
130 #define XFA_DOCFLAG_StrictScoping 0x0001 | 70 #define XFA_DOCFLAG_StrictScoping 0x0001 |
131 #define XFA_DOCFLAG_HasInteractive 0x0002 | 71 #define XFA_DOCFLAG_HasInteractive 0x0002 |
132 #define XFA_DOCFLAG_Interactive 0x0004 | 72 #define XFA_DOCFLAG_Interactive 0x0004 |
133 #define XFA_DOCFLAG_Scripting 0x0008 | 73 #define XFA_DOCFLAG_Scripting 0x0008 |
134 class CScript_DataWindow; | 74 class CScript_DataWindow; |
135 class CScript_EventPseudoModel; | 75 class CScript_EventPseudoModel; |
136 class CScript_HostPseudoModel; | 76 class CScript_HostPseudoModel; |
137 class CScript_LogPseudoModel; | 77 class CScript_LogPseudoModel; |
138 class CScript_LayoutPseudoModel; | 78 class CScript_LayoutPseudoModel; |
139 class CScript_SignaturePseudoModel; | 79 class CScript_SignaturePseudoModel; |
140 class CXFA_Document : public IXFA_ObjFactory { | 80 class CXFA_Document { |
141 public: | 81 public: |
142 CXFA_Document(IXFA_DocParser* pParser); | 82 CXFA_Document(CXFA_DocumentParser* pParser); |
143 ~CXFA_Document(); | 83 ~CXFA_Document(); |
144 CXFA_Node* GetRoot() const { return m_pRootNode; } | 84 CXFA_Node* GetRoot() const { return m_pRootNode; } |
145 IXFA_DocParser* GetParser() const { return m_pParser; } | 85 CXFA_DocumentParser* GetParser() const { return m_pParser; } |
146 IXFA_Notify* GetNotify() const; | 86 CXFA_FFNotify* GetNotify() const; |
147 void SetRoot(CXFA_Node* pNewRoot); | 87 void SetRoot(CXFA_Node* pNewRoot); |
148 CXFA_Object* GetXFAObject(const CFX_WideStringC& wsNodeName); | 88 CXFA_Object* GetXFAObject(const CFX_WideStringC& wsNodeName); |
149 CXFA_Object* GetXFAObject(uint32_t wsNodeNameHash); | 89 CXFA_Object* GetXFAObject(uint32_t wsNodeNameHash); |
150 void AddPurgeNode(CXFA_Node* pNode); | 90 void AddPurgeNode(CXFA_Node* pNode); |
151 FX_BOOL RemovePurgeNode(CXFA_Node* pNode); | 91 FX_BOOL RemovePurgeNode(CXFA_Node* pNode); |
152 void PurgeNodes(); | 92 void PurgeNodes(); |
153 bool HasFlag(uint32_t dwFlag) { return (m_dwDocFlags & dwFlag) == dwFlag; } | 93 bool HasFlag(uint32_t dwFlag) { return (m_dwDocFlags & dwFlag) == dwFlag; } |
154 void SetFlag(uint32_t dwFlag, FX_BOOL bOn = TRUE); | 94 void SetFlag(uint32_t dwFlag, FX_BOOL bOn = TRUE); |
155 FX_BOOL IsInteractive(); | 95 FX_BOOL IsInteractive(); |
156 XFA_VERSION GetCurVersionMode() { return m_eCurVersionMode; } | 96 XFA_VERSION GetCurVersionMode() { return m_eCurVersionMode; } |
157 XFA_VERSION RecognizeXFAVersionNumber(CFX_WideString& wsTemplateNS); | 97 XFA_VERSION RecognizeXFAVersionNumber(CFX_WideString& wsTemplateNS); |
158 CXFA_LocaleMgr* GetLocalMgr(); | 98 CXFA_LocaleMgr* GetLocalMgr(); |
159 virtual CXFA_Node* CreateNode(uint32_t dwPacket, XFA_ELEMENT eElement); | 99 CXFA_Node* CreateNode(uint32_t dwPacket, XFA_ELEMENT eElement); |
160 virtual CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, | 100 CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, XFA_ELEMENT eElement); |
161 XFA_ELEMENT eElement); | |
162 void DoProtoMerge(); | 101 void DoProtoMerge(); |
163 CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const CFX_WideStringC& wsID); | 102 CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const CFX_WideStringC& wsID); |
164 void DoDataMerge(); | 103 void DoDataMerge(); |
165 void DoDataRemerge(FX_BOOL bDoDataMerge); | 104 void DoDataRemerge(FX_BOOL bDoDataMerge); |
166 CXFA_Node* DataMerge_CopyContainer(CXFA_Node* pTemplateNode, | 105 CXFA_Node* DataMerge_CopyContainer(CXFA_Node* pTemplateNode, |
167 CXFA_Node* pFormNode, | 106 CXFA_Node* pFormNode, |
168 CXFA_Node* pDataScope, | 107 CXFA_Node* pDataScope, |
169 FX_BOOL bOneInstance = FALSE, | 108 FX_BOOL bOneInstance = FALSE, |
170 FX_BOOL bDataMerge = TRUE, | 109 FX_BOOL bDataMerge = TRUE, |
171 FX_BOOL bUpLevel = TRUE); | 110 FX_BOOL bUpLevel = TRUE); |
172 void DataMerge_UpdateBindingRelations(CXFA_Node* pFormUpdateRoot); | 111 void DataMerge_UpdateBindingRelations(CXFA_Node* pFormUpdateRoot); |
173 CXFA_Node* GetNotBindNode(CXFA_ObjArray& arrayNodes); | 112 CXFA_Node* GetNotBindNode(CXFA_ObjArray& arrayNodes); |
174 CXFA_LayoutProcessor* GetLayoutProcessor(); | 113 CXFA_LayoutProcessor* GetLayoutProcessor(); |
175 IXFA_DocLayout* GetDocLayout(); | 114 CXFA_LayoutProcessor* GetDocLayout(); |
176 IXFA_ScriptContext* InitScriptContext(FXJSE_HRUNTIME hRuntime); | 115 CXFA_ScriptContext* InitScriptContext(FXJSE_HRUNTIME hRuntime); |
177 IXFA_ScriptContext* GetScriptContext(); | 116 CXFA_ScriptContext* GetScriptContext(); |
178 void ClearLayoutData(); | 117 void ClearLayoutData(); |
179 | 118 |
180 CFX_MapPtrTemplate<uint32_t, CXFA_Node*> m_rgGlobalBinding; | 119 CFX_MapPtrTemplate<uint32_t, CXFA_Node*> m_rgGlobalBinding; |
181 CXFA_NodeArray m_pPendingPageSet; | 120 CXFA_NodeArray m_pPendingPageSet; |
182 | 121 |
183 protected: | 122 protected: |
184 IXFA_DocParser* m_pParser; | 123 CXFA_DocumentParser* m_pParser; |
185 IXFA_ScriptContext* m_pScriptContext; | 124 CXFA_ScriptContext* m_pScriptContext; |
186 CXFA_LayoutProcessor* m_pLayoutProcessor; | 125 CXFA_LayoutProcessor* m_pLayoutProcessor; |
187 CXFA_Node* m_pRootNode; | 126 CXFA_Node* m_pRootNode; |
188 CXFA_LocaleMgr* m_pLocalMgr; | 127 CXFA_LocaleMgr* m_pLocalMgr; |
189 CScript_DataWindow* m_pScriptDataWindow; | 128 CScript_DataWindow* m_pScriptDataWindow; |
190 CScript_EventPseudoModel* m_pScriptEvent; | 129 CScript_EventPseudoModel* m_pScriptEvent; |
191 CScript_HostPseudoModel* m_pScriptHost; | 130 CScript_HostPseudoModel* m_pScriptHost; |
192 CScript_LogPseudoModel* m_pScriptLog; | 131 CScript_LogPseudoModel* m_pScriptLog; |
193 CScript_LayoutPseudoModel* m_pScriptLayout; | 132 CScript_LayoutPseudoModel* m_pScriptLayout; |
194 CScript_SignaturePseudoModel* m_pScriptSignature; | 133 CScript_SignaturePseudoModel* m_pScriptSignature; |
195 CXFA_NodeSet m_rgPurgeNodes; | 134 CXFA_NodeSet m_rgPurgeNodes; |
196 XFA_VERSION m_eCurVersionMode; | 135 XFA_VERSION m_eCurVersionMode; |
197 uint32_t m_dwDocFlags; | 136 uint32_t m_dwDocFlags; |
198 friend class CXFA_SimpleParser; | 137 friend class CXFA_SimpleParser; |
199 }; | 138 }; |
200 | 139 |
201 #endif // XFA_FXFA_PARSER_XFA_DOCUMENT_H_ | 140 #endif // XFA_FXFA_PARSER_XFA_DOCUMENT_H_ |
OLD | NEW |