1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file
5f6e50924SAndrew Rist * distributed with this work for additional information
6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at
10f6e50924SAndrew Rist *
11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12f6e50924SAndrew Rist *
13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist * software distributed under the License is distributed on an
15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the
17f6e50924SAndrew Rist * specific language governing permissions and limitations
18f6e50924SAndrew Rist * under the License.
19f6e50924SAndrew Rist *
20f6e50924SAndrew Rist *************************************************************/
21f6e50924SAndrew Rist
22f6e50924SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <com/sun/star/table/XMergeableCell.hpp>
28cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
29cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include <comphelper/accessiblewrapper.hxx>
32cdf0e10cSrcweir #include <vos/mutex.hxx>
33cdf0e10cSrcweir #include <tools/debug.hxx>
34cdf0e10cSrcweir #include <vcl/svapp.hxx>
35cdf0e10cSrcweir
36cdf0e10cSrcweir #include <svx/AccessibleTableShape.hxx>
37766ce4d0SZheng Fan #include <svx/sdr/table/tablecontroller.hxx>
38cdf0e10cSrcweir #include "accessiblecell.hxx"
39cdf0e10cSrcweir
40cdf0e10cSrcweir #include <algorithm>
41cdf0e10cSrcweir
42cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
439b8096d0SSteve Yin #include <svx/svdotable.hxx>
449b8096d0SSteve Yin #include <com/sun/star/accessibility/AccessibleStateType.hpp>
459b8096d0SSteve Yin #include <com/sun/star/view/XSelectionSupplier.hpp>
46cdf0e10cSrcweir
47cdf0e10cSrcweir using ::rtl::OUString;
48cdf0e10cSrcweir
49cdf0e10cSrcweir using namespace ::accessibility;
50cdf0e10cSrcweir using namespace ::sdr::table;
51cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
52cdf0e10cSrcweir using namespace ::com::sun::star::uno;
53cdf0e10cSrcweir using namespace ::com::sun::star::beans;
54cdf0e10cSrcweir using namespace ::com::sun::star::util;
55cdf0e10cSrcweir using namespace ::com::sun::star::lang;
56cdf0e10cSrcweir using namespace ::com::sun::star::drawing;
57cdf0e10cSrcweir using namespace ::com::sun::star::table;
58cdf0e10cSrcweir using namespace ::com::sun::star::container;
59cdf0e10cSrcweir
60cdf0e10cSrcweir #define C2U(x) OUString(RTL_CONSTASCII_USTRINGPARAM(x))
61cdf0e10cSrcweir
62cdf0e10cSrcweir namespace accessibility
63cdf0e10cSrcweir {
64cdf0e10cSrcweir
65cdf0e10cSrcweir struct hash
66cdf0e10cSrcweir {
operator ()accessibility::hash67cdf0e10cSrcweir std::size_t operator()( const Reference< XCell >& xCell ) const
68cdf0e10cSrcweir {
69cdf0e10cSrcweir return std::size_t( xCell.get() );
70cdf0e10cSrcweir }
71cdf0e10cSrcweir };
72cdf0e10cSrcweir
73cdf0e10cSrcweir typedef std::hash_map< Reference< XCell >, rtl::Reference< AccessibleCell >, hash > AccessibleCellMap;
74cdf0e10cSrcweir
75cdf0e10cSrcweir //-----------------------------------------------------------------------------
76cdf0e10cSrcweir // AccessibleTableShapeImpl
77cdf0e10cSrcweir //-----------------------------------------------------------------------------
78cdf0e10cSrcweir
79cdf0e10cSrcweir class AccessibleTableShapeImpl : public cppu::WeakImplHelper1< XModifyListener >
80cdf0e10cSrcweir {
81cdf0e10cSrcweir public:
82cdf0e10cSrcweir AccessibleTableShapeImpl( AccessibleShapeTreeInfo& rShapeTreeInfo );
83cdf0e10cSrcweir
84cdf0e10cSrcweir void init( const Reference< XAccessible>& xAccessible, const Reference< XTable >& xTable );
85cdf0e10cSrcweir void dispose();
86cdf0e10cSrcweir
87cdf0e10cSrcweir Reference< XAccessible > getAccessibleChild( sal_Int32 i ) throw(IndexOutOfBoundsException);
88cdf0e10cSrcweir void getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (IndexOutOfBoundsException );
89cdf0e10cSrcweir
90cdf0e10cSrcweir // XModifyListener
91cdf0e10cSrcweir virtual void SAL_CALL modified( const EventObject& aEvent ) throw (RuntimeException);
92cdf0e10cSrcweir
93cdf0e10cSrcweir // XEventListener
94cdf0e10cSrcweir virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
95cdf0e10cSrcweir
96cdf0e10cSrcweir AccessibleShapeTreeInfo& mrShapeTreeInfo;
97cdf0e10cSrcweir Reference< XTable > mxTable;
98cdf0e10cSrcweir AccessibleCellMap maChildMap;
99cdf0e10cSrcweir Reference< XAccessible> mxAccessible;
1009b8096d0SSteve Yin sal_Int32 mRowCount, mColCount;
1019b8096d0SSteve Yin //get the cached AccessibleCell from XCell
1029b8096d0SSteve Yin Reference< AccessibleCell > getAccessibleCell (Reference< XCell > xCell);
103cdf0e10cSrcweir };
104cdf0e10cSrcweir
105cdf0e10cSrcweir //-----------------------------------------------------------------------------
106cdf0e10cSrcweir
AccessibleTableShapeImpl(AccessibleShapeTreeInfo & rShapeTreeInfo)107cdf0e10cSrcweir AccessibleTableShapeImpl::AccessibleTableShapeImpl( AccessibleShapeTreeInfo& rShapeTreeInfo )
108cdf0e10cSrcweir : mrShapeTreeInfo( rShapeTreeInfo )
1099b8096d0SSteve Yin , mRowCount(0)
1109b8096d0SSteve Yin , mColCount(0)
111cdf0e10cSrcweir {
112cdf0e10cSrcweir }
113cdf0e10cSrcweir
114cdf0e10cSrcweir //-----------------------------------------------------------------------------
115cdf0e10cSrcweir
init(const Reference<XAccessible> & xAccessible,const Reference<XTable> & xTable)116cdf0e10cSrcweir void AccessibleTableShapeImpl::init( const Reference< XAccessible>& xAccessible, const Reference< XTable >& xTable )
117cdf0e10cSrcweir {
118cdf0e10cSrcweir mxAccessible = xAccessible;
119cdf0e10cSrcweir mxTable = xTable;
120cdf0e10cSrcweir
121cdf0e10cSrcweir if( mxTable.is() )
122cdf0e10cSrcweir {
123cdf0e10cSrcweir Reference< XModifyListener > xListener( this );
124cdf0e10cSrcweir mxTable->addModifyListener( xListener );
1259b8096d0SSteve Yin //register the listener with table model
1269b8096d0SSteve Yin Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(xTable, UNO_QUERY);
1279b8096d0SSteve Yin Reference< ::com::sun::star::view::XSelectionChangeListener > xSelListener( xAccessible, UNO_QUERY );
1289b8096d0SSteve Yin if (xSelSupplier.is())
1299b8096d0SSteve Yin xSelSupplier->addSelectionChangeListener(xSelListener);
1309b8096d0SSteve Yin mRowCount = mxTable->getRowCount();
1319b8096d0SSteve Yin mColCount = mxTable->getColumnCount();
132cdf0e10cSrcweir }
133cdf0e10cSrcweir }
134cdf0e10cSrcweir
135cdf0e10cSrcweir //-----------------------------------------------------------------------------
136cdf0e10cSrcweir
dispose()137cdf0e10cSrcweir void AccessibleTableShapeImpl::dispose()
138cdf0e10cSrcweir {
139cdf0e10cSrcweir if( mxTable.is() )
140cdf0e10cSrcweir {
1419b8096d0SSteve Yin //IAccessibility2 Implementation 2009-----, remove all the cell's acc object in table's dispose.
1429b8096d0SSteve Yin for( AccessibleCellMap::iterator iter( maChildMap.begin() ); iter != maChildMap.end(); iter++ )
1439b8096d0SSteve Yin {
1449b8096d0SSteve Yin (*iter).second->dispose();
1459b8096d0SSteve Yin }
146cdf0e10cSrcweir Reference< XModifyListener > xListener( this );
147cdf0e10cSrcweir mxTable->removeModifyListener( xListener );
148cdf0e10cSrcweir mxTable.clear();
149cdf0e10cSrcweir }
150cdf0e10cSrcweir mxAccessible.clear();
151cdf0e10cSrcweir }
152cdf0e10cSrcweir
153cdf0e10cSrcweir //-----------------------------------------------------------------------------
1549b8096d0SSteve Yin //IAccessibility2 Implementation 2009-----, get the cached AccessibleCell from XCell
getAccessibleCell(Reference<XCell> xCell)1559b8096d0SSteve Yin Reference< AccessibleCell > AccessibleTableShapeImpl::getAccessibleCell (Reference< XCell > xCell)
1569b8096d0SSteve Yin {
1579b8096d0SSteve Yin AccessibleCellMap::iterator iter( maChildMap.find( xCell ) );
158cdf0e10cSrcweir
1599b8096d0SSteve Yin if( iter != maChildMap.end() )
1609b8096d0SSteve Yin {
1619b8096d0SSteve Yin Reference< AccessibleCell > xChild( (*iter).second.get() );
1629b8096d0SSteve Yin return xChild;
1639b8096d0SSteve Yin }
1649b8096d0SSteve Yin return Reference< AccessibleCell >();
1659b8096d0SSteve Yin }
1669b8096d0SSteve Yin
1679b8096d0SSteve Yin //-----------------------------------------------------------------------------
getAccessibleChild(sal_Int32 nChildIndex)168cdf0e10cSrcweir Reference< XAccessible > AccessibleTableShapeImpl::getAccessibleChild( sal_Int32 nChildIndex ) throw(IndexOutOfBoundsException)
169cdf0e10cSrcweir {
170cdf0e10cSrcweir sal_Int32 nColumn = 0, nRow = 0;
171cdf0e10cSrcweir getColumnAndRow( nChildIndex, nColumn, nRow );
172cdf0e10cSrcweir
173cdf0e10cSrcweir Reference< XCell > xCell( mxTable->getCellByPosition( nColumn, nRow ) );
174cdf0e10cSrcweir AccessibleCellMap::iterator iter( maChildMap.find( xCell ) );
175cdf0e10cSrcweir
176cdf0e10cSrcweir if( iter != maChildMap.end() )
177cdf0e10cSrcweir {
178cdf0e10cSrcweir Reference< XAccessible > xChild( (*iter).second.get() );
179cdf0e10cSrcweir return xChild;
180cdf0e10cSrcweir }
181cdf0e10cSrcweir else
182cdf0e10cSrcweir {
183cdf0e10cSrcweir CellRef xCellRef( dynamic_cast< Cell* >( xCell.get() ) );
184cdf0e10cSrcweir
185cdf0e10cSrcweir rtl::Reference< AccessibleCell > xAccessibleCell( new AccessibleCell( mxAccessible, xCellRef, nChildIndex, mrShapeTreeInfo ) );
186cdf0e10cSrcweir
1879b8096d0SSteve Yin xAccessibleCell->Init();
188cdf0e10cSrcweir maChildMap[xCell] = xAccessibleCell;
189cdf0e10cSrcweir
190cdf0e10cSrcweir xAccessibleCell->Init();
191cdf0e10cSrcweir
192cdf0e10cSrcweir Reference< XAccessible > xChild( xAccessibleCell.get() );
193cdf0e10cSrcweir return xChild;
194cdf0e10cSrcweir }
195cdf0e10cSrcweir }
196cdf0e10cSrcweir
197cdf0e10cSrcweir //-----------------------------------------------------------------------------
198cdf0e10cSrcweir
getColumnAndRow(sal_Int32 nChildIndex,sal_Int32 & rnColumn,sal_Int32 & rnRow)199cdf0e10cSrcweir void AccessibleTableShapeImpl::getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (IndexOutOfBoundsException )
200cdf0e10cSrcweir {
201cdf0e10cSrcweir rnRow = 0;
202cdf0e10cSrcweir rnColumn = nChildIndex;
203cdf0e10cSrcweir
204cdf0e10cSrcweir if( mxTable.is() )
205cdf0e10cSrcweir {
206cdf0e10cSrcweir const sal_Int32 nColumnCount = mxTable->getColumnCount();
207cdf0e10cSrcweir while( rnColumn >= nColumnCount )
208cdf0e10cSrcweir {
209cdf0e10cSrcweir rnRow++;
210cdf0e10cSrcweir rnColumn -= nColumnCount;
211cdf0e10cSrcweir }
212cdf0e10cSrcweir
213cdf0e10cSrcweir if( rnRow < mxTable->getRowCount() )
214cdf0e10cSrcweir return;
215cdf0e10cSrcweir }
216cdf0e10cSrcweir
217cdf0e10cSrcweir throw IndexOutOfBoundsException();
218cdf0e10cSrcweir }
219cdf0e10cSrcweir
220cdf0e10cSrcweir // XModifyListener
modified(const EventObject &)221cdf0e10cSrcweir void SAL_CALL AccessibleTableShapeImpl::modified( const EventObject& /*aEvent*/ ) throw (RuntimeException)
222cdf0e10cSrcweir {
223cdf0e10cSrcweir if( mxTable.is() ) try
224cdf0e10cSrcweir {
225cdf0e10cSrcweir // structural changes may have happened to the table, validate all accessible cell instances
226cdf0e10cSrcweir AccessibleCellMap aTempChildMap;
227cdf0e10cSrcweir aTempChildMap.swap( maChildMap );
228cdf0e10cSrcweir
229cdf0e10cSrcweir // first move all still existing cells to maChildMap again and update their index
230cdf0e10cSrcweir
231cdf0e10cSrcweir const sal_Int32 nRowCount = mxTable->getRowCount();
232cdf0e10cSrcweir const sal_Int32 nColCount = mxTable->getColumnCount();
233cdf0e10cSrcweir
2349b8096d0SSteve Yin sal_Bool bRowOrColumnChanged = sal_False;
2359b8096d0SSteve Yin if (mRowCount != nRowCount || mColCount != nColCount )
2369b8096d0SSteve Yin {
2379b8096d0SSteve Yin bRowOrColumnChanged = sal_True;
2389b8096d0SSteve Yin mRowCount = nRowCount;
2399b8096d0SSteve Yin mColCount = nColCount;
2409b8096d0SSteve Yin }
241cdf0e10cSrcweir sal_Int32 nChildIndex = 0;
242cdf0e10cSrcweir
243cdf0e10cSrcweir for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
244cdf0e10cSrcweir {
245cdf0e10cSrcweir for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol )
246cdf0e10cSrcweir {
247cdf0e10cSrcweir Reference< XCell > xCell( mxTable->getCellByPosition( nCol, nRow ) );
248cdf0e10cSrcweir AccessibleCellMap::iterator iter( aTempChildMap.find( xCell ) );
249cdf0e10cSrcweir
250cdf0e10cSrcweir if( iter != aTempChildMap.end() )
251cdf0e10cSrcweir {
252cdf0e10cSrcweir rtl::Reference< AccessibleCell > xAccessibleCell( (*iter).second );
253cdf0e10cSrcweir xAccessibleCell->setIndexInParent( nChildIndex );
2549b8096d0SSteve Yin //IAccessibility2 Implementation 2009-----, the children may need to updated
2559b8096d0SSteve Yin //xAccessibleCell->CommitChange(AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any());
2569b8096d0SSteve Yin xAccessibleCell->UpdateChildren();
2579b8096d0SSteve Yin // If row or column count is changed, there is split or merge, so all cell's acc name should be updated
2589b8096d0SSteve Yin if (bRowOrColumnChanged)
2599b8096d0SSteve Yin {
2609b8096d0SSteve Yin xAccessibleCell->SetAccessibleName(xAccessibleCell->getAccessibleName(), AccessibleContextBase::ManuallySet);
2619b8096d0SSteve Yin }
2629b8096d0SSteve Yin // For merged cell, add invisible & disabled state.
2639b8096d0SSteve Yin Reference< XMergeableCell > xMergedCell( mxTable->getCellByPosition( nCol, nRow ), UNO_QUERY );
2649b8096d0SSteve Yin if (xMergedCell.is() && xMergedCell->isMerged())
2659b8096d0SSteve Yin {
2669b8096d0SSteve Yin xAccessibleCell->ResetState(AccessibleStateType::VISIBLE);
2679b8096d0SSteve Yin xAccessibleCell->ResetState(AccessibleStateType::ENABLED);
2689b8096d0SSteve Yin // IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent
2699b8096d0SSteve Yin // xAccessibleCell->SetState(AccessibleStateType::OFFSCREEN);
2709b8096d0SSteve Yin xAccessibleCell->ResetState(AccessibleStateType::SHOWING);
2719b8096d0SSteve Yin }
2729b8096d0SSteve Yin else
2739b8096d0SSteve Yin {
2749b8096d0SSteve Yin xAccessibleCell->SetState(AccessibleStateType::VISIBLE);
2759b8096d0SSteve Yin xAccessibleCell->SetState(AccessibleStateType::ENABLED);
2769b8096d0SSteve Yin // IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent
2779b8096d0SSteve Yin // xAccessibleCell->ResetState(AccessibleStateType::OFFSCREEN);
2789b8096d0SSteve Yin xAccessibleCell->SetState(AccessibleStateType::SHOWING);
2799b8096d0SSteve Yin }
280cdf0e10cSrcweir
281cdf0e10cSrcweir // move still existing cell from temporary child map to our child map
282cdf0e10cSrcweir maChildMap[xCell] = xAccessibleCell;
283cdf0e10cSrcweir aTempChildMap.erase( iter );
284cdf0e10cSrcweir }
2859b8096d0SSteve Yin //IAccessibility2 Implementation 2009-----, need to add the new added cell on demand
2869b8096d0SSteve Yin else
2879b8096d0SSteve Yin {
2889b8096d0SSteve Yin CellRef xCellRef( dynamic_cast< Cell* >( xCell.get() ) );
2899b8096d0SSteve Yin
2909b8096d0SSteve Yin rtl::Reference< AccessibleCell > xAccessibleCell( new AccessibleCell( mxAccessible, xCellRef, nChildIndex, mrShapeTreeInfo ) );
2919b8096d0SSteve Yin
2929b8096d0SSteve Yin xAccessibleCell->Init();
2939b8096d0SSteve Yin maChildMap[xCell] = xAccessibleCell;
2949b8096d0SSteve Yin }
295cdf0e10cSrcweir
296cdf0e10cSrcweir ++nChildIndex;
297cdf0e10cSrcweir }
298cdf0e10cSrcweir }
299cdf0e10cSrcweir
300cdf0e10cSrcweir // all accessible cell instances still left in aTempChildMap must be disposed
301cdf0e10cSrcweir // as they are no longer part of the table
302cdf0e10cSrcweir
303cdf0e10cSrcweir for( AccessibleCellMap::iterator iter( aTempChildMap.begin() ); iter != aTempChildMap.end(); iter++ )
304cdf0e10cSrcweir {
305cdf0e10cSrcweir (*iter).second->dispose();
306cdf0e10cSrcweir }
3079b8096d0SSteve Yin //IAccessibility2 Implementation 2009-----, notify bridge to update the acc cache.
3089b8096d0SSteve Yin AccessibleTableShape *pAccTable = dynamic_cast <AccessibleTableShape *> (mxAccessible.get());
3099b8096d0SSteve Yin pAccTable->CommitChange(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
310cdf0e10cSrcweir }
311cdf0e10cSrcweir catch( Exception& )
312cdf0e10cSrcweir {
313cdf0e10cSrcweir DBG_ERROR("svx::AccessibleTableShape::modified(), exception caught!");
314cdf0e10cSrcweir }
315cdf0e10cSrcweir }
316cdf0e10cSrcweir
317cdf0e10cSrcweir // XEventListener
disposing(const EventObject &)318cdf0e10cSrcweir void SAL_CALL AccessibleTableShapeImpl::disposing( const EventObject& /*Source*/ ) throw (RuntimeException)
319cdf0e10cSrcweir {
320cdf0e10cSrcweir }
321cdf0e10cSrcweir
322cdf0e10cSrcweir //-----------------------------------------------------------------------------
323cdf0e10cSrcweir // AccessibleTableShape
324cdf0e10cSrcweir //-----------------------------------------------------------------------------
325cdf0e10cSrcweir
326cdf0e10cSrcweir //-----------------------------------------------------------------------------
327cdf0e10cSrcweir
AccessibleTableShape(const AccessibleShapeInfo & rShapeInfo,const AccessibleShapeTreeInfo & rShapeTreeInfo)328cdf0e10cSrcweir AccessibleTableShape::AccessibleTableShape( const AccessibleShapeInfo& rShapeInfo, const AccessibleShapeTreeInfo& rShapeTreeInfo)
329cdf0e10cSrcweir : AccessibleTableShape_Base(rShapeInfo, rShapeTreeInfo)
330ec81bebdSSteve Yin , mnPreviousSelectionCount(0)
331*61b9b0e4SPavel Janík , mxImpl( new AccessibleTableShapeImpl( maShapeTreeInfo ) )
332cdf0e10cSrcweir {
333cdf0e10cSrcweir }
334cdf0e10cSrcweir
335cdf0e10cSrcweir //-----------------------------------------------------------------------------
336cdf0e10cSrcweir
~AccessibleTableShape(void)337cdf0e10cSrcweir AccessibleTableShape::~AccessibleTableShape (void)
338cdf0e10cSrcweir {
339cdf0e10cSrcweir }
340cdf0e10cSrcweir
341cdf0e10cSrcweir //-----------------------------------------------------------------------------
342cdf0e10cSrcweir
Init()343cdf0e10cSrcweir void AccessibleTableShape::Init()
344cdf0e10cSrcweir {
345cdf0e10cSrcweir try
346ec81bebdSSteve Yin {
347cdf0e10cSrcweir Reference< XPropertySet > xSet( mxShape, UNO_QUERY_THROW );
348cdf0e10cSrcweir Reference< XTable > xTable( xSet->getPropertyValue(C2U("Model")), UNO_QUERY_THROW );
349cdf0e10cSrcweir
350cdf0e10cSrcweir mxImpl->init( this, xTable );
351cdf0e10cSrcweir }
352cdf0e10cSrcweir catch( Exception& )
353cdf0e10cSrcweir {
354cdf0e10cSrcweir DBG_ERROR("AccessibleTableShape::init(), exception caught?");
355cdf0e10cSrcweir }
356cdf0e10cSrcweir
357cdf0e10cSrcweir AccessibleTableShape_Base::Init();
358cdf0e10cSrcweir }
359cdf0e10cSrcweir
360cdf0e10cSrcweir //-----------------------------------------------------------------------------
361cdf0e10cSrcweir
getTableController()362cdf0e10cSrcweir SvxTableController* AccessibleTableShape::getTableController()
363cdf0e10cSrcweir {
364cdf0e10cSrcweir SdrView* pView = maShapeTreeInfo.GetSdrView ();
365cdf0e10cSrcweir if( pView )
366cdf0e10cSrcweir return dynamic_cast< SvxTableController* >( pView->getSelectionController().get() );
367cdf0e10cSrcweir else
368cdf0e10cSrcweir return 0;
369cdf0e10cSrcweir }
370cdf0e10cSrcweir
371cdf0e10cSrcweir //-----------------------------------------------------------------------------
372cdf0e10cSrcweir // XInterface
373cdf0e10cSrcweir //-----------------------------------------------------------------------------
374cdf0e10cSrcweir
queryInterface(const Type & aType)375cdf0e10cSrcweir Any SAL_CALL AccessibleTableShape::queryInterface( const Type& aType ) throw (RuntimeException)
376cdf0e10cSrcweir {
3779b8096d0SSteve Yin if ( aType == ::getCppuType((Reference<XAccessibleTableSelection> *)0) )
3789b8096d0SSteve Yin {
3799b8096d0SSteve Yin Reference<XAccessibleTableSelection> xThis( this );
3809b8096d0SSteve Yin Any aRet;
3819b8096d0SSteve Yin aRet <<= xThis;
3829b8096d0SSteve Yin return aRet;
3839b8096d0SSteve Yin }
3849b8096d0SSteve Yin else
385cdf0e10cSrcweir return AccessibleTableShape_Base::queryInterface( aType );
386cdf0e10cSrcweir }
387cdf0e10cSrcweir
388cdf0e10cSrcweir //-----------------------------------------------------------------------------
389cdf0e10cSrcweir
acquire()390cdf0e10cSrcweir void SAL_CALL AccessibleTableShape::acquire( ) throw ()
391cdf0e10cSrcweir {
392cdf0e10cSrcweir AccessibleTableShape_Base::acquire();
393cdf0e10cSrcweir }
394cdf0e10cSrcweir
395cdf0e10cSrcweir //-----------------------------------------------------------------------------
396cdf0e10cSrcweir
release()397cdf0e10cSrcweir void SAL_CALL AccessibleTableShape::release( ) throw ()
398cdf0e10cSrcweir {
399cdf0e10cSrcweir AccessibleTableShape_Base::release();
400cdf0e10cSrcweir }
401cdf0e10cSrcweir
402cdf0e10cSrcweir //-----------------------------------------------------------------------------
403cdf0e10cSrcweir // XAccessible
404cdf0e10cSrcweir //-----------------------------------------------------------------------------
405cdf0e10cSrcweir
getAccessibleContext(void)406cdf0e10cSrcweir Reference< XAccessibleContext > SAL_CALL AccessibleTableShape::getAccessibleContext(void) throw (RuntimeException)
407cdf0e10cSrcweir {
408cdf0e10cSrcweir return AccessibleShape::getAccessibleContext ();
409cdf0e10cSrcweir }
410cdf0e10cSrcweir
411cdf0e10cSrcweir //-----------------------------------------------------------------------------
getImplementationName(void)412cdf0e10cSrcweir OUString SAL_CALL AccessibleTableShape::getImplementationName(void) throw (RuntimeException)
413cdf0e10cSrcweir {
414cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.accessibility.AccessibleTableShape" ) );
415cdf0e10cSrcweir }
416cdf0e10cSrcweir
417cdf0e10cSrcweir //-----------------------------------------------------------------------------
418cdf0e10cSrcweir
CreateAccessibleBaseName(void)419cdf0e10cSrcweir OUString AccessibleTableShape::CreateAccessibleBaseName(void) throw (RuntimeException)
420cdf0e10cSrcweir {
4219b8096d0SSteve Yin return OUString (RTL_CONSTASCII_USTRINGPARAM("TableShape"));
422cdf0e10cSrcweir }
423cdf0e10cSrcweir
424cdf0e10cSrcweir //--------------------------------------------------------------------
425cdf0e10cSrcweir
getAccessibleChildCount()426cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleChildCount( ) throw(RuntimeException)
427cdf0e10cSrcweir {
428cdf0e10cSrcweir ::vos::OGuard aSolarGuard(::Application::GetSolarMutex());
429cdf0e10cSrcweir return mxImpl->mxTable.is() ? mxImpl->mxTable->getRowCount() * mxImpl->mxTable->getColumnCount() : 0;
430cdf0e10cSrcweir }
431cdf0e10cSrcweir
432cdf0e10cSrcweir //--------------------------------------------------------------------
getAccessibleChild(sal_Int32 i)433cdf0e10cSrcweir Reference< XAccessible > SAL_CALL AccessibleTableShape::getAccessibleChild( sal_Int32 i ) throw(IndexOutOfBoundsException, RuntimeException)
434cdf0e10cSrcweir {
435cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
436cdf0e10cSrcweir ThrowIfDisposed();
437cdf0e10cSrcweir
438cdf0e10cSrcweir return mxImpl->getAccessibleChild( i );
439cdf0e10cSrcweir }
440cdf0e10cSrcweir
441cdf0e10cSrcweir //--------------------------------------------------------------------
getAccessibleRelationSet()442cdf0e10cSrcweir Reference< XAccessibleRelationSet > SAL_CALL AccessibleTableShape::getAccessibleRelationSet( ) throw (RuntimeException)
443cdf0e10cSrcweir {
444cdf0e10cSrcweir return AccessibleShape::getAccessibleRelationSet( );
445cdf0e10cSrcweir }
446cdf0e10cSrcweir
447cdf0e10cSrcweir //--------------------------------------------------------------------
448cdf0e10cSrcweir
getAccessibleRole(void)449cdf0e10cSrcweir sal_Int16 SAL_CALL AccessibleTableShape::getAccessibleRole (void) throw (RuntimeException)
450cdf0e10cSrcweir {
451cdf0e10cSrcweir return AccessibleRole::TABLE;
452cdf0e10cSrcweir }
453cdf0e10cSrcweir
454cdf0e10cSrcweir //--------------------------------------------------------------------
455cdf0e10cSrcweir
disposing(void)456cdf0e10cSrcweir void SAL_CALL AccessibleTableShape::disposing (void)
457cdf0e10cSrcweir {
458cdf0e10cSrcweir mxImpl->dispose();
459cdf0e10cSrcweir
460cdf0e10cSrcweir // let the base do it's stuff
461cdf0e10cSrcweir AccessibleShape::disposing();
462cdf0e10cSrcweir }
463cdf0e10cSrcweir
464cdf0e10cSrcweir //--------------------------------------------------------------------
465cdf0e10cSrcweir // XAccessibleTable
466cdf0e10cSrcweir //--------------------------------------------------------------------
467cdf0e10cSrcweir
getAccessibleRowCount()468cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleRowCount() throw (RuntimeException)
469cdf0e10cSrcweir {
470cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
471cdf0e10cSrcweir return mxImpl->mxTable.is() ? mxImpl->mxTable->getRowCount() : 0;
472cdf0e10cSrcweir }
473cdf0e10cSrcweir
474cdf0e10cSrcweir //--------------------------------------------------------------------
475cdf0e10cSrcweir
getAccessibleColumnCount()476cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleColumnCount( ) throw (RuntimeException)
477cdf0e10cSrcweir {
478cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
479cdf0e10cSrcweir return mxImpl->mxTable.is() ? mxImpl->mxTable->getColumnCount() : 0;
480cdf0e10cSrcweir }
481cdf0e10cSrcweir
482cdf0e10cSrcweir //--------------------------------------------------------------------
483cdf0e10cSrcweir
getAccessibleRowDescription(sal_Int32 nRow)484cdf0e10cSrcweir OUString SAL_CALL AccessibleTableShape::getAccessibleRowDescription( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
485cdf0e10cSrcweir {
486cdf0e10cSrcweir checkCellPosition( 0, nRow );
487cdf0e10cSrcweir return OUString();
488cdf0e10cSrcweir }
489cdf0e10cSrcweir
490cdf0e10cSrcweir //--------------------------------------------------------------------
491cdf0e10cSrcweir
getAccessibleColumnDescription(sal_Int32 nColumn)492cdf0e10cSrcweir OUString SAL_CALL AccessibleTableShape::getAccessibleColumnDescription( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
493cdf0e10cSrcweir {
494cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
495cdf0e10cSrcweir checkCellPosition( nColumn, 0 );
496cdf0e10cSrcweir return OUString();
497cdf0e10cSrcweir }
498cdf0e10cSrcweir
499cdf0e10cSrcweir //--------------------------------------------------------------------
500cdf0e10cSrcweir
getAccessibleRowExtentAt(sal_Int32 nRow,sal_Int32 nColumn)501cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
502cdf0e10cSrcweir {
503cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
504cdf0e10cSrcweir checkCellPosition( nColumn, nRow );
505cdf0e10cSrcweir if( mxImpl->mxTable.is() )
506cdf0e10cSrcweir {
507cdf0e10cSrcweir Reference< XMergeableCell > xCell( mxImpl->mxTable->getCellByPosition( nColumn, nRow ), UNO_QUERY );
508cdf0e10cSrcweir if( xCell.is() )
509cdf0e10cSrcweir return xCell->getRowSpan();
510cdf0e10cSrcweir }
511cdf0e10cSrcweir return 1;
512cdf0e10cSrcweir }
513cdf0e10cSrcweir
514cdf0e10cSrcweir //--------------------------------------------------------------------
515cdf0e10cSrcweir
getAccessibleColumnExtentAt(sal_Int32 nRow,sal_Int32 nColumn)516cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
517cdf0e10cSrcweir {
518cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
519cdf0e10cSrcweir checkCellPosition( nColumn, nRow );
520cdf0e10cSrcweir if( mxImpl->mxTable.is() )
521cdf0e10cSrcweir {
522cdf0e10cSrcweir Reference< XMergeableCell > xCell( mxImpl->mxTable->getCellByPosition( nColumn, nRow ), UNO_QUERY );
523cdf0e10cSrcweir if( xCell.is() )
524cdf0e10cSrcweir return xCell->getColumnSpan();
525cdf0e10cSrcweir }
526cdf0e10cSrcweir return 1;
527cdf0e10cSrcweir }
528cdf0e10cSrcweir
529cdf0e10cSrcweir //--------------------------------------------------------------------
530cdf0e10cSrcweir
getAccessibleRowHeaders()531cdf0e10cSrcweir Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleRowHeaders( ) throw (RuntimeException)
532cdf0e10cSrcweir {
5339b8096d0SSteve Yin //Reference< XAccessibleTable > xRet( this ); // todo
5349b8096d0SSteve Yin Reference< XAccessibleTable > xRet;
5359b8096d0SSteve Yin SvxTableController* pController = getTableController();
5369b8096d0SSteve Yin if( pController )
5379b8096d0SSteve Yin {
5389b8096d0SSteve Yin if( pController->isRowHeader() )
5399b8096d0SSteve Yin {
5409b8096d0SSteve Yin AccessibleTableHeaderShape* pTableHeader = new AccessibleTableHeaderShape( this, sal_True );
5419b8096d0SSteve Yin xRet.set( pTableHeader );
5429b8096d0SSteve Yin }
5439b8096d0SSteve Yin }
544cdf0e10cSrcweir return xRet;
545cdf0e10cSrcweir }
546cdf0e10cSrcweir
547cdf0e10cSrcweir //--------------------------------------------------------------------
548cdf0e10cSrcweir
getAccessibleColumnHeaders()549cdf0e10cSrcweir Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleColumnHeaders( ) throw (RuntimeException)
550cdf0e10cSrcweir {
5519b8096d0SSteve Yin //Reference< XAccessibleTable > xRet( this ); // todo
5529b8096d0SSteve Yin Reference< XAccessibleTable > xRet;
5539b8096d0SSteve Yin SvxTableController* pController = getTableController();
5549b8096d0SSteve Yin if( pController )
5559b8096d0SSteve Yin {
5569b8096d0SSteve Yin if( pController->isColumnHeader() )
5579b8096d0SSteve Yin {
5589b8096d0SSteve Yin AccessibleTableHeaderShape* pTableHeader = new AccessibleTableHeaderShape( this, sal_False );
5599b8096d0SSteve Yin xRet.set( pTableHeader );
5609b8096d0SSteve Yin }
5619b8096d0SSteve Yin }
562cdf0e10cSrcweir return xRet;
563cdf0e10cSrcweir }
564cdf0e10cSrcweir
565cdf0e10cSrcweir //--------------------------------------------------------------------
566cdf0e10cSrcweir
getSelectedAccessibleRows()567cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL AccessibleTableShape::getSelectedAccessibleRows( ) throw (RuntimeException)
568cdf0e10cSrcweir {
5699b8096d0SSteve Yin /*Sequence< sal_Int32 > aRet;*/
5709b8096d0SSteve Yin sal_Int32 nRow = getAccessibleRowCount();
5719b8096d0SSteve Yin ::std::vector< sal_Bool > aSelected( nRow, sal_True );
5729b8096d0SSteve Yin sal_Int32 nCount = nRow;
5739b8096d0SSteve Yin for( sal_Int32 i = 0; i < nRow; i++ )
5749b8096d0SSteve Yin {
5759b8096d0SSteve Yin try
5769b8096d0SSteve Yin {
5779b8096d0SSteve Yin aSelected[i] = isAccessibleRowSelected( i );
5789b8096d0SSteve Yin }
5799b8096d0SSteve Yin catch( ... )
5809b8096d0SSteve Yin {
5819b8096d0SSteve Yin return Sequence< sal_Int32 >();
5829b8096d0SSteve Yin }
5839b8096d0SSteve Yin
5849b8096d0SSteve Yin if( !aSelected[i] )
5859b8096d0SSteve Yin nCount--;
5869b8096d0SSteve Yin }
5879b8096d0SSteve Yin Sequence < sal_Int32 > aRet( nCount );
5889b8096d0SSteve Yin sal_Int32 *pRet = aRet.getArray();
5899b8096d0SSteve Yin sal_Int32 nPos = 0;
5909b8096d0SSteve Yin size_t nSize = aSelected.size();
5919b8096d0SSteve Yin for( size_t i=0; i < nSize && nPos < nCount; i++ )
5929b8096d0SSteve Yin {
5939b8096d0SSteve Yin if( aSelected[i] )
5949b8096d0SSteve Yin {
5959b8096d0SSteve Yin *pRet++ = i;
5969b8096d0SSteve Yin nPos++;
5979b8096d0SSteve Yin }
5989b8096d0SSteve Yin }
5999b8096d0SSteve Yin
600cdf0e10cSrcweir return aRet;
601cdf0e10cSrcweir }
602cdf0e10cSrcweir
603cdf0e10cSrcweir //--------------------------------------------------------------------
604cdf0e10cSrcweir
getSelectedAccessibleColumns()605cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL AccessibleTableShape::getSelectedAccessibleColumns( ) throw (RuntimeException)
606cdf0e10cSrcweir {
6079b8096d0SSteve Yin /*Sequence< sal_Int32 > aRet;*/
6089b8096d0SSteve Yin sal_Int32 nColumn = getAccessibleColumnCount();
6099b8096d0SSteve Yin ::std::vector< sal_Bool > aSelected( nColumn, sal_True );
6109b8096d0SSteve Yin sal_Int32 nCount = nColumn;
6119b8096d0SSteve Yin for( sal_Int32 i = 0; i < nColumn; i++ )
6129b8096d0SSteve Yin {
6139b8096d0SSteve Yin try
6149b8096d0SSteve Yin {
6159b8096d0SSteve Yin aSelected[i] = isAccessibleColumnSelected( i );
6169b8096d0SSteve Yin }
6179b8096d0SSteve Yin catch( ... )
6189b8096d0SSteve Yin {
6199b8096d0SSteve Yin return Sequence< sal_Int32 >();
6209b8096d0SSteve Yin }
6219b8096d0SSteve Yin
6229b8096d0SSteve Yin if( !aSelected[i] )
6239b8096d0SSteve Yin nCount--;
6249b8096d0SSteve Yin }
6259b8096d0SSteve Yin Sequence < sal_Int32 > aRet( nCount );
6269b8096d0SSteve Yin sal_Int32 *pRet = aRet.getArray();
6279b8096d0SSteve Yin sal_Int32 nPos = 0;
6289b8096d0SSteve Yin size_t nSize = aSelected.size();
6299b8096d0SSteve Yin for( size_t i=0; i < nSize && nPos < nCount; i++ )
6309b8096d0SSteve Yin {
6319b8096d0SSteve Yin if( aSelected[i] )
6329b8096d0SSteve Yin {
6339b8096d0SSteve Yin *pRet++ = i;
6349b8096d0SSteve Yin nPos++;
6359b8096d0SSteve Yin }
6369b8096d0SSteve Yin }
6379b8096d0SSteve Yin
638cdf0e10cSrcweir return aRet;
639cdf0e10cSrcweir }
640cdf0e10cSrcweir
641cdf0e10cSrcweir //--------------------------------------------------------------------
642cdf0e10cSrcweir
isAccessibleRowSelected(sal_Int32 nRow)643cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleTableShape::isAccessibleRowSelected( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
644cdf0e10cSrcweir {
645cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
646cdf0e10cSrcweir checkCellPosition( 0, nRow );
6479b8096d0SSteve Yin SvxTableController* pController = getTableController();
6489b8096d0SSteve Yin if( pController )
6499b8096d0SSteve Yin {
6509b8096d0SSteve Yin return pController->isRowSelected( nRow );
6519b8096d0SSteve Yin }
652cdf0e10cSrcweir return sal_False;
653cdf0e10cSrcweir }
654cdf0e10cSrcweir
655cdf0e10cSrcweir //--------------------------------------------------------------------
656cdf0e10cSrcweir
isAccessibleColumnSelected(sal_Int32 nColumn)657cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleTableShape::isAccessibleColumnSelected( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
658cdf0e10cSrcweir {
659cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
660cdf0e10cSrcweir checkCellPosition( nColumn, 0 );
6619b8096d0SSteve Yin SvxTableController* pController = getTableController();
6629b8096d0SSteve Yin if( pController )
6639b8096d0SSteve Yin {
6649b8096d0SSteve Yin return pController->isColumnSelected( nColumn );
6659b8096d0SSteve Yin }
666cdf0e10cSrcweir return sal_False;
667cdf0e10cSrcweir }
668cdf0e10cSrcweir
669cdf0e10cSrcweir //--------------------------------------------------------------------
670cdf0e10cSrcweir
getAccessibleCellAt(sal_Int32 nRow,sal_Int32 nColumn)671cdf0e10cSrcweir Reference< XAccessible > SAL_CALL AccessibleTableShape::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
672cdf0e10cSrcweir {
673cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
674cdf0e10cSrcweir checkCellPosition( nColumn, nRow );
675cdf0e10cSrcweir
676cdf0e10cSrcweir sal_Int32 nChildIndex = 0;
677cdf0e10cSrcweir if( mxImpl->mxTable.is() )
678cdf0e10cSrcweir nChildIndex = mxImpl->mxTable->getColumnCount() * nRow + nColumn;
679cdf0e10cSrcweir
680cdf0e10cSrcweir return getAccessibleChild( nChildIndex );
681cdf0e10cSrcweir }
682cdf0e10cSrcweir
683cdf0e10cSrcweir //--------------------------------------------------------------------
684cdf0e10cSrcweir
getAccessibleCaption()685cdf0e10cSrcweir Reference< XAccessible > SAL_CALL AccessibleTableShape::getAccessibleCaption( ) throw (RuntimeException)
686cdf0e10cSrcweir {
687cdf0e10cSrcweir Reference< XAccessible > xRet;
688cdf0e10cSrcweir return xRet;
689cdf0e10cSrcweir }
690cdf0e10cSrcweir
691cdf0e10cSrcweir //--------------------------------------------------------------------
692cdf0e10cSrcweir
getAccessibleSummary()693cdf0e10cSrcweir Reference< XAccessible > SAL_CALL AccessibleTableShape::getAccessibleSummary( ) throw (RuntimeException)
694cdf0e10cSrcweir {
695cdf0e10cSrcweir Reference< XAccessible > xRet;
696cdf0e10cSrcweir return xRet;
697cdf0e10cSrcweir }
698cdf0e10cSrcweir
699cdf0e10cSrcweir //--------------------------------------------------------------------
700cdf0e10cSrcweir
isAccessibleSelected(sal_Int32 nRow,sal_Int32 nColumn)701cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleTableShape::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
702cdf0e10cSrcweir {
703cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
704cdf0e10cSrcweir checkCellPosition( nColumn, nRow );
705cdf0e10cSrcweir
706cdf0e10cSrcweir SvxTableController* pController = getTableController();
707cdf0e10cSrcweir if( pController && pController->hasSelectedCells() )
708cdf0e10cSrcweir {
709cdf0e10cSrcweir CellPos aFirstPos, aLastPos;
710cdf0e10cSrcweir pController->getSelectedCells( aFirstPos, aLastPos );
711cdf0e10cSrcweir if( (aFirstPos.mnRow <= nRow) && (aFirstPos.mnCol <= nColumn) && (nRow <= aLastPos.mnRow) && (nColumn <= aLastPos.mnCol) )
712cdf0e10cSrcweir return sal_True;
713cdf0e10cSrcweir }
714cdf0e10cSrcweir
715cdf0e10cSrcweir return sal_False;
716cdf0e10cSrcweir }
717cdf0e10cSrcweir
718cdf0e10cSrcweir //--------------------------------------------------------------------
719cdf0e10cSrcweir
getAccessibleIndex(sal_Int32 nRow,sal_Int32 nColumn)720cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
721cdf0e10cSrcweir {
722cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
723cdf0e10cSrcweir checkCellPosition( nColumn, nRow );
724cdf0e10cSrcweir return mxImpl->mxTable.is() ? (nRow * mxImpl->mxTable->getColumnCount() + nColumn) : 0;
725cdf0e10cSrcweir }
726cdf0e10cSrcweir
727cdf0e10cSrcweir //--------------------------------------------------------------------
728cdf0e10cSrcweir
getAccessibleRow(sal_Int32 nChildIndex)729cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleRow( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
730cdf0e10cSrcweir {
731cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
732cdf0e10cSrcweir sal_Int32 nColumn = 0, nRow = 0;
733cdf0e10cSrcweir mxImpl->getColumnAndRow( nChildIndex, nColumn, nRow );
734cdf0e10cSrcweir return nRow;
735cdf0e10cSrcweir }
736cdf0e10cSrcweir
737cdf0e10cSrcweir //--------------------------------------------------------------------
738cdf0e10cSrcweir
getAccessibleColumn(sal_Int32 nChildIndex)739cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleColumn( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
740cdf0e10cSrcweir {
741cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
742cdf0e10cSrcweir sal_Int32 nColumn = 0, nRow = 0;
743cdf0e10cSrcweir mxImpl->getColumnAndRow( nChildIndex, nColumn, nRow );
7449b8096d0SSteve Yin //return nChildIndex;
7459b8096d0SSteve Yin return nColumn;
746cdf0e10cSrcweir }
747cdf0e10cSrcweir
748cdf0e10cSrcweir //--------------------------------------------------------------------
749cdf0e10cSrcweir // XAccessibleSelection
750cdf0e10cSrcweir //--------------------------------------------------------------------
751cdf0e10cSrcweir
selectAccessibleChild(sal_Int32 nChildIndex)752cdf0e10cSrcweir void SAL_CALL AccessibleTableShape::selectAccessibleChild( sal_Int32 nChildIndex ) throw ( IndexOutOfBoundsException, RuntimeException )
753cdf0e10cSrcweir {
754cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
755cdf0e10cSrcweir CellPos aPos;
756cdf0e10cSrcweir mxImpl->getColumnAndRow( nChildIndex, aPos.mnCol, aPos.mnRow );
757cdf0e10cSrcweir
758cdf0e10cSrcweir // todo, select table shape?!?
759cdf0e10cSrcweir SvxTableController* pController = getTableController();
760cdf0e10cSrcweir if( pController )
761cdf0e10cSrcweir {
762cdf0e10cSrcweir CellPos aFirstPos( aPos ), aLastPos( aPos );
763cdf0e10cSrcweir if( pController->hasSelectedCells() )
764cdf0e10cSrcweir {
765cdf0e10cSrcweir pController->getSelectedCells( aFirstPos, aLastPos );
766cdf0e10cSrcweir
767cdf0e10cSrcweir aFirstPos.mnRow = std::min( aFirstPos.mnRow, aPos.mnRow );
768cdf0e10cSrcweir aFirstPos.mnCol = std::min( aFirstPos.mnCol, aPos.mnCol );
769cdf0e10cSrcweir aLastPos.mnRow = std::max( aLastPos.mnRow, aPos.mnRow );
770cdf0e10cSrcweir aLastPos.mnCol = std::max( aLastPos.mnCol, aPos.mnCol );
771cdf0e10cSrcweir }
772cdf0e10cSrcweir pController->setSelectedCells( aFirstPos, aLastPos );
773cdf0e10cSrcweir }
774cdf0e10cSrcweir }
775cdf0e10cSrcweir
776cdf0e10cSrcweir //--------------------------------------------------------------------
777cdf0e10cSrcweir
isAccessibleChildSelected(sal_Int32 nChildIndex)778cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleTableShape::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw ( IndexOutOfBoundsException, RuntimeException )
779cdf0e10cSrcweir {
780cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
781cdf0e10cSrcweir CellPos aPos;
782cdf0e10cSrcweir mxImpl->getColumnAndRow( nChildIndex, aPos.mnCol, aPos.mnRow );
783cdf0e10cSrcweir
7849b8096d0SSteve Yin // Para order is not correct
7859b8096d0SSteve Yin //return isAccessibleSelected(aPos.mnCol, aPos.mnRow);
7869b8096d0SSteve Yin return isAccessibleSelected(aPos.mnRow, aPos.mnCol);
787cdf0e10cSrcweir }
788cdf0e10cSrcweir
789cdf0e10cSrcweir //--------------------------------------------------------------------
790cdf0e10cSrcweir
clearAccessibleSelection()791cdf0e10cSrcweir void SAL_CALL AccessibleTableShape::clearAccessibleSelection() throw ( RuntimeException )
792cdf0e10cSrcweir {
793cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
794cdf0e10cSrcweir
795cdf0e10cSrcweir SvxTableController* pController = getTableController();
796cdf0e10cSrcweir if( pController )
797cdf0e10cSrcweir pController->clearSelection();
798cdf0e10cSrcweir }
799cdf0e10cSrcweir //--------------------------------------------------------------------
800cdf0e10cSrcweir
selectAllAccessibleChildren()801cdf0e10cSrcweir void SAL_CALL AccessibleTableShape::selectAllAccessibleChildren() throw ( RuntimeException )
802cdf0e10cSrcweir {
803cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
804cdf0e10cSrcweir
805cdf0e10cSrcweir // todo: force selection of shape?
806cdf0e10cSrcweir SvxTableController* pController = getTableController();
807cdf0e10cSrcweir if( pController )
808cdf0e10cSrcweir pController->selectAll();
809cdf0e10cSrcweir }
810cdf0e10cSrcweir
811cdf0e10cSrcweir //--------------------------------------------------------------------
812cdf0e10cSrcweir
getSelectedAccessibleChildCount()813cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleTableShape::getSelectedAccessibleChildCount() throw ( RuntimeException )
814cdf0e10cSrcweir {
815cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
816cdf0e10cSrcweir
817cdf0e10cSrcweir SvxTableController* pController = getTableController();
818cdf0e10cSrcweir if( pController && pController->hasSelectedCells() )
819cdf0e10cSrcweir {
820cdf0e10cSrcweir CellPos aFirstPos, aLastPos;
821cdf0e10cSrcweir pController->getSelectedCells( aFirstPos, aLastPos );
822cdf0e10cSrcweir
823cdf0e10cSrcweir const sal_Int32 nSelectedColumns = std::max( (sal_Int32)0, aLastPos.mnCol - aFirstPos.mnCol ) + 1;
824cdf0e10cSrcweir const sal_Int32 nSelectedRows = std::max( (sal_Int32)0, aLastPos.mnRow - aFirstPos.mnRow ) + 1;
825cdf0e10cSrcweir return nSelectedRows * nSelectedColumns;
826cdf0e10cSrcweir }
827cdf0e10cSrcweir
828cdf0e10cSrcweir return 0;
829cdf0e10cSrcweir }
830cdf0e10cSrcweir
831cdf0e10cSrcweir //--------------------------------------------------------------------
832cdf0e10cSrcweir
getSelectedAccessibleChild(sal_Int32 nSelectedChildIndex)833cdf0e10cSrcweir Reference< XAccessible > SAL_CALL AccessibleTableShape::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw ( IndexOutOfBoundsException, RuntimeException)
834cdf0e10cSrcweir {
835cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
836cdf0e10cSrcweir
8379b8096d0SSteve Yin /*SvxTableController* pController = getTableController();
838cdf0e10cSrcweir if( pController && pController->hasSelectedCells() )
839cdf0e10cSrcweir {
840cdf0e10cSrcweir CellPos aFirstPos, aLastPos;
841cdf0e10cSrcweir pController->getSelectedCells( aFirstPos, aLastPos );
842cdf0e10cSrcweir
843cdf0e10cSrcweir const sal_Int32 nSelectedColumns = std::max( (sal_Int32)0, aLastPos.mnCol - aFirstPos.mnCol ) + 1;
844cdf0e10cSrcweir const sal_Int32 nSelectedRows = std::max( (sal_Int32)0, aLastPos.mnRow - aFirstPos.mnRow ) + 1;
845cdf0e10cSrcweir
846cdf0e10cSrcweir if( nSelectedChildIndex < (nSelectedRows * nSelectedColumns) )
847cdf0e10cSrcweir {
848cdf0e10cSrcweir while( nSelectedChildIndex >= nSelectedColumns )
849cdf0e10cSrcweir {
850cdf0e10cSrcweir aFirstPos.mnRow++;
851cdf0e10cSrcweir nSelectedChildIndex -= nSelectedColumns;
852cdf0e10cSrcweir }
853cdf0e10cSrcweir return getAccessibleCellAt( nSelectedColumns, aFirstPos.mnRow );
854cdf0e10cSrcweir }
855cdf0e10cSrcweir }
856cdf0e10cSrcweir
857cdf0e10cSrcweir throw IndexOutOfBoundsException();
8589b8096d0SSteve Yin */
8599b8096d0SSteve Yin if( nSelectedChildIndex < 0 )
8609b8096d0SSteve Yin throw IndexOutOfBoundsException();
8619b8096d0SSteve Yin
8629b8096d0SSteve Yin sal_Int32 nChildIndex = GetIndexOfSelectedChild( nSelectedChildIndex );
8639b8096d0SSteve Yin
8649b8096d0SSteve Yin if( nChildIndex < 0 )
8659b8096d0SSteve Yin throw IndexOutOfBoundsException();
8669b8096d0SSteve Yin
8679b8096d0SSteve Yin if ( nChildIndex >= getAccessibleChildCount() )
8689b8096d0SSteve Yin {
8699b8096d0SSteve Yin throw IndexOutOfBoundsException();
8709b8096d0SSteve Yin }
8719b8096d0SSteve Yin
8729b8096d0SSteve Yin return getAccessibleChild( nChildIndex );
873cdf0e10cSrcweir }
874cdf0e10cSrcweir
875cdf0e10cSrcweir //--------------------------------------------------------------------
876cdf0e10cSrcweir
deselectAccessibleChild(sal_Int32 nChildIndex)877cdf0e10cSrcweir void SAL_CALL AccessibleTableShape::deselectAccessibleChild( sal_Int32 nChildIndex ) throw ( IndexOutOfBoundsException, RuntimeException )
878cdf0e10cSrcweir {
879cdf0e10cSrcweir ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
880cdf0e10cSrcweir CellPos aPos;
881cdf0e10cSrcweir mxImpl->getColumnAndRow( nChildIndex, aPos.mnCol, aPos.mnRow );
882cdf0e10cSrcweir
883cdf0e10cSrcweir // todo, select table shape?!?
884cdf0e10cSrcweir SvxTableController* pController = getTableController();
885cdf0e10cSrcweir if( pController && pController->hasSelectedCells() )
886cdf0e10cSrcweir {
887cdf0e10cSrcweir CellPos aFirstPos, aLastPos;
888cdf0e10cSrcweir pController->getSelectedCells( aFirstPos, aLastPos );
889cdf0e10cSrcweir
890cdf0e10cSrcweir // create a selection where aPos is not part of anymore
891cdf0e10cSrcweir aFirstPos.mnRow = std::min( aFirstPos.mnRow, aPos.mnRow+1 );
892cdf0e10cSrcweir aFirstPos.mnCol = std::min( aFirstPos.mnCol, aPos.mnCol+1 );
893cdf0e10cSrcweir aLastPos.mnRow = std::max( aLastPos.mnRow, aPos.mnRow-1 );
894cdf0e10cSrcweir aLastPos.mnCol = std::max( aLastPos.mnCol, aPos.mnCol-1 );
895cdf0e10cSrcweir
896cdf0e10cSrcweir // new selection may be invalid (child to deselect is not at a border of the selection but in between)
897cdf0e10cSrcweir if( (aFirstPos.mnRow > aLastPos.mnRow) || (aFirstPos.mnCol > aLastPos.mnCol) )
898cdf0e10cSrcweir pController->clearSelection(); // if selection is invalid, clear all
899cdf0e10cSrcweir else
900cdf0e10cSrcweir pController->setSelectedCells( aFirstPos, aLastPos );
901cdf0e10cSrcweir }
902cdf0e10cSrcweir }
903cdf0e10cSrcweir //--------------------------------------------------------------------
904cdf0e10cSrcweir
9059b8096d0SSteve Yin //===== XAccessibleTableSelection ============================================
selectRow(sal_Int32 row)9069b8096d0SSteve Yin sal_Bool SAL_CALL AccessibleTableShape::selectRow( sal_Int32 row )
9079b8096d0SSteve Yin throw (IndexOutOfBoundsException, RuntimeException)
9089b8096d0SSteve Yin {
9099b8096d0SSteve Yin ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
9109b8096d0SSteve Yin SvxTableController* pController = getTableController();
9119b8096d0SSteve Yin if( !pController )
9129b8096d0SSteve Yin return sal_False;
9139b8096d0SSteve Yin return pController->selectRow( row );
9149b8096d0SSteve Yin }
selectColumn(sal_Int32 column)9159b8096d0SSteve Yin sal_Bool SAL_CALL AccessibleTableShape::selectColumn( sal_Int32 column )
9169b8096d0SSteve Yin throw (IndexOutOfBoundsException, RuntimeException)
9179b8096d0SSteve Yin {
9189b8096d0SSteve Yin ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
9199b8096d0SSteve Yin SvxTableController* pController = getTableController();
9209b8096d0SSteve Yin if( !pController )
9219b8096d0SSteve Yin return sal_False;
9229b8096d0SSteve Yin return pController->selectColumn( column );
9239b8096d0SSteve Yin }
unselectRow(sal_Int32 row)9249b8096d0SSteve Yin sal_Bool SAL_CALL AccessibleTableShape::unselectRow( sal_Int32 row )
9259b8096d0SSteve Yin throw (IndexOutOfBoundsException, RuntimeException)
9269b8096d0SSteve Yin {
9279b8096d0SSteve Yin ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
9289b8096d0SSteve Yin SvxTableController* pController = getTableController();
9299b8096d0SSteve Yin if( !pController )
9309b8096d0SSteve Yin return sal_False;
9319b8096d0SSteve Yin return pController->deselectRow( row );
9329b8096d0SSteve Yin }
unselectColumn(sal_Int32 column)9339b8096d0SSteve Yin sal_Bool SAL_CALL AccessibleTableShape::unselectColumn( sal_Int32 column )
9349b8096d0SSteve Yin throw (IndexOutOfBoundsException, RuntimeException)
9359b8096d0SSteve Yin {
9369b8096d0SSteve Yin ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
9379b8096d0SSteve Yin SvxTableController* pController = getTableController();
9389b8096d0SSteve Yin if( !pController )
9399b8096d0SSteve Yin return sal_False;
9409b8096d0SSteve Yin return pController->deselectColumn( column );
9419b8096d0SSteve Yin }
GetIndexOfSelectedChild(sal_Int32 nSelectedChildIndex) const9429b8096d0SSteve Yin sal_Int32 AccessibleTableShape::GetIndexOfSelectedChild(
9439b8096d0SSteve Yin sal_Int32 nSelectedChildIndex ) const
9449b8096d0SSteve Yin {
9459b8096d0SSteve Yin sal_Int32 nChildren = const_cast<AccessibleTableShape*>(this)->getAccessibleChildCount();
9469b8096d0SSteve Yin
9479b8096d0SSteve Yin if( nSelectedChildIndex >= nChildren )
9489b8096d0SSteve Yin return -1L;
9499b8096d0SSteve Yin
9509b8096d0SSteve Yin sal_Int32 n = 0;
9519b8096d0SSteve Yin while( n < nChildren )
9529b8096d0SSteve Yin {
9539b8096d0SSteve Yin if( const_cast<AccessibleTableShape*>(this)->isAccessibleChildSelected( n ) )
9549b8096d0SSteve Yin {
9559b8096d0SSteve Yin if( 0 == nSelectedChildIndex )
9569b8096d0SSteve Yin break;
9579b8096d0SSteve Yin else
9589b8096d0SSteve Yin --nSelectedChildIndex;
9599b8096d0SSteve Yin }
9609b8096d0SSteve Yin ++n;
9619b8096d0SSteve Yin }
9629b8096d0SSteve Yin
9639b8096d0SSteve Yin return n < nChildren ? n : -1L;
9649b8096d0SSteve Yin }
getColumnAndRow(sal_Int32 nChildIndex,sal_Int32 & rnColumn,sal_Int32 & rnRow)9659b8096d0SSteve Yin void AccessibleTableShape::getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (IndexOutOfBoundsException )
9669b8096d0SSteve Yin {
9679b8096d0SSteve Yin mxImpl->getColumnAndRow(nChildIndex, rnColumn, rnRow);
9689b8096d0SSteve Yin }
9699b8096d0SSteve Yin //--------------------------------------------------------------------
9709b8096d0SSteve Yin // XSelectionChangeListener
9719b8096d0SSteve Yin void SAL_CALL
disposing(const EventObject & aEvent)9729b8096d0SSteve Yin AccessibleTableShape::disposing (const EventObject& aEvent)
9739b8096d0SSteve Yin throw (RuntimeException)
9749b8096d0SSteve Yin {
9759b8096d0SSteve Yin AccessibleShape::disposing(aEvent);
9769b8096d0SSteve Yin }
selectionChanged(const EventObject & rEvent)9779b8096d0SSteve Yin void SAL_CALL AccessibleTableShape::selectionChanged (const EventObject& rEvent)
9789b8096d0SSteve Yin throw (RuntimeException)
9799b8096d0SSteve Yin {
9809b8096d0SSteve Yin //::sdr::table::CellRef xCellRef = static_cast< ::sdr::table::CellRef > (rEvent.Source);
9819b8096d0SSteve Yin Reference< XCell > xCell(rEvent.Source, UNO_QUERY);
9829b8096d0SSteve Yin if (xCell.is())
9839b8096d0SSteve Yin {
9849b8096d0SSteve Yin Reference< AccessibleCell > xAccCell = mxImpl->getAccessibleCell( xCell );
9859b8096d0SSteve Yin if (xAccCell.is())
9869b8096d0SSteve Yin {
9879b8096d0SSteve Yin sal_Int32 nIndex = xAccCell->getAccessibleIndexInParent(),
9889b8096d0SSteve Yin nCount = getSelectedAccessibleChildCount();
9899b8096d0SSteve Yin sal_Bool bSelected = isAccessibleChildSelected(nIndex);
9909b8096d0SSteve Yin if (mnPreviousSelectionCount == 0 && nCount > 0 && bSelected)
9919b8096d0SSteve Yin {
9929b8096d0SSteve Yin xAccCell->SetState(AccessibleStateType::SELECTED);
9939b8096d0SSteve Yin xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED, Any(), Any());
9949b8096d0SSteve Yin }
9959b8096d0SSteve Yin else if (bSelected)
9969b8096d0SSteve Yin {
9979b8096d0SSteve Yin xAccCell->SetState(AccessibleStateType::SELECTED);
9989b8096d0SSteve Yin xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD, Any(), Any());
9999b8096d0SSteve Yin }
10009b8096d0SSteve Yin else
10019b8096d0SSteve Yin {
10029b8096d0SSteve Yin xAccCell->ResetState(AccessibleStateType::SELECTED);
10039b8096d0SSteve Yin xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, Any(), Any());
10049b8096d0SSteve Yin }
10059b8096d0SSteve Yin mnPreviousSelectionCount = nCount;
10069b8096d0SSteve Yin }
10079b8096d0SSteve Yin }
10089b8096d0SSteve Yin }
10099b8096d0SSteve Yin // Get the currently active cell which is text editing
GetActiveAccessibleCell()10109b8096d0SSteve Yin AccessibleCell* AccessibleTableShape::GetActiveAccessibleCell()
10119b8096d0SSteve Yin {
10129b8096d0SSteve Yin sal_Bool bCellEditing = sal_False;
10139b8096d0SSteve Yin Reference< AccessibleCell > xAccCell;
10149b8096d0SSteve Yin AccessibleCell* pAccCell = NULL;
10159b8096d0SSteve Yin SvxTableController* pController = getTableController();
10169b8096d0SSteve Yin if (pController)
10179b8096d0SSteve Yin {
10189b8096d0SSteve Yin ::sdr::table::SdrTableObj* pTableObj = pController->GetTableObj();
10199b8096d0SSteve Yin if ( pTableObj )
10209b8096d0SSteve Yin {
10219b8096d0SSteve Yin ::sdr::table::CellRef xCellRef (pTableObj->getActiveCell());
10229b8096d0SSteve Yin if ( xCellRef.is() )
10239b8096d0SSteve Yin {
10249b8096d0SSteve Yin bCellEditing = xCellRef->IsTextEditActive();
10259b8096d0SSteve Yin if (bCellEditing)
10269b8096d0SSteve Yin {
10279b8096d0SSteve Yin //Reference< XCell > xCell(xCellRef.get(), UNO_QUERY);
10289b8096d0SSteve Yin xAccCell = mxImpl->getAccessibleCell(Reference< XCell >( xCellRef.get() ));
10299b8096d0SSteve Yin if (xAccCell.is())
10309b8096d0SSteve Yin pAccCell = xAccCell.get();
10319b8096d0SSteve Yin }
10329b8096d0SSteve Yin }
10339b8096d0SSteve Yin }
10349b8096d0SSteve Yin }
10359b8096d0SSteve Yin return pAccCell;
10369b8096d0SSteve Yin }
10379b8096d0SSteve Yin //--------------------------------------------------------------------
10389b8096d0SSteve Yin //If current active cell is in editing, the focus state should be set to internal text
SetState(sal_Int16 aState)10399b8096d0SSteve Yin sal_Bool AccessibleTableShape::SetState (sal_Int16 aState)
10409b8096d0SSteve Yin {
10419b8096d0SSteve Yin AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell();
10429b8096d0SSteve Yin sal_Bool bStateHasChanged = sal_False;
10439b8096d0SSteve Yin if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != NULL)
10449b8096d0SSteve Yin {
10459b8096d0SSteve Yin return pActiveAccessibleCell->SetState(aState);
10469b8096d0SSteve Yin }
10479b8096d0SSteve Yin else
10489b8096d0SSteve Yin bStateHasChanged = AccessibleShape::SetState (aState);
10499b8096d0SSteve Yin return bStateHasChanged;
10509b8096d0SSteve Yin }
10519b8096d0SSteve Yin //--------------------------------------------------------------------
10529b8096d0SSteve Yin //If current active cell is in editing, the focus state should be reset to internal text
ResetState(sal_Int16 aState)10539b8096d0SSteve Yin sal_Bool AccessibleTableShape::ResetState (sal_Int16 aState)
10549b8096d0SSteve Yin {
10559b8096d0SSteve Yin AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell();
10569b8096d0SSteve Yin sal_Bool bStateHasChanged = sal_False;
10579b8096d0SSteve Yin if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != NULL)
10589b8096d0SSteve Yin {
10599b8096d0SSteve Yin return pActiveAccessibleCell->ResetState(aState);
10609b8096d0SSteve Yin }
10619b8096d0SSteve Yin else
10629b8096d0SSteve Yin bStateHasChanged = AccessibleShape::ResetState (aState);
10639b8096d0SSteve Yin return bStateHasChanged;
10649b8096d0SSteve Yin }
10659b8096d0SSteve Yin //--------------------------------------------------------------------
SetStateDirectly(sal_Int16 aState)10669b8096d0SSteve Yin sal_Bool AccessibleTableShape::SetStateDirectly (sal_Int16 aState)
10679b8096d0SSteve Yin {
10689b8096d0SSteve Yin return AccessibleContextBase::SetState (aState);
10699b8096d0SSteve Yin }
10709b8096d0SSteve Yin //--------------------------------------------------------------------
ResetStateDirectly(sal_Int16 aState)10719b8096d0SSteve Yin sal_Bool AccessibleTableShape::ResetStateDirectly (sal_Int16 aState)
10729b8096d0SSteve Yin {
10739b8096d0SSteve Yin return AccessibleContextBase::ResetState (aState);
10749b8096d0SSteve Yin }
checkCellPosition(sal_Int32 nCol,sal_Int32 nRow)1075cdf0e10cSrcweir void AccessibleTableShape::checkCellPosition( sal_Int32 nCol, sal_Int32 nRow ) throw ( IndexOutOfBoundsException )
1076cdf0e10cSrcweir {
1077cdf0e10cSrcweir if( (nCol >= 0) && (nRow >= 0) && mxImpl->mxTable.is() && (nCol < mxImpl->mxTable->getColumnCount()) && (nRow < mxImpl->mxTable->getRowCount()) )
1078cdf0e10cSrcweir return;
1079cdf0e10cSrcweir
1080cdf0e10cSrcweir throw IndexOutOfBoundsException();
1081cdf0e10cSrcweir }
1082cdf0e10cSrcweir
AccessibleTableHeaderShape(AccessibleTableShape * pTable,sal_Bool bRow)10839b8096d0SSteve Yin AccessibleTableHeaderShape::AccessibleTableHeaderShape( AccessibleTableShape* pTable, sal_Bool bRow )
10849b8096d0SSteve Yin {
10859b8096d0SSteve Yin mpTable = pTable;
10869b8096d0SSteve Yin mbRow = bRow;
10879b8096d0SSteve Yin }
10889b8096d0SSteve Yin
~AccessibleTableHeaderShape(void)10899b8096d0SSteve Yin AccessibleTableHeaderShape::~AccessibleTableHeaderShape (void)
10909b8096d0SSteve Yin {
10919b8096d0SSteve Yin mpTable = NULL;
10929b8096d0SSteve Yin }
10939b8096d0SSteve Yin
10949b8096d0SSteve Yin // XAccessible
getAccessibleContext(void)10959b8096d0SSteve Yin Reference< XAccessibleContext > SAL_CALL AccessibleTableHeaderShape::getAccessibleContext(void) throw (RuntimeException)
10969b8096d0SSteve Yin {
10979b8096d0SSteve Yin return this;
10989b8096d0SSteve Yin }
10999b8096d0SSteve Yin
11009b8096d0SSteve Yin // XAccessibleContext
getAccessibleChildCount()11019b8096d0SSteve Yin sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleChildCount( ) throw(RuntimeException)
11029b8096d0SSteve Yin {
11039b8096d0SSteve Yin return getAccessibleRowCount() * getAccessibleColumnCount();
11049b8096d0SSteve Yin }
11059b8096d0SSteve Yin
getAccessibleChild(sal_Int32 i)11069b8096d0SSteve Yin Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleChild( sal_Int32 i ) throw(IndexOutOfBoundsException, RuntimeException)
11079b8096d0SSteve Yin {
11089b8096d0SSteve Yin return mpTable->getAccessibleChild( i );
11099b8096d0SSteve Yin }
11109b8096d0SSteve Yin
getAccessibleParent(void)11119b8096d0SSteve Yin Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleParent (void) throw (RuntimeException)
11129b8096d0SSteve Yin {
11139b8096d0SSteve Yin Reference< XAccessible > XParent;
11149b8096d0SSteve Yin return XParent;
11159b8096d0SSteve Yin }
11169b8096d0SSteve Yin
getAccessibleIndexInParent(void)11179b8096d0SSteve Yin sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleIndexInParent (void) throw (RuntimeException)
11189b8096d0SSteve Yin {
11199b8096d0SSteve Yin return -1;
11209b8096d0SSteve Yin }
11219b8096d0SSteve Yin
getAccessibleRole(void)11229b8096d0SSteve Yin sal_Int16 SAL_CALL AccessibleTableHeaderShape::getAccessibleRole (void) throw (RuntimeException)
11239b8096d0SSteve Yin {
11249b8096d0SSteve Yin return mpTable->getAccessibleRole();
11259b8096d0SSteve Yin }
11269b8096d0SSteve Yin
getAccessibleDescription(void)11279b8096d0SSteve Yin OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleDescription (void) throw (RuntimeException)
11289b8096d0SSteve Yin {
11299b8096d0SSteve Yin return mpTable->getAccessibleDescription();
11309b8096d0SSteve Yin }
11319b8096d0SSteve Yin
getAccessibleName(void)11329b8096d0SSteve Yin OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleName (void) throw (RuntimeException)
11339b8096d0SSteve Yin {
11349b8096d0SSteve Yin return mpTable->getAccessibleName();
11359b8096d0SSteve Yin }
11369b8096d0SSteve Yin
getAccessibleStateSet(void)11379b8096d0SSteve Yin Reference< XAccessibleStateSet > SAL_CALL AccessibleTableHeaderShape::getAccessibleStateSet (void) throw (RuntimeException)
11389b8096d0SSteve Yin {
11399b8096d0SSteve Yin return mpTable->getAccessibleStateSet();
11409b8096d0SSteve Yin }
11419b8096d0SSteve Yin
getAccessibleRelationSet(void)11429b8096d0SSteve Yin Reference< XAccessibleRelationSet > SAL_CALL AccessibleTableHeaderShape::getAccessibleRelationSet (void) throw (RuntimeException)
11439b8096d0SSteve Yin {
11449b8096d0SSteve Yin return mpTable->getAccessibleRelationSet();
11459b8096d0SSteve Yin }
11469b8096d0SSteve Yin
getLocale(void)11479b8096d0SSteve Yin Locale SAL_CALL AccessibleTableHeaderShape::getLocale (void) throw (IllegalAccessibleComponentStateException, RuntimeException)
11489b8096d0SSteve Yin {
11499b8096d0SSteve Yin return mpTable->getLocale();
11509b8096d0SSteve Yin }
11519b8096d0SSteve Yin
11529b8096d0SSteve Yin //XAccessibleComponent
containsPoint(const::com::sun::star::awt::Point & aPoint)11539b8096d0SSteve Yin sal_Bool SAL_CALL AccessibleTableHeaderShape::containsPoint ( const ::com::sun::star::awt::Point& aPoint ) throw (RuntimeException)
11549b8096d0SSteve Yin {
11559b8096d0SSteve Yin return mpTable->containsPoint( aPoint );
11569b8096d0SSteve Yin }
11579b8096d0SSteve Yin
getAccessibleAtPoint(const::com::sun::star::awt::Point & aPoint)11589b8096d0SSteve Yin Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleAtPoint ( const ::com::sun::star::awt::Point& aPoint) throw (RuntimeException)
11599b8096d0SSteve Yin {
11609b8096d0SSteve Yin return mpTable->getAccessibleAtPoint( aPoint );
11619b8096d0SSteve Yin }
11629b8096d0SSteve Yin
getBounds(void)11639b8096d0SSteve Yin ::com::sun::star::awt::Rectangle SAL_CALL AccessibleTableHeaderShape::getBounds (void) throw (RuntimeException)
11649b8096d0SSteve Yin {
11659b8096d0SSteve Yin return mpTable->getBounds();
11669b8096d0SSteve Yin }
11679b8096d0SSteve Yin
getLocation(void)11689b8096d0SSteve Yin ::com::sun::star::awt::Point SAL_CALL AccessibleTableHeaderShape::getLocation (void) throw (RuntimeException)
11699b8096d0SSteve Yin {
11709b8096d0SSteve Yin return mpTable->getLocation();
11719b8096d0SSteve Yin }
11729b8096d0SSteve Yin
getLocationOnScreen(void)11739b8096d0SSteve Yin ::com::sun::star::awt::Point SAL_CALL AccessibleTableHeaderShape::getLocationOnScreen (void) throw (RuntimeException)
11749b8096d0SSteve Yin {
11759b8096d0SSteve Yin return mpTable->getLocationOnScreen();
11769b8096d0SSteve Yin }
11779b8096d0SSteve Yin
getSize(void)11789b8096d0SSteve Yin ::com::sun::star::awt::Size SAL_CALL AccessibleTableHeaderShape::getSize (void) throw (RuntimeException)
11799b8096d0SSteve Yin {
11809b8096d0SSteve Yin return mpTable->getSize();
11819b8096d0SSteve Yin }
11829b8096d0SSteve Yin
getForeground(void)11839b8096d0SSteve Yin sal_Int32 SAL_CALL AccessibleTableHeaderShape::getForeground (void) throw (RuntimeException)
11849b8096d0SSteve Yin {
11859b8096d0SSteve Yin return mpTable->getForeground();
11869b8096d0SSteve Yin }
11879b8096d0SSteve Yin
getBackground(void)11889b8096d0SSteve Yin sal_Int32 SAL_CALL AccessibleTableHeaderShape::getBackground (void) throw (RuntimeException)
11899b8096d0SSteve Yin {
11909b8096d0SSteve Yin return mpTable->getBackground();
11919b8096d0SSteve Yin }
11929b8096d0SSteve Yin
grabFocus(void)11939b8096d0SSteve Yin void SAL_CALL AccessibleTableHeaderShape::grabFocus (void) throw (RuntimeException)
11949b8096d0SSteve Yin {
11959b8096d0SSteve Yin mpTable->grabFocus();
11969b8096d0SSteve Yin }
11979b8096d0SSteve Yin //===== XAccessibleTable ============================================
11989b8096d0SSteve Yin
getAccessibleRowCount()11999b8096d0SSteve Yin sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleRowCount() throw (RuntimeException)
12009b8096d0SSteve Yin {
12019b8096d0SSteve Yin return mbRow ? 1 : mpTable->getAccessibleRowCount();
12029b8096d0SSteve Yin }
12039b8096d0SSteve Yin
getAccessibleColumnCount()12049b8096d0SSteve Yin sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnCount() throw (RuntimeException)
12059b8096d0SSteve Yin {
12069b8096d0SSteve Yin return !mbRow ? 1 : mpTable->getAccessibleColumnCount();
12079b8096d0SSteve Yin }
12089b8096d0SSteve Yin
getAccessibleRowDescription(sal_Int32 nRow)12099b8096d0SSteve Yin OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleRowDescription( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
12109b8096d0SSteve Yin {
12119b8096d0SSteve Yin return mpTable->getAccessibleRowDescription( nRow );
12129b8096d0SSteve Yin }
12139b8096d0SSteve Yin
getAccessibleColumnDescription(sal_Int32 nColumn)12149b8096d0SSteve Yin OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnDescription( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
12159b8096d0SSteve Yin {
12169b8096d0SSteve Yin return mpTable->getAccessibleColumnDescription( nColumn );
12179b8096d0SSteve Yin }
12189b8096d0SSteve Yin
getAccessibleRowExtentAt(sal_Int32 nRow,sal_Int32 nColumn)12199b8096d0SSteve Yin sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
12209b8096d0SSteve Yin {
12219b8096d0SSteve Yin return mpTable->getAccessibleRowExtentAt( nRow, nColumn );
12229b8096d0SSteve Yin }
12239b8096d0SSteve Yin
getAccessibleColumnExtentAt(sal_Int32 nRow,sal_Int32 nColumn)12249b8096d0SSteve Yin sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
12259b8096d0SSteve Yin {
12269b8096d0SSteve Yin return mpTable->getAccessibleColumnExtentAt( nRow, nColumn );
12279b8096d0SSteve Yin }
12289b8096d0SSteve Yin
getAccessibleRowHeaders()12299b8096d0SSteve Yin Reference< XAccessibleTable > SAL_CALL AccessibleTableHeaderShape::getAccessibleRowHeaders( ) throw (RuntimeException)
12309b8096d0SSteve Yin {
12319b8096d0SSteve Yin Reference< XAccessibleTable > xRet;
12329b8096d0SSteve Yin return xRet;
12339b8096d0SSteve Yin }
12349b8096d0SSteve Yin
getAccessibleColumnHeaders()12359b8096d0SSteve Yin Reference< XAccessibleTable > SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnHeaders( ) throw (RuntimeException)
12369b8096d0SSteve Yin {
12379b8096d0SSteve Yin Reference< XAccessibleTable > xRet;
12389b8096d0SSteve Yin return xRet;
12399b8096d0SSteve Yin }
12409b8096d0SSteve Yin
getSelectedAccessibleRows()12419b8096d0SSteve Yin Sequence< sal_Int32 > SAL_CALL AccessibleTableHeaderShape::getSelectedAccessibleRows( ) throw (RuntimeException)
12429b8096d0SSteve Yin {
12439b8096d0SSteve Yin sal_Int32 nRow = getAccessibleRowCount();
12449b8096d0SSteve Yin ::std::vector< sal_Bool > aSelected( nRow, sal_True );
12459b8096d0SSteve Yin sal_Int32 nCount = nRow;
12469b8096d0SSteve Yin for( sal_Int32 i = 0; i < nRow; i++ )
12479b8096d0SSteve Yin {
12489b8096d0SSteve Yin try
12499b8096d0SSteve Yin {
12509b8096d0SSteve Yin aSelected[i] = isAccessibleRowSelected( i );
12519b8096d0SSteve Yin }
12529b8096d0SSteve Yin catch( ... )
12539b8096d0SSteve Yin {
12549b8096d0SSteve Yin return Sequence< sal_Int32 >();
12559b8096d0SSteve Yin }
12569b8096d0SSteve Yin
12579b8096d0SSteve Yin if( !aSelected[i] )
12589b8096d0SSteve Yin nCount--;
12599b8096d0SSteve Yin }
12609b8096d0SSteve Yin Sequence < sal_Int32 > aRet( nCount );
12619b8096d0SSteve Yin sal_Int32 *pRet = aRet.getArray();
12629b8096d0SSteve Yin sal_Int32 nPos = 0;
12639b8096d0SSteve Yin size_t nSize = aSelected.size();
12649b8096d0SSteve Yin for( size_t i=0; i < nSize && nPos < nCount; i++ )
12659b8096d0SSteve Yin {
12669b8096d0SSteve Yin if( aSelected[i] )
12679b8096d0SSteve Yin {
12689b8096d0SSteve Yin *pRet++ = i;
12699b8096d0SSteve Yin nPos++;
12709b8096d0SSteve Yin }
12719b8096d0SSteve Yin }
12729b8096d0SSteve Yin
12739b8096d0SSteve Yin return aRet;
12749b8096d0SSteve Yin }
12759b8096d0SSteve Yin
getSelectedAccessibleColumns()12769b8096d0SSteve Yin Sequence< sal_Int32 > SAL_CALL AccessibleTableHeaderShape::getSelectedAccessibleColumns( ) throw (RuntimeException)
12779b8096d0SSteve Yin {
12789b8096d0SSteve Yin sal_Int32 nColumn = getAccessibleColumnCount();
12799b8096d0SSteve Yin ::std::vector< sal_Bool > aSelected( nColumn, sal_True );
12809b8096d0SSteve Yin sal_Int32 nCount = nColumn;
12819b8096d0SSteve Yin for( sal_Int32 i = 0; i < nColumn; i++ )
12829b8096d0SSteve Yin {
12839b8096d0SSteve Yin try
12849b8096d0SSteve Yin {
12859b8096d0SSteve Yin aSelected[i] = isAccessibleColumnSelected( i );
12869b8096d0SSteve Yin }
12879b8096d0SSteve Yin catch( ... )
12889b8096d0SSteve Yin {
12899b8096d0SSteve Yin return Sequence< sal_Int32 >();
12909b8096d0SSteve Yin }
12919b8096d0SSteve Yin
12929b8096d0SSteve Yin if( !aSelected[i] )
12939b8096d0SSteve Yin nCount--;
12949b8096d0SSteve Yin }
12959b8096d0SSteve Yin Sequence < sal_Int32 > aRet( nCount );
12969b8096d0SSteve Yin sal_Int32 *pRet = aRet.getArray();
12979b8096d0SSteve Yin sal_Int32 nPos = 0;
12989b8096d0SSteve Yin size_t nSize = aSelected.size();
12999b8096d0SSteve Yin for( size_t i=0; i < nSize && nPos < nCount; i++ )
13009b8096d0SSteve Yin {
13019b8096d0SSteve Yin if( aSelected[i] )
13029b8096d0SSteve Yin {
13039b8096d0SSteve Yin *pRet++ = i;
13049b8096d0SSteve Yin nPos++;
13059b8096d0SSteve Yin }
13069b8096d0SSteve Yin }
13079b8096d0SSteve Yin
13089b8096d0SSteve Yin return aRet;
13099b8096d0SSteve Yin }
13109b8096d0SSteve Yin
isAccessibleRowSelected(sal_Int32 nRow)13119b8096d0SSteve Yin sal_Bool SAL_CALL AccessibleTableHeaderShape::isAccessibleRowSelected( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
13129b8096d0SSteve Yin {
13139b8096d0SSteve Yin return mpTable->isAccessibleRowSelected( nRow );
13149b8096d0SSteve Yin }
13159b8096d0SSteve Yin
isAccessibleColumnSelected(sal_Int32 nColumn)13169b8096d0SSteve Yin sal_Bool SAL_CALL AccessibleTableHeaderShape::isAccessibleColumnSelected( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
13179b8096d0SSteve Yin {
13189b8096d0SSteve Yin return mpTable->isAccessibleColumnSelected( nColumn );
13199b8096d0SSteve Yin }
13209b8096d0SSteve Yin
getAccessibleCellAt(sal_Int32 nRow,sal_Int32 nColumn)13219b8096d0SSteve Yin Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
13229b8096d0SSteve Yin {
13239b8096d0SSteve Yin return mpTable->getAccessibleCellAt( nRow, nColumn );
13249b8096d0SSteve Yin }
13259b8096d0SSteve Yin
getAccessibleCaption()13269b8096d0SSteve Yin Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleCaption( ) throw (RuntimeException)
13279b8096d0SSteve Yin {
13289b8096d0SSteve Yin return mpTable->getAccessibleCaption();
13299b8096d0SSteve Yin }
13309b8096d0SSteve Yin
getAccessibleSummary()13319b8096d0SSteve Yin Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleSummary( ) throw (RuntimeException)
13329b8096d0SSteve Yin {
13339b8096d0SSteve Yin return mpTable->getAccessibleSummary();
13349b8096d0SSteve Yin }
13359b8096d0SSteve Yin
isAccessibleSelected(sal_Int32 nRow,sal_Int32 nColumn)13369b8096d0SSteve Yin sal_Bool SAL_CALL AccessibleTableHeaderShape::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
13379b8096d0SSteve Yin {
13389b8096d0SSteve Yin return mpTable->isAccessibleSelected( nRow, nColumn );
13399b8096d0SSteve Yin }
13409b8096d0SSteve Yin
getAccessibleIndex(sal_Int32 nRow,sal_Int32 nColumn)13419b8096d0SSteve Yin sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
13429b8096d0SSteve Yin {
13439b8096d0SSteve Yin return mpTable->getAccessibleIndex( nRow, nColumn );
13449b8096d0SSteve Yin }
13459b8096d0SSteve Yin
getAccessibleRow(sal_Int32 nChildIndex)13469b8096d0SSteve Yin sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleRow( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
13479b8096d0SSteve Yin {
13489b8096d0SSteve Yin return mpTable->getAccessibleRow( nChildIndex );
13499b8096d0SSteve Yin }
13509b8096d0SSteve Yin
getAccessibleColumn(sal_Int32 nChildIndex)13519b8096d0SSteve Yin sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleColumn( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
13529b8096d0SSteve Yin {
13539b8096d0SSteve Yin return mpTable->getAccessibleColumn( nChildIndex );
13549b8096d0SSteve Yin }
13559b8096d0SSteve Yin
13569b8096d0SSteve Yin //===== XAccessibleTableSelection ============================================
selectRow(sal_Int32 row)13579b8096d0SSteve Yin sal_Bool SAL_CALL AccessibleTableHeaderShape::selectRow( sal_Int32 row )
13589b8096d0SSteve Yin throw (IndexOutOfBoundsException, RuntimeException)
13599b8096d0SSteve Yin {
13609b8096d0SSteve Yin if( mbRow )
13619b8096d0SSteve Yin return mpTable->selectRow( row );
13629b8096d0SSteve Yin else
13639b8096d0SSteve Yin {
13649b8096d0SSteve Yin mpTable->clearAccessibleSelection();
13659b8096d0SSteve Yin sal_Int32 nIndex = mpTable->getAccessibleIndex( row, 0 );
13669b8096d0SSteve Yin mpTable->selectAccessibleChild( nIndex );
13679b8096d0SSteve Yin return sal_True;
13689b8096d0SSteve Yin }
13699b8096d0SSteve Yin }
13709b8096d0SSteve Yin
selectColumn(sal_Int32 column)13719b8096d0SSteve Yin sal_Bool SAL_CALL AccessibleTableHeaderShape::selectColumn( sal_Int32 column )
13729b8096d0SSteve Yin throw (IndexOutOfBoundsException, RuntimeException)
13739b8096d0SSteve Yin {
13749b8096d0SSteve Yin if( !mbRow )
13759b8096d0SSteve Yin return mpTable->selectColumn( column );
13769b8096d0SSteve Yin else
13779b8096d0SSteve Yin {
13789b8096d0SSteve Yin mpTable->clearAccessibleSelection();
13799b8096d0SSteve Yin sal_Int32 nIndex = mpTable->getAccessibleIndex( 0, column );
13809b8096d0SSteve Yin mpTable->selectAccessibleChild( nIndex );
13819b8096d0SSteve Yin return sal_True;
13829b8096d0SSteve Yin }
13839b8096d0SSteve Yin }
13849b8096d0SSteve Yin
unselectRow(sal_Int32 row)13859b8096d0SSteve Yin sal_Bool SAL_CALL AccessibleTableHeaderShape::unselectRow( sal_Int32 row )
13869b8096d0SSteve Yin throw (IndexOutOfBoundsException, RuntimeException)
13879b8096d0SSteve Yin {
13889b8096d0SSteve Yin if( mbRow )
13899b8096d0SSteve Yin return mpTable->unselectRow( row );
13909b8096d0SSteve Yin else
13919b8096d0SSteve Yin {
13929b8096d0SSteve Yin sal_Int32 nIndex = mpTable->getAccessibleIndex( row, 0 );
13939b8096d0SSteve Yin mpTable->deselectAccessibleChild( nIndex );
13949b8096d0SSteve Yin return sal_True;
13959b8096d0SSteve Yin }
13969b8096d0SSteve Yin }
13979b8096d0SSteve Yin
unselectColumn(sal_Int32 column)13989b8096d0SSteve Yin sal_Bool SAL_CALL AccessibleTableHeaderShape::unselectColumn( sal_Int32 column )
13999b8096d0SSteve Yin throw (IndexOutOfBoundsException, RuntimeException)
14009b8096d0SSteve Yin {
14019b8096d0SSteve Yin if( !mbRow )
14029b8096d0SSteve Yin return mpTable->unselectColumn( column );
14039b8096d0SSteve Yin else
14049b8096d0SSteve Yin {
14059b8096d0SSteve Yin sal_Int32 nIndex = mpTable->getAccessibleIndex( 0, column );
14069b8096d0SSteve Yin mpTable->deselectAccessibleChild( nIndex );
14079b8096d0SSteve Yin return sal_True;
14089b8096d0SSteve Yin }
14099b8096d0SSteve Yin }
1410cdf0e10cSrcweir }
1411