incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject svn commit: r1346922 - in /incubator/ooo/branches/AOO34: ./ main/ main/i18npool/source/search/textsearch.cxx main/sw/source/core/crsr/findtxt.cxx
Date Wed, 06 Jun 2012 14:47:02 GMT
Author: hdu
Date: Wed Jun  6 14:47:01 2012
New Revision: 1346922

URL: http://svn.apache.org/viewvc?rev=1346922&view=rev
Log:
#i118925# enhance textsearch's match-group references to work for look-ahead/look-behind

Patch By: Herbert Duerr
Found By: Tsutomu Uchino

Modified:
    incubator/ooo/branches/AOO34/   (props changed)
    incubator/ooo/branches/AOO34/main/   (props changed)
    incubator/ooo/branches/AOO34/main/i18npool/source/search/textsearch.cxx
    incubator/ooo/branches/AOO34/main/sw/source/core/crsr/findtxt.cxx

Propchange: incubator/ooo/branches/AOO34/
------------------------------------------------------------------------------
  Merged /incubator/ooo/trunk:r1336023,1336210,1338635,1346850

Propchange: incubator/ooo/branches/AOO34/main/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Jun  6 14:47:01 2012
@@ -0,0 +1,4 @@
+/incubator/ooo/branches/alg/linecap/main:1226811-1232461
+/incubator/ooo/branches/alg/svgreplacement/main:1205420-1220782
+/incubator/ooo/trunk:1336210
+/incubator/ooo/trunk/main:1336023,1336210,1338635,1346850

Modified: incubator/ooo/branches/AOO34/main/i18npool/source/search/textsearch.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/i18npool/source/search/textsearch.cxx?rev=1346922&r1=1346921&r2=1346922&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/i18npool/source/search/textsearch.cxx (original)
+++ incubator/ooo/branches/AOO34/main/i18npool/source/search/textsearch.cxx Wed Jun  6 14:47:01
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/branches/AOO34/main/sw/source/core/crsr/findtxt.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/sw/source/core/crsr/findtxt.cxx?rev=1346922&r1=1346921&r2=1346922&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/sw/source/core/crsr/findtxt.cxx (original)
+++ incubator/ooo/branches/AOO34/main/sw/source/core/crsr/findtxt.cxx Wed Jun  6 14:47:01
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<const SwTxtNode*>(pTxtNode))->GetTxt().Len()
)
-            {
-                aStr.Insert( sX );
-                bDeleteLastX = true;
-            }
+            const String& rStr = static_cast<const SwTxtNode*>(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;
 }
-
-



Mime
View raw message