OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
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_PARSER_XFA_DOCUMENT_H_ | |
8 #define XFA_FXFA_PARSER_XFA_DOCUMENT_H_ | |
9 | |
10 #include "xfa/fxfa/include/fxfa.h" | |
11 #include "xfa/fxfa/parser/xfa_localemgr.h" | |
12 #include "xfa/fxfa/parser/xfa_object.h" | |
13 | |
14 enum XFA_VERSION { | |
15 XFA_VERSION_UNKNOWN = 0, | |
16 XFA_VERSION_200 = 200, | |
17 XFA_VERSION_202 = 202, | |
18 XFA_VERSION_204 = 204, | |
19 XFA_VERSION_205 = 205, | |
20 XFA_VERSION_206 = 206, | |
21 XFA_VERSION_207 = 207, | |
22 XFA_VERSION_208 = 208, | |
23 XFA_VERSION_300 = 300, | |
24 XFA_VERSION_301 = 301, | |
25 XFA_VERSION_303 = 303, | |
26 XFA_VERSION_306 = 306, | |
27 XFA_VERSION_DEFAULT = XFA_VERSION_303, | |
28 XFA_VERSION_MIN = 200, | |
29 XFA_VERSION_MAX = 400, | |
30 }; | |
31 | |
32 enum XFA_DocFlag { | |
33 XFA_DOCFLAG_StrictScoping = 0x0001, | |
34 XFA_DOCFLAG_HasInteractive = 0x0002, | |
35 XFA_DOCFLAG_Interactive = 0x0004, | |
36 XFA_DOCFLAG_Scripting = 0x0008 | |
37 }; | |
38 | |
39 class CFDE_XMLDoc; | |
40 class CScript_DataWindow; | |
41 class CScript_EventPseudoModel; | |
42 class CScript_HostPseudoModel; | |
43 class CScript_LogPseudoModel; | |
44 class CScript_LayoutPseudoModel; | |
45 class CScript_SignaturePseudoModel; | |
46 class CXFA_Document; | |
47 class CXFA_LayoutItem; | |
48 class CXFA_LayoutProcessor; | |
49 class CXFA_Node; | |
50 class CXFA_LayoutProcessor; | |
51 class CXFA_DocumentParser; | |
52 class CXFA_ContainerLayoutItem; | |
53 class CXFA_FFNotify; | |
54 class CXFA_ScriptContext; | |
55 | |
56 class CXFA_Document { | |
57 public: | |
58 explicit CXFA_Document(CXFA_DocumentParser* pParser); | |
59 ~CXFA_Document(); | |
60 | |
61 CXFA_ScriptContext* InitScriptContext(v8::Isolate* pIsolate); | |
62 | |
63 CXFA_Node* GetRoot() const { return m_pRootNode; } | |
64 | |
65 CFDE_XMLDoc* GetXMLDoc() const; | |
66 CXFA_FFNotify* GetNotify() const; | |
67 CXFA_LocaleMgr* GetLocalMgr(); | |
68 CXFA_Object* GetXFAObject(XFA_HashCode wsNodeNameHash); | |
69 CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const CFX_WideStringC& wsID); | |
70 CXFA_Node* GetNotBindNode(CXFA_ObjArray& arrayNodes); | |
71 CXFA_LayoutProcessor* GetLayoutProcessor(); | |
72 CXFA_LayoutProcessor* GetDocLayout(); | |
73 CXFA_ScriptContext* GetScriptContext(); | |
74 | |
75 void SetRoot(CXFA_Node* pNewRoot); | |
76 | |
77 void AddPurgeNode(CXFA_Node* pNode); | |
78 FX_BOOL RemovePurgeNode(CXFA_Node* pNode); | |
79 void PurgeNodes(); | |
80 | |
81 bool HasFlag(uint32_t dwFlag) { return (m_dwDocFlags & dwFlag) == dwFlag; } | |
82 void SetFlag(uint32_t dwFlag, FX_BOOL bOn); | |
83 | |
84 FX_BOOL IsInteractive(); | |
85 XFA_VERSION GetCurVersionMode() { return m_eCurVersionMode; } | |
86 XFA_VERSION RecognizeXFAVersionNumber(CFX_WideString& wsTemplateNS); | |
87 | |
88 CXFA_Node* CreateNode(uint32_t dwPacket, XFA_Element eElement); | |
89 CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, XFA_Element eElement); | |
90 | |
91 void DoProtoMerge(); | |
92 void DoDataMerge(); | |
93 void DoDataRemerge(FX_BOOL bDoDataMerge); | |
94 CXFA_Node* DataMerge_CopyContainer(CXFA_Node* pTemplateNode, | |
95 CXFA_Node* pFormNode, | |
96 CXFA_Node* pDataScope, | |
97 FX_BOOL bOneInstance, | |
98 FX_BOOL bDataMerge, | |
99 FX_BOOL bUpLevel); | |
100 void DataMerge_UpdateBindingRelations(CXFA_Node* pFormUpdateRoot); | |
101 | |
102 void ClearLayoutData(); | |
103 | |
104 CFX_MapPtrTemplate<uint32_t, CXFA_Node*> m_rgGlobalBinding; | |
105 CXFA_NodeArray m_pPendingPageSet; | |
106 | |
107 protected: | |
108 friend class CXFA_SimpleParser; | |
109 | |
110 CXFA_DocumentParser* m_pParser; | |
111 CXFA_ScriptContext* m_pScriptContext; | |
112 CXFA_LayoutProcessor* m_pLayoutProcessor; | |
113 CXFA_Node* m_pRootNode; | |
114 CXFA_LocaleMgr* m_pLocalMgr; | |
115 CScript_DataWindow* m_pScriptDataWindow; | |
116 CScript_EventPseudoModel* m_pScriptEvent; | |
117 CScript_HostPseudoModel* m_pScriptHost; | |
118 CScript_LogPseudoModel* m_pScriptLog; | |
119 CScript_LayoutPseudoModel* m_pScriptLayout; | |
120 CScript_SignaturePseudoModel* m_pScriptSignature; | |
121 CXFA_NodeSet m_PurgeNodes; | |
122 XFA_VERSION m_eCurVersionMode; | |
123 uint32_t m_dwDocFlags; | |
124 }; | |
125 | |
126 #endif // XFA_FXFA_PARSER_XFA_DOCUMENT_H_ | |
OLD | NEW |