summaryrefslogtreecommitdiff
path: root/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pwl/cpwl_edit_ctrl.cpp')
-rw-r--r--fpdfsdk/pwl/cpwl_edit_ctrl.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
index 579a587175..33a83cc349 100644
--- a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
@@ -14,14 +14,11 @@
#include "fpdfsdk/pwl/cpwl_scroll_bar.h"
#include "fpdfsdk/pwl/cpwl_wnd.h"
#include "public/fpdf_fwlevent.h"
+#include "third_party/base/ptr_util.h"
-CPWL_EditCtrl::CPWL_EditCtrl()
- : m_pEdit(new CPWL_EditImpl),
- m_pEditCaret(nullptr),
- m_bMouseDown(false),
- m_nCharSet(FX_CHARSET_Default) {}
+CPWL_EditCtrl::CPWL_EditCtrl() : m_pEdit(pdfium::MakeUnique<CPWL_EditImpl>()) {}
-CPWL_EditCtrl::~CPWL_EditCtrl() {}
+CPWL_EditCtrl::~CPWL_EditCtrl() = default;
void CPWL_EditCtrl::OnCreate(CreateParams* pParamsToAdjust) {
pParamsToAdjust->eCursorType = FXCT_VBEAM;
@@ -29,7 +26,6 @@ void CPWL_EditCtrl::OnCreate(CreateParams* pParamsToAdjust) {
void CPWL_EditCtrl::OnCreated() {
SetFontSize(GetCreationParams().fFontSize);
-
m_pEdit->SetFontMap(GetFontMap());
m_pEdit->SetNotify(this);
m_pEdit->Initialize();
@@ -52,16 +48,10 @@ void CPWL_EditCtrl::SetCursor() {
}
WideString CPWL_EditCtrl::GetSelectedText() {
- if (m_pEdit)
- return m_pEdit->GetSelectedText();
-
- return WideString();
+ return m_pEdit->GetSelectedText();
}
void CPWL_EditCtrl::ReplaceSelection(const WideString& text) {
- if (!m_pEdit)
- return;
-
m_pEdit->ClearSelection();
m_pEdit->InsertText(text, FX_CHARSET_Default);
}