19b8096d0SSteve Yin /************************************************************** 29b8096d0SSteve Yin * 39b8096d0SSteve Yin * Licensed to the Apache Software Foundation (ASF) under one 49b8096d0SSteve Yin * or more contributor license agreements. See the NOTICE file 59b8096d0SSteve Yin * distributed with this work for additional information 69b8096d0SSteve Yin * regarding copyright ownership. The ASF licenses this file 79b8096d0SSteve Yin * to you under the Apache License, Version 2.0 (the 89b8096d0SSteve Yin * "License"); you may not use this file except in compliance 99b8096d0SSteve Yin * with the License. You may obtain a copy of the License at 109b8096d0SSteve Yin * 119b8096d0SSteve Yin * http://www.apache.org/licenses/LICENSE-2.0 129b8096d0SSteve Yin * 139b8096d0SSteve Yin * Unless required by applicable law or agreed to in writing, 149b8096d0SSteve Yin * software distributed under the License is distributed on an 159b8096d0SSteve Yin * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 169b8096d0SSteve Yin * KIND, either express or implied. See the License for the 179b8096d0SSteve Yin * specific language governing permissions and limitations 189b8096d0SSteve Yin * under the License. 199b8096d0SSteve Yin * 209b8096d0SSteve Yin *************************************************************/ 219b8096d0SSteve Yin 229b8096d0SSteve Yin 239b8096d0SSteve Yin // MARKER(update_precomp.py): autogen include statement, do not remove 249b8096d0SSteve Yin #include "precompiled_svx.hxx" 259b8096d0SSteve Yin 269b8096d0SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_ 279b8096d0SSteve Yin #include <com/sun/star/accessibility/AccessibleRole.hpp> 289b8096d0SSteve Yin #endif 299b8096d0SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_ 309b8096d0SSteve Yin #include <com/sun/star/accessibility/AccessibleEventId.hpp> 319b8096d0SSteve Yin #endif 329b8096d0SSteve Yin #ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX_ 339b8096d0SSteve Yin #include <unotools/accessiblestatesethelper.hxx> 349b8096d0SSteve Yin #endif 359b8096d0SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_ 369b8096d0SSteve Yin #include <com/sun/star/accessibility/AccessibleStateType.hpp> 379b8096d0SSteve Yin #endif 389b8096d0SSteve Yin 399b8096d0SSteve Yin #ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_ 409b8096d0SSteve Yin #include <com/sun/star/beans/PropertyChangeEvent.hpp> 419b8096d0SSteve Yin #endif 429b8096d0SSteve Yin 439b8096d0SSteve Yin #ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ 449b8096d0SSteve Yin #include <com/sun/star/awt/XWindow.hpp> 459b8096d0SSteve Yin #endif 469b8096d0SSteve Yin 479b8096d0SSteve Yin #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ 489b8096d0SSteve Yin #include <cppuhelper/typeprovider.hxx> 499b8096d0SSteve Yin #endif 509b8096d0SSteve Yin 519b8096d0SSteve Yin #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ 529b8096d0SSteve Yin #include <toolkit/helper/vclunohelper.hxx> 539b8096d0SSteve Yin #endif 549b8096d0SSteve Yin #ifndef _TOOLKIT_HELPER_CONVERT_HXX_ 559b8096d0SSteve Yin #include <toolkit/helper/convert.hxx> 569b8096d0SSteve Yin #endif 579b8096d0SSteve Yin 589b8096d0SSteve Yin #ifndef _SV_SVAPP_HXX 599b8096d0SSteve Yin #include <vcl/svapp.hxx> 609b8096d0SSteve Yin #endif 619b8096d0SSteve Yin 629b8096d0SSteve Yin #ifndef _OSL_MUTEX_HXX_ 639b8096d0SSteve Yin #include <osl/mutex.hxx> 649b8096d0SSteve Yin #endif 659b8096d0SSteve Yin #ifndef _RTL_UUID_H_ 669b8096d0SSteve Yin #include <rtl/uuid.h> 679b8096d0SSteve Yin #endif 689b8096d0SSteve Yin #ifndef _TOOLS_DEBUG_HXX 699b8096d0SSteve Yin #include <tools/debug.hxx> 709b8096d0SSteve Yin #endif 719b8096d0SSteve Yin #ifndef _SV_GEN_HXX 729b8096d0SSteve Yin #include <tools/gen.hxx> 739b8096d0SSteve Yin #endif 749b8096d0SSteve Yin 759b8096d0SSteve Yin #include <svx/dialogs.hrc> 769b8096d0SSteve Yin #include "accessibility.hrc" 779b8096d0SSteve Yin #include <svx/dlgctrl.hxx> 789b8096d0SSteve Yin 799b8096d0SSteve Yin #ifndef _SVX_DIALMGR_HXX 809b8096d0SSteve Yin #include <svx/dialmgr.hxx> 819b8096d0SSteve Yin #endif 829b8096d0SSteve Yin #ifndef COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER 839b8096d0SSteve Yin #include <comphelper/accessibleeventnotifier.hxx> 849b8096d0SSteve Yin #endif 859b8096d0SSteve Yin 869b8096d0SSteve Yin #include <unotools/accessiblerelationsethelper.hxx> 879b8096d0SSteve Yin 889b8096d0SSteve Yin #ifndef _SVXPIXELACCESSIBLECONTEXT_HXX 899b8096d0SSteve Yin #include "svxpixelctlaccessiblecontext.hxx" 909b8096d0SSteve Yin #endif 919b8096d0SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_ 929b8096d0SSteve Yin #include <com/sun/star/accessibility/AccessibleRelationType.hpp> 939b8096d0SSteve Yin #endif 949b8096d0SSteve Yin using namespace ::cppu; 959b8096d0SSteve Yin using namespace ::osl; 969b8096d0SSteve Yin using namespace ::rtl; 979b8096d0SSteve Yin using namespace ::com::sun::star; 989b8096d0SSteve Yin using namespace ::com::sun::star::uno; 999b8096d0SSteve Yin using namespace ::com::sun::star::accessibility; 1009b8096d0SSteve Yin 1019b8096d0SSteve Yin SvxPixelCtlAccessible::SvxPixelCtlAccessible( SvxPixelCtl& rControl) : 1029b8096d0SSteve Yin SvxPixelCtlAccessible_BASE(m_aMutex), 1039b8096d0SSteve Yin pPixelCtl(&rControl), 1049b8096d0SSteve Yin mnClientId(0) 1059b8096d0SSteve Yin { 1069b8096d0SSteve Yin //FreeResource(); 1079b8096d0SSteve Yin } 1089b8096d0SSteve Yin 1099b8096d0SSteve Yin SvxPixelCtlAccessible::~SvxPixelCtlAccessible() 1109b8096d0SSteve Yin { 1119b8096d0SSteve Yin // DBG_DTOR( SvxPixelCtlAccessible, NULL ); 1129b8096d0SSteve Yin 1139b8096d0SSteve Yin if( IsAlive() ) 1149b8096d0SSteve Yin { 1159b8096d0SSteve Yin osl_incrementInterlockedCount( &m_refCount ); 1169b8096d0SSteve Yin dispose(); // set mpRepr = NULL & release all childs 1179b8096d0SSteve Yin } 1189b8096d0SSteve Yin } 1199b8096d0SSteve Yin /*-- 04.02.2002 14:11:55--------------------------------------------------- 1209b8096d0SSteve Yin 1219b8096d0SSteve Yin -----------------------------------------------------------------------*/ 1229b8096d0SSteve Yin uno::Reference< XAccessibleContext > SvxPixelCtlAccessible::getAccessibleContext( ) 1239b8096d0SSteve Yin throw (uno::RuntimeException) 1249b8096d0SSteve Yin { 1259b8096d0SSteve Yin return this; 1269b8096d0SSteve Yin } 1279b8096d0SSteve Yin 1289b8096d0SSteve Yin sal_Int32 SvxPixelCtlAccessible::getAccessibleChildCount( ) throw (uno::RuntimeException) 1299b8096d0SSteve Yin { 1309b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1319b8096d0SSteve Yin IsValid(); 1329b8096d0SSteve Yin if(pPixelCtl) 1339b8096d0SSteve Yin { 1349b8096d0SSteve Yin return pPixelCtl->GetSquares(); 1359b8096d0SSteve Yin } 1369b8096d0SSteve Yin else 1379b8096d0SSteve Yin return 0; 1389b8096d0SSteve Yin } 1399b8096d0SSteve Yin /*-- 04.02.2002 14:11:56--------------------------------------------------- 1409b8096d0SSteve Yin 1419b8096d0SSteve Yin -----------------------------------------------------------------------*/ 1429b8096d0SSteve Yin uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleChild( sal_Int32 i ) 1439b8096d0SSteve Yin throw (uno::RuntimeException) 1449b8096d0SSteve Yin { 1459b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1469b8096d0SSteve Yin IsValid(); 1479b8096d0SSteve Yin if ( i < 0 || i >= getAccessibleChildCount()) 1489b8096d0SSteve Yin throw lang::IndexOutOfBoundsException(); 1499b8096d0SSteve Yin uno::Reference <XAccessible> xAcc; 1509b8096d0SSteve Yin if(pPixelCtl) 1519b8096d0SSteve Yin { 1529b8096d0SSteve Yin return CreateChild(i, pPixelCtl->IndexToPoint(i)); 1539b8096d0SSteve Yin } 1549b8096d0SSteve Yin else 1559b8096d0SSteve Yin return xAcc; 1569b8096d0SSteve Yin /* 1579b8096d0SSteve Yin throw lang::IndexOutOfBoundsException ( 1589b8096d0SSteve Yin ::rtl::OUString::createFromAscii ("no child with index " + i), 1599b8096d0SSteve Yin NULL); 1609b8096d0SSteve Yin */ 1619b8096d0SSteve Yin } 1629b8096d0SSteve Yin 1639b8096d0SSteve Yin 1649b8096d0SSteve Yin 1659b8096d0SSteve Yin uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleParent( ) 1669b8096d0SSteve Yin throw (uno::RuntimeException) 1679b8096d0SSteve Yin { 1689b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1699b8096d0SSteve Yin IsValid(); 1709b8096d0SSteve Yin uno::Reference< XAccessible > xRet; 1719b8096d0SSteve Yin if(pPixelCtl) 1729b8096d0SSteve Yin xRet = pPixelCtl->GetParent()->GetAccessible( sal_True ); 1739b8096d0SSteve Yin return xRet; 1749b8096d0SSteve Yin } 1759b8096d0SSteve Yin 1769b8096d0SSteve Yin sal_Int32 SvxPixelCtlAccessible::getAccessibleIndexInParent( ) 1779b8096d0SSteve Yin throw (uno::RuntimeException) 1789b8096d0SSteve Yin { 1799b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1809b8096d0SSteve Yin IsValid(); 1819b8096d0SSteve Yin sal_uInt16 nIdx = 0; 1829b8096d0SSteve Yin if(pPixelCtl) 1839b8096d0SSteve Yin { 1849b8096d0SSteve Yin Window* pTabPage = pPixelCtl->GetParent(); 1859b8096d0SSteve Yin sal_uInt16 nChildren = pTabPage->GetChildCount(); 1869b8096d0SSteve Yin for(nIdx = 0; nIdx < nChildren; nIdx++) 1879b8096d0SSteve Yin if(pTabPage->GetChild( nIdx ) == pPixelCtl) 1889b8096d0SSteve Yin break; 1899b8096d0SSteve Yin } 1909b8096d0SSteve Yin return nIdx; 1919b8096d0SSteve Yin } 1929b8096d0SSteve Yin /*-- 04.02.2002 14:11:57--------------------------------------------------- 1939b8096d0SSteve Yin 1949b8096d0SSteve Yin -----------------------------------------------------------------------*/ 1959b8096d0SSteve Yin sal_Int16 SvxPixelCtlAccessible::getAccessibleRole( ) throw (uno::RuntimeException) 1969b8096d0SSteve Yin { 1979b8096d0SSteve Yin return AccessibleRole::LIST; 1989b8096d0SSteve Yin } 1999b8096d0SSteve Yin 2009b8096d0SSteve Yin ::rtl::OUString SvxPixelCtlAccessible::getAccessibleDescription( ) 2019b8096d0SSteve Yin throw (uno::RuntimeException) 2029b8096d0SSteve Yin { 2039b8096d0SSteve Yin 2049b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 2059b8096d0SSteve Yin IsValid(); 2069b8096d0SSteve Yin if(pPixelCtl) 2079b8096d0SSteve Yin return pPixelCtl->GetAccessibleDescription(); 2089b8096d0SSteve Yin else 2099b8096d0SSteve Yin return String(); 2109b8096d0SSteve Yin 2119b8096d0SSteve Yin } 2129b8096d0SSteve Yin 2139b8096d0SSteve Yin ::rtl::OUString SvxPixelCtlAccessible::getAccessibleName( ) 2149b8096d0SSteve Yin throw (uno::RuntimeException) 2159b8096d0SSteve Yin { 2169b8096d0SSteve Yin 2179b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 2189b8096d0SSteve Yin IsValid(); 2199b8096d0SSteve Yin if(pPixelCtl) 2209b8096d0SSteve Yin return pPixelCtl->GetAccessibleName(); 2219b8096d0SSteve Yin else 2229b8096d0SSteve Yin return String(); 2239b8096d0SSteve Yin 2249b8096d0SSteve Yin } 2259b8096d0SSteve Yin 2269b8096d0SSteve Yin uno::Reference< XAccessibleRelationSet > SvxPixelCtlAccessible::getAccessibleRelationSet( ) 2279b8096d0SSteve Yin throw (uno::RuntimeException) 2289b8096d0SSteve Yin { 2299b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 2309b8096d0SSteve Yin IsValid(); 2319b8096d0SSteve Yin Window* pWindow = (Window*)pPixelCtl; 2329b8096d0SSteve Yin utl::AccessibleRelationSetHelper* rRelationSet = new utl::AccessibleRelationSetHelper; 2339b8096d0SSteve Yin uno::Reference< accessibility::XAccessibleRelationSet > rSet = rRelationSet; 2349b8096d0SSteve Yin if ( pWindow ) 2359b8096d0SSteve Yin { 2369b8096d0SSteve Yin Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy(); 2379b8096d0SSteve Yin if ( pLabeledBy && pLabeledBy != pWindow ) 2389b8096d0SSteve Yin { 2399b8096d0SSteve Yin uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); 2409b8096d0SSteve Yin aSequence[0] = pLabeledBy->GetAccessible(); 2419b8096d0SSteve Yin rRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) ); 2429b8096d0SSteve Yin } 2439b8096d0SSteve Yin 2449b8096d0SSteve Yin Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf(); 2459b8096d0SSteve Yin if ( pMemberOf && pMemberOf != pWindow ) 2469b8096d0SSteve Yin { 2479b8096d0SSteve Yin uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); 2489b8096d0SSteve Yin aSequence[0] = pMemberOf->GetAccessible(); 2499b8096d0SSteve Yin rRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) ); 2509b8096d0SSteve Yin } 2519b8096d0SSteve Yin return rSet; 2529b8096d0SSteve Yin } 2539b8096d0SSteve Yin 2549b8096d0SSteve Yin return new utl::AccessibleRelationSetHelper; 2559b8096d0SSteve Yin } 2569b8096d0SSteve Yin 2579b8096d0SSteve Yin 2589b8096d0SSteve Yin uno::Reference< XAccessibleStateSet > SvxPixelCtlAccessible::getAccessibleStateSet( ) 2599b8096d0SSteve Yin throw (uno::RuntimeException) 2609b8096d0SSteve Yin { 2619b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 2629b8096d0SSteve Yin utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; 2639b8096d0SSteve Yin uno::Reference< XAccessibleStateSet > xRet = pStateSetHelper; 2649b8096d0SSteve Yin 2659b8096d0SSteve Yin if(!pPixelCtl) 2669b8096d0SSteve Yin pStateSetHelper->AddState(AccessibleStateType::DEFUNC); 2679b8096d0SSteve Yin else 2689b8096d0SSteve Yin { 2699b8096d0SSteve Yin const sal_Int16 aStandardStates[] = 2709b8096d0SSteve Yin { 2719b8096d0SSteve Yin AccessibleStateType::FOCUSABLE, 2729b8096d0SSteve Yin AccessibleStateType::SELECTABLE, 2739b8096d0SSteve Yin AccessibleStateType::SHOWING, 2749b8096d0SSteve Yin AccessibleStateType::VISIBLE, 2759b8096d0SSteve Yin AccessibleStateType::OPAQUE, 2769b8096d0SSteve Yin 0}; 2779b8096d0SSteve Yin 2789b8096d0SSteve Yin sal_Int16 nState = 0; 2799b8096d0SSteve Yin while(aStandardStates[nState]) 2809b8096d0SSteve Yin { 2819b8096d0SSteve Yin pStateSetHelper->AddState(aStandardStates[nState++]); 2829b8096d0SSteve Yin } 2839b8096d0SSteve Yin if(pPixelCtl->IsEnabled()) 2849b8096d0SSteve Yin pStateSetHelper->AddState(AccessibleStateType::ENABLED); 2859b8096d0SSteve Yin if(pPixelCtl->HasFocus()) 2869b8096d0SSteve Yin pStateSetHelper->AddState(AccessibleStateType::FOCUSED); 2879b8096d0SSteve Yin pStateSetHelper->AddState(AccessibleStateType::MANAGES_DESCENDANTS); 2889b8096d0SSteve Yin } 2899b8096d0SSteve Yin return xRet; 2909b8096d0SSteve Yin } 2919b8096d0SSteve Yin 2929b8096d0SSteve Yin 2939b8096d0SSteve Yin com::sun::star::lang::Locale SvxPixelCtlAccessible::getLocale( ) 2949b8096d0SSteve Yin throw (IllegalAccessibleComponentStateException, uno::RuntimeException) 2959b8096d0SSteve Yin { 2969b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 2979b8096d0SSteve Yin if( getAccessibleParent().is() ) 2989b8096d0SSteve Yin { 2999b8096d0SSteve Yin uno::Reference< XAccessibleContext > xParentContext( getAccessibleParent()->getAccessibleContext() ); 3009b8096d0SSteve Yin if( xParentContext.is() ) 3019b8096d0SSteve Yin return xParentContext->getLocale(); 3029b8096d0SSteve Yin } 3039b8096d0SSteve Yin 3049b8096d0SSteve Yin // No locale and no parent. Therefore throw exception to indicate this 3059b8096d0SSteve Yin // cluelessness. 3069b8096d0SSteve Yin throw IllegalAccessibleComponentStateException(); 3079b8096d0SSteve Yin } 3089b8096d0SSteve Yin 3099b8096d0SSteve Yin 3109b8096d0SSteve Yin sal_Bool SvxPixelCtlAccessible::containsPoint( const awt::Point& aPt ) 3119b8096d0SSteve Yin throw (uno::RuntimeException) 3129b8096d0SSteve Yin { 3139b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 3149b8096d0SSteve Yin IsValid(); 3159b8096d0SSteve Yin Point aPoint(aPt.X, aPt.Y); 3169b8096d0SSteve Yin if(pPixelCtl) 3179b8096d0SSteve Yin return (aPoint.X() >= 0) 3189b8096d0SSteve Yin && (aPoint.X() < pPixelCtl->GetSizePixel().getWidth()) 3199b8096d0SSteve Yin && (aPoint.Y() >= 0) 3209b8096d0SSteve Yin && (aPoint.Y() < pPixelCtl->GetSizePixel().getHeight()); 3219b8096d0SSteve Yin else 3229b8096d0SSteve Yin return sal_False; 3239b8096d0SSteve Yin } 3249b8096d0SSteve Yin uno::Reference<XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleAtPoint ( 3259b8096d0SSteve Yin const awt::Point& aPoint) 3269b8096d0SSteve Yin throw (uno::RuntimeException) 3279b8096d0SSteve Yin { 3289b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 3299b8096d0SSteve Yin ensureIsAlive(); 3309b8096d0SSteve Yin uno::Reference <XAccessible> xAcc; 3319b8096d0SSteve Yin 3329b8096d0SSteve Yin Point childPoint; 3339b8096d0SSteve Yin childPoint.X() = aPoint.X; 3349b8096d0SSteve Yin childPoint.Y() = aPoint.Y; 3359b8096d0SSteve Yin 3369b8096d0SSteve Yin if(pPixelCtl) 3379b8096d0SSteve Yin { 3389b8096d0SSteve Yin Point pt= pPixelCtl->PixelToLogic(childPoint); 3399b8096d0SSteve Yin long nIndex = pPixelCtl->PointToIndex(pt); 3409b8096d0SSteve Yin return CreateChild(nIndex,pPixelCtl->IndexToPoint(nIndex)); 3419b8096d0SSteve Yin } 3429b8096d0SSteve Yin else 3439b8096d0SSteve Yin return xAcc; 3449b8096d0SSteve Yin 3459b8096d0SSteve Yin } 3469b8096d0SSteve Yin 3479b8096d0SSteve Yin awt::Rectangle SvxPixelCtlAccessible::getBounds( ) throw (uno::RuntimeException) 3489b8096d0SSteve Yin { 3499b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 3509b8096d0SSteve Yin IsValid(); 3519b8096d0SSteve Yin Size aSz; 3529b8096d0SSteve Yin Point aPos(0,0); 3539b8096d0SSteve Yin awt::Rectangle aRet; 3549b8096d0SSteve Yin if(pPixelCtl) 3559b8096d0SSteve Yin { 3569b8096d0SSteve Yin aSz = pPixelCtl->GetSizePixel(); 3579b8096d0SSteve Yin aPos = pPixelCtl->GetPosPixel(); 3589b8096d0SSteve Yin aRet.X = aPos.X(); 3599b8096d0SSteve Yin aRet.Y = aPos.Y(); 3609b8096d0SSteve Yin aRet.Width = aSz.Width(); 3619b8096d0SSteve Yin aRet.Height = aSz.Height(); 3629b8096d0SSteve Yin } 3639b8096d0SSteve Yin return aRet; 3649b8096d0SSteve Yin } 3659b8096d0SSteve Yin 3669b8096d0SSteve Yin awt::Point SvxPixelCtlAccessible::getLocation( ) throw (uno::RuntimeException) 3679b8096d0SSteve Yin { 3689b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 3699b8096d0SSteve Yin IsValid(); 3709b8096d0SSteve Yin Point aPos; 3719b8096d0SSteve Yin aPos = pPixelCtl->GetPosPixel(); 3729b8096d0SSteve Yin awt::Point aRet(aPos.X(), aPos.Y()); 3739b8096d0SSteve Yin return aRet; 3749b8096d0SSteve Yin } 3759b8096d0SSteve Yin 3769b8096d0SSteve Yin awt::Point SvxPixelCtlAccessible::getLocationOnScreen( ) throw (uno::RuntimeException) 3779b8096d0SSteve Yin { 3789b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 3799b8096d0SSteve Yin IsValid(); 3809b8096d0SSteve Yin Rectangle rect; 3819b8096d0SSteve Yin rect = pPixelCtl->GetWindowExtentsRelative(NULL); 3829b8096d0SSteve Yin awt::Point aRet(rect.Left(),rect.Top() ); 3839b8096d0SSteve Yin return aRet; 3849b8096d0SSteve Yin } 3859b8096d0SSteve Yin 3869b8096d0SSteve Yin awt::Size SvxPixelCtlAccessible::getSize( ) throw (uno::RuntimeException) 3879b8096d0SSteve Yin { 3889b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 3899b8096d0SSteve Yin IsValid(); 3909b8096d0SSteve Yin Size aSz; 3919b8096d0SSteve Yin aSz = pPixelCtl->GetSizePixel(); 3929b8096d0SSteve Yin awt::Size aRet(aSz.Width(),aSz.Height()); 3939b8096d0SSteve Yin return aRet; 3949b8096d0SSteve Yin } 3959b8096d0SSteve Yin void SvxPixelCtlAccessible::grabFocus( ) throw (uno::RuntimeException) 3969b8096d0SSteve Yin { 3979b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 3989b8096d0SSteve Yin IsValid(); 3999b8096d0SSteve Yin if(pPixelCtl) 4009b8096d0SSteve Yin pPixelCtl->GrabFocus(); 4019b8096d0SSteve Yin } 4029b8096d0SSteve Yin 4039b8096d0SSteve Yin sal_Int32 SvxPixelCtlAccessible::getForeground( ) 4049b8096d0SSteve Yin throw (::com::sun::star::uno::RuntimeException) 4059b8096d0SSteve Yin { 4069b8096d0SSteve Yin uno::Any aRet; 4079b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 4089b8096d0SSteve Yin IsValid(); 4099b8096d0SSteve Yin return pPixelCtl->GetControlForeground().GetColor(); 4109b8096d0SSteve Yin } 4119b8096d0SSteve Yin 4129b8096d0SSteve Yin sal_Int32 SvxPixelCtlAccessible::getBackground( ) 4139b8096d0SSteve Yin throw (::com::sun::star::uno::RuntimeException) 4149b8096d0SSteve Yin { 4159b8096d0SSteve Yin uno::Any aRet; 4169b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 4179b8096d0SSteve Yin IsValid(); 4189b8096d0SSteve Yin return pPixelCtl->GetControlBackground().GetColor(); 4199b8096d0SSteve Yin } 4209b8096d0SSteve Yin 4219b8096d0SSteve Yin ::rtl::OUString SvxPixelCtlAccessible::getImplementationName( ) throw (uno::RuntimeException) 4229b8096d0SSteve Yin { 4239b8096d0SSteve Yin return rtl::OUString::createFromAscii("SvxPixelCtlAccessible"); 4249b8096d0SSteve Yin } 4259b8096d0SSteve Yin /*-- 04.02.2002 14:12:05--------------------------------------------------- 4269b8096d0SSteve Yin 4279b8096d0SSteve Yin -----------------------------------------------------------------------*/ 4289b8096d0SSteve Yin const sal_Char sAccessible[] = "Accessible"; 4299b8096d0SSteve Yin const sal_Char sAccessibleContext[] = "AccessibleContext"; 4309b8096d0SSteve Yin const sal_Char sAccessibleComponent[] = "AccessibleComponent"; 4319b8096d0SSteve Yin //const sal_Char sAccessibleTable[] = "AccessibleTable"; 4329b8096d0SSteve Yin 4339b8096d0SSteve Yin sal_Bool SvxPixelCtlAccessible::supportsService( const ::rtl::OUString& rServiceName ) 4349b8096d0SSteve Yin throw (uno::RuntimeException) 4359b8096d0SSteve Yin { 4369b8096d0SSteve Yin return rServiceName.equalsAsciiL( sAccessible , sizeof(sAccessible )-1 ) || 4379b8096d0SSteve Yin rServiceName.equalsAsciiL( sAccessibleContext , sizeof(sAccessibleContext )-1 ) || 4389b8096d0SSteve Yin rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 );// || 4399b8096d0SSteve Yin // rServiceName.equalsAsciiL( sAccessibleTable, sizeof(sAccessibleTable)-1 ); 4409b8096d0SSteve Yin } 4419b8096d0SSteve Yin /*-- 04.02.2002 14:12:05--------------------------------------------------- 4429b8096d0SSteve Yin 4439b8096d0SSteve Yin -----------------------------------------------------------------------*/ 4449b8096d0SSteve Yin uno::Sequence< ::rtl::OUString > SvxPixelCtlAccessible::getSupportedServiceNames( ) 4459b8096d0SSteve Yin throw (uno::RuntimeException) 4469b8096d0SSteve Yin { 4479b8096d0SSteve Yin uno::Sequence< OUString > aRet(2); 4489b8096d0SSteve Yin OUString* pArray = aRet.getArray(); 4499b8096d0SSteve Yin pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible ) ); 4509b8096d0SSteve Yin pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext ) ); 4519b8096d0SSteve Yin pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) ); 4529b8096d0SSteve Yin // pArray[3] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleTable) ); 4539b8096d0SSteve Yin return aRet; 4549b8096d0SSteve Yin } 4559b8096d0SSteve Yin 4569b8096d0SSteve Yin // ----------------------------------------------------------------------------- 4579b8096d0SSteve Yin // XAccessibleSelection 4589b8096d0SSteve Yin // ----------------------------------------------------------------------------- 4599b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::selectAccessibleChild( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException) 4609b8096d0SSteve Yin { 4619b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 4629b8096d0SSteve Yin IsValid(); 4639b8096d0SSteve Yin 4649b8096d0SSteve Yin if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) 4659b8096d0SSteve Yin throw lang::IndexOutOfBoundsException(); 4669b8096d0SSteve Yin 4679b8096d0SSteve Yin long nIndex = pPixelCtl->ShowPosition(pPixelCtl->IndexToPoint(nChildIndex)); 4689b8096d0SSteve Yin NotifyChild(nIndex,sal_True,sal_False); 4699b8096d0SSteve Yin } 4709b8096d0SSteve Yin // ----------------------------------------------------------------------------- 4719b8096d0SSteve Yin sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException) 4729b8096d0SSteve Yin { 4739b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 4749b8096d0SSteve Yin 4759b8096d0SSteve Yin IsValid(); 4769b8096d0SSteve Yin 4779b8096d0SSteve Yin return pPixelCtl->GetFoucsPosIndex() == nChildIndex; 4789b8096d0SSteve Yin } 4799b8096d0SSteve Yin // ----------------------------------------------------------------------------- 4809b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::clearAccessibleSelection( ) throw (RuntimeException) 4819b8096d0SSteve Yin { 4829b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 4839b8096d0SSteve Yin 4849b8096d0SSteve Yin IsValid(); 4859b8096d0SSteve Yin 4869b8096d0SSteve Yin } 4879b8096d0SSteve Yin // ----------------------------------------------------------------------------- 4889b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::selectAllAccessibleChildren( ) throw (RuntimeException) 4899b8096d0SSteve Yin { 4909b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 4919b8096d0SSteve Yin 4929b8096d0SSteve Yin IsValid(); 4939b8096d0SSteve Yin 4949b8096d0SSteve Yin } 4959b8096d0SSteve Yin // ----------------------------------------------------------------------------- 4969b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChildCount( ) throw (RuntimeException) 4979b8096d0SSteve Yin { 4989b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 4999b8096d0SSteve Yin 5009b8096d0SSteve Yin IsValid(); 5019b8096d0SSteve Yin 5029b8096d0SSteve Yin return 1; 5039b8096d0SSteve Yin } 5049b8096d0SSteve Yin // ----------------------------------------------------------------------------- 5059b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException) 5069b8096d0SSteve Yin { 5079b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 5089b8096d0SSteve Yin 5099b8096d0SSteve Yin IsValid(); 5109b8096d0SSteve Yin 5119b8096d0SSteve Yin if ( nSelectedChildIndex >= 1) 5129b8096d0SSteve Yin throw lang::IndexOutOfBoundsException(); 5139b8096d0SSteve Yin 5149b8096d0SSteve Yin uno::Reference< XAccessible > xChild; 5159b8096d0SSteve Yin if(pPixelCtl) 5169b8096d0SSteve Yin { 5179b8096d0SSteve Yin if(m_xCurChild.is()) 5189b8096d0SSteve Yin { 5199b8096d0SSteve Yin xChild = m_xCurChild; 5209b8096d0SSteve Yin } 5219b8096d0SSteve Yin } 5229b8096d0SSteve Yin return xChild; 5239b8096d0SSteve Yin } 5249b8096d0SSteve Yin // ----------------------------------------------------------------------------- 5259b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::deselectAccessibleChild( sal_Int32 ) throw (lang::IndexOutOfBoundsException, RuntimeException) 5269b8096d0SSteve Yin { 5279b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 5289b8096d0SSteve Yin 5299b8096d0SSteve Yin IsValid(); 5309b8096d0SSteve Yin 5319b8096d0SSteve Yin 5329b8096d0SSteve Yin } 5339b8096d0SSteve Yin 5349b8096d0SSteve Yin // Added by lq 5359b8096d0SSteve Yin void SvxPixelCtlAccessible::ensureIsAlive() const 5369b8096d0SSteve Yin throw ( lang::DisposedException ) 5379b8096d0SSteve Yin { 5389b8096d0SSteve Yin if( !IsAlive() ) 5399b8096d0SSteve Yin throw lang::DisposedException(); 5409b8096d0SSteve Yin } 5419b8096d0SSteve Yin 5429b8096d0SSteve Yin void SvxPixelCtlAccessible::ensureIsValidRow( sal_Int32 nRow ) 5439b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException ) 5449b8096d0SSteve Yin { 5459b8096d0SSteve Yin if( nRow >= pPixelCtl->GetHeight() || nRow <0) 5469b8096d0SSteve Yin throw lang::IndexOutOfBoundsException( 5479b8096d0SSteve Yin OUString( RTL_CONSTASCII_USTRINGPARAM( "row index is invalid" ) ), *this ); 5489b8096d0SSteve Yin } 5499b8096d0SSteve Yin 5509b8096d0SSteve Yin void SvxPixelCtlAccessible::ensureIsValidColumn( sal_Int32 nColumn ) 5519b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException ) 5529b8096d0SSteve Yin { 5539b8096d0SSteve Yin if( nColumn >= pPixelCtl->GetWidth() || nColumn <0 ) 5549b8096d0SSteve Yin throw lang::IndexOutOfBoundsException( 5559b8096d0SSteve Yin OUString( RTL_CONSTASCII_USTRINGPARAM("column index is invalid") ), *this ); 5569b8096d0SSteve Yin } 5579b8096d0SSteve Yin 5589b8096d0SSteve Yin void SvxPixelCtlAccessible::ensureIsValidAddress( 5599b8096d0SSteve Yin sal_Int32 nRow, sal_Int32 nColumn ) 5609b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException ) 5619b8096d0SSteve Yin { 5629b8096d0SSteve Yin ensureIsValidRow( nRow ); 5639b8096d0SSteve Yin ensureIsValidColumn( nColumn ); 5649b8096d0SSteve Yin } 5659b8096d0SSteve Yin 5669b8096d0SSteve Yin void SvxPixelCtlAccessible::ensureIsValidIndex( sal_Int32 nChildIndex ) 5679b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException ) 5689b8096d0SSteve Yin { 5699b8096d0SSteve Yin if( nChildIndex >= pPixelCtl->GetSquares()) 5709b8096d0SSteve Yin throw lang::IndexOutOfBoundsException( 5719b8096d0SSteve Yin OUString( RTL_CONSTASCII_USTRINGPARAM("child index is invalid") ), *this ); 5729b8096d0SSteve Yin } 5739b8096d0SSteve Yin 5749b8096d0SSteve Yin // XAccessibleTable ----------------------------------------------------------- 5759b8096d0SSteve Yin /* 5769b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleRowCount() 5779b8096d0SSteve Yin throw ( uno::RuntimeException ) 5789b8096d0SSteve Yin { 5799b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 5809b8096d0SSteve Yin ensureIsAlive(); 5819b8096d0SSteve Yin return pPixelCtl->GetLineCount(); 5829b8096d0SSteve Yin } 5839b8096d0SSteve Yin 5849b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnCount() 5859b8096d0SSteve Yin throw ( uno::RuntimeException ) 5869b8096d0SSteve Yin { 5879b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 5889b8096d0SSteve Yin ensureIsAlive(); 5899b8096d0SSteve Yin return pPixelCtl->GetLineCount(); 5909b8096d0SSteve Yin } 5919b8096d0SSteve Yin 5929b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleRowExtentAt( 5939b8096d0SSteve Yin sal_Int32 nRow, sal_Int32 nColumn ) 5949b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 5959b8096d0SSteve Yin { 5969b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 5979b8096d0SSteve Yin ensureIsAlive(); 5989b8096d0SSteve Yin return 1; // merged cells not supported 5999b8096d0SSteve Yin } 6009b8096d0SSteve Yin 6019b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnExtentAt( 6029b8096d0SSteve Yin sal_Int32 nRow, sal_Int32 nColumn ) 6039b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 6049b8096d0SSteve Yin { 6059b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 6069b8096d0SSteve Yin ensureIsAlive(); 6079b8096d0SSteve Yin return 1; // merged cells not supported 6089b8096d0SSteve Yin } 6099b8096d0SSteve Yin 6109b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleCaption() 6119b8096d0SSteve Yin throw ( uno::RuntimeException ) 6129b8096d0SSteve Yin { 6139b8096d0SSteve Yin uno::Reference< XAccessible > xAccessble; 6149b8096d0SSteve Yin ensureIsAlive(); 6159b8096d0SSteve Yin return xAccessble; // not supported 6169b8096d0SSteve Yin } 6179b8096d0SSteve Yin 6189b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleSummary() 6199b8096d0SSteve Yin throw ( uno::RuntimeException ) 6209b8096d0SSteve Yin { 6219b8096d0SSteve Yin uno::Reference< XAccessible > xAccessble; 6229b8096d0SSteve Yin ensureIsAlive(); 6239b8096d0SSteve Yin return xAccessble; // not supported 6249b8096d0SSteve Yin } 6259b8096d0SSteve Yin 6269b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleIndex( 6279b8096d0SSteve Yin sal_Int32 nRow, sal_Int32 nColumn ) 6289b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 6299b8096d0SSteve Yin { 6309b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 6319b8096d0SSteve Yin ensureIsAlive(); 6329b8096d0SSteve Yin ensureIsValidAddress(nRow,nColumn); 6339b8096d0SSteve Yin return nRow + nColumn * pPixelCtl->GetLineCount() ; 6349b8096d0SSteve Yin } 6359b8096d0SSteve Yin 6369b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleRow( sal_Int32 nChildIndex ) 6379b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 6389b8096d0SSteve Yin { 6399b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 6409b8096d0SSteve Yin ensureIsAlive(); 6419b8096d0SSteve Yin ensureIsValidIndex( nChildIndex ); 6429b8096d0SSteve Yin return nChildIndex/pPixelCtl->GetLineCount(); 6439b8096d0SSteve Yin } 6449b8096d0SSteve Yin 6459b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleColumn( sal_Int32 nChildIndex ) 6469b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 6479b8096d0SSteve Yin { 6489b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 6499b8096d0SSteve Yin ensureIsAlive(); 6509b8096d0SSteve Yin ensureIsValidIndex( nChildIndex ); 6519b8096d0SSteve Yin return nChildIndex%pPixelCtl->GetLineCount(); 6529b8096d0SSteve Yin } 6539b8096d0SSteve Yin 6549b8096d0SSteve Yin ::rtl::OUString SAL_CALL SvxPixelCtlAccessible::getAccessibleRowDescription( sal_Int32 nRow ) 6559b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 6569b8096d0SSteve Yin { 6579b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 6589b8096d0SSteve Yin ensureIsAlive(); 6599b8096d0SSteve Yin ensureIsValidRow( nRow ); 6609b8096d0SSteve Yin return ::rtl::OUString::createFromAscii (""); 6619b8096d0SSteve Yin } 6629b8096d0SSteve Yin 6639b8096d0SSteve Yin ::rtl::OUString SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnDescription( sal_Int32 nColumn ) 6649b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 6659b8096d0SSteve Yin { 6669b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 6679b8096d0SSteve Yin ensureIsAlive(); 6689b8096d0SSteve Yin ensureIsValidColumn( nColumn ); 6699b8096d0SSteve Yin return ::rtl::OUString::createFromAscii (""); 6709b8096d0SSteve Yin } 6719b8096d0SSteve Yin 6729b8096d0SSteve Yin uno::Reference< XAccessibleTable > SAL_CALL SvxPixelCtlAccessible::getAccessibleRowHeaders() 6739b8096d0SSteve Yin throw ( uno::RuntimeException ) 6749b8096d0SSteve Yin { 6759b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 6769b8096d0SSteve Yin uno::Reference< XAccessibleTable > xAccessble; 6779b8096d0SSteve Yin ensureIsAlive(); 6789b8096d0SSteve Yin return xAccessble; 6799b8096d0SSteve Yin } 6809b8096d0SSteve Yin 6819b8096d0SSteve Yin uno::Reference< XAccessibleTable > SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnHeaders() 6829b8096d0SSteve Yin throw ( uno::RuntimeException ) 6839b8096d0SSteve Yin { 6849b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 6859b8096d0SSteve Yin uno::Reference< XAccessibleTable > xAccessble; 6869b8096d0SSteve Yin ensureIsAlive(); 6879b8096d0SSteve Yin return xAccessble; 6889b8096d0SSteve Yin } 6899b8096d0SSteve Yin 6909b8096d0SSteve Yin Sequence< sal_Int32 > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleRows() 6919b8096d0SSteve Yin throw ( uno::RuntimeException ) 6929b8096d0SSteve Yin { 6939b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 6949b8096d0SSteve Yin Sequence< sal_Int32 > accRows; 6959b8096d0SSteve Yin ensureIsAlive(); 6969b8096d0SSteve Yin 6979b8096d0SSteve Yin return accRows; 6989b8096d0SSteve Yin } 6999b8096d0SSteve Yin 7009b8096d0SSteve Yin Sequence< sal_Int32 > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleColumns() 7019b8096d0SSteve Yin throw ( uno::RuntimeException ) 7029b8096d0SSteve Yin { 7039b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 7049b8096d0SSteve Yin Sequence< sal_Int32 > accColumns; 7059b8096d0SSteve Yin ensureIsAlive(); 7069b8096d0SSteve Yin 7079b8096d0SSteve Yin return accColumns; 7089b8096d0SSteve Yin } 7099b8096d0SSteve Yin 7109b8096d0SSteve Yin sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleRowSelected( sal_Int32 nRow ) 7119b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 7129b8096d0SSteve Yin { 7139b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 7149b8096d0SSteve Yin ensureIsAlive(); 7159b8096d0SSteve Yin ensureIsValidRow( nRow ); 7169b8096d0SSteve Yin return sal_False; 7179b8096d0SSteve Yin } 7189b8096d0SSteve Yin 7199b8096d0SSteve Yin sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleColumnSelected( sal_Int32 nColumn ) 7209b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 7219b8096d0SSteve Yin { 7229b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 7239b8096d0SSteve Yin ensureIsAlive(); 7249b8096d0SSteve Yin ensureIsValidColumn( nColumn ); 7259b8096d0SSteve Yin return sal_False; 7269b8096d0SSteve Yin } 7279b8096d0SSteve Yin 7289b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleCellAt( 7299b8096d0SSteve Yin sal_Int32 nRow, sal_Int32 nColumn ) 7309b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 7319b8096d0SSteve Yin { 7329b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 7339b8096d0SSteve Yin ensureIsAlive(); 7349b8096d0SSteve Yin ensureIsValidAddress( nRow, nColumn ); 7359b8096d0SSteve Yin return getAccessibleChild(nRow*pPixelCtl->GetLineCount()+nColumn); 7369b8096d0SSteve Yin } 7379b8096d0SSteve Yin 7389b8096d0SSteve Yin sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleSelected( 7399b8096d0SSteve Yin sal_Int32 nRow, sal_Int32 nColumn ) 7409b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 7419b8096d0SSteve Yin { 7429b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 7439b8096d0SSteve Yin ensureIsAlive(); 7449b8096d0SSteve Yin ensureIsValidAddress( nRow, nColumn ); 7459b8096d0SSteve Yin return isAccessibleChildSelected(nRow*pPixelCtl->GetLineCount()+nColumn); 7469b8096d0SSteve Yin } 7479b8096d0SSteve Yin // Added by lq end 7489b8096d0SSteve Yin */ 7499b8096d0SSteve Yin 7509b8096d0SSteve Yin //XAccessibleEventBroadcaster 7519b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw( RuntimeException ) 7529b8096d0SSteve Yin { 7539b8096d0SSteve Yin if (xListener.is()) 7549b8096d0SSteve Yin { 7559b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 7569b8096d0SSteve Yin if (!mnClientId) 7579b8096d0SSteve Yin mnClientId = comphelper::AccessibleEventNotifier::registerClient( ); 7589b8096d0SSteve Yin comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener ); 7599b8096d0SSteve Yin } 7609b8096d0SSteve Yin } 7619b8096d0SSteve Yin 7629b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) 7639b8096d0SSteve Yin throw( RuntimeException ) 7649b8096d0SSteve Yin { 7659b8096d0SSteve Yin if (xListener.is()) 7669b8096d0SSteve Yin { 7679b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 7689b8096d0SSteve Yin 7699b8096d0SSteve Yin sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ); 7709b8096d0SSteve Yin if ( !nListenerCount ) 7719b8096d0SSteve Yin { 7729b8096d0SSteve Yin comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); 7739b8096d0SSteve Yin mnClientId = 0; 7749b8096d0SSteve Yin } 7759b8096d0SSteve Yin } 7769b8096d0SSteve Yin } 7779b8096d0SSteve Yin void SvxPixelCtlAccessible::CommitChange( const AccessibleEventObject& rEvent ) 7789b8096d0SSteve Yin { 7799b8096d0SSteve Yin if (mnClientId) 7809b8096d0SSteve Yin comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent ); 7819b8096d0SSteve Yin } 7829b8096d0SSteve Yin 7839b8096d0SSteve Yin //Solution:Add the event handling method 7849b8096d0SSteve Yin void SvxPixelCtlAccessible::FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew) 7859b8096d0SSteve Yin { 7869b8096d0SSteve Yin const uno::Reference< XInterface > xSource( *this ); 7879b8096d0SSteve Yin CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) ); 7889b8096d0SSteve Yin } 7899b8096d0SSteve Yin 7909b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::disposing() 7919b8096d0SSteve Yin { 7929b8096d0SSteve Yin if( !rBHelper.bDisposed ) 7939b8096d0SSteve Yin { 7949b8096d0SSteve Yin { 7959b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 7969b8096d0SSteve Yin if ( mnClientId ) 7979b8096d0SSteve Yin { 7989b8096d0SSteve Yin comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); 7999b8096d0SSteve Yin mnClientId = 0; 8009b8096d0SSteve Yin } 8019b8096d0SSteve Yin } 8029b8096d0SSteve Yin //mxParent = uno::Reference< XAccessible >(); 8039b8096d0SSteve Yin 8049b8096d0SSteve Yin } 8059b8096d0SSteve Yin } 8069b8096d0SSteve Yin void SvxPixelCtlAccessible::Invalidate() 8079b8096d0SSteve Yin { 8089b8096d0SSteve Yin pPixelCtl = 0; 8099b8096d0SSteve Yin } 8109b8096d0SSteve Yin void SvxPixelCtlAccessible::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException ) 8119b8096d0SSteve Yin { 8129b8096d0SSteve Yin if( IsNotAlive() ) 8139b8096d0SSteve Yin throw lang::DisposedException(); 8149b8096d0SSteve Yin } 8159b8096d0SSteve Yin void SvxPixelCtlAccessible::IsValid() throw (uno::RuntimeException) 8169b8096d0SSteve Yin { 8179b8096d0SSteve Yin if(!pPixelCtl) 8189b8096d0SSteve Yin throw uno::RuntimeException(); 8199b8096d0SSteve Yin } 8209b8096d0SSteve Yin 8219b8096d0SSteve Yin 8229b8096d0SSteve Yin void SvxPixelCtlAccessible::NotifyChild(long nIndex,sal_Bool bSelect ,sal_Bool bCheck) 8239b8096d0SSteve Yin { 8249b8096d0SSteve Yin DBG_ASSERT( !(!bSelect && !bCheck),"" );//non is false 8259b8096d0SSteve Yin 8269b8096d0SSteve Yin SvxPixelCtlAccessibleChild *pChild= NULL; 8279b8096d0SSteve Yin 8289b8096d0SSteve Yin if (m_xCurChild.is()) 8299b8096d0SSteve Yin { 8309b8096d0SSteve Yin pChild= static_cast<SvxPixelCtlAccessibleChild*>(m_xCurChild.get()); 8319b8096d0SSteve Yin DBG_ASSERT(pChild,"Child Must be Valid"); 8329b8096d0SSteve Yin if (pChild->getAccessibleIndexInParent() == nIndex ) 8339b8096d0SSteve Yin { 8349b8096d0SSteve Yin if (bSelect) 8359b8096d0SSteve Yin { 8369b8096d0SSteve Yin pChild->SelectChild(sal_True); 8379b8096d0SSteve Yin } 8389b8096d0SSteve Yin if (bCheck) 8399b8096d0SSteve Yin { 8409b8096d0SSteve Yin pChild->ChangePixelColorOrBG(sal_Bool(pPixelCtl->GetBitmapPixel(sal_uInt16(nIndex)))); 8419b8096d0SSteve Yin pChild->CheckChild(); 8429b8096d0SSteve Yin } 8439b8096d0SSteve Yin return ; 8449b8096d0SSteve Yin } 8459b8096d0SSteve Yin } 8469b8096d0SSteve Yin uno::Reference <XAccessible> xNewChild =CreateChild(nIndex, pPixelCtl->IndexToPoint(nIndex)); 8479b8096d0SSteve Yin SvxPixelCtlAccessibleChild *pNewChild= static_cast<SvxPixelCtlAccessibleChild*>(xNewChild.get()); 8489b8096d0SSteve Yin DBG_ASSERT(pNewChild,"Child Must be Valid"); 8499b8096d0SSteve Yin 8509b8096d0SSteve Yin Any aNewValue,aOldValue; 8519b8096d0SSteve Yin aNewValue<<= xNewChild; 8529b8096d0SSteve Yin FireAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, 8539b8096d0SSteve Yin aOldValue, 8549b8096d0SSteve Yin aNewValue ); 8559b8096d0SSteve Yin 8569b8096d0SSteve Yin if (bSelect) 8579b8096d0SSteve Yin { 8589b8096d0SSteve Yin if (pChild) 8599b8096d0SSteve Yin { 8609b8096d0SSteve Yin pChild->SelectChild(sal_False); 8619b8096d0SSteve Yin } 8629b8096d0SSteve Yin pNewChild->SelectChild(sal_True); 8639b8096d0SSteve Yin } 8649b8096d0SSteve Yin if (bCheck) 8659b8096d0SSteve Yin { 8669b8096d0SSteve Yin pNewChild->CheckChild(); 8679b8096d0SSteve Yin } 8689b8096d0SSteve Yin m_xCurChild= xNewChild; 8699b8096d0SSteve Yin 8709b8096d0SSteve Yin 8719b8096d0SSteve Yin } 8729b8096d0SSteve Yin 8739b8096d0SSteve Yin uno::Reference<XAccessible> SvxPixelCtlAccessible::CreateChild (long nIndex,Point mPoint) 8749b8096d0SSteve Yin { 8759b8096d0SSteve Yin long nX = mPoint.X(); 8769b8096d0SSteve Yin long nY = mPoint.Y(); 8779b8096d0SSteve Yin if( Application::GetSettings().GetLayoutRTL()) 8789b8096d0SSteve Yin { 8799b8096d0SSteve Yin nX = (sal_uInt16) pPixelCtl->GetWidth() - 1 - nX; 8809b8096d0SSteve Yin } 8819b8096d0SSteve Yin 8829b8096d0SSteve Yin sal_Bool bPixelColorOrBG= sal_Bool(pPixelCtl->GetBitmapPixel(sal_uInt16(nIndex))); 8839b8096d0SSteve Yin Size size(pPixelCtl->GetWidth() / pPixelCtl->GetLineCount(),pPixelCtl->GetHeight() / pPixelCtl->GetLineCount()); 8849b8096d0SSteve Yin uno::Reference<XAccessible> xChild; 8859b8096d0SSteve Yin xChild = new SvxPixelCtlAccessibleChild(pPixelCtl, 8869b8096d0SSteve Yin bPixelColorOrBG, 8879b8096d0SSteve Yin Point(nX,nY), 8889b8096d0SSteve Yin Rectangle(mPoint,size), 8899b8096d0SSteve Yin this, 8909b8096d0SSteve Yin nIndex); 8919b8096d0SSteve Yin 8929b8096d0SSteve Yin return xChild; 8939b8096d0SSteve Yin } 8949b8096d0SSteve Yin 8959b8096d0SSteve Yin 8969b8096d0SSteve Yin void SvxPixelCtlAccessible::LoseFocus() 8979b8096d0SSteve Yin { 8989b8096d0SSteve Yin m_xCurChild = uno::Reference< XAccessible >() ; 8999b8096d0SSteve Yin } 9009b8096d0SSteve Yin 9019b8096d0SSteve Yin void SvxPixelCtlAccessibleChild::CheckChild() 9029b8096d0SSteve Yin { 9039b8096d0SSteve Yin Any aChecked; 9049b8096d0SSteve Yin aChecked <<= AccessibleStateType::CHECKED; 9059b8096d0SSteve Yin 9069b8096d0SSteve Yin if (m_bPixelColorOrBG)//Current Child State 9079b8096d0SSteve Yin { 9089b8096d0SSteve Yin FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, 9099b8096d0SSteve Yin Any(), 9109b8096d0SSteve Yin aChecked); 9119b8096d0SSteve Yin } 9129b8096d0SSteve Yin else 9139b8096d0SSteve Yin { 9149b8096d0SSteve Yin FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, 9159b8096d0SSteve Yin aChecked, 9169b8096d0SSteve Yin Any() ); 9179b8096d0SSteve Yin } 9189b8096d0SSteve Yin } 9199b8096d0SSteve Yin 9209b8096d0SSteve Yin void SvxPixelCtlAccessibleChild::SelectChild( sal_Bool bSelect) 9219b8096d0SSteve Yin { 9229b8096d0SSteve Yin Any aSelected; 9239b8096d0SSteve Yin aSelected <<= AccessibleStateType::SELECTED; 9249b8096d0SSteve Yin 9259b8096d0SSteve Yin if (bSelect) 9269b8096d0SSteve Yin { 9279b8096d0SSteve Yin FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, 9289b8096d0SSteve Yin Any(), 9299b8096d0SSteve Yin aSelected); 9309b8096d0SSteve Yin } 9319b8096d0SSteve Yin else 9329b8096d0SSteve Yin { 9339b8096d0SSteve Yin FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, 9349b8096d0SSteve Yin aSelected, 9359b8096d0SSteve Yin Any()); 9369b8096d0SSteve Yin } 9379b8096d0SSteve Yin } 9389b8096d0SSteve Yin void SvxPixelCtlAccessibleChild::FireAccessibleEvent ( 9399b8096d0SSteve Yin short nEventId, 9409b8096d0SSteve Yin const ::com::sun::star::uno::Any& rOld, 9419b8096d0SSteve Yin const ::com::sun::star::uno::Any& rNew) 9429b8096d0SSteve Yin { 9439b8096d0SSteve Yin const uno::Reference< XInterface > xSource( *this ); 9449b8096d0SSteve Yin CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) ); 9459b8096d0SSteve Yin } 9469b8096d0SSteve Yin 9479b8096d0SSteve Yin 9489b8096d0SSteve Yin 9499b8096d0SSteve Yin DBG_NAME( SvxPixelCtlAccessibleChild ) 9509b8096d0SSteve Yin 9519b8096d0SSteve Yin 9529b8096d0SSteve Yin SvxPixelCtlAccessibleChild::SvxPixelCtlAccessibleChild( 9539b8096d0SSteve Yin SvxPixelCtl* rWindow, 9549b8096d0SSteve Yin sal_Bool bPixelColorOrBG, 9559b8096d0SSteve Yin const Point &aPoint, 9569b8096d0SSteve Yin const Rectangle& rBoundingBox, 9579b8096d0SSteve Yin const uno::Reference<XAccessible>& rxParent, 9589b8096d0SSteve Yin long nIndexInParent ) : 9599b8096d0SSteve Yin SvxPixelCtlAccessibleChild_BASE( m_aMutex ), 9609b8096d0SSteve Yin mrParentWindow( rWindow ), 9619b8096d0SSteve Yin mxParent(rxParent), 9629b8096d0SSteve Yin m_bPixelColorOrBG(bPixelColorOrBG), 9639b8096d0SSteve Yin maPoint(aPoint), 9649b8096d0SSteve Yin mpBoundingBox( new Rectangle( rBoundingBox ) ), 9659b8096d0SSteve Yin mnIndexInParent( nIndexInParent ), 9669b8096d0SSteve Yin mnClientId( 0 ) 9679b8096d0SSteve Yin { 9689b8096d0SSteve Yin DBG_CTOR( SvxPixelCtlAccessibleChild, NULL ); 9699b8096d0SSteve Yin } 9709b8096d0SSteve Yin 9719b8096d0SSteve Yin 9729b8096d0SSteve Yin SvxPixelCtlAccessibleChild::~SvxPixelCtlAccessibleChild() 9739b8096d0SSteve Yin { 9749b8096d0SSteve Yin DBG_DTOR( SvxPixelCtlAccessibleChild, NULL ); 9759b8096d0SSteve Yin 9769b8096d0SSteve Yin if( IsAlive() ) 9779b8096d0SSteve Yin { 9789b8096d0SSteve Yin osl_incrementInterlockedCount( &m_refCount ); 9799b8096d0SSteve Yin dispose(); // set mpRepr = NULL & release all childs 9809b8096d0SSteve Yin } 9819b8096d0SSteve Yin } 9829b8096d0SSteve Yin 9839b8096d0SSteve Yin //===== XAccessible ========================================================= 9849b8096d0SSteve Yin 9859b8096d0SSteve Yin uno::Reference< XAccessibleContext> SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleContext( void ) throw( RuntimeException ) 9869b8096d0SSteve Yin { 9879b8096d0SSteve Yin return this; 9889b8096d0SSteve Yin } 9899b8096d0SSteve Yin 9909b8096d0SSteve Yin //===== XAccessibleComponent ================================================ 9919b8096d0SSteve Yin 9929b8096d0SSteve Yin sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::containsPoint( const awt::Point& rPoint ) throw( RuntimeException ) 9939b8096d0SSteve Yin { 9949b8096d0SSteve Yin // no guard -> done in getBounds() 9959b8096d0SSteve Yin // return GetBoundingBox().IsInside( VCLPoint( rPoint ) ); 9969b8096d0SSteve Yin return Rectangle( Point( 0, 0 ), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); 9979b8096d0SSteve Yin } 9989b8096d0SSteve Yin 9999b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleAtPoint( const awt::Point& ) throw( RuntimeException ) 10009b8096d0SSteve Yin { 10019b8096d0SSteve Yin return uno::Reference< XAccessible >(); 10029b8096d0SSteve Yin } 10039b8096d0SSteve Yin 10049b8096d0SSteve Yin awt::Rectangle SAL_CALL SvxPixelCtlAccessibleChild::getBounds() throw( RuntimeException ) 10059b8096d0SSteve Yin { 10069b8096d0SSteve Yin // no guard -> done in getBoundingBox() 10079b8096d0SSteve Yin //Modified by lq, 09/26 10089b8096d0SSteve Yin //return AWTRectangle( GetBoundingBox() ); 10099b8096d0SSteve Yin awt::Rectangle rect = AWTRectangle( GetBoundingBox() ); 10109b8096d0SSteve Yin rect.X = rect.X + mrParentWindow->GetClientWindowExtentsRelative(NULL).Left()-mrParentWindow->GetWindowExtentsRelative(NULL).Left(); 10119b8096d0SSteve Yin rect.Y = rect.Y + mrParentWindow->GetClientWindowExtentsRelative(NULL).Top()-mrParentWindow->GetWindowExtentsRelative(NULL).Top(); 10129b8096d0SSteve Yin return rect; 10139b8096d0SSteve Yin // End 10149b8096d0SSteve Yin } 10159b8096d0SSteve Yin 10169b8096d0SSteve Yin awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocation() throw( RuntimeException ) 10179b8096d0SSteve Yin { 10189b8096d0SSteve Yin // no guard -> done in getBoundingBox() 10199b8096d0SSteve Yin return AWTPoint( GetBoundingBox().TopLeft() ); 10209b8096d0SSteve Yin } 10219b8096d0SSteve Yin 10229b8096d0SSteve Yin awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocationOnScreen() throw( RuntimeException ) 10239b8096d0SSteve Yin { 10249b8096d0SSteve Yin // no guard -> done in getBoundingBoxOnScreen() 10259b8096d0SSteve Yin return AWTPoint( GetBoundingBoxOnScreen().TopLeft() ); 10269b8096d0SSteve Yin } 10279b8096d0SSteve Yin 10289b8096d0SSteve Yin awt::Size SAL_CALL SvxPixelCtlAccessibleChild::getSize() throw( RuntimeException ) 10299b8096d0SSteve Yin { 10309b8096d0SSteve Yin // no guard -> done in getBoundingBox() 10319b8096d0SSteve Yin return AWTSize( GetBoundingBox().GetSize() ); 10329b8096d0SSteve Yin } 10339b8096d0SSteve Yin 10349b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessibleChild::grabFocus() throw( RuntimeException ) 10359b8096d0SSteve Yin { 10369b8096d0SSteve Yin } 10379b8096d0SSteve Yin 10389b8096d0SSteve Yin sal_Int32 SvxPixelCtlAccessibleChild::getForeground( ) 10399b8096d0SSteve Yin throw (::com::sun::star::uno::RuntimeException) 10409b8096d0SSteve Yin { 10419b8096d0SSteve Yin //::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 10429b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 10439b8096d0SSteve Yin ThrowExceptionIfNotAlive(); 10449b8096d0SSteve Yin return mrParentWindow->GetControlForeground().GetColor(); 10459b8096d0SSteve Yin } 10469b8096d0SSteve Yin sal_Int32 SvxPixelCtlAccessibleChild::getBackground( ) 10479b8096d0SSteve Yin throw (::com::sun::star::uno::RuntimeException) 10489b8096d0SSteve Yin { 10499b8096d0SSteve Yin //::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 10509b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 10519b8096d0SSteve Yin 10529b8096d0SSteve Yin ThrowExceptionIfNotAlive(); 10539b8096d0SSteve Yin return mrParentWindow->GetControlBackground().GetColor(); 10549b8096d0SSteve Yin } 10559b8096d0SSteve Yin 10569b8096d0SSteve Yin //===== XAccessibleContext ================================================== 10579b8096d0SSteve Yin 10589b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleChildCount( void ) throw( RuntimeException ) 10599b8096d0SSteve Yin { 10609b8096d0SSteve Yin return 0; 10619b8096d0SSteve Yin } 10629b8096d0SSteve Yin 10639b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleChild( sal_Int32 ) throw ( RuntimeException ) 10649b8096d0SSteve Yin { 10659b8096d0SSteve Yin throw lang::IndexOutOfBoundsException(); 10669b8096d0SSteve Yin } 10679b8096d0SSteve Yin 10689b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleParent( void ) throw( RuntimeException ) 10699b8096d0SSteve Yin { 10709b8096d0SSteve Yin return mxParent; 10719b8096d0SSteve Yin } 10729b8096d0SSteve Yin 10739b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleIndexInParent( void ) throw( RuntimeException ) 10749b8096d0SSteve Yin { 10759b8096d0SSteve Yin return mnIndexInParent; 10769b8096d0SSteve Yin } 10779b8096d0SSteve Yin 10789b8096d0SSteve Yin sal_Int16 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleRole( void ) throw( RuntimeException ) 10799b8096d0SSteve Yin { 10809b8096d0SSteve Yin return AccessibleRole::CHECK_BOX; 10819b8096d0SSteve Yin } 10829b8096d0SSteve Yin 10839b8096d0SSteve Yin OUString SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleDescription( void ) throw( RuntimeException ) 10849b8096d0SSteve Yin { 10859b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 10869b8096d0SSteve Yin 10879b8096d0SSteve Yin return GetName(); 10889b8096d0SSteve Yin } 10899b8096d0SSteve Yin 10909b8096d0SSteve Yin OUString SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleName( void ) throw( RuntimeException ) 10919b8096d0SSteve Yin { 10929b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 10939b8096d0SSteve Yin return GetName(); 10949b8096d0SSteve Yin } 10959b8096d0SSteve Yin 10969b8096d0SSteve Yin /** Return empty uno::Reference to indicate that the relation set is not 10979b8096d0SSteve Yin supported. 10989b8096d0SSteve Yin */ 10999b8096d0SSteve Yin uno::Reference<XAccessibleRelationSet> SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleRelationSet( void ) throw( RuntimeException ) 11009b8096d0SSteve Yin { 11019b8096d0SSteve Yin return uno::Reference< XAccessibleRelationSet >(); 11029b8096d0SSteve Yin } 11039b8096d0SSteve Yin 11049b8096d0SSteve Yin uno::Reference< XAccessibleStateSet > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleStateSet( void ) throw( RuntimeException ) 11059b8096d0SSteve Yin { 11069b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 11079b8096d0SSteve Yin utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; 11089b8096d0SSteve Yin 11099b8096d0SSteve Yin if( IsAlive() ) 11109b8096d0SSteve Yin { 11119b8096d0SSteve Yin 11129b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::TRANSIENT ); 11139b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::ENABLED ); 11149b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::OPAQUE ); 11159b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::SELECTABLE ); 11169b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::SHOWING ); 11179b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); 11189b8096d0SSteve Yin 11199b8096d0SSteve Yin if (mrParentWindow ) 11209b8096d0SSteve Yin { 11219b8096d0SSteve Yin long nIndex = mrParentWindow->GetFoucsPosIndex(); 11229b8096d0SSteve Yin if ( nIndex == mnIndexInParent) 11239b8096d0SSteve Yin { 11249b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::SELECTED ); 11259b8096d0SSteve Yin } 11269b8096d0SSteve Yin if (mrParentWindow->GetBitmapPixel(sal_uInt16(mnIndexInParent))) 11279b8096d0SSteve Yin { 11289b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::CHECKED ); 11299b8096d0SSteve Yin } 11309b8096d0SSteve Yin } 11319b8096d0SSteve Yin } 11329b8096d0SSteve Yin else 11339b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); 11349b8096d0SSteve Yin 11359b8096d0SSteve Yin return pStateSetHelper; 11369b8096d0SSteve Yin } 11379b8096d0SSteve Yin 11389b8096d0SSteve Yin lang::Locale SAL_CALL SvxPixelCtlAccessibleChild::getLocale( void ) throw( IllegalAccessibleComponentStateException, RuntimeException ) 11399b8096d0SSteve Yin { 11409b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 11419b8096d0SSteve Yin if( mxParent.is() ) 11429b8096d0SSteve Yin { 11439b8096d0SSteve Yin uno::Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() ); 11449b8096d0SSteve Yin if( xParentContext.is() ) 11459b8096d0SSteve Yin return xParentContext->getLocale(); 11469b8096d0SSteve Yin } 11479b8096d0SSteve Yin 11489b8096d0SSteve Yin // No locale and no parent. Therefore throw exception to indicate this 11499b8096d0SSteve Yin // cluelessness. 11509b8096d0SSteve Yin throw IllegalAccessibleComponentStateException(); 11519b8096d0SSteve Yin } 11529b8096d0SSteve Yin 11539b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessibleChild::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) 11549b8096d0SSteve Yin throw( RuntimeException ) 11559b8096d0SSteve Yin { 11569b8096d0SSteve Yin if (xListener.is()) 11579b8096d0SSteve Yin { 11589b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 11599b8096d0SSteve Yin if (!mnClientId) 11609b8096d0SSteve Yin mnClientId = comphelper::AccessibleEventNotifier::registerClient( ); 11619b8096d0SSteve Yin comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener ); 11629b8096d0SSteve Yin } 11639b8096d0SSteve Yin } 11649b8096d0SSteve Yin 11659b8096d0SSteve Yin 11669b8096d0SSteve Yin 11679b8096d0SSteve Yin 11689b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessibleChild::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) 11699b8096d0SSteve Yin throw( RuntimeException ) 11709b8096d0SSteve Yin { 11719b8096d0SSteve Yin if (xListener.is()) 11729b8096d0SSteve Yin { 11739b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 11749b8096d0SSteve Yin 11759b8096d0SSteve Yin sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ); 11769b8096d0SSteve Yin if ( !nListenerCount ) 11779b8096d0SSteve Yin { 11789b8096d0SSteve Yin // no listeners anymore 11799b8096d0SSteve Yin // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), 11809b8096d0SSteve Yin // and at least to us not firing any events anymore, in case somebody calls 11819b8096d0SSteve Yin // NotifyAccessibleEvent, again 11829b8096d0SSteve Yin comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); 11839b8096d0SSteve Yin mnClientId = 0; 11849b8096d0SSteve Yin } 11859b8096d0SSteve Yin } 11869b8096d0SSteve Yin } 11879b8096d0SSteve Yin 11889b8096d0SSteve Yin 11899b8096d0SSteve Yin //===== XServiceInfo ======================================================== 11909b8096d0SSteve Yin 11919b8096d0SSteve Yin OUString SAL_CALL SvxPixelCtlAccessibleChild::getImplementationName( void ) throw( RuntimeException ) 11929b8096d0SSteve Yin { 11939b8096d0SSteve Yin return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxPixelCtlAccessibleChild" ) ); 11949b8096d0SSteve Yin } 11959b8096d0SSteve Yin 11969b8096d0SSteve Yin sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::supportsService( const OUString& rServiceName ) throw( RuntimeException ) 11979b8096d0SSteve Yin { 11989b8096d0SSteve Yin return rServiceName.equalsAsciiL( sAccessible , sizeof(sAccessible )-1 ) || 11999b8096d0SSteve Yin rServiceName.equalsAsciiL( sAccessibleContext , sizeof(sAccessibleContext )-1 ) || 12009b8096d0SSteve Yin rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 ); 12019b8096d0SSteve Yin 12029b8096d0SSteve Yin } 12039b8096d0SSteve Yin 12049b8096d0SSteve Yin Sequence< OUString > SAL_CALL SvxPixelCtlAccessibleChild::getSupportedServiceNames( void ) throw( RuntimeException ) 12059b8096d0SSteve Yin { 12069b8096d0SSteve Yin uno::Sequence< OUString > aRet(3); 12079b8096d0SSteve Yin OUString* pArray = aRet.getArray(); 12089b8096d0SSteve Yin pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible ) ); 12099b8096d0SSteve Yin pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext ) ); 12109b8096d0SSteve Yin pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) ); 12119b8096d0SSteve Yin return aRet; 12129b8096d0SSteve Yin } 12139b8096d0SSteve Yin 12149b8096d0SSteve Yin //===== internal ============================================================ 12159b8096d0SSteve Yin 12169b8096d0SSteve Yin void SvxPixelCtlAccessibleChild::CommitChange( const AccessibleEventObject& rEvent ) 12179b8096d0SSteve Yin { 12189b8096d0SSteve Yin if (mnClientId) 12199b8096d0SSteve Yin comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent ); 12209b8096d0SSteve Yin } 12219b8096d0SSteve Yin 12229b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessibleChild::disposing() 12239b8096d0SSteve Yin { 12249b8096d0SSteve Yin if( !rBHelper.bDisposed ) 12259b8096d0SSteve Yin { 12269b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 12279b8096d0SSteve Yin 12289b8096d0SSteve Yin // Send a disposing to all listeners. 12299b8096d0SSteve Yin if ( mnClientId ) 12309b8096d0SSteve Yin { 12319b8096d0SSteve Yin comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); 12329b8096d0SSteve Yin mnClientId = 0; 12339b8096d0SSteve Yin } 12349b8096d0SSteve Yin 12359b8096d0SSteve Yin mxParent = uno::Reference< XAccessible >(); 12369b8096d0SSteve Yin 12379b8096d0SSteve Yin delete mpBoundingBox; 12389b8096d0SSteve Yin } 12399b8096d0SSteve Yin } 12409b8096d0SSteve Yin 12419b8096d0SSteve Yin void SvxPixelCtlAccessibleChild::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException ) 12429b8096d0SSteve Yin { 12439b8096d0SSteve Yin if( IsNotAlive() ) 12449b8096d0SSteve Yin throw lang::DisposedException(); 12459b8096d0SSteve Yin } 12469b8096d0SSteve Yin 12479b8096d0SSteve Yin Rectangle SvxPixelCtlAccessibleChild::GetBoundingBoxOnScreen( void ) throw( RuntimeException ) 12489b8096d0SSteve Yin { 12499b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 12509b8096d0SSteve Yin 12519b8096d0SSteve Yin // no ThrowExceptionIfNotAlive() because its done in GetBoundingBox() 12529b8096d0SSteve Yin Rectangle aRect( GetBoundingBox() ); 12539b8096d0SSteve Yin 12549b8096d0SSteve Yin return Rectangle( mrParentWindow->OutputToAbsoluteScreenPixel( aRect.TopLeft() ), aRect.GetSize() ); 12559b8096d0SSteve Yin } 12569b8096d0SSteve Yin 12579b8096d0SSteve Yin Rectangle SvxPixelCtlAccessibleChild::GetBoundingBox( void ) throw( RuntimeException ) 12589b8096d0SSteve Yin { 1259*86e1cf34SPedro Giffuni // no guard necessary, because no one changes mpBoundingBox after creating it 12609b8096d0SSteve Yin ThrowExceptionIfNotAlive(); 12619b8096d0SSteve Yin 12629b8096d0SSteve Yin return *mpBoundingBox; 12639b8096d0SSteve Yin } 12649b8096d0SSteve Yin 12659b8096d0SSteve Yin ::rtl::OUString SvxPixelCtlAccessibleChild::GetName() 12669b8096d0SSteve Yin { 12679b8096d0SSteve Yin sal_Int32 nXIndex = mnIndexInParent % mrParentWindow->GetLineCount(); 12689b8096d0SSteve Yin sal_Int32 nYIndex = mnIndexInParent / mrParentWindow->GetLineCount(); 12699b8096d0SSteve Yin 12709b8096d0SSteve Yin OUString str; 12719b8096d0SSteve Yin str += OUString::createFromAscii("("); 12729b8096d0SSteve Yin str += OUString::valueOf(nXIndex); 12739b8096d0SSteve Yin str += OUString::createFromAscii(","); 12749b8096d0SSteve Yin str += OUString::valueOf(nYIndex); 12759b8096d0SSteve Yin // str += OUString::createFromAscii(","); 12769b8096d0SSteve Yin // str += OUString::valueOf(m_bPixelColorOrBG); 12779b8096d0SSteve Yin str += OUString::createFromAscii(")"); 12789b8096d0SSteve Yin return str; 12799b8096d0SSteve Yin } 1280