Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / vcl / longcurr.hxx
blob9bcbe3085e40a11133572237c6d08c0aa559a47b
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 #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 class VCL_DLLPUBLIC LongCurrencyFormatter : public FormatterBase
32 public:
33 virtual ~LongCurrencyFormatter() override;
35 virtual void Reformat() override;
36 virtual void ReformatAll() override;
38 void SetUseThousandSep( bool b );
39 bool IsUseThousandSep() const { return mbThousandSep; }
41 void SetCurrencySymbol( const OUString& rStr );
42 OUString const & GetCurrencySymbol() const;
44 void SetMin(const BigInt& rNewMin);
45 const BigInt& GetMin() const { return mnMin; }
46 void SetMax(const BigInt& rNewMax);
47 const BigInt& GetMax() const { return mnMax; }
49 void SetDecimalDigits( sal_uInt16 nDigits );
50 sal_uInt16 GetDecimalDigits() const { return mnDecimalDigits;}
51 void SetValue(const BigInt& rNewValue);
52 void SetUserValue( BigInt nNewValue );
53 BigInt GetValue() const;
55 protected:
56 BigInt mnLastValue;
57 BigInt mnMin;
58 BigInt mnMax;
60 LongCurrencyFormatter();
61 private:
62 friend bool ImplLongCurrencyReformat( const OUString&, BigInt const &, BigInt const &, sal_uInt16, const LocaleDataWrapper&, OUString&, LongCurrencyFormatter& );
63 SAL_DLLPRIVATE void ImpInit();
65 BigInt mnFieldValue;
66 BigInt mnCorrectedValue;
67 OUString maCurrencySymbol;
68 sal_uInt16 mnDecimalDigits;
69 bool mbThousandSep;
74 class VCL_DLLPUBLIC LongCurrencyField : public SpinField, public LongCurrencyFormatter
76 friend void ImplNewLongCurrencyFieldValue(LongCurrencyField*, const BigInt&);
78 private:
79 BigInt mnSpinSize;
80 BigInt mnFirst;
81 BigInt mnLast;
83 public:
84 LongCurrencyField( vcl::Window* pParent, WinBits nWinStyle );
86 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
87 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
89 void Modify() override;
90 void Up() override;
91 void Down() override;
92 void First() override;
93 void Last() override;
95 void SetFirst(const BigInt& rNewFirst ) { mnFirst = rNewFirst; }
96 const BigInt& GetFirst() const { return mnFirst; }
97 void SetLast(const BigInt& rNewLast ) { mnLast = rNewLast; }
98 const BigInt& GetLast() const { return mnLast; }
99 void SetSpinSize(const BigInt& rNewSize) { mnSpinSize = rNewSize; }
100 const BigInt& GetSpinSize() const { return mnSpinSize; }
104 class VCL_DLLPUBLIC LongCurrencyBox : public ComboBox, public LongCurrencyFormatter
106 public:
107 LongCurrencyBox( vcl::Window* pParent, WinBits nWinStyle );
109 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
110 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
112 void Modify() override;
113 void ReformatAll() override;
116 #endif // INCLUDED_VCL_LONGCURR_HXX
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */