Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / basic / source / sbx / sbxdec.hxx
blob89977091d764815d6adaf9038213b44228dc41a1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #ifndef __SBX_SBX_DEC_HXX
22 #define __SBX_SBX_DEC_HXX
24 #ifdef WIN32
26 #undef WB_LEFT
27 #undef WB_RIGHT
29 #include <prewin.h>
30 #include <postwin.h>
32 #ifndef __MINGW32__
33 #include <comutil.h>
34 #endif
35 #include <oleauto.h>
37 #endif
38 #endif
39 #include <basic/sbx.hxx>
41 #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
44 // Decimal support
45 // Implementation only for windows
47 class SbxDecimal
49 friend void releaseDecimalPtr( SbxDecimal*& rpDecimal );
51 #ifdef WIN32
52 DECIMAL maDec;
53 #endif
54 sal_Int32 mnRefCount;
56 public:
57 SbxDecimal( void );
58 SbxDecimal( const SbxDecimal& rDec );
59 SbxDecimal( const com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
61 ~SbxDecimal();
63 void addRef( void )
64 { mnRefCount++; }
66 void fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
68 void setChar( sal_Unicode val );
69 void setByte( sal_uInt8 val );
70 void setShort( sal_Int16 val );
71 void setLong( sal_Int32 val );
72 void setUShort( sal_uInt16 val );
73 void setULong( sal_uInt32 val );
74 bool setSingle( float val );
75 bool setDouble( double val );
76 void setInt( int val );
77 void setUInt( unsigned int val );
78 bool setString( ::rtl::OUString* pOUString );
79 void setDecimal( SbxDecimal* pDecimal )
81 #ifdef WIN32
82 if( pDecimal )
83 maDec = pDecimal->maDec;
84 #else
85 (void)pDecimal;
86 #endif
89 bool getChar( sal_Unicode& rVal );
90 bool getShort( sal_Int16& rVal );
91 bool getLong( sal_Int32& rVal );
92 bool getUShort( sal_uInt16& rVal );
93 bool getULong( sal_uInt32& rVal );
94 bool getSingle( float& rVal );
95 bool getDouble( double& rVal );
96 bool getInt( int& rVal );
97 bool getUInt( unsigned int& rVal );
98 bool getString( ::rtl::OUString& rString );
100 bool operator -= ( const SbxDecimal &r );
101 bool operator += ( const SbxDecimal &r );
102 bool operator /= ( const SbxDecimal &r );
103 bool operator *= ( const SbxDecimal &r );
104 bool neg( void );
106 bool isZero( void );
108 enum CmpResult { LT, EQ, GT };
109 friend CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight );
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */