[Libreoffice-commits] core.git: svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jan 27 12:38:38 UTC 2021
svx/source/tbxctrls/tbcontrl.cxx | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
New commits:
commit d759009fd85c4e17dc7d482a84e22510e7949f16
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 26 20:44:50 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jan 27 13:37:55 2021 +0100
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 at redhat.com>
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)
More information about the Libreoffice-commits
mailing list