summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Meies <fme@openoffice.org>2002-08-02 08:58:02 +0000
committerFrank Meies <fme@openoffice.org>2002-08-02 08:58:02 +0000
commit6fad3899ea642fecf0eb2096569def3e7ce2ae2c (patch)
tree658576ab04cc50fb6b1b267f486502afc14e8ea5
parent98c935aad13d7f66cde0f0371bbc294bf27a8767 (diff)
#100447# Consider different scripts for similarity search
-rw-r--r--sw/inc/txatritr.hxx8
-rw-r--r--sw/source/core/txtnode/txatritr.cxx40
2 files changed, 34 insertions, 14 deletions
diff --git a/sw/inc/txatritr.hxx b/sw/inc/txatritr.hxx
index e86ec8d7949e..f238687cba8f 100644
--- a/sw/inc/txatritr.hxx
+++ b/sw/inc/txatritr.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txatritr.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jp $ $Date: 2001-02-21 12:47:58 $
+ * last change: $Author: fme $ $Date: 2002-08-02 09:56:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,9 +82,11 @@ class SwScriptIterator
const String& rText;
xub_StrLen nChgPos;
sal_uInt16 nCurScript;
+ sal_Bool bForward;
public:
- SwScriptIterator( const String& rStr, xub_StrLen nStart = 0 );
+ SwScriptIterator( const String& rStr, xub_StrLen nStart = 0,
+ sal_Bool bFrwrd = sal_True );
sal_Bool Next();
diff --git a/sw/source/core/txtnode/txatritr.cxx b/sw/source/core/txtnode/txatritr.cxx
index b532ed1ed52e..b6866e30c335 100644
--- a/sw/source/core/txtnode/txatritr.cxx
+++ b/sw/source/core/txtnode/txatritr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txatritr.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: os $ $Date: 2002-02-07 14:26:06 $
+ * last change: $Author: fme $ $Date: 2002-08-02 09:53:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -101,11 +101,17 @@
using namespace ::com::sun::star::i18n;
-SwScriptIterator::SwScriptIterator( const String& rStr, xub_StrLen nStt )
- : rText( rStr ), nChgPos( rStr.Len() ), nCurScript( ScriptType::WEAK )
+SwScriptIterator::SwScriptIterator( const String& rStr, xub_StrLen nStt, sal_Bool bFrwrd )
+ : rText( rStr ),
+ nChgPos( rStr.Len() ),
+ nCurScript( ScriptType::WEAK ),
+ bForward( bFrwrd )
{
if( pBreakIt->xBreak.is() )
{
+ if ( ! bFrwrd && nStt )
+ --nStt;
+
xub_StrLen nPos = nStt;
nCurScript = pBreakIt->xBreak->getScriptType( rText, nPos );
if( ScriptType::WEAK == nCurScript )
@@ -122,20 +128,32 @@ SwScriptIterator::SwScriptIterator( const String& rStr, xub_StrLen nStt )
}
}
- nChgPos = (xub_StrLen)pBreakIt->xBreak->endOfScript(
- rText, nStt, nCurScript );
+ nChgPos = bForward ?
+ (xub_StrLen)pBreakIt->xBreak->endOfScript( rText, nStt, nCurScript ) :
+ (xub_StrLen)pBreakIt->xBreak->beginOfScript( rText, nStt, nCurScript );
}
}
sal_Bool SwScriptIterator::Next()
{
sal_Bool bRet = sal_False;
- if( pBreakIt->xBreak.is() && nChgPos < rText.Len() )
+ if( pBreakIt->xBreak.is() )
{
- nCurScript = pBreakIt->xBreak->getScriptType( rText, nChgPos );
- nChgPos = (xub_StrLen)pBreakIt->xBreak->endOfScript(
- rText, nChgPos, nCurScript );
- bRet = sal_True;
+ if ( bForward && nChgPos < rText.Len() )
+ {
+ nCurScript = pBreakIt->xBreak->getScriptType( rText, nChgPos );
+ nChgPos = (xub_StrLen)pBreakIt->xBreak->endOfScript(
+ rText, nChgPos, nCurScript );
+ bRet = sal_True;
+ }
+ else if ( ! bForward && nChgPos )
+ {
+ --nChgPos;
+ nCurScript = pBreakIt->xBreak->getScriptType( rText, nChgPos );
+ nChgPos = (xub_StrLen)pBreakIt->xBreak->beginOfScript(
+ rText, nChgPos, nCurScript );
+ bRet = sal_True;
+ }
}
else
nChgPos = rText.Len();