1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27#ifndef __com_sun_star_util_XNumberFormatter_idl__
28#define __com_sun_star_util_XNumberFormatter_idl__
29
30#ifndef __com_sun_star_uno_XInterface_idl__
31#include <com/sun/star/uno/XInterface.idl>
32#endif
33
34#ifndef __com_sun_star_util_Color_idl__
35#include <com/sun/star/util/Color.idl>
36#endif
37
38#ifndef __com_sun_star_util_XNumberFormatsSupplier_idl__
39#include <com/sun/star/util/XNumberFormatsSupplier.idl>
40#endif
41
42#ifndef __com_sun_star_util_NotNumericException_idl__
43#include <com/sun/star/util/NotNumericException.idl>
44#endif
45
46#ifndef __com_sun_star_util_Color_idl__
47#include <com/sun/star/util/Color.idl>
48#endif
49
50
51//=============================================================================
52
53 module com {  module sun {  module star {  module util {
54
55//=============================================================================
56
57/** represents a number formatter.
58 */
59published interface XNumberFormatter: com::sun::star::uno::XInterface
60{
61	//-------------------------------------------------------------------------
62
63	/** attaches an <type>XNumberFormatsSupplier</type> to this
64		<type>NumberFormatter</type>.
65
66		<p>This <type>NumberFormatter</type> will only use the <type>NumberFormats</type>
67		specified in the attached <type>XNumberFormatsSupplier</type>. Without an attached
68		<type>XNumberFormatsSupplier</type>, no formatting is possible.</p>
69	 */
70	void attachNumberFormatsSupplier( [in] com::sun::star::util::XNumberFormatsSupplier xSupplier );
71
72	//-------------------------------------------------------------------------
73
74	/** @returns
75				the attached <type>XNumberFormatsSupplier</type>.
76	 */
77	com::sun::star::util::XNumberFormatsSupplier getNumberFormatsSupplier();
78
79	//-------------------------------------------------------------------------
80
81	/** detects the number format in a string which contains a formatted number.
82	 */
83	long detectNumberFormat( [in] long nKey,
84			 [in] string aString )
85			raises( com::sun::star::util::NotNumericException );
86
87	//-------------------------------------------------------------------------
88
89	/** converts a string which contains a formatted number into a number.
90
91		<p>If this is a text format, the string will not be converted.</p>
92	 */
93	double convertStringToNumber( [in] long nKey,
94			 [in] string aString )
95			raises( com::sun::star::util::NotNumericException );
96
97	//-------------------------------------------------------------------------
98
99	/** converts a number into a string.
100	 */
101	string convertNumberToString( [in] long nKey,
102			 [in] double fValue );
103
104	//-------------------------------------------------------------------------
105
106	/** @returns
107				the color which is specified for the given value in the number format,
108				which is otherwise the value of <var>aDefaultColor</var>.
109	 */
110	com::sun::star::util::Color queryColorForNumber( [in] long nKey,
111			 [in] double fValue,
112			 [in] com::sun::star::util::Color aDefaultColor );
113
114	//-------------------------------------------------------------------------
115
116	/** converts a string into another string.
117	 */
118	string formatString( [in] long nKey,
119			 [in] string aString );
120
121	//-------------------------------------------------------------------------
122
123	/** @returns
124				the color which is specified for the given string in the number format,
125				which is otherwise the value of <var>aDefaultColor</var>.
126	 */
127	com::sun::star::util::Color queryColorForString( [in] long nKey,
128			 [in] string aString,
129			 [in] com::sun::star::util::Color aDefaultColor );
130
131	//-------------------------------------------------------------------------
132
133	/** converts a number into a string with the specified format.
134
135		<p>This string can always be converted back to a number using the same
136		format.
137		</p>
138	 */
139	string getInputString( [in] long nKey,
140			 [in] double fValue );
141
142};
143
144//=============================================================================
145
146}; }; }; };
147
148#endif
149
150