diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-03 10:58:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-03 18:09:53 +0200 |
commit | 8ac055fa8aa7ea6c15fc5e8c36df840978878a6f (patch) | |
tree | 4d939b50f3040c813dc5a9c03ce87bfdbedf019f /vcl | |
parent | 97ccd327c66660c9f7c9e625e3c5469b2ce42622 (diff) |
change FormattedEntry to not own the Entry it operates on
Change-Id: I5b5753312a5bbfed3dbcdc47cc1781cbcf168750
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97858
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/weldutils.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx index 2b175e403304..32fd74642563 100644 --- a/vcl/source/app/weldutils.cxx +++ b/vcl/source/app/weldutils.cxx @@ -125,39 +125,39 @@ void RemoveParentKeepChildren(weld::TreeView& rTreeView, weld::TreeIter& rParent rTreeView.remove(rParent); } -FormattedEntry::FormattedEntry(std::unique_ptr<weld::Entry> xEntry) - : m_xEntry(std::move(xEntry)) +FormattedEntry::FormattedEntry(weld::Entry& rEntry) + : m_rEntry(rEntry) , m_eOptions(Application::GetSettings().GetStyleSettings().GetSelectionOptions()) { - m_xEntry->connect_changed(LINK(this, FormattedEntry, ModifyHdl)); - m_xEntry->connect_focus_out(LINK(this, FormattedEntry, FocusOutHdl)); + m_rEntry.connect_changed(LINK(this, FormattedEntry, ModifyHdl)); + m_rEntry.connect_focus_out(LINK(this, FormattedEntry, FocusOutHdl)); } Selection FormattedEntry::GetEntrySelection() const { int nStartPos, nEndPos; - m_xEntry->get_selection_bounds(nStartPos, nEndPos); + m_rEntry.get_selection_bounds(nStartPos, nEndPos); return Selection(nStartPos, nEndPos); } -OUString FormattedEntry::GetEntryText() const { return m_xEntry->get_text(); } +OUString FormattedEntry::GetEntryText() const { return m_rEntry.get_text(); } void FormattedEntry::SetEntryText(const OUString& rText, const Selection& rSel) { - m_xEntry->set_text(rText); + m_rEntry.set_text(rText); auto nMin = rSel.Min(); auto nMax = rSel.Max(); - m_xEntry->select_region(nMin < 0 ? 0 : nMin, nMax == SELECTION_MAX ? -1 : nMax); + m_rEntry.select_region(nMin < 0 ? 0 : nMin, nMax == SELECTION_MAX ? -1 : nMax); } void FormattedEntry::SetEntryTextColor(const Color* pColor) { - m_xEntry->set_font_color(pColor ? *pColor : COL_AUTO); + m_rEntry.set_font_color(pColor ? *pColor : COL_AUTO); } SelectionOptions FormattedEntry::GetEntrySelectionOptions() const { return m_eOptions; } -void FormattedEntry::FieldModified() { m_aModifyHdl.Call(*m_xEntry); } +void FormattedEntry::FieldModified() { m_aModifyHdl.Call(m_rEntry); } IMPL_LINK_NOARG(FormattedEntry, ModifyHdl, weld::Entry&, void) { Modify(); } |