diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-05-13 13:58:57 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-05-13 20:30:42 +0200 |
commit | 1d6af937da9d24a0cc30f0324f8f23d0c1156ccd (patch) | |
tree | b660d3f60ea407101c5c3f4502d39c011b9f5c61 | |
parent | 535d857975e453401c0c455bdda82e1a81c7e110 (diff) |
add access to entry cut/copy/paste
Change-Id: I4f84ccdc4490ae6190d02aca206f87133497bff9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94122
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/vcl/weld.hxx | 4 | ||||
-rw-r--r-- | vcl/inc/salvtables.hxx | 18 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 52 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 44 |
4 files changed, 117 insertions, 1 deletions
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 79b0de0ae508..684c70885231 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -706,6 +706,10 @@ public: virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) = 0; virtual void set_entry_completion(bool bEnable, bool bCaseSensitive = false) = 0; virtual void set_entry_placeholder_text(const OUString& rText) = 0; + virtual void set_entry_editable(bool bEditable) = 0; + virtual void cut_entry_clipboard() = 0; + virtual void copy_entry_clipboard() = 0; + virtual void paste_entry_clipboard() = 0; // font size is in points, not pixels, e.g. see Window::[G]etPointFont virtual void set_entry_font(const vcl::Font& rFont) = 0; diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 2321e9198b6a..f8347ca8cda0 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -900,6 +900,14 @@ public: virtual void set_entry_placeholder_text(const OUString&) override; + virtual void set_entry_editable(bool bEditable) override; + + virtual void cut_entry_clipboard() override; + + virtual void copy_entry_clipboard() override; + + virtual void paste_entry_clipboard() override; + virtual void set_entry_font(const vcl::Font&) override; virtual vcl::Font get_entry_font() override; @@ -958,6 +966,14 @@ public: virtual void set_entry_placeholder_text(const OUString& rText) override; + virtual void set_entry_editable(bool bEditable) override; + + virtual void cut_entry_clipboard() override; + + virtual void copy_entry_clipboard() override; + + virtual void paste_entry_clipboard() override; + virtual void select_entry_region(int nStartPos, int nEndPos) override; virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) override; @@ -1045,4 +1061,4 @@ public: virtual ~SalInstanceNotebook() override; }; -/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index b9d8e2de83c9..7e683bb6d433 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5739,6 +5739,14 @@ void SalInstanceComboBoxWithoutEdit::set_entry_completion(bool, bool) { assert(f void SalInstanceComboBoxWithoutEdit::set_entry_placeholder_text(const OUString&) { assert(false); } +void SalInstanceComboBoxWithoutEdit::set_entry_editable(bool /*bEditable*/) { assert(false); } + +void SalInstanceComboBoxWithoutEdit::cut_entry_clipboard() { assert(false); } + +void SalInstanceComboBoxWithoutEdit::copy_entry_clipboard() { assert(false); } + +void SalInstanceComboBoxWithoutEdit::paste_entry_clipboard() { assert(false); } + void SalInstanceComboBoxWithoutEdit::set_entry_font(const vcl::Font&) { assert(false); } vcl::Font SalInstanceComboBoxWithoutEdit::get_entry_font() { assert(false); return vcl::Font(); } @@ -5863,6 +5871,26 @@ void SalInstanceComboBoxWithEdit::set_entry_placeholder_text(const OUString& rTe m_xComboBox->SetPlaceholderText(rText); } +void SalInstanceComboBoxWithEdit::set_entry_editable(bool bEditable) +{ + m_xComboBox->SetReadOnly(!bEditable); +} + +void SalInstanceComboBoxWithEdit::cut_entry_clipboard() +{ + m_xComboBox->Cut(); +} + +void SalInstanceComboBoxWithEdit::copy_entry_clipboard() +{ + m_xComboBox->Copy(); +} + +void SalInstanceComboBoxWithEdit::paste_entry_clipboard() +{ + m_xComboBox->Paste(); +} + void SalInstanceComboBoxWithEdit::select_entry_region(int nStartPos, int nEndPos) { m_xComboBox->SetSelection(Selection(nStartPos, nEndPos < 0 ? SELECTION_MAX : nEndPos)); @@ -6028,6 +6056,30 @@ public: rEntry.SetPlaceholderText(rText); } + virtual void set_entry_editable(bool bEditable) override + { + Edit& rEntry = m_pEntry->getEntry(); + rEntry.SetReadOnly(!bEditable); + } + + virtual void cut_entry_clipboard() override + { + Edit& rEntry = m_pEntry->getEntry(); + rEntry.Cut(); + } + + virtual void copy_entry_clipboard() override + { + Edit& rEntry = m_pEntry->getEntry(); + rEntry.Copy(); + } + + virtual void paste_entry_clipboard() override + { + Edit& rEntry = m_pEntry->getEntry(); + rEntry.Paste(); + } + virtual void grab_focus() override { m_xEntry->grab_focus(); } virtual void connect_focus_in(const Link<Widget&, void>& rLink) override diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index cfb15f3cb4de..549132dad52e 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -14077,6 +14077,30 @@ public: gtk_entry_set_placeholder_text(GTK_ENTRY(m_pEntry), rText.toUtf8().getStr()); } + virtual void set_entry_editable(bool bEditable) override + { + assert(m_pEntry); + gtk_editable_set_editable(GTK_EDITABLE(m_pEntry), bEditable); + } + + virtual void cut_entry_clipboard() override + { + assert(m_pEntry); + gtk_editable_cut_clipboard(GTK_EDITABLE(m_pEntry)); + } + + virtual void copy_entry_clipboard() override + { + assert(m_pEntry); + gtk_editable_copy_clipboard(GTK_EDITABLE(m_pEntry)); + } + + virtual void paste_entry_clipboard() override + { + assert(m_pEntry); + gtk_editable_paste_clipboard(GTK_EDITABLE(m_pEntry)); + } + virtual void set_entry_font(const vcl::Font& rFont) override { m_xFont.reset(new vcl::Font(rFont)); @@ -14633,6 +14657,26 @@ public: m_xEntry->set_placeholder_text(rText); } + virtual void set_entry_editable(bool bEditable) override + { + m_xEntry->set_editable(bEditable); + } + + virtual void cut_entry_clipboard() override + { + m_xEntry->cut_clipboard(); + } + + virtual void copy_entry_clipboard() override + { + m_xEntry->copy_clipboard(); + } + + virtual void paste_entry_clipboard() override + { + m_xEntry->paste_clipboard(); + } + virtual void set_entry_font(const vcl::Font& rFont) override { m_xEntry->set_font(rFont); |