summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-01-26 20:44:50 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-01-27 13:37:55 +0100
commitd759009fd85c4e17dc7d482a84e22510e7949f16 (patch)
tree80973d58c8c5eb045bccbe3bd90801218e617fba
parenta9fb193b1dce89e45522e2c68b1b839017facea8 (diff)
tdf#138590 use the highlighted menu entry, not the combobox active text
Change-Id: I2fb68c1491d129d5fd9b963ae4db1fb83171a154 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109996 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 2679f0c7c839..82d12985486a 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -206,6 +206,7 @@ protected:
SfxStyleFamily eStyleFamily;
int m_nMaxUserDrawFontWidth;
+ int m_nLastItemWithMenu;
bool bRelease;
Reference< XDispatchProvider > m_xDispatchProvider;
Reference< XFrame > m_xFrame;
@@ -843,6 +844,7 @@ SvxStyleBox_Base::SvxStyleBox_Base(std::unique_ptr<weld::ComboBox> xWidget,
, m_xWidget(std::move(xWidget))
, eStyleFamily( eFamily )
, m_nMaxUserDrawFontWidth(0)
+ , m_nLastItemWithMenu(-1)
, bRelease( true )
, m_xDispatchProvider( rDispatchProvider )
, m_xFrame(_xFrame)
@@ -904,7 +906,10 @@ void SvxStyleBox_Base::ReleaseFocus()
IMPL_LINK(SvxStyleBox_Base, MenuSelectHdl, const OString&, rMenuIdent, void)
{
- OUString sEntry = m_xWidget->get_active_text();
+ if (m_nLastItemWithMenu < 0 || m_nLastItemWithMenu >= m_xWidget->get_count())
+ return;
+
+ OUString sEntry = m_xWidget->get_text(m_nLastItemWithMenu);
ReleaseFocus(); // It must be after getting entry pos!
Sequence<PropertyValue> aArgs(2);
@@ -1140,7 +1145,10 @@ void SvxStyleBox_Base::SetupEntry(vcl::RenderContext& rRenderContext, sal_Int32
if (nItem == 0 || nItem == m_xWidget->get_count() - 1)
m_xWidget->set_item_menu(OString::number(nItem), nullptr);
else
+ {
+ m_nLastItemWithMenu = nItem;
m_xWidget->set_item_menu(OString::number(nItem), m_xMenu.get());
+ }
}
if (nItem <= 0 || nItem >= m_xWidget->get_count() - 1)