1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_VCL_LONGCURR_HXX
21 #define INCLUDED_VCL_LONGCURR_HXX
23 #include <vcl/dllapi.h>
24 #include <tools/bigint.hxx>
25 #include <vcl/field.hxx>
27 class LocaleDataWrapper
;
30 // - LongCurrencyFormatter -
33 class VCL_DLLPUBLIC LongCurrencyFormatter
: public FormatterBase
36 SAL_DLLPRIVATE
friend bool ImplLongCurrencyReformat( const OUString
&, BigInt
, BigInt
, sal_uInt16
, const LocaleDataWrapper
&, OUString
&, LongCurrencyFormatter
& );
37 SAL_DLLPRIVATE
void ImpInit();
44 BigInt mnCorrectedValue
;
45 OUString maCurrencySymbol
;
47 sal_uInt16 mnDecimalDigits
;
50 LongCurrencyFormatter();
52 virtual ~LongCurrencyFormatter();
54 virtual void Reformat() SAL_OVERRIDE
;
55 virtual void ReformatAll() SAL_OVERRIDE
;
57 void SetUseThousandSep( bool b
);
58 bool IsUseThousandSep() const { return mbThousandSep
; }
60 void SetCurrencySymbol( const OUString
& rStr
);
61 OUString
GetCurrencySymbol() const;
63 void SetMin(const BigInt
& rNewMin
);
64 BigInt
GetMin() const { return mnMin
; }
65 void SetMax(const BigInt
& rNewMax
);
66 BigInt
GetMax() const { return mnMax
; }
68 void SetDecimalDigits( sal_uInt16 nDigits
);
69 sal_uInt16
GetDecimalDigits() const { return mnDecimalDigits
;}
70 void SetValue(const BigInt
& rNewValue
);
71 void SetUserValue( BigInt nNewValue
);
72 BigInt
GetValue() const;
73 bool IsEmptyValue() const { return GetField()->GetText().isEmpty(); }
75 BigInt
GetCorrectedValue() const { return mnCorrectedValue
; }
79 // - LongCurrencyField -
82 class VCL_DLLPUBLIC LongCurrencyField
: public SpinField
, public LongCurrencyFormatter
84 friend void ImplNewLongCurrencyFieldValue(LongCurrencyField
*, const BigInt
&);
92 LongCurrencyField( vcl::Window
* pParent
, WinBits nWinStyle
);
94 virtual bool PreNotify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
95 virtual bool Notify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
97 void Modify() SAL_OVERRIDE
;
98 void Up() SAL_OVERRIDE
;
99 void Down() SAL_OVERRIDE
;
100 void First() SAL_OVERRIDE
;
101 void Last() SAL_OVERRIDE
;
103 void SetFirst(const BigInt
& rNewFirst
) { mnFirst
= rNewFirst
; }
104 BigInt
GetFirst() const { return mnFirst
; }
105 void SetLast(const BigInt
& rNewLast
) { mnLast
= rNewLast
; }
106 BigInt
GetLast() const { return mnLast
; }
107 void SetSpinSize(const BigInt
& rNewSize
) { mnSpinSize
= rNewSize
; }
108 BigInt
GetSpinSize() const { return mnSpinSize
; }
112 // - LongCurrencyBox -
115 class VCL_DLLPUBLIC LongCurrencyBox
: public ComboBox
, public LongCurrencyFormatter
118 LongCurrencyBox( vcl::Window
* pParent
, WinBits nWinStyle
);
120 virtual bool PreNotify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
121 virtual bool Notify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
123 void Modify() SAL_OVERRIDE
;
124 void ReformatAll() SAL_OVERRIDE
;
126 BigInt
GetValue() const
127 { return LongCurrencyFormatter::GetValue(); }
130 #endif // INCLUDED_VCL_LONGCURR_HXX
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */