1*234bd5c5SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*234bd5c5SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*234bd5c5SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*234bd5c5SAndrew Rist * distributed with this work for additional information 6*234bd5c5SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*234bd5c5SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*234bd5c5SAndrew Rist * "License"); you may not use this file except in compliance 9*234bd5c5SAndrew Rist * with the License. You may obtain a copy of the License at 10*234bd5c5SAndrew Rist * 11*234bd5c5SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*234bd5c5SAndrew Rist * 13*234bd5c5SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*234bd5c5SAndrew Rist * software distributed under the License is distributed on an 15*234bd5c5SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*234bd5c5SAndrew Rist * KIND, either express or implied. See the License for the 17*234bd5c5SAndrew Rist * specific language governing permissions and limitations 18*234bd5c5SAndrew Rist * under the License. 19*234bd5c5SAndrew Rist * 20*234bd5c5SAndrew Rist *************************************************************/ 21*234bd5c5SAndrew Rist 22*234bd5c5SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir 25cdf0e10cSrcweir #ifndef __SBX_SBX_DEC_HXX 26cdf0e10cSrcweir #define __SBX_SBX_DEC_HXX 27cdf0e10cSrcweir 28cdf0e10cSrcweir #ifdef WIN32 29cdf0e10cSrcweir 30cdf0e10cSrcweir #undef WB_LEFT 31cdf0e10cSrcweir #undef WB_RIGHT 32cdf0e10cSrcweir #include <tools/prewin.h> 33cdf0e10cSrcweir } // close extern "C" { 34cdf0e10cSrcweir 35cdf0e10cSrcweir #ifndef __MINGW32__ 36cdf0e10cSrcweir #include <comutil.h> 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir #include <oleauto.h> 39cdf0e10cSrcweir 40cdf0e10cSrcweir extern "C" { // reopen extern "C" { 41cdf0e10cSrcweir #include <tools/postwin.h> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #endif 44cdf0e10cSrcweir #endif 45cdf0e10cSrcweir #include <basic/sbx.hxx> 46cdf0e10cSrcweir 47cdf0e10cSrcweir #include <com/sun/star/bridge/oleautomation/Decimal.hpp> 48cdf0e10cSrcweir 49cdf0e10cSrcweir 50cdf0e10cSrcweir // Decimal support 51cdf0e10cSrcweir // Implementation only for windows 52cdf0e10cSrcweir 53cdf0e10cSrcweir class SbxDecimal 54cdf0e10cSrcweir { 55cdf0e10cSrcweir friend void releaseDecimalPtr( SbxDecimal*& rpDecimal ); 56cdf0e10cSrcweir 57cdf0e10cSrcweir #ifdef WIN32 58cdf0e10cSrcweir DECIMAL maDec; 59cdf0e10cSrcweir #endif 60cdf0e10cSrcweir sal_Int32 mnRefCount; 61cdf0e10cSrcweir 62cdf0e10cSrcweir public: 63cdf0e10cSrcweir SbxDecimal( void ); 64cdf0e10cSrcweir SbxDecimal( const SbxDecimal& rDec ); 65cdf0e10cSrcweir SbxDecimal( const com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); 66cdf0e10cSrcweir 67cdf0e10cSrcweir ~SbxDecimal(); 68cdf0e10cSrcweir 69cdf0e10cSrcweir void addRef( void ) 70cdf0e10cSrcweir { mnRefCount++; } 71cdf0e10cSrcweir 72cdf0e10cSrcweir void fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); 73cdf0e10cSrcweir 74cdf0e10cSrcweir void setChar( sal_Unicode val ); 75cdf0e10cSrcweir void setByte( sal_uInt8 val ); 76cdf0e10cSrcweir void setShort( sal_Int16 val ); 77cdf0e10cSrcweir void setLong( sal_Int32 val ); 78cdf0e10cSrcweir void setUShort( sal_uInt16 val ); 79cdf0e10cSrcweir void setULong( sal_uInt32 val ); 80cdf0e10cSrcweir bool setSingle( float val ); 81cdf0e10cSrcweir bool setDouble( double val ); 82cdf0e10cSrcweir void setInt( int val ); 83cdf0e10cSrcweir void setUInt( unsigned int val ); 84cdf0e10cSrcweir bool setString( ::rtl::OUString* pOUString ); 85cdf0e10cSrcweir void setDecimal( SbxDecimal* pDecimal ) 86cdf0e10cSrcweir { 87cdf0e10cSrcweir #ifdef WIN32 88cdf0e10cSrcweir if( pDecimal ) 89cdf0e10cSrcweir maDec = pDecimal->maDec; 90cdf0e10cSrcweir #else 91cdf0e10cSrcweir (void)pDecimal; 92cdf0e10cSrcweir #endif 93cdf0e10cSrcweir } 94cdf0e10cSrcweir 95cdf0e10cSrcweir bool getChar( sal_Unicode& rVal ); 96cdf0e10cSrcweir bool getByte( sal_uInt8& rVal ); 97cdf0e10cSrcweir bool getShort( sal_Int16& rVal ); 98cdf0e10cSrcweir bool getLong( sal_Int32& rVal ); 99cdf0e10cSrcweir bool getUShort( sal_uInt16& rVal ); 100cdf0e10cSrcweir bool getULong( sal_uInt32& rVal ); 101cdf0e10cSrcweir bool getSingle( float& rVal ); 102cdf0e10cSrcweir bool getDouble( double& rVal ); 103cdf0e10cSrcweir bool getInt( int& rVal ); 104cdf0e10cSrcweir bool getUInt( unsigned int& rVal ); 105cdf0e10cSrcweir bool getString( ::rtl::OUString& rString ); 106cdf0e10cSrcweir 107cdf0e10cSrcweir bool operator -= ( const SbxDecimal &r ); 108cdf0e10cSrcweir bool operator += ( const SbxDecimal &r ); 109cdf0e10cSrcweir bool operator /= ( const SbxDecimal &r ); 110cdf0e10cSrcweir bool operator *= ( const SbxDecimal &r ); 111cdf0e10cSrcweir bool neg( void ); 112cdf0e10cSrcweir 113cdf0e10cSrcweir bool isZero( void ); 114cdf0e10cSrcweir 115cdf0e10cSrcweir enum CmpResult { LT, EQ, GT }; 116cdf0e10cSrcweir friend CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight ); 117cdf0e10cSrcweir }; 118cdf0e10cSrcweir 119