1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_I18NPOOL_INC_BREAKITERATOR_UNICODE_HXX
20 #define INCLUDED_I18NPOOL_INC_BREAKITERATOR_UNICODE_HXX
22 #include <breakiteratorImpl.hxx>
24 #include <unicode/brkiter.h>
26 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
28 #define LOAD_CHARACTER_BREAKITERATOR 0
29 #define LOAD_WORD_BREAKITERATOR 1
30 #define LOAD_SENTENCE_BREAKITERATOR 2
31 #define LOAD_LINE_BREAKITERATOR 3
34 // class BreakIterator_Unicode
36 class BreakIterator_Unicode
: public BreakIteratorImpl
39 BreakIterator_Unicode();
40 virtual ~BreakIterator_Unicode();
42 virtual sal_Int32 SAL_CALL
previousCharacters( const OUString
& Text
, sal_Int32 nStartPos
,
43 const com::sun::star::lang::Locale
& nLocale
, sal_Int16 nCharacterIteratorMode
, sal_Int32 nCount
,
44 sal_Int32
& nDone
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
45 virtual sal_Int32 SAL_CALL
nextCharacters( const OUString
& Text
, sal_Int32 nStartPos
,
46 const com::sun::star::lang::Locale
& rLocale
, sal_Int16 nCharacterIteratorMode
, sal_Int32 nCount
,
47 sal_Int32
& nDone
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
49 virtual Boundary SAL_CALL
previousWord( const OUString
& Text
, sal_Int32 nStartPos
,
50 const com::sun::star::lang::Locale
& nLocale
, sal_Int16 WordType
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
51 virtual Boundary SAL_CALL
nextWord( const OUString
& Text
, sal_Int32 nStartPos
,
52 const com::sun::star::lang::Locale
& nLocale
, sal_Int16 WordType
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
53 virtual Boundary SAL_CALL
getWordBoundary( const OUString
& Text
, sal_Int32 nPos
,
54 const com::sun::star::lang::Locale
& nLocale
, sal_Int16 WordType
, sal_Bool bDirection
)
55 throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
57 virtual sal_Int32 SAL_CALL
beginOfSentence( const OUString
& Text
, sal_Int32 nStartPos
,
58 const com::sun::star::lang::Locale
& nLocale
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
59 virtual sal_Int32 SAL_CALL
endOfSentence( const OUString
& Text
, sal_Int32 nStartPos
,
60 const com::sun::star::lang::Locale
& nLocale
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
62 virtual LineBreakResults SAL_CALL
getLineBreak( const OUString
& Text
, sal_Int32 nStartPos
,
63 const com::sun::star::lang::Locale
& nLocale
, sal_Int32 nMinBreakPos
,
64 const LineBreakHyphenationOptions
& hOptions
, const LineBreakUserOptions
& bOptions
)
65 throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
68 virtual OUString SAL_CALL
getImplementationName() throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
69 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
)
70 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
71 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
72 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
75 const sal_Char
*cBreakIterator
, *lineRule
;
76 Boundary result
; // for word break iterator
82 icu::BreakIterator
*aBreakIterator
;
83 com::sun::star::lang::Locale maLocale
;
87 , aBreakIterator(NULL
)
95 } character
, sentence
, line
, *icuBI
;
96 BI_Data words
[4]; // 4 is css::i18n::WordType enumeration size
100 void SAL_CALL
loadICUBreakIterator(const com::sun::star::lang::Locale
& rLocale
,
101 sal_Int16 rBreakType
, sal_Int16 rWordType
, const sal_Char
* name
, const OUString
& rText
) throw(com::sun::star::uno::RuntimeException
);
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */