Update git submodules
[LibreOffice.git] / include / vcl / toolkit / fmtfield.hxx
blob34b7ea7557073f35414ed84451a7d466d0768012
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 #pragma once
22 #if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
23 #error "don't use this in new code"
24 #endif
26 #include <vcl/formatter.hxx>
27 #include <vcl/toolkit/spinfld.hxx>
29 class VCL_DLLPUBLIC FormattedField : public SpinField
31 public:
32 FormattedField(vcl::Window* pParent, WinBits nStyle);
34 virtual void dispose() override;
36 // Spin-Handling
37 virtual void Up() override;
38 virtual void Down() override;
39 // Default Implementation: +/- default spin size to the double value
40 virtual void First() override;
41 virtual void Last() override;
42 // Default Implementation: Current double is set to the first or last value
44 virtual bool set_property(const OUString &rKey, const OUString &rValue) override;
45 public:
46 virtual void SetText( const OUString& rStr ) override;
47 virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) override;
49 void SetValueFromString(const OUString& rStr); // currently used by online
51 virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
53 virtual FactoryFunction GetUITestFactory() const override;
55 Formatter& GetFormatter();
56 void SetFormatter(Formatter* pFormatter);
58 protected:
59 std::unique_ptr<Formatter> m_xOwnFormatter;
60 Formatter* m_pFormatter;
62 virtual bool EventNotify(NotifyEvent& rNEvt) override;
63 virtual void Modify() override;
65 bool PreNotify(NotifyEvent& rNEvt) override;
68 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DoubleNumericField final : public FormattedField
70 public:
71 DoubleNumericField(vcl::Window* pParent, WinBits nStyle);
73 virtual ~DoubleNumericField() override;
75 validation::NumberValidator& GetNumberValidator() { return *m_pNumberValidator; }
76 void ResetConformanceTester();
78 private:
80 std::unique_ptr<validation::NumberValidator> m_pNumberValidator;
83 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DoubleCurrencyField final : public FormattedField
85 public:
86 DoubleCurrencyField(vcl::Window* pParent, WinBits nStyle);
88 const OUString& getCurrencySymbol() const { return m_sCurrencySymbol; }
89 void setCurrencySymbol(const OUString& rSymbol);
91 bool getPrependCurrSym() const { return m_bPrependCurrSym; }
92 void setPrependCurrSym(bool _bPrepend);
94 void UpdateCurrencyFormat();
95 private:
96 OUString m_sCurrencySymbol;
97 bool m_bPrependCurrSym;
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */