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