LibreOffice Module svx (master) 1
relfld.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#ifndef INCLUDED_SVX_RELFLD_HXX
20#define INCLUDED_SVX_RELFLD_HXX
21
22#include <tools/fldunit.hxx>
23#include <svtools/unitconv.hxx>
24#include <vcl/weld.hxx>
25#include <svx/svxdllapi.h>
26
28{
29private:
30 std::unique_ptr<weld::MetricSpinButton> m_xSpinButton;
31
32 sal_uInt16 nRelMin;
33 sal_uInt16 nRelMax;
37
39
40public:
41 SvxRelativeField(std::unique_ptr<weld::MetricSpinButton> pControl);
42
43 void EnableRelativeMode( sal_uInt16 nMin, sal_uInt16 nMax );
44 void SetRelative( bool bRelative );
45 bool IsRelative() const { return bRelative; }
46 void EnableNegativeMode() {bNegativeEnabled = true;}
47
48 void set_sensitive(bool sensitive) { m_xSpinButton->set_sensitive(sensitive); }
49 void set_value(int nValue, FieldUnit eValueUnit) { m_xSpinButton->set_value(nValue, eValueUnit); }
50 int get_value(FieldUnit eDestUnit) const { return m_xSpinButton->get_value(eDestUnit); }
51 int get_min(FieldUnit eValueUnit) const { return m_xSpinButton->get_min(eValueUnit); }
52 void set_min(int min, FieldUnit eValueUnit) { m_xSpinButton->set_min(min, eValueUnit); }
53 void set_max(int max, FieldUnit eValueUnit) { m_xSpinButton->set_max(max, eValueUnit); }
54 int normalize(int nValue) const { return m_xSpinButton->normalize(nValue); }
55 int denormalize(int nValue) const { return m_xSpinButton->denormalize(nValue); }
56 void connect_value_changed(const Link<weld::MetricSpinButton&, void>& rLink) { m_xSpinButton->connect_value_changed(rLink); }
57 OUString get_text() const { return m_xSpinButton->get_text(); }
58 void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); }
59 void save_value() { m_xSpinButton->save_value(); }
60 bool get_value_changed_from_saved() const { return m_xSpinButton->get_value_changed_from_saved(); }
61 weld::SpinButton& get_widget() { return m_xSpinButton->get_widget(); }
62
63 int GetCoreValue(MapUnit eUnit) const { return ::GetCoreValue(*m_xSpinButton, eUnit); }
64 void SetFieldUnit(FieldUnit eUnit, bool bAll = false) { ::SetFieldUnit(*m_xSpinButton, eUnit, bAll); }
65 void SetMetricValue(int lCoreValue, MapUnit eUnit) { ::SetMetricValue(*m_xSpinButton, lCoreValue, eUnit); }
66};
67
68#endif
69
70/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool get_value_changed_from_saved() const
Definition: relfld.hxx:60
std::unique_ptr< weld::MetricSpinButton > m_xSpinButton
Definition: relfld.hxx:30
bool IsRelative() const
Definition: relfld.hxx:45
bool bRelativeMode
Definition: relfld.hxx:34
void set_text(const OUString &rText)
Definition: relfld.hxx:58
int normalize(int nValue) const
Definition: relfld.hxx:54
int GetCoreValue(MapUnit eUnit) const
Definition: relfld.hxx:63
void SetMetricValue(int lCoreValue, MapUnit eUnit)
Definition: relfld.hxx:65
void connect_value_changed(const Link< weld::MetricSpinButton &, void > &rLink)
Definition: relfld.hxx:56
void save_value()
Definition: relfld.hxx:59
DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry &, void)
sal_uInt16 nRelMax
Definition: relfld.hxx:33
sal_uInt16 nRelMin
Definition: relfld.hxx:32
void set_min(int min, FieldUnit eValueUnit)
Definition: relfld.hxx:52
int denormalize(int nValue) const
Definition: relfld.hxx:55
void EnableNegativeMode()
Definition: relfld.hxx:46
int get_min(FieldUnit eValueUnit) const
Definition: relfld.hxx:51
void SetFieldUnit(FieldUnit eUnit, bool bAll=false)
Definition: relfld.hxx:64
void set_max(int max, FieldUnit eValueUnit)
Definition: relfld.hxx:53
weld::SpinButton & get_widget()
Definition: relfld.hxx:61
bool bNegativeEnabled
Definition: relfld.hxx:36
int get_value(FieldUnit eDestUnit) const
Definition: relfld.hxx:50
void set_value(int nValue, FieldUnit eValueUnit)
Definition: relfld.hxx:49
OUString get_text() const
Definition: relfld.hxx:57
void set_sensitive(bool sensitive)
Definition: relfld.hxx:48
#define max(a, b)
FieldUnit
sal_Int16 nValue
Definition: fmsrccfg.cxx:81
MapUnit
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28