summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-02-12 23:47:21 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-02-13 09:57:16 +0000
commite0f22bb1db655d86923c16e5c2f7d84489d7a63e (patch)
treea069b55555d3dc0cfc6504e5e509906729cccd92 /svx
parent600d6eda0028a7b4927547970a9d683a1437e4c8 (diff)
Resolves: tdf#81429 select corresponding listbox entry if not current
Change-Id: Ib475a43601ee22d33677ac45cd6ef9dba7e7c431 (cherry picked from commit a448f1bb9221f30f73574c580b506e00bf2ae61a) Reviewed-on: https://gerrit.libreoffice.org/14457 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/langbox.cxx24
1 files changed, 16 insertions, 8 deletions
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index e8a0128c86db..39cff157d5ec 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -716,21 +716,29 @@ IMPL_LINK( SvxLanguageComboBox, EditModifyHdl, SvxLanguageComboBox*, /*pEd*/ )
const sal_Int32 nPos = GetEntryPos( aStr);
if (nPos != COMBOBOX_ENTRY_NOTFOUND)
{
- // Advance start of full selection by one so the next character
- // will already continue the string instead of having to type the
- // same character again to start a new string. The selection
- // includes formatting characters and is reverse when obtained from
- // the Edit control.
Selection aSel( GetSelection());
+
+ // Select the corresponding listbox entry if not current. This
+ // invalidates the Edit Selection thus has to happen between
+ // obtaining the Selection and setting the new Selection.
+ sal_Int32 nSelPos = ImplGetSelectEntryPos();
+ if (nSelPos != nPos)
+ ImplSelectEntryPos( nPos, true);
+
+ // If typing into the Edit control led us here, advance start of a
+ // full selection by one so the next character will already
+ // continue the string instead of having to type the same character
+ // again to start a new string. The selection includes formatting
+ // characters and is reverse when obtained from the Edit control.
if (aSel.Max() == 1)
{
OUString aText( GetText());
if (aSel.Min() == aText.getLength())
- {
++aSel.Max();
- SetSelection( aSel);
- }
}
+
+ SetSelection( aSel);
+
meEditedAndValid = EDITED_NO;
}
else