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 FXFA_SRC_APP_XFA_FFDOC_H_
8#define FXFA_SRC_APP_XFA_FFDOC_H_
9
10#include "xfa/include/fxfa/fxfa.h"
11
12class CXFA_FFApp;
13class CXFA_FFNotify;
14class CXFA_FFDocView;
15class IXFA_Locale;
16
17typedef struct _FX_IMAGEDIB_AND_DPI {
18  CFX_DIBSource* pDibSource;
19  int32_t iImageXDpi;
20  int32_t iImageYDpi;
21} FX_IMAGEDIB_AND_DPI;
22
23class CXFA_FFDoc : public IXFA_Doc {
24 public:
25  CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocProvider* pDocProvider);
26  ~CXFA_FFDoc();
27  IXFA_DocProvider* GetDocProvider() { return m_pDocProvider; }
28  FX_DWORD GetDocType();
29  int32_t StartLoad();
30  int32_t DoLoad(IFX_Pause* pPause = NULL);
31  void StopLoad();
32  IXFA_DocView* CreateDocView(FX_DWORD dwView = 0);
33  FX_BOOL OpenDoc(IFX_FileRead* pStream, FX_BOOL bTakeOverFile);
34  FX_BOOL OpenDoc(CPDF_Document* pPDFDoc);
35  FX_BOOL CloseDoc();
36  void SetDocType(FX_DWORD dwType);
37  CXFA_Document* GetXFADoc() { return m_pDocument; }
38  CXFA_FFApp* GetApp() { return m_pApp; }
39  CXFA_FFDocView* GetDocView(IXFA_DocLayout* pLayout);
40  CXFA_FFDocView* GetDocView();
41  CPDF_Document* GetPDFDoc();
42  CFX_DIBitmap* GetPDFNamedImage(const CFX_WideStringC& wsName,
43                                 int32_t& iImageXDpi,
44                                 int32_t& iImageYDpi);
45  IFDE_XMLElement* GetPackageData(const CFX_WideStringC& wsPackage);
46  FX_BOOL SavePackage(const CFX_WideStringC& wsPackage,
47                      IFX_FileWrite* pFile,
48                      IXFA_ChecksumContext* pCSContext = NULL);
49  FX_BOOL ImportData(IFX_FileRead* pStream, FX_BOOL bXDP = TRUE);
50
51 protected:
52  IXFA_DocProvider* m_pDocProvider;
53  CXFA_Document* m_pDocument;
54  IFX_FileRead* m_pStream;
55  CXFA_FFApp* m_pApp;
56  CXFA_FFNotify* m_pNotify;
57  CPDF_Document* m_pPDFDoc;
58  CFX_MapPtrToPtr m_mapNamedImages;
59  CFX_MapPtrToPtr m_mapTypeToDocView;
60  FX_DWORD m_dwDocType;
61  FX_BOOL m_bOwnStream;
62};
63
64#endif  // FXFA_SRC_APP_XFA_FFDOC_H_
65