LibreOffice Module vcl (master)  1
fmtfield.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_FMTFIELD_HXX
21 #define INCLUDED_VCL_FMTFIELD_HXX
22 
23 #include <vcl/formatter.hxx>
24 #include <vcl/spinfld.hxx>
25 
27 {
28 public:
29  FormattedField(vcl::Window* pParent, WinBits nStyle);
30 
31  // Spin-Handling
32  virtual void Up() override;
33  virtual void Down() override;
34  // Default Implementation: +/- default spin size to the double value
35  virtual void First() override;
36  virtual void Last() override;
37  // Default Implementation: Current double is set to the first or last value
38 
39  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
40 public:
41  virtual void SetText( const OUString& rStr ) override;
42  virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) override;
43 
44  void SetValueFromString(const OUString& rStr); // currently used by online
45 
46  virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
47 
48  virtual FactoryFunction GetUITestFactory() const override;
49 
50  Formatter* GetFormatter();
51 
52 protected:
53  std::unique_ptr<Formatter> m_xFormatter;
54 
55  virtual bool EventNotify(NotifyEvent& rNEvt) override;
56  virtual void Modify() override;
57 
58  bool PreNotify(NotifyEvent& rNEvt) override;
59 };
60 
61 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DoubleNumericField final : public FormattedField
62 {
63 public:
64  DoubleNumericField(vcl::Window* pParent, WinBits nStyle);
65 
66  virtual ~DoubleNumericField() override;
67 
68  validation::NumberValidator& GetNumberValidator() { return *m_pNumberValidator; }
69  void ResetConformanceTester();
70 
71 private:
72 
73  std::unique_ptr<validation::NumberValidator> m_pNumberValidator;
74 };
75 
76 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DoubleCurrencyField final : public FormattedField
77 {
78 public:
79  DoubleCurrencyField(vcl::Window* pParent, WinBits nStyle);
80 
81  const OUString& getCurrencySymbol() const { return m_sCurrencySymbol; }
82  void setCurrencySymbol(const OUString& rSymbol);
83 
84  bool getPrependCurrSym() const { return m_bPrependCurrSym; }
85  void setPrependCurrSym(bool _bPrepend);
86 
87  void UpdateCurrencyFormat();
88 private:
89  OUString m_sCurrencySymbol;
90  bool m_bPrependCurrSym;
91 };
92 
93 #endif // INCLUDED_VCL_FMTFIELD_HXX
94 
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: edit.cxx:179
virtual void Up()
Definition: spinfld.cxx:358
css::uno::Any const & rValue
sal_Int64 WinBits
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: window.cxx:3380
virtual FactoryFunction GetUITestFactory() const override
Definition: spinfld.cxx:1000
virtual void Down()
Definition: spinfld.cxx:363
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: spinfld.cxx:484
std::unique_ptr< Formatter > m_xFormatter
Definition: fmtfield.hxx:53
virtual void Modify()
Definition: edit.cxx:2312
virtual void First()
Definition: spinfld.cxx:368
virtual void Last()
Definition: spinfld.cxx:373
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: spinfld.cxx:829
virtual void SetText(const OUString &rStr) override
Definition: edit.cxx:2543