1*b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*b3f79822SAndrew Rist * distributed with this work for additional information
6*b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*b3f79822SAndrew Rist * "License"); you may not use this file except in compliance
9*b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at
10*b3f79822SAndrew Rist *
11*b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*b3f79822SAndrew Rist *
13*b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*b3f79822SAndrew Rist * software distributed under the License is distributed on an
15*b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b3f79822SAndrew Rist * KIND, either express or implied. See the License for the
17*b3f79822SAndrew Rist * specific language governing permissions and limitations
18*b3f79822SAndrew Rist * under the License.
19*b3f79822SAndrew Rist *
20*b3f79822SAndrew Rist *************************************************************/
21*b3f79822SAndrew Rist
22*b3f79822SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "scitems.hxx"
28cdf0e10cSrcweir #include "AccessiblePreviewTable.hxx"
29cdf0e10cSrcweir #include "AccessiblePreviewCell.hxx"
30cdf0e10cSrcweir #include "AccessiblePreviewHeaderCell.hxx"
31cdf0e10cSrcweir #include "AccessibilityHints.hxx"
32cdf0e10cSrcweir #include "prevwsh.hxx"
33cdf0e10cSrcweir #include "unoguard.hxx"
34cdf0e10cSrcweir #include "miscuno.hxx"
35cdf0e10cSrcweir #include "prevloc.hxx"
36cdf0e10cSrcweir #include "attrib.hxx"
37cdf0e10cSrcweir #include "document.hxx"
38cdf0e10cSrcweir #include "scresid.hxx"
39cdf0e10cSrcweir #ifndef SC_SC_HRC
40cdf0e10cSrcweir #include "sc.hrc"
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir
43cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
44cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
45cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
46cdf0e10cSrcweir
47cdf0e10cSrcweir #include <vcl/window.hxx>
48cdf0e10cSrcweir #include <svl/smplhint.hxx>
49cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx>
50cdf0e10cSrcweir #include <comphelper/sequence.hxx>
51cdf0e10cSrcweir
52cdf0e10cSrcweir using namespace ::com::sun::star;
53cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
54cdf0e10cSrcweir
55cdf0e10cSrcweir //===== internal ============================================================
56cdf0e10cSrcweir
ScAccessiblePreviewTable(const::com::sun::star::uno::Reference<::com::sun::star::accessibility::XAccessible> & rxParent,ScPreviewShell * pViewShell,sal_Int32 nIndex)57cdf0e10cSrcweir ScAccessiblePreviewTable::ScAccessiblePreviewTable( const ::com::sun::star::uno::Reference<
58cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible>& rxParent,
59cdf0e10cSrcweir ScPreviewShell* pViewShell, sal_Int32 nIndex ) :
60cdf0e10cSrcweir ScAccessibleContextBase( rxParent, AccessibleRole::TABLE ),
61cdf0e10cSrcweir mpViewShell( pViewShell ),
62cdf0e10cSrcweir mnIndex( nIndex ),
63cdf0e10cSrcweir mpTableInfo( NULL )
64cdf0e10cSrcweir {
65cdf0e10cSrcweir if (mpViewShell)
66cdf0e10cSrcweir mpViewShell->AddAccessibilityObject(*this);
67cdf0e10cSrcweir }
68cdf0e10cSrcweir
~ScAccessiblePreviewTable()69cdf0e10cSrcweir ScAccessiblePreviewTable::~ScAccessiblePreviewTable()
70cdf0e10cSrcweir {
71cdf0e10cSrcweir if (!ScAccessibleContextBase::IsDefunc() && !rBHelper.bInDispose)
72cdf0e10cSrcweir {
73cdf0e10cSrcweir // increment refcount to prevent double call off dtor
74cdf0e10cSrcweir osl_incrementInterlockedCount( &m_refCount );
75cdf0e10cSrcweir dispose();
76cdf0e10cSrcweir }
77cdf0e10cSrcweir }
78cdf0e10cSrcweir
disposing()79cdf0e10cSrcweir void SAL_CALL ScAccessiblePreviewTable::disposing()
80cdf0e10cSrcweir {
81cdf0e10cSrcweir ScUnoGuard aGuard;
82cdf0e10cSrcweir if (mpViewShell)
83cdf0e10cSrcweir {
84cdf0e10cSrcweir mpViewShell->RemoveAccessibilityObject(*this);
85cdf0e10cSrcweir mpViewShell = NULL;
86cdf0e10cSrcweir }
87cdf0e10cSrcweir
88cdf0e10cSrcweir if (mpTableInfo)
89cdf0e10cSrcweir DELETEZ (mpTableInfo);
90cdf0e10cSrcweir
91cdf0e10cSrcweir ScAccessibleContextBase::disposing();
92cdf0e10cSrcweir }
93cdf0e10cSrcweir
94cdf0e10cSrcweir //===== SfxListener =====================================================
95cdf0e10cSrcweir
Notify(SfxBroadcaster & rBC,const SfxHint & rHint)96cdf0e10cSrcweir void ScAccessiblePreviewTable::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
97cdf0e10cSrcweir {
98cdf0e10cSrcweir if (rHint.ISA( SfxSimpleHint ))
99cdf0e10cSrcweir {
100cdf0e10cSrcweir const SfxSimpleHint& rRef = (const SfxSimpleHint&)rHint;
101cdf0e10cSrcweir sal_uLong nId = rRef.GetId();
102cdf0e10cSrcweir if ( nId == SFX_HINT_DATACHANGED )
103cdf0e10cSrcweir {
104cdf0e10cSrcweir // column / row layout may change with any document change,
105cdf0e10cSrcweir // so it must be invalidated
106cdf0e10cSrcweir DELETEZ( mpTableInfo );
107cdf0e10cSrcweir }
108cdf0e10cSrcweir else if (rRef.GetId() == SC_HINT_ACC_VISAREACHANGED)
109cdf0e10cSrcweir {
110cdf0e10cSrcweir AccessibleEventObject aEvent;
111cdf0e10cSrcweir aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
112cdf0e10cSrcweir aEvent.Source = uno::Reference< XAccessibleContext >(this);
113cdf0e10cSrcweir CommitChange(aEvent);
114cdf0e10cSrcweir }
115cdf0e10cSrcweir }
116cdf0e10cSrcweir
117cdf0e10cSrcweir ScAccessibleContextBase::Notify(rBC, rHint);
118cdf0e10cSrcweir }
119cdf0e10cSrcweir
120cdf0e10cSrcweir //===== XInterface =====================================================
121cdf0e10cSrcweir
queryInterface(uno::Type const & rType)122cdf0e10cSrcweir uno::Any SAL_CALL ScAccessiblePreviewTable::queryInterface( uno::Type const & rType )
123cdf0e10cSrcweir throw (uno::RuntimeException)
124cdf0e10cSrcweir {
125cdf0e10cSrcweir uno::Any aAny (ScAccessiblePreviewTableImpl::queryInterface(rType));
126cdf0e10cSrcweir return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType);
127cdf0e10cSrcweir }
128cdf0e10cSrcweir
acquire()129cdf0e10cSrcweir void SAL_CALL ScAccessiblePreviewTable::acquire()
130cdf0e10cSrcweir throw ()
131cdf0e10cSrcweir {
132cdf0e10cSrcweir ScAccessibleContextBase::acquire();
133cdf0e10cSrcweir }
134cdf0e10cSrcweir
release()135cdf0e10cSrcweir void SAL_CALL ScAccessiblePreviewTable::release()
136cdf0e10cSrcweir throw ()
137cdf0e10cSrcweir {
138cdf0e10cSrcweir ScAccessibleContextBase::release();
139cdf0e10cSrcweir }
140cdf0e10cSrcweir
141cdf0e10cSrcweir //===== XAccessibleTable ================================================
142cdf0e10cSrcweir
getAccessibleRowCount()143cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessiblePreviewTable::getAccessibleRowCount() throw (uno::RuntimeException)
144cdf0e10cSrcweir {
145cdf0e10cSrcweir ScUnoGuard aGuard;
146cdf0e10cSrcweir IsObjectValid();
147cdf0e10cSrcweir
148cdf0e10cSrcweir FillTableInfo();
149cdf0e10cSrcweir
150cdf0e10cSrcweir sal_Int32 nRet = 0;
151cdf0e10cSrcweir if ( mpTableInfo )
152cdf0e10cSrcweir nRet = mpTableInfo->GetRows();
153cdf0e10cSrcweir return nRet;
154cdf0e10cSrcweir }
155cdf0e10cSrcweir
getAccessibleColumnCount()156cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessiblePreviewTable::getAccessibleColumnCount() throw (uno::RuntimeException)
157cdf0e10cSrcweir {
158cdf0e10cSrcweir ScUnoGuard aGuard;
159cdf0e10cSrcweir IsObjectValid();
160cdf0e10cSrcweir
161cdf0e10cSrcweir FillTableInfo();
162cdf0e10cSrcweir
163cdf0e10cSrcweir sal_Int32 nRet = 0;
164cdf0e10cSrcweir if ( mpTableInfo )
165cdf0e10cSrcweir nRet = mpTableInfo->GetCols();
166cdf0e10cSrcweir return nRet;
167cdf0e10cSrcweir }
168cdf0e10cSrcweir
getAccessibleRowDescription(sal_Int32 nRow)169cdf0e10cSrcweir rtl::OUString SAL_CALL ScAccessiblePreviewTable::getAccessibleRowDescription( sal_Int32 nRow )
170cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
171cdf0e10cSrcweir {
172cdf0e10cSrcweir // is not supported or specified so not implemented
173cdf0e10cSrcweir /* ScUnoGuard aGuard;
174cdf0e10cSrcweir IsObjectValid();
175cdf0e10cSrcweir
176cdf0e10cSrcweir FillTableInfo();
177cdf0e10cSrcweir
178cdf0e10cSrcweir rtl::OUString sName;
179cdf0e10cSrcweir if ( mpTableInfo && nRow >= 0 && nRow < mpTableInfo->GetRows() )
180cdf0e10cSrcweir {
181cdf0e10cSrcweir const ScPreviewColRowInfo& rInfo = mpTableInfo->GetRowInfo()[nRow];
182cdf0e10cSrcweir if ( rInfo.bIsHeader )
183cdf0e10cSrcweir {
184cdf0e10cSrcweir //! name of column headers row?
185cdf0e10cSrcweir
186cdf0e10cSrcweir sName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Column Headers"));
187cdf0e10cSrcweir }
188cdf0e10cSrcweir else
189cdf0e10cSrcweir {
190cdf0e10cSrcweir // normal row name
191cdf0e10cSrcweir sName = rtl::OUString::valueOf( (sal_Int32) ( rInfo.nDocIndex + 1 ) );
192cdf0e10cSrcweir }
193cdf0e10cSrcweir }
194cdf0e10cSrcweir else
195cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();*/
196cdf0e10cSrcweir
197cdf0e10cSrcweir ScUnoGuard aGuard;
198cdf0e10cSrcweir FillTableInfo();
199cdf0e10cSrcweir if ( nRow < 0 || (mpTableInfo && nRow >= mpTableInfo->GetRows()) )
200cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
201cdf0e10cSrcweir
202cdf0e10cSrcweir return rtl::OUString();
203cdf0e10cSrcweir }
204cdf0e10cSrcweir
getAccessibleColumnDescription(sal_Int32 nColumn)205cdf0e10cSrcweir rtl::OUString SAL_CALL ScAccessiblePreviewTable::getAccessibleColumnDescription( sal_Int32 nColumn )
206cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
207cdf0e10cSrcweir {
208cdf0e10cSrcweir // is not supported or specified so not implemented
209cdf0e10cSrcweir /* ScUnoGuard aGuard;
210cdf0e10cSrcweir IsObjectValid();
211cdf0e10cSrcweir
212cdf0e10cSrcweir FillTableInfo();
213cdf0e10cSrcweir
214cdf0e10cSrcweir rtl::OUString sName;
215cdf0e10cSrcweir if ( mpTableInfo && nColumn >= 0 && nColumn < mpTableInfo->GetCols() )
216cdf0e10cSrcweir {
217cdf0e10cSrcweir const ScPreviewColRowInfo& rInfo = mpTableInfo->GetColInfo()[nColumn];
218cdf0e10cSrcweir if ( rInfo.bIsHeader )
219cdf0e10cSrcweir {
220cdf0e10cSrcweir //! name of row headers column?
221cdf0e10cSrcweir
222cdf0e10cSrcweir sName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Row Headers"));
223cdf0e10cSrcweir }
224cdf0e10cSrcweir else
225cdf0e10cSrcweir {
226cdf0e10cSrcweir // normal column name
227cdf0e10cSrcweir sName = ScColToAlpha( rInfo.nDocIndex );
228cdf0e10cSrcweir }
229cdf0e10cSrcweir }
230cdf0e10cSrcweir else
231cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();*/
232cdf0e10cSrcweir
233cdf0e10cSrcweir ScUnoGuard aGuard;
234cdf0e10cSrcweir FillTableInfo();
235cdf0e10cSrcweir if ( nColumn < 0 || (mpTableInfo && nColumn >= mpTableInfo->GetCols()) )
236cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
237cdf0e10cSrcweir
238cdf0e10cSrcweir return rtl::OUString();
239cdf0e10cSrcweir }
240cdf0e10cSrcweir
getAccessibleRowExtentAt(sal_Int32 nRow,sal_Int32 nColumn)241cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessiblePreviewTable::getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
242cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
243cdf0e10cSrcweir {
244cdf0e10cSrcweir ScUnoGuard aGuard;
245cdf0e10cSrcweir IsObjectValid();
246cdf0e10cSrcweir
247cdf0e10cSrcweir FillTableInfo();
248cdf0e10cSrcweir
249cdf0e10cSrcweir sal_Int32 nRows = 1;
250cdf0e10cSrcweir if ( mpViewShell && mpTableInfo && nColumn >= 0 && nRow >= 0 &&
251cdf0e10cSrcweir nColumn < mpTableInfo->GetCols() && nRow < mpTableInfo->GetRows() )
252cdf0e10cSrcweir {
253cdf0e10cSrcweir const ScPreviewColRowInfo& rColInfo = mpTableInfo->GetColInfo()[nColumn];
254cdf0e10cSrcweir const ScPreviewColRowInfo& rRowInfo = mpTableInfo->GetRowInfo()[nRow];
255cdf0e10cSrcweir
256cdf0e10cSrcweir if ( rColInfo.bIsHeader || rRowInfo.bIsHeader )
257cdf0e10cSrcweir {
258cdf0e10cSrcweir // header cells only span a single cell
259cdf0e10cSrcweir }
260cdf0e10cSrcweir else
261cdf0e10cSrcweir {
262cdf0e10cSrcweir ScDocument* pDoc = mpViewShell->GetDocument();
263cdf0e10cSrcweir const ScMergeAttr* pItem = (const ScMergeAttr*)pDoc->GetAttr(
264cdf0e10cSrcweir static_cast<SCCOL>(rColInfo.nDocIndex), static_cast<SCROW>(rRowInfo.nDocIndex), mpTableInfo->GetTab(), ATTR_MERGE );
265cdf0e10cSrcweir if ( pItem && pItem->GetRowMerge() > 0 )
266cdf0e10cSrcweir nRows = pItem->GetRowMerge();
267cdf0e10cSrcweir }
268cdf0e10cSrcweir }
269cdf0e10cSrcweir else
270cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
271cdf0e10cSrcweir
272cdf0e10cSrcweir return nRows;
273cdf0e10cSrcweir }
274cdf0e10cSrcweir
getAccessibleColumnExtentAt(sal_Int32 nRow,sal_Int32 nColumn)275cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessiblePreviewTable::getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
276cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
277cdf0e10cSrcweir {
278cdf0e10cSrcweir ScUnoGuard aGuard;
279cdf0e10cSrcweir IsObjectValid();
280cdf0e10cSrcweir
281cdf0e10cSrcweir FillTableInfo();
282cdf0e10cSrcweir
283cdf0e10cSrcweir sal_Int32 nColumns = 1;
284cdf0e10cSrcweir if ( mpViewShell && mpTableInfo && nColumn >= 0 && nRow >= 0 &&
285cdf0e10cSrcweir nColumn < mpTableInfo->GetCols() && nRow < mpTableInfo->GetRows() )
286cdf0e10cSrcweir {
287cdf0e10cSrcweir const ScPreviewColRowInfo& rColInfo = mpTableInfo->GetColInfo()[nColumn];
288cdf0e10cSrcweir const ScPreviewColRowInfo& rRowInfo = mpTableInfo->GetRowInfo()[nRow];
289cdf0e10cSrcweir
290cdf0e10cSrcweir if ( rColInfo.bIsHeader || rRowInfo.bIsHeader )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir // header cells only span a single cell
293cdf0e10cSrcweir }
294cdf0e10cSrcweir else
295cdf0e10cSrcweir {
296cdf0e10cSrcweir ScDocument* pDoc = mpViewShell->GetDocument();
297cdf0e10cSrcweir const ScMergeAttr* pItem = (const ScMergeAttr*)pDoc->GetAttr(
298cdf0e10cSrcweir static_cast<SCCOL>(rColInfo.nDocIndex), static_cast<SCROW>(rRowInfo.nDocIndex), mpTableInfo->GetTab(), ATTR_MERGE );
299cdf0e10cSrcweir if ( pItem && pItem->GetColMerge() > 0 )
300cdf0e10cSrcweir nColumns = pItem->GetColMerge();
301cdf0e10cSrcweir }
302cdf0e10cSrcweir }
303cdf0e10cSrcweir else
304cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
305cdf0e10cSrcweir
306cdf0e10cSrcweir return nColumns;
307cdf0e10cSrcweir }
308cdf0e10cSrcweir
getAccessibleRowHeaders()309cdf0e10cSrcweir uno::Reference< XAccessibleTable > SAL_CALL ScAccessiblePreviewTable::getAccessibleRowHeaders() throw (uno::RuntimeException)
310cdf0e10cSrcweir {
311cdf0e10cSrcweir //! missing
312cdf0e10cSrcweir return NULL;
313cdf0e10cSrcweir }
314cdf0e10cSrcweir
getAccessibleColumnHeaders()315cdf0e10cSrcweir uno::Reference< XAccessibleTable > SAL_CALL ScAccessiblePreviewTable::getAccessibleColumnHeaders() throw (uno::RuntimeException)
316cdf0e10cSrcweir {
317cdf0e10cSrcweir //! missing
318cdf0e10cSrcweir return NULL;
319cdf0e10cSrcweir }
320cdf0e10cSrcweir
getSelectedAccessibleRows()321cdf0e10cSrcweir uno::Sequence< sal_Int32 > SAL_CALL ScAccessiblePreviewTable::getSelectedAccessibleRows() throw (uno::RuntimeException)
322cdf0e10cSrcweir {
323cdf0e10cSrcweir // in the page preview, there is no selection
324cdf0e10cSrcweir return uno::Sequence<sal_Int32>(0);
325cdf0e10cSrcweir }
326cdf0e10cSrcweir
getSelectedAccessibleColumns()327cdf0e10cSrcweir uno::Sequence< sal_Int32 > SAL_CALL ScAccessiblePreviewTable::getSelectedAccessibleColumns() throw (uno::RuntimeException)
328cdf0e10cSrcweir {
329cdf0e10cSrcweir // in the page preview, there is no selection
330cdf0e10cSrcweir return uno::Sequence<sal_Int32>(0);
331cdf0e10cSrcweir }
332cdf0e10cSrcweir
isAccessibleRowSelected(sal_Int32 nRow)333cdf0e10cSrcweir sal_Bool SAL_CALL ScAccessiblePreviewTable::isAccessibleRowSelected( sal_Int32 nRow )
334cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
335cdf0e10cSrcweir {
336cdf0e10cSrcweir // in the page preview, there is no selection
337cdf0e10cSrcweir
338cdf0e10cSrcweir ScUnoGuard aGuard;
339cdf0e10cSrcweir FillTableInfo();
340cdf0e10cSrcweir if ( nRow < 0 || (mpTableInfo && nRow >= mpTableInfo->GetRows()) )
341cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
342cdf0e10cSrcweir
343cdf0e10cSrcweir return sal_False;
344cdf0e10cSrcweir }
345cdf0e10cSrcweir
isAccessibleColumnSelected(sal_Int32 nColumn)346cdf0e10cSrcweir sal_Bool SAL_CALL ScAccessiblePreviewTable::isAccessibleColumnSelected( sal_Int32 nColumn )
347cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
348cdf0e10cSrcweir {
349cdf0e10cSrcweir // in the page preview, there is no selection
350cdf0e10cSrcweir
351cdf0e10cSrcweir ScUnoGuard aGuard;
352cdf0e10cSrcweir FillTableInfo();
353cdf0e10cSrcweir if ( nColumn < 0 || (mpTableInfo && nColumn >= mpTableInfo->GetCols()) )
354cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
355cdf0e10cSrcweir
356cdf0e10cSrcweir return sal_False;
357cdf0e10cSrcweir }
358cdf0e10cSrcweir
getAccessibleCellAt(sal_Int32 nRow,sal_Int32 nColumn)359cdf0e10cSrcweir uno::Reference< XAccessible > SAL_CALL ScAccessiblePreviewTable::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
360cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
361cdf0e10cSrcweir {
362cdf0e10cSrcweir ScUnoGuard aGuard;
363cdf0e10cSrcweir IsObjectValid();
364cdf0e10cSrcweir
365cdf0e10cSrcweir FillTableInfo();
366cdf0e10cSrcweir
367cdf0e10cSrcweir uno::Reference<XAccessible> xRet;
368cdf0e10cSrcweir if ( mpTableInfo && nColumn >= 0 && nRow >= 0 && nColumn < mpTableInfo->GetCols() && nRow < mpTableInfo->GetRows() )
369cdf0e10cSrcweir {
370cdf0e10cSrcweir // index iterates horizontally
371cdf0e10cSrcweir long nNewIndex = nRow * mpTableInfo->GetCols() + nColumn;
372cdf0e10cSrcweir
373cdf0e10cSrcweir const ScPreviewColRowInfo& rColInfo = mpTableInfo->GetColInfo()[nColumn];
374cdf0e10cSrcweir const ScPreviewColRowInfo& rRowInfo = mpTableInfo->GetRowInfo()[nRow];
375cdf0e10cSrcweir
376cdf0e10cSrcweir ScAddress aCellPos( static_cast<SCCOL>(rColInfo.nDocIndex), static_cast<SCROW>(rRowInfo.nDocIndex), mpTableInfo->GetTab() );
377cdf0e10cSrcweir if ( rColInfo.bIsHeader || rRowInfo.bIsHeader )
378cdf0e10cSrcweir {
379cdf0e10cSrcweir ScAccessiblePreviewHeaderCell* pHeaderCell = new ScAccessiblePreviewHeaderCell( this, mpViewShell, aCellPos,
380cdf0e10cSrcweir rRowInfo.bIsHeader, rColInfo.bIsHeader, nNewIndex );
381cdf0e10cSrcweir xRet = pHeaderCell;
382cdf0e10cSrcweir pHeaderCell->Init();
383cdf0e10cSrcweir }
384cdf0e10cSrcweir else
385cdf0e10cSrcweir {
386cdf0e10cSrcweir ScAccessiblePreviewCell* pCell = new ScAccessiblePreviewCell( this, mpViewShell, aCellPos, nNewIndex );
387cdf0e10cSrcweir xRet = pCell;
388cdf0e10cSrcweir pCell->Init();
389cdf0e10cSrcweir }
390cdf0e10cSrcweir }
391cdf0e10cSrcweir
392cdf0e10cSrcweir if ( !xRet.is() )
393cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
394cdf0e10cSrcweir
395cdf0e10cSrcweir return xRet;
396cdf0e10cSrcweir }
397cdf0e10cSrcweir
getAccessibleCaption()398cdf0e10cSrcweir uno::Reference< XAccessible > SAL_CALL ScAccessiblePreviewTable::getAccessibleCaption() throw (uno::RuntimeException)
399cdf0e10cSrcweir {
400cdf0e10cSrcweir //! missing
401cdf0e10cSrcweir return NULL;
402cdf0e10cSrcweir }
403cdf0e10cSrcweir
getAccessibleSummary()404cdf0e10cSrcweir uno::Reference< XAccessible > SAL_CALL ScAccessiblePreviewTable::getAccessibleSummary() throw (uno::RuntimeException)
405cdf0e10cSrcweir {
406cdf0e10cSrcweir //! missing
407cdf0e10cSrcweir return NULL;
408cdf0e10cSrcweir }
409cdf0e10cSrcweir
isAccessibleSelected(sal_Int32 nRow,sal_Int32 nColumn)410cdf0e10cSrcweir sal_Bool SAL_CALL ScAccessiblePreviewTable::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
411cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
412cdf0e10cSrcweir {
413cdf0e10cSrcweir // in the page preview, there is no selection
414cdf0e10cSrcweir ScUnoGuard aGuard;
415cdf0e10cSrcweir IsObjectValid();
416cdf0e10cSrcweir
417cdf0e10cSrcweir FillTableInfo();
418cdf0e10cSrcweir
419cdf0e10cSrcweir if ( mpTableInfo && nColumn >= 0 && nRow >= 0 && nColumn < mpTableInfo->GetCols() && nRow < mpTableInfo->GetRows() )
420cdf0e10cSrcweir {
421cdf0e10cSrcweir // index iterates horizontally
422cdf0e10cSrcweir }
423cdf0e10cSrcweir else
424cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
425cdf0e10cSrcweir
426cdf0e10cSrcweir return sal_False;
427cdf0e10cSrcweir }
428cdf0e10cSrcweir
getAccessibleIndex(sal_Int32 nRow,sal_Int32 nColumn)429cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessiblePreviewTable::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
430cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
431cdf0e10cSrcweir {
432cdf0e10cSrcweir ScUnoGuard aGuard;
433cdf0e10cSrcweir IsObjectValid();
434cdf0e10cSrcweir
435cdf0e10cSrcweir FillTableInfo();
436cdf0e10cSrcweir
437cdf0e10cSrcweir sal_Int32 nRet = 0;
438cdf0e10cSrcweir if ( mpTableInfo && nColumn >= 0 && nRow >= 0 && nColumn < mpTableInfo->GetCols() && nRow < mpTableInfo->GetRows() )
439cdf0e10cSrcweir {
440cdf0e10cSrcweir // index iterates horizontally
441cdf0e10cSrcweir nRet = nRow * mpTableInfo->GetCols() + nColumn;
442cdf0e10cSrcweir }
443cdf0e10cSrcweir else
444cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
445cdf0e10cSrcweir
446cdf0e10cSrcweir return nRet;
447cdf0e10cSrcweir }
448cdf0e10cSrcweir
getAccessibleRow(sal_Int32 nChildIndex)449cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessiblePreviewTable::getAccessibleRow( sal_Int32 nChildIndex )
450cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
451cdf0e10cSrcweir {
452cdf0e10cSrcweir ScUnoGuard aGuard;
453cdf0e10cSrcweir IsObjectValid();
454cdf0e10cSrcweir
455cdf0e10cSrcweir FillTableInfo();
456cdf0e10cSrcweir
457cdf0e10cSrcweir sal_Int32 nRow = 0;
458cdf0e10cSrcweir if ( mpTableInfo && nChildIndex >= 0 && nChildIndex < static_cast<sal_Int32>(mpTableInfo->GetRows()) * mpTableInfo->GetCols() )
459cdf0e10cSrcweir {
460cdf0e10cSrcweir nRow = nChildIndex / mpTableInfo->GetCols();
461cdf0e10cSrcweir }
462cdf0e10cSrcweir else
463cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
464cdf0e10cSrcweir
465cdf0e10cSrcweir return nRow;
466cdf0e10cSrcweir }
467cdf0e10cSrcweir
getAccessibleColumn(sal_Int32 nChildIndex)468cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessiblePreviewTable::getAccessibleColumn( sal_Int32 nChildIndex )
469cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
470cdf0e10cSrcweir {
471cdf0e10cSrcweir ScUnoGuard aGuard;
472cdf0e10cSrcweir IsObjectValid();
473cdf0e10cSrcweir
474cdf0e10cSrcweir FillTableInfo();
475cdf0e10cSrcweir
476cdf0e10cSrcweir sal_Int32 nCol = 0;
477cdf0e10cSrcweir if ( mpTableInfo && nChildIndex >= 0 && nChildIndex < static_cast<sal_Int32>(mpTableInfo->GetRows()) * mpTableInfo->GetCols() )
478cdf0e10cSrcweir {
479cdf0e10cSrcweir nCol = nChildIndex % static_cast<sal_Int32>(mpTableInfo->GetCols());
480cdf0e10cSrcweir }
481cdf0e10cSrcweir else
482cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
483cdf0e10cSrcweir
484cdf0e10cSrcweir return nCol;
485cdf0e10cSrcweir }
486cdf0e10cSrcweir
487cdf0e10cSrcweir //===== XAccessibleComponent ============================================
488cdf0e10cSrcweir
getAccessibleAtPoint(const awt::Point & aPoint)489cdf0e10cSrcweir uno::Reference< XAccessible > SAL_CALL ScAccessiblePreviewTable::getAccessibleAtPoint( const awt::Point& aPoint )
490cdf0e10cSrcweir throw (uno::RuntimeException)
491cdf0e10cSrcweir {
492cdf0e10cSrcweir uno::Reference<XAccessible> xRet;
493cdf0e10cSrcweir if (containsPoint(aPoint))
494cdf0e10cSrcweir {
495cdf0e10cSrcweir ScUnoGuard aGuard;
496cdf0e10cSrcweir IsObjectValid();
497cdf0e10cSrcweir
498cdf0e10cSrcweir FillTableInfo();
499cdf0e10cSrcweir
500cdf0e10cSrcweir if ( mpTableInfo )
501cdf0e10cSrcweir {
502cdf0e10cSrcweir SCCOL nCols = mpTableInfo->GetCols();
503cdf0e10cSrcweir SCROW nRows = mpTableInfo->GetRows();
504cdf0e10cSrcweir const ScPreviewColRowInfo* pColInfo = mpTableInfo->GetColInfo();
505cdf0e10cSrcweir const ScPreviewColRowInfo* pRowInfo = mpTableInfo->GetRowInfo();
506cdf0e10cSrcweir
507cdf0e10cSrcweir Rectangle aScreenRect(GetBoundingBox());
508cdf0e10cSrcweir
509cdf0e10cSrcweir awt::Point aMovedPoint = aPoint;
510cdf0e10cSrcweir aMovedPoint.X += aScreenRect.Left();
511cdf0e10cSrcweir aMovedPoint.Y += aScreenRect.Top();
512cdf0e10cSrcweir
513cdf0e10cSrcweir if ( nCols > 0 && nRows > 0 && aMovedPoint.X >= pColInfo[0].nPixelStart && aMovedPoint.Y >= pRowInfo[0].nPixelStart )
514cdf0e10cSrcweir {
515cdf0e10cSrcweir SCCOL nColIndex = 0;
516cdf0e10cSrcweir while ( nColIndex < nCols && aMovedPoint.X > pColInfo[nColIndex].nPixelEnd )
517cdf0e10cSrcweir ++nColIndex;
518cdf0e10cSrcweir SCROW nRowIndex = 0;
519cdf0e10cSrcweir while ( nRowIndex < nRows && aMovedPoint.Y > pRowInfo[nRowIndex].nPixelEnd )
520cdf0e10cSrcweir ++nRowIndex;
521cdf0e10cSrcweir if ( nColIndex < nCols && nRowIndex < nRows )
522cdf0e10cSrcweir {
523cdf0e10cSrcweir try
524cdf0e10cSrcweir {
525cdf0e10cSrcweir xRet = getAccessibleCellAt( nRowIndex, nColIndex );
526cdf0e10cSrcweir }
527cdf0e10cSrcweir catch (uno::Exception&)
528cdf0e10cSrcweir {
529cdf0e10cSrcweir }
530cdf0e10cSrcweir }
531cdf0e10cSrcweir }
532cdf0e10cSrcweir }
533cdf0e10cSrcweir }
534cdf0e10cSrcweir
535cdf0e10cSrcweir return xRet;
536cdf0e10cSrcweir }
537cdf0e10cSrcweir
grabFocus()538cdf0e10cSrcweir void SAL_CALL ScAccessiblePreviewTable::grabFocus() throw (uno::RuntimeException)
539cdf0e10cSrcweir {
540cdf0e10cSrcweir ScUnoGuard aGuard;
541cdf0e10cSrcweir IsObjectValid();
542cdf0e10cSrcweir if (getAccessibleParent().is())
543cdf0e10cSrcweir {
544cdf0e10cSrcweir uno::Reference<XAccessibleComponent> xAccessibleComponent(getAccessibleParent()->getAccessibleContext(), uno::UNO_QUERY);
545cdf0e10cSrcweir if (xAccessibleComponent.is())
546cdf0e10cSrcweir xAccessibleComponent->grabFocus();
547cdf0e10cSrcweir }
548cdf0e10cSrcweir }
549cdf0e10cSrcweir
550cdf0e10cSrcweir //===== XAccessibleContext ==============================================
551cdf0e10cSrcweir
getAccessibleChildCount()552cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessiblePreviewTable::getAccessibleChildCount() throw (uno::RuntimeException)
553cdf0e10cSrcweir {
554cdf0e10cSrcweir ScUnoGuard aGuard;
555cdf0e10cSrcweir IsObjectValid();
556cdf0e10cSrcweir
557cdf0e10cSrcweir FillTableInfo();
558cdf0e10cSrcweir
559cdf0e10cSrcweir long nRet = 0;
560cdf0e10cSrcweir if ( mpTableInfo )
561cdf0e10cSrcweir nRet = static_cast<sal_Int32>(mpTableInfo->GetCols()) * mpTableInfo->GetRows();
562cdf0e10cSrcweir return nRet;
563cdf0e10cSrcweir }
564cdf0e10cSrcweir
getAccessibleChild(sal_Int32 nIndex)565cdf0e10cSrcweir uno::Reference< XAccessible > SAL_CALL ScAccessiblePreviewTable::getAccessibleChild( sal_Int32 nIndex )
566cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
567cdf0e10cSrcweir {
568cdf0e10cSrcweir ScUnoGuard aGuard;
569cdf0e10cSrcweir IsObjectValid();
570cdf0e10cSrcweir
571cdf0e10cSrcweir FillTableInfo();
572cdf0e10cSrcweir
573cdf0e10cSrcweir uno::Reference<XAccessible> xRet;
574cdf0e10cSrcweir if ( mpTableInfo )
575cdf0e10cSrcweir {
576cdf0e10cSrcweir long nColumns = mpTableInfo->GetCols();
577cdf0e10cSrcweir if ( nColumns > 0 )
578cdf0e10cSrcweir {
579cdf0e10cSrcweir // nCol, nRow are within the visible table, not the document
580cdf0e10cSrcweir long nCol = nIndex % nColumns;
581cdf0e10cSrcweir long nRow = nIndex / nColumns;
582cdf0e10cSrcweir
583cdf0e10cSrcweir xRet = getAccessibleCellAt( nRow, nCol );
584cdf0e10cSrcweir }
585cdf0e10cSrcweir }
586cdf0e10cSrcweir
587cdf0e10cSrcweir if ( !xRet.is() )
588cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
589cdf0e10cSrcweir
590cdf0e10cSrcweir return xRet;
591cdf0e10cSrcweir }
592cdf0e10cSrcweir
getAccessibleIndexInParent()593cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessiblePreviewTable::getAccessibleIndexInParent() throw (uno::RuntimeException)
594cdf0e10cSrcweir {
595cdf0e10cSrcweir return mnIndex;
596cdf0e10cSrcweir }
597cdf0e10cSrcweir
getAccessibleStateSet()598cdf0e10cSrcweir uno::Reference< XAccessibleStateSet > SAL_CALL ScAccessiblePreviewTable::getAccessibleStateSet()
599cdf0e10cSrcweir throw (uno::RuntimeException)
600cdf0e10cSrcweir {
601cdf0e10cSrcweir ScUnoGuard aGuard;
602cdf0e10cSrcweir uno::Reference<XAccessibleStateSet> xParentStates;
603cdf0e10cSrcweir if (getAccessibleParent().is())
604cdf0e10cSrcweir {
605cdf0e10cSrcweir uno::Reference<XAccessibleContext> xParentContext = getAccessibleParent()->getAccessibleContext();
606cdf0e10cSrcweir xParentStates = xParentContext->getAccessibleStateSet();
607cdf0e10cSrcweir }
608cdf0e10cSrcweir utl::AccessibleStateSetHelper* pStateSet = new utl::AccessibleStateSetHelper();
609cdf0e10cSrcweir if (IsDefunc(xParentStates))
610cdf0e10cSrcweir pStateSet->AddState(AccessibleStateType::DEFUNC);
611cdf0e10cSrcweir else
612cdf0e10cSrcweir {
613cdf0e10cSrcweir pStateSet->AddState(AccessibleStateType::MANAGES_DESCENDANTS);
614cdf0e10cSrcweir pStateSet->AddState(AccessibleStateType::ENABLED);
615cdf0e10cSrcweir pStateSet->AddState(AccessibleStateType::OPAQUE);
616cdf0e10cSrcweir if (isShowing())
617cdf0e10cSrcweir pStateSet->AddState(AccessibleStateType::SHOWING);
618cdf0e10cSrcweir if (isVisible())
619cdf0e10cSrcweir pStateSet->AddState(AccessibleStateType::VISIBLE);
620cdf0e10cSrcweir }
621cdf0e10cSrcweir return pStateSet;
622cdf0e10cSrcweir }
623cdf0e10cSrcweir
624cdf0e10cSrcweir //===== XServiceInfo ====================================================
625cdf0e10cSrcweir
getImplementationName()626cdf0e10cSrcweir rtl::OUString SAL_CALL ScAccessiblePreviewTable::getImplementationName() throw(uno::RuntimeException)
627cdf0e10cSrcweir {
628cdf0e10cSrcweir return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScAccessiblePreviewTable"));
629cdf0e10cSrcweir }
630cdf0e10cSrcweir
getSupportedServiceNames()631cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL ScAccessiblePreviewTable::getSupportedServiceNames()
632cdf0e10cSrcweir throw(uno::RuntimeException)
633cdf0e10cSrcweir {
634cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > aSequence = ScAccessibleContextBase::getSupportedServiceNames();
635cdf0e10cSrcweir sal_Int32 nOldSize(aSequence.getLength());
636cdf0e10cSrcweir aSequence.realloc(nOldSize + 1);
637cdf0e10cSrcweir ::rtl::OUString* pNames = aSequence.getArray();
638cdf0e10cSrcweir
639cdf0e10cSrcweir pNames[nOldSize] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.table.AccessibleTableView"));
640cdf0e10cSrcweir
641cdf0e10cSrcweir return aSequence;
642cdf0e10cSrcweir }
643cdf0e10cSrcweir
644cdf0e10cSrcweir //===== XTypeProvider ===================================================
645cdf0e10cSrcweir
getTypes()646cdf0e10cSrcweir uno::Sequence< uno::Type > SAL_CALL ScAccessiblePreviewTable::getTypes()
647cdf0e10cSrcweir throw (uno::RuntimeException)
648cdf0e10cSrcweir {
649cdf0e10cSrcweir return comphelper::concatSequences(ScAccessiblePreviewTableImpl::getTypes(), ScAccessibleContextBase::getTypes());
650cdf0e10cSrcweir }
651cdf0e10cSrcweir
getImplementationId()652cdf0e10cSrcweir uno::Sequence<sal_Int8> SAL_CALL ScAccessiblePreviewTable::getImplementationId()
653cdf0e10cSrcweir throw(uno::RuntimeException)
654cdf0e10cSrcweir {
655cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aId;
656cdf0e10cSrcweir if( aId.getLength() == 0 )
657cdf0e10cSrcweir {
658cdf0e10cSrcweir aId.realloc( 16 );
659cdf0e10cSrcweir rtl_createUuid (reinterpret_cast<sal_uInt8 *>(aId.getArray()), 0, sal_True);
660cdf0e10cSrcweir }
661cdf0e10cSrcweir return aId;
662cdf0e10cSrcweir }
663cdf0e10cSrcweir
664cdf0e10cSrcweir //==== internal =========================================================
665cdf0e10cSrcweir
createAccessibleDescription(void)666cdf0e10cSrcweir ::rtl::OUString SAL_CALL ScAccessiblePreviewTable::createAccessibleDescription(void)
667cdf0e10cSrcweir throw (uno::RuntimeException)
668cdf0e10cSrcweir {
669cdf0e10cSrcweir String sDesc(ScResId(STR_ACC_TABLE_DESCR));
670cdf0e10cSrcweir /* if (mpViewShell && mpViewShell->GetDocument())
671cdf0e10cSrcweir {
672cdf0e10cSrcweir FillTableInfo();
673cdf0e10cSrcweir
674cdf0e10cSrcweir if ( mpTableInfo )
675cdf0e10cSrcweir {
676cdf0e10cSrcweir String sCoreName;
677cdf0e10cSrcweir if (mpViewShell->GetDocument()->GetName( mpTableInfo->GetTab(), sCoreName ))
678cdf0e10cSrcweir sDesc.SearchAndReplaceAscii("%1", sCoreName);
679cdf0e10cSrcweir }
680cdf0e10cSrcweir }
681cdf0e10cSrcweir sDesc.SearchAndReplaceAscii("%2", String(ScResId(SCSTR_UNKNOWN)));*/
682cdf0e10cSrcweir return rtl::OUString(sDesc);
683cdf0e10cSrcweir }
684cdf0e10cSrcweir
createAccessibleName(void)685cdf0e10cSrcweir ::rtl::OUString SAL_CALL ScAccessiblePreviewTable::createAccessibleName(void)
686cdf0e10cSrcweir throw (uno::RuntimeException)
687cdf0e10cSrcweir {
688cdf0e10cSrcweir String sName(ScResId(STR_ACC_TABLE_NAME));
689cdf0e10cSrcweir
690cdf0e10cSrcweir if (mpViewShell && mpViewShell->GetDocument())
691cdf0e10cSrcweir {
692cdf0e10cSrcweir FillTableInfo();
693cdf0e10cSrcweir
694cdf0e10cSrcweir if ( mpTableInfo )
695cdf0e10cSrcweir {
696cdf0e10cSrcweir String sCoreName;
697cdf0e10cSrcweir if (mpViewShell->GetDocument()->GetName( mpTableInfo->GetTab(), sCoreName ))
698cdf0e10cSrcweir sName.SearchAndReplaceAscii("%1", sCoreName);
699cdf0e10cSrcweir }
700cdf0e10cSrcweir }
701cdf0e10cSrcweir
702cdf0e10cSrcweir return rtl::OUString(sName);
703cdf0e10cSrcweir }
704cdf0e10cSrcweir
GetBoundingBoxOnScreen() const705cdf0e10cSrcweir Rectangle ScAccessiblePreviewTable::GetBoundingBoxOnScreen() const throw (uno::RuntimeException)
706cdf0e10cSrcweir {
707cdf0e10cSrcweir Rectangle aCellRect(GetBoundingBox());
708cdf0e10cSrcweir if (mpViewShell)
709cdf0e10cSrcweir {
710cdf0e10cSrcweir Window* pWindow = mpViewShell->GetWindow();
711cdf0e10cSrcweir if (pWindow)
712cdf0e10cSrcweir {
713cdf0e10cSrcweir Rectangle aRect = pWindow->GetWindowExtentsRelative(NULL);
714cdf0e10cSrcweir aCellRect.setX(aCellRect.getX() + aRect.getX());
715cdf0e10cSrcweir aCellRect.setY(aCellRect.getY() + aRect.getY());
716cdf0e10cSrcweir }
717cdf0e10cSrcweir }
718cdf0e10cSrcweir return aCellRect;
719cdf0e10cSrcweir }
720cdf0e10cSrcweir
GetBoundingBox() const721cdf0e10cSrcweir Rectangle ScAccessiblePreviewTable::GetBoundingBox() const throw (uno::RuntimeException)
722cdf0e10cSrcweir {
723cdf0e10cSrcweir FillTableInfo();
724cdf0e10cSrcweir
725cdf0e10cSrcweir Rectangle aRect;
726cdf0e10cSrcweir if ( mpTableInfo )
727cdf0e10cSrcweir {
728cdf0e10cSrcweir SCCOL nColumns = mpTableInfo->GetCols();
729cdf0e10cSrcweir SCROW nRows = mpTableInfo->GetRows();
730cdf0e10cSrcweir if ( nColumns > 0 && nRows > 0 )
731cdf0e10cSrcweir {
732cdf0e10cSrcweir const ScPreviewColRowInfo* pColInfo = mpTableInfo->GetColInfo();
733cdf0e10cSrcweir const ScPreviewColRowInfo* pRowInfo = mpTableInfo->GetRowInfo();
734cdf0e10cSrcweir
735cdf0e10cSrcweir aRect = Rectangle( pColInfo[0].nPixelStart,
736cdf0e10cSrcweir pRowInfo[0].nPixelStart,
737cdf0e10cSrcweir pColInfo[nColumns-1].nPixelEnd,
738cdf0e10cSrcweir pRowInfo[nRows-1].nPixelEnd );
739cdf0e10cSrcweir }
740cdf0e10cSrcweir }
741cdf0e10cSrcweir return aRect;
742cdf0e10cSrcweir }
743cdf0e10cSrcweir
IsDefunc(const uno::Reference<XAccessibleStateSet> & rxParentStates)744cdf0e10cSrcweir sal_Bool ScAccessiblePreviewTable::IsDefunc( const uno::Reference<XAccessibleStateSet>& rxParentStates )
745cdf0e10cSrcweir {
746cdf0e10cSrcweir return ScAccessibleContextBase::IsDefunc() || (mpViewShell == NULL) || !getAccessibleParent().is() ||
747cdf0e10cSrcweir (rxParentStates.is() && rxParentStates->contains(AccessibleStateType::DEFUNC));
748cdf0e10cSrcweir }
749cdf0e10cSrcweir
FillTableInfo() const750cdf0e10cSrcweir void ScAccessiblePreviewTable::FillTableInfo() const
751cdf0e10cSrcweir {
752cdf0e10cSrcweir if ( mpViewShell && !mpTableInfo )
753cdf0e10cSrcweir {
754cdf0e10cSrcweir Size aOutputSize;
755cdf0e10cSrcweir Window* pWindow = mpViewShell->GetWindow();
756cdf0e10cSrcweir if ( pWindow )
757cdf0e10cSrcweir aOutputSize = pWindow->GetOutputSizePixel();
758cdf0e10cSrcweir Point aPoint;
759cdf0e10cSrcweir Rectangle aVisRect( aPoint, aOutputSize );
760cdf0e10cSrcweir
761cdf0e10cSrcweir mpTableInfo = new ScPreviewTableInfo;
762cdf0e10cSrcweir mpViewShell->GetLocationData().GetTableInfo( aVisRect, *mpTableInfo );
763cdf0e10cSrcweir }
764cdf0e10cSrcweir }
765cdf0e10cSrcweir
766