diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-10-17 09:08:26 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-10-17 14:30:31 +0000 |
commit | 6dc4fb899acfee6261a44cde8015b5c8f3eb75a3 (patch) | |
tree | 712f5b8e4e943ec6b8a36c979444a48189a7f8a0 | |
parent | 38ce5278ad391b66716425788b45a0bfa2331412 (diff) | |
download | pdfium-6dc4fb899acfee6261a44cde8015b5c8f3eb75a3.tar.xz |
Remove friends from PWL classes
This CL removes the friend entries from the various pwl/ classes.
Change-Id: Ib93a2bedcde521eb92e53580b5d7cd9bca08902f
Reviewed-on: https://pdfium-review.googlesource.com/16150
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | fpdfsdk/pwl/cpwl_edit_impl.h | 42 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_wnd.cpp | 28 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_wnd.h | 8 |
3 files changed, 24 insertions, 54 deletions
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.h b/fpdfsdk/pwl/cpwl_edit_impl.h index 11edae6180..387f6e700d 100644 --- a/fpdfsdk/pwl/cpwl_edit_impl.h +++ b/fpdfsdk/pwl/cpwl_edit_impl.h @@ -362,17 +362,22 @@ class CPWL_EditImpl { uint16_t Word, uint16_t SubWord); - private: - friend class CPWL_EditImpl_Iterator; - friend class CFXEU_InsertWord; - friend class CFXEU_InsertReturn; - friend class CFXEU_Backspace; - friend class CFXEU_Delete; - friend class CFXEU_Clear; - friend class CFXEU_InsertText; - void SetSelection(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); + bool Delete(bool bAddUndo, bool bPaint); + bool Clear(bool bAddUndo, bool bPaint); + bool InsertText(const WideString& sText, + int32_t charset, + bool bAddUndo, + bool bPaint); + bool InsertWord(uint16_t word, int32_t charset, bool bAddUndo, bool bPaint); + bool InsertReturn(bool bAddUndo, bool bPaint); + bool Backspace(bool bAddUndo, bool bPaint); + void SetCaret(const CPVT_WordPlace& place); + + CFX_PointF VTToEdit(const CFX_PointF& point) const; + + private: void RearrangeAll(); void RearrangePart(const CPVT_WordRange& range); void ScrollToCaret(); @@ -382,35 +387,20 @@ class CPWL_EditImpl { void SetScrollLimit(); void SetContentChanged(); - bool InsertWord(uint16_t word, - int32_t charset, - bool bAddUndo, - bool bPaint); - bool InsertReturn(bool bAddUndo, bool bPaint); - bool Backspace(bool bAddUndo, bool bPaint); - bool Delete(bool bAddUndo, bool bPaint); - bool Clear(bool bAddUndo, bool bPaint); - bool InsertText(const WideString& sText, - int32_t charset, - bool bAddUndo, - bool bPaint); void PaintInsertText(const CPVT_WordPlace& wpOld, const CPVT_WordPlace& wpNew); - inline CFX_PointF VTToEdit(const CFX_PointF& point) const; - inline CFX_PointF EditToVT(const CFX_PointF& point) const; - inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const; + CFX_PointF EditToVT(const CFX_PointF& point) const; + CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const; void Refresh(); void RefreshPushLineRects(const CPVT_WordRange& wr); - void SetCaret(const CPVT_WordPlace& place); void SetCaretInfo(); void SetCaretOrigin(); void AddEditUndoItem(std::unique_ptr<IFX_Edit_UndoItem> pEditUndoItem); - private: std::unique_ptr<CPDF_VariableText> m_pVT; UnownedPtr<CPWL_EditCtrl> m_pNotify; UnownedPtr<CPWL_Edit> m_pOperationNotify; diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp index ec605a3844..368db74ec4 100644 --- a/fpdfsdk/pwl/cpwl_wnd.cpp +++ b/fpdfsdk/pwl/cpwl_wnd.cpp @@ -47,31 +47,14 @@ CPWL_Wnd::CreateParams::CreateParams(const CreateParams& other) = default; CPWL_Wnd::CreateParams::~CreateParams() = default; class CPWL_MsgControl : public Observable<CPWL_MsgControl> { - friend class CPWL_Wnd; - public: - explicit CPWL_MsgControl(CPWL_Wnd* pWnd) { - m_pCreatedWnd = pWnd; - Default(); - } - - ~CPWL_MsgControl() { Default(); } - - void Default() { - m_aMousePath.clear(); - m_aKeyboardPath.clear(); - m_pMainMouseWnd = nullptr; - m_pMainKeyboardWnd = nullptr; - } + explicit CPWL_MsgControl(CPWL_Wnd* pWnd) : m_pCreatedWnd(pWnd) {} + ~CPWL_MsgControl() {} bool IsWndCreated(const CPWL_Wnd* pWnd) const { return m_pCreatedWnd == pWnd; } - bool IsMainCaptureMouse(const CPWL_Wnd* pWnd) const { - return pWnd == m_pMainMouseWnd; - } - bool IsWndCaptureMouse(const CPWL_Wnd* pWnd) const { return pWnd && pdfium::ContainsValue(m_aMousePath, pWnd); } @@ -114,7 +97,6 @@ class CPWL_MsgControl : public Observable<CPWL_MsgControl> { void SetCapture(CPWL_Wnd* pWnd) { m_aMousePath.clear(); if (pWnd) { - m_pMainMouseWnd = pWnd; CPWL_Wnd* pParent = pWnd; while (pParent) { m_aMousePath.push_back(pParent); @@ -124,15 +106,15 @@ class CPWL_MsgControl : public Observable<CPWL_MsgControl> { } void ReleaseCapture() { - m_pMainMouseWnd = nullptr; m_aMousePath.clear(); } + CPWL_Wnd* GetFocusedWindow() const { return m_pMainKeyboardWnd.Get(); } + private: std::vector<CPWL_Wnd*> m_aMousePath; std::vector<CPWL_Wnd*> m_aKeyboardPath; UnownedPtr<CPWL_Wnd> m_pCreatedWnd; - UnownedPtr<CPWL_Wnd> m_pMainMouseWnd; UnownedPtr<CPWL_Wnd> m_pMainKeyboardWnd; }; @@ -804,7 +786,7 @@ void CPWL_Wnd::SetChildMatrix(const CFX_Matrix& mt) { const CPWL_Wnd* CPWL_Wnd::GetFocused() const { CPWL_MsgControl* pMsgCtrl = GetMsgControl(); - return pMsgCtrl ? pMsgCtrl->m_pMainKeyboardWnd.Get() : nullptr; + return pMsgCtrl ? pMsgCtrl->GetFocusedWindow() : nullptr; } void CPWL_Wnd::EnableWindow(bool bEnable) { diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h index a9a434dbd1..ba52420ade 100644 --- a/fpdfsdk/pwl/cpwl_wnd.h +++ b/fpdfsdk/pwl/cpwl_wnd.h @@ -249,9 +249,10 @@ class CPWL_Wnd : public CPWL_TimerHandler, public Observable<CPWL_Wnd> { void SetChildMatrix(const CFX_Matrix& mt); CFX_Matrix GetWindowMatrix() const; - protected: - friend class CPWL_MsgControl; + virtual void OnSetFocus(); + virtual void OnKillFocus(); + protected: // CPWL_TimerHandler CFX_SystemHandler* GetSystemHandler() const override; @@ -267,9 +268,6 @@ class CPWL_Wnd : public CPWL_TimerHandler, public Observable<CPWL_Wnd> { virtual void OnCreated(); virtual void OnDestroy(); - virtual void OnSetFocus(); - virtual void OnKillFocus(); - void SetNotifyFlag(bool bNotifying = true) { m_bNotifying = bNotifying; } bool IsNotifying() const { return m_bNotifying; } bool IsValid() const { return m_bCreated; } |