tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / accessibility / source / standard / svtaccessiblenumericfield.cxx
blob2d4630a943b35bcdf7debcbac3a65db602e13aa7
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 #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);
51 double dValue = 0;
52 VclPtr<FormattedField> pField = GetAs<FormattedField>();
53 if (pField)
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>();
64 if (!pField)
65 return false;
67 double dValue = 0;
68 aNumber >>= dValue;
69 pField->GetFormatter().SetValue(dValue);
70 return true;
73 css::uno::Any SAL_CALL SVTXAccessibleNumericField::getMaximumValue()
75 OExternalLockGuard aGuard(this);
77 double dValue = 0;
78 VclPtr<FormattedField> pField = GetAs<FormattedField>();
79 if (pField)
80 dValue = pField->GetFormatter().GetMaxValue();
82 return css::uno::Any(dValue);
85 css::uno::Any SAL_CALL SVTXAccessibleNumericField::getMinimumValue()
87 OExternalLockGuard aGuard(this);
89 double dValue = 0;
90 VclPtr<FormattedField> pField = GetAs<FormattedField>();
91 if (pField)
92 dValue = pField->GetFormatter().GetMinValue();
94 return css::uno::Any(dValue);
97 css::uno::Any SAL_CALL SVTXAccessibleNumericField::getMinimumIncrement()
99 OExternalLockGuard aGuard(this);
101 double dValue = 0;
102 VclPtr<FormattedField> pField = GetAs<FormattedField>();
103 if (pField)
104 dValue = pField->GetFormatter().GetSpinSize();
106 return css::uno::Any(dValue);
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */