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_SRC_FXFA_PARSER_XFA_PARSER_IMP_H_ | |
8 #define XFA_SRC_FXFA_PARSER_XFA_PARSER_IMP_H_ | |
9 | |
10 #include "xfa/src/fxfa/parser/xfa_parser.h" | |
11 | |
12 class CXFA_XMLParser; | |
13 | |
14 class CXFA_SimpleParser : public IXFA_Parser { | |
15 public: | |
16 CXFA_SimpleParser(IXFA_ObjFactory* pFactory, FX_BOOL bDocumentParser = FALSE); | |
17 ~CXFA_SimpleParser(); | |
18 virtual void Release() { delete this; } | |
19 | |
20 virtual int32_t StartParse(IFX_FileRead* pStream, | |
21 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); | |
22 virtual int32_t DoParse(IFX_Pause* pPause = NULL); | |
23 virtual int32_t ParseXMLData(const CFX_WideString& wsXML, | |
24 IFDE_XMLNode*& pXMLNode, | |
25 IFX_Pause* pPause = NULL); | |
26 virtual void ConstructXFANode(CXFA_Node* pXFANode, IFDE_XMLNode* pXMLNode); | |
27 virtual IXFA_ObjFactory* GetFactory() const { return m_pFactory; } | |
28 virtual CXFA_Node* GetRootNode() const { return m_pRootNode; } | |
29 virtual IFDE_XMLDoc* GetXMLDoc() const { return m_pXMLDoc; } | |
30 virtual void CloseParser(); | |
31 | |
32 protected: | |
33 CXFA_Node* ParseAsXDPPacket(IFDE_XMLNode* pXMLDocumentNode, | |
34 XFA_XDPPACKET ePacketID); | |
35 CXFA_Node* ParseAsXDPPacket_XDP(IFDE_XMLNode* pXMLDocumentNode, | |
36 XFA_XDPPACKET ePacketID); | |
37 CXFA_Node* ParseAsXDPPacket_Config(IFDE_XMLNode* pXMLDocumentNode, | |
38 XFA_XDPPACKET ePacketID); | |
39 CXFA_Node* ParseAsXDPPacket_TemplateForm(IFDE_XMLNode* pXMLDocumentNode, | |
40 XFA_XDPPACKET ePacketID); | |
41 CXFA_Node* ParseAsXDPPacket_Data(IFDE_XMLNode* pXMLDocumentNode, | |
42 XFA_XDPPACKET ePacketID); | |
43 CXFA_Node* ParseAsXDPPacket_LocaleConnectionSourceSet( | |
44 IFDE_XMLNode* pXMLDocumentNode, | |
45 XFA_XDPPACKET ePacketID); | |
46 CXFA_Node* ParseAsXDPPacket_Xdc(IFDE_XMLNode* pXMLDocumentNode, | |
47 XFA_XDPPACKET ePacketID); | |
48 CXFA_Node* ParseAsXDPPacket_User(IFDE_XMLNode* pXMLDocumentNode, | |
49 XFA_XDPPACKET ePacketID); | |
50 CXFA_Node* NormalLoader(CXFA_Node* pXFANode, | |
51 IFDE_XMLNode* pXMLDoc, | |
52 XFA_XDPPACKET ePacketID, | |
53 FX_BOOL bUseAttribute = TRUE); | |
54 CXFA_Node* DataLoader(CXFA_Node* pXFANode, | |
55 IFDE_XMLNode* pXMLDoc, | |
56 FX_BOOL bDoTransform); | |
57 CXFA_Node* UserPacketLoader(CXFA_Node* pXFANode, IFDE_XMLNode* pXMLDoc); | |
58 void ParseContentNode(CXFA_Node* pXFANode, | |
59 IFDE_XMLNode* pXMLNode, | |
60 XFA_XDPPACKET ePacketID); | |
61 void ParseDataValue(CXFA_Node* pXFANode, | |
62 IFDE_XMLNode* pXMLNode, | |
63 XFA_XDPPACKET ePacketID); | |
64 void ParseDataGroup(CXFA_Node* pXFANode, | |
65 IFDE_XMLNode* pXMLNode, | |
66 XFA_XDPPACKET ePacketID); | |
67 void ParseInstruction(CXFA_Node* pXFANode, | |
68 IFDE_XMLInstruction* pXMLInstruction, | |
69 XFA_XDPPACKET ePacketID); | |
70 void SetFactory(IXFA_ObjFactory* pFactory); | |
71 | |
72 CXFA_XMLParser* m_pXMLParser; | |
73 IFDE_XMLDoc* m_pXMLDoc; | |
74 IFX_Stream* m_pStream; | |
75 IFX_FileRead* m_pFileRead; | |
76 IXFA_ObjFactory* m_pFactory; | |
77 CXFA_Node* m_pRootNode; | |
78 XFA_XDPPACKET m_ePacketID; | |
79 FX_BOOL m_bDocumentParser; | |
80 friend class CXFA_DocumentParser; | |
81 }; | |
82 | |
83 class CXFA_DocumentParser : public IXFA_DocParser { | |
84 public: | |
85 CXFA_DocumentParser(IXFA_Notify* pNotify); | |
86 ~CXFA_DocumentParser(); | |
87 virtual void Release() { delete this; } | |
88 virtual int32_t StartParse(IFX_FileRead* pStream, | |
89 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); | |
90 virtual int32_t DoParse(IFX_Pause* pPause = NULL); | |
91 virtual int32_t ParseXMLData(const CFX_WideString& wsXML, | |
92 IFDE_XMLNode*& pXMLNode, | |
93 IFX_Pause* pPause = NULL); | |
94 virtual void ConstructXFANode(CXFA_Node* pXFANode, IFDE_XMLNode* pXMLNode); | |
95 virtual IXFA_ObjFactory* GetFactory() const { | |
96 return m_nodeParser.GetFactory(); | |
97 } | |
98 virtual CXFA_Node* GetRootNode() const { return m_nodeParser.GetRootNode(); } | |
99 virtual IFDE_XMLDoc* GetXMLDoc() const { return m_nodeParser.GetXMLDoc(); } | |
100 virtual IXFA_Notify* GetNotify() const { return m_pNotify; } | |
101 virtual CXFA_Document* GetDocument() const { return m_pDocument; } | |
102 virtual void CloseParser(); | |
103 | |
104 protected: | |
105 CXFA_SimpleParser m_nodeParser; | |
106 IXFA_Notify* m_pNotify; | |
107 CXFA_Document* m_pDocument; | |
108 }; | |
109 typedef CFX_StackTemplate<IFDE_XMLNode*> CXFA_XMLNodeStack; | |
110 | |
111 class CXFA_XMLParser : public IFDE_XMLParser { | |
112 public: | |
113 CXFA_XMLParser(IFDE_XMLNode* pRoot, IFX_Stream* pStream); | |
114 ~CXFA_XMLParser(); | |
115 | |
116 virtual void Release() { delete this; } | |
117 virtual int32_t DoParser(IFX_Pause* pPause); | |
118 | |
119 FX_FILESIZE m_nStart[2]; | |
120 size_t m_nSize[2]; | |
121 FX_FILESIZE m_nElementStart; | |
122 FX_WORD m_dwCheckStatus; | |
123 FX_WORD m_dwCurrentCheckStatus; | |
124 | |
125 protected: | |
126 IFDE_XMLNode* m_pRoot; | |
127 IFX_Stream* m_pStream; | |
128 IFDE_XMLSyntaxParser* m_pParser; | |
129 | |
130 IFDE_XMLNode* m_pParent; | |
131 IFDE_XMLNode* m_pChild; | |
132 CXFA_XMLNodeStack m_NodeStack; | |
133 CFX_WideString m_ws1; | |
134 CFX_WideString m_ws2; | |
135 FX_DWORD m_dwStatus; | |
136 }; | |
137 | |
138 #endif // XFA_SRC_FXFA_PARSER_XFA_PARSER_IMP_H_ | |
OLD | NEW |