OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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_INCLUDE_FSDK_ANNOTHANDLER_H_ | 7 #ifndef FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ |
8 #define FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ | 8 #define FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ |
9 | 9 |
10 #include "../../core/include/fxcrt/fx_basic.h" | 10 #include "../../core/include/fxcrt/fx_basic.h" |
11 | 11 |
12 class CFFL_IFormFiller; | 12 class CFFL_IFormFiller; |
13 class CFX_RenderDevice; | 13 class CFX_RenderDevice; |
14 class CPDFDoc_Environment; | 14 class CPDFDoc_Environment; |
15 class CPDFSDK_Annot; | 15 class CPDFSDK_Annot; |
16 class CPDFSDK_PageView; | 16 class CPDFSDK_PageView; |
17 class CPDF_Annot; | 17 class CPDF_Annot; |
18 class CPDF_Matrix; | 18 class CPDF_Matrix; |
19 class CPDF_Point; | 19 class CPDF_Point; |
20 class CPDF_Rect; | 20 class CPDF_Rect; |
21 | 21 |
22 class IPDFSDK_AnnotHandler { | 22 class IPDFSDK_AnnotHandler { |
23 public: | 23 public: |
24 virtual ~IPDFSDK_AnnotHandler(){}; | 24 virtual ~IPDFSDK_AnnotHandler() {} |
25 | 25 |
26 virtual CFX_ByteString GetType() = 0; | 26 virtual CFX_ByteString GetType() = 0; |
27 | 27 |
28 virtual CFX_ByteString GetName() = 0; | 28 virtual CFX_ByteString GetName() = 0; |
29 | 29 |
30 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0; | 30 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0; |
31 | 31 |
32 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, | 32 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, |
33 CPDFSDK_PageView* pPage) = 0; | 33 CPDFSDK_PageView* pPage) = 0; |
34 | 34 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 virtual void OnSelected(CPDFSDK_Annot* pAnnot) = 0; | 115 virtual void OnSelected(CPDFSDK_Annot* pAnnot) = 0; |
116 | 116 |
117 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; | 117 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; |
118 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; | 118 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; |
119 }; | 119 }; |
120 | 120 |
121 class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { | 121 class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { |
122 public: | 122 public: |
123 CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp) | 123 CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp) |
124 : m_pApp(pApp), m_pFormFiller(NULL) {} | 124 : m_pApp(pApp), m_pFormFiller(NULL) {} |
125 virtual ~CPDFSDK_BFAnnotHandler() {} | 125 ~CPDFSDK_BFAnnotHandler() override {} |
126 | 126 |
127 public: | 127 // IPDFSDK_AnnotHandler |
128 virtual CFX_ByteString GetType() { return CFX_ByteString("Widget"); } | 128 CFX_ByteString GetType() override { return CFX_ByteString("Widget"); } |
129 | 129 CFX_ByteString GetName() override { return CFX_ByteString("WidgetHandler"); } |
130 virtual CFX_ByteString GetName() { return CFX_ByteString("WidgetHandler"); } | 130 FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; |
131 | 131 CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; |
132 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot); | 132 void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; |
133 | 133 void DeleteAnnot(CPDFSDK_Annot* pAnnot) override {} |
134 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage); | 134 CPDF_Rect GetViewBBox(CPDFSDK_PageView* pPageView, |
135 | 135 CPDFSDK_Annot* pAnnot) override; |
136 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); | 136 FX_BOOL HitTest(CPDFSDK_PageView* pPageView, |
137 | 137 CPDFSDK_Annot* pAnnot, |
138 virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) {} | 138 const CPDF_Point& point) override; |
139 | 139 void OnDraw(CPDFSDK_PageView* pPageView, |
140 virtual CPDF_Rect GetViewBBox(CPDFSDK_PageView* pPageView, | 140 CPDFSDK_Annot* pAnnot, |
141 CPDFSDK_Annot* pAnnot); | 141 CFX_RenderDevice* pDevice, |
142 | 142 CPDF_Matrix* pUser2Device, |
143 virtual FX_BOOL HitTest(CPDFSDK_PageView* pPageView, | 143 FX_DWORD dwFlags) override; |
| 144 void OnDrawSleep(CPDFSDK_PageView* pPageView, |
| 145 CPDFSDK_Annot* pAnnot, |
| 146 CFX_RenderDevice* pDevice, |
| 147 CPDF_Matrix* pUser2Device, |
| 148 const CPDF_Rect& rcWindow, |
| 149 FX_DWORD dwFlags) override {} |
| 150 void OnCreate(CPDFSDK_Annot* pAnnot) override; |
| 151 void OnLoad(CPDFSDK_Annot* pAnnot) override; |
| 152 void OnDelete(CPDFSDK_Annot* pAnnot) override {} |
| 153 void OnRelease(CPDFSDK_Annot* pAnnot) override {} |
| 154 void OnMouseEnter(CPDFSDK_PageView* pPageView, |
| 155 CPDFSDK_Annot* pAnnot, |
| 156 FX_DWORD nFlag) override; |
| 157 void OnMouseExit(CPDFSDK_PageView* pPageView, |
| 158 CPDFSDK_Annot* pAnnot, |
| 159 FX_DWORD nFlag) override; |
| 160 FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 161 CPDFSDK_Annot* pAnnot, |
| 162 FX_DWORD nFlags, |
| 163 const CPDF_Point& point) override; |
| 164 FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, |
| 165 CPDFSDK_Annot* pAnnot, |
| 166 FX_DWORD nFlags, |
| 167 const CPDF_Point& point) override; |
| 168 FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
144 CPDFSDK_Annot* pAnnot, | 169 CPDFSDK_Annot* pAnnot, |
145 const CPDF_Point& point); | 170 FX_DWORD nFlags, |
146 | 171 const CPDF_Point& point) override; |
147 virtual void OnDraw(CPDFSDK_PageView* pPageView, | 172 FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, |
148 CPDFSDK_Annot* pAnnot, | 173 CPDFSDK_Annot* pAnnot, |
149 CFX_RenderDevice* pDevice, | 174 FX_DWORD nFlags, |
150 CPDF_Matrix* pUser2Device, | 175 const CPDF_Point& point) override; |
151 FX_DWORD dwFlags); | 176 FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, |
152 | 177 CPDFSDK_Annot* pAnnot, |
153 virtual void OnDrawSleep(CPDFSDK_PageView* pPageView, | 178 FX_DWORD nFlags, |
154 CPDFSDK_Annot* pAnnot, | 179 short zDelta, |
155 CFX_RenderDevice* pDevice, | 180 const CPDF_Point& point) override; |
156 CPDF_Matrix* pUser2Device, | 181 FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, |
157 const CPDF_Rect& rcWindow, | 182 CPDFSDK_Annot* pAnnot, |
158 FX_DWORD dwFlags) {} | 183 FX_DWORD nFlags, |
159 | 184 const CPDF_Point& point) override; |
160 virtual void OnCreate(CPDFSDK_Annot* pAnnot); | 185 FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, |
161 | 186 CPDFSDK_Annot* pAnnot, |
162 virtual void OnLoad(CPDFSDK_Annot* pAnnot); | 187 FX_DWORD nFlags, |
163 | 188 const CPDF_Point& point) override; |
164 virtual void OnDelete(CPDFSDK_Annot* pAnnot) {} | 189 FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
165 | 190 CPDFSDK_Annot* pAnnot, |
166 virtual void OnRelease(CPDFSDK_Annot* pAnnot) {} | 191 FX_DWORD nFlags, |
167 | 192 const CPDF_Point& point) override { |
168 virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, | |
169 CPDFSDK_Annot* pAnnot, | |
170 FX_DWORD nFlag); | |
171 virtual void OnMouseExit(CPDFSDK_PageView* pPageView, | |
172 CPDFSDK_Annot* pAnnot, | |
173 FX_DWORD nFlag); | |
174 | |
175 virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, | |
176 CPDFSDK_Annot* pAnnot, | |
177 FX_DWORD nFlags, | |
178 const CPDF_Point& point); | |
179 virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, | |
180 CPDFSDK_Annot* pAnnot, | |
181 FX_DWORD nFlags, | |
182 const CPDF_Point& point); | |
183 virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, | |
184 CPDFSDK_Annot* pAnnot, | |
185 FX_DWORD nFlags, | |
186 const CPDF_Point& point); | |
187 virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, | |
188 CPDFSDK_Annot* pAnnot, | |
189 FX_DWORD nFlags, | |
190 const CPDF_Point& point); | |
191 virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, | |
192 CPDFSDK_Annot* pAnnot, | |
193 FX_DWORD nFlags, | |
194 short zDelta, | |
195 const CPDF_Point& point); | |
196 virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, | |
197 CPDFSDK_Annot* pAnnot, | |
198 FX_DWORD nFlags, | |
199 const CPDF_Point& point); | |
200 virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, | |
201 CPDFSDK_Annot* pAnnot, | |
202 FX_DWORD nFlags, | |
203 const CPDF_Point& point); | |
204 virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, | |
205 CPDFSDK_Annot* pAnnot, | |
206 FX_DWORD nFlags, | |
207 const CPDF_Point& point) { | |
208 return FALSE; | 193 return FALSE; |
209 } | 194 } |
210 | 195 FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, |
211 // by wjm. | 196 FX_DWORD nChar, |
212 virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, | 197 FX_DWORD nFlags) override; |
213 FX_DWORD nChar, | 198 FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
214 FX_DWORD nFlags); | 199 FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
215 virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); | 200 void OnDeSelected(CPDFSDK_Annot* pAnnot) override {} |
216 virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); | 201 void OnSelected(CPDFSDK_Annot* pAnnot) override {} |
217 | 202 FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) override; |
218 virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) {} | 203 FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) override; |
219 virtual void OnSelected(CPDFSDK_Annot* pAnnot) {} | |
220 | |
221 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag); | |
222 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag); | |
223 | 204 |
224 void SetFormFiller(CFFL_IFormFiller* pFiller) { m_pFormFiller = pFiller; } | 205 void SetFormFiller(CFFL_IFormFiller* pFiller) { m_pFormFiller = pFiller; } |
225 CFFL_IFormFiller* GetFormFiller() { return m_pFormFiller; } | 206 CFFL_IFormFiller* GetFormFiller() { return m_pFormFiller; } |
226 | 207 |
227 private: | 208 private: |
228 CPDFDoc_Environment* m_pApp; | 209 CPDFDoc_Environment* m_pApp; |
229 CFFL_IFormFiller* m_pFormFiller; | 210 CFFL_IFormFiller* m_pFormFiller; |
230 }; | 211 }; |
231 | 212 |
232 #define CBA_AnnotHandlerArray CFX_ArrayTemplate<IPDFSDK_AnnotHandler*> | 213 #define CBA_AnnotHandlerArray CFX_ArrayTemplate<IPDFSDK_AnnotHandler*> |
233 class CPDFSDK_AnnotHandlerMgr { | 214 class CPDFSDK_AnnotHandlerMgr { |
234 public: | 215 public: |
235 // Destroy the handler | 216 // Destroy the handler |
236 CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp); | 217 explicit CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp); |
237 virtual ~CPDFSDK_AnnotHandlerMgr(); | 218 virtual ~CPDFSDK_AnnotHandlerMgr(); |
238 | 219 |
239 public: | 220 public: |
240 void RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); | 221 void RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); |
241 void UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); | 222 void UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); |
242 | 223 |
243 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, | 224 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, |
244 CPDFSDK_PageView* pPageView); | 225 CPDFSDK_PageView* pPageView); |
245 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); | 226 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); |
246 | 227 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 CPDFSDK_Annot* NextAnnot(int& index); | 329 CPDFSDK_Annot* NextAnnot(int& index); |
349 CPDFSDK_Annot* PrevAnnot(int& index); | 330 CPDFSDK_Annot* PrevAnnot(int& index); |
350 | 331 |
351 CFX_PtrArray m_pIteratorAnnotList; | 332 CFX_PtrArray m_pIteratorAnnotList; |
352 FX_BOOL m_bReverse; | 333 FX_BOOL m_bReverse; |
353 FX_BOOL m_bIgnoreTopmost; | 334 FX_BOOL m_bIgnoreTopmost; |
354 FX_BOOL m_bCircle; | 335 FX_BOOL m_bCircle; |
355 }; | 336 }; |
356 | 337 |
357 #endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ | 338 #endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ |
OLD | NEW |