Update ooo320-m1
[ooovba.git] / basic / source / sbx / sbxdec.hxx
blobbec0b9f845474806710ae7e6a738c158366be854
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sbxdec.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #ifndef __SBX_SBX_DEC_HXX
33 #define __SBX_SBX_DEC_HXX
35 #ifdef WIN32
37 #undef WB_LEFT
38 #undef WB_RIGHT
39 #include <tools/prewin.h>
40 } // close extern "C" {
42 #ifndef __MINGW32__
43 #include <comutil.h>
44 #endif
45 #include <oleauto.h>
47 extern "C" { // reopen extern "C" {
48 #include <tools/postwin.h>
50 #endif
51 #endif
52 #include <basic/sbx.hxx>
54 #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
57 // Decimal support
58 // Implementation only for windows
60 class SbxDecimal
62 friend void releaseDecimalPtr( SbxDecimal*& rpDecimal );
64 #ifdef WIN32
65 DECIMAL maDec;
66 #endif
67 INT32 mnRefCount;
69 public:
70 SbxDecimal( void );
71 SbxDecimal( const SbxDecimal& rDec );
72 SbxDecimal( const com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
74 ~SbxDecimal();
76 void addRef( void )
77 { mnRefCount++; }
79 void fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
81 void setChar( sal_Unicode val );
82 void setByte( BYTE val );
83 void setShort( INT16 val );
84 void setLong( INT32 val );
85 void setUShort( UINT16 val );
86 void setULong( UINT32 val );
87 bool setSingle( float val );
88 bool setDouble( double val );
89 void setInt( int val );
90 void setUInt( unsigned int val );
91 bool setString( String* pString );
92 void setDecimal( SbxDecimal* pDecimal )
94 #ifdef WIN32
95 if( pDecimal )
96 maDec = pDecimal->maDec;
97 #else
98 (void)pDecimal;
99 #endif
102 bool getChar( sal_Unicode& rVal );
103 bool getByte( BYTE& rVal );
104 bool getShort( INT16& rVal );
105 bool getLong( INT32& rVal );
106 bool getUShort( UINT16& rVal );
107 bool getULong( UINT32& rVal );
108 bool getSingle( float& rVal );
109 bool getDouble( double& rVal );
110 bool getInt( int& rVal );
111 bool getUInt( unsigned int& rVal );
112 bool getString( String& rString );
114 bool operator -= ( const SbxDecimal &r );
115 bool operator += ( const SbxDecimal &r );
116 bool operator /= ( const SbxDecimal &r );
117 bool operator *= ( const SbxDecimal &r );
118 bool neg( void );
120 bool isZero( void );
122 enum CmpResult { LT, EQ, GT };
123 friend CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight );