Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : : #ifndef _I18N_BREAKITERATOR_UNICODE_HXX_
20 : : #define _I18N_BREAKITERATOR_UNICODE_HXX_
21 : :
22 : : #include <breakiteratorImpl.hxx>
23 : :
24 : : #include "warnings_guard_unicode_brkiter.h"
25 : :
26 : : namespace com { namespace sun { namespace star { namespace i18n {
27 : :
28 : : #define LOAD_CHARACTER_BREAKITERATOR 0
29 : : #define LOAD_WORD_BREAKITERATOR 1
30 : : #define LOAD_SENTENCE_BREAKITERATOR 2
31 : : #define LOAD_LINE_BREAKITERATOR 3
32 : :
33 : : // ----------------------------------------------------
34 : : // class BreakIterator_Unicode
35 : : // ----------------------------------------------------
36 : : class BreakIterator_Unicode : public BreakIteratorImpl
37 : : {
38 : : public:
39 : : BreakIterator_Unicode();
40 : : ~BreakIterator_Unicode();
41 : :
42 : : virtual sal_Int32 SAL_CALL previousCharacters( const rtl::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);
45 : : virtual sal_Int32 SAL_CALL nextCharacters( const rtl::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);
48 : :
49 : : virtual Boundary SAL_CALL previousWord( const rtl::OUString& Text, sal_Int32 nStartPos,
50 : : const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException);
51 : : virtual Boundary SAL_CALL nextWord( const rtl::OUString& Text, sal_Int32 nStartPos,
52 : : const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException);
53 : : virtual Boundary SAL_CALL getWordBoundary( const rtl::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);
56 : :
57 : : virtual sal_Int32 SAL_CALL beginOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos,
58 : : const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException);
59 : : virtual sal_Int32 SAL_CALL endOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos,
60 : : const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException);
61 : :
62 : : virtual LineBreakResults SAL_CALL getLineBreak( const rtl::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);
66 : :
67 : : //XServiceInfo
68 : : virtual rtl::OUString SAL_CALL getImplementationName() throw( com::sun::star::uno::RuntimeException );
69 : : virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
70 : : throw( com::sun::star::uno::RuntimeException );
71 : : virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames()
72 : : throw( com::sun::star::uno::RuntimeException );
73 : :
74 : : protected:
75 : : const sal_Char *cBreakIterator, *wordRule, *lineRule;
76 : : Boundary result; // for word break iterator
77 : :
78 : : struct BI_Data
79 : : {
80 : : rtl::OUString aICUText;
81 : : UText *ut;
82 : : icu::BreakIterator *aBreakIterator;
83 : :
84 : 7988 : BI_Data()
85 : : : ut(NULL)
86 : 7988 : , aBreakIterator(NULL)
87 : : {
88 : 7988 : }
89 : 7932 : ~BI_Data()
90 : 7932 : {
91 [ + - ]: 7932 : utext_close(ut);
92 : 7932 : }
93 : :
94 : : } character, word, sentence, line, *icuBI;
95 : :
96 : : com::sun::star::lang::Locale aLocale;
97 : : sal_Int16 aBreakType, aWordType;
98 : :
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);
101 : : };
102 : :
103 : : } } } }
104 : :
105 : : #endif
106 : :
107 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|