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 .
21 #include <extended/AccessibleBrowseBoxHeaderCell.hxx>
22 #include <vcl/accessibletableprovider.hxx>
23 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
24 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
26 namespace accessibility
28 using namespace ::com::sun::star::accessibility
;
29 using namespace ::com::sun::star::lang
;
30 using namespace ::com::sun::star::uno
;
32 AccessibleBrowseBoxHeaderCell::AccessibleBrowseBoxHeaderCell(sal_Int32 _nColumnRowId
,
33 const Reference
< XAccessible
>& rxParent
,
34 vcl::IAccessibleTableProvider
& rBrowseBox
,
35 AccessibleBrowseBoxObjType eObjType
)
36 : BrowseBoxAccessibleElement(rxParent
,
39 rBrowseBox
.GetAccessibleObjectName( eObjType
,_nColumnRowId
),
40 rBrowseBox
.GetAccessibleObjectDescription( eObjType
,_nColumnRowId
))
41 , m_nColumnRowId(_nColumnRowId
)
44 /** Return a bitset of states of the current object.
46 sal_Int64
AccessibleBrowseBoxHeaderCell::implCreateStateSet()
48 SolarMethodGuard
aGuard( getMutex() );
50 sal_Int64 nStateSet
= 0;
54 // SHOWING done with mxParent
56 nStateSet
|= AccessibleStateType::SHOWING
;
58 mpBrowseBox
->FillAccessibleStateSet( nStateSet
, getType() );
59 nStateSet
|= AccessibleStateType::VISIBLE
;
60 nStateSet
|= AccessibleStateType::FOCUSABLE
;
61 nStateSet
|= AccessibleStateType::TRANSIENT
;
62 nStateSet
|= AccessibleStateType::SELECTABLE
;
64 bool bSelected
= isRowBarCell() ? mpBrowseBox
->IsRowSelected(m_nColumnRowId
) : mpBrowseBox
->IsColumnSelected(m_nColumnRowId
);
66 nStateSet
|= AccessibleStateType::SELECTED
;
69 nStateSet
|= AccessibleStateType::DEFUNC
;
75 The count of visible children.
77 sal_Int64 SAL_CALL
AccessibleBrowseBoxHeaderCell::getAccessibleChildCount()
84 The XAccessible interface of the specified child.
86 Reference
<XAccessible
> SAL_CALL
AccessibleBrowseBoxHeaderCell::getAccessibleChild( sal_Int64
)
88 throw IndexOutOfBoundsException();
92 /** Grabs the focus to the column header. */
93 void SAL_CALL
AccessibleBrowseBoxHeaderCell::grabFocus()
95 SolarMethodGuard
aGuard(getMutex());
99 mpBrowseBox
->SelectRow(m_nColumnRowId
);
101 mpBrowseBox
->SelectColumn(static_cast<sal_uInt16
>(m_nColumnRowId
)); //!!!
105 The name of this class.
107 OUString SAL_CALL
AccessibleBrowseBoxHeaderCell::getImplementationName()
109 return u
"com.sun.star.comp.svtools.AccessibleBrowseBoxHeaderCell"_ustr
;
114 tools::Rectangle
getRectangle(vcl::IAccessibleTableProvider
* _pBrowseBox
,sal_Int32 _nRowColIndex
, bool _bOnScreen
,bool _bRowBar
)
117 sal_uInt16 nCol
= static_cast<sal_uInt16
>(_nRowColIndex
);
120 nRow
= _nRowColIndex
+ 1;
124 tools::Rectangle
aRet(_pBrowseBox
->GetFieldRectPixel( nRow
, nCol
, true, _bOnScreen
));
125 return tools::Rectangle(aRet
.TopLeft() - Point(0,aRet
.GetHeight()),aRet
.GetSize());
129 tools::Rectangle
AccessibleBrowseBoxHeaderCell::implGetBoundingBox()
131 return getRectangle(mpBrowseBox
,m_nColumnRowId
,false,isRowBarCell());
135 AbsoluteScreenPixelRectangle
AccessibleBrowseBoxHeaderCell::implGetBoundingBoxOnScreen()
137 return AbsoluteScreenPixelRectangle(getRectangle(mpBrowseBox
,m_nColumnRowId
,true,isRowBarCell()));
140 sal_Int64 SAL_CALL
AccessibleBrowseBoxHeaderCell::getAccessibleIndexInParent()
142 ::osl::MutexGuard
aGuard( getMutex() );
144 sal_Int64 nIndex
= m_nColumnRowId
;
145 if ( mpBrowseBox
->HasRowHeader() )
150 } // namespace accessibility
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */