summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2004-03-17 08:02:14 +0000
committerOliver Bolte <obo@openoffice.org>2004-03-17 08:02:14 +0000
commitf5bc5f04e4de8fa502d498a99f4ef6a340d796c0 (patch)
tree9429560bb0934233aae188ea5a5ed4aa2d1f31fc /i18npool
parent16401a5b865b5da8a2dd70057e8b048e9b797d5a (diff)
INTEGRATION: CWS i18n11 (1.13.14); FILE MERGED
2004/02/04 02:09:04 khong 1.13.14.2: #i24098# skip preceding space for beginOfSentence 2004/01/06 19:41:49 khong 1.13.14.1: #i24098# fix beginOfSentence, which did not work correctly when cursor is on the beginning of the sentence
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/breakiterator/breakiterator_unicode.cxx24
1 files changed, 16 insertions, 8 deletions
diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx
index 001872148d29..5075706b28de 100644
--- a/i18npool/source/breakiterator/breakiterator_unicode.cxx
+++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: breakiterator_unicode.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: hr $ $Date: 2003-11-07 15:13:54 $
+ * last change: $Author: obo $ $Date: 2004-03-17 09:02:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -329,8 +329,15 @@ sal_Int32 SAL_CALL BreakIterator_Unicode::beginOfSentence( const OUString& Text,
{
if (!sentenceBreak) sentenceBreak = loadICUBreakIterator(rLocale, LOAD_SENTENCE_BREAKITERATOR);
- sentenceBreak->setText(UnicodeString(Text.getStr(), Text.getLength()));
- return sentenceBreak->preceding(nStartPos);
+ sal_Int32 len = Text.getLength();
+ sentenceBreak->setText(UnicodeString(Text.getStr(), len));
+ if (!sentenceBreak->isBoundary(nStartPos))
+ nStartPos = sentenceBreak->preceding(nStartPos);
+
+ // skip preceding space.
+ while (nStartPos < len && unicode::isWhiteSpace(Text[nStartPos])) nStartPos++;
+
+ return nStartPos;
}
sal_Int32 SAL_CALL BreakIterator_Unicode::endOfSentence( const OUString& Text, sal_Int32 nStartPos,
@@ -338,13 +345,14 @@ sal_Int32 SAL_CALL BreakIterator_Unicode::endOfSentence( const OUString& Text, s
{
if (!sentenceBreak) sentenceBreak = loadICUBreakIterator(rLocale, LOAD_SENTENCE_BREAKITERATOR);
- sentenceBreak->setText(UnicodeString(Text.getStr(), Text.getLength()));
+ sal_Int32 len = Text.getLength();
+ sentenceBreak->setText(UnicodeString(Text.getStr(), len));
- sal_Int32 nPos = sentenceBreak->following(nStartPos);
+ nStartPos = sentenceBreak->following(nStartPos);
- while (--nPos >= 0 && unicode::isWhiteSpace(Text[nPos]));
+ while (--nStartPos >= 0 && unicode::isWhiteSpace(Text[nStartPos]));
- return ++nPos;
+ return ++nStartPos;
}
LineBreakResults SAL_CALL BreakIterator_Unicode::getLineBreak(