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
51    The number formats are managed by their unique key in the document.
52 */
53published interface XNumberFormats: com::sun::star::uno::XInterface
54{
55	//-------------------------------------------------------------------------
56
57	/** @returns
58					a readonly <type>NumberFormatProperties</type>.
59
60		@param nKey
61			the key for the format
62	 */
63	com::sun::star::beans::XPropertySet getByKey( [in] long nKey );
64
65	//-------------------------------------------------------------------------
66
67	/** @returns
68					a sequence of the keys of all number formats with the specified type and language.
69
70				@param	nType
71						the type of number formats to return. Must be one of the
72						<type>NumberFormat</type> constants.
73
74				@param	nLocale
75						the locale of number formats to return.
76
77				@param	bCreate
78						<TRUE/>: create new entries if no formats for the selected language exist<BR>
79						<FALSE/>: return an empty list if no formats for the selected language exist
80	 */
81	sequence<long> queryKeys( [in] short nType,
82			 [in] com::sun::star::lang::Locale nLocale,
83			 [in] boolean bCreate );
84
85	//-------------------------------------------------------------------------
86
87	/** finds a number format by its format string and returns its key.
88
89		@returns
90			the key for the format if found, otherwise -1.
91
92		@param aFormat
93			the string representation of the number format
94
95		@param nLocale
96			the locale for number formats to find
97
98		@param bScan
99			reserved for future use and should be set to false
100	 */
101	long queryKey( [in] string aFormat,
102			 [in] com::sun::star::lang::Locale nLocale,
103			 [in] boolean bScan );
104
105	//-------------------------------------------------------------------------
106
107	/** adds a new number format to the list, using a format string.
108
109		@returns
110			the key for new number format
111
112		@param aFormat
113			the string representation of the number format
114
115		@param nLocale
116			the locale for the number format
117
118		@throws com::sun::star::util::MalformedNumberFormatException
119			if incorrect number format is specified
120	 */
121	long addNew( [in] string aFormat,
122			 [in] com::sun::star::lang::Locale nLocale )
123			raises( com::sun::star::util::MalformedNumberFormatException );
124
125	//-------------------------------------------------------------------------
126
127	/** adds a new number format to the list, using a format
128		string in a different locale than the desired locale of the
129		resulting number format.
130
131		@returns
132			the key for added number format
133
134		@param aFormat
135			the key for the number format
136
137		@param nLocale
138			the original locale for the number format
139
140		@param nNewLocale
141			the new locale for the number format to be converted
142
143		@throws com::sun::star::util::MalformedNumberFormatException
144			if incorrect number format is specified
145	 */
146	long addNewConverted( [in] string aFormat,
147			 [in] com::sun::star::lang::Locale nLocale,
148			 [in] com::sun::star::lang::Locale nNewLocale )
149			raises( com::sun::star::util::MalformedNumberFormatException );
150
151	//-------------------------------------------------------------------------
152
153	/** removes a number format from the list.
154
155		@param nKey
156			the key for the numberformat
157	 */
158	void removeByKey( [in] long nKey );
159
160	//-------------------------------------------------------------------------
161
162	/** generates a format string from several parameters without
163		creating an actual number format.
164
165		@returns
166			the string representation for the number format
167
168		@param nBaseKey
169			the key for the number format to be used as base format
170
171		@param nLocale
172			the locale for the number format
173
174		@param bThousands
175			the thousands separator is shown or not
176
177		@param bRed
178			show negative number in red colored if <TRUE/>
179
180		@param nDecimals
181			how many digits are shown after the decimal point
182
183		@param nLeading
184			how many number of leading zeros are shown
185	 */
186	string generateFormat( [in] long nBaseKey,
187			 [in] com::sun::star::lang::Locale nLocale,
188			 [in] boolean bThousands,
189			 [in] boolean bRed,
190			 [in] short nDecimals,
191			 [in] short nLeading );
192
193};
194
195//=============================================================================
196
197}; }; }; };
198
199#endif
200
201