Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / basic / source / sbx / sbxdec.hxx
blob756fdc9f927356edc9933545873adea946bf977a
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 .
20 #pragma once
22 #ifdef _WIN32
23 #include <prewin.h>
24 #include <postwin.h>
25 #include <comutil.h>
26 #include <oleauto.h>
27 #endif
29 #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
32 // Decimal support
33 // Implementation only for windows
35 class SbxDecimal
37 friend void releaseDecimalPtr( SbxDecimal*& rpDecimal );
39 #ifdef _WIN32
40 DECIMAL maDec;
41 #endif
42 sal_Int32 mnRefCount;
44 public:
45 SbxDecimal();
46 SbxDecimal( const SbxDecimal& rDec );
47 explicit SbxDecimal( const css::bridge::oleautomation::Decimal& rAutomationDec );
49 void addRef()
50 { mnRefCount++; }
52 void fillAutomationDecimal( css::bridge::oleautomation::Decimal& rAutomationDec );
54 void setChar( sal_Unicode val );
55 void setByte( sal_uInt8 val );
56 void setShort( sal_Int16 val );
57 void setLong( sal_Int32 val );
58 void setUShort( sal_uInt16 val );
59 void setULong( sal_uInt32 val );
60 bool setSingle( float val );
61 bool setDouble( double val );
62 void setInt( int val );
63 void setUInt( unsigned int val );
64 bool setString( OUString* pOUString );
65 void setDecimal( SbxDecimal const * pDecimal )
67 #ifdef _WIN32
68 if( pDecimal )
69 maDec = pDecimal->maDec;
70 #else
71 (void)pDecimal;
72 #endif
75 bool getChar( sal_Unicode& rVal );
76 bool getShort( sal_Int16& rVal );
77 bool getLong( sal_Int32& rVal );
78 bool getUShort( sal_uInt16& rVal );
79 bool getULong( sal_uInt32& rVal );
80 bool getSingle( float& rVal );
81 bool getDouble( double& rVal );
82 void getString( OUString& rString );
84 bool operator -= ( const SbxDecimal &r );
85 bool operator += ( const SbxDecimal &r );
86 bool operator /= ( const SbxDecimal &r );
87 bool operator *= ( const SbxDecimal &r );
88 bool neg();
90 bool isZero() const;
92 // must match the return values of the Microsoft VarDecCmp Automation function
93 enum class CmpResult { LT, EQ, GT };
94 friend CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight );
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */