1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include <standard/svtaccessiblenumericfield.hxx>
21 #include <comphelper/accessiblecontexthelper.hxx>
23 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
24 #include <com/sun/star/accessibility/AccessibleRole.hpp>
26 using namespace ::com::sun::star::accessibility
;
27 using namespace ::comphelper
;
29 SVTXAccessibleNumericField::SVTXAccessibleNumericField(FormattedField
* pFormattedField
)
30 : ImplInheritanceHelper(pFormattedField
)
34 void SVTXAccessibleNumericField::ProcessWindowEvent(const VclWindowEvent
& rVclWindowEvent
)
36 VCLXAccessibleEdit::ProcessWindowEvent(rVclWindowEvent
);
38 if (rVclWindowEvent
.GetId() == VclEventId::EditModify
)
40 css::uno::Any aNewValue
= getCurrentValue();
41 NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED
, css::uno::Any(), aNewValue
);
45 sal_Int16
SVTXAccessibleNumericField::getAccessibleRole() { return AccessibleRole::SPIN_BOX
; }
47 css::uno::Any SAL_CALL
SVTXAccessibleNumericField::getCurrentValue()
49 OExternalLockGuard
aGuard(this);
52 VclPtr
<FormattedField
> pField
= GetAs
<FormattedField
>();
54 dValue
= pField
->GetFormatter().GetValue();
56 return css::uno::Any(dValue
);
59 sal_Bool
SVTXAccessibleNumericField::setCurrentValue(const css::uno::Any
& aNumber
)
61 OExternalLockGuard
aGuard(this);
63 VclPtr
<FormattedField
> pField
= GetAs
<FormattedField
>();
69 pField
->GetFormatter().SetValue(dValue
);
73 css::uno::Any SAL_CALL
SVTXAccessibleNumericField::getMaximumValue()
75 OExternalLockGuard
aGuard(this);
78 VclPtr
<FormattedField
> pField
= GetAs
<FormattedField
>();
80 dValue
= pField
->GetFormatter().GetMaxValue();
82 return css::uno::Any(dValue
);
85 css::uno::Any SAL_CALL
SVTXAccessibleNumericField::getMinimumValue()
87 OExternalLockGuard
aGuard(this);
90 VclPtr
<FormattedField
> pField
= GetAs
<FormattedField
>();
92 dValue
= pField
->GetFormatter().GetMinValue();
94 return css::uno::Any(dValue
);
97 css::uno::Any SAL_CALL
SVTXAccessibleNumericField::getMinimumIncrement()
99 OExternalLockGuard
aGuard(this);
102 VclPtr
<FormattedField
> pField
= GetAs
<FormattedField
>();
104 dValue
= pField
->GetFormatter().GetSpinSize();
106 return css::uno::Any(dValue
);
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */