Instead of letting the implementations set for
Formatter::m_aInputHdl via Formatter::SetInputHdl
always retrieve the current text and parse
that one, pass the text to convert as a parameter
instead.
Introduce a new struct Formatter::ParseResult
so that both, the state (which describes whether
parsing was successful and/or a handler was set)
and the value can still be returned at the same time.
(Link/The handlers only supports a single param. So far,
the state was returned by the function result and
the value was returned via an out param, but the
single param is now used for an input param to pass the
text.)
Make it the responsibility of Formatter::ImplGetValue
to pass the current text instead of having the handlers
read it themselves.
Rename the members accordingly:
* Formatter::m_aInputHdl -> Formatter:m_aParseTextHdl
* Formatter::SetInputHdl -> Formatter::SetParseTextHdl
This is similar to
Change-Id: I6b3fbccc89b89446a1ea367a80aeed3a7b583298
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Tue Feb 18 20:29:20 2025 +0100
tdf#130857 Let Formatter:m_aOutputHdl convert double to text
(but for the conversion the other way around) and
commit 15ad64a412
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Sat Feb 15 11:22:54 2025 +0100
tdf#130857 weld: Let SpinButton input hdl only parse value from string
(which is a similar change, but in weld::SpinButton).
No change in behavior is intended by this change
by itself.
The primary motivation is to allow reusing the
logic to convert a string to a value in order
to implement QtDoubleSpinBox::valueFromText
for QtInstanceFormattedSpinButton.
Change-Id: If6837409aadbe9cc37fdbb4c0650f5e1305229f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181942
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>