diff options
author | Justin Luth <justin.luth@collabora.com> | 2019-06-15 22:15:32 +0300 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2019-06-28 09:51:22 +0200 |
commit | d4d2cd593231f97cff938d7d6b30527e310c4244 (patch) | |
tree | 66c63ebab6910ddeb960e41e4603b7b2b221181c | |
parent | 7e47c20a1faf27c184454a3b07b14f27954cd245 (diff) |
tdf#125609 c10 vcl/button: enforce only one radio selected on init
This patch does not solve the main LO 6.2 problem in bug 125609,
but fixes the related problem from comments 10/11.
This patch fixes two different scenarios:
1.) Sometimes buttons could fall through the other safety nets and
have multiple radio buttons selected in a single group at display time.
Since ImplInitStyle can be called multiple times for the same
button, ensure that once everything is imported (IsRadioCheckEnabled)
that any calls to this double-check that only one button is enabled.
First come, first served if by programmer error multiple are marked as
IsChecked in the same group. This problem existed pre-LO 6.2,
so it had nothing to do with tabstops specifically.
2.) This patch specifically fixes the 6.2 regression with the
Grammalecte extension Graphic Options dialog box. In this case
Dialog::GrabFocusToFirstControl ended up being treated as a "click"
on a tabstopped, unchecked radio, because setting the state
never called the SetState/Checked function, but only the Init,
and so the uncheckAllOther function never removed any tabstops.
Change-Id: I98272d6c81cf582a15c2e6bf04e6ed60da1d9c71
Reviewed-on: https://gerrit.libreoffice.org/74108
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
(cherry picked from commit d35171456bc230efdaa9426da1398b2db7fa0df8)
Reviewed-on: https://gerrit.libreoffice.org/74775
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r-- | include/vcl/button.hxx | 2 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx index bc82b7c78bd8..2a63e47a8c9b 100644 --- a/include/vcl/button.hxx +++ b/include/vcl/button.hxx @@ -289,7 +289,7 @@ private: bool mbStateChanged; Link<RadioButton&,void> maToggleHdl; SAL_DLLPRIVATE void ImplInitRadioButtonData(); - static SAL_DLLPRIVATE WinBits ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nStyle ); + SAL_DLLPRIVATE WinBits ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nStyle ); SAL_DLLPRIVATE void ImplInitSettings( bool bBackground ); SAL_DLLPRIVATE void ImplDrawRadioButtonState(vcl::RenderContext& rRenderContext); SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 5ab14d2c2db2..8469407dfc57 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1857,6 +1857,10 @@ WinBits RadioButton::ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nSty nStyle |= WB_GROUP; if ( !(nStyle & WB_NOTABSTOP) ) nStyle |= WB_TABSTOP; + + if ( IsChecked() && IsRadioCheckEnabled() ) + ImplUncheckAllOther(); + return nStyle; } |