| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ | 7 #ifndef FPDFSDK_FPDFXFA_INCLUDE_CPDFXFA_DOCENVIRONMENT_H_ |
| 8 #define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ | 8 #define FPDFSDK_FPDFXFA_INCLUDE_CPDFXFA_DOCENVIRONMENT_H_ |
| 9 | |
| 10 #include "xfa/fxfa/include/xfa_ffdoc.h" | |
| 11 | |
| 12 #include <memory> | |
| 13 #include <vector> | |
| 14 | 9 |
| 15 #include "public/fpdfview.h" | 10 #include "public/fpdfview.h" |
| 16 #include "xfa/fxfa/include/fxfa.h" | 11 #include "xfa/fxfa/include/fxfa.h" |
| 17 #include "xfa/fxfa/include/xfa_ffdochandler.h" | |
| 18 | 12 |
| 19 class CPDFXFA_App; | |
| 20 class CPDFXFA_Document; | 13 class CPDFXFA_Document; |
| 21 class CPDFXFA_Page; | |
| 22 class CPDFSDK_Document; | |
| 23 class CPDFDoc_Environment; | |
| 24 class IJS_Runtime; | |
| 25 class IJS_Context; | 14 class IJS_Context; |
| 26 class CXFA_FFDocHandler; | |
| 27 | 15 |
| 28 class CPDFXFA_Document : public IXFA_DocProvider { | 16 class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment { |
| 29 public: | 17 public: |
| 30 CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc, | 18 CPDFXFA_DocEnvironment(CPDFXFA_Document*); |
| 31 CPDFXFA_App* pProvider); | 19 ~CPDFXFA_DocEnvironment() override; |
| 32 ~CPDFXFA_Document() override; | |
| 33 | 20 |
| 34 FX_BOOL LoadXFADoc(); | 21 // IXFA_DocEnvironment |
| 35 CPDF_Document* GetPDFDoc() { return m_pPDFDoc.get(); } | |
| 36 CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); } | |
| 37 CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } | |
| 38 | |
| 39 int GetPageCount(); | |
| 40 CPDFXFA_Page* GetPage(int page_index); | |
| 41 | |
| 42 void DeletePage(int page_index); | |
| 43 void RemovePage(CPDFXFA_Page* page); | |
| 44 int GetDocType() { return m_iDocType; } | |
| 45 | |
| 46 CPDFSDK_Document* GetSDKDocument(CPDFDoc_Environment* pFormFillEnv); | |
| 47 | |
| 48 // IXFA_DocProvider | |
| 49 void SetChangeMark(CXFA_FFDoc* hDoc) override; | 22 void SetChangeMark(CXFA_FFDoc* hDoc) override; |
| 50 // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros. | 23 // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros. |
| 51 void InvalidateRect(CXFA_FFPageView* pPageView, | 24 void InvalidateRect(CXFA_FFPageView* pPageView, |
| 52 const CFX_RectF& rt, | 25 const CFX_RectF& rt, |
| 53 uint32_t dwFlags) override; | 26 uint32_t dwFlags) override; |
| 54 // show or hide caret | 27 // show or hide caret |
| 55 void DisplayCaret(CXFA_FFWidget* hWidget, | 28 void DisplayCaret(CXFA_FFWidget* hWidget, |
| 56 FX_BOOL bVisible, | 29 FX_BOOL bVisible, |
| 57 const CFX_RectF* pRtAnchor) override; | 30 const CFX_RectF* pRtAnchor) override; |
| 58 // dwPos: (0:bottom 1:top) | 31 // dwPos: (0:bottom 1:top) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc, | 83 FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc, |
| 111 const CFX_ByteStringC& szPropName, | 84 const CFX_ByteStringC& szPropName, |
| 112 CFXJSE_Value* pValue) override; | 85 CFXJSE_Value* pValue) override; |
| 113 FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, | 86 FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, |
| 114 const CFX_ByteStringC& szPropName, | 87 const CFX_ByteStringC& szPropName, |
| 115 CFXJSE_Value* pValue) override; | 88 CFXJSE_Value* pValue) override; |
| 116 | 89 |
| 117 IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, | 90 IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, |
| 118 const CFX_WideString& wsLink) override; | 91 const CFX_WideString& wsLink) override; |
| 119 | 92 |
| 120 void ClearChangeMark(); | |
| 121 | |
| 122 private: | 93 private: |
| 123 enum LoadStatus { | |
| 124 FXFA_LOADSTATUS_PRELOAD = 0, | |
| 125 FXFA_LOADSTATUS_LOADING, | |
| 126 FXFA_LOADSTATUS_LOADED, | |
| 127 FXFA_LOADSTATUS_CLOSING, | |
| 128 FXFA_LOADSTATUS_CLOSED | |
| 129 }; | |
| 130 | |
| 131 void CloseXFADoc(CXFA_FFDocHandler* pDoc) { | |
| 132 if (pDoc) { | |
| 133 m_pXFADoc->CloseDoc(); | |
| 134 m_pXFADoc.reset(); | |
| 135 m_pXFADocView = nullptr; | |
| 136 } | |
| 137 } | |
| 138 | |
| 139 CPDFXFA_Page* GetPage(CXFA_FFPageView* pPage); | |
| 140 FX_BOOL OnBeforeNotifySubmit(); | 94 FX_BOOL OnBeforeNotifySubmit(); |
| 141 void OnAfterNotifySubmit(); | 95 void OnAfterNotifySubmit(); |
| 142 FX_BOOL NotifySubmit(FX_BOOL bPrevOrPost); | 96 FX_BOOL NotifySubmit(FX_BOOL bPrevOrPost); |
| 143 FX_BOOL SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit); | 97 FX_BOOL SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit); |
| 144 FX_BOOL MailToInfo(CFX_WideString& csURL, | 98 FX_BOOL MailToInfo(CFX_WideString& csURL, |
| 145 CFX_WideString& csToAddress, | 99 CFX_WideString& csToAddress, |
| 146 CFX_WideString& csCCAddress, | 100 CFX_WideString& csCCAddress, |
| 147 CFX_WideString& csBCCAddress, | 101 CFX_WideString& csBCCAddress, |
| 148 CFX_WideString& csSubject, | 102 CFX_WideString& csSubject, |
| 149 CFX_WideString& csMsg); | 103 CFX_WideString& csMsg); |
| 150 FX_BOOL ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler, | 104 FX_BOOL ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler, |
| 151 int fileType, | 105 int fileType, |
| 152 FPDF_DWORD encodeType, | 106 FPDF_DWORD encodeType, |
| 153 FPDF_DWORD flag); | 107 FPDF_DWORD flag); |
| 154 void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag); | 108 void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag); |
| 155 | 109 |
| 156 int m_iDocType; | 110 CPDFXFA_Document* const m_pDocument; // Not owned; |
| 157 | |
| 158 // |m_pSDKDoc| has to be released before |m_pPDFDoc| since it needs to access | |
| 159 // it to kill focused annotations. | |
| 160 std::unique_ptr<CPDF_Document> m_pPDFDoc; | |
| 161 std::unique_ptr<CPDFSDK_Document> m_pSDKDoc; | |
| 162 std::unique_ptr<CXFA_FFDoc> m_pXFADoc; | |
| 163 CXFA_FFDocView* m_pXFADocView; // not owned. | |
| 164 CPDFXFA_App* const m_pApp; | |
| 165 IJS_Context* m_pJSContext; | 111 IJS_Context* m_pJSContext; |
| 166 CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList; | |
| 167 LoadStatus m_nLoadStatus; | |
| 168 int m_nPageCount; | |
| 169 }; | 112 }; |
| 170 | 113 |
| 171 #endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ | 114 #endif // FPDFSDK_FPDFXFA_INCLUDE_CPDFXFA_DOCENVIRONMENT_H_ |
| OLD | NEW |