summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-27 06:38:59 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-27 06:38:59 -0700
commitb95901091d63ce09accec3088945955f969d46e1 (patch)
tree9994d5b9bcd5de21eb0c72d7c4b9a82fae7dde5f
parent12168d764be266a209bc3fd15dbe4223732ae319 (diff)
downloadpdfium-b95901091d63ce09accec3088945955f969d46e1.tar.xz
Remove IFX_SystemHandler.
This CL folds IFX_SystemHandler into CFX_SystemHandler. Methods which either had no implementation, or returned a default value have been removed. Review URL: https://codereview.chromium.org/1923093002
-rw-r--r--BUILD.gn2
-rw-r--r--fpdfsdk/cfx_systemhandler.cpp142
-rw-r--r--fpdfsdk/cfx_systemhandler.h83
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.cpp2
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.h2
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp2
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.h2
-rw-r--r--fpdfsdk/fsdk_mgr.cpp183
-rw-r--r--fpdfsdk/fxedit/fxet_pageobjs.cpp4
-rw-r--r--fpdfsdk/fxedit/include/fx_edit.h4
-rw-r--r--fpdfsdk/include/fsdk_baseannot.h2
-rw-r--r--fpdfsdk/include/fsdk_mgr.h8
-rw-r--r--fpdfsdk/include/fx_systemhandler.h106
-rw-r--r--fpdfsdk/javascript/JS_Object.cpp4
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.cpp205
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.h7
-rw-r--r--fpdfsdk/pdfwindow/PWL_EditCtrl.cpp2
-rw-r--r--fpdfsdk/pdfwindow/PWL_FontMap.cpp8
-rw-r--r--fpdfsdk/pdfwindow/PWL_FontMap.h10
-rw-r--r--fpdfsdk/pdfwindow/PWL_Label.cpp2
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListBox.cpp4
-rw-r--r--fpdfsdk/pdfwindow/PWL_Wnd.cpp16
-rw-r--r--fpdfsdk/pdfwindow/PWL_Wnd.h14
-rw-r--r--pdfium.gyp2
-rw-r--r--xfa/fwl/core/fwl_sdadapterimp.cpp4
-rw-r--r--xfa/fwl/core/fwl_sdadapterimp.h1
-rw-r--r--xfa/fwl/core/ifwl_adapterwidgetmgr.h1
27 files changed, 277 insertions, 545 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 4c974a9581..747c6305bd 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -57,6 +57,8 @@ config("pdfium_config") {
static_library("pdfium") {
sources = [
+ "fpdfsdk/cfx_systemhandler.cpp",
+ "fpdfsdk/cfx_systemhandler.h",
"fpdfsdk/fpdf_dataavail.cpp",
"fpdfsdk/fpdf_ext.cpp",
"fpdfsdk/fpdf_flatten.cpp",
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
new file mode 100644
index 0000000000..95a940d1ff
--- /dev/null
+++ b/fpdfsdk/cfx_systemhandler.cpp
@@ -0,0 +1,142 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/cfx_systemhandler.h"
+
+#include "fpdfsdk/formfiller/cffl_formfiller.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+
+namespace {
+
+int CharSet2CP(int charset) {
+ if (charset == 128)
+ return 932;
+ if (charset == 134)
+ return 936;
+ if (charset == 129)
+ return 949;
+ if (charset == 136)
+ return 950;
+ return 0;
+}
+
+} // namespace
+
+void CFX_SystemHandler::SetCursor(int32_t nCursorType) {
+ m_pEnv->FFI_SetCursor(nCursorType);
+}
+
+void CFX_SystemHandler::InvalidateRect(FX_HWND hWnd, FX_RECT rect) {
+ CPDFSDK_Annot* pSDKAnnot = (CPDFSDK_Annot*)hWnd;
+ CPDFSDK_PageView* pPageView = pSDKAnnot->GetPageView();
+ UnderlyingPageType* pPage = pSDKAnnot->GetUnderlyingPage();
+ if (!pPage || !pPageView)
+ return;
+
+ CFX_Matrix page2device;
+ pPageView->GetCurrentMatrix(page2device);
+ CFX_Matrix device2page;
+ device2page.SetReverse(page2device);
+ FX_FLOAT left, top, right, bottom;
+ device2page.Transform((FX_FLOAT)rect.left, (FX_FLOAT)rect.top, left, top);
+ device2page.Transform((FX_FLOAT)rect.right, (FX_FLOAT)rect.bottom, right,
+ bottom);
+ CFX_FloatRect rcPDF(left, bottom, right, top);
+ rcPDF.Normalize();
+
+ m_pEnv->FFI_Invalidate(pPage, rcPDF.left, rcPDF.top, rcPDF.right,
+ rcPDF.bottom);
+}
+
+void CFX_SystemHandler::OutputSelectedRect(void* pFormFiller,
+ CFX_FloatRect& rect) {
+ CFFL_FormFiller* pFFL = (CFFL_FormFiller*)pFormFiller;
+ if (!pFFL)
+ return;
+
+ CFX_FloatPoint leftbottom = CFX_FloatPoint(rect.left, rect.bottom);
+ CFX_FloatPoint righttop = CFX_FloatPoint(rect.right, rect.top);
+ CFX_FloatPoint ptA = pFFL->PWLtoFFL(leftbottom);
+ CFX_FloatPoint ptB = pFFL->PWLtoFFL(righttop);
+ CPDFSDK_Annot* pAnnot = pFFL->GetSDKAnnot();
+ UnderlyingPageType* pPage = pAnnot->GetUnderlyingPage();
+ ASSERT(pPage);
+
+ m_pEnv->FFI_OutputSelectedRect(pPage, ptA.x, ptB.y, ptB.x, ptA.y);
+}
+
+bool CFX_SystemHandler::IsSelectionImplemented() const {
+ if (m_pEnv) {
+ FPDF_FORMFILLINFO* pInfo = m_pEnv->GetFormFillInfo();
+ if (pInfo && pInfo->FFI_OutputSelectedRect)
+ return true;
+ }
+ return false;
+}
+
+bool CFX_SystemHandler::FindNativeTrueTypeFont(int32_t nCharset,
+ CFX_ByteString sFontFaceName) {
+ CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr();
+ if (!pFontMgr)
+ return false;
+
+ CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper();
+ if (!pFontMapper)
+ return false;
+
+ if (pFontMapper->m_InstalledTTFonts.empty())
+ pFontMapper->LoadInstalledFonts();
+
+ for (const auto& font : pFontMapper->m_InstalledTTFonts) {
+ if (font.Compare(sFontFaceName.AsStringC()))
+ return true;
+ }
+
+ return false;
+}
+
+CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF(
+ CPDF_Document* pDoc,
+ CFX_ByteString sFontFaceName,
+ uint8_t nCharset) {
+ if (!pDoc)
+ return nullptr;
+
+ CFX_Font* pFXFont = new CFX_Font();
+ pFXFont->LoadSubst(sFontFaceName, TRUE, 0, 0, 0, CharSet2CP(nCharset), FALSE);
+ CPDF_Font* pFont = pDoc->AddFont(pFXFont, nCharset, FALSE);
+ delete pFXFont;
+ return pFont;
+}
+
+int32_t CFX_SystemHandler::SetTimer(int32_t uElapse,
+ TimerCallback lpTimerFunc) {
+ return m_pEnv->FFI_SetTimer(uElapse, lpTimerFunc);
+}
+
+void CFX_SystemHandler::KillTimer(int32_t nID) {
+ m_pEnv->FFI_KillTimer(nID);
+}
+
+FX_SYSTEMTIME CFX_SystemHandler::GetLocalTime() {
+ return m_pEnv->FFI_GetLocalTime();
+}
+
+bool CFX_SystemHandler::IsSHIFTKeyDown(uint32_t nFlag) const {
+ return m_pEnv->FFI_IsSHIFTKeyDown(nFlag);
+}
+
+bool CFX_SystemHandler::IsCTRLKeyDown(uint32_t nFlag) const {
+ return m_pEnv->FFI_IsCTRLKeyDown(nFlag);
+}
+
+bool CFX_SystemHandler::IsALTKeyDown(uint32_t nFlag) const {
+ return m_pEnv->FFI_IsALTKeyDown(nFlag);
+}
+
+bool CFX_SystemHandler::IsINSERTKeyDown(uint32_t nFlag) const {
+ return m_pEnv->FFI_IsINSERTKeyDown(nFlag);
+}
diff --git a/fpdfsdk/cfx_systemhandler.h b/fpdfsdk/cfx_systemhandler.h
new file mode 100644
index 0000000000..ec5735366c
--- /dev/null
+++ b/fpdfsdk/cfx_systemhandler.h
@@ -0,0 +1,83 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_CFX_SYSTEMHANDLER_H_
+#define FPDFSDK_CFX_SYSTEMHANDLER_H_
+
+#include "core/fxcrt/include/fx_coordinates.h"
+#include "core/fxcrt/include/fx_system.h"
+
+using FX_HWND = void*;
+using FX_HMENU = void*;
+using TimerCallback = void (*)(int32_t idEvent);
+
+struct FX_SYSTEMTIME {
+ FX_SYSTEMTIME()
+ : wYear(0),
+ wMonth(0),
+ wDayOfWeek(0),
+ wDay(0),
+ wHour(0),
+ wMinute(0),
+ wSecond(0),
+ wMilliseconds(0) {}
+
+ uint16_t wYear;
+ uint16_t wMonth;
+ uint16_t wDayOfWeek;
+ uint16_t wDay;
+ uint16_t wHour;
+ uint16_t wMinute;
+ uint16_t wSecond;
+ uint16_t wMilliseconds;
+};
+
+// Cursor style. These must match the values in public/fpdf_formfill.h
+#define FXCT_ARROW 0
+#define FXCT_NESW 1
+#define FXCT_NWSE 2
+#define FXCT_VBEAM 3
+#define FXCT_HBEAM 4
+#define FXCT_HAND 5
+
+class CPDF_Document;
+class CPDF_Font;
+class CPDFDoc_Environment;
+
+class CFX_SystemHandler {
+ public:
+ explicit CFX_SystemHandler(CPDFDoc_Environment* pEnv)
+ : m_pEnv(pEnv), m_nCharSet(-1) {}
+ ~CFX_SystemHandler() {}
+
+ void InvalidateRect(FX_HWND hWnd, FX_RECT rect);
+ void OutputSelectedRect(void* pFormFiller, CFX_FloatRect& rect);
+ bool IsSelectionImplemented() const;
+
+ void SetCursor(int32_t nCursorType);
+
+ bool FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteString sFontFaceName);
+ CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc,
+ CFX_ByteString sFontFaceName,
+ uint8_t nCharset);
+ int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc);
+ void KillTimer(int32_t nID);
+ bool IsSHIFTKeyDown(uint32_t nFlag) const;
+ bool IsCTRLKeyDown(uint32_t nFlag) const;
+ bool IsALTKeyDown(uint32_t nFlag) const;
+ bool IsINSERTKeyDown(uint32_t nFlag) const;
+
+ FX_SYSTEMTIME GetLocalTime();
+
+ int32_t GetCharSet() const { return m_nCharSet; }
+ void SetCharSet(int32_t nCharSet) { m_nCharSet = nCharSet; }
+
+ private:
+ CPDFDoc_Environment* const m_pEnv;
+ int m_nCharSet;
+};
+
+#endif // FPDFSDK_CFX_SYSTEMHANDLER_H_
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
index 4b9fcf839d..00e213c7d7 100644
--- a/fpdfsdk/formfiller/cba_fontmap.cpp
+++ b/fpdfsdk/formfiller/cba_fontmap.cpp
@@ -14,7 +14,7 @@
#include "fpdfsdk/include/fsdk_baseannot.h"
CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot,
- IFX_SystemHandler* pSystemHandler)
+ CFX_SystemHandler* pSystemHandler)
: CPWL_FontMap(pSystemHandler),
m_pDocument(NULL),
m_pAnnotDict(NULL),
diff --git a/fpdfsdk/formfiller/cba_fontmap.h b/fpdfsdk/formfiller/cba_fontmap.h
index ac5f2ced8a..c0e569a0d3 100644
--- a/fpdfsdk/formfiller/cba_fontmap.h
+++ b/fpdfsdk/formfiller/cba_fontmap.h
@@ -14,7 +14,7 @@ class CPDFSDK_Annot;
class CBA_FontMap : public CPWL_FontMap {
public:
- CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandler);
+ CBA_FontMap(CPDFSDK_Annot* pAnnot, CFX_SystemHandler* pSystemHandler);
~CBA_FontMap() override;
void SetDefaultFont(CPDF_Font* pFont, const CFX_ByteString& sFontName);
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 9ca8f05493..b6f719db99 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -603,7 +603,7 @@ CPWL_Wnd* CFFL_FormFiller::ResetPDFWindow(CPDFSDK_PageView* pPageView,
void CFFL_FormFiller::TimerProc() {}
-IFX_SystemHandler* CFFL_FormFiller::GetSystemHandler() const {
+CFX_SystemHandler* CFFL_FormFiller::GetSystemHandler() const {
return m_pApp->GetSysHandler();
}
diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h
index 9e9f4becf4..7360957256 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.h
+++ b/fpdfsdk/formfiller/cffl_formfiller.h
@@ -83,7 +83,7 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler {
// CPWL_TimerHandler
void TimerProc() override;
- IFX_SystemHandler* GetSystemHandler() const override;
+ CFX_SystemHandler* GetSystemHandler() const override;
// IPWL_Provider
CFX_Matrix GetWindowMatrix(void* pAttachedData) override;
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index cfb1b8a8b3..4ab4850c4d 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -33,194 +33,11 @@
#include <ctime>
#endif
-namespace {
-
-int CharSet2CP(int charset) {
- if (charset == 128)
- return 932;
- if (charset == 134)
- return 936;
- if (charset == 129)
- return 949;
- if (charset == 136)
- return 950;
- return 0;
-}
-
-} // namespace
-
FPDF_WIDESTRING AsFPDFWideString(CFX_ByteString* bsUTF16LE) {
return reinterpret_cast<FPDF_WIDESTRING>(
bsUTF16LE->GetBuffer(bsUTF16LE->GetLength()));
}
-class CFX_SystemHandler : public IFX_SystemHandler {
- public:
- explicit CFX_SystemHandler(CPDFDoc_Environment* pEnv)
- : m_pEnv(pEnv), m_nCharSet(-1) {}
- ~CFX_SystemHandler() override {}
-
- public:
- // IFX_SystemHandler
- void InvalidateRect(FX_HWND hWnd, FX_RECT rect) override;
- void OutputSelectedRect(void* pFormFiller, CFX_FloatRect& rect) override;
- FX_BOOL IsSelectionImplemented() override;
- CFX_WideString GetClipboardText(FX_HWND hWnd) override { return L""; }
- FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString str) override {
- return FALSE;
- }
- void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) override {}
- void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) override {}
- void SetCursor(int32_t nCursorType) override;
- FX_HMENU CreatePopupMenu() override { return NULL; }
- FX_BOOL AppendMenuItem(FX_HMENU hMenu,
- int32_t nIDNewItem,
- CFX_WideString str) override {
- return FALSE;
- }
- FX_BOOL EnableMenuItem(FX_HMENU hMenu,
- int32_t nIDItem,
- FX_BOOL bEnabled) override {
- return FALSE;
- }
- int32_t TrackPopupMenu(FX_HMENU hMenu,
- int32_t x,
- int32_t y,
- FX_HWND hParent) override {
- return -1;
- }
- void DestroyMenu(FX_HMENU hMenu) override {}
- CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset) override;
- FX_BOOL FindNativeTrueTypeFont(int32_t nCharset,
- CFX_ByteString sFontFaceName) override;
- CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc,
- CFX_ByteString sFontFaceName,
- uint8_t nCharset) override;
- int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc) override;
- void KillTimer(int32_t nID) override;
- FX_BOOL IsSHIFTKeyDown(uint32_t nFlag) override {
- return m_pEnv->FFI_IsSHIFTKeyDown(nFlag);
- }
- FX_BOOL IsCTRLKeyDown(uint32_t nFlag) override {
- return m_pEnv->FFI_IsCTRLKeyDown(nFlag);
- }
- FX_BOOL IsALTKeyDown(uint32_t nFlag) override {
- return m_pEnv->FFI_IsALTKeyDown(nFlag);
- }
- FX_BOOL IsINSERTKeyDown(uint32_t nFlag) override {
- return m_pEnv->FFI_IsINSERTKeyDown(nFlag);
- }
- FX_SYSTEMTIME GetLocalTime() override;
- int32_t GetCharSet() override { return m_nCharSet; }
- void SetCharSet(int32_t nCharSet) override { m_nCharSet = nCharSet; }
-
- private:
- CPDFDoc_Environment* m_pEnv;
- int m_nCharSet;
-};
-
-void CFX_SystemHandler::SetCursor(int32_t nCursorType) {
- m_pEnv->FFI_SetCursor(nCursorType);
-}
-
-void CFX_SystemHandler::InvalidateRect(FX_HWND hWnd, FX_RECT rect) {
- CPDFSDK_Annot* pSDKAnnot = (CPDFSDK_Annot*)hWnd;
- CPDFSDK_PageView* pPageView = pSDKAnnot->GetPageView();
- UnderlyingPageType* pPage = pSDKAnnot->GetUnderlyingPage();
- if (!pPage || !pPageView)
- return;
- CFX_Matrix page2device;
- pPageView->GetCurrentMatrix(page2device);
- CFX_Matrix device2page;
- device2page.SetReverse(page2device);
- FX_FLOAT left, top, right, bottom;
- device2page.Transform((FX_FLOAT)rect.left, (FX_FLOAT)rect.top, left, top);
- device2page.Transform((FX_FLOAT)rect.right, (FX_FLOAT)rect.bottom, right,
- bottom);
- CFX_FloatRect rcPDF(left, bottom, right, top);
- rcPDF.Normalize();
-
- m_pEnv->FFI_Invalidate(pPage, rcPDF.left, rcPDF.top, rcPDF.right,
- rcPDF.bottom);
-}
-void CFX_SystemHandler::OutputSelectedRect(void* pFormFiller,
- CFX_FloatRect& rect) {
- CFFL_FormFiller* pFFL = (CFFL_FormFiller*)pFormFiller;
- if (pFFL) {
- CFX_FloatPoint leftbottom = CFX_FloatPoint(rect.left, rect.bottom);
- CFX_FloatPoint righttop = CFX_FloatPoint(rect.right, rect.top);
- CFX_FloatPoint ptA = pFFL->PWLtoFFL(leftbottom);
- CFX_FloatPoint ptB = pFFL->PWLtoFFL(righttop);
- CPDFSDK_Annot* pAnnot = pFFL->GetSDKAnnot();
- UnderlyingPageType* pPage = pAnnot->GetUnderlyingPage();
- ASSERT(pPage);
- m_pEnv->FFI_OutputSelectedRect(pPage, ptA.x, ptB.y, ptB.x, ptA.y);
- }
-}
-
-FX_BOOL CFX_SystemHandler::IsSelectionImplemented() {
- if (m_pEnv) {
- FPDF_FORMFILLINFO* pInfo = m_pEnv->GetFormFillInfo();
- if (pInfo && pInfo->FFI_OutputSelectedRect)
- return TRUE;
- }
- return FALSE;
-}
-
-CFX_ByteString CFX_SystemHandler::GetNativeTrueTypeFont(int32_t nCharset) {
- return "";
-}
-
-FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont(
- int32_t nCharset,
- CFX_ByteString sFontFaceName) {
- CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr();
- if (!pFontMgr)
- return FALSE;
-
- CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper();
- if (!pFontMapper)
- return FALSE;
-
- if (pFontMapper->m_InstalledTTFonts.empty())
- pFontMapper->LoadInstalledFonts();
-
- for (const auto& font : pFontMapper->m_InstalledTTFonts) {
- if (font.Compare(sFontFaceName.AsStringC()))
- return TRUE;
- }
-
- return FALSE;
-}
-
-CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF(
- CPDF_Document* pDoc,
- CFX_ByteString sFontFaceName,
- uint8_t nCharset) {
- if (pDoc) {
- CFX_Font* pFXFont = new CFX_Font();
- pFXFont->LoadSubst(sFontFaceName, TRUE, 0, 0, 0, CharSet2CP(nCharset),
- FALSE);
- CPDF_Font* pFont = pDoc->AddFont(pFXFont, nCharset, FALSE);
- delete pFXFont;
- return pFont;
- }
-
- return NULL;
-}
-
-int32_t CFX_SystemHandler::SetTimer(int32_t uElapse,
- TimerCallback lpTimerFunc) {
- return m_pEnv->FFI_SetTimer(uElapse, lpTimerFunc);
-}
-void CFX_SystemHandler::KillTimer(int32_t nID) {
- m_pEnv->FFI_KillTimer(nID);
-}
-
-FX_SYSTEMTIME CFX_SystemHandler::GetLocalTime() {
- return m_pEnv->FFI_GetLocalTime();
-}
-
CPDFDoc_Environment::CPDFDoc_Environment(UnderlyingDocumentType* pDoc,
FPDF_FORMFILLINFO* pFFinfo)
: m_pInfo(pFFinfo), m_pSDKDoc(NULL), m_pUnderlyingDoc(pDoc) {
diff --git a/fpdfsdk/fxedit/fxet_pageobjs.cpp b/fpdfsdk/fxedit/fxet_pageobjs.cpp
index b3f4ad60c6..b28cf84efd 100644
--- a/fpdfsdk/fxedit/fxet_pageobjs.cpp
+++ b/fpdfsdk/fxedit/fxet_pageobjs.cpp
@@ -13,9 +13,9 @@
#include "core/fpdfdoc/include/cpvt_word.h"
#include "core/fpdfdoc/include/ipvt_fontmap.h"
#include "core/fxge/include/fx_ge.h"
+#include "fpdfsdk/cfx_systemhandler.h"
#include "fpdfsdk/fxedit/include/fx_edit.h"
#include "fpdfsdk/fxedit/include/fxet_edit.h"
-#include "fpdfsdk/include/fx_systemhandler.h"
#define FX_EDIT_UNDERLINEHALFWIDTH 0.5f
#define FX_EDIT_CROSSOUTHALFWIDTH 0.5f
@@ -151,7 +151,7 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice,
const CFX_FloatRect& rcClip,
const CFX_FloatPoint& ptOffset,
const CPVT_WordRange* pRange,
- IFX_SystemHandler* pSystemHandler,
+ CFX_SystemHandler* pSystemHandler,
void* pFFLData) {
const bool bContinuous =
pEdit->GetCharArray() == 0 && pEdit->GetCharSpace() <= 0.0f;
diff --git a/fpdfsdk/fxedit/include/fx_edit.h b/fpdfsdk/fxedit/include/fx_edit.h
index 4220c0bd01..a00d1d41a7 100644
--- a/fpdfsdk/fxedit/include/fx_edit.h
+++ b/fpdfsdk/fxedit/include/fx_edit.h
@@ -17,6 +17,7 @@ class CPDF_TextObject;
class CFX_FloatPoint;
class CFX_Matrix;
class CFX_RenderDevice;
+class CFX_SystemHandler;
class IFX_Edit;
class IPVT_FontMap;
class IFX_Edit_Iterator;
@@ -24,7 +25,6 @@ class IFX_Edit_Notify;
class IFX_Edit_UndoItem;
class IFX_List;
class IFX_List_Notify;
-class IFX_SystemHandler;
struct CPVT_Line;
struct CPVT_SecProps;
@@ -495,7 +495,7 @@ class IFX_Edit {
const CFX_FloatRect& rcClip,
const CFX_FloatPoint& ptOffset,
const CPVT_WordRange* pRange,
- IFX_SystemHandler* pSystemHandler,
+ CFX_SystemHandler* pSystemHandler,
void* pFFLData);
static void DrawUnderline(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
diff --git a/fpdfsdk/include/fsdk_baseannot.h b/fpdfsdk/include/fsdk_baseannot.h
index 7a1d3e3c20..cb7d49e789 100644
--- a/fpdfsdk/include/fsdk_baseannot.h
+++ b/fpdfsdk/include/fsdk_baseannot.h
@@ -15,8 +15,8 @@
#include "core/fpdfdoc/include/fpdf_doc.h"
#include "core/fxcrt/include/fx_basic.h"
+#include "fpdfsdk/cfx_systemhandler.h"
#include "fpdfsdk/include/fsdk_define.h"
-#include "fpdfsdk/include/fx_systemhandler.h"
class CPDFSDK_PageView;
class CPDF_Annot;
diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h
index ff947cccf8..8fbc0d75e9 100644
--- a/fpdfsdk/include/fsdk_mgr.h
+++ b/fpdfsdk/include/fsdk_mgr.h
@@ -12,23 +12,23 @@
#include <vector>
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
+#include "fpdfsdk/cfx_systemhandler.h"
#include "fpdfsdk/include/fsdk_actionhandler.h"
#include "fpdfsdk/include/fsdk_annothandler.h"
#include "fpdfsdk/include/fsdk_baseannot.h"
#include "fpdfsdk/include/fsdk_baseform.h"
#include "fpdfsdk/include/fsdk_common.h"
#include "fpdfsdk/include/fsdk_define.h"
-#include "fpdfsdk/include/fx_systemhandler.h"
#include "public/fpdf_formfill.h"
#include "public/fpdf_fwlevent.h"
class CFFL_IFormFiller;
+class CFX_SystemHandler;
class CPDFSDK_ActionHandler;
class CPDFSDK_Annot;
class CPDFSDK_InterForm;
class CPDFSDK_PageView;
class CPDFSDK_Widget;
-class IFX_SystemHandler;
class IJS_Runtime;
// NOTE: |bsUTF16LE| must outlive the use of the result. Care must be taken
@@ -437,7 +437,7 @@ class CPDFDoc_Environment final {
return m_pUnderlyingDoc;
}
CFX_ByteString GetAppName() const { return ""; }
- IFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); }
+ CFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); }
FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; }
CFFL_IFormFiller* GetIFormFiller(); // Creates if not present.
@@ -453,7 +453,7 @@ class CPDFDoc_Environment final {
CPDFSDK_Document* m_pSDKDoc;
UnderlyingDocumentType* const m_pUnderlyingDoc;
std::unique_ptr<CFFL_IFormFiller> m_pIFormFiller;
- std::unique_ptr<IFX_SystemHandler> m_pSysHandler;
+ std::unique_ptr<CFX_SystemHandler> m_pSysHandler;
};
class CPDFSDK_Document {
diff --git a/fpdfsdk/include/fx_systemhandler.h b/fpdfsdk/include/fx_systemhandler.h
deleted file mode 100644
index dc225df0a2..0000000000
--- a/fpdfsdk/include/fx_systemhandler.h
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FPDFSDK_INCLUDE_FX_SYSTEMHANDLER_H_
-#define FPDFSDK_INCLUDE_FX_SYSTEMHANDLER_H_
-
-#include "core/fxcrt/include/fx_coordinates.h"
-#include "core/fxcrt/include/fx_system.h"
-
-class CPDF_Document;
-class CPDF_Font;
-
-typedef void* FX_HWND;
-typedef void* FX_HMENU;
-typedef void (*TimerCallback)(int32_t idEvent);
-
-struct FX_SYSTEMTIME {
- FX_SYSTEMTIME()
- : wYear(0),
- wMonth(0),
- wDayOfWeek(0),
- wDay(0),
- wHour(0),
- wMinute(0),
- wSecond(0),
- wMilliseconds(0) {}
- uint16_t wYear;
- uint16_t wMonth;
- uint16_t wDayOfWeek;
- uint16_t wDay;
- uint16_t wHour;
- uint16_t wMinute;
- uint16_t wSecond;
- uint16_t wMilliseconds;
-};
-
-// cursor style
-#define FXCT_ARROW 0
-#define FXCT_NESW 1
-#define FXCT_NWSE 2
-#define FXCT_VBEAM 3
-#define FXCT_HBEAM 4
-#define FXCT_HAND 5
-
-class IFX_SystemHandler {
- public:
- virtual ~IFX_SystemHandler() {}
- virtual void InvalidateRect(FX_HWND hWnd, FX_RECT rect) = 0;
- virtual void OutputSelectedRect(void* pFormFiller, CFX_FloatRect& rect) = 0;
-
- virtual FX_BOOL IsSelectionImplemented() = 0;
-
- virtual CFX_WideString GetClipboardText(FX_HWND hWnd) = 0;
- virtual FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString str) = 0;
-
- virtual void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) = 0;
- virtual void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) = 0;
-
- /*cursor style
- FXCT_ARROW
- FXCT_NESW
- FXCT_NWSE
- FXCT_VBEAM
- FXCT_HBEAM
- FXCT_HAND
- */
- virtual void SetCursor(int32_t nCursorType) = 0;
-
- virtual FX_HMENU CreatePopupMenu() = 0;
- virtual FX_BOOL AppendMenuItem(FX_HMENU hMenu,
- int32_t nIDNewItem,
- CFX_WideString str) = 0;
- virtual FX_BOOL EnableMenuItem(FX_HMENU hMenu,
- int32_t nIDItem,
- FX_BOOL bEnabled) = 0;
- virtual int32_t TrackPopupMenu(FX_HMENU hMenu,
- int32_t x,
- int32_t y,
- FX_HWND hParent) = 0;
- virtual void DestroyMenu(FX_HMENU hMenu) = 0;
-
- virtual CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset) = 0;
- virtual FX_BOOL FindNativeTrueTypeFont(int32_t nCharset,
- CFX_ByteString sFontFaceName) = 0;
- virtual CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc,
- CFX_ByteString sFontFaceName,
- uint8_t nCharset) = 0;
-
- virtual int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc) = 0;
- virtual void KillTimer(int32_t nID) = 0;
-
- virtual FX_BOOL IsSHIFTKeyDown(uint32_t nFlag) = 0;
- virtual FX_BOOL IsCTRLKeyDown(uint32_t nFlag) = 0;
- virtual FX_BOOL IsALTKeyDown(uint32_t nFlag) = 0;
- virtual FX_BOOL IsINSERTKeyDown(uint32_t nFlag) = 0;
-
- virtual FX_SYSTEMTIME GetLocalTime() = 0;
-
- virtual int32_t GetCharSet() = 0;
- virtual void SetCharSet(int32_t nCharSet) = 0;
-};
-
-#endif // FPDFSDK_INCLUDE_FX_SYSTEMHANDLER_H_
diff --git a/fpdfsdk/javascript/JS_Object.cpp b/fpdfsdk/javascript/JS_Object.cpp
index d85cc1dbe4..7dc91a7291 100644
--- a/fpdfsdk/javascript/JS_Object.cpp
+++ b/fpdfsdk/javascript/JS_Object.cpp
@@ -107,7 +107,7 @@ CJS_Timer::CJS_Timer(CJS_EmbedObj* pObj,
m_swJScript(script),
m_pRuntime(pRuntime),
m_pApp(pApp) {
- IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
+ CFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
m_nTimerID = pHandler->SetTimer(dwElapse, TimerProc);
(*GetGlobalTimerMap())[m_nTimerID] = this;
m_pRuntime->AddObserver(this);
@@ -123,7 +123,7 @@ CJS_Timer::~CJS_Timer() {
void CJS_Timer::KillJSTimer() {
if (m_nTimerID) {
if (m_bValid) {
- IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
+ CFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
pHandler->KillTimer(m_nTimerID);
}
GetGlobalTimerMap()->erase(m_nTimerID);
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp
index 4a9adfb207..dffc62a02f 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp
@@ -129,67 +129,9 @@ FX_BOOL CPWL_Edit::CanCopy() const {
FX_BOOL CPWL_Edit::CanCut() const {
return CanCopy() && !IsReadOnly();
}
-
-FX_BOOL CPWL_Edit::CanPaste() const {
- if (IsReadOnly())
- return FALSE;
-
- CFX_WideString swClipboard;
- if (IFX_SystemHandler* pSH = GetSystemHandler())
- swClipboard = pSH->GetClipboardText(GetAttachedHWnd());
-
- return !swClipboard.IsEmpty();
-}
-
-void CPWL_Edit::CopyText() {
- if (!CanCopy())
- return;
-
- CFX_WideString str = m_pEdit->GetSelText();
-
- if (IFX_SystemHandler* pSH = GetSystemHandler())
- pSH->SetClipboardText(GetAttachedHWnd(), str);
-}
-
-void CPWL_Edit::PasteText() {
- if (!CanPaste())
- return;
-
- CFX_WideString swClipboard;
- if (IFX_SystemHandler* pSH = GetSystemHandler())
- swClipboard = pSH->GetClipboardText(GetAttachedHWnd());
-
- if (m_pFillerNotify) {
- FX_BOOL bRC = TRUE;
- FX_BOOL bExit = FALSE;
- CFX_WideString strChangeEx;
- int nSelStart = 0;
- int nSelEnd = 0;
- GetSel(nSelStart, nSelEnd);
- m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swClipboard,
- strChangeEx, nSelStart, nSelEnd, TRUE,
- bRC, bExit, 0);
- if (!bRC)
- return;
- if (bExit)
- return;
- }
-
- if (swClipboard.GetLength() > 0) {
- Clear();
- InsertText(swClipboard.c_str());
- }
-}
-
void CPWL_Edit::CutText() {
if (!CanCut())
return;
-
- CFX_WideString str = m_pEdit->GetSelText();
-
- if (IFX_SystemHandler* pSH = GetSystemHandler())
- pSH->SetClipboardText(GetAttachedHWnd(), str);
-
m_pEdit->Clear();
}
@@ -442,7 +384,7 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
rcClip = GetClientRect();
pRange = &wrRange;
}
- IFX_SystemHandler* pSysHandler = GetSystemHandler();
+ CFX_SystemHandler* pSysHandler = GetSystemHandler();
IFX_Edit::DrawEdit(
pDevice, pUser2Device, m_pEdit,
CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
@@ -477,15 +419,6 @@ FX_BOOL CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& point,
return TRUE;
}
-#define WM_PWLEDIT_UNDO 0x01
-#define WM_PWLEDIT_REDO 0x02
-#define WM_PWLEDIT_CUT 0x03
-#define WM_PWLEDIT_COPY 0x04
-#define WM_PWLEDIT_PASTE 0x05
-#define WM_PWLEDIT_DELETE 0x06
-#define WM_PWLEDIT_SELECTALL 0x07
-#define WM_PWLEDIT_SUGGEST 0x08
-
FX_BOOL CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) {
if (m_bMouseDown)
return FALSE;
@@ -495,145 +428,13 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) {
if (!HasFlag(PES_TEXTOVERFLOW) && !ClientHitTest(point))
return TRUE;
- IFX_SystemHandler* pSH = GetSystemHandler();
+ CFX_SystemHandler* pSH = GetSystemHandler();
if (!pSH)
return FALSE;
SetFocus();
- CPVT_WordRange wrLatin = GetLatinWordsRange(point);
- CFX_WideString swLatin = m_pEdit->GetRangeText(wrLatin);
-
- FX_HMENU hPopup = pSH->CreatePopupMenu();
- if (!hPopup)
- return FALSE;
-
- std::vector<CFX_ByteString> sSuggestWords;
- CFX_FloatPoint ptPopup = point;
-
- IPWL_Provider* pProvider = GetProvider();
-
- if (HasFlag(PES_UNDO)) {
- pSH->AppendMenuItem(
- hPopup, WM_PWLEDIT_UNDO,
- pProvider ? pProvider->LoadPopupMenuString(0) : L"&Undo");
- pSH->AppendMenuItem(
- hPopup, WM_PWLEDIT_REDO,
- pProvider ? pProvider->LoadPopupMenuString(1) : L"&Redo");
- pSH->AppendMenuItem(hPopup, 0, L"");
-
- if (!m_pEdit->CanUndo())
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_UNDO, FALSE);
- if (!m_pEdit->CanRedo())
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_REDO, FALSE);
- }
-
- pSH->AppendMenuItem(hPopup, WM_PWLEDIT_CUT,
- pProvider ? pProvider->LoadPopupMenuString(2) : L"Cu&t");
- pSH->AppendMenuItem(hPopup, WM_PWLEDIT_COPY,
- pProvider ? pProvider->LoadPopupMenuString(3) : L"&Copy");
- pSH->AppendMenuItem(
- hPopup, WM_PWLEDIT_PASTE,
- pProvider ? pProvider->LoadPopupMenuString(4) : L"&Paste");
- pSH->AppendMenuItem(
- hPopup, WM_PWLEDIT_DELETE,
- pProvider ? pProvider->LoadPopupMenuString(5) : L"&Delete");
-
- CFX_WideString swText = pSH->GetClipboardText(GetAttachedHWnd());
- if (swText.IsEmpty())
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_PASTE, FALSE);
-
- if (!m_pEdit->IsSelected()) {
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, FALSE);
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_COPY, FALSE);
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_DELETE, FALSE);
- }
-
- if (IsReadOnly()) {
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, FALSE);
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_DELETE, FALSE);
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_PASTE, FALSE);
- }
-
- if (HasFlag(PES_PASSWORD)) {
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, FALSE);
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_COPY, FALSE);
- }
-
- if (HasFlag(PES_NOREAD)) {
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, FALSE);
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_COPY, FALSE);
- }
-
- pSH->AppendMenuItem(hPopup, 0, L"");
- pSH->AppendMenuItem(
- hPopup, WM_PWLEDIT_SELECTALL,
- pProvider ? pProvider->LoadPopupMenuString(6) : L"&Select All");
-
- if (m_pEdit->GetTotalWords() == 0) {
- pSH->EnableMenuItem(hPopup, WM_PWLEDIT_SELECTALL, FALSE);
- }
-
- int32_t x, y;
- PWLtoWnd(ptPopup, x, y);
- pSH->ClientToScreen(GetAttachedHWnd(), x, y);
- pSH->SetCursor(FXCT_ARROW);
- int32_t nCmd = pSH->TrackPopupMenu(hPopup, x, y, GetAttachedHWnd());
-
- switch (nCmd) {
- case WM_PWLEDIT_UNDO:
- Undo();
- break;
- case WM_PWLEDIT_REDO:
- Redo();
- break;
- case WM_PWLEDIT_CUT:
- CutText();
- break;
- case WM_PWLEDIT_COPY:
- CopyText();
- break;
- case WM_PWLEDIT_PASTE:
- PasteText();
- break;
- case WM_PWLEDIT_DELETE:
- Clear();
- break;
- case WM_PWLEDIT_SELECTALL:
- SelectAll();
- break;
- case WM_PWLEDIT_SUGGEST + 0:
- SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),
- m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
- ReplaceSel(sSuggestWords[0].UTF8Decode().c_str());
- break;
- case WM_PWLEDIT_SUGGEST + 1:
- SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),
- m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
- ReplaceSel(sSuggestWords[1].UTF8Decode().c_str());
- break;
- case WM_PWLEDIT_SUGGEST + 2:
- SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),
- m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
- ReplaceSel(sSuggestWords[2].UTF8Decode().c_str());
- break;
- case WM_PWLEDIT_SUGGEST + 3:
- SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),
- m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
- ReplaceSel(sSuggestWords[3].UTF8Decode().c_str());
- break;
- case WM_PWLEDIT_SUGGEST + 4:
- SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),
- m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
- ReplaceSel(sSuggestWords[4].UTF8Decode().c_str());
- break;
- default:
- break;
- }
-
- pSH->DestroyMenu(hPopup);
-
- return TRUE;
+ return FALSE;
}
void CPWL_Edit::OnSetFocus() {
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.h b/fpdfsdk/pdfwindow/PWL_Edit.h
index 29747dd2ae..8a9d371b28 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.h
+++ b/fpdfsdk/pdfwindow/PWL_Edit.h
@@ -83,13 +83,10 @@ class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify {
FX_BOOL CanClear() const;
FX_BOOL CanCopy() const;
FX_BOOL CanCut() const;
- FX_BOOL CanPaste() const;
- virtual void CopyText();
- virtual void PasteText();
- virtual void CutText();
+ void CutText();
- virtual void SetText(const FX_WCHAR* csText);
+ void SetText(const FX_WCHAR* csText);
void ReplaceSel(const FX_WCHAR* csText);
CFX_ByteString GetTextAppearanceStream(const CFX_FloatPoint& ptOffset) const;
diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
index af7e5837a3..a6596582de 100644
--- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
+++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
@@ -60,7 +60,7 @@ FX_BOOL CPWL_EditCtrl::IsWndHorV() {
void CPWL_EditCtrl::SetCursor() {
if (IsValid()) {
- if (IFX_SystemHandler* pSH = GetSystemHandler()) {
+ if (CFX_SystemHandler* pSH = GetSystemHandler()) {
if (IsWndHorV())
pSH->SetCursor(FXCT_VBEAM);
else
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
index 62bb4079f2..f73468bf2b 100644
--- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp
+++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
@@ -34,7 +34,7 @@ const char* const g_sDEStandardFontName[] = {"Courier",
} // namespace
-CPWL_FontMap::CPWL_FontMap(IFX_SystemHandler* pSystemHandler)
+CPWL_FontMap::CPWL_FontMap(CFX_SystemHandler* pSystemHandler)
: m_pPDFDoc(NULL), m_pSystemHandler(pSystemHandler) {
ASSERT(m_pSystemHandler);
}
@@ -46,7 +46,7 @@ CPWL_FontMap::~CPWL_FontMap() {
Empty();
}
-void CPWL_FontMap::SetSystemHandler(IFX_SystemHandler* pSystemHandler) {
+void CPWL_FontMap::SetSystemHandler(CFX_SystemHandler* pSystemHandler) {
m_pSystemHandler = pSystemHandler;
}
@@ -284,7 +284,7 @@ CFX_ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) {
if (m_pSystemHandler->FindNativeTrueTypeFont(nCharset, sFontName))
return sFontName;
- sFontName = m_pSystemHandler->GetNativeTrueTypeFont(nCharset);
+ sFontName = "";
}
return sFontName;
}
@@ -491,7 +491,7 @@ int32_t CPWL_FontMap::CharSetFromUnicode(uint16_t word, int32_t nOldCharset) {
return ANSI_CHARSET;
}
-CPWL_DocFontMap::CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler,
+CPWL_DocFontMap::CPWL_DocFontMap(CFX_SystemHandler* pSystemHandler,
CPDF_Document* pAttachedDoc)
: CPWL_FontMap(pSystemHandler), m_pAttachedDoc(pAttachedDoc) {}
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.h b/fpdfsdk/pdfwindow/PWL_FontMap.h
index 7533b1e787..2c40c92a97 100644
--- a/fpdfsdk/pdfwindow/PWL_FontMap.h
+++ b/fpdfsdk/pdfwindow/PWL_FontMap.h
@@ -12,7 +12,7 @@
#include "public/fpdf_sysfontinfo.h"
class CPDF_Document;
-class IFX_SystemHandler;
+class CFX_SystemHandler;
struct CPWL_FontMap_Data {
CPDF_Font* pFont;
@@ -51,7 +51,7 @@ struct CPWL_FontMap_Native {
class CPWL_FontMap : public IPVT_FontMap {
public:
- CPWL_FontMap(IFX_SystemHandler* pSystemHandler);
+ CPWL_FontMap(CFX_SystemHandler* pSystemHandler);
~CPWL_FontMap() override;
// IPVT_FontMap
@@ -63,7 +63,7 @@ class CPWL_FontMap : public IPVT_FontMap {
int32_t CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) override;
int32_t CharSetFromUnicode(uint16_t word, int32_t nOldCharset) override;
- void SetSystemHandler(IFX_SystemHandler* pSystemHandler);
+ void SetSystemHandler(CFX_SystemHandler* pSystemHandler);
int32_t GetFontMapCount() const;
const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const;
static int32_t GetNativeCharset();
@@ -119,12 +119,12 @@ class CPWL_FontMap : public IPVT_FontMap {
private:
CPDF_Document* m_pPDFDoc;
- IFX_SystemHandler* m_pSystemHandler;
+ CFX_SystemHandler* m_pSystemHandler;
};
class CPWL_DocFontMap : public CPWL_FontMap {
public:
- CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler,
+ CPWL_DocFontMap(CFX_SystemHandler* pSystemHandler,
CPDF_Document* pAttachedDoc);
~CPWL_DocFontMap() override;
diff --git a/fpdfsdk/pdfwindow/PWL_Label.cpp b/fpdfsdk/pdfwindow/PWL_Label.cpp
index 1375678cfb..9cb9791444 100644
--- a/fpdfsdk/pdfwindow/PWL_Label.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Label.cpp
@@ -96,7 +96,7 @@ void CPWL_Label::DrawThisAppearance(CFX_RenderDevice* pDevice,
rcClip = GetClientRect();
pRange = &wrRange;
}
- IFX_SystemHandler* pSysHandler = GetSystemHandler();
+ CFX_SystemHandler* pSysHandler = GetSystemHandler();
IFX_Edit::DrawEdit(
pDevice, pUser2Device, m_pEdit,
CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
index d32e7c937c..86f3b8f24a 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
@@ -181,7 +181,7 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
}
if (m_pList->IsItemSelected(i)) {
- IFX_SystemHandler* pSysHandler = GetSystemHandler();
+ CFX_SystemHandler* pSysHandler = GetSystemHandler();
if (pSysHandler && pSysHandler->IsSelectionImplemented()) {
IFX_Edit::DrawEdit(
pDevice, pUser2Device, m_pList->GetItemEdit(i),
@@ -197,7 +197,7 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
ptOffset, NULL, pSysHandler, m_pFormFiller);
}
} else {
- IFX_SystemHandler* pSysHandler = GetSystemHandler();
+ CFX_SystemHandler* pSysHandler = GetSystemHandler();
IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
CPWL_Utils::PWLColorToFXColor(GetTextColor()),
CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()),
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
index 538651797e..8883ceb574 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
@@ -17,7 +17,7 @@ static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap() {
}
CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached,
- IFX_SystemHandler* pSystemHandler)
+ CFX_SystemHandler* pSystemHandler)
: m_nTimerID(0), m_pAttached(pAttached), m_pSystemHandler(pSystemHandler) {
ASSERT(m_pAttached);
ASSERT(m_pSystemHandler);
@@ -398,7 +398,7 @@ void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) {
rcWin.right += PWL_INVALIDATE_INFLATE;
rcWin.bottom += PWL_INVALIDATE_INFLATE;
- if (IFX_SystemHandler* pSH = GetSystemHandler()) {
+ if (CFX_SystemHandler* pSH = GetSystemHandler()) {
if (FX_HWND hWnd = GetAttachedHWnd()) {
pSH->InvalidateRect(hWnd, rcWin);
}
@@ -744,7 +744,7 @@ void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM& cp) {}
void CPWL_Wnd::SetCursor() {
if (IsValid()) {
- if (IFX_SystemHandler* pSH = GetSystemHandler()) {
+ if (CFX_SystemHandler* pSH = GetSystemHandler()) {
int32_t nCursorType = GetCreationParam().eCursorType;
pSH->SetCursor(nCursorType);
}
@@ -803,7 +803,7 @@ void CPWL_Wnd::SetFontSize(FX_FLOAT fFontSize) {
m_sPrivateParam.fFontSize = fFontSize;
}
-IFX_SystemHandler* CPWL_Wnd::GetSystemHandler() const {
+CFX_SystemHandler* CPWL_Wnd::GetSystemHandler() const {
return m_sPrivateParam.pSystemHandler;
}
@@ -1007,7 +1007,7 @@ void CPWL_Wnd::OnEnabled() {}
void CPWL_Wnd::OnDisabled() {}
FX_BOOL CPWL_Wnd::IsCTRLpressed(uint32_t nFlag) const {
- if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) {
+ if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) {
return pSystemHandler->IsCTRLKeyDown(nFlag);
}
@@ -1015,7 +1015,7 @@ FX_BOOL CPWL_Wnd::IsCTRLpressed(uint32_t nFlag) const {
}
FX_BOOL CPWL_Wnd::IsSHIFTpressed(uint32_t nFlag) const {
- if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) {
+ if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) {
return pSystemHandler->IsSHIFTKeyDown(nFlag);
}
@@ -1023,7 +1023,7 @@ FX_BOOL CPWL_Wnd::IsSHIFTpressed(uint32_t nFlag) const {
}
FX_BOOL CPWL_Wnd::IsALTpressed(uint32_t nFlag) const {
- if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) {
+ if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) {
return pSystemHandler->IsALTKeyDown(nFlag);
}
@@ -1031,7 +1031,7 @@ FX_BOOL CPWL_Wnd::IsALTpressed(uint32_t nFlag) const {
}
FX_BOOL CPWL_Wnd::IsINSERTpressed(uint32_t nFlag) const {
- if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) {
+ if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) {
return pSystemHandler->IsINSERTKeyDown(nFlag);
}
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h
index b9448c4362..dec3f9f252 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.h
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.h
@@ -11,15 +11,15 @@
#include "core/fpdfdoc/include/fpdf_doc.h"
#include "core/fxcrt/include/fx_basic.h"
-#include "fpdfsdk/include/fx_systemhandler.h"
+#include "fpdfsdk/cfx_systemhandler.h"
class CPWL_MsgControl;
class CPWL_ScrollBar;
class CPWL_Timer;
class CPWL_TimerHandler;
class CPWL_Wnd;
+class CFX_SystemHandler;
class IPVT_FontMap;
-class IFX_SystemHandler;
class IPWL_Provider;
// window styles
@@ -218,7 +218,7 @@ struct PWL_CREATEPARAM {
mtChild(1, 0, 0, 1, 0, 0) {}
CFX_FloatRect rcRectWnd; // required
- IFX_SystemHandler* pSystemHandler; // required
+ CFX_SystemHandler* pSystemHandler; // required
IPVT_FontMap* pFontMap; // required for text window
IPWL_Provider* pProvider; // required for self coordinate
IPWL_FocusHandler* pFocusHandler; // optional
@@ -242,7 +242,7 @@ struct PWL_CREATEPARAM {
class CPWL_Timer {
public:
- CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler);
+ CPWL_Timer(CPWL_TimerHandler* pAttached, CFX_SystemHandler* pSystemHandler);
virtual ~CPWL_Timer();
int32_t SetPWLTimer(int32_t nElapse);
@@ -252,7 +252,7 @@ class CPWL_Timer {
private:
int32_t m_nTimerID;
CPWL_TimerHandler* m_pAttached;
- IFX_SystemHandler* m_pSystemHandler;
+ CFX_SystemHandler* m_pSystemHandler;
};
class CPWL_TimerHandler {
@@ -263,7 +263,7 @@ class CPWL_TimerHandler {
void BeginTimer(int32_t nElapse);
void EndTimer();
virtual void TimerProc();
- virtual IFX_SystemHandler* GetSystemHandler() const = 0;
+ virtual CFX_SystemHandler* GetSystemHandler() const = 0;
private:
CPWL_Timer* m_pTimer;
@@ -382,7 +382,7 @@ class CPWL_Wnd : public CPWL_TimerHandler {
protected:
// CPWL_TimerHandler
- IFX_SystemHandler* GetSystemHandler() const override;
+ CFX_SystemHandler* GetSystemHandler() const override;
virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
virtual void RePosChildWnd();
diff --git a/pdfium.gyp b/pdfium.gyp
index cefdcaa61f..10bba9d488 100644
--- a/pdfium.gyp
+++ b/pdfium.gyp
@@ -124,6 +124,8 @@
'pdfwindow',
],
'sources': [
+ 'fpdfsdk/cfx_systemhandler.cpp',
+ 'fpdfsdk/cfx_systemhandler.h',
'fpdfsdk/include/fsdk_actionhandler.h',
'fpdfsdk/include/fsdk_annothandler.h',
'fpdfsdk/include/fsdk_baseannot.h',
diff --git a/xfa/fwl/core/fwl_sdadapterimp.cpp b/xfa/fwl/core/fwl_sdadapterimp.cpp
index 9732414ea1..76cbad6b86 100644
--- a/xfa/fwl/core/fwl_sdadapterimp.cpp
+++ b/xfa/fwl/core/fwl_sdadapterimp.cpp
@@ -127,10 +127,6 @@ FWL_ERR CFWL_SDAdapterWidgetMgr::UpdateMenu(IFWL_Menu* pMenu,
int32_t iType) {
return FWL_ERR_Succeeded;
}
-int32_t CFWL_SDAdapterWidgetMgr::TrackPopupMenu(IFWL_Menu* pMenu,
- IFWL_MenuDP* pMenuData) {
- return 0;
-}
FWL_ERR CFWL_SDAdapterWidgetMgr::SetMessageHook(IFWL_AdapterMessageHook* hook) {
return FWL_ERR_Succeeded;
}
diff --git a/xfa/fwl/core/fwl_sdadapterimp.h b/xfa/fwl/core/fwl_sdadapterimp.h
index d91c88213e..3bd176afe8 100644
--- a/xfa/fwl/core/fwl_sdadapterimp.h
+++ b/xfa/fwl/core/fwl_sdadapterimp.h
@@ -61,7 +61,6 @@ class CFWL_SDAdapterWidgetMgr : public IFWL_AdapterWidgetMgr {
virtual FWL_ERR UpdateMenu(IFWL_Menu* pMenu,
const void* hItem,
int32_t iType);
- virtual int32_t TrackPopupMenu(IFWL_Menu* pMenu, IFWL_MenuDP* pMenuData);
virtual FWL_ERR SetMessageHook(IFWL_AdapterMessageHook* hook);
virtual FWL_ERR GetSystemBorder(FX_FLOAT& l,
FX_FLOAT& t,
diff --git a/xfa/fwl/core/ifwl_adapterwidgetmgr.h b/xfa/fwl/core/ifwl_adapterwidgetmgr.h
index 8744c6b078..a737e81c3c 100644
--- a/xfa/fwl/core/ifwl_adapterwidgetmgr.h
+++ b/xfa/fwl/core/ifwl_adapterwidgetmgr.h
@@ -64,7 +64,6 @@ class IFWL_AdapterWidgetMgr {
virtual FWL_ERR UpdateMenu(IFWL_Menu* pMenu,
const void* hItem,
int32_t iType) = 0;
- virtual int32_t TrackPopupMenu(IFWL_Menu* pMenu, IFWL_MenuDP* pMenuData) = 0;
virtual FWL_ERR SetMessageHook(IFWL_AdapterMessageHook* hook) = 0;
virtual FWL_ERR GetSystemBorder(FX_FLOAT& l,
FX_FLOAT& t,