1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_accessibility.hxx"
26 #include "accessibility/extended/accessiblebrowseboxcell.hxx"
27 #include <svtools/accessibletableprovider.hxx>
28 
29 // .................................................................................
30 namespace accessibility
31 {
32 // .................................................................................
33 
34 	using namespace ::com::sun::star::uno;
35 	using namespace ::com::sun::star::awt;
36 	using namespace ::com::sun::star::accessibility;
37 	using namespace ::svt;
38 
39 	// =============================================================================
40 	// = AccessibleBrowseBoxCell
41 	// =============================================================================
DBG_NAME(svt_AccessibleBrowseBoxCell)42 	DBG_NAME( svt_AccessibleBrowseBoxCell )
43 	// -----------------------------------------------------------------------------
44 	AccessibleBrowseBoxCell::AccessibleBrowseBoxCell(
45 			const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox,
46 			const Reference< XWindow >& _xFocusWindow,
47 			sal_Int32 _nRowPos, sal_uInt16 _nColPos, AccessibleBrowseBoxObjType _eType )
48 		:AccessibleBrowseBoxBase( _rxParent, _rBrowseBox, _xFocusWindow, _eType )
49 		,m_nRowPos( _nRowPos )
50 		,m_nColPos( _nColPos )
51 	{
52 		DBG_CTOR( svt_AccessibleBrowseBoxCell, NULL );
53 		// set accessible name here, because for that we need the position of the cell
54 		// and so the base class isn't capable of doing this
55 		sal_Int32 nPos = _nRowPos * _rBrowseBox.GetColumnCount() + _nColPos;
56 		::rtl::OUString aAccName = _rBrowseBox.GetAccessibleObjectName( BBTYPE_TABLECELL, nPos );
57 		implSetName( aAccName );
58 	}
59 
60 	// -----------------------------------------------------------------------------
~AccessibleBrowseBoxCell()61 	AccessibleBrowseBoxCell::~AccessibleBrowseBoxCell()
62 	{
63 		DBG_DTOR( svt_AccessibleBrowseBoxCell, NULL );
64 	}
65 
66 	// -----------------------------------------------------------------------------
grabFocus()67 	void SAL_CALL AccessibleBrowseBoxCell::grabFocus() throw ( RuntimeException )
68 	{
69 		SolarMethodGuard aGuard( *this );
70 		mpBrowseBox->GoToCell( m_nRowPos, m_nColPos );
71 	}
72 	// -----------------------------------------------------------------------------
implGetBoundingBox()73 	::Rectangle AccessibleBrowseBoxCell::implGetBoundingBox()
74 	{
75 		return mpBrowseBox->GetFieldRectPixelAbs( m_nRowPos, m_nColPos, sal_False, sal_False );
76 	}
77 
78 	// -----------------------------------------------------------------------------
implGetBoundingBoxOnScreen()79 	::Rectangle AccessibleBrowseBoxCell::implGetBoundingBoxOnScreen()
80 	{
81 		return mpBrowseBox->GetFieldRectPixelAbs( m_nRowPos, m_nColPos, sal_False );
82 	}
83 
84 // .................................................................................
85 }	// namespace accessibility
86 // .................................................................................
87