Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / i18npool / inc / breakiterator_unicode.hxx
bloba9273f14b24ea6c8cc9b3d24dae849083e3acc12
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef _I18N_BREAKITERATOR_UNICODE_HXX_
29 #define _I18N_BREAKITERATOR_UNICODE_HXX_
31 #include <breakiteratorImpl.hxx>
33 #include "warnings_guard_unicode_brkiter.h"
35 namespace com { namespace sun { namespace star { namespace i18n {
37 #define LOAD_CHARACTER_BREAKITERATOR 0
38 #define LOAD_WORD_BREAKITERATOR 1
39 #define LOAD_SENTENCE_BREAKITERATOR 2
40 #define LOAD_LINE_BREAKITERATOR 3
42 // ----------------------------------------------------
43 // class BreakIterator_Unicode
44 // ----------------------------------------------------
45 class BreakIterator_Unicode : public BreakIteratorImpl
47 public:
48 BreakIterator_Unicode();
49 ~BreakIterator_Unicode();
51 virtual sal_Int32 SAL_CALL previousCharacters( const rtl::OUString& Text, sal_Int32 nStartPos,
52 const com::sun::star::lang::Locale& nLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount,
53 sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException);
54 virtual sal_Int32 SAL_CALL nextCharacters( const rtl::OUString& Text, sal_Int32 nStartPos,
55 const com::sun::star::lang::Locale& rLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount,
56 sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException);
58 virtual Boundary SAL_CALL previousWord( const rtl::OUString& Text, sal_Int32 nStartPos,
59 const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException);
60 virtual Boundary SAL_CALL nextWord( 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 getWordBoundary( const rtl::OUString& Text, sal_Int32 nPos,
63 const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType, sal_Bool bDirection )
64 throw(com::sun::star::uno::RuntimeException);
66 virtual sal_Int32 SAL_CALL beginOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos,
67 const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException);
68 virtual sal_Int32 SAL_CALL endOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos,
69 const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException);
71 virtual LineBreakResults SAL_CALL getLineBreak( const rtl::OUString& Text, sal_Int32 nStartPos,
72 const com::sun::star::lang::Locale& nLocale, sal_Int32 nMinBreakPos,
73 const LineBreakHyphenationOptions& hOptions, const LineBreakUserOptions& bOptions )
74 throw(com::sun::star::uno::RuntimeException);
76 //XServiceInfo
77 virtual rtl::OUString SAL_CALL getImplementationName() throw( com::sun::star::uno::RuntimeException );
78 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
79 throw( com::sun::star::uno::RuntimeException );
80 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames()
81 throw( com::sun::star::uno::RuntimeException );
83 protected:
84 const sal_Char *cBreakIterator, *wordRule, *lineRule;
85 Boundary result; // for word break iterator
87 struct BI_Data
89 rtl::OUString aICUText;
90 UText *ut;
91 icu::BreakIterator *aBreakIterator;
93 BI_Data()
94 : ut(NULL)
95 , aBreakIterator(NULL)
98 ~BI_Data()
100 utext_close(ut);
103 } character, word, sentence, line, *icuBI;
105 com::sun::star::lang::Locale aLocale;
106 sal_Int16 aBreakType, aWordType;
108 void SAL_CALL loadICUBreakIterator(const com::sun::star::lang::Locale& rLocale,
109 sal_Int16 rBreakType, sal_Int16 rWordType, const sal_Char* name, const rtl::OUString& rText) throw(com::sun::star::uno::RuntimeException);
112 } } } }
114 #endif
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */