diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2014-09-25 18:14:13 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-09-26 08:14:44 +0000 |
commit | 2b5cbaea8321b281be076b089c9de61742401401 (patch) | |
tree | 2a2df89c3ad4fb833bf8da2c12f8f11bca59be8f /cui/source | |
parent | 402bb706da7a43ee8c161cab5a5fc4d05b965051 (diff) |
fixed behavior of Writer's Special Character dialog
before: the character is inserted at the end
after: The character will be inserted where the cursor is or will replace the selected string.
Change-Id: If5f7cac24c98a9105c38864da5a4c6363a35a834
Reviewed-on: https://gerrit.libreoffice.org/11642
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/dialogs/cuicharmap.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx index 5227bcf92cfb..2d46a7947890 100644 --- a/cui/source/dialogs/cuicharmap.cxx +++ b/cui/source/dialogs/cuicharmap.cxx @@ -52,6 +52,7 @@ SvxCharacterMap::SvxCharacterMap( vcl::Window* pParent, bool bOne_, const SfxIte get(m_pShowChar, "showchar"); m_pShowChar->SetCentered(true); get(m_pShowText, "showtext"); + m_pShowText->SetMaxTextLen(CHARMAP_MAXLEN); get(m_pOKBtn, "ok"); get(m_pFontText, "fontft"); get(m_pFontLB, "fontlb"); @@ -507,13 +508,25 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharSelectHdl) if ( !bOne ) { OUString aText = m_pShowText->GetText(); + Selection aSelection = m_pShowText->GetSelection(); + aSelection.Justify(); + long nLen = aSelection.Len(); - if ( aText.getLength() != CHARMAP_MAXLEN ) + if ( aText.getLength() != CHARMAP_MAXLEN || nLen > 0 ) { sal_UCS4 cChar = m_pShowSet->GetSelectCharacter(); // using the new UCS4 constructor OUString aOUStr( &cChar, 1 ); - m_pShowText->SetText( aText + aOUStr ); + + long nPos = aSelection.Min(); + if( aText.getLength() ) + { + m_pShowText->SetText( aText.copy( 0, nPos ) + aOUStr + aText.copy( nPos + nLen ) ); + } + else + m_pShowText->SetText( aOUStr ); + + m_pShowText->SetSelection( Selection( nPos + 1 ) ); } } |