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