1*9b8096d0SSteve Yin /************************************************************** 2*9b8096d0SSteve Yin * 3*9b8096d0SSteve Yin * Licensed to the Apache Software Foundation (ASF) under one 4*9b8096d0SSteve Yin * or more contributor license agreements. See the NOTICE file 5*9b8096d0SSteve Yin * distributed with this work for additional information 6*9b8096d0SSteve Yin * regarding copyright ownership. The ASF licenses this file 7*9b8096d0SSteve Yin * to you under the Apache License, Version 2.0 (the 8*9b8096d0SSteve Yin * "License"); you may not use this file except in compliance 9*9b8096d0SSteve Yin * with the License. You may obtain a copy of the License at 10*9b8096d0SSteve Yin * 11*9b8096d0SSteve Yin * http://www.apache.org/licenses/LICENSE-2.0 12*9b8096d0SSteve Yin * 13*9b8096d0SSteve Yin * Unless required by applicable law or agreed to in writing, 14*9b8096d0SSteve Yin * software distributed under the License is distributed on an 15*9b8096d0SSteve Yin * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*9b8096d0SSteve Yin * KIND, either express or implied. See the License for the 17*9b8096d0SSteve Yin * specific language governing permissions and limitations 18*9b8096d0SSteve Yin * under the License. 19*9b8096d0SSteve Yin * 20*9b8096d0SSteve Yin *************************************************************/ 21*9b8096d0SSteve Yin 22*9b8096d0SSteve Yin 23*9b8096d0SSteve Yin // MARKER(update_precomp.py): autogen include statement, do not remove 24*9b8096d0SSteve Yin #include "precompiled_svx.hxx" 25*9b8096d0SSteve Yin 26*9b8096d0SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_ 27*9b8096d0SSteve Yin #include <com/sun/star/accessibility/AccessibleRole.hpp> 28*9b8096d0SSteve Yin #endif 29*9b8096d0SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_ 30*9b8096d0SSteve Yin #include <com/sun/star/accessibility/AccessibleEventId.hpp> 31*9b8096d0SSteve Yin #endif 32*9b8096d0SSteve Yin #ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX_ 33*9b8096d0SSteve Yin #include <unotools/accessiblestatesethelper.hxx> 34*9b8096d0SSteve Yin #endif 35*9b8096d0SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_ 36*9b8096d0SSteve Yin #include <com/sun/star/accessibility/AccessibleStateType.hpp> 37*9b8096d0SSteve Yin #endif 38*9b8096d0SSteve Yin 39*9b8096d0SSteve Yin #ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_ 40*9b8096d0SSteve Yin #include <com/sun/star/beans/PropertyChangeEvent.hpp> 41*9b8096d0SSteve Yin #endif 42*9b8096d0SSteve Yin 43*9b8096d0SSteve Yin #ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ 44*9b8096d0SSteve Yin #include <com/sun/star/awt/XWindow.hpp> 45*9b8096d0SSteve Yin #endif 46*9b8096d0SSteve Yin 47*9b8096d0SSteve Yin #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ 48*9b8096d0SSteve Yin #include <cppuhelper/typeprovider.hxx> 49*9b8096d0SSteve Yin #endif 50*9b8096d0SSteve Yin 51*9b8096d0SSteve Yin #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ 52*9b8096d0SSteve Yin #include <toolkit/helper/vclunohelper.hxx> 53*9b8096d0SSteve Yin #endif 54*9b8096d0SSteve Yin #ifndef _TOOLKIT_HELPER_CONVERT_HXX_ 55*9b8096d0SSteve Yin #include <toolkit/helper/convert.hxx> 56*9b8096d0SSteve Yin #endif 57*9b8096d0SSteve Yin 58*9b8096d0SSteve Yin #ifndef _SV_SVAPP_HXX 59*9b8096d0SSteve Yin #include <vcl/svapp.hxx> 60*9b8096d0SSteve Yin #endif 61*9b8096d0SSteve Yin 62*9b8096d0SSteve Yin #ifndef _OSL_MUTEX_HXX_ 63*9b8096d0SSteve Yin #include <osl/mutex.hxx> 64*9b8096d0SSteve Yin #endif 65*9b8096d0SSteve Yin #ifndef _RTL_UUID_H_ 66*9b8096d0SSteve Yin #include <rtl/uuid.h> 67*9b8096d0SSteve Yin #endif 68*9b8096d0SSteve Yin #ifndef _TOOLS_DEBUG_HXX 69*9b8096d0SSteve Yin #include <tools/debug.hxx> 70*9b8096d0SSteve Yin #endif 71*9b8096d0SSteve Yin #ifndef _SV_GEN_HXX 72*9b8096d0SSteve Yin #include <tools/gen.hxx> 73*9b8096d0SSteve Yin #endif 74*9b8096d0SSteve Yin 75*9b8096d0SSteve Yin #include <svx/dialogs.hrc> 76*9b8096d0SSteve Yin #include "accessibility.hrc" 77*9b8096d0SSteve Yin #include <svx/dlgctrl.hxx> 78*9b8096d0SSteve Yin 79*9b8096d0SSteve Yin #ifndef _SVX_DIALMGR_HXX 80*9b8096d0SSteve Yin #include <svx/dialmgr.hxx> 81*9b8096d0SSteve Yin #endif 82*9b8096d0SSteve Yin #ifndef COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER 83*9b8096d0SSteve Yin #include <comphelper/accessibleeventnotifier.hxx> 84*9b8096d0SSteve Yin #endif 85*9b8096d0SSteve Yin 86*9b8096d0SSteve Yin #include <unotools/accessiblerelationsethelper.hxx> 87*9b8096d0SSteve Yin 88*9b8096d0SSteve Yin #ifndef _SVXPIXELACCESSIBLECONTEXT_HXX 89*9b8096d0SSteve Yin #include "svxpixelctlaccessiblecontext.hxx" 90*9b8096d0SSteve Yin #endif 91*9b8096d0SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_ 92*9b8096d0SSteve Yin #include <com/sun/star/accessibility/AccessibleRelationType.hpp> 93*9b8096d0SSteve Yin #endif 94*9b8096d0SSteve Yin using namespace ::cppu; 95*9b8096d0SSteve Yin using namespace ::osl; 96*9b8096d0SSteve Yin using namespace ::rtl; 97*9b8096d0SSteve Yin using namespace ::com::sun::star; 98*9b8096d0SSteve Yin using namespace ::com::sun::star::uno; 99*9b8096d0SSteve Yin using namespace ::com::sun::star::accessibility; 100*9b8096d0SSteve Yin 101*9b8096d0SSteve Yin SvxPixelCtlAccessible::SvxPixelCtlAccessible( SvxPixelCtl& rControl) : 102*9b8096d0SSteve Yin SvxPixelCtlAccessible_BASE(m_aMutex), 103*9b8096d0SSteve Yin pPixelCtl(&rControl), 104*9b8096d0SSteve Yin mnClientId(0) 105*9b8096d0SSteve Yin { 106*9b8096d0SSteve Yin //FreeResource(); 107*9b8096d0SSteve Yin } 108*9b8096d0SSteve Yin 109*9b8096d0SSteve Yin SvxPixelCtlAccessible::~SvxPixelCtlAccessible() 110*9b8096d0SSteve Yin { 111*9b8096d0SSteve Yin // DBG_DTOR( SvxPixelCtlAccessible, NULL ); 112*9b8096d0SSteve Yin 113*9b8096d0SSteve Yin if( IsAlive() ) 114*9b8096d0SSteve Yin { 115*9b8096d0SSteve Yin osl_incrementInterlockedCount( &m_refCount ); 116*9b8096d0SSteve Yin dispose(); // set mpRepr = NULL & release all childs 117*9b8096d0SSteve Yin } 118*9b8096d0SSteve Yin } 119*9b8096d0SSteve Yin /*-- 04.02.2002 14:11:55--------------------------------------------------- 120*9b8096d0SSteve Yin 121*9b8096d0SSteve Yin -----------------------------------------------------------------------*/ 122*9b8096d0SSteve Yin uno::Reference< XAccessibleContext > SvxPixelCtlAccessible::getAccessibleContext( ) 123*9b8096d0SSteve Yin throw (uno::RuntimeException) 124*9b8096d0SSteve Yin { 125*9b8096d0SSteve Yin return this; 126*9b8096d0SSteve Yin } 127*9b8096d0SSteve Yin 128*9b8096d0SSteve Yin sal_Int32 SvxPixelCtlAccessible::getAccessibleChildCount( ) throw (uno::RuntimeException) 129*9b8096d0SSteve Yin { 130*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 131*9b8096d0SSteve Yin IsValid(); 132*9b8096d0SSteve Yin if(pPixelCtl) 133*9b8096d0SSteve Yin { 134*9b8096d0SSteve Yin return pPixelCtl->GetSquares(); 135*9b8096d0SSteve Yin } 136*9b8096d0SSteve Yin else 137*9b8096d0SSteve Yin return 0; 138*9b8096d0SSteve Yin } 139*9b8096d0SSteve Yin /*-- 04.02.2002 14:11:56--------------------------------------------------- 140*9b8096d0SSteve Yin 141*9b8096d0SSteve Yin -----------------------------------------------------------------------*/ 142*9b8096d0SSteve Yin uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleChild( sal_Int32 i ) 143*9b8096d0SSteve Yin throw (uno::RuntimeException) 144*9b8096d0SSteve Yin { 145*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 146*9b8096d0SSteve Yin IsValid(); 147*9b8096d0SSteve Yin if ( i < 0 || i >= getAccessibleChildCount()) 148*9b8096d0SSteve Yin throw lang::IndexOutOfBoundsException(); 149*9b8096d0SSteve Yin uno::Reference <XAccessible> xAcc; 150*9b8096d0SSteve Yin if(pPixelCtl) 151*9b8096d0SSteve Yin { 152*9b8096d0SSteve Yin return CreateChild(i, pPixelCtl->IndexToPoint(i)); 153*9b8096d0SSteve Yin } 154*9b8096d0SSteve Yin else 155*9b8096d0SSteve Yin return xAcc; 156*9b8096d0SSteve Yin /* 157*9b8096d0SSteve Yin throw lang::IndexOutOfBoundsException ( 158*9b8096d0SSteve Yin ::rtl::OUString::createFromAscii ("no child with index " + i), 159*9b8096d0SSteve Yin NULL); 160*9b8096d0SSteve Yin */ 161*9b8096d0SSteve Yin } 162*9b8096d0SSteve Yin 163*9b8096d0SSteve Yin 164*9b8096d0SSteve Yin 165*9b8096d0SSteve Yin uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleParent( ) 166*9b8096d0SSteve Yin throw (uno::RuntimeException) 167*9b8096d0SSteve Yin { 168*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 169*9b8096d0SSteve Yin IsValid(); 170*9b8096d0SSteve Yin uno::Reference< XAccessible > xRet; 171*9b8096d0SSteve Yin if(pPixelCtl) 172*9b8096d0SSteve Yin xRet = pPixelCtl->GetParent()->GetAccessible( sal_True ); 173*9b8096d0SSteve Yin return xRet; 174*9b8096d0SSteve Yin } 175*9b8096d0SSteve Yin 176*9b8096d0SSteve Yin sal_Int32 SvxPixelCtlAccessible::getAccessibleIndexInParent( ) 177*9b8096d0SSteve Yin throw (uno::RuntimeException) 178*9b8096d0SSteve Yin { 179*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 180*9b8096d0SSteve Yin IsValid(); 181*9b8096d0SSteve Yin sal_uInt16 nIdx = 0; 182*9b8096d0SSteve Yin if(pPixelCtl) 183*9b8096d0SSteve Yin { 184*9b8096d0SSteve Yin Window* pTabPage = pPixelCtl->GetParent(); 185*9b8096d0SSteve Yin sal_uInt16 nChildren = pTabPage->GetChildCount(); 186*9b8096d0SSteve Yin for(nIdx = 0; nIdx < nChildren; nIdx++) 187*9b8096d0SSteve Yin if(pTabPage->GetChild( nIdx ) == pPixelCtl) 188*9b8096d0SSteve Yin break; 189*9b8096d0SSteve Yin } 190*9b8096d0SSteve Yin return nIdx; 191*9b8096d0SSteve Yin } 192*9b8096d0SSteve Yin /*-- 04.02.2002 14:11:57--------------------------------------------------- 193*9b8096d0SSteve Yin 194*9b8096d0SSteve Yin -----------------------------------------------------------------------*/ 195*9b8096d0SSteve Yin sal_Int16 SvxPixelCtlAccessible::getAccessibleRole( ) throw (uno::RuntimeException) 196*9b8096d0SSteve Yin { 197*9b8096d0SSteve Yin return AccessibleRole::LIST; 198*9b8096d0SSteve Yin } 199*9b8096d0SSteve Yin 200*9b8096d0SSteve Yin ::rtl::OUString SvxPixelCtlAccessible::getAccessibleDescription( ) 201*9b8096d0SSteve Yin throw (uno::RuntimeException) 202*9b8096d0SSteve Yin { 203*9b8096d0SSteve Yin 204*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 205*9b8096d0SSteve Yin IsValid(); 206*9b8096d0SSteve Yin if(pPixelCtl) 207*9b8096d0SSteve Yin return pPixelCtl->GetAccessibleDescription(); 208*9b8096d0SSteve Yin else 209*9b8096d0SSteve Yin return String(); 210*9b8096d0SSteve Yin 211*9b8096d0SSteve Yin } 212*9b8096d0SSteve Yin 213*9b8096d0SSteve Yin ::rtl::OUString SvxPixelCtlAccessible::getAccessibleName( ) 214*9b8096d0SSteve Yin throw (uno::RuntimeException) 215*9b8096d0SSteve Yin { 216*9b8096d0SSteve Yin 217*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 218*9b8096d0SSteve Yin IsValid(); 219*9b8096d0SSteve Yin if(pPixelCtl) 220*9b8096d0SSteve Yin return pPixelCtl->GetAccessibleName(); 221*9b8096d0SSteve Yin else 222*9b8096d0SSteve Yin return String(); 223*9b8096d0SSteve Yin 224*9b8096d0SSteve Yin } 225*9b8096d0SSteve Yin 226*9b8096d0SSteve Yin uno::Reference< XAccessibleRelationSet > SvxPixelCtlAccessible::getAccessibleRelationSet( ) 227*9b8096d0SSteve Yin throw (uno::RuntimeException) 228*9b8096d0SSteve Yin { 229*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 230*9b8096d0SSteve Yin IsValid(); 231*9b8096d0SSteve Yin Window* pWindow = (Window*)pPixelCtl; 232*9b8096d0SSteve Yin utl::AccessibleRelationSetHelper* rRelationSet = new utl::AccessibleRelationSetHelper; 233*9b8096d0SSteve Yin uno::Reference< accessibility::XAccessibleRelationSet > rSet = rRelationSet; 234*9b8096d0SSteve Yin if ( pWindow ) 235*9b8096d0SSteve Yin { 236*9b8096d0SSteve Yin Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy(); 237*9b8096d0SSteve Yin if ( pLabeledBy && pLabeledBy != pWindow ) 238*9b8096d0SSteve Yin { 239*9b8096d0SSteve Yin uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); 240*9b8096d0SSteve Yin aSequence[0] = pLabeledBy->GetAccessible(); 241*9b8096d0SSteve Yin rRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) ); 242*9b8096d0SSteve Yin } 243*9b8096d0SSteve Yin 244*9b8096d0SSteve Yin Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf(); 245*9b8096d0SSteve Yin if ( pMemberOf && pMemberOf != pWindow ) 246*9b8096d0SSteve Yin { 247*9b8096d0SSteve Yin uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); 248*9b8096d0SSteve Yin aSequence[0] = pMemberOf->GetAccessible(); 249*9b8096d0SSteve Yin rRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) ); 250*9b8096d0SSteve Yin } 251*9b8096d0SSteve Yin return rSet; 252*9b8096d0SSteve Yin } 253*9b8096d0SSteve Yin 254*9b8096d0SSteve Yin return new utl::AccessibleRelationSetHelper; 255*9b8096d0SSteve Yin } 256*9b8096d0SSteve Yin 257*9b8096d0SSteve Yin 258*9b8096d0SSteve Yin uno::Reference< XAccessibleStateSet > SvxPixelCtlAccessible::getAccessibleStateSet( ) 259*9b8096d0SSteve Yin throw (uno::RuntimeException) 260*9b8096d0SSteve Yin { 261*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 262*9b8096d0SSteve Yin utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; 263*9b8096d0SSteve Yin uno::Reference< XAccessibleStateSet > xRet = pStateSetHelper; 264*9b8096d0SSteve Yin 265*9b8096d0SSteve Yin if(!pPixelCtl) 266*9b8096d0SSteve Yin pStateSetHelper->AddState(AccessibleStateType::DEFUNC); 267*9b8096d0SSteve Yin else 268*9b8096d0SSteve Yin { 269*9b8096d0SSteve Yin const sal_Int16 aStandardStates[] = 270*9b8096d0SSteve Yin { 271*9b8096d0SSteve Yin AccessibleStateType::FOCUSABLE, 272*9b8096d0SSteve Yin AccessibleStateType::SELECTABLE, 273*9b8096d0SSteve Yin AccessibleStateType::SHOWING, 274*9b8096d0SSteve Yin AccessibleStateType::VISIBLE, 275*9b8096d0SSteve Yin AccessibleStateType::OPAQUE, 276*9b8096d0SSteve Yin 0}; 277*9b8096d0SSteve Yin 278*9b8096d0SSteve Yin sal_Int16 nState = 0; 279*9b8096d0SSteve Yin while(aStandardStates[nState]) 280*9b8096d0SSteve Yin { 281*9b8096d0SSteve Yin pStateSetHelper->AddState(aStandardStates[nState++]); 282*9b8096d0SSteve Yin } 283*9b8096d0SSteve Yin if(pPixelCtl->IsEnabled()) 284*9b8096d0SSteve Yin pStateSetHelper->AddState(AccessibleStateType::ENABLED); 285*9b8096d0SSteve Yin if(pPixelCtl->HasFocus()) 286*9b8096d0SSteve Yin pStateSetHelper->AddState(AccessibleStateType::FOCUSED); 287*9b8096d0SSteve Yin pStateSetHelper->AddState(AccessibleStateType::MANAGES_DESCENDANTS); 288*9b8096d0SSteve Yin } 289*9b8096d0SSteve Yin return xRet; 290*9b8096d0SSteve Yin } 291*9b8096d0SSteve Yin 292*9b8096d0SSteve Yin 293*9b8096d0SSteve Yin com::sun::star::lang::Locale SvxPixelCtlAccessible::getLocale( ) 294*9b8096d0SSteve Yin throw (IllegalAccessibleComponentStateException, uno::RuntimeException) 295*9b8096d0SSteve Yin { 296*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 297*9b8096d0SSteve Yin if( getAccessibleParent().is() ) 298*9b8096d0SSteve Yin { 299*9b8096d0SSteve Yin uno::Reference< XAccessibleContext > xParentContext( getAccessibleParent()->getAccessibleContext() ); 300*9b8096d0SSteve Yin if( xParentContext.is() ) 301*9b8096d0SSteve Yin return xParentContext->getLocale(); 302*9b8096d0SSteve Yin } 303*9b8096d0SSteve Yin 304*9b8096d0SSteve Yin // No locale and no parent. Therefore throw exception to indicate this 305*9b8096d0SSteve Yin // cluelessness. 306*9b8096d0SSteve Yin throw IllegalAccessibleComponentStateException(); 307*9b8096d0SSteve Yin } 308*9b8096d0SSteve Yin 309*9b8096d0SSteve Yin 310*9b8096d0SSteve Yin sal_Bool SvxPixelCtlAccessible::containsPoint( const awt::Point& aPt ) 311*9b8096d0SSteve Yin throw (uno::RuntimeException) 312*9b8096d0SSteve Yin { 313*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 314*9b8096d0SSteve Yin IsValid(); 315*9b8096d0SSteve Yin Point aPoint(aPt.X, aPt.Y); 316*9b8096d0SSteve Yin if(pPixelCtl) 317*9b8096d0SSteve Yin return (aPoint.X() >= 0) 318*9b8096d0SSteve Yin && (aPoint.X() < pPixelCtl->GetSizePixel().getWidth()) 319*9b8096d0SSteve Yin && (aPoint.Y() >= 0) 320*9b8096d0SSteve Yin && (aPoint.Y() < pPixelCtl->GetSizePixel().getHeight()); 321*9b8096d0SSteve Yin else 322*9b8096d0SSteve Yin return sal_False; 323*9b8096d0SSteve Yin } 324*9b8096d0SSteve Yin uno::Reference<XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleAtPoint ( 325*9b8096d0SSteve Yin const awt::Point& aPoint) 326*9b8096d0SSteve Yin throw (uno::RuntimeException) 327*9b8096d0SSteve Yin { 328*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 329*9b8096d0SSteve Yin ensureIsAlive(); 330*9b8096d0SSteve Yin uno::Reference <XAccessible> xAcc; 331*9b8096d0SSteve Yin 332*9b8096d0SSteve Yin Point childPoint; 333*9b8096d0SSteve Yin childPoint.X() = aPoint.X; 334*9b8096d0SSteve Yin childPoint.Y() = aPoint.Y; 335*9b8096d0SSteve Yin 336*9b8096d0SSteve Yin if(pPixelCtl) 337*9b8096d0SSteve Yin { 338*9b8096d0SSteve Yin Point pt= pPixelCtl->PixelToLogic(childPoint); 339*9b8096d0SSteve Yin long nIndex = pPixelCtl->PointToIndex(pt); 340*9b8096d0SSteve Yin return CreateChild(nIndex,pPixelCtl->IndexToPoint(nIndex)); 341*9b8096d0SSteve Yin } 342*9b8096d0SSteve Yin else 343*9b8096d0SSteve Yin return xAcc; 344*9b8096d0SSteve Yin 345*9b8096d0SSteve Yin } 346*9b8096d0SSteve Yin 347*9b8096d0SSteve Yin awt::Rectangle SvxPixelCtlAccessible::getBounds( ) throw (uno::RuntimeException) 348*9b8096d0SSteve Yin { 349*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 350*9b8096d0SSteve Yin IsValid(); 351*9b8096d0SSteve Yin Size aSz; 352*9b8096d0SSteve Yin Point aPos(0,0); 353*9b8096d0SSteve Yin awt::Rectangle aRet; 354*9b8096d0SSteve Yin if(pPixelCtl) 355*9b8096d0SSteve Yin { 356*9b8096d0SSteve Yin aSz = pPixelCtl->GetSizePixel(); 357*9b8096d0SSteve Yin aPos = pPixelCtl->GetPosPixel(); 358*9b8096d0SSteve Yin aRet.X = aPos.X(); 359*9b8096d0SSteve Yin aRet.Y = aPos.Y(); 360*9b8096d0SSteve Yin aRet.Width = aSz.Width(); 361*9b8096d0SSteve Yin aRet.Height = aSz.Height(); 362*9b8096d0SSteve Yin } 363*9b8096d0SSteve Yin return aRet; 364*9b8096d0SSteve Yin } 365*9b8096d0SSteve Yin 366*9b8096d0SSteve Yin awt::Point SvxPixelCtlAccessible::getLocation( ) throw (uno::RuntimeException) 367*9b8096d0SSteve Yin { 368*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 369*9b8096d0SSteve Yin IsValid(); 370*9b8096d0SSteve Yin Point aPos; 371*9b8096d0SSteve Yin aPos = pPixelCtl->GetPosPixel(); 372*9b8096d0SSteve Yin awt::Point aRet(aPos.X(), aPos.Y()); 373*9b8096d0SSteve Yin return aRet; 374*9b8096d0SSteve Yin } 375*9b8096d0SSteve Yin 376*9b8096d0SSteve Yin awt::Point SvxPixelCtlAccessible::getLocationOnScreen( ) throw (uno::RuntimeException) 377*9b8096d0SSteve Yin { 378*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 379*9b8096d0SSteve Yin IsValid(); 380*9b8096d0SSteve Yin Rectangle rect; 381*9b8096d0SSteve Yin rect = pPixelCtl->GetWindowExtentsRelative(NULL); 382*9b8096d0SSteve Yin awt::Point aRet(rect.Left(),rect.Top() ); 383*9b8096d0SSteve Yin return aRet; 384*9b8096d0SSteve Yin } 385*9b8096d0SSteve Yin 386*9b8096d0SSteve Yin awt::Size SvxPixelCtlAccessible::getSize( ) throw (uno::RuntimeException) 387*9b8096d0SSteve Yin { 388*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 389*9b8096d0SSteve Yin IsValid(); 390*9b8096d0SSteve Yin Size aSz; 391*9b8096d0SSteve Yin aSz = pPixelCtl->GetSizePixel(); 392*9b8096d0SSteve Yin awt::Size aRet(aSz.Width(),aSz.Height()); 393*9b8096d0SSteve Yin return aRet; 394*9b8096d0SSteve Yin } 395*9b8096d0SSteve Yin void SvxPixelCtlAccessible::grabFocus( ) throw (uno::RuntimeException) 396*9b8096d0SSteve Yin { 397*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 398*9b8096d0SSteve Yin IsValid(); 399*9b8096d0SSteve Yin if(pPixelCtl) 400*9b8096d0SSteve Yin pPixelCtl->GrabFocus(); 401*9b8096d0SSteve Yin } 402*9b8096d0SSteve Yin 403*9b8096d0SSteve Yin sal_Int32 SvxPixelCtlAccessible::getForeground( ) 404*9b8096d0SSteve Yin throw (::com::sun::star::uno::RuntimeException) 405*9b8096d0SSteve Yin { 406*9b8096d0SSteve Yin uno::Any aRet; 407*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 408*9b8096d0SSteve Yin IsValid(); 409*9b8096d0SSteve Yin return pPixelCtl->GetControlForeground().GetColor(); 410*9b8096d0SSteve Yin } 411*9b8096d0SSteve Yin 412*9b8096d0SSteve Yin sal_Int32 SvxPixelCtlAccessible::getBackground( ) 413*9b8096d0SSteve Yin throw (::com::sun::star::uno::RuntimeException) 414*9b8096d0SSteve Yin { 415*9b8096d0SSteve Yin uno::Any aRet; 416*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 417*9b8096d0SSteve Yin IsValid(); 418*9b8096d0SSteve Yin return pPixelCtl->GetControlBackground().GetColor(); 419*9b8096d0SSteve Yin } 420*9b8096d0SSteve Yin 421*9b8096d0SSteve Yin ::rtl::OUString SvxPixelCtlAccessible::getImplementationName( ) throw (uno::RuntimeException) 422*9b8096d0SSteve Yin { 423*9b8096d0SSteve Yin return rtl::OUString::createFromAscii("SvxPixelCtlAccessible"); 424*9b8096d0SSteve Yin } 425*9b8096d0SSteve Yin /*-- 04.02.2002 14:12:05--------------------------------------------------- 426*9b8096d0SSteve Yin 427*9b8096d0SSteve Yin -----------------------------------------------------------------------*/ 428*9b8096d0SSteve Yin const sal_Char sAccessible[] = "Accessible"; 429*9b8096d0SSteve Yin const sal_Char sAccessibleContext[] = "AccessibleContext"; 430*9b8096d0SSteve Yin const sal_Char sAccessibleComponent[] = "AccessibleComponent"; 431*9b8096d0SSteve Yin //const sal_Char sAccessibleTable[] = "AccessibleTable"; 432*9b8096d0SSteve Yin 433*9b8096d0SSteve Yin sal_Bool SvxPixelCtlAccessible::supportsService( const ::rtl::OUString& rServiceName ) 434*9b8096d0SSteve Yin throw (uno::RuntimeException) 435*9b8096d0SSteve Yin { 436*9b8096d0SSteve Yin return rServiceName.equalsAsciiL( sAccessible , sizeof(sAccessible )-1 ) || 437*9b8096d0SSteve Yin rServiceName.equalsAsciiL( sAccessibleContext , sizeof(sAccessibleContext )-1 ) || 438*9b8096d0SSteve Yin rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 );// || 439*9b8096d0SSteve Yin // rServiceName.equalsAsciiL( sAccessibleTable, sizeof(sAccessibleTable)-1 ); 440*9b8096d0SSteve Yin } 441*9b8096d0SSteve Yin /*-- 04.02.2002 14:12:05--------------------------------------------------- 442*9b8096d0SSteve Yin 443*9b8096d0SSteve Yin -----------------------------------------------------------------------*/ 444*9b8096d0SSteve Yin uno::Sequence< ::rtl::OUString > SvxPixelCtlAccessible::getSupportedServiceNames( ) 445*9b8096d0SSteve Yin throw (uno::RuntimeException) 446*9b8096d0SSteve Yin { 447*9b8096d0SSteve Yin uno::Sequence< OUString > aRet(2); 448*9b8096d0SSteve Yin OUString* pArray = aRet.getArray(); 449*9b8096d0SSteve Yin pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible ) ); 450*9b8096d0SSteve Yin pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext ) ); 451*9b8096d0SSteve Yin pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) ); 452*9b8096d0SSteve Yin // pArray[3] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleTable) ); 453*9b8096d0SSteve Yin return aRet; 454*9b8096d0SSteve Yin } 455*9b8096d0SSteve Yin 456*9b8096d0SSteve Yin // ----------------------------------------------------------------------------- 457*9b8096d0SSteve Yin // XAccessibleSelection 458*9b8096d0SSteve Yin // ----------------------------------------------------------------------------- 459*9b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::selectAccessibleChild( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException) 460*9b8096d0SSteve Yin { 461*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 462*9b8096d0SSteve Yin IsValid(); 463*9b8096d0SSteve Yin 464*9b8096d0SSteve Yin if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) 465*9b8096d0SSteve Yin throw lang::IndexOutOfBoundsException(); 466*9b8096d0SSteve Yin 467*9b8096d0SSteve Yin long nIndex = pPixelCtl->ShowPosition(pPixelCtl->IndexToPoint(nChildIndex)); 468*9b8096d0SSteve Yin NotifyChild(nIndex,sal_True,sal_False); 469*9b8096d0SSteve Yin } 470*9b8096d0SSteve Yin // ----------------------------------------------------------------------------- 471*9b8096d0SSteve Yin sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException) 472*9b8096d0SSteve Yin { 473*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 474*9b8096d0SSteve Yin 475*9b8096d0SSteve Yin IsValid(); 476*9b8096d0SSteve Yin 477*9b8096d0SSteve Yin return pPixelCtl->GetFoucsPosIndex() == nChildIndex; 478*9b8096d0SSteve Yin } 479*9b8096d0SSteve Yin // ----------------------------------------------------------------------------- 480*9b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::clearAccessibleSelection( ) throw (RuntimeException) 481*9b8096d0SSteve Yin { 482*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 483*9b8096d0SSteve Yin 484*9b8096d0SSteve Yin IsValid(); 485*9b8096d0SSteve Yin 486*9b8096d0SSteve Yin } 487*9b8096d0SSteve Yin // ----------------------------------------------------------------------------- 488*9b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::selectAllAccessibleChildren( ) throw (RuntimeException) 489*9b8096d0SSteve Yin { 490*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 491*9b8096d0SSteve Yin 492*9b8096d0SSteve Yin IsValid(); 493*9b8096d0SSteve Yin 494*9b8096d0SSteve Yin } 495*9b8096d0SSteve Yin // ----------------------------------------------------------------------------- 496*9b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChildCount( ) throw (RuntimeException) 497*9b8096d0SSteve Yin { 498*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 499*9b8096d0SSteve Yin 500*9b8096d0SSteve Yin IsValid(); 501*9b8096d0SSteve Yin 502*9b8096d0SSteve Yin return 1; 503*9b8096d0SSteve Yin } 504*9b8096d0SSteve Yin // ----------------------------------------------------------------------------- 505*9b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException) 506*9b8096d0SSteve Yin { 507*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 508*9b8096d0SSteve Yin 509*9b8096d0SSteve Yin IsValid(); 510*9b8096d0SSteve Yin 511*9b8096d0SSteve Yin if ( nSelectedChildIndex >= 1) 512*9b8096d0SSteve Yin throw lang::IndexOutOfBoundsException(); 513*9b8096d0SSteve Yin 514*9b8096d0SSteve Yin uno::Reference< XAccessible > xChild; 515*9b8096d0SSteve Yin if(pPixelCtl) 516*9b8096d0SSteve Yin { 517*9b8096d0SSteve Yin if(m_xCurChild.is()) 518*9b8096d0SSteve Yin { 519*9b8096d0SSteve Yin xChild = m_xCurChild; 520*9b8096d0SSteve Yin } 521*9b8096d0SSteve Yin } 522*9b8096d0SSteve Yin return xChild; 523*9b8096d0SSteve Yin } 524*9b8096d0SSteve Yin // ----------------------------------------------------------------------------- 525*9b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::deselectAccessibleChild( sal_Int32 ) throw (lang::IndexOutOfBoundsException, RuntimeException) 526*9b8096d0SSteve Yin { 527*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 528*9b8096d0SSteve Yin 529*9b8096d0SSteve Yin IsValid(); 530*9b8096d0SSteve Yin 531*9b8096d0SSteve Yin 532*9b8096d0SSteve Yin } 533*9b8096d0SSteve Yin 534*9b8096d0SSteve Yin // Added by lq 535*9b8096d0SSteve Yin void SvxPixelCtlAccessible::ensureIsAlive() const 536*9b8096d0SSteve Yin throw ( lang::DisposedException ) 537*9b8096d0SSteve Yin { 538*9b8096d0SSteve Yin if( !IsAlive() ) 539*9b8096d0SSteve Yin throw lang::DisposedException(); 540*9b8096d0SSteve Yin } 541*9b8096d0SSteve Yin 542*9b8096d0SSteve Yin void SvxPixelCtlAccessible::ensureIsValidRow( sal_Int32 nRow ) 543*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException ) 544*9b8096d0SSteve Yin { 545*9b8096d0SSteve Yin if( nRow >= pPixelCtl->GetHeight() || nRow <0) 546*9b8096d0SSteve Yin throw lang::IndexOutOfBoundsException( 547*9b8096d0SSteve Yin OUString( RTL_CONSTASCII_USTRINGPARAM( "row index is invalid" ) ), *this ); 548*9b8096d0SSteve Yin } 549*9b8096d0SSteve Yin 550*9b8096d0SSteve Yin void SvxPixelCtlAccessible::ensureIsValidColumn( sal_Int32 nColumn ) 551*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException ) 552*9b8096d0SSteve Yin { 553*9b8096d0SSteve Yin if( nColumn >= pPixelCtl->GetWidth() || nColumn <0 ) 554*9b8096d0SSteve Yin throw lang::IndexOutOfBoundsException( 555*9b8096d0SSteve Yin OUString( RTL_CONSTASCII_USTRINGPARAM("column index is invalid") ), *this ); 556*9b8096d0SSteve Yin } 557*9b8096d0SSteve Yin 558*9b8096d0SSteve Yin void SvxPixelCtlAccessible::ensureIsValidAddress( 559*9b8096d0SSteve Yin sal_Int32 nRow, sal_Int32 nColumn ) 560*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException ) 561*9b8096d0SSteve Yin { 562*9b8096d0SSteve Yin ensureIsValidRow( nRow ); 563*9b8096d0SSteve Yin ensureIsValidColumn( nColumn ); 564*9b8096d0SSteve Yin } 565*9b8096d0SSteve Yin 566*9b8096d0SSteve Yin void SvxPixelCtlAccessible::ensureIsValidIndex( sal_Int32 nChildIndex ) 567*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException ) 568*9b8096d0SSteve Yin { 569*9b8096d0SSteve Yin if( nChildIndex >= pPixelCtl->GetSquares()) 570*9b8096d0SSteve Yin throw lang::IndexOutOfBoundsException( 571*9b8096d0SSteve Yin OUString( RTL_CONSTASCII_USTRINGPARAM("child index is invalid") ), *this ); 572*9b8096d0SSteve Yin } 573*9b8096d0SSteve Yin 574*9b8096d0SSteve Yin // XAccessibleTable ----------------------------------------------------------- 575*9b8096d0SSteve Yin /* 576*9b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleRowCount() 577*9b8096d0SSteve Yin throw ( uno::RuntimeException ) 578*9b8096d0SSteve Yin { 579*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 580*9b8096d0SSteve Yin ensureIsAlive(); 581*9b8096d0SSteve Yin return pPixelCtl->GetLineCount(); 582*9b8096d0SSteve Yin } 583*9b8096d0SSteve Yin 584*9b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnCount() 585*9b8096d0SSteve Yin throw ( uno::RuntimeException ) 586*9b8096d0SSteve Yin { 587*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 588*9b8096d0SSteve Yin ensureIsAlive(); 589*9b8096d0SSteve Yin return pPixelCtl->GetLineCount(); 590*9b8096d0SSteve Yin } 591*9b8096d0SSteve Yin 592*9b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleRowExtentAt( 593*9b8096d0SSteve Yin sal_Int32 nRow, sal_Int32 nColumn ) 594*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 595*9b8096d0SSteve Yin { 596*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 597*9b8096d0SSteve Yin ensureIsAlive(); 598*9b8096d0SSteve Yin return 1; // merged cells not supported 599*9b8096d0SSteve Yin } 600*9b8096d0SSteve Yin 601*9b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnExtentAt( 602*9b8096d0SSteve Yin sal_Int32 nRow, sal_Int32 nColumn ) 603*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 604*9b8096d0SSteve Yin { 605*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 606*9b8096d0SSteve Yin ensureIsAlive(); 607*9b8096d0SSteve Yin return 1; // merged cells not supported 608*9b8096d0SSteve Yin } 609*9b8096d0SSteve Yin 610*9b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleCaption() 611*9b8096d0SSteve Yin throw ( uno::RuntimeException ) 612*9b8096d0SSteve Yin { 613*9b8096d0SSteve Yin uno::Reference< XAccessible > xAccessble; 614*9b8096d0SSteve Yin ensureIsAlive(); 615*9b8096d0SSteve Yin return xAccessble; // not supported 616*9b8096d0SSteve Yin } 617*9b8096d0SSteve Yin 618*9b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleSummary() 619*9b8096d0SSteve Yin throw ( uno::RuntimeException ) 620*9b8096d0SSteve Yin { 621*9b8096d0SSteve Yin uno::Reference< XAccessible > xAccessble; 622*9b8096d0SSteve Yin ensureIsAlive(); 623*9b8096d0SSteve Yin return xAccessble; // not supported 624*9b8096d0SSteve Yin } 625*9b8096d0SSteve Yin 626*9b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleIndex( 627*9b8096d0SSteve Yin sal_Int32 nRow, sal_Int32 nColumn ) 628*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 629*9b8096d0SSteve Yin { 630*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 631*9b8096d0SSteve Yin ensureIsAlive(); 632*9b8096d0SSteve Yin ensureIsValidAddress(nRow,nColumn); 633*9b8096d0SSteve Yin return nRow + nColumn * pPixelCtl->GetLineCount() ; 634*9b8096d0SSteve Yin } 635*9b8096d0SSteve Yin 636*9b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleRow( sal_Int32 nChildIndex ) 637*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 638*9b8096d0SSteve Yin { 639*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 640*9b8096d0SSteve Yin ensureIsAlive(); 641*9b8096d0SSteve Yin ensureIsValidIndex( nChildIndex ); 642*9b8096d0SSteve Yin return nChildIndex/pPixelCtl->GetLineCount(); 643*9b8096d0SSteve Yin } 644*9b8096d0SSteve Yin 645*9b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleColumn( sal_Int32 nChildIndex ) 646*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 647*9b8096d0SSteve Yin { 648*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 649*9b8096d0SSteve Yin ensureIsAlive(); 650*9b8096d0SSteve Yin ensureIsValidIndex( nChildIndex ); 651*9b8096d0SSteve Yin return nChildIndex%pPixelCtl->GetLineCount(); 652*9b8096d0SSteve Yin } 653*9b8096d0SSteve Yin 654*9b8096d0SSteve Yin ::rtl::OUString SAL_CALL SvxPixelCtlAccessible::getAccessibleRowDescription( sal_Int32 nRow ) 655*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 656*9b8096d0SSteve Yin { 657*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 658*9b8096d0SSteve Yin ensureIsAlive(); 659*9b8096d0SSteve Yin ensureIsValidRow( nRow ); 660*9b8096d0SSteve Yin return ::rtl::OUString::createFromAscii (""); 661*9b8096d0SSteve Yin } 662*9b8096d0SSteve Yin 663*9b8096d0SSteve Yin ::rtl::OUString SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnDescription( sal_Int32 nColumn ) 664*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 665*9b8096d0SSteve Yin { 666*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 667*9b8096d0SSteve Yin ensureIsAlive(); 668*9b8096d0SSteve Yin ensureIsValidColumn( nColumn ); 669*9b8096d0SSteve Yin return ::rtl::OUString::createFromAscii (""); 670*9b8096d0SSteve Yin } 671*9b8096d0SSteve Yin 672*9b8096d0SSteve Yin uno::Reference< XAccessibleTable > SAL_CALL SvxPixelCtlAccessible::getAccessibleRowHeaders() 673*9b8096d0SSteve Yin throw ( uno::RuntimeException ) 674*9b8096d0SSteve Yin { 675*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 676*9b8096d0SSteve Yin uno::Reference< XAccessibleTable > xAccessble; 677*9b8096d0SSteve Yin ensureIsAlive(); 678*9b8096d0SSteve Yin return xAccessble; 679*9b8096d0SSteve Yin } 680*9b8096d0SSteve Yin 681*9b8096d0SSteve Yin uno::Reference< XAccessibleTable > SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnHeaders() 682*9b8096d0SSteve Yin throw ( uno::RuntimeException ) 683*9b8096d0SSteve Yin { 684*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 685*9b8096d0SSteve Yin uno::Reference< XAccessibleTable > xAccessble; 686*9b8096d0SSteve Yin ensureIsAlive(); 687*9b8096d0SSteve Yin return xAccessble; 688*9b8096d0SSteve Yin } 689*9b8096d0SSteve Yin 690*9b8096d0SSteve Yin Sequence< sal_Int32 > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleRows() 691*9b8096d0SSteve Yin throw ( uno::RuntimeException ) 692*9b8096d0SSteve Yin { 693*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 694*9b8096d0SSteve Yin Sequence< sal_Int32 > accRows; 695*9b8096d0SSteve Yin ensureIsAlive(); 696*9b8096d0SSteve Yin 697*9b8096d0SSteve Yin return accRows; 698*9b8096d0SSteve Yin } 699*9b8096d0SSteve Yin 700*9b8096d0SSteve Yin Sequence< sal_Int32 > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleColumns() 701*9b8096d0SSteve Yin throw ( uno::RuntimeException ) 702*9b8096d0SSteve Yin { 703*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 704*9b8096d0SSteve Yin Sequence< sal_Int32 > accColumns; 705*9b8096d0SSteve Yin ensureIsAlive(); 706*9b8096d0SSteve Yin 707*9b8096d0SSteve Yin return accColumns; 708*9b8096d0SSteve Yin } 709*9b8096d0SSteve Yin 710*9b8096d0SSteve Yin sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleRowSelected( sal_Int32 nRow ) 711*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 712*9b8096d0SSteve Yin { 713*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 714*9b8096d0SSteve Yin ensureIsAlive(); 715*9b8096d0SSteve Yin ensureIsValidRow( nRow ); 716*9b8096d0SSteve Yin return sal_False; 717*9b8096d0SSteve Yin } 718*9b8096d0SSteve Yin 719*9b8096d0SSteve Yin sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleColumnSelected( sal_Int32 nColumn ) 720*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 721*9b8096d0SSteve Yin { 722*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 723*9b8096d0SSteve Yin ensureIsAlive(); 724*9b8096d0SSteve Yin ensureIsValidColumn( nColumn ); 725*9b8096d0SSteve Yin return sal_False; 726*9b8096d0SSteve Yin } 727*9b8096d0SSteve Yin 728*9b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleCellAt( 729*9b8096d0SSteve Yin sal_Int32 nRow, sal_Int32 nColumn ) 730*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 731*9b8096d0SSteve Yin { 732*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 733*9b8096d0SSteve Yin ensureIsAlive(); 734*9b8096d0SSteve Yin ensureIsValidAddress( nRow, nColumn ); 735*9b8096d0SSteve Yin return getAccessibleChild(nRow*pPixelCtl->GetLineCount()+nColumn); 736*9b8096d0SSteve Yin } 737*9b8096d0SSteve Yin 738*9b8096d0SSteve Yin sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleSelected( 739*9b8096d0SSteve Yin sal_Int32 nRow, sal_Int32 nColumn ) 740*9b8096d0SSteve Yin throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 741*9b8096d0SSteve Yin { 742*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 743*9b8096d0SSteve Yin ensureIsAlive(); 744*9b8096d0SSteve Yin ensureIsValidAddress( nRow, nColumn ); 745*9b8096d0SSteve Yin return isAccessibleChildSelected(nRow*pPixelCtl->GetLineCount()+nColumn); 746*9b8096d0SSteve Yin } 747*9b8096d0SSteve Yin // Added by lq end 748*9b8096d0SSteve Yin */ 749*9b8096d0SSteve Yin 750*9b8096d0SSteve Yin //XAccessibleEventBroadcaster 751*9b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw( RuntimeException ) 752*9b8096d0SSteve Yin { 753*9b8096d0SSteve Yin if (xListener.is()) 754*9b8096d0SSteve Yin { 755*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 756*9b8096d0SSteve Yin if (!mnClientId) 757*9b8096d0SSteve Yin mnClientId = comphelper::AccessibleEventNotifier::registerClient( ); 758*9b8096d0SSteve Yin comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener ); 759*9b8096d0SSteve Yin } 760*9b8096d0SSteve Yin } 761*9b8096d0SSteve Yin 762*9b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) 763*9b8096d0SSteve Yin throw( RuntimeException ) 764*9b8096d0SSteve Yin { 765*9b8096d0SSteve Yin if (xListener.is()) 766*9b8096d0SSteve Yin { 767*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 768*9b8096d0SSteve Yin 769*9b8096d0SSteve Yin sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ); 770*9b8096d0SSteve Yin if ( !nListenerCount ) 771*9b8096d0SSteve Yin { 772*9b8096d0SSteve Yin comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); 773*9b8096d0SSteve Yin mnClientId = 0; 774*9b8096d0SSteve Yin } 775*9b8096d0SSteve Yin } 776*9b8096d0SSteve Yin } 777*9b8096d0SSteve Yin void SvxPixelCtlAccessible::CommitChange( const AccessibleEventObject& rEvent ) 778*9b8096d0SSteve Yin { 779*9b8096d0SSteve Yin if (mnClientId) 780*9b8096d0SSteve Yin comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent ); 781*9b8096d0SSteve Yin } 782*9b8096d0SSteve Yin 783*9b8096d0SSteve Yin //Solution:Add the event handling method 784*9b8096d0SSteve Yin void SvxPixelCtlAccessible::FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew) 785*9b8096d0SSteve Yin { 786*9b8096d0SSteve Yin const uno::Reference< XInterface > xSource( *this ); 787*9b8096d0SSteve Yin CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) ); 788*9b8096d0SSteve Yin } 789*9b8096d0SSteve Yin 790*9b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessible::disposing() 791*9b8096d0SSteve Yin { 792*9b8096d0SSteve Yin if( !rBHelper.bDisposed ) 793*9b8096d0SSteve Yin { 794*9b8096d0SSteve Yin { 795*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 796*9b8096d0SSteve Yin if ( mnClientId ) 797*9b8096d0SSteve Yin { 798*9b8096d0SSteve Yin comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); 799*9b8096d0SSteve Yin mnClientId = 0; 800*9b8096d0SSteve Yin } 801*9b8096d0SSteve Yin } 802*9b8096d0SSteve Yin //mxParent = uno::Reference< XAccessible >(); 803*9b8096d0SSteve Yin 804*9b8096d0SSteve Yin } 805*9b8096d0SSteve Yin } 806*9b8096d0SSteve Yin void SvxPixelCtlAccessible::Invalidate() 807*9b8096d0SSteve Yin { 808*9b8096d0SSteve Yin pPixelCtl = 0; 809*9b8096d0SSteve Yin } 810*9b8096d0SSteve Yin void SvxPixelCtlAccessible::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException ) 811*9b8096d0SSteve Yin { 812*9b8096d0SSteve Yin if( IsNotAlive() ) 813*9b8096d0SSteve Yin throw lang::DisposedException(); 814*9b8096d0SSteve Yin } 815*9b8096d0SSteve Yin void SvxPixelCtlAccessible::IsValid() throw (uno::RuntimeException) 816*9b8096d0SSteve Yin { 817*9b8096d0SSteve Yin if(!pPixelCtl) 818*9b8096d0SSteve Yin throw uno::RuntimeException(); 819*9b8096d0SSteve Yin } 820*9b8096d0SSteve Yin 821*9b8096d0SSteve Yin 822*9b8096d0SSteve Yin void SvxPixelCtlAccessible::NotifyChild(long nIndex,sal_Bool bSelect ,sal_Bool bCheck) 823*9b8096d0SSteve Yin { 824*9b8096d0SSteve Yin DBG_ASSERT( !(!bSelect && !bCheck),"" );//non is false 825*9b8096d0SSteve Yin 826*9b8096d0SSteve Yin SvxPixelCtlAccessibleChild *pChild= NULL; 827*9b8096d0SSteve Yin 828*9b8096d0SSteve Yin if (m_xCurChild.is()) 829*9b8096d0SSteve Yin { 830*9b8096d0SSteve Yin pChild= static_cast<SvxPixelCtlAccessibleChild*>(m_xCurChild.get()); 831*9b8096d0SSteve Yin DBG_ASSERT(pChild,"Child Must be Valid"); 832*9b8096d0SSteve Yin if (pChild->getAccessibleIndexInParent() == nIndex ) 833*9b8096d0SSteve Yin { 834*9b8096d0SSteve Yin if (bSelect) 835*9b8096d0SSteve Yin { 836*9b8096d0SSteve Yin pChild->SelectChild(sal_True); 837*9b8096d0SSteve Yin } 838*9b8096d0SSteve Yin if (bCheck) 839*9b8096d0SSteve Yin { 840*9b8096d0SSteve Yin pChild->ChangePixelColorOrBG(sal_Bool(pPixelCtl->GetBitmapPixel(sal_uInt16(nIndex)))); 841*9b8096d0SSteve Yin pChild->CheckChild(); 842*9b8096d0SSteve Yin } 843*9b8096d0SSteve Yin return ; 844*9b8096d0SSteve Yin } 845*9b8096d0SSteve Yin } 846*9b8096d0SSteve Yin uno::Reference <XAccessible> xNewChild =CreateChild(nIndex, pPixelCtl->IndexToPoint(nIndex)); 847*9b8096d0SSteve Yin SvxPixelCtlAccessibleChild *pNewChild= static_cast<SvxPixelCtlAccessibleChild*>(xNewChild.get()); 848*9b8096d0SSteve Yin DBG_ASSERT(pNewChild,"Child Must be Valid"); 849*9b8096d0SSteve Yin 850*9b8096d0SSteve Yin Any aNewValue,aOldValue; 851*9b8096d0SSteve Yin aNewValue<<= xNewChild; 852*9b8096d0SSteve Yin FireAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, 853*9b8096d0SSteve Yin aOldValue, 854*9b8096d0SSteve Yin aNewValue ); 855*9b8096d0SSteve Yin 856*9b8096d0SSteve Yin if (bSelect) 857*9b8096d0SSteve Yin { 858*9b8096d0SSteve Yin if (pChild) 859*9b8096d0SSteve Yin { 860*9b8096d0SSteve Yin pChild->SelectChild(sal_False); 861*9b8096d0SSteve Yin } 862*9b8096d0SSteve Yin pNewChild->SelectChild(sal_True); 863*9b8096d0SSteve Yin } 864*9b8096d0SSteve Yin if (bCheck) 865*9b8096d0SSteve Yin { 866*9b8096d0SSteve Yin pNewChild->CheckChild(); 867*9b8096d0SSteve Yin } 868*9b8096d0SSteve Yin m_xCurChild= xNewChild; 869*9b8096d0SSteve Yin 870*9b8096d0SSteve Yin 871*9b8096d0SSteve Yin } 872*9b8096d0SSteve Yin 873*9b8096d0SSteve Yin uno::Reference<XAccessible> SvxPixelCtlAccessible::CreateChild (long nIndex,Point mPoint) 874*9b8096d0SSteve Yin { 875*9b8096d0SSteve Yin long nX = mPoint.X(); 876*9b8096d0SSteve Yin long nY = mPoint.Y(); 877*9b8096d0SSteve Yin if( Application::GetSettings().GetLayoutRTL()) 878*9b8096d0SSteve Yin { 879*9b8096d0SSteve Yin nX = (sal_uInt16) pPixelCtl->GetWidth() - 1 - nX; 880*9b8096d0SSteve Yin } 881*9b8096d0SSteve Yin 882*9b8096d0SSteve Yin sal_Bool bPixelColorOrBG= sal_Bool(pPixelCtl->GetBitmapPixel(sal_uInt16(nIndex))); 883*9b8096d0SSteve Yin Size size(pPixelCtl->GetWidth() / pPixelCtl->GetLineCount(),pPixelCtl->GetHeight() / pPixelCtl->GetLineCount()); 884*9b8096d0SSteve Yin uno::Reference<XAccessible> xChild; 885*9b8096d0SSteve Yin xChild = new SvxPixelCtlAccessibleChild(pPixelCtl, 886*9b8096d0SSteve Yin bPixelColorOrBG, 887*9b8096d0SSteve Yin Point(nX,nY), 888*9b8096d0SSteve Yin Rectangle(mPoint,size), 889*9b8096d0SSteve Yin this, 890*9b8096d0SSteve Yin nIndex); 891*9b8096d0SSteve Yin 892*9b8096d0SSteve Yin return xChild; 893*9b8096d0SSteve Yin } 894*9b8096d0SSteve Yin 895*9b8096d0SSteve Yin 896*9b8096d0SSteve Yin void SvxPixelCtlAccessible::LoseFocus() 897*9b8096d0SSteve Yin { 898*9b8096d0SSteve Yin m_xCurChild = uno::Reference< XAccessible >() ; 899*9b8096d0SSteve Yin } 900*9b8096d0SSteve Yin 901*9b8096d0SSteve Yin void SvxPixelCtlAccessibleChild::CheckChild() 902*9b8096d0SSteve Yin { 903*9b8096d0SSteve Yin Any aChecked; 904*9b8096d0SSteve Yin aChecked <<= AccessibleStateType::CHECKED; 905*9b8096d0SSteve Yin 906*9b8096d0SSteve Yin if (m_bPixelColorOrBG)//Current Child State 907*9b8096d0SSteve Yin { 908*9b8096d0SSteve Yin FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, 909*9b8096d0SSteve Yin Any(), 910*9b8096d0SSteve Yin aChecked); 911*9b8096d0SSteve Yin } 912*9b8096d0SSteve Yin else 913*9b8096d0SSteve Yin { 914*9b8096d0SSteve Yin FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, 915*9b8096d0SSteve Yin aChecked, 916*9b8096d0SSteve Yin Any() ); 917*9b8096d0SSteve Yin } 918*9b8096d0SSteve Yin } 919*9b8096d0SSteve Yin 920*9b8096d0SSteve Yin void SvxPixelCtlAccessibleChild::SelectChild( sal_Bool bSelect) 921*9b8096d0SSteve Yin { 922*9b8096d0SSteve Yin Any aSelected; 923*9b8096d0SSteve Yin aSelected <<= AccessibleStateType::SELECTED; 924*9b8096d0SSteve Yin 925*9b8096d0SSteve Yin if (bSelect) 926*9b8096d0SSteve Yin { 927*9b8096d0SSteve Yin FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, 928*9b8096d0SSteve Yin Any(), 929*9b8096d0SSteve Yin aSelected); 930*9b8096d0SSteve Yin } 931*9b8096d0SSteve Yin else 932*9b8096d0SSteve Yin { 933*9b8096d0SSteve Yin FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, 934*9b8096d0SSteve Yin aSelected, 935*9b8096d0SSteve Yin Any()); 936*9b8096d0SSteve Yin } 937*9b8096d0SSteve Yin } 938*9b8096d0SSteve Yin void SvxPixelCtlAccessibleChild::FireAccessibleEvent ( 939*9b8096d0SSteve Yin short nEventId, 940*9b8096d0SSteve Yin const ::com::sun::star::uno::Any& rOld, 941*9b8096d0SSteve Yin const ::com::sun::star::uno::Any& rNew) 942*9b8096d0SSteve Yin { 943*9b8096d0SSteve Yin const uno::Reference< XInterface > xSource( *this ); 944*9b8096d0SSteve Yin CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) ); 945*9b8096d0SSteve Yin } 946*9b8096d0SSteve Yin 947*9b8096d0SSteve Yin 948*9b8096d0SSteve Yin 949*9b8096d0SSteve Yin DBG_NAME( SvxPixelCtlAccessibleChild ) 950*9b8096d0SSteve Yin 951*9b8096d0SSteve Yin 952*9b8096d0SSteve Yin SvxPixelCtlAccessibleChild::SvxPixelCtlAccessibleChild( 953*9b8096d0SSteve Yin SvxPixelCtl* rWindow, 954*9b8096d0SSteve Yin sal_Bool bPixelColorOrBG, 955*9b8096d0SSteve Yin const Point &aPoint, 956*9b8096d0SSteve Yin const Rectangle& rBoundingBox, 957*9b8096d0SSteve Yin const uno::Reference<XAccessible>& rxParent, 958*9b8096d0SSteve Yin long nIndexInParent ) : 959*9b8096d0SSteve Yin SvxPixelCtlAccessibleChild_BASE( m_aMutex ), 960*9b8096d0SSteve Yin mrParentWindow( rWindow ), 961*9b8096d0SSteve Yin mxParent(rxParent), 962*9b8096d0SSteve Yin m_bPixelColorOrBG(bPixelColorOrBG), 963*9b8096d0SSteve Yin maPoint(aPoint), 964*9b8096d0SSteve Yin mpBoundingBox( new Rectangle( rBoundingBox ) ), 965*9b8096d0SSteve Yin mnIndexInParent( nIndexInParent ), 966*9b8096d0SSteve Yin mnClientId( 0 ) 967*9b8096d0SSteve Yin { 968*9b8096d0SSteve Yin DBG_CTOR( SvxPixelCtlAccessibleChild, NULL ); 969*9b8096d0SSteve Yin } 970*9b8096d0SSteve Yin 971*9b8096d0SSteve Yin 972*9b8096d0SSteve Yin SvxPixelCtlAccessibleChild::~SvxPixelCtlAccessibleChild() 973*9b8096d0SSteve Yin { 974*9b8096d0SSteve Yin DBG_DTOR( SvxPixelCtlAccessibleChild, NULL ); 975*9b8096d0SSteve Yin 976*9b8096d0SSteve Yin if( IsAlive() ) 977*9b8096d0SSteve Yin { 978*9b8096d0SSteve Yin osl_incrementInterlockedCount( &m_refCount ); 979*9b8096d0SSteve Yin dispose(); // set mpRepr = NULL & release all childs 980*9b8096d0SSteve Yin } 981*9b8096d0SSteve Yin } 982*9b8096d0SSteve Yin 983*9b8096d0SSteve Yin //===== XAccessible ========================================================= 984*9b8096d0SSteve Yin 985*9b8096d0SSteve Yin uno::Reference< XAccessibleContext> SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleContext( void ) throw( RuntimeException ) 986*9b8096d0SSteve Yin { 987*9b8096d0SSteve Yin return this; 988*9b8096d0SSteve Yin } 989*9b8096d0SSteve Yin 990*9b8096d0SSteve Yin //===== XAccessibleComponent ================================================ 991*9b8096d0SSteve Yin 992*9b8096d0SSteve Yin sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::containsPoint( const awt::Point& rPoint ) throw( RuntimeException ) 993*9b8096d0SSteve Yin { 994*9b8096d0SSteve Yin // no guard -> done in getBounds() 995*9b8096d0SSteve Yin // return GetBoundingBox().IsInside( VCLPoint( rPoint ) ); 996*9b8096d0SSteve Yin return Rectangle( Point( 0, 0 ), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); 997*9b8096d0SSteve Yin } 998*9b8096d0SSteve Yin 999*9b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleAtPoint( const awt::Point& ) throw( RuntimeException ) 1000*9b8096d0SSteve Yin { 1001*9b8096d0SSteve Yin return uno::Reference< XAccessible >(); 1002*9b8096d0SSteve Yin } 1003*9b8096d0SSteve Yin 1004*9b8096d0SSteve Yin awt::Rectangle SAL_CALL SvxPixelCtlAccessibleChild::getBounds() throw( RuntimeException ) 1005*9b8096d0SSteve Yin { 1006*9b8096d0SSteve Yin // no guard -> done in getBoundingBox() 1007*9b8096d0SSteve Yin //Modified by lq, 09/26 1008*9b8096d0SSteve Yin //return AWTRectangle( GetBoundingBox() ); 1009*9b8096d0SSteve Yin awt::Rectangle rect = AWTRectangle( GetBoundingBox() ); 1010*9b8096d0SSteve Yin rect.X = rect.X + mrParentWindow->GetClientWindowExtentsRelative(NULL).Left()-mrParentWindow->GetWindowExtentsRelative(NULL).Left(); 1011*9b8096d0SSteve Yin rect.Y = rect.Y + mrParentWindow->GetClientWindowExtentsRelative(NULL).Top()-mrParentWindow->GetWindowExtentsRelative(NULL).Top(); 1012*9b8096d0SSteve Yin return rect; 1013*9b8096d0SSteve Yin // End 1014*9b8096d0SSteve Yin } 1015*9b8096d0SSteve Yin 1016*9b8096d0SSteve Yin awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocation() throw( RuntimeException ) 1017*9b8096d0SSteve Yin { 1018*9b8096d0SSteve Yin // no guard -> done in getBoundingBox() 1019*9b8096d0SSteve Yin return AWTPoint( GetBoundingBox().TopLeft() ); 1020*9b8096d0SSteve Yin } 1021*9b8096d0SSteve Yin 1022*9b8096d0SSteve Yin awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocationOnScreen() throw( RuntimeException ) 1023*9b8096d0SSteve Yin { 1024*9b8096d0SSteve Yin // no guard -> done in getBoundingBoxOnScreen() 1025*9b8096d0SSteve Yin return AWTPoint( GetBoundingBoxOnScreen().TopLeft() ); 1026*9b8096d0SSteve Yin } 1027*9b8096d0SSteve Yin 1028*9b8096d0SSteve Yin awt::Size SAL_CALL SvxPixelCtlAccessibleChild::getSize() throw( RuntimeException ) 1029*9b8096d0SSteve Yin { 1030*9b8096d0SSteve Yin // no guard -> done in getBoundingBox() 1031*9b8096d0SSteve Yin return AWTSize( GetBoundingBox().GetSize() ); 1032*9b8096d0SSteve Yin } 1033*9b8096d0SSteve Yin 1034*9b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessibleChild::grabFocus() throw( RuntimeException ) 1035*9b8096d0SSteve Yin { 1036*9b8096d0SSteve Yin } 1037*9b8096d0SSteve Yin 1038*9b8096d0SSteve Yin sal_Int32 SvxPixelCtlAccessibleChild::getForeground( ) 1039*9b8096d0SSteve Yin throw (::com::sun::star::uno::RuntimeException) 1040*9b8096d0SSteve Yin { 1041*9b8096d0SSteve Yin //::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 1042*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1043*9b8096d0SSteve Yin ThrowExceptionIfNotAlive(); 1044*9b8096d0SSteve Yin return mrParentWindow->GetControlForeground().GetColor(); 1045*9b8096d0SSteve Yin } 1046*9b8096d0SSteve Yin sal_Int32 SvxPixelCtlAccessibleChild::getBackground( ) 1047*9b8096d0SSteve Yin throw (::com::sun::star::uno::RuntimeException) 1048*9b8096d0SSteve Yin { 1049*9b8096d0SSteve Yin //::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 1050*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1051*9b8096d0SSteve Yin 1052*9b8096d0SSteve Yin ThrowExceptionIfNotAlive(); 1053*9b8096d0SSteve Yin return mrParentWindow->GetControlBackground().GetColor(); 1054*9b8096d0SSteve Yin } 1055*9b8096d0SSteve Yin 1056*9b8096d0SSteve Yin //===== XAccessibleContext ================================================== 1057*9b8096d0SSteve Yin 1058*9b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleChildCount( void ) throw( RuntimeException ) 1059*9b8096d0SSteve Yin { 1060*9b8096d0SSteve Yin return 0; 1061*9b8096d0SSteve Yin } 1062*9b8096d0SSteve Yin 1063*9b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleChild( sal_Int32 ) throw ( RuntimeException ) 1064*9b8096d0SSteve Yin { 1065*9b8096d0SSteve Yin throw lang::IndexOutOfBoundsException(); 1066*9b8096d0SSteve Yin } 1067*9b8096d0SSteve Yin 1068*9b8096d0SSteve Yin uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleParent( void ) throw( RuntimeException ) 1069*9b8096d0SSteve Yin { 1070*9b8096d0SSteve Yin return mxParent; 1071*9b8096d0SSteve Yin } 1072*9b8096d0SSteve Yin 1073*9b8096d0SSteve Yin sal_Int32 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleIndexInParent( void ) throw( RuntimeException ) 1074*9b8096d0SSteve Yin { 1075*9b8096d0SSteve Yin return mnIndexInParent; 1076*9b8096d0SSteve Yin } 1077*9b8096d0SSteve Yin 1078*9b8096d0SSteve Yin sal_Int16 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleRole( void ) throw( RuntimeException ) 1079*9b8096d0SSteve Yin { 1080*9b8096d0SSteve Yin return AccessibleRole::CHECK_BOX; 1081*9b8096d0SSteve Yin } 1082*9b8096d0SSteve Yin 1083*9b8096d0SSteve Yin OUString SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleDescription( void ) throw( RuntimeException ) 1084*9b8096d0SSteve Yin { 1085*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1086*9b8096d0SSteve Yin 1087*9b8096d0SSteve Yin return GetName(); 1088*9b8096d0SSteve Yin } 1089*9b8096d0SSteve Yin 1090*9b8096d0SSteve Yin OUString SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleName( void ) throw( RuntimeException ) 1091*9b8096d0SSteve Yin { 1092*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1093*9b8096d0SSteve Yin return GetName(); 1094*9b8096d0SSteve Yin } 1095*9b8096d0SSteve Yin 1096*9b8096d0SSteve Yin /** Return empty uno::Reference to indicate that the relation set is not 1097*9b8096d0SSteve Yin supported. 1098*9b8096d0SSteve Yin */ 1099*9b8096d0SSteve Yin uno::Reference<XAccessibleRelationSet> SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleRelationSet( void ) throw( RuntimeException ) 1100*9b8096d0SSteve Yin { 1101*9b8096d0SSteve Yin return uno::Reference< XAccessibleRelationSet >(); 1102*9b8096d0SSteve Yin } 1103*9b8096d0SSteve Yin 1104*9b8096d0SSteve Yin uno::Reference< XAccessibleStateSet > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleStateSet( void ) throw( RuntimeException ) 1105*9b8096d0SSteve Yin { 1106*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1107*9b8096d0SSteve Yin utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; 1108*9b8096d0SSteve Yin 1109*9b8096d0SSteve Yin if( IsAlive() ) 1110*9b8096d0SSteve Yin { 1111*9b8096d0SSteve Yin 1112*9b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::TRANSIENT ); 1113*9b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::ENABLED ); 1114*9b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::OPAQUE ); 1115*9b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::SELECTABLE ); 1116*9b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::SHOWING ); 1117*9b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); 1118*9b8096d0SSteve Yin 1119*9b8096d0SSteve Yin if (mrParentWindow ) 1120*9b8096d0SSteve Yin { 1121*9b8096d0SSteve Yin long nIndex = mrParentWindow->GetFoucsPosIndex(); 1122*9b8096d0SSteve Yin if ( nIndex == mnIndexInParent) 1123*9b8096d0SSteve Yin { 1124*9b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::SELECTED ); 1125*9b8096d0SSteve Yin } 1126*9b8096d0SSteve Yin //IAccessibility2 Implementation 2009----- 1127*9b8096d0SSteve Yin if (mrParentWindow->GetBitmapPixel(sal_uInt16(mnIndexInParent))) 1128*9b8096d0SSteve Yin //-----IAccessibility2 Implementation 2009 1129*9b8096d0SSteve Yin { 1130*9b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::CHECKED ); 1131*9b8096d0SSteve Yin } 1132*9b8096d0SSteve Yin } 1133*9b8096d0SSteve Yin } 1134*9b8096d0SSteve Yin else 1135*9b8096d0SSteve Yin pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); 1136*9b8096d0SSteve Yin 1137*9b8096d0SSteve Yin return pStateSetHelper; 1138*9b8096d0SSteve Yin } 1139*9b8096d0SSteve Yin 1140*9b8096d0SSteve Yin lang::Locale SAL_CALL SvxPixelCtlAccessibleChild::getLocale( void ) throw( IllegalAccessibleComponentStateException, RuntimeException ) 1141*9b8096d0SSteve Yin { 1142*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1143*9b8096d0SSteve Yin if( mxParent.is() ) 1144*9b8096d0SSteve Yin { 1145*9b8096d0SSteve Yin uno::Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() ); 1146*9b8096d0SSteve Yin if( xParentContext.is() ) 1147*9b8096d0SSteve Yin return xParentContext->getLocale(); 1148*9b8096d0SSteve Yin } 1149*9b8096d0SSteve Yin 1150*9b8096d0SSteve Yin // No locale and no parent. Therefore throw exception to indicate this 1151*9b8096d0SSteve Yin // cluelessness. 1152*9b8096d0SSteve Yin throw IllegalAccessibleComponentStateException(); 1153*9b8096d0SSteve Yin } 1154*9b8096d0SSteve Yin 1155*9b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessibleChild::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) 1156*9b8096d0SSteve Yin throw( RuntimeException ) 1157*9b8096d0SSteve Yin { 1158*9b8096d0SSteve Yin if (xListener.is()) 1159*9b8096d0SSteve Yin { 1160*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1161*9b8096d0SSteve Yin if (!mnClientId) 1162*9b8096d0SSteve Yin mnClientId = comphelper::AccessibleEventNotifier::registerClient( ); 1163*9b8096d0SSteve Yin comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener ); 1164*9b8096d0SSteve Yin } 1165*9b8096d0SSteve Yin } 1166*9b8096d0SSteve Yin 1167*9b8096d0SSteve Yin 1168*9b8096d0SSteve Yin 1169*9b8096d0SSteve Yin 1170*9b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessibleChild::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) 1171*9b8096d0SSteve Yin throw( RuntimeException ) 1172*9b8096d0SSteve Yin { 1173*9b8096d0SSteve Yin if (xListener.is()) 1174*9b8096d0SSteve Yin { 1175*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1176*9b8096d0SSteve Yin 1177*9b8096d0SSteve Yin sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ); 1178*9b8096d0SSteve Yin if ( !nListenerCount ) 1179*9b8096d0SSteve Yin { 1180*9b8096d0SSteve Yin // no listeners anymore 1181*9b8096d0SSteve Yin // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), 1182*9b8096d0SSteve Yin // and at least to us not firing any events anymore, in case somebody calls 1183*9b8096d0SSteve Yin // NotifyAccessibleEvent, again 1184*9b8096d0SSteve Yin comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); 1185*9b8096d0SSteve Yin mnClientId = 0; 1186*9b8096d0SSteve Yin } 1187*9b8096d0SSteve Yin } 1188*9b8096d0SSteve Yin } 1189*9b8096d0SSteve Yin 1190*9b8096d0SSteve Yin 1191*9b8096d0SSteve Yin //===== XServiceInfo ======================================================== 1192*9b8096d0SSteve Yin 1193*9b8096d0SSteve Yin OUString SAL_CALL SvxPixelCtlAccessibleChild::getImplementationName( void ) throw( RuntimeException ) 1194*9b8096d0SSteve Yin { 1195*9b8096d0SSteve Yin return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxPixelCtlAccessibleChild" ) ); 1196*9b8096d0SSteve Yin } 1197*9b8096d0SSteve Yin 1198*9b8096d0SSteve Yin sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::supportsService( const OUString& rServiceName ) throw( RuntimeException ) 1199*9b8096d0SSteve Yin { 1200*9b8096d0SSteve Yin return rServiceName.equalsAsciiL( sAccessible , sizeof(sAccessible )-1 ) || 1201*9b8096d0SSteve Yin rServiceName.equalsAsciiL( sAccessibleContext , sizeof(sAccessibleContext )-1 ) || 1202*9b8096d0SSteve Yin rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 ); 1203*9b8096d0SSteve Yin 1204*9b8096d0SSteve Yin } 1205*9b8096d0SSteve Yin 1206*9b8096d0SSteve Yin Sequence< OUString > SAL_CALL SvxPixelCtlAccessibleChild::getSupportedServiceNames( void ) throw( RuntimeException ) 1207*9b8096d0SSteve Yin { 1208*9b8096d0SSteve Yin uno::Sequence< OUString > aRet(3); 1209*9b8096d0SSteve Yin OUString* pArray = aRet.getArray(); 1210*9b8096d0SSteve Yin pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible ) ); 1211*9b8096d0SSteve Yin pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext ) ); 1212*9b8096d0SSteve Yin pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) ); 1213*9b8096d0SSteve Yin return aRet; 1214*9b8096d0SSteve Yin } 1215*9b8096d0SSteve Yin 1216*9b8096d0SSteve Yin //===== internal ============================================================ 1217*9b8096d0SSteve Yin 1218*9b8096d0SSteve Yin void SvxPixelCtlAccessibleChild::CommitChange( const AccessibleEventObject& rEvent ) 1219*9b8096d0SSteve Yin { 1220*9b8096d0SSteve Yin if (mnClientId) 1221*9b8096d0SSteve Yin comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent ); 1222*9b8096d0SSteve Yin } 1223*9b8096d0SSteve Yin 1224*9b8096d0SSteve Yin void SAL_CALL SvxPixelCtlAccessibleChild::disposing() 1225*9b8096d0SSteve Yin { 1226*9b8096d0SSteve Yin if( !rBHelper.bDisposed ) 1227*9b8096d0SSteve Yin { 1228*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1229*9b8096d0SSteve Yin 1230*9b8096d0SSteve Yin // Send a disposing to all listeners. 1231*9b8096d0SSteve Yin if ( mnClientId ) 1232*9b8096d0SSteve Yin { 1233*9b8096d0SSteve Yin comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); 1234*9b8096d0SSteve Yin mnClientId = 0; 1235*9b8096d0SSteve Yin } 1236*9b8096d0SSteve Yin 1237*9b8096d0SSteve Yin mxParent = uno::Reference< XAccessible >(); 1238*9b8096d0SSteve Yin 1239*9b8096d0SSteve Yin delete mpBoundingBox; 1240*9b8096d0SSteve Yin } 1241*9b8096d0SSteve Yin } 1242*9b8096d0SSteve Yin 1243*9b8096d0SSteve Yin void SvxPixelCtlAccessibleChild::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException ) 1244*9b8096d0SSteve Yin { 1245*9b8096d0SSteve Yin if( IsNotAlive() ) 1246*9b8096d0SSteve Yin throw lang::DisposedException(); 1247*9b8096d0SSteve Yin } 1248*9b8096d0SSteve Yin 1249*9b8096d0SSteve Yin Rectangle SvxPixelCtlAccessibleChild::GetBoundingBoxOnScreen( void ) throw( RuntimeException ) 1250*9b8096d0SSteve Yin { 1251*9b8096d0SSteve Yin ::osl::MutexGuard aGuard( m_aMutex ); 1252*9b8096d0SSteve Yin 1253*9b8096d0SSteve Yin // no ThrowExceptionIfNotAlive() because its done in GetBoundingBox() 1254*9b8096d0SSteve Yin Rectangle aRect( GetBoundingBox() ); 1255*9b8096d0SSteve Yin 1256*9b8096d0SSteve Yin return Rectangle( mrParentWindow->OutputToAbsoluteScreenPixel( aRect.TopLeft() ), aRect.GetSize() ); 1257*9b8096d0SSteve Yin } 1258*9b8096d0SSteve Yin 1259*9b8096d0SSteve Yin Rectangle SvxPixelCtlAccessibleChild::GetBoundingBox( void ) throw( RuntimeException ) 1260*9b8096d0SSteve Yin { 1261*9b8096d0SSteve Yin // no guard neccessary, because no one changes mpBoundingBox after creating it 1262*9b8096d0SSteve Yin ThrowExceptionIfNotAlive(); 1263*9b8096d0SSteve Yin 1264*9b8096d0SSteve Yin return *mpBoundingBox; 1265*9b8096d0SSteve Yin } 1266*9b8096d0SSteve Yin 1267*9b8096d0SSteve Yin ::rtl::OUString SvxPixelCtlAccessibleChild::GetName() 1268*9b8096d0SSteve Yin { 1269*9b8096d0SSteve Yin sal_Int32 nXIndex = mnIndexInParent % mrParentWindow->GetLineCount(); 1270*9b8096d0SSteve Yin sal_Int32 nYIndex = mnIndexInParent / mrParentWindow->GetLineCount(); 1271*9b8096d0SSteve Yin 1272*9b8096d0SSteve Yin OUString str; 1273*9b8096d0SSteve Yin str += OUString::createFromAscii("("); 1274*9b8096d0SSteve Yin str += OUString::valueOf(nXIndex); 1275*9b8096d0SSteve Yin str += OUString::createFromAscii(","); 1276*9b8096d0SSteve Yin str += OUString::valueOf(nYIndex); 1277*9b8096d0SSteve Yin // str += OUString::createFromAscii(","); 1278*9b8096d0SSteve Yin // str += OUString::valueOf(m_bPixelColorOrBG); 1279*9b8096d0SSteve Yin str += OUString::createFromAscii(")"); 1280*9b8096d0SSteve Yin return str; 1281*9b8096d0SSteve Yin } 1282