xref: /AOO41X/main/unotools/inc/unotools/collatorwrapper.hxx (revision bae3752ec30c258ca902793e4eea3c818b0bcaad)
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 #include "unotools/unotoolsdllapi.h"
24 
25 #ifndef _UNOTOOLS_COLLATORWRAPPER_HXX
26 #define _UNOTOOLS_COLLATORWRAPPER_HXX
27 
28 #ifndef _COM_SUN_STAR_UTIL_XCOLLATOR_HPP_
29 #include <com/sun/star/i18n/XCollator.hpp>
30 #endif
31 
32 namespace com { namespace sun { namespace star { namespace lang {
33         class XMultiServiceFactory;
34 }}}}
35 
36 class UNOTOOLS_DLLPUBLIC CollatorWrapper
37 {
38     private:
39 
40         ::com::sun::star::uno::Reference<
41                 ::com::sun::star::lang::XMultiServiceFactory
42             > mxServiceFactory;
43 
44         ::com::sun::star::uno::Reference<
45                 ::com::sun::star::i18n::XCollator
46             > mxInternationalCollator;
47 
48     public:
49 
50         CollatorWrapper (
51                 const ::com::sun::star::uno::Reference<
52                     ::com::sun::star::lang::XMultiServiceFactory > &xServiceFactoryIn);
53 
54         ~CollatorWrapper();
55 
56         sal_Int32
57         compareSubstring (
58                 const ::rtl::OUString& s1, sal_Int32 off1, sal_Int32 len1,
59                 const ::rtl::OUString& s2, sal_Int32 off2, sal_Int32 len2) const;
60 
61         sal_Int32
62         compareString (
63                 const ::rtl::OUString& s1, const ::rtl::OUString& s2) const;
64 
65         ::com::sun::star::uno::Sequence< ::rtl::OUString >
66         listCollatorAlgorithms (
67                 const ::com::sun::star::lang::Locale& rLocale) const;
68 
69         ::com::sun::star::uno::Sequence< sal_Int32 >
70         listCollatorOptions (
71                 const ::rtl::OUString& rAlgorithm) const;
72 
73         sal_Int32
74         loadDefaultCollator (
75                 const ::com::sun::star::lang::Locale& rLocale, sal_Int32 nOption);
76 
77         sal_Int32
78         loadCollatorAlgorithm (
79                 const ::rtl::OUString& rAlgorithm,
80                 const ::com::sun::star::lang::Locale& rLocale, sal_Int32 nOption);
81 
82         void
83         loadCollatorAlgorithmWithEndUserOption (
84                 const ::rtl::OUString& rAlgorithm,
85                 const ::com::sun::star::lang::Locale& rLocale,
86                 const ::com::sun::star::uno::Sequence< sal_Int32 >& rOption);
87 
88     protected:
89 
90         CollatorWrapper();
91 };
92 
93 #endif /* _UNOTOOLS_COLLATORWRAPPER_HXX */
94