| 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 FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_ |  | 
| 8 #define FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_ |  | 
| 9 |  | 
| 10 #include <memory> |  | 
| 11 |  | 
| 12 #include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h" |  | 
| 13 #include "xfa/fxfa/xfa_ffdoc.h" |  | 
| 14 |  | 
| 15 class CJS_Runtime; |  | 
| 16 class CPDFSDK_FormFillEnvironment; |  | 
| 17 class CPDFXFA_Page; |  | 
| 18 class CXFA_FFDocHandler; |  | 
| 19 class IJS_Runtime; |  | 
| 20 class IJS_Context; |  | 
| 21 |  | 
| 22 enum LoadStatus { |  | 
| 23   FXFA_LOADSTATUS_PRELOAD = 0, |  | 
| 24   FXFA_LOADSTATUS_LOADING, |  | 
| 25   FXFA_LOADSTATUS_LOADED, |  | 
| 26   FXFA_LOADSTATUS_CLOSING, |  | 
| 27   FXFA_LOADSTATUS_CLOSED |  | 
| 28 }; |  | 
| 29 |  | 
| 30 class CPDFXFA_Document : public IXFA_AppProvider { |  | 
| 31  public: |  | 
| 32   CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc); |  | 
| 33   ~CPDFXFA_Document() override; |  | 
| 34 |  | 
| 35   FX_BOOL LoadXFADoc(); |  | 
| 36   CPDF_Document* GetPDFDoc() { return m_pPDFDoc.get(); } |  | 
| 37   CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); } |  | 
| 38   CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } |  | 
| 39   int GetDocType() const { return m_iDocType; } |  | 
| 40   v8::Isolate* GetJSERuntime() const; |  | 
| 41   CXFA_FFApp* GetXFAApp() { return m_pXFAApp.get(); } |  | 
| 42 |  | 
| 43   CPDFSDK_FormFillEnvironment* GetFormFillEnv() const { return m_pFormFillEnv; } |  | 
| 44   void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv); |  | 
| 45 |  | 
| 46   void DeletePage(int page_index); |  | 
| 47   int GetPageCount() const; |  | 
| 48 |  | 
| 49   CPDFXFA_Page* GetXFAPage(int page_index); |  | 
| 50   CPDFXFA_Page* GetXFAPage(CXFA_FFPageView* pPage) const; |  | 
| 51 |  | 
| 52   void RemovePage(CPDFXFA_Page* page); |  | 
| 53 |  | 
| 54   void ClearChangeMark(); |  | 
| 55 |  | 
| 56   // IFXA_AppProvider: |  | 
| 57   void GetLanguage(CFX_WideString& wsLanguage) override; |  | 
| 58   void GetPlatform(CFX_WideString& wsPlatform) override; |  | 
| 59   void GetAppName(CFX_WideString& wsName) override; |  | 
| 60 |  | 
| 61   void Beep(uint32_t dwType) override; |  | 
| 62   int32_t MsgBox(const CFX_WideString& wsMessage, |  | 
| 63                  const CFX_WideString& wsTitle, |  | 
| 64                  uint32_t dwIconType, |  | 
| 65                  uint32_t dwButtonType) override; |  | 
| 66   CFX_WideString Response(const CFX_WideString& wsQuestion, |  | 
| 67                           const CFX_WideString& wsTitle, |  | 
| 68                           const CFX_WideString& wsDefaultAnswer, |  | 
| 69                           FX_BOOL bMark) override; |  | 
| 70   IFX_SeekableReadStream* DownloadURL(const CFX_WideString& wsURL) override; |  | 
| 71   FX_BOOL PostRequestURL(const CFX_WideString& wsURL, |  | 
| 72                          const CFX_WideString& wsData, |  | 
| 73                          const CFX_WideString& wsContentType, |  | 
| 74                          const CFX_WideString& wsEncode, |  | 
| 75                          const CFX_WideString& wsHeader, |  | 
| 76                          CFX_WideString& wsResponse) override; |  | 
| 77   FX_BOOL PutRequestURL(const CFX_WideString& wsURL, |  | 
| 78                         const CFX_WideString& wsData, |  | 
| 79                         const CFX_WideString& wsEncode) override; |  | 
| 80 |  | 
| 81   void LoadString(int32_t iStringID, CFX_WideString& wsString) override; |  | 
| 82   IFWL_AdapterTimerMgr* GetTimerMgr() override; |  | 
| 83 |  | 
| 84  protected: |  | 
| 85   friend class CPDFXFA_DocEnvironment; |  | 
| 86 |  | 
| 87   int GetOriginalPageCount() const { return m_nPageCount; } |  | 
| 88   void SetOriginalPageCount(int count) { |  | 
| 89     m_nPageCount = count; |  | 
| 90     m_XFAPageList.SetSize(count); |  | 
| 91   } |  | 
| 92 |  | 
| 93   LoadStatus GetLoadStatus() const { return m_nLoadStatus; } |  | 
| 94 |  | 
| 95   CFX_ArrayTemplate<CPDFXFA_Page*>* GetXFAPageList() { return &m_XFAPageList; } |  | 
| 96 |  | 
| 97  private: |  | 
| 98   void CloseXFADoc(); |  | 
| 99 |  | 
| 100   int m_iDocType; |  | 
| 101 |  | 
| 102   std::unique_ptr<CPDF_Document> m_pPDFDoc; |  | 
| 103   std::unique_ptr<CXFA_FFDoc> m_pXFADoc; |  | 
| 104   CPDFSDK_FormFillEnvironment* m_pFormFillEnv;  // not owned. |  | 
| 105   CXFA_FFDocView* m_pXFADocView;  // not owned. |  | 
| 106   std::unique_ptr<CXFA_FFApp> m_pXFAApp; |  | 
| 107   std::unique_ptr<CJS_Runtime> m_pRuntime; |  | 
| 108   CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList; |  | 
| 109   LoadStatus m_nLoadStatus; |  | 
| 110   int m_nPageCount; |  | 
| 111 |  | 
| 112   // Must be destroyed before |m_pFormFillEnv|. |  | 
| 113   CPDFXFA_DocEnvironment m_DocEnv; |  | 
| 114 }; |  | 
| 115 |  | 
| 116 #endif  // FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_ |  | 
| OLD | NEW | 
|---|