include/vcl/weld.hxx | 31 ++++++++++++++++++++++++++++--- vcl/inc/jsdialog/jsdialogbuilder.hxx | 2 +- vcl/inc/qt5/QtInstanceCheckButton.hxx | 2 +- vcl/inc/qt5/QtInstanceEntry.hxx | 4 ++-- vcl/inc/salvtables.hxx | 6 +++--- vcl/jsdialog/jsdialogbuilder.cxx | 4 ++-- vcl/qt5/QtInstanceCheckButton.cxx | 2 +- vcl/qt5/QtInstanceEntry.cxx | 4 ++-- vcl/source/app/salvtables.cxx | 12 +++--------- vcl/unx/gtk3/gtkinst.cxx | 6 +++--- 10 files changed, 46 insertions(+), 27 deletions(-)
New commits: commit f544a3bcd9ce325c84381881d72b3332a54b3222 Author: Michael Weghorn <[email protected]> AuthorDate: Sat Oct 18 01:55:47 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Mon Oct 20 17:08:26 2025 +0200 tdf#130857 weld: Move signal blocking to CheckButton::set_state Apply the changes as described in Change-Id: If5fba408cc6638441e9856238b19659fed6d7e01 Author: Michael Weghorn <[email protected]> Date: Fri Oct 17 22:11:02 2025 +0200 tdf#130857 weld: Move signal blocking to TextView::select_region for this method as well. See the above-mentioned commit for more details/background. Change-Id: I8f75e66e14bb3f4e2b3315c77091f04ce29daf71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192630 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index bd0da3708e3a..9fcd12adb83e 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1900,10 +1900,19 @@ public: class VCL_DLLPUBLIC CheckButton : virtual public Toggleable { +protected: + virtual void do_set_state(TriState eState) = 0; + public: // must override Toggleable::get_state to support TRISTATE_INDET virtual TriState get_state() const override = 0; - virtual void set_state(TriState eState) = 0; + + void set_state(TriState eState) + { + disable_notify_events(); + do_set_state(eState); + enable_notify_events(); + } virtual void set_active(bool bActive) override final { diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index f1449b395853..4702c6dfcc0e 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -634,7 +634,7 @@ public: JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership); - virtual void set_state(TriState eState) override; + virtual void do_set_state(TriState eState) override; }; class JSDrawingArea final : public JSWidget<SalInstanceDrawingArea, VclDrawingArea> diff --git a/vcl/inc/qt5/QtInstanceCheckButton.hxx b/vcl/inc/qt5/QtInstanceCheckButton.hxx index ad4fbf2e0291..6c604e9e0483 100644 --- a/vcl/inc/qt5/QtInstanceCheckButton.hxx +++ b/vcl/inc/qt5/QtInstanceCheckButton.hxx @@ -23,7 +23,7 @@ class QtInstanceCheckButton : public QtInstanceWidget, public virtual weld::Chec public: QtInstanceCheckButton(QCheckBox* pCheckBox); - virtual void set_state(TriState eState) override; + virtual void do_set_state(TriState eState) override; virtual TriState get_state() const override; virtual void set_label(const OUString& rText) override; diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index c7add67d6fb5..6611f23b3aea 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -1226,7 +1226,7 @@ private: public: SalInstanceCheckButton(CheckBox* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership); - virtual void set_state(TriState eState) override; + virtual void do_set_state(TriState eState) override; virtual TriState get_state() const override; diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index add03c7c789f..8570f4d7922a 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -1554,10 +1554,10 @@ JSCheckButton::JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox, { } -void JSCheckButton::set_state(TriState eState) +void JSCheckButton::do_set_state(TriState eState) { TriState eOldState = get_state(); - SalInstanceCheckButton::set_state(eState); + SalInstanceCheckButton::do_set_state(eState); if (eOldState != eState) sendUpdate(); } diff --git a/vcl/qt5/QtInstanceCheckButton.cxx b/vcl/qt5/QtInstanceCheckButton.cxx index cdd5fb3e4571..9ef78ea14c25 100644 --- a/vcl/qt5/QtInstanceCheckButton.cxx +++ b/vcl/qt5/QtInstanceCheckButton.cxx @@ -20,7 +20,7 @@ QtInstanceCheckButton::QtInstanceCheckButton(QCheckBox* pCheckBox) connect(m_pCheckBox, &QCheckBox::toggled, this, &QtInstanceCheckButton::handleToggled); } -void QtInstanceCheckButton::set_state(TriState eState) +void QtInstanceCheckButton::do_set_state(TriState eState) { SolarMutexGuard g; GetQtInstance().RunInMainThread([&] { diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index b30010324209..d08ebff06792 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -3141,12 +3141,10 @@ SalInstanceCheckButton::SalInstanceCheckButton(CheckBox* pButton, SalInstanceBui m_xCheckButton->SetToggleHdl(LINK(this, SalInstanceCheckButton, ToggleHdl)); } -void SalInstanceCheckButton::set_state(TriState eState) +void SalInstanceCheckButton::do_set_state(TriState eState) { - disable_notify_events(); m_xCheckButton->EnableTriState(eState == TRISTATE_INDET); m_xCheckButton->SetState(eState); - enable_notify_events(); } TriState SalInstanceCheckButton::get_state() const { return m_xCheckButton->GetState(); } diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 80850e9885da..628c1517c70b 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -12492,7 +12492,7 @@ public: { } - virtual void set_state(TriState eState) override + virtual void do_set_state(TriState eState) override { disable_notify_events(); const bool bInconsistent = eState == TRISTATE_INDET; commit cc88fad299367a967e45b29d8593f727e43efce8 Author: Michael Weghorn <[email protected]> AuthorDate: Sat Oct 18 01:52:41 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Mon Oct 20 17:08:20 2025 +0200 tdf#130857 weld: Move signal blocking to Entry::select_region Apply the changes as described in Change-Id: If5fba408cc6638441e9856238b19659fed6d7e01 Author: Michael Weghorn <[email protected]> Date: Fri Oct 17 22:11:02 2025 +0200 tdf#130857 weld: Move signal blocking to TextView::select_region for this method as well. See the above-mentioned commit for more details/background. Change-Id: I1c4118b9dc63de5bb3d755cd629f38e1b4540a52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192629 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 11a03f4b819b..bd0da3708e3a 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -2021,6 +2021,7 @@ protected: } virtual void do_set_text(const OUString& rText) = 0; + virtual void do_select_region(int nStartPos, int nEndPos) = 0; virtual void do_set_position(int nCursorPos) = 0; public: @@ -2036,8 +2037,15 @@ public: virtual int get_width_chars() const = 0; // The maximum length of the entry. Use 0 for no maximum virtual void set_max_length(int nChars) = 0; + // nEndPos can be -1 in order to select all text - virtual void select_region(int nStartPos, int nEndPos) = 0; + void select_region(int nStartPos, int nEndPos) + { + disable_notify_events(); + do_select_region(nStartPos, nEndPos); + enable_notify_events(); + } + // returns true if the selection has nonzero length virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0; virtual void replace_selection(const OUString& rText) = 0; diff --git a/vcl/inc/qt5/QtInstanceEntry.hxx b/vcl/inc/qt5/QtInstanceEntry.hxx index 6fa19e1fd136..6e6c85a06c05 100644 --- a/vcl/inc/qt5/QtInstanceEntry.hxx +++ b/vcl/inc/qt5/QtInstanceEntry.hxx @@ -27,7 +27,7 @@ public: virtual void set_width_chars(int nChars) override; virtual int get_width_chars() const override; virtual void set_max_length(int nChars) override; - virtual void select_region(int nStartPos, int nEndPos) override; + virtual void do_select_region(int nStartPos, int nEndPos) override; virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) override; virtual void replace_selection(const OUString& rText) override; virtual void do_set_position(int nCursorPos) override; diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 1d626d2b35f3..c7add67d6fb5 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -618,7 +618,7 @@ public: virtual void set_max_length(int nChars) override; - virtual void select_region(int nStartPos, int nEndPos) override; + virtual void do_select_region(int nStartPos, int nEndPos) override; bool get_selection_bounds(int& rStartPos, int& rEndPos) override; diff --git a/vcl/qt5/QtInstanceEntry.cxx b/vcl/qt5/QtInstanceEntry.cxx index c765ada9e464..8fbbe2f94d85 100644 --- a/vcl/qt5/QtInstanceEntry.cxx +++ b/vcl/qt5/QtInstanceEntry.cxx @@ -57,7 +57,7 @@ void QtInstanceEntry::set_max_length(int nChars) GetQtInstance().RunInMainThread([&] { m_pLineEdit->setMaxLength(nChars); }); } -void QtInstanceEntry::select_region(int nStartPos, int nEndPos) +void QtInstanceEntry::do_select_region(int nStartPos, int nEndPos) { SolarMutexGuard g; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 31f07b81d3a1..b30010324209 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -3318,13 +3318,11 @@ int SalInstanceEntry::get_width_chars() const { return m_xEntry->GetWidthInChars void SalInstanceEntry::set_max_length(int nChars) { m_xEntry->SetMaxTextLen(nChars); } -void SalInstanceEntry::select_region(int nStartPos, int nEndPos) +void SalInstanceEntry::do_select_region(int nStartPos, int nEndPos) { - disable_notify_events(); tools::Long nStart = nStartPos < 0 ? SELECTION_MAX : nStartPos; tools::Long nEnd = nEndPos < 0 ? SELECTION_MAX : nEndPos; m_xEntry->SetSelection(Selection(nStart, nEnd)); - enable_notify_events(); } bool SalInstanceEntry::get_selection_bounds(int& rStartPos, int& rEndPos) diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 7700f89b4068..80850e9885da 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -13177,7 +13177,7 @@ public: enable_notify_events(); } - virtual void select_region(int nStartPos, int nEndPos) override + virtual void do_select_region(int nStartPos, int nEndPos) override { disable_notify_events(); gtk_editable_select_region(m_pEditable, nStartPos, nEndPos); commit 1beaa4bc6b049b9851eec1bf480c4247abbb7bae Author: Michael Weghorn <[email protected]> AuthorDate: Sat Oct 18 01:48:40 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Mon Oct 20 17:08:13 2025 +0200 tdf#130857 weld: Move signal blocking to Entry::set_position Apply the changes as described in Change-Id: If5fba408cc6638441e9856238b19659fed6d7e01 Author: Michael Weghorn <[email protected]> Date: Fri Oct 17 22:11:02 2025 +0200 tdf#130857 weld: Move signal blocking to TextView::select_region for this method as well. See the above-mentioned commit for more details/background. Change-Id: I55c85c8ca0bec770b6b6d598ea9934ade8ddd19f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192628 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index fc398fe4521b..11a03f4b819b 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -2021,6 +2021,7 @@ protected: } virtual void do_set_text(const OUString& rText) = 0; + virtual void do_set_position(int nCursorPos) = 0; public: void set_text(const OUString& rText) @@ -2040,8 +2041,15 @@ public: // returns true if the selection has nonzero length virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0; virtual void replace_selection(const OUString& rText) = 0; + // nCursorPos can be -1 to set to the end - virtual void set_position(int nCursorPos) = 0; + void set_position(int nCursorPos) + { + disable_notify_events(); + do_set_position(nCursorPos); + enable_notify_events(); + } + virtual int get_position() const = 0; virtual void set_editable(bool bEditable) = 0; virtual bool get_editable() const = 0; diff --git a/vcl/inc/qt5/QtInstanceEntry.hxx b/vcl/inc/qt5/QtInstanceEntry.hxx index 87a105c9b973..6fa19e1fd136 100644 --- a/vcl/inc/qt5/QtInstanceEntry.hxx +++ b/vcl/inc/qt5/QtInstanceEntry.hxx @@ -30,7 +30,7 @@ public: virtual void select_region(int nStartPos, int nEndPos) override; virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) override; virtual void replace_selection(const OUString& rText) override; - virtual void set_position(int nCursorPos) override; + virtual void do_set_position(int nCursorPos) override; virtual int get_position() const override; virtual void set_editable(bool bEditable) override; virtual bool get_editable() const override; diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 1fcdcf821452..1d626d2b35f3 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -624,7 +624,7 @@ public: virtual void replace_selection(const OUString& rText) override; - virtual void set_position(int nCursorPos) override; + virtual void do_set_position(int nCursorPos) override; virtual int get_position() const override; diff --git a/vcl/qt5/QtInstanceEntry.cxx b/vcl/qt5/QtInstanceEntry.cxx index 50086730e872..c765ada9e464 100644 --- a/vcl/qt5/QtInstanceEntry.cxx +++ b/vcl/qt5/QtInstanceEntry.cxx @@ -90,7 +90,7 @@ void QtInstanceEntry::replace_selection(const OUString& rText) GetQtInstance().RunInMainThread([&] { m_pLineEdit->insert(toQString(rText)); }); } -void QtInstanceEntry::set_position(int nCursorPos) +void QtInstanceEntry::do_set_position(int nCursorPos) { SolarMutexGuard g; if (nCursorPos == -1) diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 52dfe051fe53..31f07b81d3a1 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -3340,14 +3340,12 @@ void SalInstanceEntry::replace_selection(const OUString& rText) m_xEntry->ReplaceSelected(rText); } -void SalInstanceEntry::set_position(int nCursorPos) +void SalInstanceEntry::do_set_position(int nCursorPos) { - disable_notify_events(); if (nCursorPos < 0) m_xEntry->SetCursorAtLast(); else m_xEntry->SetSelection(Selection(nCursorPos, nCursorPos)); - enable_notify_events(); } int SalInstanceEntry::get_position() const { return m_xEntry->GetSelection().Max(); } diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 4767bfe0b268..7700f89b4068 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -13200,7 +13200,7 @@ public: enable_notify_events(); } - virtual void set_position(int nCursorPos) override + virtual void do_set_position(int nCursorPos) override { disable_notify_events(); gtk_editable_set_position(m_pEditable, nCursorPos);
