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 <extended/AccessibleBrowseBoxCheckBoxCell.hxx>
21 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
22 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
23 #include <vcl/accessibletableprovider.hxx>
24 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
26 namespace accessibility
28 using namespace com::sun::star::accessibility
;
29 using namespace com::sun::star::uno
;
30 using namespace com::sun::star::accessibility::AccessibleEventId
;
32 AccessibleCheckBoxCell::AccessibleCheckBoxCell(const Reference
<XAccessible
>& _rxParent
,
33 vcl::IAccessibleTableProvider
& _rBrowseBox
,
34 const css::uno::Reference
< css::awt::XWindow
>& _xFocusWindow
,
37 ,const TriState
& _eState
,
39 :AccessibleBrowseBoxCell(_rxParent
, _rBrowseBox
, _xFocusWindow
, _nRowPos
, _nColPos
, AccessibleBrowseBoxObjType::CheckBoxCell
)
41 ,m_bIsTriState(_bIsTriState
)
44 IMPLEMENT_FORWARD_XINTERFACE2( AccessibleCheckBoxCell
, AccessibleBrowseBoxCell
, AccessibleCheckBoxCell_BASE
)
46 IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleCheckBoxCell
, AccessibleBrowseBoxCell
, AccessibleCheckBoxCell_BASE
)
48 Reference
< XAccessibleContext
> SAL_CALL
AccessibleCheckBoxCell::getAccessibleContext( )
50 osl::MutexGuard
aGuard( getMutex() );
55 sal_Int64
AccessibleCheckBoxCell::implCreateStateSet()
57 sal_Int64 nStateSet
= AccessibleBrowseBoxCell::implCreateStateSet();
60 mpBrowseBox
->FillAccessibleStateSetForCell(
61 nStateSet
, getRowPos(), static_cast< sal_uInt16
>( getColumnPos() ) );
62 if ( m_eState
== TRISTATE_TRUE
)
63 nStateSet
|= AccessibleStateType::CHECKED
;
70 Any SAL_CALL
AccessibleCheckBoxCell::getCurrentValue( )
72 ::osl::MutexGuard
aGuard( getMutex() );
90 sal_Bool SAL_CALL
AccessibleCheckBoxCell::setCurrentValue( const Any
& )
95 Any SAL_CALL
AccessibleCheckBoxCell::getMaximumValue( )
97 ::osl::MutexGuard
aGuard( getMutex() );
102 aValue
<<= sal_Int32(2);
104 aValue
<<= sal_Int32(1);
109 Any SAL_CALL
AccessibleCheckBoxCell::getMinimumValue( )
112 aValue
<<= sal_Int32(0);
117 Any SAL_CALL
AccessibleCheckBoxCell::getMinimumIncrement( )
120 aValue
<<= sal_Int32(1);
125 // XAccessibleContext
126 sal_Int64 SAL_CALL
AccessibleCheckBoxCell::getAccessibleChildCount( )
131 css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
AccessibleCheckBoxCell::getAccessibleChild( sal_Int64
)
133 throw css::lang::IndexOutOfBoundsException();
136 OUString SAL_CALL
AccessibleCheckBoxCell::getImplementationName()
138 return "com.sun.star.comp.svtools.TableCheckBoxCell";
141 sal_Int64 SAL_CALL
AccessibleCheckBoxCell::getAccessibleIndexInParent()
143 ::osl::MutexGuard
aGuard( getMutex() );
146 return (static_cast<sal_Int64
>(getRowPos()) * static_cast<sal_Int64
>(mpBrowseBox
->GetColumnCount())) + getColumnPos();
149 void AccessibleCheckBoxCell::SetChecked( bool _bChecked
)
151 m_eState
= _bChecked
? TRISTATE_TRUE
: TRISTATE_FALSE
;
152 Any aOldValue
, aNewValue
;
154 aNewValue
<<= AccessibleStateType::CHECKED
;
156 aOldValue
<<= AccessibleStateType::CHECKED
;
157 commitEvent( AccessibleEventId::STATE_CHANGED
, aNewValue
, aOldValue
);
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */