xref: /AOO41X/main/sc/inc/unitconv.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
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 
24 #ifndef SC_UNITCONV_HXX
25 #define SC_UNITCONV_HXX
26 
27 #include "collect.hxx"
28 
29 
30 class ScUnitConverterData : public StrData
31 {
32             double          fValue;
33 
34                             // not implemented
35     ScUnitConverterData&    operator=( const ScUnitConverterData& );
36 
37 public:
38                             ScUnitConverterData( const String& rFromUnit,
39                                 const String& rToUnit, double fValue = 1.0 );
40                             ScUnitConverterData( const ScUnitConverterData& );
~ScUnitConverterData()41     virtual                 ~ScUnitConverterData() {};
42 
43     virtual ScDataObject*       Clone() const;
44 
GetValue() const45             double          GetValue() const    { return fValue; }
46 
47     static  void            BuildIndexString( String& rStr,
48                                 const String& rFromUnit, const String& rToUnit );
49 
50 };
51 
52 
53 class ScUnitConverter : public ScStrCollection
54 {
55                             // not implemented
56                             ScUnitConverter( const ScUnitConverter& );
57         ScUnitConverter&    operator=( const ScUnitConverter& );
58 
59 public:
60                             ScUnitConverter( sal_uInt16 nInit = 16, sal_uInt16 nDelta = 4 );
~ScUnitConverter()61     virtual                 ~ScUnitConverter() {};
62 
63         sal_Bool                GetValue( double& fValue, const String& rFromUnit,
64                                 const String& rToUnit ) const;
65 };
66 
67 
68 #endif
69 
70