Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4214

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/14/4214/1

Rework code after OUString'ification

Change-Id: Ic93472b0621a13a777d37cfacc4230630f88a6ac
---
M sw/source/ui/docvw/edtwin.cxx
1 file changed, 11 insertions(+), 15 deletions(-)



diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index f0b1951..3aa3fe0 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -860,26 +860,25 @@
             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:
@@ -888,7 +887,6 @@
                     }
 
                     // 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();
@@ -897,13 +895,11 @@
                             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();
@@ -912,7 +908,7 @@
                 {
                     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:

-- 
To view, visit https://gerrit.libreoffice.org/4214
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic93472b0621a13a777d37cfacc4230630f88a6ac
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Matteo Casalin <matteo.casalin@yahoo.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.