diff options
-rw-r--r-- | basctl/source/basicide/IDEComboBox.cxx | 2 | ||||
-rw-r--r-- | include/vcl/combobox.hxx | 13 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 6 | ||||
-rw-r--r-- | sfx2/source/inet/inettbc.cxx | 2 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbunocontroller.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/workctrl.cxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 17 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 19 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 4 |
9 files changed, 45 insertions, 22 deletions
diff --git a/basctl/source/basicide/IDEComboBox.cxx b/basctl/source/basicide/IDEComboBox.cxx index 5279861365d1..b748577e9c63 100644 --- a/basctl/source/basicide/IDEComboBox.cxx +++ b/basctl/source/basicide/IDEComboBox.cxx @@ -300,7 +300,7 @@ IMPL_LINK_NOARG(LibBox, FocusOutHdl, weld::Widget&, void) void LibBox::Select() { - if (m_xWidget->changed_by_menu()) + if (m_xWidget->changed_by_direct_pick()) { if (!mbIgnoreSelect) NotifyIDE(); diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx index f2f96dca1b37..aae2ce719624 100644 --- a/include/vcl/combobox.hxx +++ b/include/vcl/combobox.hxx @@ -152,8 +152,17 @@ public: void SetNoSelection(); tools::Rectangle GetBoundingRectangle( sal_Int32 nItem ) const; - // determine if Select was called due to something selected from the menu - bool IsModifyByMenu() const; + // determine if Select was called due to typing or cursoring in the + // combobox, as opposed to something selected from the menu or via some + // other route. e.g. the toolbar fontsize combobox wants to immediately + // change size only if something is picked from the combobox menu, other + // changes don't auto-apply until the user presses return + bool IsModifyByKeyboard() const; + + // determine if Edit::Modify was called due to the ComboBox changing the edit area + // itself + bool IsSyntheticModify() const; + /** checks whether a certain point lies within the bounds of a list item and returns the item as well as the character position diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index a98563a9680f..0c9e4af7e893 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -654,12 +654,12 @@ public: to the user selecting a different item from the list or while typing into the entry of a combo box with an entry. - Use changed_by_menu() to discover whether an item was actually selected - from the menu. + Use changed_by_direct_pick() to discover whether an item was actually explicitly + selected, e.g. from the menu. */ void connect_changed(const Link<ComboBox&, void>& rLink) { m_aChangeHdl = rLink; } - virtual bool changed_by_menu() const = 0; + virtual bool changed_by_direct_pick() const = 0; virtual void connect_popup_toggled(const Link<ComboBox&, void>& rLink) { diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index ee5adc326ee3..3193100c5f7c 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -207,7 +207,7 @@ IMPL_LINK(SfxURLToolBoxControl_Impl, SelectHdl, weld::ComboBox&, rComboBox, void SvtURLBox* pURLBox = GetURLBox(); OUString aName( pURLBox->GetURL() ); - if (rComboBox.changed_by_menu() && !aName.isEmpty()) + if (rComboBox.changed_by_direct_pick() && !aName.isEmpty()) OpenURL( aName ); } diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index 22e78a397a79..e7a937ed79a9 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -175,7 +175,7 @@ void SvxFontSizeBox_Impl::ReleaseFocus_Impl() IMPL_LINK(SvxFontSizeBox_Impl, SelectHdl, weld::ComboBox&, rCombo, void) { - if (rCombo.changed_by_menu()) // only when picked from the list + if (rCombo.changed_by_direct_pick()) // only when picked from the list Select(); } diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index e60ce29a0c03..0886e3a7ff5c 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -616,7 +616,7 @@ SwZoomBox_Impl::SwZoomBox_Impl(vcl::Window* pParent, sal_uInt16 nSlot) IMPL_LINK(SwZoomBox_Impl, SelectHdl, weld::ComboBox&, rComboBox, void) { - if (rComboBox.changed_by_menu()) // only when picked from the list + if (rComboBox.changed_by_direct_pick()) // only when picked from the list Select(); } diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 942aa3e9d928..f77d986eb0d5 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -6166,7 +6166,7 @@ public: return false; } - virtual bool changed_by_menu() const override + virtual bool changed_by_direct_pick() const override { return true; } @@ -6227,6 +6227,7 @@ class SalInstanceComboBoxWithEdit : public SalInstanceComboBox<ComboBox> private: DECL_LINK(ChangeHdl, Edit&, void); DECL_LINK(EntryActivateHdl, Edit&, bool); + DECL_LINK(SelectHdl, ::ComboBox&, void); WeldTextFilter m_aTextFilter; public: SalInstanceComboBoxWithEdit(::ComboBox* pComboBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership) @@ -6234,6 +6235,7 @@ public: , m_aTextFilter(m_aEntryInsertTextHdl) { m_xComboBox->SetModifyHdl(LINK(this, SalInstanceComboBoxWithEdit, ChangeHdl)); + m_xComboBox->SetSelectHdl(LINK(this, SalInstanceComboBoxWithEdit, SelectHdl)); m_xComboBox->SetEntryActivateHdl(LINK(this, SalInstanceComboBoxWithEdit, EntryActivateHdl)); m_xComboBox->SetTextFilter(&m_aTextFilter); } @@ -6243,9 +6245,9 @@ public: return true; } - virtual bool changed_by_menu() const override + virtual bool changed_by_direct_pick() const override { - return m_xComboBox->IsModifyByMenu(); // && !m_xComboBox->IsTravelSelect(); + return !m_xComboBox->IsModifyByKeyboard(); } virtual void set_entry_message_type(weld::EntryMessageType eType) override @@ -6329,6 +6331,7 @@ public: m_xComboBox->SetTextFilter(nullptr); m_xComboBox->SetEntryActivateHdl(Link<Edit&, bool>()); m_xComboBox->SetModifyHdl(Link<Edit&, void>()); + m_xComboBox->SetSelectHdl(Link<::ComboBox&, void>()); } }; @@ -6336,6 +6339,12 @@ public: IMPL_LINK_NOARG(SalInstanceComboBoxWithEdit, ChangeHdl, Edit&, void) { + if (!m_xComboBox->IsSyntheticModify()) // SelectHdl will be called + signal_changed(); +} + +IMPL_LINK_NOARG(SalInstanceComboBoxWithEdit, SelectHdl, ::ComboBox&, void) +{ signal_changed(); } @@ -6398,7 +6407,7 @@ public: m_xEntry->connect_focus_out(rLink); } - virtual bool changed_by_menu() const override + virtual bool changed_by_direct_pick() const override { return m_bTreeChange; } diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index c42ef08e8e38..03b44f36e880 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -57,7 +57,7 @@ struct ComboBox::Impl sal_Unicode m_cMultiSep; bool m_isDDAutoSize : 1; bool m_isSyntheticModify : 1; - bool m_isMenuModify : 1; + bool m_isKeyBoardModify : 1; bool m_isMatchCase : 1; sal_Int32 m_nMaxWidthChars; sal_Int32 m_nWidthInChars; @@ -70,7 +70,7 @@ struct ComboBox::Impl , m_cMultiSep(0) , m_isDDAutoSize(false) , m_isSyntheticModify(false) - , m_isMenuModify(false) + , m_isKeyBoardModify(false) , m_isMatchCase(false) , m_nMaxWidthChars(0) , m_nWidthInChars(-1) @@ -144,7 +144,7 @@ void ComboBox::Impl::ImplInitComboBoxData() m_nDDHeight = 0; m_isDDAutoSize = true; m_isSyntheticModify = false; - m_isMenuModify = false; + m_isKeyBoardModify = false; m_isMatchCase = false; m_cMultiSep = ';'; m_nMaxWidthChars = -1; @@ -434,19 +434,24 @@ IMPL_LINK_NOARG(ComboBox::Impl, ImplSelectHdl, LinkParamNone*, void) if ( bCallSelect ) { + m_isKeyBoardModify = !bMenuSelect; m_pSubEdit->SetModifyFlag(); m_isSyntheticModify = true; - m_isMenuModify = bMenuSelect; m_rThis.Modify(); - m_isMenuModify = false; m_isSyntheticModify = false; m_rThis.Select(); + m_isKeyBoardModify = false; } } -bool ComboBox::IsModifyByMenu() const +bool ComboBox::IsSyntheticModify() const { - return m_pImpl->m_isMenuModify; + return m_pImpl->m_isSyntheticModify; +} + +bool ComboBox::IsModifyByKeyboard() const +{ + return m_pImpl->m_isKeyBoardModify; } IMPL_LINK_NOARG( ComboBox::Impl, ImplListItemSelectHdl, LinkParamNone*, void ) diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 342658c0de74..177dfc7c5674 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -12645,7 +12645,7 @@ public: return gtk_widget_has_focus(m_pToggleButton) || GtkInstanceWidget::has_focus(); } - virtual bool changed_by_menu() const override + virtual bool changed_by_direct_pick() const override { return m_bChangedByMenu; } @@ -12870,7 +12870,7 @@ public: GtkInstanceContainer::disable_notify_events(); } - virtual bool changed_by_menu() const override + virtual bool changed_by_direct_pick() const override { return m_bTreeChange; } |