1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: breakiterator_unicode.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _I18N_BREAKITERATOR_UNICODE_HXX_
31 #define _I18N_BREAKITERATOR_UNICODE_HXX_
33 #include <breakiteratorImpl.hxx>
35 #include "warnings_guard_unicode_brkiter.h"
37 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
39 #define LOAD_CHARACTER_BREAKITERATOR 0
40 #define LOAD_WORD_BREAKITERATOR 1
41 #define LOAD_SENTENCE_BREAKITERATOR 2
42 #define LOAD_LINE_BREAKITERATOR 3
44 // ----------------------------------------------------
45 // class BreakIterator_Unicode
46 // ----------------------------------------------------
47 class BreakIterator_Unicode
: public BreakIteratorImpl
50 BreakIterator_Unicode();
51 ~BreakIterator_Unicode();
53 virtual sal_Int32 SAL_CALL
previousCharacters( const rtl::OUString
& Text
, sal_Int32 nStartPos
,
54 const com::sun::star::lang::Locale
& nLocale
, sal_Int16 nCharacterIteratorMode
, sal_Int32 nCount
,
55 sal_Int32
& nDone
) throw(com::sun::star::uno::RuntimeException
);
56 virtual sal_Int32 SAL_CALL
nextCharacters( const rtl::OUString
& Text
, sal_Int32 nStartPos
,
57 const com::sun::star::lang::Locale
& rLocale
, sal_Int16 nCharacterIteratorMode
, sal_Int32 nCount
,
58 sal_Int32
& nDone
) throw(com::sun::star::uno::RuntimeException
);
60 virtual Boundary SAL_CALL
previousWord( const rtl::OUString
& Text
, sal_Int32 nStartPos
,
61 const com::sun::star::lang::Locale
& nLocale
, sal_Int16 WordType
) throw(com::sun::star::uno::RuntimeException
);
62 virtual Boundary SAL_CALL
nextWord( const rtl::OUString
& Text
, sal_Int32 nStartPos
,
63 const com::sun::star::lang::Locale
& nLocale
, sal_Int16 WordType
) throw(com::sun::star::uno::RuntimeException
);
64 virtual Boundary SAL_CALL
getWordBoundary( const rtl::OUString
& Text
, sal_Int32 nPos
,
65 const com::sun::star::lang::Locale
& nLocale
, sal_Int16 WordType
, sal_Bool bDirection
)
66 throw(com::sun::star::uno::RuntimeException
);
68 virtual sal_Int32 SAL_CALL
beginOfSentence( const rtl::OUString
& Text
, sal_Int32 nStartPos
,
69 const com::sun::star::lang::Locale
& nLocale
) throw(com::sun::star::uno::RuntimeException
);
70 virtual sal_Int32 SAL_CALL
endOfSentence( const rtl::OUString
& Text
, sal_Int32 nStartPos
,
71 const com::sun::star::lang::Locale
& nLocale
) throw(com::sun::star::uno::RuntimeException
);
73 virtual LineBreakResults SAL_CALL
getLineBreak( const rtl::OUString
& Text
, sal_Int32 nStartPos
,
74 const com::sun::star::lang::Locale
& nLocale
, sal_Int32 nMinBreakPos
,
75 const LineBreakHyphenationOptions
& hOptions
, const LineBreakUserOptions
& bOptions
)
76 throw(com::sun::star::uno::RuntimeException
);
79 virtual rtl::OUString SAL_CALL
getImplementationName() throw( com::sun::star::uno::RuntimeException
);
80 virtual sal_Bool SAL_CALL
supportsService(const rtl::OUString
& ServiceName
)
81 throw( com::sun::star::uno::RuntimeException
);
82 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getSupportedServiceNames()
83 throw( com::sun::star::uno::RuntimeException
);
86 const sal_Char
*cBreakIterator
, *wordRule
, *lineRule
;
87 Boundary result
; // for word break iterator
90 UnicodeString aICUText
;
91 icu::BreakIterator
*aBreakIterator
;
93 BI_Data() : aICUText(), aBreakIterator(NULL
) {}
94 } character
, word
, sentence
, line
, *icuBI
;
96 com::sun::star::lang::Locale aLocale
;
97 sal_Int16 aBreakType
, aWordType
;
99 void SAL_CALL
loadICUBreakIterator(const com::sun::star::lang::Locale
& rLocale
,
100 sal_Int16 rBreakType
, sal_Int16 rWordType
, const sal_Char
* name
, const rtl::OUString
& rText
) throw(com::sun::star::uno::RuntimeException
);