Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / basic / source / sbx / sbxconv.hxx
blob4b369ce70768ce1f2de3db24fd6ccb155fe96161
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _SBXCONV_HXX
21 #define _SBXCONV_HXX
23 #include "sbxdec.hxx"
25 class SbxArray;
27 // SBXSCAN.CXX
28 extern void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, bool bCoreString=false );
29 extern SbxError ImpScan
30 ( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, sal_uInt16* pLen,
31 bool bAllowIntntl=false, bool bOnlyIntntl=false );
33 // with advanced evaluation (International, "TRUE"/"FALSE")
34 extern bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType );
36 void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep );
38 // SBXINT.CXX
40 double ImpRound( double );
41 sal_Int16 ImpGetInteger( const SbxValues* );
42 void ImpPutInteger( SbxValues*, sal_Int16 );
44 sal_Int64 ImpGetInt64( const SbxValues* );
45 void ImpPutInt64( SbxValues*, sal_Int64 );
46 sal_uInt64 ImpGetUInt64( const SbxValues* );
47 void ImpPutUInt64( SbxValues*, sal_uInt64 );
49 sal_Int64 ImpDoubleToSalInt64 ( double d );
50 sal_uInt64 ImpDoubleToSalUInt64( double d );
51 double ImpSalInt64ToDouble ( sal_Int64 n );
52 double ImpSalUInt64ToDouble( sal_uInt64 n );
54 // SBXLNG.CXX
56 sal_Int32 ImpGetLong( const SbxValues* );
57 void ImpPutLong( SbxValues*, sal_Int32 );
59 // SBXSNG.CXX
61 float ImpGetSingle( const SbxValues* );
62 void ImpPutSingle( SbxValues*, float );
64 // SBXDBL.CXX
66 double ImpGetDouble( const SbxValues* );
67 void ImpPutDouble( SbxValues*, double, bool bCoreString=false );
69 // SBXCURR.CXX
71 sal_Int64 ImpGetCurrency( const SbxValues* );
72 void ImpPutCurrency( SbxValues*, const sal_Int64 );
74 inline sal_Int64 ImpDoubleToCurrency( double d )
75 { if (d > 0) return (sal_Int64)( d * CURRENCY_FACTOR + 0.5);
76 else return (sal_Int64)( d * CURRENCY_FACTOR - 0.5);
79 inline double ImpCurrencyToDouble( const sal_Int64 r )
80 { return (double)r / (double)CURRENCY_FACTOR; }
83 // SBXDEC.CXX
85 SbxDecimal* ImpCreateDecimal( SbxValues* p );
86 SbxDecimal* ImpGetDecimal( const SbxValues* p );
87 void ImpPutDecimal( SbxValues* p, SbxDecimal* pDec );
89 // SBXDATE.CXX
91 double ImpGetDate( const SbxValues* );
92 void ImpPutDate( SbxValues*, double );
94 // SBXSTR.CXX
96 ::rtl::OUString ImpGetString( const SbxValues* );
97 ::rtl::OUString ImpGetCoreString( const SbxValues* );
98 void ImpPutString( SbxValues*, const ::rtl::OUString* );
100 // SBXCHAR.CXX
102 sal_Unicode ImpGetChar( const SbxValues* );
103 void ImpPutChar( SbxValues*, sal_Unicode );
105 // SBXBYTE.CXX
106 sal_uInt8 ImpGetByte( const SbxValues* );
107 void ImpPutByte( SbxValues*, sal_uInt8 );
109 // SBXUINT.CXX
111 sal_uInt16 ImpGetUShort( const SbxValues* );
112 void ImpPutUShort( SbxValues*, sal_uInt16 );
114 // SBXULNG.CXX
116 sal_uInt32 ImpGetULong( const SbxValues* );
117 void ImpPutULong( SbxValues*, sal_uInt32 );
119 // SBXBOOL.CXX
121 enum SbxBOOL ImpGetBool( const SbxValues* );
122 void ImpPutBool( SbxValues*, sal_Int16 );
124 // ByteArray <--> String
125 SbxArray* StringToByteArray(const ::rtl::OUString& rStr);
126 ::rtl::OUString ByteArrayToString(SbxArray* pArr);
128 #endif
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */