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 #include "../../public/fpdf_ext.h" | 7 #include "../../public/fpdf_ext.h" |
8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
9 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 9 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
10 #include "../include/fpdfxfa/fpdfxfa_page.h" | 10 #include "../include/fpdfxfa/fpdfxfa_page.h" |
11 #include "../include/fpdfxfa/fpdfxfa_util.h" | 11 #include "../include/fpdfxfa/fpdfxfa_util.h" |
12 #include "../include/fsdk_mgr.h" | 12 #include "../include/fsdk_mgr.h" |
13 #include "../include/formfiller/FFL_FormFiller.h" | 13 #include "../include/formfiller/FFL_FormFiller.h" |
14 #include "../include/javascript/IJavaScript.h" | 14 #include "../include/javascript/IJavaScript.h" |
15 #include "../include/fpdfxfa/fpdfxfa_app.h" | 15 #include "../include/fpdfxfa/fpdfxfa_app.h" |
16 | 16 |
17 #if _FX_OS_ == _FX_ANDROID_ | 17 #if _FX_OS_ == _FX_ANDROID_ |
18 #include "time.h" | 18 #include "time.h" |
19 #else | 19 #else |
20 #include <ctime> | 20 #include <ctime> |
21 #endif | 21 #endif |
22 | 22 |
23 // extern CPDFDoc_Environment* g_pFormFillApp; | |
24 class CFX_SystemHandler : public IFX_SystemHandler { | 23 class CFX_SystemHandler : public IFX_SystemHandler { |
25 public: | 24 public: |
26 CFX_SystemHandler(CPDFDoc_Environment* pEnv) : m_pEnv(pEnv), m_nCharSet(-1) {} | 25 CFX_SystemHandler(CPDFDoc_Environment* pEnv) : m_pEnv(pEnv), m_nCharSet(-1) {} |
| 26 ~CFX_SystemHandler() override {} |
27 | 27 |
28 public: | 28 public: |
29 virtual void InvalidateRect(FX_HWND hWnd, FX_RECT rect); | 29 // IFX_SystemHandler |
30 virtual void OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect); | 30 void InvalidateRect(FX_HWND hWnd, FX_RECT rect) override; |
31 | 31 void OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect) override; |
32 virtual FX_BOOL IsSelectionImplemented(); | 32 FX_BOOL IsSelectionImplemented() override; |
33 | 33 CFX_WideString GetClipboardText(FX_HWND hWnd) override { return L""; } |
34 virtual CFX_WideString GetClipboardText(FX_HWND hWnd) { return L""; } | 34 FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) override { |
35 virtual FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) { | |
36 return FALSE; | 35 return FALSE; |
37 } | 36 } |
38 | 37 void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) override {} |
39 virtual void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) {} | 38 void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) override {} |
40 virtual void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) {} | 39 void SetCursor(int32_t nCursorType) override; |
41 | 40 FX_HMENU CreatePopupMenu() override { return NULL; } |
42 /*cursor style | 41 FX_BOOL AppendMenuItem(FX_HMENU hMenu, |
43 FXCT_ARROW | 42 int32_t nIDNewItem, |
44 FXCT_NESW | 43 CFX_WideString string) override { |
45 FXCT_NWSE | |
46 FXCT_VBEAM | |
47 FXCT_HBEAM | |
48 FXCT_HAND | |
49 */ | |
50 virtual void SetCursor(int32_t nCursorType); | |
51 | |
52 virtual FX_HMENU CreatePopupMenu() { return NULL; } | |
53 virtual FX_BOOL AppendMenuItem(FX_HMENU hMenu, | |
54 int32_t nIDNewItem, | |
55 CFX_WideString string) { | |
56 return FALSE; | 44 return FALSE; |
57 } | 45 } |
58 virtual FX_BOOL EnableMenuItem(FX_HMENU hMenu, | 46 FX_BOOL EnableMenuItem(FX_HMENU hMenu, |
59 int32_t nIDItem, | 47 int32_t nIDItem, |
60 FX_BOOL bEnabled) { | 48 FX_BOOL bEnabled) override { |
61 return FALSE; | 49 return FALSE; |
62 } | 50 } |
63 virtual int32_t TrackPopupMenu(FX_HMENU hMenu, | 51 int32_t TrackPopupMenu(FX_HMENU hMenu, |
64 int32_t x, | 52 int32_t x, |
65 int32_t y, | 53 int32_t y, |
66 FX_HWND hParent) { | 54 FX_HWND hParent) override { |
67 return -1; | 55 return -1; |
68 } | 56 } |
69 virtual void DestroyMenu(FX_HMENU hMenu) {} | 57 void DestroyMenu(FX_HMENU hMenu) override {} |
70 | 58 CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset) override; |
71 virtual CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset); | 59 FX_BOOL FindNativeTrueTypeFont(int32_t nCharset, |
72 virtual FX_BOOL FindNativeTrueTypeFont(int32_t nCharset, | 60 CFX_ByteString sFontFaceName) override; |
73 CFX_ByteString sFontFaceName); | 61 CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, |
74 virtual CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, | 62 CFX_ByteString sFontFaceName, |
75 CFX_ByteString sFontFaceName, | 63 uint8_t nCharset) override; |
76 uint8_t nCharset); | 64 int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc) override; |
77 | 65 void KillTimer(int32_t nID) override; |
78 virtual int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc); | 66 FX_BOOL IsSHIFTKeyDown(FX_DWORD nFlag) override { |
79 virtual void KillTimer(int32_t nID); | |
80 | |
81 virtual FX_BOOL IsSHIFTKeyDown(FX_DWORD nFlag) { | |
82 return m_pEnv->FFI_IsSHIFTKeyDown(nFlag); | 67 return m_pEnv->FFI_IsSHIFTKeyDown(nFlag); |
83 } | 68 } |
84 virtual FX_BOOL IsCTRLKeyDown(FX_DWORD nFlag) { | 69 FX_BOOL IsCTRLKeyDown(FX_DWORD nFlag) override { |
85 return m_pEnv->FFI_IsCTRLKeyDown(nFlag); | 70 return m_pEnv->FFI_IsCTRLKeyDown(nFlag); |
86 } | 71 } |
87 virtual FX_BOOL IsALTKeyDown(FX_DWORD nFlag) { | 72 FX_BOOL IsALTKeyDown(FX_DWORD nFlag) override { |
88 return m_pEnv->FFI_IsALTKeyDown(nFlag); | 73 return m_pEnv->FFI_IsALTKeyDown(nFlag); |
89 } | 74 } |
90 virtual FX_BOOL IsINSERTKeyDown(FX_DWORD nFlag) { | 75 FX_BOOL IsINSERTKeyDown(FX_DWORD nFlag) override { |
91 return m_pEnv->FFI_IsINSERTKeyDown(nFlag); | 76 return m_pEnv->FFI_IsINSERTKeyDown(nFlag); |
92 } | 77 } |
93 | 78 FX_SYSTEMTIME GetLocalTime() override; |
94 virtual FX_SYSTEMTIME GetLocalTime(); | 79 int32_t GetCharSet() override { return m_nCharSet; } |
95 | 80 void SetCharSet(int32_t nCharSet) override { m_nCharSet = nCharSet; } |
96 virtual int32_t GetCharSet() { return m_nCharSet; } | |
97 virtual void SetCharSet(int32_t nCharSet) { m_nCharSet = nCharSet; } | |
98 | 81 |
99 private: | 82 private: |
100 CPDFDoc_Environment* m_pEnv; | 83 CPDFDoc_Environment* m_pEnv; |
101 int m_nCharSet; | 84 int m_nCharSet; |
102 }; | 85 }; |
103 | 86 |
104 void CFX_SystemHandler::SetCursor(int32_t nCursorType) { | 87 void CFX_SystemHandler::SetCursor(int32_t nCursorType) { |
105 m_pEnv->FFI_SetCursor(nCursorType); | 88 m_pEnv->FFI_SetCursor(nCursorType); |
106 } | 89 } |
107 | 90 |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 if (!pFocusAnnot) | 1195 if (!pFocusAnnot) |
1213 return NULL; | 1196 return NULL; |
1214 | 1197 |
1215 for (int i = 0; i < m_fxAnnotArray.GetSize(); i++) { | 1198 for (int i = 0; i < m_fxAnnotArray.GetSize(); i++) { |
1216 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); | 1199 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); |
1217 if (pAnnot == pFocusAnnot) | 1200 if (pAnnot == pFocusAnnot) |
1218 return pAnnot; | 1201 return pAnnot; |
1219 } | 1202 } |
1220 return NULL; | 1203 return NULL; |
1221 } | 1204 } |
OLD | NEW |