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#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>
28
30{
31public:
32 FormattedField(vcl::Window* pParent, WinBits nStyle);
33
34 virtual void dispose() override;
35
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
43
44 virtual bool set_property(const OUString &rKey, const OUString &rValue) override;
45public:
46 virtual void SetText( const OUString& rStr ) override;
47 virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) override;
48
49 void SetValueFromString(const OUString& rStr); // currently used by online
50
51 virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
52
53 virtual FactoryFunction GetUITestFactory() const override;
54
55 Formatter& GetFormatter();
56 void SetFormatter(Formatter* pFormatter);
57
58protected:
59 std::unique_ptr<Formatter> m_xOwnFormatter;
61
62 virtual bool EventNotify(NotifyEvent& rNEvt) override;
63 virtual void Modify() override;
64
65 bool PreNotify(NotifyEvent& rNEvt) override;
66};
67
68class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DoubleNumericField final : public FormattedField
69{
70public:
71 DoubleNumericField(vcl::Window* pParent, WinBits nStyle);
72
73 virtual ~DoubleNumericField() override;
74
75 validation::NumberValidator& GetNumberValidator() { return *m_pNumberValidator; }
76 void ResetConformanceTester();
77
78private:
79
80 std::unique_ptr<validation::NumberValidator> m_pNumberValidator;
81};
82
83class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DoubleCurrencyField final : public FormattedField
84{
85public:
86 DoubleCurrencyField(vcl::Window* pParent, WinBits nStyle);
87
88 const OUString& getCurrencySymbol() const { return m_sCurrencySymbol; }
89 void setCurrencySymbol(const OUString& rSymbol);
90
91 bool getPrependCurrSym() const { return m_bPrependCurrSym; }
92 void setPrependCurrSym(bool _bPrepend);
93
94 void UpdateCurrencyFormat();
95private:
96 OUString m_sCurrencySymbol;
97 bool m_bPrependCurrSym;
98};
99
100/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Modify()
Definition: edit.cxx:2320
virtual void SetText(const OUString &rStr) override
Definition: edit.cxx:2551
virtual bool set_property(const OUString &rKey, const OUString &rValue) override
Definition: edit.cxx:183
virtual void DumpAsPropertyTree(tools::JsonWriter &rJsonWriter) override
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
Definition: edit.cxx:2924
Formatter * m_pFormatter
Definition: fmtfield.hxx:60
std::unique_ptr< Formatter > m_xOwnFormatter
Definition: fmtfield.hxx:59
virtual void Last()
Definition: spinfld.cxx:374
virtual FactoryFunction GetUITestFactory() const override
Definition: spinfld.cxx:1023
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: spinfld.cxx:485
virtual void First()
Definition: spinfld.cxx:369
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: spinfld.cxx:858
virtual void Down()
Definition: spinfld.cxx:364
virtual void Up()
Definition: spinfld.cxx:359
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: spinfld.cxx:352
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
sal_Int64 WinBits
Definition: wintypes.hxx:109