diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-01 17:00:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-02 20:22:05 +0200 |
commit | a751d9c414fc63f36ae4b54b8adbaba042b31f60 (patch) | |
tree | 14b16f3580b140e0e45da81bb93712ff321b6218 /svtools | |
parent | 4582ac7de8291a81c867492aad770206fbaca224 (diff) |
weld FormattedControl
by using the newly split out Formatter to do the number formatting
but input/output to/from a weld::Entry
Change-Id: Ic9e619dc5d1ed2fae87e2d89a40dc51f3881468f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97660
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/pch/precompiled_svt.hxx | 4 | ||||
-rw-r--r-- | svtools/source/brwbox/ebbcontrols.cxx | 57 | ||||
-rw-r--r-- | svtools/source/brwbox/editbrowsebox.cxx | 1 |
3 files changed, 43 insertions, 19 deletions
diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx index 3122d26aab54..9654a9c02771 100644 --- a/svtools/inc/pch/precompiled_svt.hxx +++ b/svtools/inc/pch/precompiled_svt.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-06-26 20:20:06 using: + Generated on 2020-07-02 16:19:19 using: ./bin/update_pch svtools svt --cutoff=4 --exclude:system --include:module --exclude:local If after updating build fails, use the following command to locate conflicting headers: @@ -114,6 +114,7 @@ #include <vcl/floatwin.hxx> #include <vcl/fntstyle.hxx> #include <vcl/font.hxx> +#include <vcl/formatter.hxx> #include <vcl/gfxlink.hxx> #include <vcl/graph.hxx> #include <vcl/graphicfilter.hxx> @@ -295,6 +296,7 @@ #include <cppu/cppudllapi.h> #include <cppu/unotype.hxx> #include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase.hxx> #include <cppuhelper/compbase_ex.hxx> #include <cppuhelper/cppuhelperdllapi.h> #include <cppuhelper/implbase.hxx> diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx index c2534dc9efd4..29d4c06c0b4c 100644 --- a/svtools/source/brwbox/ebbcontrols.cxx +++ b/svtools/source/brwbox/ebbcontrols.cxx @@ -346,26 +346,56 @@ namespace svt m_aModifyHdl.Call(nullptr); } - EditControl::EditControl(vcl::Window* pParent) + EditControlBase::EditControlBase(vcl::Window* pParent) : InterimItemWindow(pParent, "svt/ui/thineditcontrol.ui", "EditControl") // *thin*editcontrol has no frame/border - , m_xWidget(m_xBuilder->weld_entry("entry")) { - m_xWidget->set_width_chars(1); // so a smaller than default width can be used - m_xWidget->connect_key_press(LINK(this, EditControl, KeyInputHdl)); } - IMPL_LINK(EditControl, KeyInputHdl, const KeyEvent&, rKEvt, bool) + void EditControlBase::init(weld::Entry* pEntry) + { + m_pEntry = pEntry; + m_pEntry->set_width_chars(1); // so a smaller than default width can be used + m_pEntry->connect_key_press(LINK(this, EditControl, KeyInputHdl)); + } + + IMPL_LINK(EditControlBase, KeyInputHdl, const KeyEvent&, rKEvt, bool) { return ChildKeyInput(rKEvt); } + void EditControlBase::dispose() + { + m_pEntry = nullptr; + InterimItemWindow::dispose(); + } + + EditControl::EditControl(vcl::Window* pParent) + : EditControlBase(pParent) + , m_xWidget(m_xBuilder->weld_entry("entry")) + { + init(m_xWidget.get()); + } + void EditControl::dispose() { m_xWidget.reset(); - InterimItemWindow::dispose(); + EditControlBase::dispose(); + } + + FormattedControl::FormattedControl(vcl::Window* pParent) + : EditControlBase(pParent) + , m_xFormattedEntry(new weld::FormattedEntry(m_xBuilder->weld_entry("entry"))) + { + init(m_xFormattedEntry->get_widget()); + } + + void FormattedControl::dispose() + { + m_xFormattedEntry.reset(); + EditControlBase::dispose(); } - EditCellController::EditCellController(EditControl* pEdit) + EditCellController::EditCellController(EditControlBase* pEdit) : CellController(pEdit) , m_pEditImplementation(new EntryImplementation(*pEdit)) , m_bOwnImplementation(true) @@ -475,30 +505,23 @@ namespace svt } //= FormattedFieldCellController - - - FormattedFieldCellController::FormattedFieldCellController( FormattedField* _pFormatted ) - :EditCellController( _pFormatted ) + FormattedFieldCellController::FormattedFieldCellController( FormattedControl* _pFormatted ) + : EditCellController(_pFormatted) { } - void FormattedFieldCellController::CommitModifications() { - static_cast< FormattedField& >( GetWindow() ).Commit(); + static_cast<FormattedControl&>(GetWindow()).get_formatter().Commit(); } - //= MultiLineTextCell - - void MultiLineTextCell::Modify() { GetTextEngine()->SetModified( true ); VclMultiLineEdit::Modify(); } - bool MultiLineTextCell::dispatchKeyEvent( const KeyEvent& _rEvent ) { Selection aOldSelection( GetSelection() ); diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 1db43ea8c40f..1f79a3686474 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -24,7 +24,6 @@ #include <vcl/window.hxx> #include <vcl/button.hxx> -#include <vcl/edit.hxx> #include <vcl/settings.hxx> #include <bitmaps.hlst> |