merge the formfield patch from ooo-build
[ooovba.git] / i18npool / inc / breakiteratorImpl.hxx
blobb5275fcc2ec57447a697c7c04f6abbe3b927da00
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: breakiteratorImpl.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _I18N_BREAKITERATOR_HXX_
31 #define _I18N_BREAKITERATOR_HXX_
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <comphelper/processfactory.hxx>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/beans/PropertyValues.hpp>
37 #include <com/sun/star/i18n/XBreakIterator.hpp>
38 #include <com/sun/star/i18n/WordType.hpp>
39 #include <com/sun/star/i18n/BreakType.hpp>
40 #include <com/sun/star/i18n/ScriptType.hpp>
41 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
42 #include <com/sun/star/i18n/CharType.hpp>
43 #include <com/sun/star/i18n/XLocaleData.hpp>
44 #include <cppuhelper/implbase2.hxx> // helper for implementations
46 #include <vector>
48 namespace com { namespace sun { namespace star { namespace i18n {
50 // ----------------------------------------------------
51 // class BreakIterator
52 // ----------------------------------------------------
53 class BreakIteratorImpl : public cppu::WeakImplHelper2
55 XBreakIterator,
56 com::sun::star::lang::XServiceInfo
59 public:
60 BreakIteratorImpl( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
61 BreakIteratorImpl();
62 ~BreakIteratorImpl();
64 virtual sal_Int32 SAL_CALL nextCharacters( const rtl::OUString& Text, sal_Int32 nStartPos,
65 const com::sun::star::lang::Locale& rLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount,
66 sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException);
67 virtual sal_Int32 SAL_CALL previousCharacters( const rtl::OUString& Text, sal_Int32 nStartPos,
68 const com::sun::star::lang::Locale& nLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount,
69 sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException);
71 virtual Boundary SAL_CALL previousWord( const rtl::OUString& Text, sal_Int32 nStartPos,
72 const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException);
73 virtual Boundary SAL_CALL nextWord( const rtl::OUString& Text, sal_Int32 nStartPos,
74 const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException);
75 virtual Boundary SAL_CALL getWordBoundary( const rtl::OUString& Text, sal_Int32 nPos,
76 const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType, sal_Bool bDirection )
77 throw(com::sun::star::uno::RuntimeException);
79 virtual sal_Bool SAL_CALL isBeginWord( const rtl::OUString& Text, sal_Int32 nPos,
80 const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType ) throw(com::sun::star::uno::RuntimeException);
81 virtual sal_Bool SAL_CALL isEndWord( const rtl::OUString& Text, sal_Int32 nPos,
82 const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType ) throw(com::sun::star::uno::RuntimeException);
83 virtual sal_Int16 SAL_CALL getWordType( const rtl::OUString& Text, sal_Int32 nPos,
84 const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException);
86 virtual sal_Int32 SAL_CALL beginOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos,
87 const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException);
88 virtual sal_Int32 SAL_CALL endOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos,
89 const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException);
91 virtual LineBreakResults SAL_CALL getLineBreak( const rtl::OUString& Text, sal_Int32 nStartPos,
92 const com::sun::star::lang::Locale& nLocale, sal_Int32 nMinBreakPos,
93 const LineBreakHyphenationOptions& hOptions, const LineBreakUserOptions& bOptions )
94 throw(com::sun::star::uno::RuntimeException);
96 virtual sal_Int16 SAL_CALL getScriptType( const rtl::OUString& Text, sal_Int32 nPos )
97 throw(com::sun::star::uno::RuntimeException);
98 virtual sal_Int32 SAL_CALL beginOfScript( const rtl::OUString& Text, sal_Int32 nStartPos,
99 sal_Int16 ScriptType ) throw(com::sun::star::uno::RuntimeException);
100 virtual sal_Int32 SAL_CALL endOfScript( const rtl::OUString& Text, sal_Int32 nStartPos,
101 sal_Int16 ScriptType ) throw(com::sun::star::uno::RuntimeException);
102 virtual sal_Int32 SAL_CALL previousScript( const rtl::OUString& Text, sal_Int32 nStartPos,
103 sal_Int16 ScriptType ) throw(com::sun::star::uno::RuntimeException);
104 virtual sal_Int32 SAL_CALL nextScript( const rtl::OUString& Text, sal_Int32 nStartPos,
105 sal_Int16 ScriptType ) throw(com::sun::star::uno::RuntimeException);
107 virtual sal_Int32 SAL_CALL beginOfCharBlock( const rtl::OUString& Text, sal_Int32 nStartPos,
108 const com::sun::star::lang::Locale& nLocale, sal_Int16 CharType ) throw(com::sun::star::uno::RuntimeException);
109 virtual sal_Int32 SAL_CALL endOfCharBlock( const rtl::OUString& Text, sal_Int32 nStartPos,
110 const com::sun::star::lang::Locale& nLocale, sal_Int16 CharType ) throw(com::sun::star::uno::RuntimeException);
111 virtual sal_Int32 SAL_CALL previousCharBlock( const rtl::OUString& Text, sal_Int32 nStartPos,
112 const com::sun::star::lang::Locale& nLocale, sal_Int16 CharType ) throw(com::sun::star::uno::RuntimeException);
113 virtual sal_Int32 SAL_CALL nextCharBlock( const rtl::OUString& Text, sal_Int32 nStartPos,
114 const com::sun::star::lang::Locale& nLocale, sal_Int16 CharType ) throw(com::sun::star::uno::RuntimeException);
116 //XServiceInfo
117 virtual rtl::OUString SAL_CALL getImplementationName() throw( com::sun::star::uno::RuntimeException );
118 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
119 throw( com::sun::star::uno::RuntimeException );
120 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames()
121 throw( com::sun::star::uno::RuntimeException );
123 static sal_Int16 SAL_CALL getScriptClass(sal_uInt32 currentChar);
124 protected:
125 Boundary result; // for word break iterator
127 private :
129 struct lookupTableItem {
130 lookupTableItem(const com::sun::star::lang::Locale& _aLocale, com::sun::star::uno::Reference < XBreakIterator >& _xBI) : aLocale(_aLocale), xBI(_xBI) {};
131 com::sun::star::lang::Locale aLocale;
132 com::sun::star::uno::Reference < XBreakIterator > xBI;
134 std::vector<lookupTableItem*> lookupTable;
135 com::sun::star::lang::Locale aLocale;
136 com::sun::star::uno::Reference < XBreakIterator > xBI;
138 com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF;
139 sal_Bool SAL_CALL createLocaleSpecificBreakIterator( const rtl::OUString& aLocaleName )
140 throw( com::sun::star::uno::RuntimeException );
141 com::sun::star::uno::Reference < XBreakIterator > SAL_CALL getLocaleSpecificBreakIterator( const com::sun::star::lang::Locale& rLocale )
142 throw( com::sun::star::uno::RuntimeException );
143 const com::sun::star::lang::Locale& SAL_CALL getLocaleByScriptType(const com::sun::star::lang::Locale& rLocale, const rtl::OUString& Text,
144 sal_Int32 nStartPos, sal_Bool forward, sal_Bool skipWhiteSpace)
145 throw(com::sun::star::uno::RuntimeException);
149 } // i18n
150 } // star
151 } // sun
152 } // com
155 #endif // _I18N_BREAKITERATOR_HXX_