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