xref: /AOO41X/main/offapi/com/sun/star/util/XNumberFormatter.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_XNumberFormatter_idl__
24#define __com_sun_star_util_XNumberFormatter_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_util_Color_idl__
31#include <com/sun/star/util/Color.idl>
32#endif
33
34#ifndef __com_sun_star_util_XNumberFormatsSupplier_idl__
35#include <com/sun/star/util/XNumberFormatsSupplier.idl>
36#endif
37
38#ifndef __com_sun_star_util_NotNumericException_idl__
39#include <com/sun/star/util/NotNumericException.idl>
40#endif
41
42#ifndef __com_sun_star_util_Color_idl__
43#include <com/sun/star/util/Color.idl>
44#endif
45
46
47//=============================================================================
48
49 module com {  module sun {  module star {  module util {
50
51//=============================================================================
52
53/** represents a number formatter.
54 */
55published interface XNumberFormatter: com::sun::star::uno::XInterface
56{
57    //-------------------------------------------------------------------------
58
59    /** attaches an <type>XNumberFormatsSupplier</type> to this
60        <type>NumberFormatter</type>.
61
62        <p>This <type>NumberFormatter</type> will only use the <type>NumberFormats</type>
63        specified in the attached <type>XNumberFormatsSupplier</type>. Without an attached
64        <type>XNumberFormatsSupplier</type>, no formatting is possible.</p>
65     */
66    void attachNumberFormatsSupplier( [in] com::sun::star::util::XNumberFormatsSupplier xSupplier );
67
68    //-------------------------------------------------------------------------
69
70    /** @returns
71                the attached <type>XNumberFormatsSupplier</type>.
72     */
73    com::sun::star::util::XNumberFormatsSupplier getNumberFormatsSupplier();
74
75    //-------------------------------------------------------------------------
76
77    /** detects the number format in a string which contains a formatted number.
78     */
79    long detectNumberFormat( [in] long nKey,
80             [in] string aString )
81            raises( com::sun::star::util::NotNumericException );
82
83    //-------------------------------------------------------------------------
84
85    /** converts a string which contains a formatted number into a number.
86
87        <p>If this is a text format, the string will not be converted.</p>
88     */
89    double convertStringToNumber( [in] long nKey,
90             [in] string aString )
91            raises( com::sun::star::util::NotNumericException );
92
93    //-------------------------------------------------------------------------
94
95    /** converts a number into a string.
96     */
97    string convertNumberToString( [in] long nKey,
98             [in] double fValue );
99
100    //-------------------------------------------------------------------------
101
102    /** @returns
103                the color which is specified for the given value in the number format,
104                which is otherwise the value of <var>aDefaultColor</var>.
105     */
106    com::sun::star::util::Color queryColorForNumber( [in] long nKey,
107             [in] double fValue,
108             [in] com::sun::star::util::Color aDefaultColor );
109
110    //-------------------------------------------------------------------------
111
112    /** converts a string into another string.
113     */
114    string formatString( [in] long nKey,
115             [in] string aString );
116
117    //-------------------------------------------------------------------------
118
119    /** @returns
120                the color which is specified for the given string in the number format,
121                which is otherwise the value of <var>aDefaultColor</var>.
122     */
123    com::sun::star::util::Color queryColorForString( [in] long nKey,
124             [in] string aString,
125             [in] com::sun::star::util::Color aDefaultColor );
126
127    //-------------------------------------------------------------------------
128
129    /** converts a number into a string with the specified format.
130
131        <p>This string can always be converted back to a number using the same
132        format.
133        </p>
134     */
135    string getInputString( [in] long nKey,
136             [in] double fValue );
137
138};
139
140//=============================================================================
141
142}; }; }; };
143
144#endif
145
146