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