xref: /trunk/main/offapi/com/sun/star/i18n/XCollator.idl (revision d1766043)
1*d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3*d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*d1766043SAndrew Rist * distributed with this work for additional information
6*d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9*d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10*d1766043SAndrew Rist *
11*d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*d1766043SAndrew Rist *
13*d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*d1766043SAndrew Rist * software distributed under the License is distributed on an
15*d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17*d1766043SAndrew Rist * specific language governing permissions and limitations
18*d1766043SAndrew Rist * under the License.
19*d1766043SAndrew Rist *
20*d1766043SAndrew Rist *************************************************************/
21*d1766043SAndrew Rist
22*d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_i18n_XCollator_idl__
24cdf0e10cSrcweir#define __com_sun_star_i18n_XCollator_idl__
25cdf0e10cSrcweir
26cdf0e10cSrcweir#include <com/sun/star/uno/Exception.idl>
27cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
28cdf0e10cSrcweir#include <com/sun/star/lang/Locale.idl>
29cdf0e10cSrcweir//=============================================================================
30cdf0e10cSrcweir
31cdf0e10cSrcweirmodule com { module sun { module star { module i18n {
32cdf0e10cSrcweir
33cdf0e10cSrcweir/** provides locale-sensitive collation algorithms for string comparison.
34cdf0e10cSrcweir
35cdf0e10cSrcweir*/
36cdf0e10cSrcweirpublished interface XCollator: com::sun::star::uno::XInterface
37cdf0e10cSrcweir{
38cdf0e10cSrcweir    //-------------------------------------------------------------------------
39cdf0e10cSrcweir    /** Compare 2 substrings in specific locale and algorithm.
40cdf0e10cSrcweir
41cdf0e10cSrcweir        @param aStr1
42cdf0e10cSrcweir            First string.
43cdf0e10cSrcweir
44cdf0e10cSrcweir        @param nOff1
45cdf0e10cSrcweir            Offset (from 0) of the first string.
46cdf0e10cSrcweir
47cdf0e10cSrcweir        @param nLen1
48cdf0e10cSrcweir            Length (from offset) of the first substring.
49cdf0e10cSrcweir
50cdf0e10cSrcweir        @param aStr2
51cdf0e10cSrcweir            Second string
52cdf0e10cSrcweir
53cdf0e10cSrcweir        @param nOff2
54cdf0e10cSrcweir            Offset (from 0) of the second string.
55cdf0e10cSrcweir
56cdf0e10cSrcweir        @param nLen2
57cdf0e10cSrcweir            Length (from offset) of the second substring.
58cdf0e10cSrcweir
59cdf0e10cSrcweir        @returns
60cdf0e10cSrcweir            1 if the first string is greater than the second string <br/>
61cdf0e10cSrcweir            0 if the first string is equal to the second string <br/>
62cdf0e10cSrcweir            -1 if the first string is less than the second string
63cdf0e10cSrcweir    */
64cdf0e10cSrcweir    long compareSubstring(  [in] string aStr1, [in] long nOff1, [in] long nLen1,
65cdf0e10cSrcweir                            [in] string aStr2, [in] long nOff2, [in] long nLen2 );
66cdf0e10cSrcweir
67cdf0e10cSrcweir    //-------------------------------------------------------------------------
68cdf0e10cSrcweir    /** Compare 2 strings in specific locale and algorithm.
69cdf0e10cSrcweir
70cdf0e10cSrcweir        @param aStr1
71cdf0e10cSrcweir            First string.
72cdf0e10cSrcweir
73cdf0e10cSrcweir        @param aStr2
74cdf0e10cSrcweir            Second string.
75cdf0e10cSrcweir
76cdf0e10cSrcweir        @returns
77cdf0e10cSrcweir            1 if the first string is greater than the second string <br/>
78cdf0e10cSrcweir            0 if the first string is equal to the second string <br/>
79cdf0e10cSrcweir            -1 if the first string is less than the second string
80cdf0e10cSrcweir    */
81cdf0e10cSrcweir    long compareString( [in] string aStr1, [in] string aStr2 );
82cdf0e10cSrcweir
83cdf0e10cSrcweir    //-------------------------------------------------------------------------
84cdf0e10cSrcweir    /** Load the collator with default algorithm defined in
85cdf0e10cSrcweir        locale data.
86cdf0e10cSrcweir
87cdf0e10cSrcweir        @param aLocale
88cdf0e10cSrcweir            The locale for this collator.
89cdf0e10cSrcweir
90cdf0e10cSrcweir        @param nCollatorOptions
91cdf0e10cSrcweir            A mask of <type>CollatorOptions</type>.
92cdf0e10cSrcweir
93cdf0e10cSrcweir        @returns
94cdf0e10cSrcweir            Returns 0 when loading was successful,
95cdf0e10cSrcweir            otherwise throws runtime exception. In fact the return value
96cdf0e10cSrcweir            should be ignored and the exception be caught instead.
97cdf0e10cSrcweir    */
98cdf0e10cSrcweir    long loadDefaultCollator(   [in] ::com::sun::star::lang::Locale aLocale,
99cdf0e10cSrcweir                                [in] long nCollatorOptions );
100cdf0e10cSrcweir
101cdf0e10cSrcweir    //-------------------------------------------------------------------------
102cdf0e10cSrcweir    /** Load a particular collator algorithm for the locale.
103cdf0e10cSrcweir
104cdf0e10cSrcweir        @param aAlgorithmName
105cdf0e10cSrcweir            The algorithm to load.
106cdf0e10cSrcweir
107cdf0e10cSrcweir        @param aLocale
108cdf0e10cSrcweir            The locale for this collator.
109cdf0e10cSrcweir
110cdf0e10cSrcweir        @param nCollatorOptions
111cdf0e10cSrcweir            A mask of <type>CollatorOptions</type>.
112cdf0e10cSrcweir
113cdf0e10cSrcweir        @returns
114cdf0e10cSrcweir            Returns 0 when loading was successful,
115cdf0e10cSrcweir            otherwise throws runtime exception.
116cdf0e10cSrcweir    */
117cdf0e10cSrcweir    long loadCollatorAlgorithm( [in] string aAlgorithmName,
118cdf0e10cSrcweir                                [in] ::com::sun::star::lang::Locale aLocale,
119cdf0e10cSrcweir                                [in] long nCollatorOptions );
120cdf0e10cSrcweir
121cdf0e10cSrcweir    //-------------------------------------------------------------------------
122cdf0e10cSrcweir    /** List all collator algorithms for a given locale.
123cdf0e10cSrcweir
124cdf0e10cSrcweir        @param aLocale
125cdf0e10cSrcweir            The locale for which to list algorithms.
126cdf0e10cSrcweir
127cdf0e10cSrcweir        @returns
128cdf0e10cSrcweir            A sequence of algorithm names.
129cdf0e10cSrcweir    */
130cdf0e10cSrcweir    sequence <string> listCollatorAlgorithms(
131cdf0e10cSrcweir                                [in] ::com::sun::star::lang::Locale aLocale );
132cdf0e10cSrcweir
133cdf0e10cSrcweir    //-------------------------------------------------------------------------
134cdf0e10cSrcweir    /** Load a collator algorithm with options chosen by end user.
135cdf0e10cSrcweir
136cdf0e10cSrcweir        @param aAlgorithmName
137cdf0e10cSrcweir            The algorithm name to load.
138cdf0e10cSrcweir
139cdf0e10cSrcweir        @param aLocale
140cdf0e10cSrcweir            The locale for this collator.
141cdf0e10cSrcweir
142cdf0e10cSrcweir        @param aCollatorOptions
143cdf0e10cSrcweir            A sequence of end user collator options like those returned
144cdf0e10cSrcweir            by <member>XCollator::listCollatorOptions()</member>.
145cdf0e10cSrcweir    */
146cdf0e10cSrcweir    void loadCollatorAlgorithmWithEndUserOption(
147cdf0e10cSrcweir                                [in] string aAlgorithmName,
148cdf0e10cSrcweir                                [in] ::com::sun::star::lang::Locale aLocale,
149cdf0e10cSrcweir                                [in] sequence<long> aCollatorOptions );
150cdf0e10cSrcweir
151cdf0e10cSrcweir    //-------------------------------------------------------------------------
152cdf0e10cSrcweir    /** List all end user collator options for a given algorithm.
153cdf0e10cSrcweir
154cdf0e10cSrcweir        @param aAlgorithmName
155cdf0e10cSrcweir            The algorithm name for this collator.
156cdf0e10cSrcweir
157cdf0e10cSrcweir        @returns
158cdf0e10cSrcweir            An array of end user options available for the algorithm.
159cdf0e10cSrcweir    */
160cdf0e10cSrcweir    sequence <long> listCollatorOptions( [in] string aAlgorithmName );
161cdf0e10cSrcweir
162cdf0e10cSrcweir};
163cdf0e10cSrcweir
164cdf0e10cSrcweir//=============================================================================
165cdf0e10cSrcweir
166cdf0e10cSrcweir}; }; }; };
167cdf0e10cSrcweir
168cdf0e10cSrcweir//=============================================================================
169cdf0e10cSrcweir
170cdf0e10cSrcweir#endif
171