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