xref: /AOO41X/main/basic/source/sbx/sbxconv.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _SBXCONV_HXX
29*cdf0e10cSrcweir #define _SBXCONV_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "sbxdec.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir class SbxArray;
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir // SBXSCAN.CXX
36*cdf0e10cSrcweir extern void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, sal_Bool bCoreString=sal_False );
37*cdf0e10cSrcweir extern SbxError ImpScan
38*cdf0e10cSrcweir 	( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, sal_uInt16* pLen,
39*cdf0e10cSrcweir 	  sal_Bool bAllowIntntl=sal_False, sal_Bool bOnlyIntntl=sal_False );
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir // mit erweiterter Auswertung (International, "sal_True"/"sal_False")
42*cdf0e10cSrcweir extern sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType );
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir // SBXINT.CXX
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir double 	    ImpRound( double );
47*cdf0e10cSrcweir sal_Int16 	    ImpGetInteger( const SbxValues* );
48*cdf0e10cSrcweir void        ImpPutInteger( SbxValues*, sal_Int16 );
49*cdf0e10cSrcweir sal_Int64 	ImpGetInt64( const SbxValues* );
50*cdf0e10cSrcweir void        ImpPutInt64( SbxValues*, sal_Int64 );
51*cdf0e10cSrcweir sal_uInt64 	ImpGetUInt64( const SbxValues* );
52*cdf0e10cSrcweir void        ImpPutUInt64( SbxValues*, sal_uInt64 );
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir sal_Int64   ImpDoubleToSalInt64( double d );
55*cdf0e10cSrcweir sal_uInt64  ImpDoubleToSalUInt64( double d );
56*cdf0e10cSrcweir double      ImpSalUInt64ToDouble( sal_uInt64 n );
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir // SBXLNG.CXX
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir sal_Int32 	ImpGetLong( const SbxValues* );
61*cdf0e10cSrcweir void    ImpPutLong( SbxValues*, sal_Int32 );
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir // SBXSNG.CXX
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir float 	ImpGetSingle( const SbxValues* );
66*cdf0e10cSrcweir void    ImpPutSingle( SbxValues*, float );
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir // SBXDBL.CXX
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir double 	ImpGetDouble( const SbxValues* );
71*cdf0e10cSrcweir void    ImpPutDouble( SbxValues*, double, sal_Bool bCoreString=sal_False );
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir #if FALSE
74*cdf0e10cSrcweir // SBX64.CXX
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir SbxINT64  ImpGetINT64( const SbxValues* );
77*cdf0e10cSrcweir void      ImpPutINT64( SbxValues*, const SbxINT64& );
78*cdf0e10cSrcweir SbxUINT64 ImpGetUINT64( const SbxValues* );
79*cdf0e10cSrcweir void      ImpPutUINT64( SbxValues*, const SbxUINT64& );
80*cdf0e10cSrcweir #endif
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir // SBXCURR.CXX
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir SbxUINT64 ImpDoubleToUINT64( double );
85*cdf0e10cSrcweir double 	  ImpUINT64ToDouble( const SbxUINT64& );
86*cdf0e10cSrcweir SbxINT64  ImpDoubleToINT64( double );
87*cdf0e10cSrcweir double 	  ImpINT64ToDouble( const SbxINT64& );
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir #if TRUE
90*cdf0e10cSrcweir sal_Int32	  ImpGetCurrLong( const SbxValues* );
91*cdf0e10cSrcweir void      ImpPutCurrLong( SbxValues*, sal_Int32 );
92*cdf0e10cSrcweir sal_Int32 	  ImpDoubleToCurrLong( double );
93*cdf0e10cSrcweir double 	  ImpCurrLongToDouble( sal_Int32 );
94*cdf0e10cSrcweir #endif
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir SbxINT64  ImpGetCurrency( const SbxValues* );
97*cdf0e10cSrcweir void      ImpPutCurrency( SbxValues*, const SbxINT64& );
98*cdf0e10cSrcweir inline
99*cdf0e10cSrcweir SbxINT64  ImpDoubleToCurrency( double d )
100*cdf0e10cSrcweir 		  { return ImpDoubleToINT64( d * CURRENCY_FACTOR ); }
101*cdf0e10cSrcweir inline
102*cdf0e10cSrcweir double 	  ImpCurrencyToDouble( const SbxINT64 &r )
103*cdf0e10cSrcweir 		  { return ImpINT64ToDouble( r ) / CURRENCY_FACTOR; }
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir // SBXDEC.CXX
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir SbxDecimal* ImpCreateDecimal( SbxValues* p );
109*cdf0e10cSrcweir SbxDecimal* ImpGetDecimal( const SbxValues* p );
110*cdf0e10cSrcweir void ImpPutDecimal( SbxValues* p, SbxDecimal* pDec );
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir // SBXDATE.CXX
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir double 	ImpGetDate( const SbxValues* );
115*cdf0e10cSrcweir void    ImpPutDate( SbxValues*, double );
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir // SBXSTR.CXX
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir ::rtl::OUString 	ImpGetString( const SbxValues* );
120*cdf0e10cSrcweir ::rtl::OUString 	ImpGetCoreString( const SbxValues* );
121*cdf0e10cSrcweir void   	ImpPutString( SbxValues*, const ::rtl::OUString* );
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir // SBXCHAR.CXX
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir sal_Unicode ImpGetChar( const SbxValues* );
126*cdf0e10cSrcweir void    ImpPutChar( SbxValues*, sal_Unicode );
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir // SBXBYTE.CXX
129*cdf0e10cSrcweir sal_uInt8 	ImpGetByte( const SbxValues* );
130*cdf0e10cSrcweir void    ImpPutByte( SbxValues*, sal_uInt8 );
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir // SBXUINT.CXX
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir sal_uInt16 	ImpGetUShort( const SbxValues* );
135*cdf0e10cSrcweir void    ImpPutUShort( SbxValues*, sal_uInt16 );
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir // SBXULNG.CXX
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir sal_uInt32 	ImpGetULong( const SbxValues* );
140*cdf0e10cSrcweir void    ImpPutULong( SbxValues*, sal_uInt32 );
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir // SBXBOOL.CXX
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir enum SbxBOOL ImpGetBool( const SbxValues* );
145*cdf0e10cSrcweir void    ImpPutBool( SbxValues*, sal_Int16 );
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir // ByteArry <--> String
148*cdf0e10cSrcweir SbxArray* StringToByteArray(const ::rtl::OUString& rStr);
149*cdf0e10cSrcweir ::rtl::OUString ByteArrayToString(SbxArray* pArr);
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir #endif
152