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 __SBX_SBX_DEC_HXX
22 : #define __SBX_SBX_DEC_HXX
23 :
24 : #ifdef WIN32
25 :
26 : #undef WB_LEFT
27 : #undef WB_RIGHT
28 :
29 : #include <prewin.h>
30 : #include <postwin.h>
31 :
32 : #ifndef __MINGW32__
33 : #include <comutil.h>
34 : #endif
35 : #include <oleauto.h>
36 :
37 : #endif
38 : #endif
39 : #include <basic/sbx.hxx>
40 :
41 : #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
42 :
43 :
44 : // Decimal support
45 : // Implementation only for windows
46 :
47 : class SbxDecimal
48 : {
49 : friend void releaseDecimalPtr( SbxDecimal*& rpDecimal );
50 :
51 : #ifdef WIN32
52 : DECIMAL maDec;
53 : #endif
54 : sal_Int32 mnRefCount;
55 :
56 : public:
57 : SbxDecimal( void );
58 : SbxDecimal( const SbxDecimal& rDec );
59 : SbxDecimal( const com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
60 :
61 : ~SbxDecimal();
62 :
63 0 : void addRef( void )
64 0 : { mnRefCount++; }
65 :
66 : void fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
67 :
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 0 : void setDecimal( SbxDecimal* pDecimal )
80 : {
81 : #ifdef WIN32
82 : if( pDecimal )
83 : maDec = pDecimal->maDec;
84 : #else
85 : (void)pDecimal;
86 : #endif
87 0 : }
88 :
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 );
99 :
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 );
105 :
106 : bool isZero( void );
107 :
108 : enum CmpResult { LT, EQ, GT };
109 : friend CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight );
110 : };
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|