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 :
21 : #ifndef INCLUDED_BASIC_SOURCE_SBX_SBXDEC_HXX
22 : #define INCLUDED_BASIC_SOURCE_SBX_SBXDEC_HXX
23 :
24 : #ifdef WNT
25 : #include <prewin.h>
26 : #include <postwin.h>
27 :
28 : #ifndef __MINGW32__
29 : #include <comutil.h>
30 : #endif
31 : #include <oleauto.h>
32 :
33 : #endif
34 : #endif
35 :
36 : #include <basic/sbx.hxx>
37 :
38 : #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
39 :
40 :
41 : // Decimal support
42 : // Implementation only for windows
43 :
44 : class SbxDecimal
45 : {
46 : friend void releaseDecimalPtr( SbxDecimal*& rpDecimal );
47 :
48 : #ifdef WIN32
49 : DECIMAL maDec;
50 : #endif
51 : sal_Int32 mnRefCount;
52 :
53 : public:
54 : SbxDecimal( void );
55 : SbxDecimal( const SbxDecimal& rDec );
56 : SbxDecimal( const com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
57 :
58 : ~SbxDecimal();
59 :
60 0 : void addRef( void )
61 0 : { mnRefCount++; }
62 :
63 : void fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
64 :
65 : void setChar( sal_Unicode val );
66 : void setByte( sal_uInt8 val );
67 : void setShort( sal_Int16 val );
68 : void setLong( sal_Int32 val );
69 : void setUShort( sal_uInt16 val );
70 : void setULong( sal_uInt32 val );
71 : bool setSingle( float val );
72 : bool setDouble( double val );
73 : void setInt( int val );
74 : void setUInt( unsigned int val );
75 : bool setString( OUString* pOUString );
76 0 : void setDecimal( SbxDecimal* pDecimal )
77 : {
78 : #ifdef WIN32
79 : if( pDecimal )
80 : maDec = pDecimal->maDec;
81 : #else
82 : (void)pDecimal;
83 : #endif
84 0 : }
85 :
86 : bool getChar( sal_Unicode& rVal );
87 : bool getShort( sal_Int16& rVal );
88 : bool getLong( sal_Int32& rVal );
89 : bool getUShort( sal_uInt16& rVal );
90 : bool getULong( sal_uInt32& rVal );
91 : bool getSingle( float& rVal );
92 : bool getDouble( double& rVal );
93 : bool getInt( int& rVal );
94 : bool getUInt( unsigned int& rVal );
95 : bool getString( OUString& rString );
96 :
97 : bool operator -= ( const SbxDecimal &r );
98 : bool operator += ( const SbxDecimal &r );
99 : bool operator /= ( const SbxDecimal &r );
100 : bool operator *= ( const SbxDecimal &r );
101 : bool neg( void );
102 :
103 : bool isZero( void );
104 :
105 : enum CmpResult { LT, EQ, GT };
106 : friend CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight );
107 : };
108 :
109 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|