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 .
23 #include <vcl/dllapi.h>
24 #include <tools/bigint.hxx>
25 #include <vcl/field.hxx>
27 class LocaleDataWrapper
;
29 // -------------------------
30 // - LongCurrencyFormatter -
31 // -------------------------
33 class VCL_DLLPUBLIC LongCurrencyFormatter
: public FormatterBase
36 SAL_DLLPRIVATE
friend bool ImplLongCurrencyReformat( const XubString
&, BigInt
, BigInt
, sal_uInt16
, const LocaleDataWrapper
&, XubString
&, LongCurrencyFormatter
& );
37 SAL_DLLPRIVATE
void ImpInit();
44 BigInt mnCorrectedValue
;
45 OUString maCurrencySymbol
;
47 sal_uInt16 mnDecimalDigits
;
48 sal_Bool mbThousandSep
;
50 LongCurrencyFormatter();
52 ~LongCurrencyFormatter();
54 virtual void Reformat();
55 virtual void ReformatAll();
57 void SetUseThousandSep( sal_Bool b
);
58 sal_Bool
IsUseThousandSep() const { return mbThousandSep
; }
60 void SetCurrencySymbol( const String
& rStr
);
61 String
GetCurrencySymbol() const;
63 void SetMin( BigInt nNewMin
);
64 BigInt
GetMin() const { return mnMin
; }
65 void SetMax( BigInt nNewMax
);
66 BigInt
GetMax() const { return mnMax
; }
68 void SetDecimalDigits( sal_uInt16 nDigits
);
69 sal_uInt16
GetDecimalDigits() const;
70 void SetValue( BigInt nNewValue
);
71 void SetUserValue( BigInt nNewValue
);
72 BigInt
GetValue() const;
73 sal_Bool
IsEmptyValue() const { return GetField()->GetText().isEmpty(); }
75 BigInt
GetCorrectedValue() const { return mnCorrectedValue
; }
78 // ---------------------
79 // - LongCurrencyField -
80 // ---------------------
82 class VCL_DLLPUBLIC LongCurrencyField
: public SpinField
, public LongCurrencyFormatter
84 friend void ImplNewLongCurrencyFieldValue( LongCurrencyField
*, BigInt
);
92 LongCurrencyField( Window
* pParent
, WinBits nWinStyle
);
95 long PreNotify( NotifyEvent
& rNEvt
);
96 long Notify( NotifyEvent
& rNEvt
);
104 void SetFirst( BigInt nNewFirst
) { mnFirst
= nNewFirst
; }
105 BigInt
GetFirst() const { return mnFirst
; }
106 void SetLast( BigInt nNewLast
) { mnLast
= nNewLast
; }
107 BigInt
GetLast() const { return mnLast
; }
108 void SetSpinSize( BigInt nNewSize
) { mnSpinSize
= nNewSize
; }
109 BigInt
GetSpinSize() const { return mnSpinSize
; }
112 // -------------------
113 // - LongCurrencyBox -
114 // -------------------
116 class VCL_DLLPUBLIC LongCurrencyBox
: public ComboBox
, public LongCurrencyFormatter
119 LongCurrencyBox( Window
* pParent
, WinBits nWinStyle
);
122 long PreNotify( NotifyEvent
& rNEvt
);
123 long Notify( NotifyEvent
& rNEvt
);
128 BigInt
GetValue() const
129 { return LongCurrencyFormatter::GetValue(); }
132 #endif // _LONGCURR_HXX
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */