[Libreoffice-commits] core.git: cui/source
Szymon KÅos
eszkadev at gmail.com
Fri Sep 26 01:15:16 PDT 2014
cui/source/dialogs/cuicharmap.cxx | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
New commits:
commit 2b5cbaea8321b281be076b089c9de61742401401
Author: Szymon KÅos <eszkadev at gmail.com>
Date: Thu Sep 25 18:14:13 2014 +0200
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 at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index 5227bcf..2d46a79 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 ) );
}
}
More information about the Libreoffice-commits
mailing list