summaryrefslogtreecommitdiff
path: root/fpdfsdk/pwl
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pwl')
-rw-r--r--fpdfsdk/pwl/cpwl_edit.cpp2
-rw-r--r--fpdfsdk/pwl/cpwl_edit.h12
-rw-r--r--fpdfsdk/pwl/cpwl_wnd.cpp18
-rw-r--r--fpdfsdk/pwl/cpwl_wnd.h88
4 files changed, 64 insertions, 56 deletions
diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp
index 4558e432ac..8fbafd0ca0 100644
--- a/fpdfsdk/pwl/cpwl_edit.cpp
+++ b/fpdfsdk/pwl/cpwl_edit.cpp
@@ -333,7 +333,7 @@ bool CPWL_Edit::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) {
void CPWL_Edit::OnSetFocus() {
SetEditCaret(true);
if (!IsReadOnly()) {
- if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler())
+ if (CPWL_Wnd::FocusHandlerIface* pFocusHandler = GetFocusHandler())
pFocusHandler->OnSetFocus(this);
}
m_bFocus = true;
diff --git a/fpdfsdk/pwl/cpwl_edit.h b/fpdfsdk/pwl/cpwl_edit.h
index ef12e9884a..3e8de04b47 100644
--- a/fpdfsdk/pwl/cpwl_edit.h
+++ b/fpdfsdk/pwl/cpwl_edit.h
@@ -13,18 +13,20 @@
#include "core/fxcrt/cfx_unowned_ptr.h"
#include "fpdfsdk/pwl/cpwl_edit_ctrl.h"
+#define PWL_CLASSNAME_EDIT "CPWL_Edit"
+
class IPWL_Filler_Notify {
public:
virtual ~IPWL_Filler_Notify() {}
// Must write to |bBottom| and |fPopupRet|.
- virtual void QueryWherePopup(void* pPrivateData,
+ virtual void QueryWherePopup(CPWL_Wnd::PrivateData* pAttached,
float fPopupMin,
float fPopupMax,
bool* bBottom,
float* fPopupRet) = 0;
virtual std::pair<bool, bool> OnBeforeKeyStroke(
- void* pPrivateData,
+ CPWL_Wnd::PrivateData* pAttached,
CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
int nSelStart,
@@ -32,8 +34,10 @@ class IPWL_Filler_Notify {
bool bKeyDown,
uint32_t nFlag) = 0;
#ifdef PDF_ENABLE_XFA
- virtual bool OnPopupPreOpen(void* pPrivateData, uint32_t nFlag) = 0;
- virtual bool OnPopupPostOpen(void* pPrivateData, uint32_t nFlag) = 0;
+ virtual bool OnPopupPreOpen(CPWL_Wnd::PrivateData* pAttached,
+ uint32_t nFlag) = 0;
+ virtual bool OnPopupPostOpen(CPWL_Wnd::PrivateData* pAttached,
+ uint32_t nFlag) = 0;
#endif // PDF_ENABLE_XFA
};
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index e259d1f9ef..401fed3f9c 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -44,6 +44,8 @@ CPWL_Wnd::CreateParams::CreateParams()
CPWL_Wnd::CreateParams::CreateParams(const CreateParams& other) = default;
+CPWL_Wnd::CreateParams::~CreateParams() = default;
+
class CPWL_MsgControl : public CFX_Observable<CPWL_MsgControl> {
friend class CPWL_Wnd;
@@ -181,12 +183,12 @@ void CPWL_Wnd::OnCreated() {}
void CPWL_Wnd::OnDestroy() {}
-void CPWL_Wnd::InvalidateFocusHandler(IPWL_FocusHandler* handler) {
+void CPWL_Wnd::InvalidateFocusHandler(FocusHandlerIface* handler) {
if (m_CreationParams.pFocusHandler == handler)
m_CreationParams.pFocusHandler = nullptr;
}
-void CPWL_Wnd::InvalidateProvider(IPWL_Provider* provider) {
+void CPWL_Wnd::InvalidateProvider(ProviderIface* provider) {
if (m_CreationParams.pProvider.Get() == provider)
m_CreationParams.pProvider.Reset();
}
@@ -482,8 +484,8 @@ const CPWL_Dash& CPWL_Wnd::GetBorderDash() const {
return m_CreationParams.sDash;
}
-void* CPWL_Wnd::GetAttachedData() const {
- return m_CreationParams.pAttachedData;
+CPWL_Wnd::PrivateData* CPWL_Wnd::GetAttachedData() const {
+ return m_CreationParams.pAttachedData.Get();
}
CPWL_ScrollBar* CPWL_Wnd::GetVScrollBar() const {
@@ -670,11 +672,11 @@ CFX_SystemHandler* CPWL_Wnd::GetSystemHandler() const {
return m_CreationParams.pSystemHandler;
}
-IPWL_FocusHandler* CPWL_Wnd::GetFocusHandler() const {
- return m_CreationParams.pFocusHandler;
+CPWL_Wnd::FocusHandlerIface* CPWL_Wnd::GetFocusHandler() const {
+ return m_CreationParams.pFocusHandler.Get();
}
-IPWL_Provider* CPWL_Wnd::GetProvider() const {
+CPWL_Wnd::ProviderIface* CPWL_Wnd::GetProvider() const {
return m_CreationParams.pProvider.Get();
}
@@ -718,7 +720,7 @@ void CPWL_Wnd::SetTransparency(int32_t nTransparency) {
CFX_Matrix CPWL_Wnd::GetWindowMatrix() const {
CFX_Matrix mt = GetChildToRoot();
- if (IPWL_Provider* pProvider = GetProvider())
+ if (ProviderIface* pProvider = GetProvider())
mt.Concat(pProvider->GetWindowMatrix(GetAttachedData()));
return mt;
}
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index 4074e9369f..2fd5077a86 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -22,10 +22,8 @@
class CPWL_Edit;
class CPWL_MsgControl;
class CPWL_ScrollBar;
-class CPWL_Wnd;
class CFX_SystemHandler;
class IPVT_FontMap;
-class IPWL_Provider;
struct PWL_SCROLL_INFO;
// window styles
@@ -65,8 +63,6 @@ struct PWL_SCROLL_INFO;
// combobox styles
#define PCBS_ALLOWCUSTOMTEXT 0x0001L
-#define PWL_CLASSNAME_EDIT "CPWL_Edit"
-
struct CPWL_Dash {
CPWL_Dash() : nDash(0), nGap(0), nPhase(0) {}
CPWL_Dash(int32_t dash, int32_t gap, int32_t phase)
@@ -104,47 +100,53 @@ inline bool operator!=(const CFX_Color& c1, const CFX_Color& c2) {
#define PWL_DEFAULT_BLACKCOLOR CFX_Color(COLORTYPE_GRAY, 0)
#define PWL_DEFAULT_WHITECOLOR CFX_Color(COLORTYPE_GRAY, 1)
-class IPWL_Provider : public CFX_Observable<IPWL_Provider> {
+class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
public:
- virtual ~IPWL_Provider() {}
+ class PrivateData {
+ protected:
+ ~PrivateData() {}
+ };
- // get a matrix which map user space to CWnd client space
- virtual CFX_Matrix GetWindowMatrix(void* pAttachedData) = 0;
-};
+ class ProviderIface : public CFX_Observable<ProviderIface> {
+ public:
+ virtual ~ProviderIface() {}
-class IPWL_FocusHandler {
- public:
- virtual ~IPWL_FocusHandler() {}
- virtual void OnSetFocus(CPWL_Edit* pEdit) = 0;
-};
+ // get a matrix which map user space to CWnd client space
+ virtual CFX_Matrix GetWindowMatrix(PrivateData* pAttached) = 0;
+ };
-class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
- public:
- struct CreateParams {
+ class FocusHandlerIface {
+ public:
+ virtual ~FocusHandlerIface() {}
+ virtual void OnSetFocus(CPWL_Edit* pEdit) = 0;
+ };
+
+ class CreateParams {
public:
CreateParams();
CreateParams(const CreateParams& other);
-
- CFX_FloatRect rcRectWnd; // required
- CFX_SystemHandler* pSystemHandler; // required
- IPVT_FontMap* pFontMap; // required
- IPWL_Provider::ObservedPtr pProvider; // required
- IPWL_FocusHandler* pFocusHandler; // optional
- uint32_t dwFlags; // optional
- CFX_Color sBackgroundColor; // optional
- CPDFSDK_Widget::ObservedPtr pAttachedWidget; // required
- BorderStyle nBorderStyle; // optional
- int32_t dwBorderWidth; // optional
- CFX_Color sBorderColor; // optional
- CFX_Color sTextColor; // optional
- int32_t nTransparency; // optional
- float fFontSize; // optional
- CPWL_Dash sDash; // optional
- void* pAttachedData; // optional
- CPWL_Wnd* pParentWnd; // ignore
- CPWL_MsgControl* pMsgControl; // ignore
- int32_t eCursorType; // ignore
- CFX_Matrix mtChild; // ignore
+ ~CreateParams();
+
+ CFX_FloatRect rcRectWnd; // required
+ CFX_SystemHandler* pSystemHandler; // required
+ IPVT_FontMap* pFontMap; // required
+ ProviderIface::ObservedPtr pProvider; // required
+ CFX_UnownedPtr<FocusHandlerIface> pFocusHandler; // optional
+ uint32_t dwFlags; // optional
+ CFX_Color sBackgroundColor; // optional
+ CPDFSDK_Widget::ObservedPtr pAttachedWidget; // required
+ BorderStyle nBorderStyle; // optional
+ int32_t dwBorderWidth; // optional
+ CFX_Color sBorderColor; // optional
+ CFX_Color sTextColor; // optional
+ int32_t nTransparency; // optional
+ float fFontSize; // optional
+ CPWL_Dash sDash; // optional
+ CFX_UnownedPtr<PrivateData> pAttachedData; // optional
+ CPWL_Wnd* pParentWnd; // ignore
+ CPWL_MsgControl* pMsgControl; // ignore
+ int32_t eCursorType; // ignore
+ CFX_Matrix mtChild; // ignore
};
CPWL_Wnd();
@@ -182,8 +184,8 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
virtual CFX_FloatRect GetFocusRect() const;
virtual CFX_FloatRect GetClientRect() const;
- void InvalidateFocusHandler(IPWL_FocusHandler* handler);
- void InvalidateProvider(IPWL_Provider* provider);
+ void InvalidateFocusHandler(FocusHandlerIface* handler);
+ void InvalidateProvider(ProviderIface* provider);
void Create(const CreateParams& cp);
void Destroy();
void Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh);
@@ -220,7 +222,7 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
const CFX_FloatRect& GetClipRect() const;
CPWL_Wnd* GetParentWindow() const;
- void* GetAttachedData() const;
+ PrivateData* GetAttachedData() const;
bool WndHitTest(const CFX_PointF& point) const;
bool ClientHitTest(const CFX_PointF& point) const;
@@ -234,8 +236,8 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
CPWL_ScrollBar* GetVScrollBar() const;
IPVT_FontMap* GetFontMap() const;
- IPWL_Provider* GetProvider() const;
- IPWL_FocusHandler* GetFocusHandler() const;
+ ProviderIface* GetProvider() const;
+ FocusHandlerIface* GetFocusHandler() const;
int32_t GetTransparency();
void SetTransparency(int32_t nTransparency);