[Libreoffice-commits] core.git: cui/source include/svtools svtools/source svx/source vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Mar 9 12:26:34 UTC 2020
cui/source/tabpages/chardlg.cxx | 2 +-
include/svtools/ctrlbox.hxx | 2 +-
svtools/source/control/ctrlbox.cxx | 8 ++++++--
svx/source/tbxctrls/tbunocontroller.cxx | 10 +++++-----
vcl/source/app/salvtables.cxx | 2 +-
5 files changed, 14 insertions(+), 10 deletions(-)
New commits:
commit 633b2f4dffedaf4a162a5fa92eeaeb509efab173
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Mar 9 10:26:54 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Mar 9 13:25:56 2020 +0100
save/restore the entry text of the fontsize widget
instead of its value, because the min value is 2, but we set
empty text to indicate multiple values are selected in the underlying
text.
Change-Id: If4232b500cd177a264aa5e6ca0537021483db95f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90208
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index c6e4340be1bb..d8ab1aa1e9d1 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -766,7 +766,7 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp
}
else
{
- pSizeBox->set_active_text( OUString() );
+ pSizeBox->set_entry_text( OUString() );
if ( eState <= SfxItemState::READONLY )
{
pSizeBox->set_sensitive(false);
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index 66a9a73cd988..60f1ab0510dc 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -438,7 +438,7 @@ public:
void connect_focus_out(const Link<weld::Widget&, void>& rLink) { m_aFocusOutHdl = rLink; }
void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_xComboBox->connect_key_press(rLink); }
OUString get_active_text() const { return m_xComboBox->get_active_text(); }
- void set_active_text(const OUString& rText) { m_xComboBox->set_active_text(rText); }
+ void set_entry_text(const OUString& rText);
void set_sensitive(bool bSensitive) { m_xComboBox->set_sensitive(bSensitive); }
int get_active() const { return m_xComboBox->get_active(); }
int get_value() const;
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 04b586a82253..4ad49c2fc976 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -868,6 +868,11 @@ FontSizeBox::FontSizeBox(std::unique_ptr<weld::ComboBox> p)
m_xComboBox->connect_changed(LINK(this, FontSizeBox, ModifyHdl));
}
+void FontSizeBox::set_entry_text(const OUString& rText)
+{
+ m_xComboBox->set_entry_text(rText);
+}
+
IMPL_LINK(FontSizeBox, ReformatHdl, weld::Widget&, rWidget, void)
{
FontSizeNames aFontSizeNames(Application::GetSettings().GetUILanguageTag().getLanguageType());
@@ -1157,8 +1162,7 @@ void FontSizeBox::SetValue(int nNewValue, FieldUnit eInUnit)
const int nFound = m_xComboBox->find_text(aResult);
if (nFound != -1)
m_xComboBox->set_active(nFound);
- else
- m_xComboBox->set_entry_text(aResult);
+ m_xComboBox->set_entry_text(aResult);
}
void FontSizeBox::set_value(int nNewValue)
diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx
index e7a937ed79a9..717bb13fab6d 100644
--- a/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -133,7 +133,7 @@ SvxFontSizeBox_Impl::SvxFontSizeBox_Impl(
m_xWidget(new FontSizeBox(m_xBuilder->weld_combo_box("fontsizecombobox")))
{
m_xWidget->set_value(0);
- m_xWidget->set_active_text("");
+ m_xWidget->set_entry_text("");
m_xWidget->disable_entry_completion();
m_xWidget->connect_changed(LINK(this, SvxFontSizeBox_Impl, SelectHdl));
@@ -217,9 +217,9 @@ void SvxFontSizeBox_Impl::statusChanged_Impl( long nPoint, bool bErase )
{
// delete value in the display
m_xWidget->set_value(-1L);
- m_xWidget->set_active_text("");
+ m_xWidget->set_entry_text("");
}
- m_xWidget->save_value();
+ m_aCurText = m_xWidget->get_active_text();
}
void SvxFontSizeBox_Impl::UpdateFont( const css::awt::FontDescriptor& rCurrentFont )
@@ -260,7 +260,7 @@ IMPL_LINK(SvxFontSizeBox_Impl, KeyInputHdl, const KeyEvent&, rKEvt, bool)
break;
case KEY_ESCAPE:
- m_xWidget->set_active_text(m_aCurText);
+ m_xWidget->set_entry_text(m_aCurText);
if ( typeid( *GetParent() ) != typeid( sfx2::sidebar::SidebarToolBox ) )
ReleaseFocus_Impl();
bHandled = true;
@@ -273,7 +273,7 @@ IMPL_LINK(SvxFontSizeBox_Impl, KeyInputHdl, const KeyEvent&, rKEvt, bool)
IMPL_LINK_NOARG(SvxFontSizeBox_Impl, FocusOutHdl, weld::Widget&, void)
{
if (!m_xWidget->has_focus()) // a combobox can be comprised of different subwidget so double-check if none of those has focus
- m_xWidget->set_value(m_xWidget->get_saved_value());
+ m_xWidget->set_entry_text(m_aCurText);
}
void SvxFontSizeBox_Impl::SetOptimalSize()
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 1d5683a7d392..5fa320af8dbc 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5881,7 +5881,7 @@ public:
virtual bool changed_by_direct_pick() const override
{
- return m_bInSelect && !m_xComboBox->IsModifyByKeyboard();
+ return m_bInSelect && !m_xComboBox->IsModifyByKeyboard() && !m_xComboBox->IsTravelSelect();
}
virtual void set_entry_message_type(weld::EntryMessageType eType) override
More information about the Libreoffice-commits
mailing list