1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _I18N_BREAKITERATOR_UNICODE_HXX_ 24 #define _I18N_BREAKITERATOR_UNICODE_HXX_ 25 26 #include <breakiteratorImpl.hxx> 27 28 #include "warnings_guard_unicode_brkiter.h" 29 30 namespace com { namespace sun { namespace star { namespace i18n { 31 32 #define LOAD_CHARACTER_BREAKITERATOR 0 33 #define LOAD_WORD_BREAKITERATOR 1 34 #define LOAD_SENTENCE_BREAKITERATOR 2 35 #define LOAD_LINE_BREAKITERATOR 3 36 37 // ---------------------------------------------------- 38 // class BreakIterator_Unicode 39 // ---------------------------------------------------- 40 class BreakIterator_Unicode : public BreakIteratorImpl 41 { 42 public: 43 BreakIterator_Unicode(); 44 ~BreakIterator_Unicode(); 45 46 virtual sal_Int32 SAL_CALL previousCharacters( const rtl::OUString& Text, sal_Int32 nStartPos, 47 const com::sun::star::lang::Locale& nLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount, 48 sal_Int32& nDone ); 49 virtual sal_Int32 SAL_CALL nextCharacters( const rtl::OUString& Text, sal_Int32 nStartPos, 50 const com::sun::star::lang::Locale& rLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount, 51 sal_Int32& nDone ); 52 53 virtual Boundary SAL_CALL previousWord( const rtl::OUString& Text, sal_Int32 nStartPos, 54 const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType); 55 virtual Boundary SAL_CALL nextWord( const rtl::OUString& Text, sal_Int32 nStartPos, 56 const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType); 57 virtual Boundary SAL_CALL getWordBoundary( const rtl::OUString& Text, sal_Int32 nPos, 58 const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType, sal_Bool bDirection ); 59 60 virtual sal_Int32 SAL_CALL beginOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos, 61 const com::sun::star::lang::Locale& nLocale ); 62 virtual sal_Int32 SAL_CALL endOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos, 63 const com::sun::star::lang::Locale& nLocale ); 64 65 virtual LineBreakResults SAL_CALL getLineBreak( const rtl::OUString& Text, sal_Int32 nStartPos, 66 const com::sun::star::lang::Locale& nLocale, sal_Int32 nMinBreakPos, 67 const LineBreakHyphenationOptions& hOptions, const LineBreakUserOptions& bOptions ); 68 69 //XServiceInfo 70 virtual rtl::OUString SAL_CALL getImplementationName(); 71 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName); 72 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(); 73 74 protected: 75 const sal_Char *cBreakIterator, *wordRule, *lineRule; 76 Boundary result; // for word break iterator 77 78 struct BI_Data { 79 UnicodeString aICUText; 80 icu::BreakIterator *aBreakIterator; 81 BI_Datacom::sun::star::i18n::BreakIterator_Unicode::BI_Data82 BI_Data() : aICUText(), aBreakIterator(NULL) {} 83 } character, word, sentence, line, *icuBI; 84 85 com::sun::star::lang::Locale aLocale; 86 sal_Int16 aBreakType, aWordType; 87 88 void SAL_CALL loadICUBreakIterator(const com::sun::star::lang::Locale& rLocale, 89 sal_Int16 rBreakType, sal_Int16 rWordType, const sal_Char* name, const rtl::OUString& rText); 90 }; 91 92 } } } } 93 94 #endif 95