xref: /aoo42x/main/basic/source/sbx/sbxconv.hxx (revision 234bd5c5)
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 _SBXCONV_HXX
25 #define _SBXCONV_HXX
26 
27 #include "sbxdec.hxx"
28 
29 class SbxArray;
30 
31 // SBXSCAN.CXX
32 extern void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, sal_Bool bCoreString=sal_False );
33 extern SbxError ImpScan
34 	( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, sal_uInt16* pLen,
35 	  sal_Bool bAllowIntntl=sal_False, sal_Bool bOnlyIntntl=sal_False );
36 
37 // mit erweiterter Auswertung (International, "sal_True"/"sal_False")
38 extern sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType );
39 
40 // SBXINT.CXX
41 
42 double 	    ImpRound( double );
43 sal_Int16 	    ImpGetInteger( const SbxValues* );
44 void        ImpPutInteger( SbxValues*, sal_Int16 );
45 sal_Int64 	ImpGetInt64( const SbxValues* );
46 void        ImpPutInt64( SbxValues*, sal_Int64 );
47 sal_uInt64 	ImpGetUInt64( const SbxValues* );
48 void        ImpPutUInt64( SbxValues*, sal_uInt64 );
49 
50 sal_Int64   ImpDoubleToSalInt64( double d );
51 sal_uInt64  ImpDoubleToSalUInt64( double d );
52 double      ImpSalUInt64ToDouble( sal_uInt64 n );
53 
54 // SBXLNG.CXX
55 
56 sal_Int32 	ImpGetLong( const SbxValues* );
57 void    ImpPutLong( SbxValues*, sal_Int32 );
58 
59 // SBXSNG.CXX
60 
61 float 	ImpGetSingle( const SbxValues* );
62 void    ImpPutSingle( SbxValues*, float );
63 
64 // SBXDBL.CXX
65 
66 double 	ImpGetDouble( const SbxValues* );
67 void    ImpPutDouble( SbxValues*, double, sal_Bool bCoreString=sal_False );
68 
69 #if FALSE
70 // SBX64.CXX
71 
72 SbxINT64  ImpGetINT64( const SbxValues* );
73 void      ImpPutINT64( SbxValues*, const SbxINT64& );
74 SbxUINT64 ImpGetUINT64( const SbxValues* );
75 void      ImpPutUINT64( SbxValues*, const SbxUINT64& );
76 #endif
77 
78 // SBXCURR.CXX
79 
80 SbxUINT64 ImpDoubleToUINT64( double );
81 double 	  ImpUINT64ToDouble( const SbxUINT64& );
82 SbxINT64  ImpDoubleToINT64( double );
83 double 	  ImpINT64ToDouble( const SbxINT64& );
84 
85 #if TRUE
86 sal_Int32	  ImpGetCurrLong( const SbxValues* );
87 void      ImpPutCurrLong( SbxValues*, sal_Int32 );
88 sal_Int32 	  ImpDoubleToCurrLong( double );
89 double 	  ImpCurrLongToDouble( sal_Int32 );
90 #endif
91 
92 SbxINT64  ImpGetCurrency( const SbxValues* );
93 void      ImpPutCurrency( SbxValues*, const SbxINT64& );
94 inline
ImpDoubleToCurrency(double d)95 SbxINT64  ImpDoubleToCurrency( double d )
96 		  { return ImpDoubleToINT64( d * CURRENCY_FACTOR ); }
97 inline
ImpCurrencyToDouble(const SbxINT64 & r)98 double 	  ImpCurrencyToDouble( const SbxINT64 &r )
99 		  { return ImpINT64ToDouble( r ) / CURRENCY_FACTOR; }
100 
101 
102 // SBXDEC.CXX
103 
104 SbxDecimal* ImpCreateDecimal( SbxValues* p );
105 SbxDecimal* ImpGetDecimal( const SbxValues* p );
106 void ImpPutDecimal( SbxValues* p, SbxDecimal* pDec );
107 
108 // SBXDATE.CXX
109 
110 double 	ImpGetDate( const SbxValues* );
111 void    ImpPutDate( SbxValues*, double );
112 
113 // SBXSTR.CXX
114 
115 ::rtl::OUString 	ImpGetString( const SbxValues* );
116 ::rtl::OUString 	ImpGetCoreString( const SbxValues* );
117 void   	ImpPutString( SbxValues*, const ::rtl::OUString* );
118 
119 // SBXCHAR.CXX
120 
121 sal_Unicode ImpGetChar( const SbxValues* );
122 void    ImpPutChar( SbxValues*, sal_Unicode );
123 
124 // SBXBYTE.CXX
125 sal_uInt8 	ImpGetByte( const SbxValues* );
126 void    ImpPutByte( SbxValues*, sal_uInt8 );
127 
128 // SBXUINT.CXX
129 
130 sal_uInt16 	ImpGetUShort( const SbxValues* );
131 void    ImpPutUShort( SbxValues*, sal_uInt16 );
132 
133 // SBXULNG.CXX
134 
135 sal_uInt32 	ImpGetULong( const SbxValues* );
136 void    ImpPutULong( SbxValues*, sal_uInt32 );
137 
138 // SBXBOOL.CXX
139 
140 enum SbxBOOL ImpGetBool( const SbxValues* );
141 void    ImpPutBool( SbxValues*, sal_Int16 );
142 
143 // ByteArry <--> String
144 SbxArray* StringToByteArray(const ::rtl::OUString& rStr);
145 ::rtl::OUString ByteArrayToString(SbxArray* pArr);
146 
147 #endif
148