/src/libreoffice/include/vcl/toolkit/fmtfield.hxx
Line | Count | Source |
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 | | #pragma once |
21 | | |
22 | | #if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) |
23 | | #error "don't use this in new code" |
24 | | #endif |
25 | | |
26 | | #include <vcl/formatter.hxx> |
27 | | #include <vcl/toolkit/spinfld.hxx> |
28 | | |
29 | | class VCL_DLLPUBLIC FormattedField : public SpinField |
30 | | { |
31 | | public: |
32 | | FormattedField(vcl::Window* pParent, WinBits nStyle); |
33 | | |
34 | | virtual void dispose() override; |
35 | | |
36 | | virtual rtl::Reference<comphelper::OAccessible> CreateAccessible() override; |
37 | | |
38 | | // Spin-Handling |
39 | | virtual void Up() override; |
40 | | virtual void Down() override; |
41 | | // Default Implementation: +/- default spin size to the double value |
42 | | virtual void First() override; |
43 | | virtual void Last() override; |
44 | | // Default Implementation: Current double is set to the first or last value |
45 | | |
46 | | virtual bool set_property(const OUString &rKey, const OUString &rValue) override; |
47 | | public: |
48 | | virtual void SetText( const OUString& rStr ) override; |
49 | | virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) override; |
50 | | |
51 | | void SetValueFromString(const OUString& rStr); // currently used by online |
52 | | |
53 | | virtual void DumpAsPropertyTree(tools::JsonWriter&) override; |
54 | | |
55 | | virtual FactoryFunction GetUITestFactory() const override; |
56 | | |
57 | | Formatter& GetFormatter(); |
58 | | void SetFormatter(Formatter* pFormatter); |
59 | | |
60 | | protected: |
61 | | std::unique_ptr<Formatter> m_xOwnFormatter; |
62 | | Formatter* m_pFormatter; |
63 | | |
64 | | virtual bool EventNotify(NotifyEvent& rNEvt) override; |
65 | | virtual void Modify() override; |
66 | | |
67 | | bool PreNotify(NotifyEvent& rNEvt) override; |
68 | | }; |
69 | | |
70 | | class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DoubleNumericField final : public FormattedField |
71 | | { |
72 | | public: |
73 | | DoubleNumericField(vcl::Window* pParent, WinBits nStyle); |
74 | | |
75 | | virtual ~DoubleNumericField() override; |
76 | | |
77 | 0 | validation::NumberValidator& GetNumberValidator() { return *m_pNumberValidator; } |
78 | | void ResetConformanceTester(); |
79 | | |
80 | | private: |
81 | | |
82 | | std::unique_ptr<validation::NumberValidator> m_pNumberValidator; |
83 | | }; |
84 | | |
85 | | class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DoubleCurrencyField final : public FormattedField |
86 | | { |
87 | | public: |
88 | | DoubleCurrencyField(vcl::Window* pParent, WinBits nStyle); |
89 | | |
90 | 0 | const OUString& getCurrencySymbol() const { return m_sCurrencySymbol; } |
91 | | void setCurrencySymbol(const OUString& rSymbol); |
92 | | |
93 | 0 | bool getPrependCurrSym() const { return m_bPrependCurrSym; } |
94 | | void setPrependCurrSym(bool _bPrepend); |
95 | | |
96 | | void UpdateCurrencyFormat(); |
97 | | private: |
98 | | OUString m_sCurrencySymbol; |
99 | | bool m_bPrependCurrSym; |
100 | | }; |
101 | | |
102 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |