Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: xfa/src/fwl/lightwidget/edit.cpp

Issue 1803723002: Move xfa/src up to xfa/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/src/fwl/lightwidget/datetimepicker.cpp ('k') | xfa/src/fwl/lightwidget/listbox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #include "xfa/include/fwl/lightwidget/edit.h"
8
9 #include <memory>
10 #include <vector>
11
12 #include "xfa/include/fwl/basewidget/fwl_edit.h"
13
14 CFWL_Edit* CFWL_Edit::Create() {
15 return new CFWL_Edit;
16 }
17 FWL_ERR CFWL_Edit::Initialize(const CFWL_WidgetProperties* pProperties) {
18 if (m_pIface)
19 return FWL_ERR_Indefinite;
20 if (pProperties) {
21 *m_pProperties = *pProperties;
22 }
23 std::unique_ptr<IFWL_Edit> pEdit(IFWL_Edit::Create(
24 m_pProperties->MakeWidgetImpProperties(nullptr), nullptr));
25 FWL_ERR ret = pEdit->Initialize();
26 if (ret != FWL_ERR_Succeeded) {
27 return ret;
28 }
29 m_pIface = pEdit.release();
30 CFWL_Widget::Initialize();
31 return FWL_ERR_Succeeded;
32 }
33 FWL_ERR CFWL_Edit::SetText(const CFX_WideString& wsText) {
34 if (!m_pIface)
35 return FWL_ERR_Indefinite;
36 return static_cast<IFWL_Edit*>(m_pIface)->SetText(wsText);
37 }
38 int32_t CFWL_Edit::GetTextLength() const {
39 if (!m_pIface)
40 return 0;
41 return static_cast<IFWL_Edit*>(m_pIface)->GetTextLength();
42 }
43 FWL_ERR CFWL_Edit::GetText(CFX_WideString& wsText,
44 int32_t nStart,
45 int32_t nCount) const {
46 if (!m_pIface)
47 return FWL_ERR_Indefinite;
48 return static_cast<IFWL_Edit*>(m_pIface)->GetText(wsText, nStart, nCount);
49 }
50 FWL_ERR CFWL_Edit::ClearText() {
51 if (!m_pIface)
52 return FWL_ERR_Indefinite;
53 return static_cast<IFWL_Edit*>(m_pIface)->ClearText();
54 }
55 int32_t CFWL_Edit::GetCaretPos() const {
56 if (!m_pIface)
57 return -1;
58 return static_cast<IFWL_Edit*>(m_pIface)->GetCaretPos();
59 }
60 int32_t CFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) {
61 if (!m_pIface)
62 return -1;
63 return static_cast<IFWL_Edit*>(m_pIface)->SetCaretPos(nIndex, bBefore);
64 }
65 FWL_ERR CFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) {
66 if (!m_pIface)
67 return FWL_ERR_Indefinite;
68 static_cast<IFWL_Edit*>(m_pIface)->AddSelRange(nStart, nCount);
69 int32_t pos = 0;
70 int32_t sum = static_cast<IFWL_Edit*>(m_pIface)->GetTextLength();
71 if (nCount == -1) {
72 pos = sum;
73 } else {
74 pos = nStart + nCount;
75 }
76 return static_cast<IFWL_Edit*>(m_pIface)->SetCaretPos(pos);
77 }
78 int32_t CFWL_Edit::CountSelRanges() {
79 if (!m_pIface)
80 return 0;
81 return static_cast<IFWL_Edit*>(m_pIface)->CountSelRanges();
82 }
83 int32_t CFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) {
84 if (!m_pIface)
85 return 0;
86 return static_cast<IFWL_Edit*>(m_pIface)->GetSelRange(nIndex, nStart);
87 }
88 FWL_ERR CFWL_Edit::ClearSelections() {
89 if (!m_pIface)
90 return FWL_ERR_Indefinite;
91 return static_cast<IFWL_Edit*>(m_pIface)->ClearSelections();
92 }
93 int32_t CFWL_Edit::GetLimit() {
94 if (!m_pIface)
95 return -1;
96 return static_cast<IFWL_Edit*>(m_pIface)->GetLimit();
97 }
98 FWL_ERR CFWL_Edit::SetLimit(int32_t nLimit) {
99 if (!m_pIface)
100 return FWL_ERR_Indefinite;
101 return static_cast<IFWL_Edit*>(m_pIface)->SetLimit(nLimit);
102 }
103 FWL_ERR CFWL_Edit::SetAliasChar(FX_WCHAR wAlias) {
104 if (!m_pIface)
105 return FWL_ERR_Indefinite;
106 return static_cast<IFWL_Edit*>(m_pIface)->SetAliasChar(wAlias);
107 }
108 FWL_ERR CFWL_Edit::Insert(int32_t nStart,
109 const FX_WCHAR* lpText,
110 int32_t nLen) {
111 if (!m_pIface)
112 return FWL_ERR_Indefinite;
113 return static_cast<IFWL_Edit*>(m_pIface)->Insert(nStart, lpText, nLen);
114 }
115 FWL_ERR CFWL_Edit::DeleteSelections() {
116 if (!m_pIface)
117 return FWL_ERR_Indefinite;
118 return static_cast<IFWL_Edit*>(m_pIface)->DeleteSelections();
119 }
120 FWL_ERR CFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) {
121 if (!m_pIface)
122 return FWL_ERR_Indefinite;
123 return static_cast<IFWL_Edit*>(m_pIface)->DeleteRange(nStart, nCount);
124 }
125 FWL_ERR CFWL_Edit::ReplaceSelections(const CFX_WideStringC& wsReplace) {
126 if (!m_pIface)
127 return FWL_ERR_Indefinite;
128 return static_cast<IFWL_Edit*>(m_pIface)->ReplaceSelections(wsReplace);
129 }
130 FWL_ERR CFWL_Edit::Replace(int32_t nStart,
131 int32_t nLen,
132 const CFX_WideStringC& wsReplace) {
133 if (!m_pIface)
134 return FWL_ERR_Indefinite;
135 return static_cast<IFWL_Edit*>(m_pIface)->Replace(nStart, nLen, wsReplace);
136 }
137 FWL_ERR CFWL_Edit::DoClipboard(int32_t iCmd) {
138 if (!m_pIface)
139 return FWL_ERR_Indefinite;
140 return static_cast<IFWL_Edit*>(m_pIface)->DoClipboard(iCmd);
141 }
142 FX_BOOL CFWL_Edit::Redo(const CFX_ByteStringC& bsRecord) {
143 if (!m_pIface)
144 return FALSE;
145 return static_cast<IFWL_Edit*>(m_pIface)->Redo(bsRecord);
146 }
147 FX_BOOL CFWL_Edit::Undo(const CFX_ByteStringC& bsRecord) {
148 if (!m_pIface)
149 return FALSE;
150 return static_cast<IFWL_Edit*>(m_pIface)->Undo(bsRecord);
151 }
152 FWL_ERR CFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) {
153 if (!m_pIface)
154 return FWL_ERR_Indefinite;
155 return static_cast<IFWL_Edit*>(m_pIface)
156 ->SetTabWidth(fTabWidth, bEquidistant);
157 }
158 FWL_ERR CFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) {
159 if (iMin > iMax) {
160 return FWL_ERR_Parameter_Invalid;
161 }
162 return static_cast<IFWL_Edit*>(m_pIface)->SetNumberRange(iMin, iMax);
163 }
164 FWL_ERR CFWL_Edit::SetBackColor(FX_DWORD dwColor) {
165 if (!m_pIface)
166 return FWL_ERR_Indefinite;
167 return static_cast<IFWL_Edit*>(m_pIface)->SetBackColor(dwColor);
168 }
169 FWL_ERR CFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) {
170 if (!m_pIface)
171 return FWL_ERR_Indefinite;
172 return static_cast<IFWL_Edit*>(m_pIface)->SetFont(wsFont, fSize);
173 }
174 FX_BOOL CFWL_Edit::CanUndo() {
175 return static_cast<IFWL_Edit*>(m_pIface)->CanUndo();
176 }
177 FX_BOOL CFWL_Edit::CanRedo() {
178 return static_cast<IFWL_Edit*>(m_pIface)->CanRedo();
179 }
180 FX_BOOL CFWL_Edit::Undo() {
181 return static_cast<IFWL_Edit*>(m_pIface)->Undo();
182 }
183 FX_BOOL CFWL_Edit::Redo() {
184 return static_cast<IFWL_Edit*>(m_pIface)->Undo();
185 }
186 FX_BOOL CFWL_Edit::Copy(CFX_WideString& wsCopy) {
187 return static_cast<IFWL_Edit*>(m_pIface)->Copy(wsCopy);
188 }
189 FX_BOOL CFWL_Edit::Cut(CFX_WideString& wsCut) {
190 return static_cast<IFWL_Edit*>(m_pIface)->Cut(wsCut);
191 }
192 FX_BOOL CFWL_Edit::Paste(const CFX_WideString& wsPaste) {
193 return static_cast<IFWL_Edit*>(m_pIface)->Paste(wsPaste);
194 }
195 FX_BOOL CFWL_Edit::Delete() {
196 return static_cast<IFWL_Edit*>(m_pIface)->Delete();
197 }
198 void CFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) {
199 return static_cast<IFWL_Edit*>(m_pIface)->SetScrollOffset(fScrollOffset);
200 }
201 FX_BOOL CFWL_Edit::GetSuggestWords(CFX_PointF pointf,
202 std::vector<CFX_ByteString>& sSuggest) {
203 return static_cast<IFWL_Edit*>(m_pIface)->GetSuggestWords(pointf, sSuggest);
204 }
205 FX_BOOL CFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf,
206 const CFX_ByteStringC& bsReplace) {
207 return static_cast<IFWL_Edit*>(m_pIface)
208 ->ReplaceSpellCheckWord(pointf, bsReplace);
209 }
210 CFWL_Edit::CFWL_Edit() {}
211 CFWL_Edit::~CFWL_Edit() {}
OLDNEW
« no previous file with comments | « xfa/src/fwl/lightwidget/datetimepicker.cpp ('k') | xfa/src/fwl/lightwidget/listbox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698