summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-03-09 10:26:54 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-03-09 13:25:56 +0100
commit633b2f4dffedaf4a162a5fa92eeaeb509efab173 (patch)
tree56b0ee015b834444da703fb7779d4b171c22c5a1
parentad85d0503bdce3f4a7f8be3dc571343f5b7afdc6 (diff)
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@redhat.com>
-rw-r--r--cui/source/tabpages/chardlg.cxx2
-rw-r--r--include/svtools/ctrlbox.hxx2
-rw-r--r--svtools/source/control/ctrlbox.cxx8
-rw-r--r--svx/source/tbxctrls/tbunocontroller.cxx10
-rw-r--r--vcl/source/app/salvtables.cxx2
5 files changed, 14 insertions, 10 deletions
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