LibreOffice Module vcl (master)  1
longcurr.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_VCL_LONGCURR_HXX
21 #define INCLUDED_VCL_LONGCURR_HXX
22 
23 #include <config_options.h>
24 #include <vcl/dllapi.h>
25 #include <tools/bigint.hxx>
26 #include <vcl/field.hxx>
27 
28 class LocaleDataWrapper;
29 
30 
31 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) LongCurrencyFormatter : public FormatterBase
32 {
33 public:
34  virtual ~LongCurrencyFormatter() override;
35 
36  virtual void Reformat() override;
37  virtual void ReformatAll() override;
38 
39  void SetUseThousandSep( bool b );
40  bool IsUseThousandSep() const { return mbThousandSep; }
41 
42  void SetCurrencySymbol( const OUString& rStr );
43  OUString const & GetCurrencySymbol() const;
44 
45  void SetMin(const BigInt& rNewMin);
46  const BigInt& GetMin() const { return mnMin; }
47  void SetMax(const BigInt& rNewMax);
48  const BigInt& GetMax() const { return mnMax; }
49 
50  void SetDecimalDigits( sal_uInt16 nDigits );
51  sal_uInt16 GetDecimalDigits() const { return mnDecimalDigits;}
52  void SetValue(const BigInt& rNewValue);
53  void SetUserValue( BigInt nNewValue );
54  BigInt GetValue() const;
55 
56 protected:
57  BigInt mnLastValue;
58  BigInt mnMin;
59  BigInt mnMax;
60 
61  LongCurrencyFormatter(Edit* pEdit);
62 private:
63  friend bool ImplLongCurrencyReformat( const OUString&, BigInt const &, BigInt const &, sal_uInt16, const LocaleDataWrapper&, OUString&, LongCurrencyFormatter const & );
64  SAL_DLLPRIVATE void ImpInit();
65 
66  OUString maCurrencySymbol;
67  sal_uInt16 mnDecimalDigits;
68  bool mbThousandSep;
69 
70 };
71 
72 
73 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) LongCurrencyField final : public SpinField, public LongCurrencyFormatter
74 {
75  friend void ImplNewLongCurrencyFieldValue(LongCurrencyField*, const BigInt&);
76 
77 private:
78  BigInt mnSpinSize;
79  BigInt mnFirst;
80  BigInt mnLast;
81 
82 public:
83  LongCurrencyField( vcl::Window* pParent, WinBits nWinStyle );
84 
85  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
86 
87  void Modify() override;
88  void Up() override;
89  void Down() override;
90  void First() override;
91  void Last() override;
92 
93  void SetFirst(const BigInt& rNewFirst ) { mnFirst = rNewFirst; }
94  const BigInt& GetFirst() const { return mnFirst; }
95  void SetLast(const BigInt& rNewLast ) { mnLast = rNewLast; }
96  const BigInt& GetLast() const { return mnLast; }
97  void SetSpinSize(const BigInt& rNewSize) { mnSpinSize = rNewSize; }
98  const BigInt& GetSpinSize() const { return mnSpinSize; }
99 };
100 
101 
102 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) LongCurrencyBox final : public ComboBox, public LongCurrencyFormatter
103 {
104 public:
105  LongCurrencyBox( vcl::Window* pParent, WinBits nWinStyle );
106 
107  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
108 
109  void Modify() override;
110  void ReformatAll() override;
111 };
112 
113 #endif // INCLUDED_VCL_LONGCURR_HXX
114 
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void ImplNewLongCurrencyFieldValue(LongCurrencyField *pField, const BigInt &rNewValue)
Definition: longcurr.cxx:379
std::string GetValue
virtual void Up()
Definition: spinfld.cxx:359
sal_Int64 WinBits
Definition: edit.hxx:55
virtual void Down()
Definition: spinfld.cxx:364
bool ImplLongCurrencyReformat(const OUString &rStr, BigInt const &nMin, BigInt const &nMax, sal_uInt16 nDecDigits, const LocaleDataWrapper &rLocaleDataWrapper, OUString &rOutStr, LongCurrencyFormatter const &rFormatter)
Definition: longcurr.cxx:222
virtual void ReformatAll()
Definition: field.cxx:467
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: spinfld.cxx:485
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: combobox.cxx:720
virtual void Reformat()
Definition: field.cxx:463
virtual void Modify()
Definition: edit.cxx:2309
virtual void First()
Definition: spinfld.cxx:369
virtual void Last()
Definition: spinfld.cxx:374
A widget used to choose from a list of items and which has an entry.
Definition: combobox.hxx:34
virtual void Modify() override
Definition: combobox.cxx:825