1 // Copyright 2014 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_INCLUDE_FX_SYSTEMHANDLER_H_ 8 #define FPDFSDK_INCLUDE_FX_SYSTEMHANDLER_H_ 9 10 #include "core/include/fpdfapi/fpdf_parser.h" 11 #include "core/include/fxcrt/fx_coordinates.h" 12 #include "core/include/fxcrt/fx_system.h" 13 14 class CPDF_Document; 15 class CPDF_Font; 16 17 typedef void* FX_HWND; 18 typedef void* FX_HMENU; 19 typedef void (*TimerCallback)(int32_t idEvent); 20 21 typedef struct _FX_SYSTEMTIME { 22 _FX_SYSTEMTIME() 23 : wYear(0), 24 wMonth(0), 25 wDayOfWeek(0), 26 wDay(0), 27 wHour(0), 28 wMinute(0), 29 wSecond(0), 30 wMilliseconds(0) {} 31 FX_WORD wYear; 32 FX_WORD wMonth; 33 FX_WORD wDayOfWeek; 34 FX_WORD wDay; 35 FX_WORD wHour; 36 FX_WORD wMinute; 37 FX_WORD wSecond; 38 FX_WORD wMilliseconds; 39 } FX_SYSTEMTIME; 40 41 // cursor style 42 #define FXCT_ARROW 0 43 #define FXCT_NESW 1 44 #define FXCT_NWSE 2 45 #define FXCT_VBEAM 3 46 #define FXCT_HBEAM 4 47 #define FXCT_HAND 5 48 49 class IFX_SystemHandler { 50 public: 51 virtual ~IFX_SystemHandler() {} 52 virtual void InvalidateRect(FX_HWND hWnd, FX_RECT rect) = 0; 53 virtual void OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect) = 0; 54 55 virtual FX_BOOL IsSelectionImplemented() = 0; 56 57 virtual CFX_WideString GetClipboardText(FX_HWND hWnd) = 0; 58 virtual FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) = 0; 59 60 virtual void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) = 0; 61 virtual void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) = 0; 62 63 /*cursor style 64 FXCT_ARROW 65 FXCT_NESW 66 FXCT_NWSE 67 FXCT_VBEAM 68 FXCT_HBEAM 69 FXCT_HAND 70 */ 71 virtual void SetCursor(int32_t nCursorType) = 0; 72 73 virtual FX_HMENU CreatePopupMenu() = 0; 74 virtual FX_BOOL AppendMenuItem(FX_HMENU hMenu, 75 int32_t nIDNewItem, 76 CFX_WideString string) = 0; 77 virtual FX_BOOL EnableMenuItem(FX_HMENU hMenu, 78 int32_t nIDItem, 79 FX_BOOL bEnabled) = 0; 80 virtual int32_t TrackPopupMenu(FX_HMENU hMenu, 81 int32_t x, 82 int32_t y, 83 FX_HWND hParent) = 0; 84 virtual void DestroyMenu(FX_HMENU hMenu) = 0; 85 86 virtual CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset) = 0; 87 virtual FX_BOOL FindNativeTrueTypeFont(int32_t nCharset, 88 CFX_ByteString sFontFaceName) = 0; 89 virtual CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, 90 CFX_ByteString sFontFaceName, 91 uint8_t nCharset) = 0; 92 93 virtual int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc) = 0; 94 virtual void KillTimer(int32_t nID) = 0; 95 96 virtual FX_BOOL IsSHIFTKeyDown(FX_DWORD nFlag) = 0; 97 virtual FX_BOOL IsCTRLKeyDown(FX_DWORD nFlag) = 0; 98 virtual FX_BOOL IsALTKeyDown(FX_DWORD nFlag) = 0; 99 virtual FX_BOOL IsINSERTKeyDown(FX_DWORD nFlag) = 0; 100 101 virtual FX_SYSTEMTIME GetLocalTime() = 0; 102 103 virtual int32_t GetCharSet() = 0; 104 virtual void SetCharSet(int32_t nCharSet) = 0; 105 }; 106 107 #endif // FPDFSDK_INCLUDE_FX_SYSTEMHANDLER_H_ 108