| 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/core/cfwl_edit.h" | 7 #include "xfa/fwl/core/cfwl_edit.h" | 
| 8 | 8 | 
| 9 #include <memory> | 9 #include <memory> | 
| 10 #include <vector> | 10 #include <vector> | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 61     return FWL_Error::Indefinite; | 61     return FWL_Error::Indefinite; | 
| 62   return ToEdit(GetWidget())->ClearText(); | 62   return ToEdit(GetWidget())->ClearText(); | 
| 63 } | 63 } | 
| 64 | 64 | 
| 65 int32_t CFWL_Edit::GetCaretPos() const { | 65 int32_t CFWL_Edit::GetCaretPos() const { | 
| 66   if (!GetWidget()) | 66   if (!GetWidget()) | 
| 67     return -1; | 67     return -1; | 
| 68   return ToEdit(GetWidget())->GetCaretPos(); | 68   return ToEdit(GetWidget())->GetCaretPos(); | 
| 69 } | 69 } | 
| 70 | 70 | 
| 71 int32_t CFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { | 71 int32_t CFWL_Edit::SetCaretPos(int32_t nIndex, bool bBefore) { | 
| 72   if (!GetWidget()) | 72   if (!GetWidget()) | 
| 73     return -1; | 73     return -1; | 
| 74   return ToEdit(GetWidget())->SetCaretPos(nIndex, bBefore); | 74   return ToEdit(GetWidget())->SetCaretPos(nIndex, bBefore); | 
| 75 } | 75 } | 
| 76 | 76 | 
| 77 int32_t CFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) { | 77 int32_t CFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) { | 
| 78   if (!GetWidget()) | 78   if (!GetWidget()) | 
| 79     return -1; | 79     return -1; | 
| 80   ToEdit(GetWidget())->AddSelRange(nStart, nCount); | 80   ToEdit(GetWidget())->AddSelRange(nStart, nCount); | 
| 81   int32_t pos = 0; | 81   int32_t pos = 0; | 
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 151     return FWL_Error::Indefinite; | 151     return FWL_Error::Indefinite; | 
| 152   return ToEdit(GetWidget())->Replace(nStart, nLen, wsReplace); | 152   return ToEdit(GetWidget())->Replace(nStart, nLen, wsReplace); | 
| 153 } | 153 } | 
| 154 | 154 | 
| 155 FWL_Error CFWL_Edit::DoClipboard(int32_t iCmd) { | 155 FWL_Error CFWL_Edit::DoClipboard(int32_t iCmd) { | 
| 156   if (!GetWidget()) | 156   if (!GetWidget()) | 
| 157     return FWL_Error::Indefinite; | 157     return FWL_Error::Indefinite; | 
| 158   return ToEdit(GetWidget())->DoClipboard(iCmd); | 158   return ToEdit(GetWidget())->DoClipboard(iCmd); | 
| 159 } | 159 } | 
| 160 | 160 | 
| 161 FX_BOOL CFWL_Edit::Redo(const IFDE_TxtEdtDoRecord* pRecord) { | 161 bool CFWL_Edit::Redo(const IFDE_TxtEdtDoRecord* pRecord) { | 
| 162   return GetWidget() && ToEdit(GetWidget())->Redo(pRecord); | 162   return GetWidget() && ToEdit(GetWidget())->Redo(pRecord); | 
| 163 } | 163 } | 
| 164 | 164 | 
| 165 FX_BOOL CFWL_Edit::Undo(const IFDE_TxtEdtDoRecord* pRecord) { | 165 bool CFWL_Edit::Undo(const IFDE_TxtEdtDoRecord* pRecord) { | 
| 166   return GetWidget() && ToEdit(GetWidget())->Undo(pRecord); | 166   return GetWidget() && ToEdit(GetWidget())->Undo(pRecord); | 
| 167 } | 167 } | 
| 168 | 168 | 
| 169 FWL_Error CFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { | 169 FWL_Error CFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant) { | 
| 170   if (!GetWidget()) | 170   if (!GetWidget()) | 
| 171     return FWL_Error::Indefinite; | 171     return FWL_Error::Indefinite; | 
| 172   return ToEdit(GetWidget())->SetTabWidth(fTabWidth, bEquidistant); | 172   return ToEdit(GetWidget())->SetTabWidth(fTabWidth, bEquidistant); | 
| 173 } | 173 } | 
| 174 | 174 | 
| 175 FWL_Error CFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) { | 175 FWL_Error CFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) { | 
| 176   if (iMin > iMax) | 176   if (iMin > iMax) | 
| 177     return FWL_Error::ParameterInvalid; | 177     return FWL_Error::ParameterInvalid; | 
| 178   return ToEdit(GetWidget())->SetNumberRange(iMin, iMax); | 178   return ToEdit(GetWidget())->SetNumberRange(iMin, iMax); | 
| 179 } | 179 } | 
| 180 | 180 | 
| 181 FWL_Error CFWL_Edit::SetBackColor(uint32_t dwColor) { | 181 FWL_Error CFWL_Edit::SetBackColor(uint32_t dwColor) { | 
| 182   if (!GetWidget()) | 182   if (!GetWidget()) | 
| 183     return FWL_Error::Indefinite; | 183     return FWL_Error::Indefinite; | 
| 184   return ToEdit(GetWidget())->SetBackgroundColor(dwColor); | 184   return ToEdit(GetWidget())->SetBackgroundColor(dwColor); | 
| 185 } | 185 } | 
| 186 | 186 | 
| 187 FWL_Error CFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { | 187 FWL_Error CFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { | 
| 188   if (!GetWidget()) | 188   if (!GetWidget()) | 
| 189     return FWL_Error::Indefinite; | 189     return FWL_Error::Indefinite; | 
| 190   return ToEdit(GetWidget())->SetFont(wsFont, fSize); | 190   return ToEdit(GetWidget())->SetFont(wsFont, fSize); | 
| 191 } | 191 } | 
| 192 | 192 | 
| 193 FX_BOOL CFWL_Edit::CanUndo() { | 193 bool CFWL_Edit::CanUndo() { | 
| 194   return ToEdit(GetWidget())->CanUndo(); | 194   return ToEdit(GetWidget())->CanUndo(); | 
| 195 } | 195 } | 
| 196 | 196 | 
| 197 FX_BOOL CFWL_Edit::CanRedo() { | 197 bool CFWL_Edit::CanRedo() { | 
| 198   return ToEdit(GetWidget())->CanRedo(); | 198   return ToEdit(GetWidget())->CanRedo(); | 
| 199 } | 199 } | 
| 200 | 200 | 
| 201 FX_BOOL CFWL_Edit::Undo() { | 201 bool CFWL_Edit::Undo() { | 
| 202   return ToEdit(GetWidget())->Undo(); | 202   return ToEdit(GetWidget())->Undo(); | 
| 203 } | 203 } | 
| 204 | 204 | 
| 205 FX_BOOL CFWL_Edit::Redo() { | 205 bool CFWL_Edit::Redo() { | 
| 206   return ToEdit(GetWidget())->Undo(); | 206   return ToEdit(GetWidget())->Undo(); | 
| 207 } | 207 } | 
| 208 | 208 | 
| 209 FX_BOOL CFWL_Edit::Copy(CFX_WideString& wsCopy) { | 209 bool CFWL_Edit::Copy(CFX_WideString& wsCopy) { | 
| 210   return ToEdit(GetWidget())->Copy(wsCopy); | 210   return ToEdit(GetWidget())->Copy(wsCopy); | 
| 211 } | 211 } | 
| 212 | 212 | 
| 213 FX_BOOL CFWL_Edit::Cut(CFX_WideString& wsCut) { | 213 bool CFWL_Edit::Cut(CFX_WideString& wsCut) { | 
| 214   return ToEdit(GetWidget())->Cut(wsCut); | 214   return ToEdit(GetWidget())->Cut(wsCut); | 
| 215 } | 215 } | 
| 216 | 216 | 
| 217 FX_BOOL CFWL_Edit::Paste(const CFX_WideString& wsPaste) { | 217 bool CFWL_Edit::Paste(const CFX_WideString& wsPaste) { | 
| 218   return ToEdit(GetWidget())->Paste(wsPaste); | 218   return ToEdit(GetWidget())->Paste(wsPaste); | 
| 219 } | 219 } | 
| 220 | 220 | 
| 221 FX_BOOL CFWL_Edit::Delete() { | 221 bool CFWL_Edit::Delete() { | 
| 222   return ToEdit(GetWidget())->Delete(); | 222   return ToEdit(GetWidget())->Delete(); | 
| 223 } | 223 } | 
| 224 | 224 | 
| 225 void CFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) { | 225 void CFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) { | 
| 226   return ToEdit(GetWidget())->SetScrollOffset(fScrollOffset); | 226   return ToEdit(GetWidget())->SetScrollOffset(fScrollOffset); | 
| 227 } | 227 } | 
| 228 | 228 | 
| 229 FX_BOOL CFWL_Edit::GetSuggestWords(CFX_PointF pointf, | 229 bool CFWL_Edit::GetSuggestWords(CFX_PointF pointf, | 
| 230                                    std::vector<CFX_ByteString>& sSuggest) { | 230                                 std::vector<CFX_ByteString>& sSuggest) { | 
| 231   return ToEdit(GetWidget())->GetSuggestWords(pointf, sSuggest); | 231   return ToEdit(GetWidget())->GetSuggestWords(pointf, sSuggest); | 
| 232 } | 232 } | 
| 233 | 233 | 
| 234 FX_BOOL CFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf, | 234 bool CFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf, | 
| 235                                          const CFX_ByteStringC& bsReplace) { | 235                                       const CFX_ByteStringC& bsReplace) { | 
| 236   return ToEdit(GetWidget())->ReplaceSpellCheckWord(pointf, bsReplace); | 236   return ToEdit(GetWidget())->ReplaceSpellCheckWord(pointf, bsReplace); | 
| 237 } | 237 } | 
| OLD | NEW | 
|---|