xref: /AOO41X/main/offapi/com/sun/star/util/XNumberFormats.idl (revision d1766043198e81d0bcfc626e12893e7b4d7e31ca)
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 __com_sun_star_util_XNumberFormats_idl__
24#define __com_sun_star_util_XNumberFormats_idl__
25
26#ifndef __com_sun_star_uno_XInterface_idl__
27#include <com/sun/star/uno/XInterface.idl>
28#endif
29
30#ifndef __com_sun_star_beans_XPropertySet_idl__
31#include <com/sun/star/beans/XPropertySet.idl>
32#endif
33
34#ifndef __com_sun_star_lang_Locale_idl__
35#include <com/sun/star/lang/Locale.idl>
36#endif
37
38#ifndef __com_sun_star_util_MalformedNumberFormatException_idl__
39#include <com/sun/star/util/MalformedNumberFormatException.idl>
40#endif
41
42
43//=============================================================================
44
45 module com {  module sun {  module star {  module util {
46
47//=============================================================================
48
49/** provides access to multiple <type>NumberFormat</type>s.
50 */
51published interface XNumberFormats: com::sun::star::uno::XInterface
52{
53    //-------------------------------------------------------------------------
54
55    /** @returns
56                    a readonly <type>NumberFormatProperties</type>.
57     */
58    com::sun::star::beans::XPropertySet getByKey( [in] long nKey );
59
60    //-------------------------------------------------------------------------
61
62    /** @returns
63                    a sequence of the keys of all number formats with the specified type and language.
64
65                @param  nType
66                        the type of number formats to return. Must be one of the
67                        <type>NumberFormat</type> constants.
68
69                @param  nLanguage
70                        the language of number formats to return.
71
72                @param  bCreate
73                        <TRUE/>: create new entries if no formats for the selected language exist<BR>
74                        <FALSE/>: return an empty list if no formats for the selected language exist
75     */
76    sequence<long> queryKeys( [in] short nType,
77             [in] com::sun::star::lang::Locale nLocale,
78             [in] boolean bCreate );
79
80    //-------------------------------------------------------------------------
81
82    /** finds a number format by its format string and returns its key.
83     */
84    long queryKey( [in] string aFormat,
85             [in] com::sun::star::lang::Locale nLocale,
86             [in] boolean bScan );
87
88    //-------------------------------------------------------------------------
89
90    /** adds a new number format to the list, using a format string.
91     */
92    long addNew( [in] string aFormat,
93             [in] com::sun::star::lang::Locale nLocale )
94            raises( com::sun::star::util::MalformedNumberFormatException );
95
96    //-------------------------------------------------------------------------
97
98    /** adds a new number format to the list, using a format
99        string in a different locale than the desired locale of the
100        resulting number format.
101     */
102    long addNewConverted( [in] string aFormat,
103             [in] com::sun::star::lang::Locale nLocale,
104             [in] com::sun::star::lang::Locale nNewLocale )
105            raises( com::sun::star::util::MalformedNumberFormatException );
106
107    //-------------------------------------------------------------------------
108
109    /** removes a number format from the list.
110     */
111    void removeByKey( [in] long nKey );
112
113    //-------------------------------------------------------------------------
114
115    /** generates a format string from several parameters without
116        creating an actual number format.
117     */
118    string generateFormat( [in] long nBaseKey,
119             [in] com::sun::star::lang::Locale nLocale,
120             [in] boolean bThousands,
121             [in] boolean bRed,
122             [in] short nDecimals,
123             [in] short nLeading );
124
125};
126
127//=============================================================================
128
129}; }; }; };
130
131#endif
132
133