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