1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_BASIC_SOURCE_SBX_SBXCONV_HXX
21 #define INCLUDED_BASIC_SOURCE_SBX_SBXCONV_HXX
24 #include <basic/sbx.hxx>
29 extern void ImpCvtNum( double nNum
, short nPrec
, OUString
& rRes
, bool bCoreString
=false );
30 extern ErrCode ImpScan
31 ( const OUString
& rSrc
, double& nVal
, SbxDataType
& rType
, sal_uInt16
* pLen
,
34 // with advanced evaluation (International, "TRUE"/"FALSE")
35 extern bool ImpConvStringExt( OUString
& rSrc
, SbxDataType eTargetType
);
37 void ImpGetIntntlSep( sal_Unicode
& rcDecimalSep
, sal_Unicode
& rcThousandSep
, sal_Unicode
& rcDecimalSepAlt
);
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 ImpSalUInt64ToDouble( sal_uInt64 n
);
55 sal_Int32
ImpGetLong( const SbxValues
* );
56 void ImpPutLong( SbxValues
*, sal_Int32
);
60 float ImpGetSingle( const SbxValues
* );
61 void ImpPutSingle( SbxValues
*, float );
65 double ImpGetDouble( const SbxValues
* );
66 void ImpPutDouble( SbxValues
*, double, bool bCoreString
=false );
70 sal_Int64
ImpGetCurrency( const SbxValues
* );
71 void ImpPutCurrency( SbxValues
*, const sal_Int64
);
73 inline sal_Int64
ImpDoubleToCurrency( double d
)
76 return static_cast<sal_Int64
>( d
* CURRENCY_FACTOR
+ 0.5);
78 return static_cast<sal_Int64
>( d
* CURRENCY_FACTOR
- 0.5);
81 inline double ImpCurrencyToDouble( const sal_Int64 r
)
82 { return static_cast<double>(r
) / double(CURRENCY_FACTOR
); }
87 SbxDecimal
* ImpCreateDecimal( SbxValues
* p
);
88 SbxDecimal
* ImpGetDecimal( const SbxValues
* p
);
89 void ImpPutDecimal( SbxValues
* p
, SbxDecimal
* pDec
);
93 double ImpGetDate( const SbxValues
* );
94 void ImpPutDate( SbxValues
*, double );
98 OUString
ImpGetString( const SbxValues
* );
99 OUString
ImpGetCoreString( const SbxValues
* );
100 void ImpPutString( SbxValues
*, const OUString
* );
104 sal_Unicode
ImpGetChar( const SbxValues
* );
105 void ImpPutChar( SbxValues
*, sal_Unicode
);
108 sal_uInt8
ImpGetByte( const SbxValues
* );
109 void ImpPutByte( SbxValues
*, sal_uInt8
);
113 sal_uInt16
ImpGetUShort( const SbxValues
* );
114 void ImpPutUShort( SbxValues
*, sal_uInt16
);
118 sal_uInt32
ImpGetULong( const SbxValues
* );
119 void ImpPutULong( SbxValues
*, sal_uInt32
);
123 enum SbxBOOL
ImpGetBool( const SbxValues
* );
124 void ImpPutBool( SbxValues
*, sal_Int16
);
126 // ByteArray <--> String
127 SbxArray
* StringToByteArray(const OUString
& rStr
);
128 OUString
ByteArrayToString(SbxArray
* pArr
);
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */