1d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5d1766043SAndrew Rist * distributed with this work for additional information
6d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10d1766043SAndrew Rist *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12d1766043SAndrew Rist *
13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14d1766043SAndrew Rist * software distributed under the License is distributed on an
15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17d1766043SAndrew Rist * specific language governing permissions and limitations
18d1766043SAndrew Rist * under the License.
19d1766043SAndrew Rist *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_util_XNumberFormats_idl__
24cdf0e10cSrcweir#define __com_sun_star_util_XNumberFormats_idl__
25cdf0e10cSrcweir
26cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
27cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
28cdf0e10cSrcweir#endif
29cdf0e10cSrcweir
30cdf0e10cSrcweir#ifndef __com_sun_star_beans_XPropertySet_idl__
31cdf0e10cSrcweir#include <com/sun/star/beans/XPropertySet.idl>
32cdf0e10cSrcweir#endif
33cdf0e10cSrcweir
34cdf0e10cSrcweir#ifndef __com_sun_star_lang_Locale_idl__
35cdf0e10cSrcweir#include <com/sun/star/lang/Locale.idl>
36cdf0e10cSrcweir#endif
37cdf0e10cSrcweir
38cdf0e10cSrcweir#ifndef __com_sun_star_util_MalformedNumberFormatException_idl__
39cdf0e10cSrcweir#include <com/sun/star/util/MalformedNumberFormatException.idl>
40cdf0e10cSrcweir#endif
41cdf0e10cSrcweir
42cdf0e10cSrcweir
43cdf0e10cSrcweir//=============================================================================
44cdf0e10cSrcweir
45cdf0e10cSrcweir module com {  module sun {  module star {  module util {
46cdf0e10cSrcweir
47cdf0e10cSrcweir//=============================================================================
48cdf0e10cSrcweir
49cdf0e10cSrcweir/** provides access to multiple <type>NumberFormat</type>s.
50*cf467b9eSTsutomu Uchino
51*cf467b9eSTsutomu Uchino    The number formats are managed by their unique key in the document.
52cdf0e10cSrcweir */
53cdf0e10cSrcweirpublished interface XNumberFormats: com::sun::star::uno::XInterface
54cdf0e10cSrcweir{
55cdf0e10cSrcweir	//-------------------------------------------------------------------------
56cdf0e10cSrcweir
57cdf0e10cSrcweir	/** @returns
58cdf0e10cSrcweir					a readonly <type>NumberFormatProperties</type>.
59*cf467b9eSTsutomu Uchino
60*cf467b9eSTsutomu Uchino		@param nKey
61*cf467b9eSTsutomu Uchino			the key for the format
62cdf0e10cSrcweir	 */
63cdf0e10cSrcweir	com::sun::star::beans::XPropertySet getByKey( [in] long nKey );
64cdf0e10cSrcweir
65cdf0e10cSrcweir	//-------------------------------------------------------------------------
66cdf0e10cSrcweir
67cdf0e10cSrcweir	/** @returns
68cdf0e10cSrcweir					a sequence of the keys of all number formats with the specified type and language.
69cdf0e10cSrcweir
70cdf0e10cSrcweir				@param	nType
71cdf0e10cSrcweir						the type of number formats to return. Must be one of the
72cdf0e10cSrcweir						<type>NumberFormat</type> constants.
73cdf0e10cSrcweir
74*cf467b9eSTsutomu Uchino				@param	nLocale
75*cf467b9eSTsutomu Uchino						the locale of number formats to return.
76cdf0e10cSrcweir
77cdf0e10cSrcweir				@param	bCreate
78cdf0e10cSrcweir						<TRUE/>: create new entries if no formats for the selected language exist<BR>
79cdf0e10cSrcweir						<FALSE/>: return an empty list if no formats for the selected language exist
80cdf0e10cSrcweir	 */
81cdf0e10cSrcweir	sequence<long> queryKeys( [in] short nType,
82cdf0e10cSrcweir			 [in] com::sun::star::lang::Locale nLocale,
83cdf0e10cSrcweir			 [in] boolean bCreate );
84cdf0e10cSrcweir
85cdf0e10cSrcweir	//-------------------------------------------------------------------------
86cdf0e10cSrcweir
87cdf0e10cSrcweir	/** finds a number format by its format string and returns its key.
88*cf467b9eSTsutomu Uchino
89*cf467b9eSTsutomu Uchino		@returns
90*cf467b9eSTsutomu Uchino			the key for the format if found, otherwise -1.
91*cf467b9eSTsutomu Uchino
92*cf467b9eSTsutomu Uchino		@param aFormat
93*cf467b9eSTsutomu Uchino			the string representation of the number format
94*cf467b9eSTsutomu Uchino
95*cf467b9eSTsutomu Uchino		@param nLocale
96*cf467b9eSTsutomu Uchino			the locale for number formats to find
97*cf467b9eSTsutomu Uchino
98*cf467b9eSTsutomu Uchino		@param bScan
99*cf467b9eSTsutomu Uchino			reserved for future use and should be set to false
100cdf0e10cSrcweir	 */
101cdf0e10cSrcweir	long queryKey( [in] string aFormat,
102cdf0e10cSrcweir			 [in] com::sun::star::lang::Locale nLocale,
103cdf0e10cSrcweir			 [in] boolean bScan );
104cdf0e10cSrcweir
105cdf0e10cSrcweir	//-------------------------------------------------------------------------
106cdf0e10cSrcweir
107cdf0e10cSrcweir	/** adds a new number format to the list, using a format string.
108*cf467b9eSTsutomu Uchino
109*cf467b9eSTsutomu Uchino		@returns
110*cf467b9eSTsutomu Uchino			the key for new number format
111*cf467b9eSTsutomu Uchino
112*cf467b9eSTsutomu Uchino		@param aFormat
113*cf467b9eSTsutomu Uchino			the string representation of the number format
114*cf467b9eSTsutomu Uchino
115*cf467b9eSTsutomu Uchino		@param nLocale
116*cf467b9eSTsutomu Uchino			the locale for the number format
117*cf467b9eSTsutomu Uchino
118*cf467b9eSTsutomu Uchino		@throws com::sun::star::util::MalformedNumberFormatException
119*cf467b9eSTsutomu Uchino			if incorrect number format is specified
120cdf0e10cSrcweir	 */
121cdf0e10cSrcweir	long addNew( [in] string aFormat,
122cdf0e10cSrcweir			 [in] com::sun::star::lang::Locale nLocale )
123cdf0e10cSrcweir			raises( com::sun::star::util::MalformedNumberFormatException );
124cdf0e10cSrcweir
125cdf0e10cSrcweir	//-------------------------------------------------------------------------
126cdf0e10cSrcweir
127cdf0e10cSrcweir	/** adds a new number format to the list, using a format
128cdf0e10cSrcweir		string in a different locale than the desired locale of the
129cdf0e10cSrcweir		resulting number format.
130*cf467b9eSTsutomu Uchino
131*cf467b9eSTsutomu Uchino		@returns
132*cf467b9eSTsutomu Uchino			the key for added number format
133*cf467b9eSTsutomu Uchino
134*cf467b9eSTsutomu Uchino		@param aFormat
135*cf467b9eSTsutomu Uchino			the key for the number format
136*cf467b9eSTsutomu Uchino
137*cf467b9eSTsutomu Uchino		@param nLocale
138*cf467b9eSTsutomu Uchino			the original locale for the number format
139*cf467b9eSTsutomu Uchino
140*cf467b9eSTsutomu Uchino		@param nNewLocale
141*cf467b9eSTsutomu Uchino			the new locale for the number format to be converted
142*cf467b9eSTsutomu Uchino
143*cf467b9eSTsutomu Uchino		@throws com::sun::star::util::MalformedNumberFormatException
144*cf467b9eSTsutomu Uchino			if incorrect number format is specified
145cdf0e10cSrcweir	 */
146cdf0e10cSrcweir	long addNewConverted( [in] string aFormat,
147cdf0e10cSrcweir			 [in] com::sun::star::lang::Locale nLocale,
148cdf0e10cSrcweir			 [in] com::sun::star::lang::Locale nNewLocale )
149cdf0e10cSrcweir			raises( com::sun::star::util::MalformedNumberFormatException );
150cdf0e10cSrcweir
151cdf0e10cSrcweir	//-------------------------------------------------------------------------
152cdf0e10cSrcweir
153cdf0e10cSrcweir	/** removes a number format from the list.
154*cf467b9eSTsutomu Uchino
155*cf467b9eSTsutomu Uchino		@param nKey
156*cf467b9eSTsutomu Uchino			the key for the numberformat
157cdf0e10cSrcweir	 */
158cdf0e10cSrcweir	void removeByKey( [in] long nKey );
159cdf0e10cSrcweir
160cdf0e10cSrcweir	//-------------------------------------------------------------------------
161cdf0e10cSrcweir
162cdf0e10cSrcweir	/** generates a format string from several parameters without
163cdf0e10cSrcweir		creating an actual number format.
164*cf467b9eSTsutomu Uchino
165*cf467b9eSTsutomu Uchino		@returns
166*cf467b9eSTsutomu Uchino			the string representation for the number format
167*cf467b9eSTsutomu Uchino
168*cf467b9eSTsutomu Uchino		@param nBaseKey
169*cf467b9eSTsutomu Uchino			the key for the number format to be used as base format
170*cf467b9eSTsutomu Uchino
171*cf467b9eSTsutomu Uchino		@param nLocale
172*cf467b9eSTsutomu Uchino			the locale for the number format
173*cf467b9eSTsutomu Uchino
174*cf467b9eSTsutomu Uchino		@param bThousands
175*cf467b9eSTsutomu Uchino			the thousands separator is shown or not
176*cf467b9eSTsutomu Uchino
177*cf467b9eSTsutomu Uchino		@param bRed
178*cf467b9eSTsutomu Uchino			show negative number in red colored if <TRUE/>
179*cf467b9eSTsutomu Uchino
180*cf467b9eSTsutomu Uchino		@param nDecimals
181*cf467b9eSTsutomu Uchino			how many digits are shown after the decimal point
182*cf467b9eSTsutomu Uchino
183*cf467b9eSTsutomu Uchino		@param nLeading
184*cf467b9eSTsutomu Uchino			how many number of leading zeros are shown
185cdf0e10cSrcweir	 */
186cdf0e10cSrcweir	string generateFormat( [in] long nBaseKey,
187cdf0e10cSrcweir			 [in] com::sun::star::lang::Locale nLocale,
188cdf0e10cSrcweir			 [in] boolean bThousands,
189cdf0e10cSrcweir			 [in] boolean bRed,
190cdf0e10cSrcweir			 [in] short nDecimals,
191cdf0e10cSrcweir			 [in] short nLeading );
192cdf0e10cSrcweir
193cdf0e10cSrcweir};
194cdf0e10cSrcweir
195cdf0e10cSrcweir//=============================================================================
196cdf0e10cSrcweir
197cdf0e10cSrcweir}; }; }; };
198cdf0e10cSrcweir
199cdf0e10cSrcweir#endif
200cdf0e10cSrcweir
201