diff options
author | Ryan Harrison <rharrison@chromium.org> | 2018-01-05 15:40:40 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-05 20:55:18 +0000 |
commit | 245f80c4ae2bde11de8fdff54e736ec4e4296e0a (patch) | |
tree | 4e62bab9aabd17eb1f69e95f9755d5ddb2b144f2 /xfa/fxfa | |
parent | a172cfb094fe1012d71d556552977c86f2ae639d (diff) | |
download | pdfium-245f80c4ae2bde11de8fdff54e736ec4e4296e0a.tar.xz |
Convert CFWL_Edit Cut & Copy out param to return
Change-Id: I99776deb809609f69275848ddb81706e2cc82c82
Reviewed-on: https://pdfium-review.googlesource.com/22370
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r-- | xfa/fxfa/cxfa_ffcombobox.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffcombobox.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fftextedit.cpp | 8 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fftextedit.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.cpp | 8 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidgethandler.cpp | 4 |
7 files changed, 22 insertions, 22 deletions
diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp index 58a0f94f9d..13bda7adbb 100644 --- a/xfa/fxfa/cxfa_ffcombobox.cpp +++ b/xfa/fxfa/cxfa_ffcombobox.cpp @@ -232,13 +232,15 @@ bool CXFA_FFComboBox::CanSelectAll() { return ToComboBox(m_pNormalWidget.get())->EditCanSelectAll(); } -bool CXFA_FFComboBox::Copy(WideString& wsCopy) { - return ToComboBox(m_pNormalWidget.get())->EditCopy(wsCopy); +Optional<WideString> CXFA_FFComboBox::Copy() { + return ToComboBox(m_pNormalWidget.get())->EditCopy(); } -bool CXFA_FFComboBox::Cut(WideString& wsCut) { - return m_pDataAcc->IsChoiceListAllowTextEntry() && - ToComboBox(m_pNormalWidget.get())->EditCut(wsCut); +Optional<WideString> CXFA_FFComboBox::Cut() { + if (!m_pDataAcc->IsChoiceListAllowTextEntry()) + return {}; + + return ToComboBox(m_pNormalWidget.get())->EditCut(); } bool CXFA_FFComboBox::Paste(const WideString& wsPaste) { diff --git a/xfa/fxfa/cxfa_ffcombobox.h b/xfa/fxfa/cxfa_ffcombobox.h index 81da2c2125..727e1ba7bf 100644 --- a/xfa/fxfa/cxfa_ffcombobox.h +++ b/xfa/fxfa/cxfa_ffcombobox.h @@ -29,8 +29,8 @@ class CXFA_FFComboBox : public CXFA_FFField { bool CanCut() override; bool CanPaste() override; bool CanSelectAll() override; - bool Copy(WideString& wsCopy) override; - bool Cut(WideString& wsCut) override; + Optional<WideString> Copy() override; + Optional<WideString> Cut() override; bool Paste(const WideString& wsPaste) override; void SelectAll() override; void Delete() override; diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp index b97b218894..3f4260c748 100644 --- a/xfa/fxfa/cxfa_fftextedit.cpp +++ b/xfa/fxfa/cxfa_fftextedit.cpp @@ -398,12 +398,12 @@ bool CXFA_FFTextEdit::CanSelectAll() { return ToEdit(m_pNormalWidget.get())->GetTextLength() > 0; } -bool CXFA_FFTextEdit::Copy(WideString& wsCopy) { - return ToEdit(m_pNormalWidget.get())->Copy(wsCopy); +Optional<WideString> CXFA_FFTextEdit::Copy() { + return ToEdit(m_pNormalWidget.get())->Copy(); } -bool CXFA_FFTextEdit::Cut(WideString& wsCut) { - return ToEdit(m_pNormalWidget.get())->Copy(wsCut); +Optional<WideString> CXFA_FFTextEdit::Cut() { + return ToEdit(m_pNormalWidget.get())->Cut(); } bool CXFA_FFTextEdit::Paste(const WideString& wsPaste) { diff --git a/xfa/fxfa/cxfa_fftextedit.h b/xfa/fxfa/cxfa_fftextedit.h index dd3801b4df..404d35ec18 100644 --- a/xfa/fxfa/cxfa_fftextedit.h +++ b/xfa/fxfa/cxfa_fftextedit.h @@ -51,8 +51,8 @@ class CXFA_FFTextEdit : public CXFA_FFField { bool CanCut() override; bool CanPaste() override; bool CanSelectAll() override; - bool Copy(WideString& wsCopy) override; - bool Cut(WideString& wsCut) override; + Optional<WideString> Copy() override; + Optional<WideString> Cut() override; bool Paste(const WideString& wsPaste) override; void SelectAll() override; void Delete() override; diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 1314b8a3cd..2a844bbb82 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -1166,12 +1166,12 @@ bool CXFA_FFWidget::CanDeSelect() { return CanCopy(); } -bool CXFA_FFWidget::Copy(WideString& wsCopy) { - return false; +Optional<WideString> CXFA_FFWidget::Copy() { + return {}; } -bool CXFA_FFWidget::Cut(WideString& wsCut) { - return false; +Optional<WideString> CXFA_FFWidget::Cut() { + return {}; } bool CXFA_FFWidget::Paste(const WideString& wsPaste) { diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index 13372320b8..f52098301f 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h @@ -127,8 +127,8 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { virtual bool CanSelectAll(); virtual bool CanDelete(); virtual bool CanDeSelect(); - virtual bool Copy(WideString& wsCopy); - virtual bool Cut(WideString& wsCut); + virtual Optional<WideString> Copy(); + virtual Optional<WideString> Cut(); virtual bool Paste(const WideString& wsPaste); virtual void SelectAll(); virtual void Delete(); diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp index 8988cf1903..79e48bab9b 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.cpp +++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp @@ -150,9 +150,7 @@ WideString CXFA_FFWidgetHandler::GetSelectedText(CXFA_FFWidget* widget) { if (!widget->CanCopy()) return WideString(); - WideString val; - widget->Copy(val); - return val; + return widget->Copy().value_or(WideString()); } void CXFA_FFWidgetHandler::PasteText(CXFA_FFWidget* widget, |