Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 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 | |
dsinclair | 5b49309 | 2016-09-29 20:20:24 -0700 | [diff] [blame] | 7 | #ifndef XFA_FXFA_XFA_FFDOC_H_ |
| 8 | #define XFA_FXFA_XFA_FFDOC_H_ |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 9 | |
tsepez | 084174a | 2016-04-25 12:37:27 -0700 | [diff] [blame] | 10 | #include <map> |
| 11 | #include <memory> |
| 12 | |
dsinclair | 5b49309 | 2016-09-29 20:20:24 -0700 | [diff] [blame] | 13 | #include "xfa/fxfa/fxfa.h" |
dsinclair | 1628024 | 2016-07-21 12:03:47 -0700 | [diff] [blame] | 14 | #include "xfa/fxfa/parser/cxfa_document.h" |
dsinclair | 34f86b0 | 2016-07-11 08:42:33 -0700 | [diff] [blame] | 15 | #include "xfa/fxfa/parser/cxfa_document_parser.h" |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 16 | |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 17 | class CXFA_ChecksumContext; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 18 | class CXFA_FFApp; |
| 19 | class CXFA_FFNotify; |
| 20 | class CXFA_FFDocView; |
| 21 | |
| 22 | struct FX_IMAGEDIB_AND_DPI { |
| 23 | CFX_DIBSource* pDibSource; |
| 24 | int32_t iImageXDpi; |
| 25 | int32_t iImageYDpi; |
| 26 | }; |
| 27 | |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 28 | class CXFA_FFDoc { |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 29 | public: |
dsinclair | a440bb3 | 2016-09-14 07:01:54 -0700 | [diff] [blame] | 30 | CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocEnvironment* pDocEnvironment); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 31 | ~CXFA_FFDoc(); |
dsinclair | 8837c91 | 2016-11-01 11:22:37 -0700 | [diff] [blame] | 32 | |
dsinclair | a440bb3 | 2016-09-14 07:01:54 -0700 | [diff] [blame] | 33 | IXFA_DocEnvironment* GetDocEnvironment() const { return m_pDocEnvironment; } |
tsepez | deee3d2 | 2016-03-25 14:38:58 -0700 | [diff] [blame] | 34 | uint32_t GetDocType(); |
dsinclair | 8837c91 | 2016-11-01 11:22:37 -0700 | [diff] [blame] | 35 | void SetDocType(uint32_t dwType); |
| 36 | |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 37 | int32_t StartLoad(); |
dsinclair | 85d1f2c | 2016-06-23 12:40:16 -0700 | [diff] [blame] | 38 | int32_t DoLoad(IFX_Pause* pPause = nullptr); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 39 | void StopLoad(); |
dsinclair | 8837c91 | 2016-11-01 11:22:37 -0700 | [diff] [blame] | 40 | |
Dan Sinclair | 3d06022 | 2017-03-22 15:29:20 -0400 | [diff] [blame^] | 41 | CXFA_FFDocView* CreateDocView(); |
dsinclair | 8837c91 | 2016-11-01 11:22:37 -0700 | [diff] [blame] | 42 | |
tsepez | 833619b | 2016-12-07 09:21:17 -0800 | [diff] [blame] | 43 | bool OpenDoc(const CFX_RetainPtr<IFX_SeekableReadStream>& pStream); |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 44 | bool OpenDoc(CPDF_Document* pPDFDoc); |
| 45 | bool CloseDoc(); |
dsinclair | 8837c91 | 2016-11-01 11:22:37 -0700 | [diff] [blame] | 46 | |
dsinclair | a1b0772 | 2016-07-11 08:20:58 -0700 | [diff] [blame] | 47 | CXFA_Document* GetXFADoc() { return m_pDocumentParser->GetDocument(); } |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 48 | CXFA_FFApp* GetApp() { return m_pApp; } |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 49 | CXFA_FFDocView* GetDocView(CXFA_LayoutProcessor* pLayout); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 50 | CXFA_FFDocView* GetDocView(); |
| 51 | CPDF_Document* GetPDFDoc(); |
| 52 | CFX_DIBitmap* GetPDFNamedImage(const CFX_WideStringC& wsName, |
| 53 | int32_t& iImageXDpi, |
| 54 | int32_t& iImageYDpi); |
dsinclair | cbfef57 | 2016-05-18 13:16:12 -0700 | [diff] [blame] | 55 | |
| 56 | bool SavePackage(XFA_HashCode code, |
tsepez | 833619b | 2016-12-07 09:21:17 -0800 | [diff] [blame] | 57 | const CFX_RetainPtr<IFX_SeekableWriteStream>& pFile, |
dsinclair | cbfef57 | 2016-05-18 13:16:12 -0700 | [diff] [blame] | 58 | CXFA_ChecksumContext* pCSContext); |
tsepez | 833619b | 2016-12-07 09:21:17 -0800 | [diff] [blame] | 59 | bool ImportData(const CFX_RetainPtr<IFX_SeekableReadStream>& pStream, |
| 60 | bool bXDP = true); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 61 | |
| 62 | protected: |
dsinclair | a440bb3 | 2016-09-14 07:01:54 -0700 | [diff] [blame] | 63 | IXFA_DocEnvironment* const m_pDocEnvironment; |
dsinclair | a1b0772 | 2016-07-11 08:20:58 -0700 | [diff] [blame] | 64 | std::unique_ptr<CXFA_DocumentParser> m_pDocumentParser; |
tsepez | 833619b | 2016-12-07 09:21:17 -0800 | [diff] [blame] | 65 | CFX_RetainPtr<IFX_SeekableReadStream> m_pStream; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 66 | CXFA_FFApp* m_pApp; |
dsinclair | a1b0772 | 2016-07-11 08:20:58 -0700 | [diff] [blame] | 67 | std::unique_ptr<CXFA_FFNotify> m_pNotify; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 68 | CPDF_Document* m_pPDFDoc; |
tsepez | 084174a | 2016-04-25 12:37:27 -0700 | [diff] [blame] | 69 | std::map<uint32_t, FX_IMAGEDIB_AND_DPI> m_HashToDibDpiMap; |
Dan Sinclair | 3d06022 | 2017-03-22 15:29:20 -0400 | [diff] [blame^] | 70 | std::unique_ptr<CXFA_FFDocView> m_DocView; |
tsepez | deee3d2 | 2016-03-25 14:38:58 -0700 | [diff] [blame] | 71 | uint32_t m_dwDocType; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 72 | }; |
| 73 | |
dsinclair | 5b49309 | 2016-09-29 20:20:24 -0700 | [diff] [blame] | 74 | #endif // XFA_FXFA_XFA_FFDOC_H_ |