[Libreoffice-commits] core.git: sw/source

Matteo Casalin matteo.casalin at yahoo.com
Wed Jun 19 08:07:50 PDT 2013


 sw/source/ui/docvw/edtwin.cxx |   26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

New commits:
commit 4bb1b555c533493799d780f18c1ab602677ef88a
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Jun 9 13:17:42 2013 +0200

    Rework code after OUString'ification
    
    Change-Id: Ic93472b0621a13a777d37cfacc4230630f88a6ac
    Reviewed-on: https://gerrit.libreoffice.org/4214
    Reviewed-by: Noel Power <noel.power at suse.com>
    Tested-by: Noel Power <noel.power at suse.com>

diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 60b7c8b..d72b270 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -861,26 +861,25 @@ void SwEditWin::FlushInBuffer()
             if (!rSh.GetCrsr()->HasMark())
                 rSh.GetCrsr()->SetMark();
             rSh.GetCrsr()->GetMark()->nContent = 0;
-            OUString aLeftText( rSh.GetCrsr()->GetTxt() );
+
+            const OUString aOldText( rSh.GetCrsr()->GetTxt() );
+            const sal_Int32 nOldLen = aOldText.getLength();
 
             SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions();
 
             xub_StrLen nExpandSelection = 0;
-            if (aLeftText.getLength() > 0)
+            if (nOldLen > 0)
             {
-                sal_Unicode cChar = '\0';
-
-                sal_Int32 nTmpPos = aLeftText.getLength();
+                sal_Int32 nTmpPos = nOldLen;
                 sal_Int16 nCheckMode = rCTLOptions.IsCTLSequenceCheckingRestricted() ?
                         i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC;
 
-                OUString aOldText( aLeftText );
                 OUString aNewText( aOldText );
                 if (rCTLOptions.IsCTLSequenceCheckingTypeAndReplace())
                 {
                     for (xub_StrLen k = 0;  k < m_aInBuffer.Len();  ++k)
                     {
-                        cChar = m_aInBuffer.GetChar(k);
+                        const sal_Unicode cChar = m_aInBuffer.GetChar(k);
                         const sal_Int32 nPrevPos =xISC->correctInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode );
 
                         // valid sequence or sequence could be corrected:
@@ -889,7 +888,6 @@ void SwEditWin::FlushInBuffer()
                     }
 
                     // find position of first character that has changed
-                    sal_Int32 nOldLen = aOldText.getLength();
                     sal_Int32 nNewLen = aNewText.getLength();
                     const sal_Unicode *pOldTxt = aOldText.getStr();
                     const sal_Unicode *pNewTxt = aNewText.getStr();
@@ -898,13 +896,11 @@ void SwEditWin::FlushInBuffer()
                             pOldTxt[nChgPos] == pNewTxt[nChgPos] )
                         ++nChgPos;
 
-                    xub_StrLen nChgLen = static_cast< xub_StrLen >(nNewLen - nChgPos);
-                    String aChgText( aNewText.copy( static_cast< xub_StrLen >(nChgPos), nChgLen ) );
-
-                    if (aChgText.Len())
+                    const sal_Int32 nChgLen = nNewLen - nChgPos;
+                    if (nChgLen)
                     {
-                        m_aInBuffer = aChgText;
-                        nExpandSelection = static_cast< xub_StrLen >(aLeftText.getLength() - nChgPos);
+                        m_aInBuffer = aNewText.copy( nChgPos, nChgLen );
+                        nExpandSelection = static_cast< xub_StrLen >(nOldLen - nChgPos);
                     }
                     else
                         m_aInBuffer.Erase();
@@ -913,7 +909,7 @@ void SwEditWin::FlushInBuffer()
                 {
                     for (xub_StrLen k = 0;  k < m_aInBuffer.Len();  ++k)
                     {
-                        cChar = m_aInBuffer.GetChar(k);
+                        const sal_Unicode cChar = m_aInBuffer.GetChar(k);
                         if (xISC->checkInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode ))
                         {
                             // character can be inserted:


More information about the Libreoffice-commits mailing list