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