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