OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fwl/lightwidget/cfwl_edit.h" | 7 #include "xfa/fwl/lightwidget/cfwl_edit.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "third_party/base/ptr_util.h" |
| 13 |
12 IFWL_Edit* CFWL_Edit::GetWidget() { | 14 IFWL_Edit* CFWL_Edit::GetWidget() { |
13 return static_cast<IFWL_Edit*>(m_pIface.get()); | 15 return static_cast<IFWL_Edit*>(m_pIface.get()); |
14 } | 16 } |
15 | 17 |
16 const IFWL_Edit* CFWL_Edit::GetWidget() const { | 18 const IFWL_Edit* CFWL_Edit::GetWidget() const { |
17 return static_cast<IFWL_Edit*>(m_pIface.get()); | 19 return static_cast<IFWL_Edit*>(m_pIface.get()); |
18 } | 20 } |
19 | 21 |
20 FWL_Error CFWL_Edit::Initialize(const CFWL_WidgetProperties* pProperties) { | 22 FWL_Error CFWL_Edit::Initialize(const CFWL_WidgetProperties* pProperties) { |
21 if (m_pIface) | 23 if (m_pIface) |
22 return FWL_Error::Indefinite; | 24 return FWL_Error::Indefinite; |
23 if (pProperties) { | 25 if (pProperties) { |
24 *m_pProperties = *pProperties; | 26 *m_pProperties = *pProperties; |
25 } | 27 } |
26 std::unique_ptr<IFWL_Edit> pEdit(IFWL_Edit::Create( | 28 std::unique_ptr<IFWL_Edit> pEdit = pdfium::MakeUnique<IFWL_Edit>( |
27 m_pProperties->MakeWidgetImpProperties(nullptr), nullptr)); | 29 m_pProperties->MakeWidgetImpProperties(nullptr), nullptr); |
28 FWL_Error ret = pEdit->Initialize(); | 30 FWL_Error ret = pEdit->Initialize(); |
29 if (ret != FWL_Error::Succeeded) { | 31 if (ret != FWL_Error::Succeeded) { |
30 return ret; | 32 return ret; |
31 } | 33 } |
32 m_pIface = std::move(pEdit); | 34 m_pIface = std::move(pEdit); |
33 CFWL_Widget::Initialize(); | 35 CFWL_Widget::Initialize(); |
34 return FWL_Error::Succeeded; | 36 return FWL_Error::Succeeded; |
35 } | 37 } |
36 | 38 |
37 FWL_Error CFWL_Edit::SetText(const CFX_WideString& wsText) { | 39 FWL_Error CFWL_Edit::SetText(const CFX_WideString& wsText) { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 233 } |
232 | 234 |
233 FX_BOOL CFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf, | 235 FX_BOOL CFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf, |
234 const CFX_ByteStringC& bsReplace) { | 236 const CFX_ByteStringC& bsReplace) { |
235 return GetWidget()->ReplaceSpellCheckWord(pointf, bsReplace); | 237 return GetWidget()->ReplaceSpellCheckWord(pointf, bsReplace); |
236 } | 238 } |
237 | 239 |
238 CFWL_Edit::CFWL_Edit() {} | 240 CFWL_Edit::CFWL_Edit() {} |
239 | 241 |
240 CFWL_Edit::~CFWL_Edit() {} | 242 CFWL_Edit::~CFWL_Edit() {} |
OLD | NEW |