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