Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef _SBXCONV_HXX
21 : : #define _SBXCONV_HXX
22 : :
23 : : #include "sbxdec.hxx"
24 : :
25 : : class SbxArray;
26 : :
27 : : // SBXSCAN.CXX
28 : : extern void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, sal_Bool bCoreString=sal_False );
29 : : extern SbxError ImpScan
30 : : ( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, sal_uInt16* pLen,
31 : : sal_Bool bAllowIntntl=sal_False, sal_Bool bOnlyIntntl=sal_False );
32 : :
33 : : // with advanced evaluation (International, "TRUE"/"FALSE")
34 : : extern sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType );
35 : :
36 : : void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep );
37 : :
38 : : // SBXINT.CXX
39 : :
40 : : double ImpRound( double );
41 : : sal_Int16 ImpGetInteger( const SbxValues* );
42 : : void ImpPutInteger( SbxValues*, sal_Int16 );
43 : :
44 : : sal_Int64 ImpGetInt64( const SbxValues* );
45 : : void ImpPutInt64( SbxValues*, sal_Int64 );
46 : : sal_uInt64 ImpGetUInt64( const SbxValues* );
47 : : void ImpPutUInt64( SbxValues*, sal_uInt64 );
48 : :
49 : : sal_Int64 ImpDoubleToSalInt64 ( double d );
50 : : sal_uInt64 ImpDoubleToSalUInt64( double d );
51 : : double ImpSalInt64ToDouble ( sal_Int64 n );
52 : : double ImpSalUInt64ToDouble( sal_uInt64 n );
53 : :
54 : : // SBXLNG.CXX
55 : :
56 : : sal_Int32 ImpGetLong( const SbxValues* );
57 : : void ImpPutLong( SbxValues*, sal_Int32 );
58 : :
59 : : // SBXSNG.CXX
60 : :
61 : : float ImpGetSingle( const SbxValues* );
62 : : void ImpPutSingle( SbxValues*, float );
63 : :
64 : : // SBXDBL.CXX
65 : :
66 : : double ImpGetDouble( const SbxValues* );
67 : : void ImpPutDouble( SbxValues*, double, sal_Bool bCoreString=sal_False );
68 : :
69 : : // SBXCURR.CXX
70 : :
71 : : sal_Int64 ImpGetCurrency( const SbxValues* );
72 : : void ImpPutCurrency( SbxValues*, const sal_Int64 );
73 : :
74 : 0 : inline sal_Int64 ImpDoubleToCurrency( double d )
75 [ # # ]: 0 : { if (d > 0) return (sal_Int64)( d * CURRENCY_FACTOR + 0.5);
76 : 0 : else return (sal_Int64)( d * CURRENCY_FACTOR - 0.5);
77 : : }
78 : :
79 : 0 : inline double ImpCurrencyToDouble( const sal_Int64 r )
80 : 0 : { return (double)r / (double)CURRENCY_FACTOR; }
81 : :
82 : :
83 : : // SBXDEC.CXX
84 : :
85 : : SbxDecimal* ImpCreateDecimal( SbxValues* p );
86 : : SbxDecimal* ImpGetDecimal( const SbxValues* p );
87 : : void ImpPutDecimal( SbxValues* p, SbxDecimal* pDec );
88 : :
89 : : // SBXDATE.CXX
90 : :
91 : : double ImpGetDate( const SbxValues* );
92 : : void ImpPutDate( SbxValues*, double );
93 : :
94 : : // SBXSTR.CXX
95 : :
96 : : ::rtl::OUString ImpGetString( const SbxValues* );
97 : : ::rtl::OUString ImpGetCoreString( const SbxValues* );
98 : : void ImpPutString( SbxValues*, const ::rtl::OUString* );
99 : :
100 : : // SBXCHAR.CXX
101 : :
102 : : sal_Unicode ImpGetChar( const SbxValues* );
103 : : void ImpPutChar( SbxValues*, sal_Unicode );
104 : :
105 : : // SBXBYTE.CXX
106 : : sal_uInt8 ImpGetByte( const SbxValues* );
107 : : void ImpPutByte( SbxValues*, sal_uInt8 );
108 : :
109 : : // SBXUINT.CXX
110 : :
111 : : sal_uInt16 ImpGetUShort( const SbxValues* );
112 : : void ImpPutUShort( SbxValues*, sal_uInt16 );
113 : :
114 : : // SBXULNG.CXX
115 : :
116 : : sal_uInt32 ImpGetULong( const SbxValues* );
117 : : void ImpPutULong( SbxValues*, sal_uInt32 );
118 : :
119 : : // SBXBOOL.CXX
120 : :
121 : : enum SbxBOOL ImpGetBool( const SbxValues* );
122 : : void ImpPutBool( SbxValues*, sal_Int16 );
123 : :
124 : : // ByteArray <--> String
125 : : SbxArray* StringToByteArray(const ::rtl::OUString& rStr);
126 : : ::rtl::OUString ByteArrayToString(SbxArray* pArr);
127 : :
128 : : #endif
129 : :
130 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|