xref: /AOO41X/main/basic/source/sbx/sbxconv.hxx (revision 234bd5c559aaf7abbd02d045859137b774cd8b34)
1*234bd5c5SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*234bd5c5SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*234bd5c5SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*234bd5c5SAndrew Rist  * distributed with this work for additional information
6*234bd5c5SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*234bd5c5SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*234bd5c5SAndrew Rist  * "License"); you may not use this file except in compliance
9*234bd5c5SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*234bd5c5SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*234bd5c5SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*234bd5c5SAndrew Rist  * software distributed under the License is distributed on an
15*234bd5c5SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*234bd5c5SAndrew Rist  * KIND, either express or implied.  See the License for the
17*234bd5c5SAndrew Rist  * specific language governing permissions and limitations
18*234bd5c5SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*234bd5c5SAndrew Rist  *************************************************************/
21*234bd5c5SAndrew Rist 
22*234bd5c5SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SBXCONV_HXX
25cdf0e10cSrcweir #define _SBXCONV_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "sbxdec.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir class SbxArray;
30cdf0e10cSrcweir 
31cdf0e10cSrcweir // SBXSCAN.CXX
32cdf0e10cSrcweir extern void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, sal_Bool bCoreString=sal_False );
33cdf0e10cSrcweir extern SbxError ImpScan
34cdf0e10cSrcweir 	( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, sal_uInt16* pLen,
35cdf0e10cSrcweir 	  sal_Bool bAllowIntntl=sal_False, sal_Bool bOnlyIntntl=sal_False );
36cdf0e10cSrcweir 
37cdf0e10cSrcweir // mit erweiterter Auswertung (International, "sal_True"/"sal_False")
38cdf0e10cSrcweir extern sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType );
39cdf0e10cSrcweir 
40cdf0e10cSrcweir // SBXINT.CXX
41cdf0e10cSrcweir 
42cdf0e10cSrcweir double 	    ImpRound( double );
43cdf0e10cSrcweir sal_Int16 	    ImpGetInteger( const SbxValues* );
44cdf0e10cSrcweir void        ImpPutInteger( SbxValues*, sal_Int16 );
45cdf0e10cSrcweir sal_Int64 	ImpGetInt64( const SbxValues* );
46cdf0e10cSrcweir void        ImpPutInt64( SbxValues*, sal_Int64 );
47cdf0e10cSrcweir sal_uInt64 	ImpGetUInt64( const SbxValues* );
48cdf0e10cSrcweir void        ImpPutUInt64( SbxValues*, sal_uInt64 );
49cdf0e10cSrcweir 
50cdf0e10cSrcweir sal_Int64   ImpDoubleToSalInt64( double d );
51cdf0e10cSrcweir sal_uInt64  ImpDoubleToSalUInt64( double d );
52cdf0e10cSrcweir double      ImpSalUInt64ToDouble( sal_uInt64 n );
53cdf0e10cSrcweir 
54cdf0e10cSrcweir // SBXLNG.CXX
55cdf0e10cSrcweir 
56cdf0e10cSrcweir sal_Int32 	ImpGetLong( const SbxValues* );
57cdf0e10cSrcweir void    ImpPutLong( SbxValues*, sal_Int32 );
58cdf0e10cSrcweir 
59cdf0e10cSrcweir // SBXSNG.CXX
60cdf0e10cSrcweir 
61cdf0e10cSrcweir float 	ImpGetSingle( const SbxValues* );
62cdf0e10cSrcweir void    ImpPutSingle( SbxValues*, float );
63cdf0e10cSrcweir 
64cdf0e10cSrcweir // SBXDBL.CXX
65cdf0e10cSrcweir 
66cdf0e10cSrcweir double 	ImpGetDouble( const SbxValues* );
67cdf0e10cSrcweir void    ImpPutDouble( SbxValues*, double, sal_Bool bCoreString=sal_False );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir #if FALSE
70cdf0e10cSrcweir // SBX64.CXX
71cdf0e10cSrcweir 
72cdf0e10cSrcweir SbxINT64  ImpGetINT64( const SbxValues* );
73cdf0e10cSrcweir void      ImpPutINT64( SbxValues*, const SbxINT64& );
74cdf0e10cSrcweir SbxUINT64 ImpGetUINT64( const SbxValues* );
75cdf0e10cSrcweir void      ImpPutUINT64( SbxValues*, const SbxUINT64& );
76cdf0e10cSrcweir #endif
77cdf0e10cSrcweir 
78cdf0e10cSrcweir // SBXCURR.CXX
79cdf0e10cSrcweir 
80cdf0e10cSrcweir SbxUINT64 ImpDoubleToUINT64( double );
81cdf0e10cSrcweir double 	  ImpUINT64ToDouble( const SbxUINT64& );
82cdf0e10cSrcweir SbxINT64  ImpDoubleToINT64( double );
83cdf0e10cSrcweir double 	  ImpINT64ToDouble( const SbxINT64& );
84cdf0e10cSrcweir 
85cdf0e10cSrcweir #if TRUE
86cdf0e10cSrcweir sal_Int32	  ImpGetCurrLong( const SbxValues* );
87cdf0e10cSrcweir void      ImpPutCurrLong( SbxValues*, sal_Int32 );
88cdf0e10cSrcweir sal_Int32 	  ImpDoubleToCurrLong( double );
89cdf0e10cSrcweir double 	  ImpCurrLongToDouble( sal_Int32 );
90cdf0e10cSrcweir #endif
91cdf0e10cSrcweir 
92cdf0e10cSrcweir SbxINT64  ImpGetCurrency( const SbxValues* );
93cdf0e10cSrcweir void      ImpPutCurrency( SbxValues*, const SbxINT64& );
94cdf0e10cSrcweir inline
ImpDoubleToCurrency(double d)95cdf0e10cSrcweir SbxINT64  ImpDoubleToCurrency( double d )
96cdf0e10cSrcweir 		  { return ImpDoubleToINT64( d * CURRENCY_FACTOR ); }
97cdf0e10cSrcweir inline
ImpCurrencyToDouble(const SbxINT64 & r)98cdf0e10cSrcweir double 	  ImpCurrencyToDouble( const SbxINT64 &r )
99cdf0e10cSrcweir 		  { return ImpINT64ToDouble( r ) / CURRENCY_FACTOR; }
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 
102cdf0e10cSrcweir // SBXDEC.CXX
103cdf0e10cSrcweir 
104cdf0e10cSrcweir SbxDecimal* ImpCreateDecimal( SbxValues* p );
105cdf0e10cSrcweir SbxDecimal* ImpGetDecimal( const SbxValues* p );
106cdf0e10cSrcweir void ImpPutDecimal( SbxValues* p, SbxDecimal* pDec );
107cdf0e10cSrcweir 
108cdf0e10cSrcweir // SBXDATE.CXX
109cdf0e10cSrcweir 
110cdf0e10cSrcweir double 	ImpGetDate( const SbxValues* );
111cdf0e10cSrcweir void    ImpPutDate( SbxValues*, double );
112cdf0e10cSrcweir 
113cdf0e10cSrcweir // SBXSTR.CXX
114cdf0e10cSrcweir 
115cdf0e10cSrcweir ::rtl::OUString 	ImpGetString( const SbxValues* );
116cdf0e10cSrcweir ::rtl::OUString 	ImpGetCoreString( const SbxValues* );
117cdf0e10cSrcweir void   	ImpPutString( SbxValues*, const ::rtl::OUString* );
118cdf0e10cSrcweir 
119cdf0e10cSrcweir // SBXCHAR.CXX
120cdf0e10cSrcweir 
121cdf0e10cSrcweir sal_Unicode ImpGetChar( const SbxValues* );
122cdf0e10cSrcweir void    ImpPutChar( SbxValues*, sal_Unicode );
123cdf0e10cSrcweir 
124cdf0e10cSrcweir // SBXBYTE.CXX
125cdf0e10cSrcweir sal_uInt8 	ImpGetByte( const SbxValues* );
126cdf0e10cSrcweir void    ImpPutByte( SbxValues*, sal_uInt8 );
127cdf0e10cSrcweir 
128cdf0e10cSrcweir // SBXUINT.CXX
129cdf0e10cSrcweir 
130cdf0e10cSrcweir sal_uInt16 	ImpGetUShort( const SbxValues* );
131cdf0e10cSrcweir void    ImpPutUShort( SbxValues*, sal_uInt16 );
132cdf0e10cSrcweir 
133cdf0e10cSrcweir // SBXULNG.CXX
134cdf0e10cSrcweir 
135cdf0e10cSrcweir sal_uInt32 	ImpGetULong( const SbxValues* );
136cdf0e10cSrcweir void    ImpPutULong( SbxValues*, sal_uInt32 );
137cdf0e10cSrcweir 
138cdf0e10cSrcweir // SBXBOOL.CXX
139cdf0e10cSrcweir 
140cdf0e10cSrcweir enum SbxBOOL ImpGetBool( const SbxValues* );
141cdf0e10cSrcweir void    ImpPutBool( SbxValues*, sal_Int16 );
142cdf0e10cSrcweir 
143cdf0e10cSrcweir // ByteArry <--> String
144cdf0e10cSrcweir SbxArray* StringToByteArray(const ::rtl::OUString& rStr);
145cdf0e10cSrcweir ::rtl::OUString ByteArrayToString(SbxArray* pArr);
146cdf0e10cSrcweir 
147cdf0e10cSrcweir #endif
148