OLD | NEW |
1 // Copyright 2016 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_CPDFSDK_FORMFILLENVIRONMENT_H_ | 7 #ifndef FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ |
8 #define FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ | 8 #define FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 23 matching lines...) Expand all Loading... |
34 FPDF_FORMFILLINFO* pFFinfo); | 34 FPDF_FORMFILLINFO* pFFinfo); |
35 ~CPDFSDK_FormFillEnvironment(); | 35 ~CPDFSDK_FormFillEnvironment(); |
36 | 36 |
37 CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, bool renew); | 37 CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, bool renew); |
38 CPDFSDK_PageView* GetPageView(int nIndex); | 38 CPDFSDK_PageView* GetPageView(int nIndex); |
39 CPDFSDK_PageView* GetCurrentView(); | 39 CPDFSDK_PageView* GetCurrentView(); |
40 void RemovePageView(UnderlyingPageType* pPage); | 40 void RemovePageView(UnderlyingPageType* pPage); |
41 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); | 41 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); |
42 | 42 |
43 CPDFSDK_Annot* GetFocusAnnot() { return m_pFocusAnnot.Get(); } | 43 CPDFSDK_Annot* GetFocusAnnot() { return m_pFocusAnnot.Get(); } |
44 FX_BOOL SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pAnnot); | 44 bool SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pAnnot); |
45 FX_BOOL KillFocusAnnot(uint32_t nFlag); | 45 bool KillFocusAnnot(uint32_t nFlag); |
46 void ClearAllFocusedAnnots(); | 46 void ClearAllFocusedAnnots(); |
47 | 47 |
48 FX_BOOL ExtractPages(const std::vector<uint16_t>& arrExtraPages, | 48 bool ExtractPages(const std::vector<uint16_t>& arrExtraPages, |
49 CPDF_Document* pDstDoc); | 49 CPDF_Document* pDstDoc); |
50 FX_BOOL InsertPages(int nInsertAt, | 50 bool InsertPages(int nInsertAt, |
51 const CPDF_Document* pSrcDoc, | 51 const CPDF_Document* pSrcDoc, |
52 const std::vector<uint16_t>& arrSrcPages); | 52 const std::vector<uint16_t>& arrSrcPages); |
53 FX_BOOL ReplacePages(int nPage, | 53 bool ReplacePages(int nPage, |
54 const CPDF_Document* pSrcDoc, | 54 const CPDF_Document* pSrcDoc, |
55 const std::vector<uint16_t>& arrSrcPages); | 55 const std::vector<uint16_t>& arrSrcPages); |
56 | 56 |
57 int GetPageCount() { return m_pUnderlyingDoc->GetPageCount(); } | 57 int GetPageCount() { return m_pUnderlyingDoc->GetPageCount(); } |
58 FX_BOOL GetPermissions(int nFlag); | 58 bool GetPermissions(int nFlag); |
59 | 59 |
60 bool GetChangeMark() const { return m_bChangeMask; } | 60 bool GetChangeMark() const { return m_bChangeMask; } |
61 void SetChangeMark() { m_bChangeMask = true; } | 61 void SetChangeMark() { m_bChangeMask = true; } |
62 void ClearChangeMark() { m_bChangeMask = false; } | 62 void ClearChangeMark() { m_bChangeMask = false; } |
63 | 63 |
64 UnderlyingPageType* GetPage(int nIndex); | 64 UnderlyingPageType* GetPage(int nIndex); |
65 | 65 |
66 void ProcJavascriptFun(); | 66 void ProcJavascriptFun(); |
67 FX_BOOL ProcOpenAction(); | 67 bool ProcOpenAction(); |
68 | 68 |
69 void Invalidate(FPDF_PAGE page, | 69 void Invalidate(FPDF_PAGE page, |
70 double left, | 70 double left, |
71 double top, | 71 double top, |
72 double right, | 72 double right, |
73 double bottom); | 73 double bottom); |
74 void OutputSelectedRect(FPDF_PAGE page, | 74 void OutputSelectedRect(FPDF_PAGE page, |
75 double left, | 75 double left, |
76 double top, | 76 double top, |
77 double right, | 77 double right, |
78 double bottom); | 78 double bottom); |
79 | 79 |
80 void SetCursor(int nCursorType); | 80 void SetCursor(int nCursorType); |
81 int SetTimer(int uElapse, TimerCallback lpTimerFunc); | 81 int SetTimer(int uElapse, TimerCallback lpTimerFunc); |
82 void KillTimer(int nTimerID); | 82 void KillTimer(int nTimerID); |
83 FX_SYSTEMTIME GetLocalTime() const; | 83 FX_SYSTEMTIME GetLocalTime() const; |
84 | 84 |
85 void OnChange(); | 85 void OnChange(); |
86 FX_BOOL IsSHIFTKeyDown(uint32_t nFlag) const; | 86 bool IsSHIFTKeyDown(uint32_t nFlag) const; |
87 FX_BOOL IsCTRLKeyDown(uint32_t nFlag) const; | 87 bool IsCTRLKeyDown(uint32_t nFlag) const; |
88 FX_BOOL IsALTKeyDown(uint32_t nFlag) const; | 88 bool IsALTKeyDown(uint32_t nFlag) const; |
89 | 89 |
90 FPDF_PAGE GetPage(FPDF_DOCUMENT document, int nPageIndex); | 90 FPDF_PAGE GetPage(FPDF_DOCUMENT document, int nPageIndex); |
91 FPDF_PAGE GetCurrentPage(FPDF_DOCUMENT document); | 91 FPDF_PAGE GetCurrentPage(FPDF_DOCUMENT document); |
92 | 92 |
93 void ExecuteNamedAction(const FX_CHAR* namedAction); | 93 void ExecuteNamedAction(const FX_CHAR* namedAction); |
94 void OnSetFieldInputFocus(FPDF_WIDESTRING focusText, | 94 void OnSetFieldInputFocus(FPDF_WIDESTRING focusText, |
95 FPDF_DWORD nTextLen, | 95 FPDF_DWORD nTextLen, |
96 FX_BOOL bFocus); | 96 bool bFocus); |
97 void DoURIAction(const FX_CHAR* bsURI); | 97 void DoURIAction(const FX_CHAR* bsURI); |
98 void DoGoToAction(int nPageIndex, | 98 void DoGoToAction(int nPageIndex, |
99 int zoomMode, | 99 int zoomMode, |
100 float* fPosArray, | 100 float* fPosArray, |
101 int sizeOfArray); | 101 int sizeOfArray); |
102 | 102 |
103 UnderlyingDocumentType* GetUnderlyingDocument() const { | 103 UnderlyingDocumentType* GetUnderlyingDocument() const { |
104 return m_pUnderlyingDoc; | 104 return m_pUnderlyingDoc; |
105 } | 105 } |
106 | 106 |
(...skipping 15 matching lines...) Expand all Loading... |
122 double bottom); | 122 double bottom); |
123 int GetCurrentPageIndex(FPDF_DOCUMENT document); | 123 int GetCurrentPageIndex(FPDF_DOCUMENT document); |
124 void SetCurrentPage(FPDF_DOCUMENT document, int iCurPage); | 124 void SetCurrentPage(FPDF_DOCUMENT document, int iCurPage); |
125 | 125 |
126 // TODO(dsinclair): This should probably change to PDFium? | 126 // TODO(dsinclair): This should probably change to PDFium? |
127 CFX_WideString FFI_GetAppName() const { return CFX_WideString(L"Acrobat"); } | 127 CFX_WideString FFI_GetAppName() const { return CFX_WideString(L"Acrobat"); } |
128 | 128 |
129 CFX_WideString GetPlatform(); | 129 CFX_WideString GetPlatform(); |
130 void GotoURL(FPDF_DOCUMENT document, const CFX_WideStringC& wsURL); | 130 void GotoURL(FPDF_DOCUMENT document, const CFX_WideStringC& wsURL); |
131 void GetPageViewRect(FPDF_PAGE page, FS_RECTF& dstRect); | 131 void GetPageViewRect(FPDF_PAGE page, FS_RECTF& dstRect); |
132 FX_BOOL PopupMenu(FPDF_PAGE page, | 132 bool PopupMenu(FPDF_PAGE page, |
133 FPDF_WIDGET hWidget, | 133 FPDF_WIDGET hWidget, |
134 int menuFlag, | 134 int menuFlag, |
135 CFX_PointF pt); | 135 CFX_PointF pt); |
136 | 136 |
137 void Alert(FPDF_WIDESTRING Msg, FPDF_WIDESTRING Title, int Type, int Icon); | 137 void Alert(FPDF_WIDESTRING Msg, FPDF_WIDESTRING Title, int Type, int Icon); |
138 void EmailTo(FPDF_FILEHANDLER* fileHandler, | 138 void EmailTo(FPDF_FILEHANDLER* fileHandler, |
139 FPDF_WIDESTRING pTo, | 139 FPDF_WIDESTRING pTo, |
140 FPDF_WIDESTRING pSubject, | 140 FPDF_WIDESTRING pSubject, |
141 FPDF_WIDESTRING pCC, | 141 FPDF_WIDESTRING pCC, |
142 FPDF_WIDESTRING pBcc, | 142 FPDF_WIDESTRING pBcc, |
143 FPDF_WIDESTRING pMsg); | 143 FPDF_WIDESTRING pMsg); |
144 void UploadTo(FPDF_FILEHANDLER* fileHandler, | 144 void UploadTo(FPDF_FILEHANDLER* fileHandler, |
145 int fileFlag, | 145 int fileFlag, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 void JS_docprint(FPDF_BOOL bUI, | 189 void JS_docprint(FPDF_BOOL bUI, |
190 int nStart, | 190 int nStart, |
191 int nEnd, | 191 int nEnd, |
192 FPDF_BOOL bSilent, | 192 FPDF_BOOL bSilent, |
193 FPDF_BOOL bShrinkToFit, | 193 FPDF_BOOL bShrinkToFit, |
194 FPDF_BOOL bPrintAsImage, | 194 FPDF_BOOL bPrintAsImage, |
195 FPDF_BOOL bReverse, | 195 FPDF_BOOL bReverse, |
196 FPDF_BOOL bAnnotations); | 196 FPDF_BOOL bAnnotations); |
197 void JS_docgotoPage(int nPageNum); | 197 void JS_docgotoPage(int nPageNum); |
198 | 198 |
199 FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } | 199 bool IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } |
200 CFX_ByteString GetAppName() const { return ""; } | 200 CFX_ByteString GetAppName() const { return ""; } |
201 CFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); } | 201 CFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); } |
202 FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; } | 202 FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; } |
203 | 203 |
204 // Creates if not present. | 204 // Creates if not present. |
205 CFFL_InteractiveFormFiller* GetInteractiveFormFiller(); | 205 CFFL_InteractiveFormFiller* GetInteractiveFormFiller(); |
206 CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); // Creates if not present. | 206 CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); // Creates if not present. |
207 IJS_Runtime* GetJSRuntime(); // Creates if not present. | 207 IJS_Runtime* GetJSRuntime(); // Creates if not present. |
208 CPDFSDK_ActionHandler* GetActionHander(); // Creates if not present. | 208 CPDFSDK_ActionHandler* GetActionHander(); // Creates if not present. |
209 CPDFSDK_InterForm* GetInterForm(); // Creates if not present. | 209 CPDFSDK_InterForm* GetInterForm(); // Creates if not present. |
210 | 210 |
211 private: | 211 private: |
212 std::unique_ptr<CPDFSDK_AnnotHandlerMgr> m_pAnnotHandlerMgr; | 212 std::unique_ptr<CPDFSDK_AnnotHandlerMgr> m_pAnnotHandlerMgr; |
213 std::unique_ptr<CPDFSDK_ActionHandler> m_pActionHandler; | 213 std::unique_ptr<CPDFSDK_ActionHandler> m_pActionHandler; |
214 std::unique_ptr<IJS_Runtime> m_pJSRuntime; | 214 std::unique_ptr<IJS_Runtime> m_pJSRuntime; |
215 FPDF_FORMFILLINFO* const m_pInfo; | 215 FPDF_FORMFILLINFO* const m_pInfo; |
216 std::map<UnderlyingPageType*, std::unique_ptr<CPDFSDK_PageView>> m_pageMap; | 216 std::map<UnderlyingPageType*, std::unique_ptr<CPDFSDK_PageView>> m_pageMap; |
217 std::unique_ptr<CPDFSDK_InterForm> m_pInterForm; | 217 std::unique_ptr<CPDFSDK_InterForm> m_pInterForm; |
218 CPDFSDK_Annot::ObservedPtr m_pFocusAnnot; | 218 CPDFSDK_Annot::ObservedPtr m_pFocusAnnot; |
219 UnderlyingDocumentType* m_pUnderlyingDoc; | 219 UnderlyingDocumentType* m_pUnderlyingDoc; |
220 std::unique_ptr<CFFL_InteractiveFormFiller> m_pFormFiller; | 220 std::unique_ptr<CFFL_InteractiveFormFiller> m_pFormFiller; |
221 std::unique_ptr<CFX_SystemHandler> m_pSysHandler; | 221 std::unique_ptr<CFX_SystemHandler> m_pSysHandler; |
222 bool m_bChangeMask; | 222 bool m_bChangeMask; |
223 bool m_bBeingDestroyed; | 223 bool m_bBeingDestroyed; |
224 }; | 224 }; |
225 | 225 |
226 #endif // FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ | 226 #endif // FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ |
OLD | NEW |