OLD | NEW |
| (Empty) |
1 // Copyright 2016 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_INCLUDE_CPDFXFA_DOCENVIRONMENT_H_ | |
8 #define FPDFSDK_FPDFXFA_INCLUDE_CPDFXFA_DOCENVIRONMENT_H_ | |
9 | |
10 #include "public/fpdfview.h" | |
11 #include "xfa/fxfa/include/fxfa.h" | |
12 | |
13 class CPDFXFA_Document; | |
14 class IJS_Context; | |
15 | |
16 class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment { | |
17 public: | |
18 CPDFXFA_DocEnvironment(CPDFXFA_Document*); | |
19 ~CPDFXFA_DocEnvironment() override; | |
20 | |
21 // IXFA_DocEnvironment | |
22 void SetChangeMark(CXFA_FFDoc* hDoc) override; | |
23 // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros. | |
24 void InvalidateRect(CXFA_FFPageView* pPageView, | |
25 const CFX_RectF& rt, | |
26 uint32_t dwFlags) override; | |
27 // show or hide caret | |
28 void DisplayCaret(CXFA_FFWidget* hWidget, | |
29 FX_BOOL bVisible, | |
30 const CFX_RectF* pRtAnchor) override; | |
31 // dwPos: (0:bottom 1:top) | |
32 FX_BOOL GetPopupPos(CXFA_FFWidget* hWidget, | |
33 FX_FLOAT fMinPopup, | |
34 FX_FLOAT fMaxPopup, | |
35 const CFX_RectF& rtAnchor, | |
36 CFX_RectF& rtPopup) override; | |
37 FX_BOOL PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup) override; | |
38 | |
39 // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing | |
40 void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) override; | |
41 void WidgetPostAdd(CXFA_FFWidget* hWidget, | |
42 CXFA_WidgetAcc* pWidgetData) override; | |
43 void WidgetPreRemove(CXFA_FFWidget* hWidget, | |
44 CXFA_WidgetAcc* pWidgetData) override; | |
45 | |
46 // Host method | |
47 int32_t CountPages(CXFA_FFDoc* hDoc) override; | |
48 int32_t GetCurrentPage(CXFA_FFDoc* hDoc) override; | |
49 void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) override; | |
50 FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc) override; | |
51 void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; | |
52 void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) override; | |
53 void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) override; | |
54 void ExportData(CXFA_FFDoc* hDoc, | |
55 const CFX_WideString& wsFilePath, | |
56 FX_BOOL bXDP) override; | |
57 void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL) override; | |
58 FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc) override; | |
59 void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; | |
60 void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; | |
61 void Print(CXFA_FFDoc* hDoc, | |
62 int32_t nStartPage, | |
63 int32_t nEndPage, | |
64 uint32_t dwOptions) override; | |
65 FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) override; | |
66 | |
67 /** | |
68 *Submit data to email, http, ftp. | |
69 * @param[in] hDoc The document handler. | |
70 * @param[in] eFormat Determines the format in which the data will be | |
71 *submitted. XFA_ATTRIBUTEENUM_Xdp, XFA_ATTRIBUTEENUM_Xml... | |
72 * @param[in] wsTarget The URL to which the data will be submitted. | |
73 * @param[in] eEncoding The encoding of text content. | |
74 * @param[in] pXDPContent Controls what subset of the data is submitted, used | |
75 *only when the format property is xdp. | |
76 * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted | |
77 *content or not. | |
78 */ | |
79 FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override; | |
80 | |
81 FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc, | |
82 const CFX_ByteStringC& szPropName, | |
83 CFXJSE_Value* pValue) override; | |
84 FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, | |
85 const CFX_ByteStringC& szPropName, | |
86 CFXJSE_Value* pValue) override; | |
87 | |
88 IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, | |
89 const CFX_WideString& wsLink) override; | |
90 | |
91 private: | |
92 FX_BOOL OnBeforeNotifySubmit(); | |
93 void OnAfterNotifySubmit(); | |
94 FX_BOOL NotifySubmit(FX_BOOL bPrevOrPost); | |
95 FX_BOOL SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit); | |
96 FX_BOOL MailToInfo(CFX_WideString& csURL, | |
97 CFX_WideString& csToAddress, | |
98 CFX_WideString& csCCAddress, | |
99 CFX_WideString& csBCCAddress, | |
100 CFX_WideString& csSubject, | |
101 CFX_WideString& csMsg); | |
102 FX_BOOL ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler, | |
103 int fileType, | |
104 FPDF_DWORD encodeType, | |
105 FPDF_DWORD flag); | |
106 void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag); | |
107 | |
108 CPDFXFA_Document* const m_pDocument; // Not owned; | |
109 IJS_Context* m_pJSContext; | |
110 }; | |
111 | |
112 #endif // FPDFSDK_FPDFXFA_INCLUDE_CPDFXFA_DOCENVIRONMENT_H_ | |
OLD | NEW |