diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-04-25 15:55:31 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-04-27 13:20:00 +0200 |
commit | 2b223e0a1ed529b95f095725b356f5fa91551209 (patch) | |
tree | 29a4798c9c5dd884e3e7a7a63f6493d3fd1743cf /svtools | |
parent | e9786a1439db437cc378f426c7cb496db20959fd (diff) |
Resolves: tdf#141441 get and set selected entry when "unfrozen"
Change-Id: I4229460fb27ae3dc133c0f6a53c7792a87bf4db3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133396
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 72b995d5ad83..0b1c67e31980 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -844,9 +844,10 @@ FontStyleBox::FontStyleBox(std::unique_ptr<weld::ComboBox> p) void FontStyleBox::Fill( const OUString& rName, const FontList* pList ) { - m_xComboBox->freeze(); OUString aOldText = m_xComboBox->get_active_text(); int nPos = m_xComboBox->get_active(); + + m_xComboBox->freeze(); m_xComboBox->clear(); // does a font with this name already exist? @@ -949,19 +950,6 @@ void FontStyleBox::Fill( const OUString& rName, const FontList* pList ) if ( bNormal || bItalic || bBold ) m_xComboBox->append_text(pList->GetBoldItalicStr()); } - if (!aOldText.isEmpty()) - { - int nFound = m_xComboBox->find_text(aOldText); - if (nFound != -1) - m_xComboBox->set_active(nFound); - else - { - if (nPos >= m_xComboBox->get_count()) - m_xComboBox->set_active(0); - else - m_xComboBox->set_active(nPos); - } - } } else { @@ -970,7 +958,16 @@ void FontStyleBox::Fill( const OUString& rName, const FontList* pList ) m_xComboBox->append_text(pList->GetItalicStr()); m_xComboBox->append_text(pList->GetBoldStr()); m_xComboBox->append_text(pList->GetBoldItalicStr()); - if (!aOldText.isEmpty()) + } + + m_xComboBox->thaw(); + + if (!aOldText.isEmpty()) + { + int nFound = m_xComboBox->find_text(aOldText); + if (nFound != -1) + m_xComboBox->set_active(nFound); + else { if (nPos >= m_xComboBox->get_count()) m_xComboBox->set_active(0); @@ -978,7 +975,6 @@ void FontStyleBox::Fill( const OUString& rName, const FontList* pList ) m_xComboBox->set_active(nPos); } } - m_xComboBox->thaw(); } FontSizeBox::FontSizeBox(std::unique_ptr<weld::ComboBox> p) |