Return-Path: X-Original-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E3EF690AE for ; Wed, 9 May 2012 13:57:44 +0000 (UTC) Received: (qmail 47983 invoked by uid 500); 9 May 2012 13:57:44 -0000 Delivered-To: apmail-incubator-ooo-commits-archive@incubator.apache.org Received: (qmail 47946 invoked by uid 500); 9 May 2012 13:57:44 -0000 Mailing-List: contact ooo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ooo-dev@incubator.apache.org Delivered-To: mailing list ooo-commits@incubator.apache.org Received: (qmail 47939 invoked by uid 99); 9 May 2012 13:57:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 13:57:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 13:57:42 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 921332388978; Wed, 9 May 2012 13:57:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1336210 - in /incubator/ooo/trunk/main: i18npool/source/search/textsearch.cxx sw/source/core/crsr/findtxt.cxx Date: Wed, 09 May 2012 13:57:20 -0000 To: ooo-commits@incubator.apache.org From: hdu@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120509135720.921332388978@eris.apache.org> Author: hdu Date: Wed May 9 13:57:20 2012 New Revision: 1336210 URL: http://svn.apache.org/viewvc?rev=1336210&view=rev Log: #i118925# enhance textsearch's match-group references to work for look-ahead/look-behind Modified: incubator/ooo/trunk/main/i18npool/source/search/textsearch.cxx incubator/ooo/trunk/main/sw/source/core/crsr/findtxt.cxx Modified: incubator/ooo/trunk/main/i18npool/source/search/textsearch.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/i18npool/source/search/textsearch.cxx?rev=1336210&r1=1336209&r2=1336210&view=diff ============================================================================== --- incubator/ooo/trunk/main/i18npool/source/search/textsearch.cxx (original) +++ incubator/ooo/trunk/main/i18npool/source/search/textsearch.cxx Wed May 9 13:57:20 2012 @@ -752,7 +752,7 @@ SearchResult TextSearch::RESrchFrwrd( co // use the ICU RegexMatcher to find the matches UErrorCode nIcuErr = U_ZERO_ERROR; - const IcuUniString aSearchTargetStr( (const UChar*)searchStr.getStr(), endPos); + const IcuUniString aSearchTargetStr( (const UChar*)searchStr.getStr(), searchStr.getLength()); pRegexMatcher->reset( aSearchTargetStr); // search until there is a valid match for(;;) Modified: incubator/ooo/trunk/main/sw/source/core/crsr/findtxt.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/crsr/findtxt.cxx?rev=1336210&r1=1336209&r2=1336210&view=diff ============================================================================== --- incubator/ooo/trunk/main/sw/source/core/crsr/findtxt.cxx (original) +++ incubator/ooo/trunk/main/sw/source/core/crsr/findtxt.cxx Wed May 9 13:57:20 2012 @@ -676,36 +676,17 @@ String *ReplaceBackReferences( const Sea if( pTxtNode && pTxtNode->IsTxtNode() && pTxtNode == pPam->GetCntntNode( sal_False ) ) { utl::TextSearch aSTxt( rSearchOpt ); - String aStr( pPam->GetTxt() ); - String aSearchStr( rSearchOpt.searchString ); - String aReplaceStr( rSearchOpt.replaceString ); - aStr.EraseAllChars( CH_TXTATR_BREAKWORD ); - aStr.EraseAllChars( CH_TXTATR_INWORD ); - xub_StrLen nStart = 0; - String sX( 'x' ); - if( pPam->Start()->nContent > 0 ) - { - aStr.Insert( sX, 0 ); - ++nStart; - } - xub_StrLen nEnd = aStr.Len(); - bool bDeleteLastX = false; - if( pPam->End()->nContent < (static_cast(pTxtNode))->GetTxt().Len() ) - { - aStr.Insert( sX ); - bDeleteLastX = true; - } + const String& rStr = static_cast(pTxtNode)->GetTxt(); + xub_StrLen nStart = pPam->Start()->nContent.GetIndex(); + xub_StrLen nEnd = pPam->End()->nContent.GetIndex(); SearchResult aResult; - if( aSTxt.SearchFrwrd( aStr, &nStart, &nEnd, &aResult ) ) + if( aSTxt.SearchFrwrd( rStr, &nStart, &nEnd, &aResult ) ) { - if( bDeleteLastX ) - aStr.Erase( aStr.Len() - 1 ); - aSTxt.ReplaceBackReferences( aReplaceStr, aStr, aResult ); + String aReplaceStr( rSearchOpt.replaceString ); + aSTxt.ReplaceBackReferences( aReplaceStr, rStr, aResult ); pRet = new String( aReplaceStr ); } } } return pRet; } - -