Home | History | Annotate | Download | only in fpdfsdk
      1 // 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/fx_coordinates.h"
     11 #include "core/fxcrt/fx_string.h"
     12 #include "core/fxcrt/fx_system.h"
     13 #include "core/fxcrt/unowned_ptr.h"
     14 
     15 using TimerCallback = void (*)(int32_t idEvent);
     16 
     17 struct 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 
     46 class CFFL_FormFiller;
     47 class CPDF_Document;
     48 class CPDF_Font;
     49 class CPDFSDK_FormFillEnvironment;
     50 class CPDFSDK_Widget;
     51 
     52 class CFX_SystemHandler {
     53  public:
     54   explicit CFX_SystemHandler(CPDFSDK_FormFillEnvironment* pFormFillEnv);
     55   ~CFX_SystemHandler();
     56 
     57   void InvalidateRect(CPDFSDK_Widget* widget, const CFX_FloatRect& rect);
     58   void OutputSelectedRect(CFFL_FormFiller* pFormFiller, CFX_FloatRect& rect);
     59   bool IsSelectionImplemented() const;
     60   void SetCursor(int32_t nCursorType);
     61   bool FindNativeTrueTypeFont(ByteString sFontFaceName);
     62   CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc,
     63                                         ByteString sFontFaceName,
     64                                         uint8_t nCharset);
     65 
     66   int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc);
     67   void KillTimer(int32_t nID);
     68 
     69  private:
     70   UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
     71 };
     72 
     73 #endif  // FPDFSDK_CFX_SYSTEMHANDLER_H_
     74