blob: 76da223310a234083b642198327318ace7ae2389 [file] [log] [blame]
dsinclairb9590102016-04-27 06:38:59 -07001// Copyright 2016 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_CFX_SYSTEMHANDLER_H_
8#define FPDFSDK_CFX_SYSTEMHANDLER_H_
9
10#include "core/fxcrt/include/fx_coordinates.h"
11#include "core/fxcrt/include/fx_system.h"
12
13using FX_HWND = void*;
14using FX_HMENU = void*;
15using TimerCallback = void (*)(int32_t idEvent);
16
17struct FX_SYSTEMTIME {
18 FX_SYSTEMTIME()
19 : wYear(0),
20 wMonth(0),
21 wDayOfWeek(0),
22 wDay(0),
23 wHour(0),
24 wMinute(0),
25 wSecond(0),
26 wMilliseconds(0) {}
27
28 uint16_t wYear;
29 uint16_t wMonth;
30 uint16_t wDayOfWeek;
31 uint16_t wDay;
32 uint16_t wHour;
33 uint16_t wMinute;
34 uint16_t wSecond;
35 uint16_t wMilliseconds;
36};
37
38// Cursor style. These must match the values in public/fpdf_formfill.h
39#define FXCT_ARROW 0
40#define FXCT_NESW 1
41#define FXCT_NWSE 2
42#define FXCT_VBEAM 3
43#define FXCT_HBEAM 4
44#define FXCT_HAND 5
45
46class CPDF_Document;
47class CPDF_Font;
48class CPDFDoc_Environment;
49
50class CFX_SystemHandler {
51 public:
thestig907a5222016-06-21 14:38:27 -070052 explicit CFX_SystemHandler(CPDFDoc_Environment* pEnv) : m_pEnv(pEnv) {}
dsinclairb9590102016-04-27 06:38:59 -070053 ~CFX_SystemHandler() {}
54
55 void InvalidateRect(FX_HWND hWnd, FX_RECT rect);
56 void OutputSelectedRect(void* pFormFiller, CFX_FloatRect& rect);
57 bool IsSelectionImplemented() const;
58
59 void SetCursor(int32_t nCursorType);
60
thestig907a5222016-06-21 14:38:27 -070061 bool FindNativeTrueTypeFont(CFX_ByteString sFontFaceName);
dsinclairb9590102016-04-27 06:38:59 -070062 CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc,
63 CFX_ByteString sFontFaceName,
64 uint8_t nCharset);
65 int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc);
66 void KillTimer(int32_t nID);
67 bool IsSHIFTKeyDown(uint32_t nFlag) const;
68 bool IsCTRLKeyDown(uint32_t nFlag) const;
69 bool IsALTKeyDown(uint32_t nFlag) const;
dsinclairb9590102016-04-27 06:38:59 -070070
71 FX_SYSTEMTIME GetLocalTime();
72
dsinclairb9590102016-04-27 06:38:59 -070073 private:
74 CPDFDoc_Environment* const m_pEnv;
dsinclairb9590102016-04-27 06:38:59 -070075};
76
77#endif // FPDFSDK_CFX_SYSTEMHANDLER_H_