1*5fdc4257SSteve Yin /************************************************************************* 2*5fdc4257SSteve Yin * 3*5fdc4257SSteve Yin * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*5fdc4257SSteve Yin * 5*5fdc4257SSteve Yin * Copyright IBM Corporation 2010. 6*5fdc4257SSteve Yin * Copyright 2000, 2010 Oracle and/or its affiliates. 7*5fdc4257SSteve Yin * 8*5fdc4257SSteve Yin * OpenOffice.org - a multi-platform office productivity suite 9*5fdc4257SSteve Yin * 10*5fdc4257SSteve Yin * This file is part of OpenOffice.org. 11*5fdc4257SSteve Yin * 12*5fdc4257SSteve Yin * OpenOffice.org is free software: you can redistribute it and/or modify 13*5fdc4257SSteve Yin * it under the terms of the GNU Lesser General Public License version 3 14*5fdc4257SSteve Yin * only, as published by the Free Software Foundation. 15*5fdc4257SSteve Yin * 16*5fdc4257SSteve Yin * OpenOffice.org is distributed in the hope that it will be useful, 17*5fdc4257SSteve Yin * but WITHOUT ANY WARRANTY; without even the implied warranty of 18*5fdc4257SSteve Yin * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19*5fdc4257SSteve Yin * GNU Lesser General Public License version 3 for more details 20*5fdc4257SSteve Yin * (a copy is included in the LICENSE file that accompanied this code). 21*5fdc4257SSteve Yin * 22*5fdc4257SSteve Yin * You should have received a copy of the GNU Lesser General Public License 23*5fdc4257SSteve Yin * version 3 along with OpenOffice.org. If not, see 24*5fdc4257SSteve Yin * <http://www.openoffice.org/license.html> 25*5fdc4257SSteve Yin * for a copy of the LGPLv3 License. 26*5fdc4257SSteve Yin * 27*5fdc4257SSteve Yin ************************************************************************/ 28*5fdc4257SSteve Yin 29*5fdc4257SSteve Yin #include "stdafx.h" 30*5fdc4257SSteve Yin #include "UAccCOM2.h" 31*5fdc4257SSteve Yin #include "MAccessible.h" 32*5fdc4257SSteve Yin 33*5fdc4257SSteve Yin #include <algorithm> 34*5fdc4257SSteve Yin #include "AccAction.h" 35*5fdc4257SSteve Yin 36*5fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleText.hpp> 37*5fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> 38*5fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleImage.hpp> 39*5fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleTable.hpp> 40*5fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp> 41*5fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleAction.hpp> 42*5fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp> 43*5fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleHyperText.hpp> 44*5fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleHyperlink.hpp> 45*5fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> 46*5fdc4257SSteve Yin #include <com/sun/star/accessibility/AccessibleStateType.hpp> 47*5fdc4257SSteve Yin #include <com/sun/star/accessibility/AccessibleRole.hpp> 48*5fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleGroupPosition.hpp> 49*5fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleValue.hpp> 50*5fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp> 51*5fdc4257SSteve Yin #include <com/sun/star/style/LineSpacing.hpp> 52*5fdc4257SSteve Yin #include <com/sun/star/style/TabStop.hpp> 53*5fdc4257SSteve Yin #include <com/sun/star/container/XIndexReplace.hpp> 54*5fdc4257SSteve Yin 55*5fdc4257SSteve Yin #include "AccessibleRole.h" 56*5fdc4257SSteve Yin 57*5fdc4257SSteve Yin using namespace com::sun::star::accessibility::AccessibleStateType; 58*5fdc4257SSteve Yin 59*5fdc4257SSteve Yin // IA2 states mapping, and name 60*5fdc4257SSteve Yin // maintenance the consistency, change one array, change the three all 61*5fdc4257SSteve Yin long IA2_STATES[] = 62*5fdc4257SSteve Yin { 63*5fdc4257SSteve Yin IA2_STATE_ACTIVE, // = 0x1; 64*5fdc4257SSteve Yin IA2_STATE_ARMED, // = 0x2; 65*5fdc4257SSteve Yin IA2_STATE_DEFUNCT, // = 0x4; 66*5fdc4257SSteve Yin IA2_STATE_EDITABLE, // = 0x8; 67*5fdc4257SSteve Yin IA2_STATE_HORIZONTAL, // = 0x10; 68*5fdc4257SSteve Yin IA2_STATE_ICONIFIED, // = 0x20; 69*5fdc4257SSteve Yin IA2_STATE_INVALID_ENTRY, // = 0x80; 70*5fdc4257SSteve Yin IA2_STATE_MANAGES_DESCENDANTS, // = 0x100; 71*5fdc4257SSteve Yin IA2_STATE_MODAL, // = 0x200; 72*5fdc4257SSteve Yin IA2_STATE_MULTI_LINE, // = 0x400; 73*5fdc4257SSteve Yin IA2_STATE_OPAQUE, // = 0x800; 74*5fdc4257SSteve Yin IA2_STATE_REQUIRED, // = 0x2000; 75*5fdc4257SSteve Yin IA2_STATE_SELECTABLE_TEXT, // = 0x3000; 76*5fdc4257SSteve Yin IA2_STATE_SINGLE_LINE, // = 0x4000; 77*5fdc4257SSteve Yin IA2_STATE_STALE, // = 0x8000; 78*5fdc4257SSteve Yin IA2_STATE_SUPPORTS_AUTOCOMPLETION, // = 0x10000; 79*5fdc4257SSteve Yin IA2_STATE_TRANSIENT, //= 0x20000; 80*5fdc4257SSteve Yin IA2_STATE_VERTICAL // = 0x40000; 81*5fdc4257SSteve Yin }; 82*5fdc4257SSteve Yin /* 83*5fdc4257SSteve Yin 84*5fdc4257SSteve Yin <=== map ===> 85*5fdc4257SSteve Yin 86*5fdc4257SSteve Yin */ 87*5fdc4257SSteve Yin short UNO_STATES[] = 88*5fdc4257SSteve Yin { 89*5fdc4257SSteve Yin ACTIVE, // = (sal_Int16)1; 90*5fdc4257SSteve Yin ARMED, // = (sal_Int16)2; 91*5fdc4257SSteve Yin DEFUNC, // = (sal_Int16)5; 92*5fdc4257SSteve Yin EDITABLE, // = (sal_Int16)6; 93*5fdc4257SSteve Yin HORIZONTAL, // = (sal_Int16)12; 94*5fdc4257SSteve Yin ICONIFIED, // = (sal_Int16)13; 95*5fdc4257SSteve Yin -1, //IA2_STATE_INVALID_ENTRY 96*5fdc4257SSteve Yin MANAGES_DESCENDANTS, // = (sal_Int16)15; 97*5fdc4257SSteve Yin MODAL, // = (sal_Int16)16; 98*5fdc4257SSteve Yin MULTI_LINE, // = (sal_Int16)17; 99*5fdc4257SSteve Yin OPAQUE, // = (sal_Int16)19; 100*5fdc4257SSteve Yin -1, //IA2_STATE_REQUIRED 101*5fdc4257SSteve Yin -1, //IA2_STATE_SELECTABLE_TEXT 102*5fdc4257SSteve Yin SINGLE_LINE, // = (sal_Int16)26; 103*5fdc4257SSteve Yin STALE, // = (sal_Int16)27; 104*5fdc4257SSteve Yin -1, //IA2_STATE_SUPPORTS_AUTOCOMPLETION 105*5fdc4257SSteve Yin TRANSIENT, //IA2_STATE_TRANSIENT 106*5fdc4257SSteve Yin VERTICAL // = (sal_Int16)29; 107*5fdc4257SSteve Yin }; 108*5fdc4257SSteve Yin 109*5fdc4257SSteve Yin // <=== map ===> 110*5fdc4257SSteve Yin 111*5fdc4257SSteve Yin BSTR IA2_STATES_NAME[] = 112*5fdc4257SSteve Yin { 113*5fdc4257SSteve Yin _T("Active"), 114*5fdc4257SSteve Yin _T("Armed"), 115*5fdc4257SSteve Yin _T("Defunct"), 116*5fdc4257SSteve Yin _T("Editable"), 117*5fdc4257SSteve Yin _T("Horizontal"), 118*5fdc4257SSteve Yin _T("Iconified"), 119*5fdc4257SSteve Yin _T("Invalid Entry"), 120*5fdc4257SSteve Yin _T("Manages Decendents"), 121*5fdc4257SSteve Yin _T("Modal"), 122*5fdc4257SSteve Yin _T("Multi Line"), 123*5fdc4257SSteve Yin _T("Opaque"), 124*5fdc4257SSteve Yin _T("Required"), 125*5fdc4257SSteve Yin _T("Selectable Text"), 126*5fdc4257SSteve Yin _T("Single Line"), 127*5fdc4257SSteve Yin _T("Stale"), 128*5fdc4257SSteve Yin _T("Supports Autocompletion"), 129*5fdc4257SSteve Yin _T("Transient"), 130*5fdc4257SSteve Yin _T("Vertical") 131*5fdc4257SSteve Yin }; 132*5fdc4257SSteve Yin 133*5fdc4257SSteve Yin // IA2 states mapping, and name 134*5fdc4257SSteve Yin // maintenance the consistency. change one, change them all 135*5fdc4257SSteve Yin 136*5fdc4257SSteve Yin BSTR UNO_ALL_STATES[] = 137*5fdc4257SSteve Yin { 138*5fdc4257SSteve Yin _T("INVALID"), // INVALID ( 0 ) 139*5fdc4257SSteve Yin _T("ACTIVE"), // ACTIVE ( 1 ) 140*5fdc4257SSteve Yin _T("ARMED"), // ARMED ( 2 ) 141*5fdc4257SSteve Yin _T("BUSY"), // BUSY ( 3 ) 142*5fdc4257SSteve Yin _T("CHECKED"), // CHECKED ( 4 ) 143*5fdc4257SSteve Yin _T("DEFUNC"), // DEFUNC ( 5 ) 144*5fdc4257SSteve Yin _T("EDITABLE"), // EDITABLE ( 6 ) 145*5fdc4257SSteve Yin _T("ENABLED"), // ENABLED ( 7 ) 146*5fdc4257SSteve Yin _T("EXPANDABLE"), // EXPANDABLE ( 8 ) 147*5fdc4257SSteve Yin _T("EXPANDED"), // EXPANDED ( 9 ) 148*5fdc4257SSteve Yin _T("FOCUSABLE"), // FOCUSABLE ( 10 ) 149*5fdc4257SSteve Yin _T("FOCUSED"), // FOCUSED ( 11 ) 150*5fdc4257SSteve Yin _T("HORIZONTAL"), // HORIZONTAL ( 12 ) 151*5fdc4257SSteve Yin _T("ICONIFIED"), // ICONIFIED ( 13 ) 152*5fdc4257SSteve Yin _T("INDETERMINATE"), // INDETERMINATE ( 14 ) 153*5fdc4257SSteve Yin _T("MANAGES_DESCENDANTS"),// MANAGES_DESCENDANTS ( 15 ) 154*5fdc4257SSteve Yin _T("MODAL"), // MODAL ( 16 ) 155*5fdc4257SSteve Yin _T("MULTI_LINE"), // MULTI_LINE ( 17 ) 156*5fdc4257SSteve Yin _T("MULTI_SELECTABLE"), // MULTI_SELECTABLE ( 18 ) 157*5fdc4257SSteve Yin _T("OPAQUE"), // OPAQUE ( 19 ) 158*5fdc4257SSteve Yin _T("PRESSED"), // PRESSED ( 20 ) 159*5fdc4257SSteve Yin _T("RESIZABLE"), // RESIZABLE ( 21 ) 160*5fdc4257SSteve Yin _T("SELECTABLE"), // SELECTABLE ( 22 ) 161*5fdc4257SSteve Yin _T("SELECTED"), // SELECTED ( 23 ) 162*5fdc4257SSteve Yin _T("SENSITIVE"), // SENSITIVE ( 24 ) 163*5fdc4257SSteve Yin _T("SHOWING"), // SHOWING ( 25 ) 164*5fdc4257SSteve Yin _T("SINGLE_LINE"), // SINGLE_LINE ( 26 ) 165*5fdc4257SSteve Yin _T("STALE"), // STALE ( 27 ) 166*5fdc4257SSteve Yin _T("TRANSIENT"), // TRANSIENT ( 28 ) 167*5fdc4257SSteve Yin _T("VERTICAL"), // VERTICAL ( 29 ) 168*5fdc4257SSteve Yin _T("VISIBLE"), // VISIBLE ( 30 ) 169*5fdc4257SSteve Yin _T("MOVEABLE"), // MOVEABLE ( 31 ) 170*5fdc4257SSteve Yin _T("OFFSCREEN"), // OFFSCREEN ( 32 ) 171*5fdc4257SSteve Yin _T("COLLAPSE"), // COLLAPSE ( 33 ) 172*5fdc4257SSteve Yin _T("DEFAULT") // DEFAULT ( 34 ) 173*5fdc4257SSteve Yin }; 174*5fdc4257SSteve Yin 175*5fdc4257SSteve Yin 176*5fdc4257SSteve Yin using namespace com::sun::star::accessibility::AccessibleRole; 177*5fdc4257SSteve Yin 178*5fdc4257SSteve Yin 179*5fdc4257SSteve Yin 180*5fdc4257SSteve Yin #define QUERYXINTERFACE(ainterface) \ 181*5fdc4257SSteve Yin { \ 182*5fdc4257SSteve Yin if(pXAcc == NULL) \ 183*5fdc4257SSteve Yin return FALSE; \ 184*5fdc4257SSteve Yin pRContext = pXAcc->getAccessibleContext(); \ 185*5fdc4257SSteve Yin if( !pRContext.is() ) \ 186*5fdc4257SSteve Yin { \ 187*5fdc4257SSteve Yin return FALSE; \ 188*5fdc4257SSteve Yin } \ 189*5fdc4257SSteve Yin Reference<X##ainterface> pRXI(pRContext,UNO_QUERY);\ 190*5fdc4257SSteve Yin if( !pRXI.is() ) \ 191*5fdc4257SSteve Yin { \ 192*5fdc4257SSteve Yin return FALSE; \ 193*5fdc4257SSteve Yin } \ 194*5fdc4257SSteve Yin *ppXI = (XInterface*)pRXI.get(); \ 195*5fdc4257SSteve Yin return TRUE; \ 196*5fdc4257SSteve Yin } 197*5fdc4257SSteve Yin 198*5fdc4257SSteve Yin #define ISDESTROY() \ 199*5fdc4257SSteve Yin if(m_isDestroy) \ 200*5fdc4257SSteve Yin return S_FALSE; 201*5fdc4257SSteve Yin 202*5fdc4257SSteve Yin 203*5fdc4257SSteve Yin AccObjectManagerAgent* CMAccessible::g_pAgent = NULL; 204*5fdc4257SSteve Yin 205*5fdc4257SSteve Yin CMAccessible::CMAccessible(): 206*5fdc4257SSteve Yin m_iRole(0x00), 207*5fdc4257SSteve Yin m_dState(0x00), 208*5fdc4257SSteve Yin m_dChildID(0x00), 209*5fdc4257SSteve Yin m_dFocusChildID(UACC_NO_FOCUS), 210*5fdc4257SSteve Yin m_hwnd(NULL), 211*5fdc4257SSteve Yin m_pIParent(NULL), 212*5fdc4257SSteve Yin m_pszName(NULL), 213*5fdc4257SSteve Yin m_pszValue(NULL), 214*5fdc4257SSteve Yin m_pszDescription(NULL), 215*5fdc4257SSteve Yin m_isDestroy(FALSE), 216*5fdc4257SSteve Yin m_pszActionDescription(NULL), 217*5fdc4257SSteve Yin m_pXAction(NULL), 218*5fdc4257SSteve Yin m_bRequiresSave(FALSE), 219*5fdc4257SSteve Yin pUNOInterface(NULL) 220*5fdc4257SSteve Yin { 221*5fdc4257SSteve Yin m_sLocation.m_dLeft=0; 222*5fdc4257SSteve Yin m_sLocation.m_dTop = 0; 223*5fdc4257SSteve Yin m_sLocation.m_dWidth=0; 224*5fdc4257SSteve Yin m_sLocation.m_dHeight=0; 225*5fdc4257SSteve Yin CEnumVariant::Create(&m_pEnumVar); 226*5fdc4257SSteve Yin } 227*5fdc4257SSteve Yin 228*5fdc4257SSteve Yin CMAccessible::~CMAccessible() 229*5fdc4257SSteve Yin { 230*5fdc4257SSteve Yin if(m_pszName!=NULL) 231*5fdc4257SSteve Yin { 232*5fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszName); 233*5fdc4257SSteve Yin m_pszName=NULL; 234*5fdc4257SSteve Yin } 235*5fdc4257SSteve Yin if(m_pszValue!=NULL) 236*5fdc4257SSteve Yin { 237*5fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszValue); 238*5fdc4257SSteve Yin m_pszValue=NULL; 239*5fdc4257SSteve Yin } 240*5fdc4257SSteve Yin if(m_pszDescription!=NULL) 241*5fdc4257SSteve Yin { 242*5fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszDescription); 243*5fdc4257SSteve Yin m_pszDescription=NULL; 244*5fdc4257SSteve Yin } 245*5fdc4257SSteve Yin 246*5fdc4257SSteve Yin if(m_pszActionDescription!=NULL) 247*5fdc4257SSteve Yin { 248*5fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszActionDescription); 249*5fdc4257SSteve Yin m_pszActionDescription=NULL; 250*5fdc4257SSteve Yin } 251*5fdc4257SSteve Yin 252*5fdc4257SSteve Yin if(m_pIParent) 253*5fdc4257SSteve Yin { 254*5fdc4257SSteve Yin m_pIParent->Release(); 255*5fdc4257SSteve Yin m_pIParent=NULL; 256*5fdc4257SSteve Yin } 257*5fdc4257SSteve Yin pRef = NULL; 258*5fdc4257SSteve Yin m_pEnumVar->Release(); 259*5fdc4257SSteve Yin m_containedObjects.clear(); 260*5fdc4257SSteve Yin pRContext = NULL; 261*5fdc4257SSteve Yin } 262*5fdc4257SSteve Yin 263*5fdc4257SSteve Yin /** 264*5fdc4257SSteve Yin * Returns the Parent IAccessible interface pointer to AT. 265*5fdc4257SSteve Yin * It should add reference, and the client should release the component. 266*5fdc4257SSteve Yin * It should return E_FAIL when the parent point is null. 267*5fdc4257SSteve Yin * @param ppdispParent [in,out] used to return the parent interface point. 268*5fdc4257SSteve Yin * when the point is null, should return null. 269*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if the m_pIParent is NULL. 270*5fdc4257SSteve Yin */ 271*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accParent(IDispatch **ppdispParent) 272*5fdc4257SSteve Yin { 273*5fdc4257SSteve Yin 274*5fdc4257SSteve Yin CHECK_ENABLE_INF 275*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 276*5fdc4257SSteve Yin ISDESTROY() 277*5fdc4257SSteve Yin // #CHECK# 278*5fdc4257SSteve Yin if(ppdispParent == NULL) 279*5fdc4257SSteve Yin { 280*5fdc4257SSteve Yin return E_INVALIDARG; 281*5fdc4257SSteve Yin } 282*5fdc4257SSteve Yin 283*5fdc4257SSteve Yin if(m_pIParent) 284*5fdc4257SSteve Yin { 285*5fdc4257SSteve Yin *ppdispParent = m_pIParent; 286*5fdc4257SSteve Yin (*ppdispParent)->AddRef(); 287*5fdc4257SSteve Yin return S_OK; 288*5fdc4257SSteve Yin } 289*5fdc4257SSteve Yin else if(m_hwnd) 290*5fdc4257SSteve Yin { 291*5fdc4257SSteve Yin HRESULT hr = AccessibleObjectFromWindow(m_hwnd, OBJID_WINDOW, IID_IAccessible, (void**)ppdispParent); 292*5fdc4257SSteve Yin if( ! SUCCEEDED( hr ) || ! ppdispParent ) 293*5fdc4257SSteve Yin { 294*5fdc4257SSteve Yin return S_FALSE; 295*5fdc4257SSteve Yin } 296*5fdc4257SSteve Yin return S_OK; 297*5fdc4257SSteve Yin } 298*5fdc4257SSteve Yin return S_FALSE; 299*5fdc4257SSteve Yin 300*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 301*5fdc4257SSteve Yin } 302*5fdc4257SSteve Yin 303*5fdc4257SSteve Yin /** 304*5fdc4257SSteve Yin * Returns child count of current COM object. 305*5fdc4257SSteve Yin * @param pcountChildren [in,out] used to return the children count. 306*5fdc4257SSteve Yin * @return S_OK if successful. 307*5fdc4257SSteve Yin */ 308*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accChildCount(long *pcountChildren) 309*5fdc4257SSteve Yin { 310*5fdc4257SSteve Yin 311*5fdc4257SSteve Yin CHECK_ENABLE_INF 312*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 313*5fdc4257SSteve Yin ISDESTROY() 314*5fdc4257SSteve Yin // #CHECK# 315*5fdc4257SSteve Yin if(pcountChildren == NULL) 316*5fdc4257SSteve Yin { 317*5fdc4257SSteve Yin return E_INVALIDARG; 318*5fdc4257SSteve Yin } 319*5fdc4257SSteve Yin 320*5fdc4257SSteve Yin if(!pUNOInterface) 321*5fdc4257SSteve Yin return S_FALSE; 322*5fdc4257SSteve Yin 323*5fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext(); 324*5fdc4257SSteve Yin if( pRContext.is() ) 325*5fdc4257SSteve Yin { 326*5fdc4257SSteve Yin *pcountChildren = pRContext->getAccessibleChildCount(); 327*5fdc4257SSteve Yin } 328*5fdc4257SSteve Yin 329*5fdc4257SSteve Yin return S_OK; 330*5fdc4257SSteve Yin 331*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 332*5fdc4257SSteve Yin } 333*5fdc4257SSteve Yin 334*5fdc4257SSteve Yin /** 335*5fdc4257SSteve Yin * Returns child interface pointer for AT according to input child ID. 336*5fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 337*5fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 338*5fdc4257SSteve Yin * @param ppdispChild, [in,out] use to return the child interface point. 339*5fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 340*5fdc4257SSteve Yin */ 341*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accChild(VARIANT varChild, IDispatch **ppdispChild) 342*5fdc4257SSteve Yin { 343*5fdc4257SSteve Yin 344*5fdc4257SSteve Yin CHECK_ENABLE_INF 345*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 346*5fdc4257SSteve Yin ISDESTROY() 347*5fdc4257SSteve Yin // #CHECK# 348*5fdc4257SSteve Yin if(ppdispChild == NULL) 349*5fdc4257SSteve Yin { 350*5fdc4257SSteve Yin return E_INVALIDARG; 351*5fdc4257SSteve Yin } 352*5fdc4257SSteve Yin if(varChild.vt==VT_I4) 353*5fdc4257SSteve Yin { 354*5fdc4257SSteve Yin //get child interface pointer due to child ID 355*5fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 356*5fdc4257SSteve Yin { 357*5fdc4257SSteve Yin AddRef(); 358*5fdc4257SSteve Yin *ppdispChild = this; 359*5fdc4257SSteve Yin return S_OK; 360*5fdc4257SSteve Yin } 361*5fdc4257SSteve Yin *ppdispChild = GetChildInterface(varChild.lVal); 362*5fdc4257SSteve Yin (*ppdispChild)->AddRef(); 363*5fdc4257SSteve Yin return (*ppdispChild)?S_OK:S_FALSE; 364*5fdc4257SSteve Yin } 365*5fdc4257SSteve Yin return S_FALSE; 366*5fdc4257SSteve Yin 367*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 368*5fdc4257SSteve Yin } 369*5fdc4257SSteve Yin 370*5fdc4257SSteve Yin /** 371*5fdc4257SSteve Yin * Returns the accessible name of the current COM object self or its one child to AT. 372*5fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 373*5fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 374*5fdc4257SSteve Yin * @param pszName, [in,out] use to return the name of the proper object. 375*5fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 376*5fdc4257SSteve Yin */ 377*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accName(VARIANT varChild, BSTR *pszName) 378*5fdc4257SSteve Yin { 379*5fdc4257SSteve Yin 380*5fdc4257SSteve Yin CHECK_ENABLE_INF 381*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 382*5fdc4257SSteve Yin ISDESTROY() 383*5fdc4257SSteve Yin // #CHECK# 384*5fdc4257SSteve Yin if(pszName == NULL) 385*5fdc4257SSteve Yin { 386*5fdc4257SSteve Yin return E_INVALIDARG; 387*5fdc4257SSteve Yin } 388*5fdc4257SSteve Yin if(varChild.vt==VT_I4) 389*5fdc4257SSteve Yin { 390*5fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 391*5fdc4257SSteve Yin { 392*5fdc4257SSteve Yin SAFE_SYSFREESTRING(*pszName); 393*5fdc4257SSteve Yin *pszName = SysAllocString(m_pszName); 394*5fdc4257SSteve Yin return S_OK; 395*5fdc4257SSteve Yin } 396*5fdc4257SSteve Yin 397*5fdc4257SSteve Yin long lVal = varChild.lVal; 398*5fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 399*5fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 400*5fdc4257SSteve Yin if(!pChild) 401*5fdc4257SSteve Yin return E_FAIL; 402*5fdc4257SSteve Yin return pChild->get_accName(varChild,pszName); 403*5fdc4257SSteve Yin } 404*5fdc4257SSteve Yin return S_FALSE; 405*5fdc4257SSteve Yin 406*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 407*5fdc4257SSteve Yin } 408*5fdc4257SSteve Yin 409*5fdc4257SSteve Yin /** 410*5fdc4257SSteve Yin * Returns the accessible value of the current COM object self or its one child to AT. 411*5fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 412*5fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 413*5fdc4257SSteve Yin * @param pszValue, [in,out] use to return the value of the proper object. 414*5fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 415*5fdc4257SSteve Yin */ 416*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accValue(VARIANT varChild, BSTR *pszValue) 417*5fdc4257SSteve Yin { 418*5fdc4257SSteve Yin 419*5fdc4257SSteve Yin CHECK_ENABLE_INF 420*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 421*5fdc4257SSteve Yin ISDESTROY() 422*5fdc4257SSteve Yin // #CHECK# 423*5fdc4257SSteve Yin if( pszValue == NULL ) 424*5fdc4257SSteve Yin { 425*5fdc4257SSteve Yin return E_INVALIDARG; 426*5fdc4257SSteve Yin } 427*5fdc4257SSteve Yin if( varChild.vt==VT_I4 ) 428*5fdc4257SSteve Yin { 429*5fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 430*5fdc4257SSteve Yin { 431*5fdc4257SSteve Yin if(m_dState & STATE_SYSTEM_PROTECTED) 432*5fdc4257SSteve Yin return E_ACCESSDENIED; 433*5fdc4257SSteve Yin 434*5fdc4257SSteve Yin if ( m_pszValue !=NULL && wcslen(m_pszValue) == 0 ) 435*5fdc4257SSteve Yin return S_OK; 436*5fdc4257SSteve Yin 437*5fdc4257SSteve Yin SAFE_SYSFREESTRING(*pszValue); 438*5fdc4257SSteve Yin *pszValue = SysAllocString(m_pszValue); 439*5fdc4257SSteve Yin return S_OK; 440*5fdc4257SSteve Yin } 441*5fdc4257SSteve Yin 442*5fdc4257SSteve Yin long lVal = varChild.lVal; 443*5fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 444*5fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 445*5fdc4257SSteve Yin if(!pChild) 446*5fdc4257SSteve Yin return E_FAIL; 447*5fdc4257SSteve Yin return pChild->get_accValue(varChild,pszValue); 448*5fdc4257SSteve Yin } 449*5fdc4257SSteve Yin return S_FALSE; 450*5fdc4257SSteve Yin 451*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 452*5fdc4257SSteve Yin } 453*5fdc4257SSteve Yin 454*5fdc4257SSteve Yin /** 455*5fdc4257SSteve Yin * Returns the accessible description of the current COM object self or its one child to AT. 456*5fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 457*5fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 458*5fdc4257SSteve Yin * @param pszDescription, [in,out] use to return the description of the proper object. 459*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 460*5fdc4257SSteve Yin */ 461*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accDescription(VARIANT varChild, BSTR *pszDescription) 462*5fdc4257SSteve Yin { 463*5fdc4257SSteve Yin 464*5fdc4257SSteve Yin CHECK_ENABLE_INF 465*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 466*5fdc4257SSteve Yin ISDESTROY() 467*5fdc4257SSteve Yin // #CHECK# 468*5fdc4257SSteve Yin if(pszDescription == NULL) 469*5fdc4257SSteve Yin { 470*5fdc4257SSteve Yin return E_INVALIDARG; 471*5fdc4257SSteve Yin } 472*5fdc4257SSteve Yin if(varChild.vt==VT_I4) 473*5fdc4257SSteve Yin { 474*5fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 475*5fdc4257SSteve Yin { 476*5fdc4257SSteve Yin SAFE_SYSFREESTRING(*pszDescription); 477*5fdc4257SSteve Yin *pszDescription = SysAllocString(m_pszDescription); 478*5fdc4257SSteve Yin return S_OK; 479*5fdc4257SSteve Yin } 480*5fdc4257SSteve Yin 481*5fdc4257SSteve Yin long lVal = varChild.lVal; 482*5fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 483*5fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 484*5fdc4257SSteve Yin if(!pChild) 485*5fdc4257SSteve Yin return E_FAIL; 486*5fdc4257SSteve Yin return pChild->get_accDescription(varChild,pszDescription); 487*5fdc4257SSteve Yin } 488*5fdc4257SSteve Yin return S_FALSE; 489*5fdc4257SSteve Yin 490*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 491*5fdc4257SSteve Yin } 492*5fdc4257SSteve Yin 493*5fdc4257SSteve Yin /** 494*5fdc4257SSteve Yin * Returns the accessible role of the current COM object self or its one child to AT. 495*5fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 496*5fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 497*5fdc4257SSteve Yin * @param pvarRole, [in,out] use to return the role of the proper object. 498*5fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 499*5fdc4257SSteve Yin */ 500*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accRole(VARIANT varChild, VARIANT *pvarRole) 501*5fdc4257SSteve Yin { 502*5fdc4257SSteve Yin 503*5fdc4257SSteve Yin CHECK_ENABLE_INF 504*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 505*5fdc4257SSteve Yin ISDESTROY() 506*5fdc4257SSteve Yin // #CHECK# 507*5fdc4257SSteve Yin if(pvarRole == NULL) 508*5fdc4257SSteve Yin { 509*5fdc4257SSteve Yin return E_INVALIDARG; 510*5fdc4257SSteve Yin } 511*5fdc4257SSteve Yin if(varChild.vt == VT_I4) 512*5fdc4257SSteve Yin { 513*5fdc4257SSteve Yin 514*5fdc4257SSteve Yin if(varChild.lVal == CHILDID_SELF) 515*5fdc4257SSteve Yin { 516*5fdc4257SSteve Yin if( m_iRole < IA2_ROLE_CAPTION ) 517*5fdc4257SSteve Yin { 518*5fdc4257SSteve Yin VariantInit(pvarRole); 519*5fdc4257SSteve Yin pvarRole->vt = VT_I4; 520*5fdc4257SSteve Yin pvarRole->lVal = m_iRole; 521*5fdc4257SSteve Yin } 522*5fdc4257SSteve Yin else 523*5fdc4257SSteve Yin { 524*5fdc4257SSteve Yin VariantInit(pvarRole); 525*5fdc4257SSteve Yin pvarRole->vt = VT_I4; 526*5fdc4257SSteve Yin pvarRole->lVal = ROLE_SYSTEM_CLIENT; 527*5fdc4257SSteve Yin } 528*5fdc4257SSteve Yin return S_OK; 529*5fdc4257SSteve Yin } 530*5fdc4257SSteve Yin 531*5fdc4257SSteve Yin 532*5fdc4257SSteve Yin long lVal = varChild.lVal; 533*5fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 534*5fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 535*5fdc4257SSteve Yin if(!pChild) 536*5fdc4257SSteve Yin return E_FAIL; 537*5fdc4257SSteve Yin return pChild->get_accRole(varChild,pvarRole); 538*5fdc4257SSteve Yin } 539*5fdc4257SSteve Yin return S_FALSE; 540*5fdc4257SSteve Yin 541*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 542*5fdc4257SSteve Yin } 543*5fdc4257SSteve Yin 544*5fdc4257SSteve Yin /** 545*5fdc4257SSteve Yin * Returns the accessible state of the current COM object self or its one child to AT. 546*5fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 547*5fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 548*5fdc4257SSteve Yin * @param pvarState, [in,out] use to return the state of the proper object. 549*5fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 550*5fdc4257SSteve Yin */ 551*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accState(VARIANT varChild, VARIANT *pvarState) 552*5fdc4257SSteve Yin { 553*5fdc4257SSteve Yin 554*5fdc4257SSteve Yin CHECK_ENABLE_INF 555*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 556*5fdc4257SSteve Yin ISDESTROY() 557*5fdc4257SSteve Yin // #CHECK# 558*5fdc4257SSteve Yin if(pvarState == NULL) 559*5fdc4257SSteve Yin { 560*5fdc4257SSteve Yin return E_INVALIDARG; 561*5fdc4257SSteve Yin } 562*5fdc4257SSteve Yin if(varChild.vt==VT_I4) 563*5fdc4257SSteve Yin { 564*5fdc4257SSteve Yin if(varChild.lVal == CHILDID_SELF) 565*5fdc4257SSteve Yin { 566*5fdc4257SSteve Yin if(pUNOInterface) 567*5fdc4257SSteve Yin { 568*5fdc4257SSteve Yin Reference< XAccessibleContext > pContext = pUNOInterface->getAccessibleContext(); 569*5fdc4257SSteve Yin if(pContext.is()) 570*5fdc4257SSteve Yin { 571*5fdc4257SSteve Yin // add the STATE_SYSTEM_LINKED state 572*5fdc4257SSteve Yin Reference< XAccessibleHypertext > pRHypertext(pContext,UNO_QUERY); 573*5fdc4257SSteve Yin if(pRHypertext.is()) 574*5fdc4257SSteve Yin { 575*5fdc4257SSteve Yin if( pRHypertext->getHyperLinkCount() > 0 ) 576*5fdc4257SSteve Yin m_dState |= STATE_SYSTEM_LINKED; 577*5fdc4257SSteve Yin else 578*5fdc4257SSteve Yin m_dState &= ~STATE_SYSTEM_LINKED; 579*5fdc4257SSteve Yin } 580*5fdc4257SSteve Yin else 581*5fdc4257SSteve Yin m_dState &= ~STATE_SYSTEM_LINKED; 582*5fdc4257SSteve Yin } 583*5fdc4257SSteve Yin } 584*5fdc4257SSteve Yin 585*5fdc4257SSteve Yin VariantInit(pvarState); 586*5fdc4257SSteve Yin pvarState->vt = VT_I4; 587*5fdc4257SSteve Yin pvarState->lVal = m_dState; 588*5fdc4257SSteve Yin return S_OK; 589*5fdc4257SSteve Yin } 590*5fdc4257SSteve Yin 591*5fdc4257SSteve Yin long lVal = varChild.lVal; 592*5fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 593*5fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 594*5fdc4257SSteve Yin if(!pChild) 595*5fdc4257SSteve Yin return E_FAIL; 596*5fdc4257SSteve Yin return pChild->get_accState(varChild,pvarState); 597*5fdc4257SSteve Yin } 598*5fdc4257SSteve Yin return S_FALSE; 599*5fdc4257SSteve Yin 600*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 601*5fdc4257SSteve Yin } 602*5fdc4257SSteve Yin 603*5fdc4257SSteve Yin /** 604*5fdc4257SSteve Yin * Returns the accessible helpString of the current COM object self or its one child to AT. 605*5fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 606*5fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 607*5fdc4257SSteve Yin * @param pszHelp, [in,out] use to return the helpString of the proper object. 608*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 609*5fdc4257SSteve Yin */ 610*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accHelp(VARIANT, BSTR *) 611*5fdc4257SSteve Yin { 612*5fdc4257SSteve Yin return E_NOTIMPL; 613*5fdc4257SSteve Yin } 614*5fdc4257SSteve Yin 615*5fdc4257SSteve Yin /** 616*5fdc4257SSteve Yin * Returns the accessible HelpTopic of the current COM object self or its one child to AT. 617*5fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 618*5fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 619*5fdc4257SSteve Yin * @param pszHelpFile, [in,out] use to return the HelpTopic of the proper object. 620*5fdc4257SSteve Yin * @param pidTopic, use to return the HelpTopic ID of the proper object. 621*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 622*5fdc4257SSteve Yin * Not implemented yet 623*5fdc4257SSteve Yin */ 624*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accHelpTopic(BSTR *, VARIANT, long *) 625*5fdc4257SSteve Yin { 626*5fdc4257SSteve Yin return E_NOTIMPL; 627*5fdc4257SSteve Yin } 628*5fdc4257SSteve Yin 629*5fdc4257SSteve Yin static void GetMnemonicChar( const ::rtl::OUString& aStr, WCHAR* wStr) 630*5fdc4257SSteve Yin { 631*5fdc4257SSteve Yin int nLen = aStr.pData->length; 632*5fdc4257SSteve Yin int i = 0; 633*5fdc4257SSteve Yin WCHAR* text = aStr.pData->buffer; 634*5fdc4257SSteve Yin 635*5fdc4257SSteve Yin while ( i < nLen ) 636*5fdc4257SSteve Yin { 637*5fdc4257SSteve Yin if ( text[i] == L'~' ) 638*5fdc4257SSteve Yin if ( text[i+1] != L'~' ) 639*5fdc4257SSteve Yin { 640*5fdc4257SSteve Yin wStr[0] = text[i+1]; 641*5fdc4257SSteve Yin break; 642*5fdc4257SSteve Yin } 643*5fdc4257SSteve Yin i++; 644*5fdc4257SSteve Yin } 645*5fdc4257SSteve Yin } 646*5fdc4257SSteve Yin 647*5fdc4257SSteve Yin /** 648*5fdc4257SSteve Yin * Returns the accessible keyboard shortcut of the current COM object self or its one child to AT. 649*5fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 650*5fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 651*5fdc4257SSteve Yin * @param pszKeyboardShortcut, [in,out] use to return the kbshortcut of the proper object. 652*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 653*5fdc4257SSteve Yin */ 654*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accKeyboardShortcut(VARIANT varChild, BSTR *pszKeyboardShortcut) 655*5fdc4257SSteve Yin { 656*5fdc4257SSteve Yin 657*5fdc4257SSteve Yin CHECK_ENABLE_INF 658*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 659*5fdc4257SSteve Yin 660*5fdc4257SSteve Yin ISDESTROY() 661*5fdc4257SSteve Yin // #CHECK# 662*5fdc4257SSteve Yin if(pszKeyboardShortcut == NULL) 663*5fdc4257SSteve Yin { 664*5fdc4257SSteve Yin return E_INVALIDARG; 665*5fdc4257SSteve Yin } 666*5fdc4257SSteve Yin 667*5fdc4257SSteve Yin if(varChild.vt==VT_I4) 668*5fdc4257SSteve Yin { 669*5fdc4257SSteve Yin if(varChild.lVal == CHILDID_SELF) 670*5fdc4257SSteve Yin { 671*5fdc4257SSteve Yin if( pUNOInterface ) 672*5fdc4257SSteve Yin { 673*5fdc4257SSteve Yin Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext(); 674*5fdc4257SSteve Yin if( !pRContext.is() ) 675*5fdc4257SSteve Yin return S_FALSE; 676*5fdc4257SSteve Yin 677*5fdc4257SSteve Yin Reference<XAccessibleAction> pRXI(pRContext,UNO_QUERY); 678*5fdc4257SSteve Yin 679*5fdc4257SSteve Yin OLECHAR wString[64]={0}; 680*5fdc4257SSteve Yin 681*5fdc4257SSteve Yin if( pRXI.is() && pRXI->getAccessibleActionCount() >= 1) 682*5fdc4257SSteve Yin { 683*5fdc4257SSteve Yin Reference< XAccessibleKeyBinding > binding = pRXI->getAccessibleActionKeyBinding(0); 684*5fdc4257SSteve Yin if( binding.is() ) 685*5fdc4257SSteve Yin { 686*5fdc4257SSteve Yin long nCount = binding->getAccessibleKeyBindingCount(); 687*5fdc4257SSteve Yin if(nCount >= 1) 688*5fdc4257SSteve Yin { 689*5fdc4257SSteve Yin CAccAction::GetkeyBindingStrByXkeyBinding( binding->getAccessibleKeyBinding(0),wString ); 690*5fdc4257SSteve Yin } 691*5fdc4257SSteve Yin } 692*5fdc4257SSteve Yin } 693*5fdc4257SSteve Yin if(wString[0] == 0) 694*5fdc4257SSteve Yin { 695*5fdc4257SSteve Yin Reference<XAccessibleRelationSet> pRrelationSet = pRContext->getAccessibleRelationSet(); 696*5fdc4257SSteve Yin if(!pRrelationSet.is()) 697*5fdc4257SSteve Yin { 698*5fdc4257SSteve Yin return S_FALSE; 699*5fdc4257SSteve Yin } 700*5fdc4257SSteve Yin 701*5fdc4257SSteve Yin long nRelCount = pRrelationSet->getRelationCount(); 702*5fdc4257SSteve Yin 703*5fdc4257SSteve Yin // Modified by Steve Yin, for SODC_1552 704*5fdc4257SSteve Yin if( /*nRelCount <= 0 &&*/ m_iRole == ROLE_SYSTEM_TEXT ) 705*5fdc4257SSteve Yin { 706*5fdc4257SSteve Yin VARIANT varParentRole; 707*5fdc4257SSteve Yin VariantInit( &varParentRole ); 708*5fdc4257SSteve Yin 709*5fdc4257SSteve Yin m_pIParent->get_accRole(varChild, &varParentRole); 710*5fdc4257SSteve Yin 711*5fdc4257SSteve Yin if( m_pIParent && varParentRole.lVal == ROLE_SYSTEM_COMBOBOX ) // edit in comoboBox 712*5fdc4257SSteve Yin { 713*5fdc4257SSteve Yin m_pIParent->get_accKeyboardShortcut(varChild, pszKeyboardShortcut); 714*5fdc4257SSteve Yin return S_OK; 715*5fdc4257SSteve Yin } 716*5fdc4257SSteve Yin } 717*5fdc4257SSteve Yin 718*5fdc4257SSteve Yin AccessibleRelation *paccRelation = NULL; 719*5fdc4257SSteve Yin AccessibleRelation accRelation; 720*5fdc4257SSteve Yin for(int i=0; i<nRelCount ; i++) 721*5fdc4257SSteve Yin { 722*5fdc4257SSteve Yin if( pRrelationSet->getRelation(i).RelationType == 6 ) 723*5fdc4257SSteve Yin { 724*5fdc4257SSteve Yin accRelation = pRrelationSet->getRelation(i); 725*5fdc4257SSteve Yin paccRelation = &accRelation; 726*5fdc4257SSteve Yin } 727*5fdc4257SSteve Yin } 728*5fdc4257SSteve Yin 729*5fdc4257SSteve Yin if(paccRelation == NULL) 730*5fdc4257SSteve Yin return S_FALSE; 731*5fdc4257SSteve Yin 732*5fdc4257SSteve Yin Sequence< Reference< XInterface > > xTargets = paccRelation->TargetSet; 733*5fdc4257SSteve Yin Reference<XInterface> pRAcc = xTargets[0]; 734*5fdc4257SSteve Yin 735*5fdc4257SSteve Yin XAccessible* pXAcc = (XAccessible*)pRAcc.get(); 736*5fdc4257SSteve Yin 737*5fdc4257SSteve Yin Reference<XAccessibleContext> pRLebelContext = pXAcc->getAccessibleContext(); 738*5fdc4257SSteve Yin if(!pRLebelContext.is()) 739*5fdc4257SSteve Yin return S_FALSE; 740*5fdc4257SSteve Yin 741*5fdc4257SSteve Yin pRrelationSet = pRLebelContext->getAccessibleRelationSet(); 742*5fdc4257SSteve Yin nRelCount = pRrelationSet->getRelationCount(); 743*5fdc4257SSteve Yin 744*5fdc4257SSteve Yin paccRelation = NULL; 745*5fdc4257SSteve Yin for(int j=0; j<nRelCount ; j++) 746*5fdc4257SSteve Yin { 747*5fdc4257SSteve Yin if( pRrelationSet->getRelation(j).RelationType == 5 ) 748*5fdc4257SSteve Yin { 749*5fdc4257SSteve Yin accRelation = pRrelationSet->getRelation(j); 750*5fdc4257SSteve Yin paccRelation = &accRelation; 751*5fdc4257SSteve Yin } 752*5fdc4257SSteve Yin } 753*5fdc4257SSteve Yin 754*5fdc4257SSteve Yin if(paccRelation) 755*5fdc4257SSteve Yin { 756*5fdc4257SSteve Yin xTargets = paccRelation->TargetSet; 757*5fdc4257SSteve Yin pRAcc = xTargets[0]; 758*5fdc4257SSteve Yin if(pUNOInterface != (XAccessible*)pRAcc.get()) 759*5fdc4257SSteve Yin return S_FALSE; 760*5fdc4257SSteve Yin } 761*5fdc4257SSteve Yin 762*5fdc4257SSteve Yin Reference<XAccessibleExtendedComponent> pRXIE(pRLebelContext,UNO_QUERY); 763*5fdc4257SSteve Yin if(!pRXIE.is()) 764*5fdc4257SSteve Yin return S_FALSE; 765*5fdc4257SSteve Yin 766*5fdc4257SSteve Yin ::rtl::OUString ouStr = pRXIE->getTitledBorderText(); 767*5fdc4257SSteve Yin WCHAR key[2] = {NULL}; 768*5fdc4257SSteve Yin GetMnemonicChar(ouStr, key); 769*5fdc4257SSteve Yin if(key[0] != 0) 770*5fdc4257SSteve Yin { 771*5fdc4257SSteve Yin wcscat(wString, L"Alt+"); 772*5fdc4257SSteve Yin wcscat(wString, key); 773*5fdc4257SSteve Yin } 774*5fdc4257SSteve Yin else 775*5fdc4257SSteve Yin return S_FALSE; 776*5fdc4257SSteve Yin } 777*5fdc4257SSteve Yin 778*5fdc4257SSteve Yin SAFE_SYSFREESTRING(*pszKeyboardShortcut); 779*5fdc4257SSteve Yin *pszKeyboardShortcut = SysAllocString(wString); 780*5fdc4257SSteve Yin 781*5fdc4257SSteve Yin return S_OK; 782*5fdc4257SSteve Yin } 783*5fdc4257SSteve Yin else 784*5fdc4257SSteve Yin { 785*5fdc4257SSteve Yin return S_FALSE; 786*5fdc4257SSteve Yin } 787*5fdc4257SSteve Yin } 788*5fdc4257SSteve Yin 789*5fdc4257SSteve Yin long lVal = varChild.lVal; 790*5fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 791*5fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 792*5fdc4257SSteve Yin if(!pChild) 793*5fdc4257SSteve Yin return E_FAIL; 794*5fdc4257SSteve Yin 795*5fdc4257SSteve Yin return pChild->get_accKeyboardShortcut(varChild,pszKeyboardShortcut); 796*5fdc4257SSteve Yin } 797*5fdc4257SSteve Yin return S_FALSE; 798*5fdc4257SSteve Yin 799*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 800*5fdc4257SSteve Yin } 801*5fdc4257SSteve Yin 802*5fdc4257SSteve Yin /** 803*5fdc4257SSteve Yin * Returns the current focused child to AT. 804*5fdc4257SSteve Yin * @param pvarChild, [in,out] vt member of pvarChild must be VT_I4,and lVal member stores the child ID, 805*5fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 806*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 807*5fdc4257SSteve Yin */ 808*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accFocus(VARIANT *pvarChild) 809*5fdc4257SSteve Yin { 810*5fdc4257SSteve Yin 811*5fdc4257SSteve Yin CHECK_ENABLE_INF 812*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 813*5fdc4257SSteve Yin ISDESTROY() 814*5fdc4257SSteve Yin // #CHECK# 815*5fdc4257SSteve Yin if(pvarChild == NULL) 816*5fdc4257SSteve Yin { 817*5fdc4257SSteve Yin return E_INVALIDARG; 818*5fdc4257SSteve Yin } 819*5fdc4257SSteve Yin if( m_dFocusChildID==UACC_NO_FOCUS ) 820*5fdc4257SSteve Yin { 821*5fdc4257SSteve Yin pvarChild->vt = VT_EMPTY;//no focus on the object and its children 822*5fdc4257SSteve Yin return S_OK; 823*5fdc4257SSteve Yin } 824*5fdc4257SSteve Yin //if the descendant of current object has focus indicated by m_dFocusChildID, return the IDispatch of this focused object 825*5fdc4257SSteve Yin else 826*5fdc4257SSteve Yin { 827*5fdc4257SSteve Yin IMAccessible* pIMAcc = NULL; 828*5fdc4257SSteve Yin g_pAgent->GetIAccessibleFromResID(m_dFocusChildID,&pIMAcc); 829*5fdc4257SSteve Yin pIMAcc->AddRef(); 830*5fdc4257SSteve Yin pvarChild->vt = VT_DISPATCH; 831*5fdc4257SSteve Yin pvarChild->pdispVal = pIMAcc; 832*5fdc4257SSteve Yin 833*5fdc4257SSteve Yin } 834*5fdc4257SSteve Yin return S_OK; 835*5fdc4257SSteve Yin 836*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 837*5fdc4257SSteve Yin } 838*5fdc4257SSteve Yin 839*5fdc4257SSteve Yin /** 840*5fdc4257SSteve Yin * Returns the selection of the current COM object to AT. 841*5fdc4257SSteve Yin * @param pvarChildren,[in,out] 842*5fdc4257SSteve Yin * if selection num is 0,return VT_EMPTY for vt, 843*5fdc4257SSteve Yin * if selection num is 1,return VT_I4 for vt,and child index for lVal 844*5fdc4257SSteve Yin * if selection num >1,return VT_UNKNOWN for vt, and IEnumVariant* for punkVal 845*5fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 846*5fdc4257SSteve Yin */ 847*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accSelection(VARIANT *pvarChildren) 848*5fdc4257SSteve Yin { 849*5fdc4257SSteve Yin 850*5fdc4257SSteve Yin CHECK_ENABLE_INF 851*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 852*5fdc4257SSteve Yin ISDESTROY() 853*5fdc4257SSteve Yin // #CHECK# 854*5fdc4257SSteve Yin if(pvarChildren == NULL) 855*5fdc4257SSteve Yin { 856*5fdc4257SSteve Yin return E_INVALIDARG; 857*5fdc4257SSteve Yin } 858*5fdc4257SSteve Yin switch(m_pEnumVar->GetCountOfElements()) 859*5fdc4257SSteve Yin { 860*5fdc4257SSteve Yin case 0: 861*5fdc4257SSteve Yin pvarChildren->vt = VT_EMPTY; 862*5fdc4257SSteve Yin break; 863*5fdc4257SSteve Yin case 1: 864*5fdc4257SSteve Yin VARIANT varTmp[1]; 865*5fdc4257SSteve Yin ULONG count; 866*5fdc4257SSteve Yin VariantInit(&varTmp[0]); 867*5fdc4257SSteve Yin m_pEnumVar->Next(1,varTmp,&count); 868*5fdc4257SSteve Yin if(count!=1) 869*5fdc4257SSteve Yin return S_FALSE; 870*5fdc4257SSteve Yin pvarChildren->vt = VT_I4; 871*5fdc4257SSteve Yin pvarChildren->lVal = varTmp[0].lVal; 872*5fdc4257SSteve Yin VariantClear(&varTmp[0]); 873*5fdc4257SSteve Yin m_pEnumVar->Reset(); 874*5fdc4257SSteve Yin break; 875*5fdc4257SSteve Yin default: 876*5fdc4257SSteve Yin pvarChildren->vt = VT_UNKNOWN; 877*5fdc4257SSteve Yin m_pEnumVar->AddRef(); 878*5fdc4257SSteve Yin pvarChildren->punkVal = m_pEnumVar; 879*5fdc4257SSteve Yin break; 880*5fdc4257SSteve Yin } 881*5fdc4257SSteve Yin return S_OK; 882*5fdc4257SSteve Yin 883*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 884*5fdc4257SSteve Yin } 885*5fdc4257SSteve Yin 886*5fdc4257SSteve Yin /** 887*5fdc4257SSteve Yin * Returns the location of the current COM object self or its one child to AT. 888*5fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 889*5fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 890*5fdc4257SSteve Yin * @param pxLeft, [in,out] use to return the x-coordination of the proper object. 891*5fdc4257SSteve Yin * @param pyTop, [in,out] use to return the y-coordination of the proper object. 892*5fdc4257SSteve Yin * @param pcxWidth, [in,out] use to return the x-coordination width of the proper object. 893*5fdc4257SSteve Yin * @param pcyHeight, [in,out] use to return the y-coordination height of the proper object. 894*5fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 895*5fdc4257SSteve Yin */ 896*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::accLocation(long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varChild) 897*5fdc4257SSteve Yin { 898*5fdc4257SSteve Yin 899*5fdc4257SSteve Yin CHECK_ENABLE_INF 900*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 901*5fdc4257SSteve Yin ISDESTROY() 902*5fdc4257SSteve Yin // #CHECK# 903*5fdc4257SSteve Yin if(pxLeft == NULL || pyTop == NULL || pcxWidth == NULL || pcyHeight == NULL) 904*5fdc4257SSteve Yin { 905*5fdc4257SSteve Yin return E_INVALIDARG; 906*5fdc4257SSteve Yin } 907*5fdc4257SSteve Yin 908*5fdc4257SSteve Yin if(varChild.vt==VT_I4) 909*5fdc4257SSteve Yin { 910*5fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 911*5fdc4257SSteve Yin { 912*5fdc4257SSteve Yin 913*5fdc4257SSteve Yin if(pUNOInterface) 914*5fdc4257SSteve Yin { 915*5fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext(); 916*5fdc4257SSteve Yin if( !pRContext.is() ) 917*5fdc4257SSteve Yin return S_FALSE; 918*5fdc4257SSteve Yin Reference< XAccessibleComponent > pRComponent(pRContext,UNO_QUERY); 919*5fdc4257SSteve Yin if( !pRComponent.is() ) 920*5fdc4257SSteve Yin return S_FALSE; 921*5fdc4257SSteve Yin 922*5fdc4257SSteve Yin ::com::sun::star::awt::Point pCPoint = pRComponent->getLocationOnScreen(); 923*5fdc4257SSteve Yin ::com::sun::star::awt::Size pCSize = pRComponent->getSize(); 924*5fdc4257SSteve Yin *pxLeft = pCPoint.X; 925*5fdc4257SSteve Yin *pyTop = pCPoint.Y; 926*5fdc4257SSteve Yin *pcxWidth = pCSize.Width; 927*5fdc4257SSteve Yin *pcyHeight = pCSize.Height; 928*5fdc4257SSteve Yin return S_OK; 929*5fdc4257SSteve Yin } 930*5fdc4257SSteve Yin else 931*5fdc4257SSteve Yin { 932*5fdc4257SSteve Yin *pxLeft = m_sLocation.m_dLeft; 933*5fdc4257SSteve Yin *pyTop = m_sLocation.m_dTop; 934*5fdc4257SSteve Yin *pcxWidth = m_sLocation.m_dWidth; 935*5fdc4257SSteve Yin *pcyHeight = m_sLocation.m_dHeight; 936*5fdc4257SSteve Yin return S_OK; 937*5fdc4257SSteve Yin } 938*5fdc4257SSteve Yin } 939*5fdc4257SSteve Yin 940*5fdc4257SSteve Yin } 941*5fdc4257SSteve Yin return S_FALSE; 942*5fdc4257SSteve Yin 943*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 944*5fdc4257SSteve Yin } 945*5fdc4257SSteve Yin 946*5fdc4257SSteve Yin /** 947*5fdc4257SSteve Yin * Returns the current focused child to AT. 948*5fdc4257SSteve Yin * @param navDir, the direction flag of the navigation. 949*5fdc4257SSteve Yin * @param varStart, the start child id of this navigation action. 950*5fdc4257SSteve Yin * @param pvarEndUpAt, [in,out] the end up child of this navigation action. 951*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 952*5fdc4257SSteve Yin */ 953*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::accNavigate(long navDir, VARIANT varStart, VARIANT *pvarEndUpAt) 954*5fdc4257SSteve Yin { 955*5fdc4257SSteve Yin 956*5fdc4257SSteve Yin CHECK_ENABLE_INF 957*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 958*5fdc4257SSteve Yin ISDESTROY() 959*5fdc4257SSteve Yin // #CHECK# 960*5fdc4257SSteve Yin if(pvarEndUpAt == NULL) 961*5fdc4257SSteve Yin { 962*5fdc4257SSteve Yin return E_INVALIDARG; 963*5fdc4257SSteve Yin } 964*5fdc4257SSteve Yin HRESULT ret = E_FAIL; 965*5fdc4257SSteve Yin switch (navDir) 966*5fdc4257SSteve Yin { 967*5fdc4257SSteve Yin case NAVDIR_FIRSTCHILD: 968*5fdc4257SSteve Yin ret = GetFirstChild(varStart,pvarEndUpAt); 969*5fdc4257SSteve Yin break; 970*5fdc4257SSteve Yin case NAVDIR_LASTCHILD: 971*5fdc4257SSteve Yin ret = GetLastChild(varStart,pvarEndUpAt); 972*5fdc4257SSteve Yin break; 973*5fdc4257SSteve Yin case NAVDIR_NEXT: 974*5fdc4257SSteve Yin ret = GetNextSibling(varStart,pvarEndUpAt); 975*5fdc4257SSteve Yin break; 976*5fdc4257SSteve Yin case NAVDIR_PREVIOUS: 977*5fdc4257SSteve Yin ret = GetPreSibling(varStart,pvarEndUpAt); 978*5fdc4257SSteve Yin break; 979*5fdc4257SSteve Yin case NAVDIR_DOWN://do not implement temporarily 980*5fdc4257SSteve Yin break; 981*5fdc4257SSteve Yin case NAVDIR_UP://do not implement temporarily 982*5fdc4257SSteve Yin break; 983*5fdc4257SSteve Yin case NAVDIR_LEFT://do not implement temporarily 984*5fdc4257SSteve Yin break; 985*5fdc4257SSteve Yin case NAVDIR_RIGHT://do not implement temporarily 986*5fdc4257SSteve Yin break; 987*5fdc4257SSteve Yin default: 988*5fdc4257SSteve Yin break; 989*5fdc4257SSteve Yin }; 990*5fdc4257SSteve Yin return ret; 991*5fdc4257SSteve Yin 992*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 993*5fdc4257SSteve Yin } 994*5fdc4257SSteve Yin 995*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::accHitTest(long xLeft, long yTop, VARIANT *pvarChild) 996*5fdc4257SSteve Yin { 997*5fdc4257SSteve Yin 998*5fdc4257SSteve Yin CHECK_ENABLE_INF 999*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1000*5fdc4257SSteve Yin ISDESTROY() 1001*5fdc4257SSteve Yin // #CHECK# 1002*5fdc4257SSteve Yin if(pvarChild == NULL) 1003*5fdc4257SSteve Yin { 1004*5fdc4257SSteve Yin return E_INVALIDARG; 1005*5fdc4257SSteve Yin } 1006*5fdc4257SSteve Yin long x, y, w, h; 1007*5fdc4257SSteve Yin VARIANT varSelf; 1008*5fdc4257SSteve Yin VariantInit(&varSelf); 1009*5fdc4257SSteve Yin varSelf.vt = VT_I4; 1010*5fdc4257SSteve Yin varSelf.lVal = CHILDID_SELF; 1011*5fdc4257SSteve Yin accLocation(&x,&y,&w,&h,varSelf); 1012*5fdc4257SSteve Yin if( (x < xLeft && (x + w) >xLeft) && (y < yTop && (y + h) >yTop) ) 1013*5fdc4257SSteve Yin { 1014*5fdc4257SSteve Yin int i, nCount; 1015*5fdc4257SSteve Yin pvarChild->vt = VT_EMPTY; 1016*5fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = GetContextByXAcc(pUNOInterface); 1017*5fdc4257SSteve Yin nCount = pRContext->getAccessibleChildCount(); 1018*5fdc4257SSteve Yin if(nCount > 256) 1019*5fdc4257SSteve Yin return E_FAIL; 1020*5fdc4257SSteve Yin IMAccessible* child = NULL; 1021*5fdc4257SSteve Yin for( i = 0; i<nCount; i++) 1022*5fdc4257SSteve Yin { 1023*5fdc4257SSteve Yin 1024*5fdc4257SSteve Yin child = GetChildInterface(i + 1); 1025*5fdc4257SSteve Yin if(child && child->accHitTest(xLeft,yTop,pvarChild) == S_OK) 1026*5fdc4257SSteve Yin break; 1027*5fdc4257SSteve Yin } 1028*5fdc4257SSteve Yin 1029*5fdc4257SSteve Yin if(pvarChild->vt == VT_DISPATCH) 1030*5fdc4257SSteve Yin return S_OK; 1031*5fdc4257SSteve Yin 1032*5fdc4257SSteve Yin if( i < nCount) 1033*5fdc4257SSteve Yin { 1034*5fdc4257SSteve Yin pvarChild->vt = VT_DISPATCH; 1035*5fdc4257SSteve Yin pvarChild->pdispVal = child; 1036*5fdc4257SSteve Yin child->AddRef(); 1037*5fdc4257SSteve Yin } 1038*5fdc4257SSteve Yin else 1039*5fdc4257SSteve Yin { 1040*5fdc4257SSteve Yin pvarChild->vt = VT_I4; 1041*5fdc4257SSteve Yin pvarChild->lVal = CHILDID_SELF; 1042*5fdc4257SSteve Yin } 1043*5fdc4257SSteve Yin return S_OK; 1044*5fdc4257SSteve Yin } 1045*5fdc4257SSteve Yin return S_FALSE; 1046*5fdc4257SSteve Yin 1047*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1048*5fdc4257SSteve Yin } 1049*5fdc4257SSteve Yin 1050*5fdc4257SSteve Yin /** 1051*5fdc4257SSteve Yin * Get The other Interface from CMAccessible. 1052*5fdc4257SSteve Yin * @param guidService, must be IID_IAccessible here. 1053*5fdc4257SSteve Yin * @param riid, the IID interface . 1054*5fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 1055*5fdc4257SSteve Yin */ 1056*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::QueryService(REFGUID guidService, REFIID riid, void** ppvObject) 1057*5fdc4257SSteve Yin { 1058*5fdc4257SSteve Yin if( InlineIsEqualGUID(guidService, IID_IAccessible) ) 1059*5fdc4257SSteve Yin return QueryInterface(riid, ppvObject); 1060*5fdc4257SSteve Yin return S_FALSE; 1061*5fdc4257SSteve Yin } 1062*5fdc4257SSteve Yin 1063*5fdc4257SSteve Yin /** 1064*5fdc4257SSteve Yin * Set the accessible name of the current COM object self or its one child from UNO. 1065*5fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 1066*5fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 1067*5fdc4257SSteve Yin * @param szName, the name used to set the name of the proper object. 1068*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1069*5fdc4257SSteve Yin */ 1070*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::put_accName(VARIANT varChild, BSTR szName) 1071*5fdc4257SSteve Yin { 1072*5fdc4257SSteve Yin 1073*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1074*5fdc4257SSteve Yin ISDESTROY() 1075*5fdc4257SSteve Yin if(varChild.vt==VT_I4) 1076*5fdc4257SSteve Yin { 1077*5fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 1078*5fdc4257SSteve Yin { 1079*5fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszName); 1080*5fdc4257SSteve Yin m_pszName=SysAllocString(szName); 1081*5fdc4257SSteve Yin return S_OK; 1082*5fdc4257SSteve Yin } 1083*5fdc4257SSteve Yin 1084*5fdc4257SSteve Yin long lVal = varChild.lVal; 1085*5fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 1086*5fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 1087*5fdc4257SSteve Yin if(!pChild) 1088*5fdc4257SSteve Yin return E_FAIL; 1089*5fdc4257SSteve Yin return pChild->put_accName(varChild,szName); 1090*5fdc4257SSteve Yin } 1091*5fdc4257SSteve Yin return E_FAIL; 1092*5fdc4257SSteve Yin 1093*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1094*5fdc4257SSteve Yin } 1095*5fdc4257SSteve Yin 1096*5fdc4257SSteve Yin /** 1097*5fdc4257SSteve Yin * Set the accessible value of the current COM object self or its one child from UNO. 1098*5fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 1099*5fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 1100*5fdc4257SSteve Yin * @param szValue, the value used to set the value of the proper object. 1101*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1102*5fdc4257SSteve Yin */ 1103*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::put_accValue(VARIANT varChild, BSTR szValue) 1104*5fdc4257SSteve Yin { 1105*5fdc4257SSteve Yin 1106*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1107*5fdc4257SSteve Yin ISDESTROY() 1108*5fdc4257SSteve Yin if(varChild.vt==VT_I4) 1109*5fdc4257SSteve Yin { 1110*5fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 1111*5fdc4257SSteve Yin { 1112*5fdc4257SSteve Yin SysAllocString(m_pszValue); 1113*5fdc4257SSteve Yin m_pszValue=SysAllocString(szValue); 1114*5fdc4257SSteve Yin return S_OK; 1115*5fdc4257SSteve Yin } 1116*5fdc4257SSteve Yin 1117*5fdc4257SSteve Yin long lVal = varChild.lVal; 1118*5fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 1119*5fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 1120*5fdc4257SSteve Yin if(!pChild) 1121*5fdc4257SSteve Yin return E_FAIL; 1122*5fdc4257SSteve Yin return pChild->put_accValue(varChild,szValue); 1123*5fdc4257SSteve Yin } 1124*5fdc4257SSteve Yin return E_FAIL; 1125*5fdc4257SSteve Yin 1126*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1127*5fdc4257SSteve Yin } 1128*5fdc4257SSteve Yin 1129*5fdc4257SSteve Yin /** 1130*5fdc4257SSteve Yin * Set the accessible name of the current COM object self from UNO. 1131*5fdc4257SSteve Yin * @param pszName, the name value used to set the name of the current object. 1132*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1133*5fdc4257SSteve Yin */ 1134*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccName(const OLECHAR __RPC_FAR *pszName) 1135*5fdc4257SSteve Yin { 1136*5fdc4257SSteve Yin 1137*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1138*5fdc4257SSteve Yin ISDESTROY() 1139*5fdc4257SSteve Yin // #CHECK# 1140*5fdc4257SSteve Yin if(pszName == NULL) 1141*5fdc4257SSteve Yin { 1142*5fdc4257SSteve Yin return E_INVALIDARG; 1143*5fdc4257SSteve Yin } 1144*5fdc4257SSteve Yin 1145*5fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszName);//?? 1146*5fdc4257SSteve Yin m_pszName = SysAllocString(pszName); 1147*5fdc4257SSteve Yin if(m_pszName==NULL) 1148*5fdc4257SSteve Yin return E_FAIL; 1149*5fdc4257SSteve Yin return S_OK; 1150*5fdc4257SSteve Yin 1151*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1152*5fdc4257SSteve Yin } 1153*5fdc4257SSteve Yin 1154*5fdc4257SSteve Yin /** 1155*5fdc4257SSteve Yin * Set the accessible role of the current COM object self from UNO. 1156*5fdc4257SSteve Yin * @param pRole, the role value used to set the role of the current object. 1157*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1158*5fdc4257SSteve Yin */ 1159*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccRole(unsigned short pRole) 1160*5fdc4257SSteve Yin { 1161*5fdc4257SSteve Yin m_iRole = pRole; 1162*5fdc4257SSteve Yin return S_OK; 1163*5fdc4257SSteve Yin } 1164*5fdc4257SSteve Yin 1165*5fdc4257SSteve Yin /** 1166*5fdc4257SSteve Yin * Add one state into the current state set for the current COM object from UNO. 1167*5fdc4257SSteve Yin * @param pXSate, the state used to set the name of the current object. 1168*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1169*5fdc4257SSteve Yin */ 1170*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::DecreaseState(DWORD pXSate) 1171*5fdc4257SSteve Yin { 1172*5fdc4257SSteve Yin m_dState &= (~pXSate); 1173*5fdc4257SSteve Yin return S_OK; 1174*5fdc4257SSteve Yin } 1175*5fdc4257SSteve Yin 1176*5fdc4257SSteve Yin /** 1177*5fdc4257SSteve Yin * Delete one state into the current state set for the current COM object from UNO. 1178*5fdc4257SSteve Yin * @param pXSate, the state used to set the name of the current object. 1179*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1180*5fdc4257SSteve Yin */ 1181*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::IncreaseState(DWORD pXSate) 1182*5fdc4257SSteve Yin { 1183*5fdc4257SSteve Yin m_dState |= pXSate; 1184*5fdc4257SSteve Yin return S_OK; 1185*5fdc4257SSteve Yin } 1186*5fdc4257SSteve Yin 1187*5fdc4257SSteve Yin /** 1188*5fdc4257SSteve Yin * Set state into the current state set for the current COM object from UNO. 1189*5fdc4257SSteve Yin * @param pXSate, the state used to set the name of the current object. 1190*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1191*5fdc4257SSteve Yin */ 1192*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::SetState(DWORD pXSate) 1193*5fdc4257SSteve Yin { 1194*5fdc4257SSteve Yin m_dState = pXSate; 1195*5fdc4257SSteve Yin return S_OK; 1196*5fdc4257SSteve Yin } 1197*5fdc4257SSteve Yin 1198*5fdc4257SSteve Yin 1199*5fdc4257SSteve Yin 1200*5fdc4257SSteve Yin /** 1201*5fdc4257SSteve Yin * Set the accessible description of the current COM object self from UNO. 1202*5fdc4257SSteve Yin * @param pszDescription, the name used to set the description of the current object. 1203*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1204*5fdc4257SSteve Yin */ 1205*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccDescription(const OLECHAR __RPC_FAR *pszDescription) 1206*5fdc4257SSteve Yin { 1207*5fdc4257SSteve Yin 1208*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1209*5fdc4257SSteve Yin ISDESTROY() 1210*5fdc4257SSteve Yin // #CHECK# 1211*5fdc4257SSteve Yin if(pszDescription == NULL) 1212*5fdc4257SSteve Yin { 1213*5fdc4257SSteve Yin return E_INVALIDARG; 1214*5fdc4257SSteve Yin } 1215*5fdc4257SSteve Yin 1216*5fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszDescription); 1217*5fdc4257SSteve Yin m_pszDescription = SysAllocString(pszDescription); 1218*5fdc4257SSteve Yin 1219*5fdc4257SSteve Yin if(m_pszDescription==NULL) 1220*5fdc4257SSteve Yin return E_FAIL; 1221*5fdc4257SSteve Yin return S_OK; 1222*5fdc4257SSteve Yin 1223*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1224*5fdc4257SSteve Yin } 1225*5fdc4257SSteve Yin 1226*5fdc4257SSteve Yin /** 1227*5fdc4257SSteve Yin * Set the accessible value of the current COM object self from UNO. 1228*5fdc4257SSteve Yin * @param pszAccValue, the name used to set the value of the current object. 1229*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1230*5fdc4257SSteve Yin */ 1231*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccValue(const OLECHAR __RPC_FAR *pszAccValue) 1232*5fdc4257SSteve Yin { 1233*5fdc4257SSteve Yin 1234*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1235*5fdc4257SSteve Yin ISDESTROY() 1236*5fdc4257SSteve Yin // #CHECK# 1237*5fdc4257SSteve Yin if(pszAccValue == NULL) 1238*5fdc4257SSteve Yin { 1239*5fdc4257SSteve Yin return E_INVALIDARG; 1240*5fdc4257SSteve Yin } 1241*5fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszValue); 1242*5fdc4257SSteve Yin m_pszValue = SysAllocString(pszAccValue); 1243*5fdc4257SSteve Yin if(m_pszValue==NULL) 1244*5fdc4257SSteve Yin return E_FAIL; 1245*5fdc4257SSteve Yin return S_OK; 1246*5fdc4257SSteve Yin 1247*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1248*5fdc4257SSteve Yin } 1249*5fdc4257SSteve Yin 1250*5fdc4257SSteve Yin /** 1251*5fdc4257SSteve Yin * Set the HWND value of the current COM object self from UNO. It should set the parent IAccessible 1252*5fdc4257SSteve Yin * Object through the method AccessibleObjectFromWindow(...). 1253*5fdc4257SSteve Yin * @param hwnd, the HWND used to set the value of the current object. 1254*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1255*5fdc4257SSteve Yin */ 1256*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccWindowHandle(HWND hwnd) 1257*5fdc4257SSteve Yin { 1258*5fdc4257SSteve Yin 1259*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1260*5fdc4257SSteve Yin ISDESTROY() 1261*5fdc4257SSteve Yin m_hwnd = hwnd; 1262*5fdc4257SSteve Yin return S_OK; 1263*5fdc4257SSteve Yin 1264*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1265*5fdc4257SSteve Yin } 1266*5fdc4257SSteve Yin 1267*5fdc4257SSteve Yin /** 1268*5fdc4257SSteve Yin * Set accessible focus by specifying child ID 1269*5fdc4257SSteve Yin * @param dChildID, the child id identifies the focus child. 1270*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1271*5fdc4257SSteve Yin */ 1272*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccFocus(long dChildID) 1273*5fdc4257SSteve Yin { 1274*5fdc4257SSteve Yin 1275*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1276*5fdc4257SSteve Yin ISDESTROY() 1277*5fdc4257SSteve Yin 1278*5fdc4257SSteve Yin if(dChildID==CHILDID_SELF) 1279*5fdc4257SSteve Yin { 1280*5fdc4257SSteve Yin if(m_pIParent) 1281*5fdc4257SSteve Yin { 1282*5fdc4257SSteve Yin m_pIParent->Put_XAccFocus(m_dChildID); 1283*5fdc4257SSteve Yin } 1284*5fdc4257SSteve Yin } 1285*5fdc4257SSteve Yin else 1286*5fdc4257SSteve Yin { 1287*5fdc4257SSteve Yin m_dFocusChildID = dChildID; 1288*5fdc4257SSteve Yin //traverse all ancestors to set the focused child ID so that when the get_accFocus is called on 1289*5fdc4257SSteve Yin //any of the ancestors, this id can be used to get the IAccessible of focused object. 1290*5fdc4257SSteve Yin if(m_pIParent) 1291*5fdc4257SSteve Yin { 1292*5fdc4257SSteve Yin m_pIParent->Put_XAccFocus(dChildID); 1293*5fdc4257SSteve Yin } 1294*5fdc4257SSteve Yin } 1295*5fdc4257SSteve Yin return S_OK; 1296*5fdc4257SSteve Yin 1297*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1298*5fdc4257SSteve Yin } 1299*5fdc4257SSteve Yin 1300*5fdc4257SSteve Yin /** 1301*5fdc4257SSteve Yin *Set accessible object location for the current COM object 1302*5fdc4257SSteve Yin * @param sLocation, the location of the current object. 1303*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1304*5fdc4257SSteve Yin */ 1305*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccLocation(const Location sLocation) 1306*5fdc4257SSteve Yin { 1307*5fdc4257SSteve Yin 1308*5fdc4257SSteve Yin this->m_sLocation = sLocation; 1309*5fdc4257SSteve Yin return S_OK; 1310*5fdc4257SSteve Yin } 1311*5fdc4257SSteve Yin 1312*5fdc4257SSteve Yin /** 1313*5fdc4257SSteve Yin * Set accessible parent object for the current COM object if 1314*5fdc4257SSteve Yin * the current object is a child of some COM object 1315*5fdc4257SSteve Yin * @param pIParent, the parent of the current object. 1316*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1317*5fdc4257SSteve Yin */ 1318*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccParent(IMAccessible __RPC_FAR *pIParent) 1319*5fdc4257SSteve Yin { 1320*5fdc4257SSteve Yin this->m_pIParent = pIParent; 1321*5fdc4257SSteve Yin 1322*5fdc4257SSteve Yin if(pIParent) 1323*5fdc4257SSteve Yin m_pIParent->AddRef(); 1324*5fdc4257SSteve Yin 1325*5fdc4257SSteve Yin return S_OK; 1326*5fdc4257SSteve Yin } 1327*5fdc4257SSteve Yin 1328*5fdc4257SSteve Yin /** 1329*5fdc4257SSteve Yin * Set unique child id to COM 1330*5fdc4257SSteve Yin * @param dChildID, the id of the current object. 1331*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1332*5fdc4257SSteve Yin */ 1333*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccChildID(long dChildID) 1334*5fdc4257SSteve Yin { 1335*5fdc4257SSteve Yin 1336*5fdc4257SSteve Yin this->m_dChildID = dChildID; 1337*5fdc4257SSteve Yin return S_OK; 1338*5fdc4257SSteve Yin } 1339*5fdc4257SSteve Yin 1340*5fdc4257SSteve Yin /** 1341*5fdc4257SSteve Yin * Set AccObjectManagerAgent object pointer to COM 1342*5fdc4257SSteve Yin * @param pAgent, the AccObjectManagerAgent point. 1343*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1344*5fdc4257SSteve Yin */ 1345*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccAgent(long pAgent) 1346*5fdc4257SSteve Yin { 1347*5fdc4257SSteve Yin g_pAgent = (AccObjectManagerAgent*)pAgent; 1348*5fdc4257SSteve Yin return S_OK; 1349*5fdc4257SSteve Yin } 1350*5fdc4257SSteve Yin 1351*5fdc4257SSteve Yin /** 1352*5fdc4257SSteve Yin * When a UNO control disposing, it disposes its listeners, 1353*5fdc4257SSteve Yin * then notify AccObject in bridge management, then notify 1354*5fdc4257SSteve Yin * COM that the XAccessible is invalid,so set pUNOInterface as NULL 1355*5fdc4257SSteve Yin * @param isDestroy, true is it need to be destroyed. 1356*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1357*5fdc4257SSteve Yin */ 1358*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::NotifyDestroy(BOOL isDestroy) 1359*5fdc4257SSteve Yin { 1360*5fdc4257SSteve Yin 1361*5fdc4257SSteve Yin m_isDestroy = isDestroy; 1362*5fdc4257SSteve Yin pUNOInterface = NULL; 1363*5fdc4257SSteve Yin return S_OK; 1364*5fdc4257SSteve Yin } 1365*5fdc4257SSteve Yin 1366*5fdc4257SSteve Yin /** 1367*5fdc4257SSteve Yin *private methods that help implement public functions 1368*5fdc4257SSteve Yin */ 1369*5fdc4257SSteve Yin 1370*5fdc4257SSteve Yin /** 1371*5fdc4257SSteve Yin * Return child interface pointer by child ID,note: need to call AddRef() 1372*5fdc4257SSteve Yin * @param lChildID, specify child index,which AT(such as Inspect32) gives. 1373*5fdc4257SSteve Yin * @return IMAccessible*, pointer to the corresponding child object. 1374*5fdc4257SSteve Yin */ 1375*5fdc4257SSteve Yin IMAccessible* CMAccessible::GetChildInterface(long dChildID)//for test 1376*5fdc4257SSteve Yin { 1377*5fdc4257SSteve Yin 1378*5fdc4257SSteve Yin long dChildIndex = 0; 1379*5fdc4257SSteve Yin if(dChildID<0) 1380*5fdc4257SSteve Yin { 1381*5fdc4257SSteve Yin if(g_pAgent) 1382*5fdc4257SSteve Yin { 1383*5fdc4257SSteve Yin IMAccessible* pIMAcc = NULL; 1384*5fdc4257SSteve Yin g_pAgent->GetIAccessibleFromResID(dChildID,&pIMAcc); 1385*5fdc4257SSteve Yin return pIMAcc; 1386*5fdc4257SSteve Yin } 1387*5fdc4257SSteve Yin return NULL; 1388*5fdc4257SSteve Yin } 1389*5fdc4257SSteve Yin else 1390*5fdc4257SSteve Yin { 1391*5fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext(); 1392*5fdc4257SSteve Yin if( !pRContext.is() ) 1393*5fdc4257SSteve Yin return NULL; 1394*5fdc4257SSteve Yin 1395*5fdc4257SSteve Yin if(dChildID<1 || dChildID>pRContext->getAccessibleChildCount()) 1396*5fdc4257SSteve Yin return NULL; 1397*5fdc4257SSteve Yin 1398*5fdc4257SSteve Yin IAccessible* pChild = NULL; 1399*5fdc4257SSteve Yin Reference< XAccessible > pXChild = pRContext->getAccessibleChild(dChildID-1); 1400*5fdc4257SSteve Yin BOOL isGet = get_IAccessibleFromXAccessible((long)pXChild.get(),&pChild); 1401*5fdc4257SSteve Yin 1402*5fdc4257SSteve Yin if(!isGet) 1403*5fdc4257SSteve Yin { 1404*5fdc4257SSteve Yin g_pAgent->InsertAccObj(pXChild.get(),pUNOInterface,(long)m_hwnd); 1405*5fdc4257SSteve Yin isGet = get_IAccessibleFromXAccessible((long)pXChild.get(),&pChild); 1406*5fdc4257SSteve Yin } 1407*5fdc4257SSteve Yin 1408*5fdc4257SSteve Yin if(isGet) 1409*5fdc4257SSteve Yin { 1410*5fdc4257SSteve Yin IMAccessible* pIMAcc = (IMAccessible*)pChild; 1411*5fdc4257SSteve Yin return pIMAcc; 1412*5fdc4257SSteve Yin } 1413*5fdc4257SSteve Yin } 1414*5fdc4257SSteve Yin 1415*5fdc4257SSteve Yin return NULL; 1416*5fdc4257SSteve Yin } 1417*5fdc4257SSteve Yin 1418*5fdc4257SSteve Yin /** 1419*5fdc4257SSteve Yin * For List, tree and table,these roles belong to manage_decendant in UNO, 1420*5fdc4257SSteve Yin * need to process specifically when navigate 1421*5fdc4257SSteve Yin * @return BOOL, if it is decendantmanager, return true. 1422*5fdc4257SSteve Yin */ 1423*5fdc4257SSteve Yin BOOL CMAccessible::IsDecendantManage() 1424*5fdc4257SSteve Yin { 1425*5fdc4257SSteve Yin 1426*5fdc4257SSteve Yin return (m_iRole==ROLE_SYSTEM_LIST)||(m_iRole==ROLE_SYSTEM_OUTLINE)||(m_iRole==ROLE_SYSTEM_TABLE); 1427*5fdc4257SSteve Yin } 1428*5fdc4257SSteve Yin 1429*5fdc4257SSteve Yin /** 1430*5fdc4257SSteve Yin * for decendantmanager circumstance,provide child interface when navigate 1431*5fdc4257SSteve Yin * @param varCur, the current child. 1432*5fdc4257SSteve Yin * @param flags, the navigation direction. 1433*5fdc4257SSteve Yin * @return IMAccessible*, the child of the end up node. 1434*5fdc4257SSteve Yin */ 1435*5fdc4257SSteve Yin IMAccessible* CMAccessible::GetNavigateChildForDM(VARIANT varCur, short flags) 1436*5fdc4257SSteve Yin { 1437*5fdc4257SSteve Yin 1438*5fdc4257SSteve Yin XAccessibleContext* pXContext = GetContextByXAcc(pUNOInterface); 1439*5fdc4257SSteve Yin if(pXContext==NULL) 1440*5fdc4257SSteve Yin { 1441*5fdc4257SSteve Yin return NULL; 1442*5fdc4257SSteve Yin } 1443*5fdc4257SSteve Yin 1444*5fdc4257SSteve Yin int count = pXContext->getAccessibleChildCount(); 1445*5fdc4257SSteve Yin if(count<1) 1446*5fdc4257SSteve Yin { 1447*5fdc4257SSteve Yin return NULL; 1448*5fdc4257SSteve Yin } 1449*5fdc4257SSteve Yin 1450*5fdc4257SSteve Yin IMAccessible* pCurChild = NULL; 1451*5fdc4257SSteve Yin XAccessible* pChildXAcc = NULL; 1452*5fdc4257SSteve Yin Reference<XAccessible> pRChildXAcc; 1453*5fdc4257SSteve Yin XAccessibleContext* pChildContext = NULL; 1454*5fdc4257SSteve Yin int index = 0,delta=0; 1455*5fdc4257SSteve Yin switch(flags) 1456*5fdc4257SSteve Yin { 1457*5fdc4257SSteve Yin case DM_FIRSTCHILD: 1458*5fdc4257SSteve Yin pRChildXAcc = pXContext->getAccessibleChild(0); 1459*5fdc4257SSteve Yin break; 1460*5fdc4257SSteve Yin case DM_LASTCHILD: 1461*5fdc4257SSteve Yin pRChildXAcc = pXContext->getAccessibleChild(count-1); 1462*5fdc4257SSteve Yin break; 1463*5fdc4257SSteve Yin case DM_NEXTCHILD: 1464*5fdc4257SSteve Yin case DM_PREVCHILD: 1465*5fdc4257SSteve Yin pCurChild = GetChildInterface(varCur.lVal); 1466*5fdc4257SSteve Yin if(pCurChild==NULL) 1467*5fdc4257SSteve Yin { 1468*5fdc4257SSteve Yin return NULL; 1469*5fdc4257SSteve Yin } 1470*5fdc4257SSteve Yin pCurChild->GetUNOInterface((long*)&pChildXAcc); 1471*5fdc4257SSteve Yin if(pChildXAcc==NULL) 1472*5fdc4257SSteve Yin { 1473*5fdc4257SSteve Yin return NULL; 1474*5fdc4257SSteve Yin } 1475*5fdc4257SSteve Yin pChildContext = GetContextByXAcc(pChildXAcc); 1476*5fdc4257SSteve Yin if(pChildContext == NULL) 1477*5fdc4257SSteve Yin { 1478*5fdc4257SSteve Yin return NULL; 1479*5fdc4257SSteve Yin } 1480*5fdc4257SSteve Yin delta = (flags==DM_NEXTCHILD)?1:-1; 1481*5fdc4257SSteve Yin //currently, getAccessibleIndexInParent is error in UNO for 1482*5fdc4257SSteve Yin //some kind of List,such as ValueSet, the index will be less 1 than 1483*5fdc4257SSteve Yin //what should be, need to fix UNO code 1484*5fdc4257SSteve Yin index = pChildContext->getAccessibleIndexInParent()+delta; 1485*5fdc4257SSteve Yin if((index>=0)&&(index<=count-1)) 1486*5fdc4257SSteve Yin { 1487*5fdc4257SSteve Yin pRChildXAcc = pXContext->getAccessibleChild(index); 1488*5fdc4257SSteve Yin } 1489*5fdc4257SSteve Yin break; 1490*5fdc4257SSteve Yin default: 1491*5fdc4257SSteve Yin break; 1492*5fdc4257SSteve Yin } 1493*5fdc4257SSteve Yin 1494*5fdc4257SSteve Yin if(!pRChildXAcc.is()) 1495*5fdc4257SSteve Yin { 1496*5fdc4257SSteve Yin return NULL; 1497*5fdc4257SSteve Yin } 1498*5fdc4257SSteve Yin pChildXAcc = pRChildXAcc.get(); 1499*5fdc4257SSteve Yin g_pAgent->InsertAccObj(pChildXAcc,pUNOInterface); 1500*5fdc4257SSteve Yin return g_pAgent->GetIMAccByXAcc(pChildXAcc); 1501*5fdc4257SSteve Yin } 1502*5fdc4257SSteve Yin 1503*5fdc4257SSteve Yin /** 1504*5fdc4257SSteve Yin *the following 4 private methods are for accNavigate implementation 1505*5fdc4257SSteve Yin */ 1506*5fdc4257SSteve Yin 1507*5fdc4257SSteve Yin /** 1508*5fdc4257SSteve Yin * Return first child for parent container, process differently according 1509*5fdc4257SSteve Yin * to whether it is decendant manage 1510*5fdc4257SSteve Yin * @param varStart, the start child id of this navigation action. 1511*5fdc4257SSteve Yin * @param pvarEndUpAt, [in,out] the end up child of this navigation action. 1512*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1513*5fdc4257SSteve Yin */ 1514*5fdc4257SSteve Yin HRESULT CMAccessible::GetFirstChild(VARIANT varStart,VARIANT* pvarEndUpAt) 1515*5fdc4257SSteve Yin { 1516*5fdc4257SSteve Yin 1517*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1518*5fdc4257SSteve Yin ISDESTROY() 1519*5fdc4257SSteve Yin // #CHECK# 1520*5fdc4257SSteve Yin if(pvarEndUpAt == NULL) 1521*5fdc4257SSteve Yin { 1522*5fdc4257SSteve Yin return E_INVALIDARG; 1523*5fdc4257SSteve Yin } 1524*5fdc4257SSteve Yin if(varStart.vt != VT_I4) 1525*5fdc4257SSteve Yin { 1526*5fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 1527*5fdc4257SSteve Yin return E_INVALIDARG; 1528*5fdc4257SSteve Yin } 1529*5fdc4257SSteve Yin 1530*5fdc4257SSteve Yin pvarEndUpAt->pdispVal = GetNavigateChildForDM(varStart, DM_FIRSTCHILD); 1531*5fdc4257SSteve Yin if(pvarEndUpAt->pdispVal) 1532*5fdc4257SSteve Yin { 1533*5fdc4257SSteve Yin pvarEndUpAt->pdispVal->AddRef(); 1534*5fdc4257SSteve Yin pvarEndUpAt->vt = VT_DISPATCH; 1535*5fdc4257SSteve Yin return S_OK; 1536*5fdc4257SSteve Yin } 1537*5fdc4257SSteve Yin 1538*5fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 1539*5fdc4257SSteve Yin return E_FAIL; 1540*5fdc4257SSteve Yin 1541*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1542*5fdc4257SSteve Yin } 1543*5fdc4257SSteve Yin 1544*5fdc4257SSteve Yin /** 1545*5fdc4257SSteve Yin * Return last child for parent container, process differently according 1546*5fdc4257SSteve Yin * to whether it is decendant manage 1547*5fdc4257SSteve Yin * @param varStart, the start child id of this navigation action. 1548*5fdc4257SSteve Yin * @param pvarEndUpAt, [in,out] the end up child of this navigation action. 1549*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1550*5fdc4257SSteve Yin */ 1551*5fdc4257SSteve Yin HRESULT CMAccessible::GetLastChild(VARIANT varStart,VARIANT* pvarEndUpAt) 1552*5fdc4257SSteve Yin { 1553*5fdc4257SSteve Yin 1554*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1555*5fdc4257SSteve Yin ISDESTROY() 1556*5fdc4257SSteve Yin // #CHECK# 1557*5fdc4257SSteve Yin if(pvarEndUpAt == NULL) 1558*5fdc4257SSteve Yin { 1559*5fdc4257SSteve Yin return E_INVALIDARG; 1560*5fdc4257SSteve Yin } 1561*5fdc4257SSteve Yin if(varStart.vt != VT_I4) 1562*5fdc4257SSteve Yin { 1563*5fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 1564*5fdc4257SSteve Yin return E_INVALIDARG; 1565*5fdc4257SSteve Yin } 1566*5fdc4257SSteve Yin 1567*5fdc4257SSteve Yin pvarEndUpAt->pdispVal = GetNavigateChildForDM(varStart, DM_LASTCHILD); 1568*5fdc4257SSteve Yin if(pvarEndUpAt->pdispVal) 1569*5fdc4257SSteve Yin { 1570*5fdc4257SSteve Yin pvarEndUpAt->pdispVal->AddRef(); 1571*5fdc4257SSteve Yin pvarEndUpAt->vt = VT_DISPATCH; 1572*5fdc4257SSteve Yin return S_OK; 1573*5fdc4257SSteve Yin } 1574*5fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 1575*5fdc4257SSteve Yin return E_FAIL; 1576*5fdc4257SSteve Yin 1577*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1578*5fdc4257SSteve Yin } 1579*5fdc4257SSteve Yin 1580*5fdc4257SSteve Yin /** 1581*5fdc4257SSteve Yin * The method GetNextSibling is general, whatever it is decendant manage or not 1582*5fdc4257SSteve Yin * Get the next sibling object. 1583*5fdc4257SSteve Yin * @param varStart, the start child id of this navigation action. 1584*5fdc4257SSteve Yin * @param pvarEndUpAt, [in,out] the end up child of this navigation action. 1585*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1586*5fdc4257SSteve Yin */ 1587*5fdc4257SSteve Yin HRESULT CMAccessible::GetNextSibling(VARIANT varStart,VARIANT* pvarEndUpAt) 1588*5fdc4257SSteve Yin { 1589*5fdc4257SSteve Yin 1590*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1591*5fdc4257SSteve Yin ISDESTROY() 1592*5fdc4257SSteve Yin if(varStart.vt != VT_I4) 1593*5fdc4257SSteve Yin { 1594*5fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 1595*5fdc4257SSteve Yin return E_INVALIDARG; 1596*5fdc4257SSteve Yin } 1597*5fdc4257SSteve Yin 1598*5fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = GetContextByXAcc(pUNOInterface); 1599*5fdc4257SSteve Yin if(pRContext.is()) 1600*5fdc4257SSteve Yin { 1601*5fdc4257SSteve Yin varStart.iVal = sal_Int16(pRContext->getAccessibleIndexInParent() + 2); 1602*5fdc4257SSteve Yin if(m_pIParent) 1603*5fdc4257SSteve Yin if( m_pIParent->get_accChild(varStart,&pvarEndUpAt->pdispVal) == S_OK) 1604*5fdc4257SSteve Yin { 1605*5fdc4257SSteve Yin pvarEndUpAt->vt = VT_DISPATCH; 1606*5fdc4257SSteve Yin return S_OK; 1607*5fdc4257SSteve Yin } 1608*5fdc4257SSteve Yin } 1609*5fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 1610*5fdc4257SSteve Yin return E_FAIL; 1611*5fdc4257SSteve Yin 1612*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1613*5fdc4257SSteve Yin } 1614*5fdc4257SSteve Yin 1615*5fdc4257SSteve Yin /** 1616*5fdc4257SSteve Yin *the method GetPreSibling is general, whatever it is decendant manage or not 1617*5fdc4257SSteve Yin * @param varStart, the start child id of this navigation action. 1618*5fdc4257SSteve Yin * @param pvarEndUpAt, [in,out] the end up child of this navigation action. 1619*5fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 1620*5fdc4257SSteve Yin */ 1621*5fdc4257SSteve Yin HRESULT CMAccessible::GetPreSibling(VARIANT varStart,VARIANT* pvarEndUpAt) 1622*5fdc4257SSteve Yin { 1623*5fdc4257SSteve Yin 1624*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1625*5fdc4257SSteve Yin ISDESTROY() 1626*5fdc4257SSteve Yin // #CHECK# 1627*5fdc4257SSteve Yin if(pvarEndUpAt == NULL) 1628*5fdc4257SSteve Yin { 1629*5fdc4257SSteve Yin return E_INVALIDARG; 1630*5fdc4257SSteve Yin } 1631*5fdc4257SSteve Yin if(varStart.vt != VT_I4) 1632*5fdc4257SSteve Yin { 1633*5fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 1634*5fdc4257SSteve Yin return E_INVALIDARG; 1635*5fdc4257SSteve Yin } 1636*5fdc4257SSteve Yin 1637*5fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = GetContextByXAcc(pUNOInterface); 1638*5fdc4257SSteve Yin if(pRContext.is()) 1639*5fdc4257SSteve Yin { 1640*5fdc4257SSteve Yin varStart.iVal = sal_Int16(pRContext->getAccessibleIndexInParent()); 1641*5fdc4257SSteve Yin if(m_pIParent && varStart.iVal > 0) 1642*5fdc4257SSteve Yin if( m_pIParent->get_accChild(varStart,&pvarEndUpAt->pdispVal) == S_OK) 1643*5fdc4257SSteve Yin { 1644*5fdc4257SSteve Yin pvarEndUpAt->vt = VT_DISPATCH; 1645*5fdc4257SSteve Yin return S_OK; 1646*5fdc4257SSteve Yin } 1647*5fdc4257SSteve Yin } 1648*5fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 1649*5fdc4257SSteve Yin return E_FAIL; 1650*5fdc4257SSteve Yin 1651*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1652*5fdc4257SSteve Yin } 1653*5fdc4257SSteve Yin 1654*5fdc4257SSteve Yin /** 1655*5fdc4257SSteve Yin * For IAccessible2 implementation methods 1656*5fdc4257SSteve Yin */ 1657*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_nRelations( long __RPC_FAR *nRelations) 1658*5fdc4257SSteve Yin { 1659*5fdc4257SSteve Yin 1660*5fdc4257SSteve Yin CHECK_ENABLE_INF 1661*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1662*5fdc4257SSteve Yin 1663*5fdc4257SSteve Yin // #CHECK# 1664*5fdc4257SSteve Yin if(nRelations == NULL) 1665*5fdc4257SSteve Yin { 1666*5fdc4257SSteve Yin return E_INVALIDARG; 1667*5fdc4257SSteve Yin } 1668*5fdc4257SSteve Yin 1669*5fdc4257SSteve Yin *nRelations = 0; 1670*5fdc4257SSteve Yin 1671*5fdc4257SSteve Yin if( !pRContext.is() ) 1672*5fdc4257SSteve Yin return E_FAIL; 1673*5fdc4257SSteve Yin Reference<XAccessibleRelationSet> pRrelationSet = pRContext.get()->getAccessibleRelationSet(); 1674*5fdc4257SSteve Yin if(!pRrelationSet.is()) 1675*5fdc4257SSteve Yin { 1676*5fdc4257SSteve Yin *nRelations = 0; 1677*5fdc4257SSteve Yin return S_OK; 1678*5fdc4257SSteve Yin } 1679*5fdc4257SSteve Yin 1680*5fdc4257SSteve Yin *nRelations = pRrelationSet->getRelationCount(); 1681*5fdc4257SSteve Yin return S_OK; 1682*5fdc4257SSteve Yin 1683*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1684*5fdc4257SSteve Yin } 1685*5fdc4257SSteve Yin 1686*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_relation( long relationIndex, IAccessibleRelation __RPC_FAR *__RPC_FAR *relation) 1687*5fdc4257SSteve Yin { 1688*5fdc4257SSteve Yin 1689*5fdc4257SSteve Yin CHECK_ENABLE_INF 1690*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1691*5fdc4257SSteve Yin ISDESTROY() 1692*5fdc4257SSteve Yin // #CHECK# 1693*5fdc4257SSteve Yin if(relation == NULL) 1694*5fdc4257SSteve Yin { 1695*5fdc4257SSteve Yin return E_INVALIDARG; 1696*5fdc4257SSteve Yin } 1697*5fdc4257SSteve Yin 1698*5fdc4257SSteve Yin if( !pRContext.is() ) 1699*5fdc4257SSteve Yin return E_FAIL; 1700*5fdc4257SSteve Yin 1701*5fdc4257SSteve Yin 1702*5fdc4257SSteve Yin long nMax = 0; 1703*5fdc4257SSteve Yin long nReal = 0; 1704*5fdc4257SSteve Yin get_nRelations(&nMax); 1705*5fdc4257SSteve Yin 1706*5fdc4257SSteve Yin *relation = (IAccessibleRelation*)::CoTaskMemAlloc(sizeof(IAccessibleRelation)); 1707*5fdc4257SSteve Yin 1708*5fdc4257SSteve Yin // #CHECK Memory Allocation# 1709*5fdc4257SSteve Yin if(*relation == NULL) 1710*5fdc4257SSteve Yin { 1711*5fdc4257SSteve Yin return E_FAIL; 1712*5fdc4257SSteve Yin } 1713*5fdc4257SSteve Yin 1714*5fdc4257SSteve Yin if( relationIndex < nMax ) 1715*5fdc4257SSteve Yin { 1716*5fdc4257SSteve Yin 1717*5fdc4257SSteve Yin 1718*5fdc4257SSteve Yin Reference<XAccessibleRelationSet> pRrelationSet = pRContext.get()->getAccessibleRelationSet(); 1719*5fdc4257SSteve Yin if(!pRrelationSet.is()) 1720*5fdc4257SSteve Yin { 1721*5fdc4257SSteve Yin 1722*5fdc4257SSteve Yin return E_FAIL; 1723*5fdc4257SSteve Yin } 1724*5fdc4257SSteve Yin 1725*5fdc4257SSteve Yin IAccessibleRelation* pRelation = NULL; 1726*5fdc4257SSteve Yin HRESULT hr = CoCreateInstance( CLSID_AccRelation, NULL, CLSCTX_SERVER , 1727*5fdc4257SSteve Yin IID_IAccessibleRelation, 1728*5fdc4257SSteve Yin (void **)&pRelation); 1729*5fdc4257SSteve Yin if(SUCCEEDED(hr)) 1730*5fdc4257SSteve Yin { 1731*5fdc4257SSteve Yin IUNOXWrapper* wrapper = NULL; 1732*5fdc4257SSteve Yin hr = pRelation->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper); 1733*5fdc4257SSteve Yin if(SUCCEEDED(hr)) 1734*5fdc4257SSteve Yin { 1735*5fdc4257SSteve Yin AccessibleRelation accRelation = pRrelationSet->getRelation(relationIndex); 1736*5fdc4257SSteve Yin wrapper->put_XSubInterface((long)&accRelation); 1737*5fdc4257SSteve Yin wrapper->Release(); 1738*5fdc4257SSteve Yin *relation = pRelation; 1739*5fdc4257SSteve Yin return S_OK; 1740*5fdc4257SSteve Yin } 1741*5fdc4257SSteve Yin 1742*5fdc4257SSteve Yin } 1743*5fdc4257SSteve Yin } 1744*5fdc4257SSteve Yin 1745*5fdc4257SSteve Yin return E_FAIL; 1746*5fdc4257SSteve Yin 1747*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1748*5fdc4257SSteve Yin } 1749*5fdc4257SSteve Yin 1750*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_relations( long, IAccessibleRelation __RPC_FAR *__RPC_FAR *relation, long __RPC_FAR *nRelations) 1751*5fdc4257SSteve Yin { 1752*5fdc4257SSteve Yin 1753*5fdc4257SSteve Yin CHECK_ENABLE_INF 1754*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1755*5fdc4257SSteve Yin 1756*5fdc4257SSteve Yin // #CHECK# 1757*5fdc4257SSteve Yin if(relation == NULL || nRelations == NULL) 1758*5fdc4257SSteve Yin { 1759*5fdc4257SSteve Yin return E_INVALIDARG; 1760*5fdc4257SSteve Yin } 1761*5fdc4257SSteve Yin // #CHECK XInterface# 1762*5fdc4257SSteve Yin 1763*5fdc4257SSteve Yin if( !pRContext.is() ) 1764*5fdc4257SSteve Yin return E_FAIL; 1765*5fdc4257SSteve Yin 1766*5fdc4257SSteve Yin Reference<XAccessibleRelationSet> pRrelationSet = pRContext.get()->getAccessibleRelationSet(); 1767*5fdc4257SSteve Yin if(!pRrelationSet.is()) 1768*5fdc4257SSteve Yin { 1769*5fdc4257SSteve Yin *nRelations = 0; 1770*5fdc4257SSteve Yin return S_OK; 1771*5fdc4257SSteve Yin } 1772*5fdc4257SSteve Yin 1773*5fdc4257SSteve Yin long nCount = pRrelationSet->getRelationCount(); 1774*5fdc4257SSteve Yin 1775*5fdc4257SSteve Yin *relation = (IAccessibleRelation*)::CoTaskMemAlloc(nCount*sizeof(IAccessibleRelation)); 1776*5fdc4257SSteve Yin 1777*5fdc4257SSteve Yin // #CHECK Memory Allocation# 1778*5fdc4257SSteve Yin if(*relation == NULL) 1779*5fdc4257SSteve Yin { 1780*5fdc4257SSteve Yin return E_FAIL; 1781*5fdc4257SSteve Yin } 1782*5fdc4257SSteve Yin 1783*5fdc4257SSteve Yin for(int i=0; i<nCount ; i++) 1784*5fdc4257SSteve Yin { 1785*5fdc4257SSteve Yin IAccessibleRelation* pRelation = NULL; 1786*5fdc4257SSteve Yin HRESULT hr = CoCreateInstance( CLSID_AccRelation, NULL, CLSCTX_SERVER , 1787*5fdc4257SSteve Yin IID_IAccessibleRelation, 1788*5fdc4257SSteve Yin (void **)&pRelation); 1789*5fdc4257SSteve Yin if(SUCCEEDED(hr)) 1790*5fdc4257SSteve Yin { 1791*5fdc4257SSteve Yin IUNOXWrapper* wrapper = NULL; 1792*5fdc4257SSteve Yin hr = pRelation->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper); 1793*5fdc4257SSteve Yin if(SUCCEEDED(hr)) 1794*5fdc4257SSteve Yin { 1795*5fdc4257SSteve Yin AccessibleRelation accRelation = pRrelationSet->getRelation(i); 1796*5fdc4257SSteve Yin wrapper->put_XSubInterface((long)&accRelation); 1797*5fdc4257SSteve Yin wrapper->Release(); 1798*5fdc4257SSteve Yin } 1799*5fdc4257SSteve Yin (relation)[i] = pRelation; 1800*5fdc4257SSteve Yin } 1801*5fdc4257SSteve Yin } 1802*5fdc4257SSteve Yin 1803*5fdc4257SSteve Yin *nRelations = nCount; 1804*5fdc4257SSteve Yin return S_OK; 1805*5fdc4257SSteve Yin 1806*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1807*5fdc4257SSteve Yin } 1808*5fdc4257SSteve Yin 1809*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::role(long __RPC_FAR *role) 1810*5fdc4257SSteve Yin { 1811*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1812*5fdc4257SSteve Yin 1813*5fdc4257SSteve Yin (*role) = m_iRole; 1814*5fdc4257SSteve Yin 1815*5fdc4257SSteve Yin return S_OK; 1816*5fdc4257SSteve Yin 1817*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1818*5fdc4257SSteve Yin } 1819*5fdc4257SSteve Yin 1820*5fdc4257SSteve Yin 1821*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_nActions(long __RPC_FAR *nActions) 1822*5fdc4257SSteve Yin { 1823*5fdc4257SSteve Yin 1824*5fdc4257SSteve Yin try 1825*5fdc4257SSteve Yin { 1826*5fdc4257SSteve Yin ISDESTROY() 1827*5fdc4257SSteve Yin // #CHECK# 1828*5fdc4257SSteve Yin if(nActions == NULL) 1829*5fdc4257SSteve Yin { 1830*5fdc4257SSteve Yin return E_INVALIDARG; 1831*5fdc4257SSteve Yin } 1832*5fdc4257SSteve Yin *nActions = 0L; 1833*5fdc4257SSteve Yin IAccessibleAction* pAcc = NULL; 1834*5fdc4257SSteve Yin HRESULT hr = QueryInterface(IID_IAccessibleAction, (void**)&pAcc); 1835*5fdc4257SSteve Yin if( hr == S_OK ) 1836*5fdc4257SSteve Yin { 1837*5fdc4257SSteve Yin pAcc->nActions(nActions); 1838*5fdc4257SSteve Yin pAcc->Release(); 1839*5fdc4257SSteve Yin } 1840*5fdc4257SSteve Yin 1841*5fdc4257SSteve Yin return S_OK; 1842*5fdc4257SSteve Yin } 1843*5fdc4257SSteve Yin catch(...) 1844*5fdc4257SSteve Yin { 1845*5fdc4257SSteve Yin *nActions = 0L; 1846*5fdc4257SSteve Yin return S_OK; 1847*5fdc4257SSteve Yin } 1848*5fdc4257SSteve Yin } 1849*5fdc4257SSteve Yin 1850*5fdc4257SSteve Yin 1851*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: scrollToPoint(enum IA2CoordinateType, long, long) 1852*5fdc4257SSteve Yin { 1853*5fdc4257SSteve Yin 1854*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1855*5fdc4257SSteve Yin ISDESTROY() 1856*5fdc4257SSteve Yin return E_NOTIMPL; 1857*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1858*5fdc4257SSteve Yin 1859*5fdc4257SSteve Yin } 1860*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: scrollTo(enum IA2ScrollType) 1861*5fdc4257SSteve Yin { 1862*5fdc4257SSteve Yin 1863*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1864*5fdc4257SSteve Yin ISDESTROY() 1865*5fdc4257SSteve Yin 1866*5fdc4257SSteve Yin return E_NOTIMPL; 1867*5fdc4257SSteve Yin 1868*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1869*5fdc4257SSteve Yin } 1870*5fdc4257SSteve Yin 1871*5fdc4257SSteve Yin static XAccessible* getTheParentOfMember(XAccessible* pXAcc) 1872*5fdc4257SSteve Yin { 1873*5fdc4257SSteve Yin // #CHECK# 1874*5fdc4257SSteve Yin if(pXAcc == NULL) 1875*5fdc4257SSteve Yin { 1876*5fdc4257SSteve Yin return NULL; 1877*5fdc4257SSteve Yin } 1878*5fdc4257SSteve Yin Reference<XAccessibleContext> pRContext = pXAcc->getAccessibleContext(); 1879*5fdc4257SSteve Yin Reference<XAccessibleRelationSet> pRrelationSet = pRContext->getAccessibleRelationSet(); 1880*5fdc4257SSteve Yin long nRelations = pRrelationSet->getRelationCount(); 1881*5fdc4257SSteve Yin for(int i=0 ; i<nRelations ; i++) 1882*5fdc4257SSteve Yin { 1883*5fdc4257SSteve Yin AccessibleRelation accRelation = pRrelationSet->getRelation(i); 1884*5fdc4257SSteve Yin if(accRelation.RelationType == 7) 1885*5fdc4257SSteve Yin { 1886*5fdc4257SSteve Yin Sequence< Reference< XInterface > > xTargets = accRelation.TargetSet; 1887*5fdc4257SSteve Yin return (XAccessible*)xTargets[0].get(); 1888*5fdc4257SSteve Yin } 1889*5fdc4257SSteve Yin } 1890*5fdc4257SSteve Yin return NULL; 1891*5fdc4257SSteve Yin } 1892*5fdc4257SSteve Yin 1893*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_groupPosition(long __RPC_FAR *groupLevel,long __RPC_FAR *similarItemsInGroup,long __RPC_FAR *positionInGroup) 1894*5fdc4257SSteve Yin { 1895*5fdc4257SSteve Yin 1896*5fdc4257SSteve Yin CHECK_ENABLE_INF 1897*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1898*5fdc4257SSteve Yin ISDESTROY() 1899*5fdc4257SSteve Yin // #CHECK# 1900*5fdc4257SSteve Yin if(groupLevel == NULL || similarItemsInGroup == NULL || positionInGroup == NULL) 1901*5fdc4257SSteve Yin { 1902*5fdc4257SSteve Yin return E_INVALIDARG; 1903*5fdc4257SSteve Yin } 1904*5fdc4257SSteve Yin 1905*5fdc4257SSteve Yin Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext(); 1906*5fdc4257SSteve Yin if(!pRContext.is()) 1907*5fdc4257SSteve Yin return E_FAIL; 1908*5fdc4257SSteve Yin long Role = pRContext->getAccessibleRole(); 1909*5fdc4257SSteve Yin 1910*5fdc4257SSteve Yin *groupLevel = 0; 1911*5fdc4257SSteve Yin *similarItemsInGroup = 0; 1912*5fdc4257SSteve Yin *positionInGroup = 0; 1913*5fdc4257SSteve Yin 1914*5fdc4257SSteve Yin if (Role != AccessibleRole::DOCUMENT) 1915*5fdc4257SSteve Yin { 1916*5fdc4257SSteve Yin Reference< XAccessibleGroupPosition > xGroupPosition( pRContext, UNO_QUERY ); 1917*5fdc4257SSteve Yin if ( xGroupPosition.is() ) 1918*5fdc4257SSteve Yin { 1919*5fdc4257SSteve Yin Sequence< sal_Int32 > rSeq = xGroupPosition->getGroupPosition( makeAny( pRContext ) ); 1920*5fdc4257SSteve Yin sal_Int32* pSeq = rSeq.getArray(); 1921*5fdc4257SSteve Yin if ( pSeq ) 1922*5fdc4257SSteve Yin { 1923*5fdc4257SSteve Yin *groupLevel = pSeq[0]; 1924*5fdc4257SSteve Yin *similarItemsInGroup = pSeq[1]; 1925*5fdc4257SSteve Yin *positionInGroup = pSeq[2]; 1926*5fdc4257SSteve Yin return S_OK; 1927*5fdc4257SSteve Yin } 1928*5fdc4257SSteve Yin return S_OK; 1929*5fdc4257SSteve Yin } 1930*5fdc4257SSteve Yin } 1931*5fdc4257SSteve Yin 1932*5fdc4257SSteve Yin Reference< XAccessible> pParentAcc = pRContext->getAccessibleParent(); 1933*5fdc4257SSteve Yin if( !pParentAcc.is() ) 1934*5fdc4257SSteve Yin { 1935*5fdc4257SSteve Yin return S_OK; 1936*5fdc4257SSteve Yin } 1937*5fdc4257SSteve Yin 1938*5fdc4257SSteve Yin Reference<XAccessibleContext> pRParentContext = pParentAcc->getAccessibleContext(); 1939*5fdc4257SSteve Yin 1940*5fdc4257SSteve Yin int level = 0; 1941*5fdc4257SSteve Yin int index = 0; 1942*5fdc4257SSteve Yin int number = 0; 1943*5fdc4257SSteve Yin 1944*5fdc4257SSteve Yin if( Role == RADIO_BUTTON ) 1945*5fdc4257SSteve Yin { 1946*5fdc4257SSteve Yin Reference<XAccessibleRelationSet> pRrelationSet = pRContext->getAccessibleRelationSet(); 1947*5fdc4257SSteve Yin long nRel = pRrelationSet->getRelationCount(); 1948*5fdc4257SSteve Yin for(int i=0 ; i<nRel ; i++) 1949*5fdc4257SSteve Yin { 1950*5fdc4257SSteve Yin AccessibleRelation accRelation = pRrelationSet->getRelation(i); 1951*5fdc4257SSteve Yin if(accRelation.RelationType == 7) 1952*5fdc4257SSteve Yin { 1953*5fdc4257SSteve Yin Sequence< Reference< XInterface > > xTargets = accRelation.TargetSet; 1954*5fdc4257SSteve Yin int nCount = xTargets.getLength(); 1955*5fdc4257SSteve Yin 1956*5fdc4257SSteve Yin Reference<XInterface> pRAcc = xTargets[0]; 1957*5fdc4257SSteve Yin for(int j=0; j<pRParentContext->getAccessibleChildCount(); j++) 1958*5fdc4257SSteve Yin { 1959*5fdc4257SSteve Yin if( getTheParentOfMember(pRParentContext->getAccessibleChild(j).get()) 1960*5fdc4257SSteve Yin == (XAccessible*)pRAcc.get() && 1961*5fdc4257SSteve Yin pRParentContext->getAccessibleChild(j)->getAccessibleContext()->getAccessibleRole() == RADIO_BUTTON) 1962*5fdc4257SSteve Yin number++; 1963*5fdc4257SSteve Yin if(pRParentContext->getAccessibleChild(j).get() == pUNOInterface) 1964*5fdc4257SSteve Yin index = number; 1965*5fdc4257SSteve Yin } 1966*5fdc4257SSteve Yin } 1967*5fdc4257SSteve Yin } 1968*5fdc4257SSteve Yin *groupLevel = 1; 1969*5fdc4257SSteve Yin *similarItemsInGroup = number; 1970*5fdc4257SSteve Yin *positionInGroup = index; 1971*5fdc4257SSteve Yin return S_OK; 1972*5fdc4257SSteve Yin } 1973*5fdc4257SSteve Yin 1974*5fdc4257SSteve Yin else if ( COMBO_BOX == Role ) 1975*5fdc4257SSteve Yin { 1976*5fdc4257SSteve Yin *groupLevel = 1; 1977*5fdc4257SSteve Yin *similarItemsInGroup = 0; 1978*5fdc4257SSteve Yin *positionInGroup = -1; 1979*5fdc4257SSteve Yin 1980*5fdc4257SSteve Yin long nCount = pRContext->getAccessibleChildCount(); 1981*5fdc4257SSteve Yin if( 2 != nCount) 1982*5fdc4257SSteve Yin { 1983*5fdc4257SSteve Yin return S_OK; 1984*5fdc4257SSteve Yin } 1985*5fdc4257SSteve Yin Reference<XAccessible> xList=pRContext->getAccessibleChild(1); 1986*5fdc4257SSteve Yin if (!xList.is()) 1987*5fdc4257SSteve Yin { 1988*5fdc4257SSteve Yin return S_OK; 1989*5fdc4257SSteve Yin } 1990*5fdc4257SSteve Yin Reference<XAccessibleContext> xListContext(xList,UNO_QUERY); 1991*5fdc4257SSteve Yin if (!xListContext.is()) 1992*5fdc4257SSteve Yin { 1993*5fdc4257SSteve Yin return S_OK; 1994*5fdc4257SSteve Yin } 1995*5fdc4257SSteve Yin Reference<XAccessibleSelection> xListSel(xList,UNO_QUERY); 1996*5fdc4257SSteve Yin if (!xListSel.is()) 1997*5fdc4257SSteve Yin { 1998*5fdc4257SSteve Yin return S_OK; 1999*5fdc4257SSteve Yin } 2000*5fdc4257SSteve Yin *similarItemsInGroup = xListContext->getAccessibleChildCount(); 2001*5fdc4257SSteve Yin if (*similarItemsInGroup > 0 ) 2002*5fdc4257SSteve Yin { 2003*5fdc4257SSteve Yin try 2004*5fdc4257SSteve Yin { 2005*5fdc4257SSteve Yin Reference<XAccessible> xChild = xListSel->getSelectedAccessibleChild(0); 2006*5fdc4257SSteve Yin if (xChild.is()) 2007*5fdc4257SSteve Yin { 2008*5fdc4257SSteve Yin Reference<XAccessibleContext> xChildContext(xChild,UNO_QUERY); 2009*5fdc4257SSteve Yin if (xChildContext.is()) 2010*5fdc4257SSteve Yin { 2011*5fdc4257SSteve Yin *positionInGroup=xChildContext->getAccessibleIndexInParent() + 1 ; 2012*5fdc4257SSteve Yin return S_OK; 2013*5fdc4257SSteve Yin } 2014*5fdc4257SSteve Yin } 2015*5fdc4257SSteve Yin } 2016*5fdc4257SSteve Yin catch(...) 2017*5fdc4257SSteve Yin {} 2018*5fdc4257SSteve Yin } 2019*5fdc4257SSteve Yin return S_OK; 2020*5fdc4257SSteve Yin } 2021*5fdc4257SSteve Yin else if ( PAGE_TAB == Role ) 2022*5fdc4257SSteve Yin { 2023*5fdc4257SSteve Yin *groupLevel = 1; 2024*5fdc4257SSteve Yin *similarItemsInGroup = pRParentContext->getAccessibleChildCount(); 2025*5fdc4257SSteve Yin 2026*5fdc4257SSteve Yin if (*similarItemsInGroup > 0 ) 2027*5fdc4257SSteve Yin { 2028*5fdc4257SSteve Yin *positionInGroup=pRContext->getAccessibleIndexInParent() + 1 ; 2029*5fdc4257SSteve Yin } 2030*5fdc4257SSteve Yin else 2031*5fdc4257SSteve Yin { 2032*5fdc4257SSteve Yin *positionInGroup = -1; 2033*5fdc4257SSteve Yin } 2034*5fdc4257SSteve Yin return S_OK; 2035*5fdc4257SSteve Yin } 2036*5fdc4257SSteve Yin 2037*5fdc4257SSteve Yin 2038*5fdc4257SSteve Yin BOOL isFound = FALSE; 2039*5fdc4257SSteve Yin while( pParentAcc.is() && !isFound) 2040*5fdc4257SSteve Yin { 2041*5fdc4257SSteve Yin level++; 2042*5fdc4257SSteve Yin pRParentContext = pParentAcc->getAccessibleContext(); 2043*5fdc4257SSteve Yin Role = pRParentContext->getAccessibleRole(); 2044*5fdc4257SSteve Yin if( (Role == TREE) || (Role == LIST) ) 2045*5fdc4257SSteve Yin isFound = TRUE; 2046*5fdc4257SSteve Yin pParentAcc = pRParentContext->getAccessibleParent(); 2047*5fdc4257SSteve Yin } 2048*5fdc4257SSteve Yin 2049*5fdc4257SSteve Yin if( isFound ) 2050*5fdc4257SSteve Yin { 2051*5fdc4257SSteve Yin Reference< XAccessible> pTempAcc = pRContext->getAccessibleParent(); 2052*5fdc4257SSteve Yin pRParentContext = pTempAcc->getAccessibleContext(); 2053*5fdc4257SSteve Yin *groupLevel = level; 2054*5fdc4257SSteve Yin *similarItemsInGroup = pRParentContext->getAccessibleChildCount(); 2055*5fdc4257SSteve Yin *positionInGroup = pRContext->getAccessibleIndexInParent() + 1; 2056*5fdc4257SSteve Yin } 2057*5fdc4257SSteve Yin else 2058*5fdc4257SSteve Yin { 2059*5fdc4257SSteve Yin *groupLevel = 0; 2060*5fdc4257SSteve Yin *similarItemsInGroup = 0; 2061*5fdc4257SSteve Yin *positionInGroup = 0; 2062*5fdc4257SSteve Yin } 2063*5fdc4257SSteve Yin return S_OK; 2064*5fdc4257SSteve Yin 2065*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2066*5fdc4257SSteve Yin } 2067*5fdc4257SSteve Yin 2068*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_extendedStates( long, BSTR __RPC_FAR *__RPC_FAR *, long __RPC_FAR *) 2069*5fdc4257SSteve Yin { 2070*5fdc4257SSteve Yin 2071*5fdc4257SSteve Yin CHECK_ENABLE_INF 2072*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2073*5fdc4257SSteve Yin ISDESTROY() 2074*5fdc4257SSteve Yin 2075*5fdc4257SSteve Yin return E_NOTIMPL; 2076*5fdc4257SSteve Yin 2077*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2078*5fdc4257SSteve Yin } 2079*5fdc4257SSteve Yin 2080*5fdc4257SSteve Yin 2081*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_uniqueID(long __RPC_FAR *uniqueID) 2082*5fdc4257SSteve Yin { 2083*5fdc4257SSteve Yin 2084*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2085*5fdc4257SSteve Yin ISDESTROY() 2086*5fdc4257SSteve Yin // #CHECK# 2087*5fdc4257SSteve Yin if(uniqueID == NULL) 2088*5fdc4257SSteve Yin { 2089*5fdc4257SSteve Yin return E_INVALIDARG; 2090*5fdc4257SSteve Yin } 2091*5fdc4257SSteve Yin *uniqueID = m_dChildID; 2092*5fdc4257SSteve Yin return S_OK; 2093*5fdc4257SSteve Yin 2094*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2095*5fdc4257SSteve Yin } 2096*5fdc4257SSteve Yin 2097*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_windowHandle(HWND __RPC_FAR *windowHandle) 2098*5fdc4257SSteve Yin { 2099*5fdc4257SSteve Yin 2100*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2101*5fdc4257SSteve Yin ISDESTROY() 2102*5fdc4257SSteve Yin // #CHECK# 2103*5fdc4257SSteve Yin if(windowHandle == NULL) 2104*5fdc4257SSteve Yin { 2105*5fdc4257SSteve Yin return E_INVALIDARG; 2106*5fdc4257SSteve Yin } 2107*5fdc4257SSteve Yin 2108*5fdc4257SSteve Yin HWND nHwnd = m_hwnd; 2109*5fdc4257SSteve Yin IAccessible* pParent = m_pIParent; 2110*5fdc4257SSteve Yin CMAccessible* pChild = this; 2111*5fdc4257SSteve Yin while((nHwnd==0) && pParent) 2112*5fdc4257SSteve Yin { 2113*5fdc4257SSteve Yin pChild = (CMAccessible*)pParent; 2114*5fdc4257SSteve Yin if(pChild) 2115*5fdc4257SSteve Yin { 2116*5fdc4257SSteve Yin pParent = (IAccessible*)pChild->m_pIParent; 2117*5fdc4257SSteve Yin nHwnd = (HWND)pChild->m_hwnd; 2118*5fdc4257SSteve Yin } 2119*5fdc4257SSteve Yin else 2120*5fdc4257SSteve Yin pParent = NULL; 2121*5fdc4257SSteve Yin } 2122*5fdc4257SSteve Yin 2123*5fdc4257SSteve Yin *windowHandle = nHwnd; 2124*5fdc4257SSteve Yin return S_OK; 2125*5fdc4257SSteve Yin 2126*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2127*5fdc4257SSteve Yin } 2128*5fdc4257SSteve Yin 2129*5fdc4257SSteve Yin /** 2130*5fdc4257SSteve Yin * Get XAccessibleContext directly from UNO by the stored XAccessible pointer 2131*5fdc4257SSteve Yin * @param pXAcc, UNO XAccessible object point. 2132*5fdc4257SSteve Yin * @return XAccessibleContext*, the context of the pXAcc. 2133*5fdc4257SSteve Yin */ 2134*5fdc4257SSteve Yin XAccessibleContext* CMAccessible::GetContextByXAcc( XAccessible* pXAcc ) 2135*5fdc4257SSteve Yin { 2136*5fdc4257SSteve Yin Reference< XAccessibleContext > pRContext; 2137*5fdc4257SSteve Yin if( pXAcc == NULL) 2138*5fdc4257SSteve Yin return NULL; 2139*5fdc4257SSteve Yin 2140*5fdc4257SSteve Yin pRContext = pXAcc->getAccessibleContext(); 2141*5fdc4257SSteve Yin if( !pRContext.is() ) 2142*5fdc4257SSteve Yin return NULL; 2143*5fdc4257SSteve Yin return pRContext.get(); 2144*5fdc4257SSteve Yin } 2145*5fdc4257SSteve Yin 2146*5fdc4257SSteve Yin /** 2147*5fdc4257SSteve Yin * Return the member variable m_pXAccessibleSelection, instead of 2148*5fdc4257SSteve Yin * get XAccessibleSelection according to XAccessibleContext because if so,it will 2149*5fdc4257SSteve Yin * depend on the UNO implementation code,so when COM is created, put XAccessibleSelection 2150*5fdc4257SSteve Yin * by bridge management system 2151*5fdc4257SSteve Yin * @return XAccessibleSelection*, the selection of the current object. 2152*5fdc4257SSteve Yin */ 2153*5fdc4257SSteve Yin Reference< XAccessibleSelection > CMAccessible::GetSelection() 2154*5fdc4257SSteve Yin { 2155*5fdc4257SSteve Yin if( pUNOInterface == NULL ) 2156*5fdc4257SSteve Yin return NULL; 2157*5fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext(); 2158*5fdc4257SSteve Yin if(pRContext.is()) 2159*5fdc4257SSteve Yin { 2160*5fdc4257SSteve Yin Reference< XAccessibleSelection > pRSelection(pRContext,UNO_QUERY); 2161*5fdc4257SSteve Yin return pRSelection; 2162*5fdc4257SSteve Yin } 2163*5fdc4257SSteve Yin return NULL; 2164*5fdc4257SSteve Yin } 2165*5fdc4257SSteve Yin 2166*5fdc4257SSteve Yin /** 2167*5fdc4257SSteve Yin * Select one XAccessible item, for accSelect implementation 2168*5fdc4257SSteve Yin * @param pItem, the item should be selected. 2169*5fdc4257SSteve Yin * @return S_OK if successful. 2170*5fdc4257SSteve Yin */ 2171*5fdc4257SSteve Yin HRESULT CMAccessible::SelectChild(XAccessible* pItem) 2172*5fdc4257SSteve Yin { 2173*5fdc4257SSteve Yin 2174*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2175*5fdc4257SSteve Yin ISDESTROY() 2176*5fdc4257SSteve Yin XAccessibleContext* pParentContext = GetContextByXAcc( pUNOInterface ); 2177*5fdc4257SSteve Yin XAccessibleContext* pContext = GetContextByXAcc( pItem ); 2178*5fdc4257SSteve Yin if( pParentContext == NULL || pContext == NULL ) 2179*5fdc4257SSteve Yin return E_FAIL; 2180*5fdc4257SSteve Yin 2181*5fdc4257SSteve Yin Reference< XAccessibleSelection > pRSelection = GetSelection(); 2182*5fdc4257SSteve Yin if( !pRSelection.is() ) 2183*5fdc4257SSteve Yin return E_FAIL; 2184*5fdc4257SSteve Yin long Index = pContext->getAccessibleIndexInParent(); 2185*5fdc4257SSteve Yin pRSelection->selectAccessibleChild( Index ); 2186*5fdc4257SSteve Yin return S_OK; 2187*5fdc4257SSteve Yin 2188*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2189*5fdc4257SSteve Yin } 2190*5fdc4257SSteve Yin 2191*5fdc4257SSteve Yin /** 2192*5fdc4257SSteve Yin * Deselect one XAccessible item, for accSelect implimentation 2193*5fdc4257SSteve Yin * @param pItem, the item should be deselected. 2194*5fdc4257SSteve Yin * @return S_OK if successful. 2195*5fdc4257SSteve Yin */ 2196*5fdc4257SSteve Yin HRESULT CMAccessible::DeSelectChild(XAccessible* pItem) 2197*5fdc4257SSteve Yin { 2198*5fdc4257SSteve Yin 2199*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2200*5fdc4257SSteve Yin ISDESTROY() 2201*5fdc4257SSteve Yin XAccessibleContext* pParentContext = GetContextByXAcc( pUNOInterface ); 2202*5fdc4257SSteve Yin ; 2203*5fdc4257SSteve Yin XAccessibleContext* pContext = GetContextByXAcc( pItem ); 2204*5fdc4257SSteve Yin if( pParentContext == NULL || pContext == NULL ) 2205*5fdc4257SSteve Yin return E_INVALIDARG; 2206*5fdc4257SSteve Yin 2207*5fdc4257SSteve Yin Reference< XAccessibleSelection > pRSelection = GetSelection(); 2208*5fdc4257SSteve Yin if( !pRSelection.is() ) 2209*5fdc4257SSteve Yin return E_FAIL; 2210*5fdc4257SSteve Yin long Index = pContext->getAccessibleIndexInParent(); 2211*5fdc4257SSteve Yin pRSelection->deselectAccessibleChild( Index ); 2212*5fdc4257SSteve Yin 2213*5fdc4257SSteve Yin return S_OK; 2214*5fdc4257SSteve Yin 2215*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2216*5fdc4257SSteve Yin } 2217*5fdc4257SSteve Yin 2218*5fdc4257SSteve Yin /** 2219*5fdc4257SSteve Yin * Select multiple XAccessible items,for implementation of accSelect 2220*5fdc4257SSteve Yin * @param pItem, the items should be selected. 2221*5fdc4257SSteve Yin * @param size, the size of the items. 2222*5fdc4257SSteve Yin * @return S_OK if successful. 2223*5fdc4257SSteve Yin */ 2224*5fdc4257SSteve Yin HRESULT CMAccessible::SelectMutipleChidren( XAccessible** pItem,int size ) 2225*5fdc4257SSteve Yin { 2226*5fdc4257SSteve Yin 2227*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2228*5fdc4257SSteve Yin ISDESTROY() 2229*5fdc4257SSteve Yin // #CHECK# 2230*5fdc4257SSteve Yin if(pItem == NULL) 2231*5fdc4257SSteve Yin { 2232*5fdc4257SSteve Yin return E_INVALIDARG; 2233*5fdc4257SSteve Yin } 2234*5fdc4257SSteve Yin for(int index = 0;index < size;index++) 2235*5fdc4257SSteve Yin { 2236*5fdc4257SSteve Yin SelectChild( pItem[index] ); 2237*5fdc4257SSteve Yin } 2238*5fdc4257SSteve Yin return S_OK; 2239*5fdc4257SSteve Yin 2240*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2241*5fdc4257SSteve Yin } 2242*5fdc4257SSteve Yin 2243*5fdc4257SSteve Yin /** 2244*5fdc4257SSteve Yin * Deselect multiple XAccessible items,for implementation of accSelect 2245*5fdc4257SSteve Yin * @param pItem, the items should be selected. 2246*5fdc4257SSteve Yin * @param size, the size of the items. 2247*5fdc4257SSteve Yin * @return S_OK if successful. 2248*5fdc4257SSteve Yin */ 2249*5fdc4257SSteve Yin HRESULT CMAccessible::DeSelectMutipleChildren( XAccessible** pItem,int size ) 2250*5fdc4257SSteve Yin { 2251*5fdc4257SSteve Yin 2252*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2253*5fdc4257SSteve Yin ISDESTROY() 2254*5fdc4257SSteve Yin // #CHECK# 2255*5fdc4257SSteve Yin if(pItem == NULL) 2256*5fdc4257SSteve Yin { 2257*5fdc4257SSteve Yin return E_INVALIDARG; 2258*5fdc4257SSteve Yin } 2259*5fdc4257SSteve Yin for(int index = 0;index < size;index++) 2260*5fdc4257SSteve Yin { 2261*5fdc4257SSteve Yin DeSelectChild( pItem[index] ); 2262*5fdc4257SSteve Yin } 2263*5fdc4257SSteve Yin return S_OK; 2264*5fdc4257SSteve Yin 2265*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2266*5fdc4257SSteve Yin } 2267*5fdc4257SSteve Yin 2268*5fdc4257SSteve Yin /** 2269*5fdc4257SSteve Yin * When COM is created, UNO set XAccessible pointer to it 2270*5fdc4257SSteve Yin * in order to COM can operate UNO information 2271*5fdc4257SSteve Yin * @param pXAcc, the XAccessible object of current object. 2272*5fdc4257SSteve Yin * @return S_OK if successful. 2273*5fdc4257SSteve Yin */ 2274*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::SetXAccessible(long pXAcc) 2275*5fdc4257SSteve Yin { 2276*5fdc4257SSteve Yin pUNOInterface = (XAccessible*)pXAcc; 2277*5fdc4257SSteve Yin pRef = pUNOInterface; 2278*5fdc4257SSteve Yin m_pEnumVar->PutSelection(/*XAccessibleSelection*/(long)pUNOInterface); 2279*5fdc4257SSteve Yin 2280*5fdc4257SSteve Yin pRContext = pUNOInterface->getAccessibleContext(); 2281*5fdc4257SSteve Yin pRContextInterface = (XAccessibleContext*)pRContext.is(); 2282*5fdc4257SSteve Yin 2283*5fdc4257SSteve Yin return S_OK; 2284*5fdc4257SSteve Yin } 2285*5fdc4257SSteve Yin 2286*5fdc4257SSteve Yin /** 2287*5fdc4257SSteve Yin * accSelect method has many optional flags, needs to process comprehensively 2288*5fdc4257SSteve Yin * Mozilla and Microsoft do not implement SELFLAG_EXTENDSELECTION flag. 2289*5fdc4257SSteve Yin * The implementation of this flag is a little trouble-shooting,so we also 2290*5fdc4257SSteve Yin * do not implement it now 2291*5fdc4257SSteve Yin * @param flagsSelect, the selection flag of the select action. 2292*5fdc4257SSteve Yin * @param varChild, the child object pointer of current action. 2293*5fdc4257SSteve Yin * @return S_OK if successful. 2294*5fdc4257SSteve Yin */ 2295*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::accSelect(long flagsSelect, VARIANT varChild) 2296*5fdc4257SSteve Yin { 2297*5fdc4257SSteve Yin 2298*5fdc4257SSteve Yin CHECK_ENABLE_INF 2299*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2300*5fdc4257SSteve Yin ISDESTROY() 2301*5fdc4257SSteve Yin if( (flagsSelect&SELFLAG_ADDSELECTION) && 2302*5fdc4257SSteve Yin (SELFLAG_REMOVESELECTION&flagsSelect) ) 2303*5fdc4257SSteve Yin return E_INVALIDARG; 2304*5fdc4257SSteve Yin 2305*5fdc4257SSteve Yin if ( (flagsSelect&SELFLAG_TAKESELECTION) && 2306*5fdc4257SSteve Yin ( 2307*5fdc4257SSteve Yin (flagsSelect&SELFLAG_ADDSELECTION) || 2308*5fdc4257SSteve Yin (flagsSelect&SELFLAG_REMOVESELECTION) || 2309*5fdc4257SSteve Yin (flagsSelect&SELFLAG_EXTENDSELECTION ) 2310*5fdc4257SSteve Yin ) 2311*5fdc4257SSteve Yin ) 2312*5fdc4257SSteve Yin return E_INVALIDARG; 2313*5fdc4257SSteve Yin 2314*5fdc4257SSteve Yin if ( varChild.vt != VT_I4 ) 2315*5fdc4257SSteve Yin return E_INVALIDARG; 2316*5fdc4257SSteve Yin 2317*5fdc4257SSteve Yin IMAccessible* pSelectAcc; 2318*5fdc4257SSteve Yin if( varChild.lVal == CHILDID_SELF ) 2319*5fdc4257SSteve Yin { 2320*5fdc4257SSteve Yin pSelectAcc = this; 2321*5fdc4257SSteve Yin pSelectAcc->AddRef(); 2322*5fdc4257SSteve Yin } 2323*5fdc4257SSteve Yin else 2324*5fdc4257SSteve Yin { 2325*5fdc4257SSteve Yin pSelectAcc = GetChildInterface(varChild.lVal); 2326*5fdc4257SSteve Yin } 2327*5fdc4257SSteve Yin 2328*5fdc4257SSteve Yin if( pSelectAcc == NULL ) 2329*5fdc4257SSteve Yin return E_INVALIDARG; 2330*5fdc4257SSteve Yin 2331*5fdc4257SSteve Yin if( flagsSelect&SELFLAG_TAKEFOCUS ) 2332*5fdc4257SSteve Yin { 2333*5fdc4257SSteve Yin long pTempUNO = 0; 2334*5fdc4257SSteve Yin pSelectAcc->GetUNOInterface( &pTempUNO); 2335*5fdc4257SSteve Yin 2336*5fdc4257SSteve Yin if( pTempUNO == NULL ) 2337*5fdc4257SSteve Yin return NULL; 2338*5fdc4257SSteve Yin 2339*5fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = ( (XAccessible*)pTempUNO)->getAccessibleContext(); 2340*5fdc4257SSteve Yin Reference< XAccessibleComponent > pRComponent(pRContext,UNO_QUERY); 2341*5fdc4257SSteve Yin Reference< XAccessible > pRParentXAcc = pRContext->getAccessibleParent(); 2342*5fdc4257SSteve Yin Reference< XAccessibleContext > pRParentContext = pRParentXAcc->getAccessibleContext(); 2343*5fdc4257SSteve Yin Reference< XAccessibleComponent > pRParentComponent(pRParentContext,UNO_QUERY); 2344*5fdc4257SSteve Yin Reference< XAccessibleSelection > pRParentSelection(pRParentContext,UNO_QUERY); 2345*5fdc4257SSteve Yin 2346*5fdc4257SSteve Yin 2347*5fdc4257SSteve Yin pRComponent->grabFocus(); 2348*5fdc4257SSteve Yin 2349*5fdc4257SSteve Yin if( flagsSelect & SELFLAG_TAKESELECTION ) 2350*5fdc4257SSteve Yin { 2351*5fdc4257SSteve Yin pRParentSelection->clearAccessibleSelection(); 2352*5fdc4257SSteve Yin pRParentSelection->selectAccessibleChild( pRContext->getAccessibleIndexInParent() ); 2353*5fdc4257SSteve Yin } 2354*5fdc4257SSteve Yin 2355*5fdc4257SSteve Yin if( flagsSelect & SELFLAG_ADDSELECTION ) 2356*5fdc4257SSteve Yin { 2357*5fdc4257SSteve Yin pRParentSelection->selectAccessibleChild( pRContext->getAccessibleIndexInParent() ); 2358*5fdc4257SSteve Yin } 2359*5fdc4257SSteve Yin 2360*5fdc4257SSteve Yin if( flagsSelect & SELFLAG_REMOVESELECTION ) 2361*5fdc4257SSteve Yin { 2362*5fdc4257SSteve Yin pRParentSelection->deselectAccessibleChild( pRContext->getAccessibleIndexInParent() ); 2363*5fdc4257SSteve Yin } 2364*5fdc4257SSteve Yin 2365*5fdc4257SSteve Yin if( flagsSelect & SELFLAG_EXTENDSELECTION ) 2366*5fdc4257SSteve Yin { 2367*5fdc4257SSteve Yin long indexInParrent = pRContext->getAccessibleIndexInParent(); 2368*5fdc4257SSteve Yin 2369*5fdc4257SSteve Yin if( pRParentSelection->isAccessibleChildSelected( indexInParrent + 1 ) || 2370*5fdc4257SSteve Yin pRParentSelection->isAccessibleChildSelected( indexInParrent - 1 ) ) 2371*5fdc4257SSteve Yin { 2372*5fdc4257SSteve Yin pRParentSelection->selectAccessibleChild( indexInParrent ); 2373*5fdc4257SSteve Yin } 2374*5fdc4257SSteve Yin } 2375*5fdc4257SSteve Yin 2376*5fdc4257SSteve Yin } 2377*5fdc4257SSteve Yin 2378*5fdc4257SSteve Yin pSelectAcc->Release(); 2379*5fdc4257SSteve Yin return S_OK; 2380*5fdc4257SSteve Yin 2381*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2382*5fdc4257SSteve Yin } 2383*5fdc4257SSteve Yin 2384*5fdc4257SSteve Yin /** 2385*5fdc4257SSteve Yin * Return XAccessible interface pointer when needed 2386*5fdc4257SSteve Yin * @param pXAcc, [in, out] the Uno interface of the current object. 2387*5fdc4257SSteve Yin * @return S_OK if successful. 2388*5fdc4257SSteve Yin */ 2389*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::GetUNOInterface(long* pXAcc) 2390*5fdc4257SSteve Yin { 2391*5fdc4257SSteve Yin // #CHECK# 2392*5fdc4257SSteve Yin if(pXAcc == NULL) 2393*5fdc4257SSteve Yin return E_INVALIDARG; 2394*5fdc4257SSteve Yin 2395*5fdc4257SSteve Yin *pXAcc = (long)pUNOInterface; 2396*5fdc4257SSteve Yin return S_OK; 2397*5fdc4257SSteve Yin } 2398*5fdc4257SSteve Yin 2399*5fdc4257SSteve Yin /** 2400*5fdc4257SSteve Yin * Helper method for Implementation of get_accDefaultAction 2401*5fdc4257SSteve Yin * @param pAction, the default action point of the current object. 2402*5fdc4257SSteve Yin * @return S_OK if successful. 2403*5fdc4257SSteve Yin */ 2404*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::SetDefaultAction(long pAction) 2405*5fdc4257SSteve Yin { 2406*5fdc4257SSteve Yin m_pXAction = (XAccessibleAction*)pAction; 2407*5fdc4257SSteve Yin return S_OK; 2408*5fdc4257SSteve Yin } 2409*5fdc4257SSteve Yin 2410*5fdc4257SSteve Yin /** 2411*5fdc4257SSteve Yin * This method is called when AT open some UI elements initially 2412*5fdc4257SSteve Yin * the UI element takes the default action defined here 2413*5fdc4257SSteve Yin * @param varChild, the child id of the defaultaction. 2414*5fdc4257SSteve Yin * @param pszDefaultAction,[in/out] the description of the current action. 2415*5fdc4257SSteve Yin * @return S_OK if successful. 2416*5fdc4257SSteve Yin */ 2417*5fdc4257SSteve Yin HRESULT STDMETHODCALLTYPE CMAccessible::get_accDefaultAction(VARIANT varChild, BSTR *pszDefaultAction) 2418*5fdc4257SSteve Yin { 2419*5fdc4257SSteve Yin 2420*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2421*5fdc4257SSteve Yin ISDESTROY() 2422*5fdc4257SSteve Yin // #CHECK# 2423*5fdc4257SSteve Yin if(pszDefaultAction == NULL) 2424*5fdc4257SSteve Yin { 2425*5fdc4257SSteve Yin return E_INVALIDARG; 2426*5fdc4257SSteve Yin } 2427*5fdc4257SSteve Yin if(varChild.vt==VT_I4) 2428*5fdc4257SSteve Yin { 2429*5fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 2430*5fdc4257SSteve Yin { 2431*5fdc4257SSteve Yin if( m_pXAction == NULL ) 2432*5fdc4257SSteve Yin return DISP_E_MEMBERNOTFOUND; 2433*5fdc4257SSteve Yin SAFE_SYSFREESTRING(*pszDefaultAction); 2434*5fdc4257SSteve Yin *pszDefaultAction = SysAllocString(m_pszActionDescription); 2435*5fdc4257SSteve Yin return S_OK; 2436*5fdc4257SSteve Yin } 2437*5fdc4257SSteve Yin 2438*5fdc4257SSteve Yin long lVal = varChild.lVal; 2439*5fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 2440*5fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 2441*5fdc4257SSteve Yin if(!pChild) 2442*5fdc4257SSteve Yin return E_FAIL; 2443*5fdc4257SSteve Yin return pChild->get_accDefaultAction(varChild,pszDefaultAction); 2444*5fdc4257SSteve Yin } 2445*5fdc4257SSteve Yin return S_FALSE; 2446*5fdc4257SSteve Yin 2447*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2448*5fdc4257SSteve Yin } 2449*5fdc4257SSteve Yin 2450*5fdc4257SSteve Yin /** 2451*5fdc4257SSteve Yin * AT call this method to operate application 2452*5fdc4257SSteve Yin * @param varChild, the child id of the action object. 2453*5fdc4257SSteve Yin * @return S_OK if successful. 2454*5fdc4257SSteve Yin */ 2455*5fdc4257SSteve Yin HRESULT STDMETHODCALLTYPE CMAccessible::accDoDefaultAction(VARIANT varChild) 2456*5fdc4257SSteve Yin { 2457*5fdc4257SSteve Yin 2458*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2459*5fdc4257SSteve Yin ISDESTROY() 2460*5fdc4257SSteve Yin if( varChild.vt != VT_I4 ) 2461*5fdc4257SSteve Yin return E_INVALIDARG; 2462*5fdc4257SSteve Yin if( m_pXAction == NULL ) 2463*5fdc4257SSteve Yin return E_FAIL; 2464*5fdc4257SSteve Yin if( m_pXAction->getAccessibleActionCount() == 0 ) 2465*5fdc4257SSteve Yin return E_FAIL; 2466*5fdc4257SSteve Yin 2467*5fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 2468*5fdc4257SSteve Yin { 2469*5fdc4257SSteve Yin if(m_pXAction->getAccessibleActionCount() > 0) 2470*5fdc4257SSteve Yin m_pXAction->doAccessibleAction(0); 2471*5fdc4257SSteve Yin return S_OK; 2472*5fdc4257SSteve Yin } 2473*5fdc4257SSteve Yin 2474*5fdc4257SSteve Yin long lVal = varChild.lVal; 2475*5fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 2476*5fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 2477*5fdc4257SSteve Yin if(!pChild) 2478*5fdc4257SSteve Yin return E_FAIL; 2479*5fdc4257SSteve Yin return pChild->accDoDefaultAction( varChild ); 2480*5fdc4257SSteve Yin 2481*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2482*5fdc4257SSteve Yin } 2483*5fdc4257SSteve Yin 2484*5fdc4257SSteve Yin /** 2485*5fdc4257SSteve Yin * UNO set description information for action to COM. 2486*5fdc4257SSteve Yin * @param szAction, the action description of the current object. 2487*5fdc4257SSteve Yin * @return S_OK if successful. 2488*5fdc4257SSteve Yin */ 2489*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_ActionDescription( const OLECHAR* szAction) 2490*5fdc4257SSteve Yin { 2491*5fdc4257SSteve Yin 2492*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2493*5fdc4257SSteve Yin ISDESTROY() 2494*5fdc4257SSteve Yin // #CHECK# 2495*5fdc4257SSteve Yin if(szAction == NULL) 2496*5fdc4257SSteve Yin { 2497*5fdc4257SSteve Yin return E_INVALIDARG; 2498*5fdc4257SSteve Yin } 2499*5fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszActionDescription ); 2500*5fdc4257SSteve Yin m_pszActionDescription = SysAllocString( szAction ); 2501*5fdc4257SSteve Yin return S_OK; 2502*5fdc4257SSteve Yin 2503*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2504*5fdc4257SSteve Yin } 2505*5fdc4257SSteve Yin 2506*5fdc4257SSteve Yin BOOL CMAccessible::GetXInterfaceFromXAccessible(XAccessible* pXAcc, XInterface** ppXI, int index) 2507*5fdc4257SSteve Yin { 2508*5fdc4257SSteve Yin Reference< XAccessibleContext > pRContext; 2509*5fdc4257SSteve Yin 2510*5fdc4257SSteve Yin switch(index) 2511*5fdc4257SSteve Yin { 2512*5fdc4257SSteve Yin case XI_COMPONENT: 2513*5fdc4257SSteve Yin QUERYXINTERFACE(AccessibleComponent) 2514*5fdc4257SSteve Yin break; 2515*5fdc4257SSteve Yin case XI_TEXT: 2516*5fdc4257SSteve Yin QUERYXINTERFACE(AccessibleText) 2517*5fdc4257SSteve Yin break; 2518*5fdc4257SSteve Yin case XI_EDITABLETEXT: 2519*5fdc4257SSteve Yin QUERYXINTERFACE(AccessibleEditableText) 2520*5fdc4257SSteve Yin break; 2521*5fdc4257SSteve Yin case XI_TABLE: 2522*5fdc4257SSteve Yin QUERYXINTERFACE(AccessibleTable) 2523*5fdc4257SSteve Yin break; 2524*5fdc4257SSteve Yin case XI_SELECTION: 2525*5fdc4257SSteve Yin QUERYXINTERFACE(AccessibleSelection) 2526*5fdc4257SSteve Yin break; 2527*5fdc4257SSteve Yin case XI_EXTENDEDCOMP: 2528*5fdc4257SSteve Yin QUERYXINTERFACE(AccessibleExtendedComponent) 2529*5fdc4257SSteve Yin break; 2530*5fdc4257SSteve Yin case XI_KEYBINDING: 2531*5fdc4257SSteve Yin QUERYXINTERFACE(AccessibleKeyBinding) 2532*5fdc4257SSteve Yin break; 2533*5fdc4257SSteve Yin case XI_ACTION: 2534*5fdc4257SSteve Yin QUERYXINTERFACE(AccessibleAction) 2535*5fdc4257SSteve Yin break; 2536*5fdc4257SSteve Yin case XI_VALUE: 2537*5fdc4257SSteve Yin QUERYXINTERFACE(AccessibleValue) 2538*5fdc4257SSteve Yin break; 2539*5fdc4257SSteve Yin case XI_HYPERTEXT: 2540*5fdc4257SSteve Yin QUERYXINTERFACE(AccessibleHypertext) 2541*5fdc4257SSteve Yin break; 2542*5fdc4257SSteve Yin case XI_HYPERLINK: 2543*5fdc4257SSteve Yin QUERYXINTERFACE(AccessibleHyperlink) 2544*5fdc4257SSteve Yin break; 2545*5fdc4257SSteve Yin case XI_IMAGE: 2546*5fdc4257SSteve Yin QUERYXINTERFACE(AccessibleImage) 2547*5fdc4257SSteve Yin break; 2548*5fdc4257SSteve Yin default: 2549*5fdc4257SSteve Yin break; 2550*5fdc4257SSteve Yin } 2551*5fdc4257SSteve Yin 2552*5fdc4257SSteve Yin return FALSE; 2553*5fdc4257SSteve Yin } 2554*5fdc4257SSteve Yin 2555*5fdc4257SSteve Yin HRESULT WINAPI CMAccessible::SmartQI(void* pv, REFIID iid, void** ppvObject) 2556*5fdc4257SSteve Yin { 2557*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2558*5fdc4257SSteve Yin ISDESTROY() 2559*5fdc4257SSteve Yin if( ImplIsEqualGUID(iid,IID_IAccIdentity) || 2560*5fdc4257SSteve Yin ImplIsEqualGUID(iid,IID_IStdMarshalInfo) || 2561*5fdc4257SSteve Yin ImplIsEqualGUID(iid,IID_IMarshal) || 2562*5fdc4257SSteve Yin ImplIsEqualGUID(iid,IID_IExternalConnection)|| 2563*5fdc4257SSteve Yin ImplIsEqualGUID(iid,IID_IOleWindow)) 2564*5fdc4257SSteve Yin return E_FAIL; 2565*5fdc4257SSteve Yin 2566*5fdc4257SSteve Yin 2567*5fdc4257SSteve Yin _UNO_AGGMAP_ENTRY* pMap = _GetAggEntries(); 2568*5fdc4257SSteve Yin while(pMap && pMap->piid) 2569*5fdc4257SSteve Yin { 2570*5fdc4257SSteve Yin if(ImplIsEqualGUID(iid, *pMap->piid)) 2571*5fdc4257SSteve Yin { 2572*5fdc4257SSteve Yin XInterface* pXI = NULL; 2573*5fdc4257SSteve Yin BOOL bFound = GetXInterfaceFromXAccessible(pUNOInterface,&pXI,pMap->XIFIndex); 2574*5fdc4257SSteve Yin if(!bFound) 2575*5fdc4257SSteve Yin { 2576*5fdc4257SSteve Yin return E_FAIL; 2577*5fdc4257SSteve Yin } 2578*5fdc4257SSteve Yin 2579*5fdc4257SSteve Yin XGUIDToComObjHash::iterator pIndTemp = m_containedObjects.find( iid ); 2580*5fdc4257SSteve Yin if ( pIndTemp != m_containedObjects.end() ) 2581*5fdc4257SSteve Yin { 2582*5fdc4257SSteve Yin return pIndTemp->second.p->QueryInterface( iid, ppvObject ); 2583*5fdc4257SSteve Yin } 2584*5fdc4257SSteve Yin else 2585*5fdc4257SSteve Yin { 2586*5fdc4257SSteve Yin HRESULT hr = pMap->pfnCreateInstance(pv, iid, ppvObject); 2587*5fdc4257SSteve Yin if(hr == S_OK) 2588*5fdc4257SSteve Yin { 2589*5fdc4257SSteve Yin m_containedObjects.insert(XGUIDToComObjHash::value_type(*pMap->piid,(IUnknown*)*ppvObject)); 2590*5fdc4257SSteve Yin IUNOXWrapper* wrapper = NULL; 2591*5fdc4257SSteve Yin ((IUnknown*)*ppvObject)->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper); 2592*5fdc4257SSteve Yin if(wrapper) 2593*5fdc4257SSteve Yin { 2594*5fdc4257SSteve Yin wrapper->put_XInterface((long)pUNOInterface); 2595*5fdc4257SSteve Yin wrapper->Release(); 2596*5fdc4257SSteve Yin } 2597*5fdc4257SSteve Yin return S_OK; 2598*5fdc4257SSteve Yin } 2599*5fdc4257SSteve Yin } 2600*5fdc4257SSteve Yin return E_FAIL; 2601*5fdc4257SSteve Yin } 2602*5fdc4257SSteve Yin pMap++; 2603*5fdc4257SSteve Yin } 2604*5fdc4257SSteve Yin return E_FAIL; 2605*5fdc4257SSteve Yin 2606*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2607*5fdc4257SSteve Yin } 2608*5fdc4257SSteve Yin 2609*5fdc4257SSteve Yin BOOL CMAccessible::get_IAccessibleFromXAccessible(long pXAcc, IAccessible **ppIA) 2610*5fdc4257SSteve Yin { 2611*5fdc4257SSteve Yin 2612*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2613*5fdc4257SSteve Yin 2614*5fdc4257SSteve Yin // #CHECK# 2615*5fdc4257SSteve Yin if(ppIA == NULL) 2616*5fdc4257SSteve Yin { 2617*5fdc4257SSteve Yin return E_INVALIDARG; 2618*5fdc4257SSteve Yin } 2619*5fdc4257SSteve Yin BOOL isGet = FALSE; 2620*5fdc4257SSteve Yin if(g_pAgent) 2621*5fdc4257SSteve Yin isGet = g_pAgent->GetIAccessibleFromXAccessible((XAccessible*)pXAcc,ppIA); 2622*5fdc4257SSteve Yin 2623*5fdc4257SSteve Yin if(isGet) 2624*5fdc4257SSteve Yin return TRUE; 2625*5fdc4257SSteve Yin else 2626*5fdc4257SSteve Yin return FALSE; 2627*5fdc4257SSteve Yin 2628*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2629*5fdc4257SSteve Yin } 2630*5fdc4257SSteve Yin 2631*5fdc4257SSteve Yin void CMAccessible::get_OLECHARFromAny(Any& pAny, OLECHAR* pChar) 2632*5fdc4257SSteve Yin { 2633*5fdc4257SSteve Yin // #CHECK# 2634*5fdc4257SSteve Yin if(pChar == NULL) 2635*5fdc4257SSteve Yin return; 2636*5fdc4257SSteve Yin 2637*5fdc4257SSteve Yin switch(pAny.getValueTypeClass()) 2638*5fdc4257SSteve Yin { 2639*5fdc4257SSteve Yin case TypeClass_CHAR: 2640*5fdc4257SSteve Yin { 2641*5fdc4257SSteve Yin sal_Int8 val; 2642*5fdc4257SSteve Yin pAny >>= val; 2643*5fdc4257SSteve Yin swprintf( pChar, L"%d", val); 2644*5fdc4257SSteve Yin break; 2645*5fdc4257SSteve Yin } 2646*5fdc4257SSteve Yin case TypeClass_BOOLEAN: 2647*5fdc4257SSteve Yin { 2648*5fdc4257SSteve Yin sal_Bool val; 2649*5fdc4257SSteve Yin pAny >>= val; 2650*5fdc4257SSteve Yin swprintf( pChar, L"%d", val); 2651*5fdc4257SSteve Yin break; 2652*5fdc4257SSteve Yin } 2653*5fdc4257SSteve Yin case TypeClass_BYTE: 2654*5fdc4257SSteve Yin { 2655*5fdc4257SSteve Yin sal_Int8 val; 2656*5fdc4257SSteve Yin pAny >>= val; 2657*5fdc4257SSteve Yin swprintf( pChar, L"%d", val); 2658*5fdc4257SSteve Yin break; 2659*5fdc4257SSteve Yin } 2660*5fdc4257SSteve Yin case TypeClass_SHORT: 2661*5fdc4257SSteve Yin { 2662*5fdc4257SSteve Yin SHORT val; 2663*5fdc4257SSteve Yin pAny >>= val; 2664*5fdc4257SSteve Yin swprintf( pChar, L"%d", val); 2665*5fdc4257SSteve Yin break; 2666*5fdc4257SSteve Yin } 2667*5fdc4257SSteve Yin case TypeClass_UNSIGNED_SHORT: 2668*5fdc4257SSteve Yin { 2669*5fdc4257SSteve Yin USHORT val; 2670*5fdc4257SSteve Yin pAny >>= val; 2671*5fdc4257SSteve Yin swprintf( pChar, L"%d", val); 2672*5fdc4257SSteve Yin break; 2673*5fdc4257SSteve Yin } 2674*5fdc4257SSteve Yin case TypeClass_LONG: 2675*5fdc4257SSteve Yin { 2676*5fdc4257SSteve Yin LONG val; 2677*5fdc4257SSteve Yin pAny >>= val; 2678*5fdc4257SSteve Yin swprintf( pChar, L"%ld", val); 2679*5fdc4257SSteve Yin break; 2680*5fdc4257SSteve Yin } 2681*5fdc4257SSteve Yin case TypeClass_UNSIGNED_LONG: 2682*5fdc4257SSteve Yin { 2683*5fdc4257SSteve Yin ULONG val; 2684*5fdc4257SSteve Yin pAny >>= val; 2685*5fdc4257SSteve Yin swprintf( pChar, L"%ld", val); 2686*5fdc4257SSteve Yin break; 2687*5fdc4257SSteve Yin } 2688*5fdc4257SSteve Yin case TypeClass_FLOAT: 2689*5fdc4257SSteve Yin { 2690*5fdc4257SSteve Yin FLOAT val; 2691*5fdc4257SSteve Yin pAny >>= val; 2692*5fdc4257SSteve Yin swprintf( pChar, L"%.3f", val); 2693*5fdc4257SSteve Yin break; 2694*5fdc4257SSteve Yin } 2695*5fdc4257SSteve Yin case TypeClass_DOUBLE: 2696*5fdc4257SSteve Yin { 2697*5fdc4257SSteve Yin DOUBLE val; 2698*5fdc4257SSteve Yin pAny >>= val; 2699*5fdc4257SSteve Yin swprintf( pChar, L"%.6lf", val); 2700*5fdc4257SSteve Yin break; 2701*5fdc4257SSteve Yin } 2702*5fdc4257SSteve Yin case TypeClass_STRING: 2703*5fdc4257SSteve Yin { 2704*5fdc4257SSteve Yin ::rtl::OUString val; 2705*5fdc4257SSteve Yin pAny >>= val; 2706*5fdc4257SSteve Yin wcscpy(pChar, val.getStr()); 2707*5fdc4257SSteve Yin break; 2708*5fdc4257SSteve Yin } 2709*5fdc4257SSteve Yin case TypeClass_SEQUENCE: 2710*5fdc4257SSteve Yin { 2711*5fdc4257SSteve Yin if(pAny.getValueType() == getCppuType( (Sequence< ::rtl::OUString > *)0 ) ) 2712*5fdc4257SSteve Yin { 2713*5fdc4257SSteve Yin Sequence < ::rtl::OUString > val; 2714*5fdc4257SSteve Yin pAny >>= val; 2715*5fdc4257SSteve Yin 2716*5fdc4257SSteve Yin ::rtl::OUString pString; 2717*5fdc4257SSteve Yin 2718*5fdc4257SSteve Yin int count = val.getLength(); 2719*5fdc4257SSteve Yin 2720*5fdc4257SSteve Yin for( int iIndex = 0;iIndex < count;iIndex++ ) 2721*5fdc4257SSteve Yin { 2722*5fdc4257SSteve Yin pString += val[iIndex]; 2723*5fdc4257SSteve Yin } 2724*5fdc4257SSteve Yin wcscpy(pChar, pString.getStr()); 2725*5fdc4257SSteve Yin } 2726*5fdc4257SSteve Yin else if (pAny.getValueType() == getCppuType( (Sequence< ::com::sun::star::style::TabStop >* )0 ) ) 2727*5fdc4257SSteve Yin { 2728*5fdc4257SSteve Yin Sequence < ::com::sun::star::style::TabStop > val; 2729*5fdc4257SSteve Yin pAny >>= val; 2730*5fdc4257SSteve Yin int count = val.getLength(); 2731*5fdc4257SSteve Yin 2732*5fdc4257SSteve Yin for( int iIndex = 0;iIndex < count;iIndex++ ) 2733*5fdc4257SSteve Yin { 2734*5fdc4257SSteve Yin OLECHAR pAttrs[512] = {NULL}; 2735*5fdc4257SSteve Yin 2736*5fdc4257SSteve Yin OLECHAR pAttrsPosition[512] = {NULL}; 2737*5fdc4257SSteve Yin OLECHAR pAttrsDescimalChar[512] = {NULL}; 2738*5fdc4257SSteve Yin OLECHAR pAttrsFillChar[512] = {NULL}; 2739*5fdc4257SSteve Yin 2740*5fdc4257SSteve Yin ::com::sun::star::style::TabStop sigleVal = val[iIndex]; 2741*5fdc4257SSteve Yin 2742*5fdc4257SSteve Yin swprintf( pAttrsPosition, L"Position=%ld,TabAlign=%ld", 2743*5fdc4257SSteve Yin sigleVal.Position, sigleVal.Alignment); 2744*5fdc4257SSteve Yin 2745*5fdc4257SSteve Yin if(sigleVal.DecimalChar==';' || sigleVal.DecimalChar == ':' || sigleVal.DecimalChar == ',' || 2746*5fdc4257SSteve Yin sigleVal.DecimalChar == '=' || sigleVal.DecimalChar == '\\') 2747*5fdc4257SSteve Yin swprintf( pAttrsDescimalChar, L"DecimalChar=\\%c",sigleVal.DecimalChar); 2748*5fdc4257SSteve Yin else 2749*5fdc4257SSteve Yin swprintf( pAttrsDescimalChar, L"DecimalChar=%c",sigleVal.DecimalChar); 2750*5fdc4257SSteve Yin 2751*5fdc4257SSteve Yin if(sigleVal.FillChar==';' || sigleVal.FillChar == ':' || sigleVal.FillChar == ',' || 2752*5fdc4257SSteve Yin sigleVal.FillChar == '=' || sigleVal.FillChar == '\\') 2753*5fdc4257SSteve Yin swprintf( pAttrsFillChar, L"FillChar=\\%c",sigleVal.FillChar); 2754*5fdc4257SSteve Yin else 2755*5fdc4257SSteve Yin swprintf( pAttrsFillChar, L"FillChar=%c",sigleVal.FillChar); 2756*5fdc4257SSteve Yin 2757*5fdc4257SSteve Yin swprintf( pAttrs, L"%s,%s,%s,",pAttrsPosition,pAttrsDescimalChar,pAttrsFillChar); 2758*5fdc4257SSteve Yin 2759*5fdc4257SSteve Yin wcscat(pChar,pAttrs); 2760*5fdc4257SSteve Yin } 2761*5fdc4257SSteve Yin } 2762*5fdc4257SSteve Yin break; 2763*5fdc4257SSteve Yin } 2764*5fdc4257SSteve Yin case TypeClass_ENUM: 2765*5fdc4257SSteve Yin { 2766*5fdc4257SSteve Yin if (pAny.getValueType() == getCppuType( (::com::sun::star::awt::FontSlant* )0 ) ) 2767*5fdc4257SSteve Yin { 2768*5fdc4257SSteve Yin com::sun::star::awt::FontSlant val; 2769*5fdc4257SSteve Yin pAny >>= val; 2770*5fdc4257SSteve Yin swprintf( pChar, L"%d", val); 2771*5fdc4257SSteve Yin } 2772*5fdc4257SSteve Yin } 2773*5fdc4257SSteve Yin case TypeClass_STRUCT: 2774*5fdc4257SSteve Yin { 2775*5fdc4257SSteve Yin if (pAny.getValueType() == getCppuType( (::com::sun::star::style::LineSpacing* )0 ) ) 2776*5fdc4257SSteve Yin { 2777*5fdc4257SSteve Yin com::sun::star::style::LineSpacing val; 2778*5fdc4257SSteve Yin pAny >>= val; 2779*5fdc4257SSteve Yin swprintf( pChar, L"Mode=%ld,Height=%ld,", val.Mode, val.Height); 2780*5fdc4257SSteve Yin } 2781*5fdc4257SSteve Yin else if (pAny.getValueType() == getCppuType( (com::sun::star::accessibility::TextSegment *)0 ) ) 2782*5fdc4257SSteve Yin { 2783*5fdc4257SSteve Yin com::sun::star::accessibility::TextSegment val; 2784*5fdc4257SSteve Yin pAny >>= val; 2785*5fdc4257SSteve Yin ::rtl::OUString realVal(val.SegmentText); 2786*5fdc4257SSteve Yin wcscpy(pChar, realVal.getStr()); 2787*5fdc4257SSteve Yin } 2788*5fdc4257SSteve Yin break; 2789*5fdc4257SSteve Yin } 2790*5fdc4257SSteve Yin case TypeClass_VOID: 2791*5fdc4257SSteve Yin case TypeClass_HYPER: 2792*5fdc4257SSteve Yin case TypeClass_UNSIGNED_HYPER: 2793*5fdc4257SSteve Yin case TypeClass_TYPE: 2794*5fdc4257SSteve Yin case TypeClass_ANY: 2795*5fdc4257SSteve Yin case TypeClass_TYPEDEF: 2796*5fdc4257SSteve Yin case TypeClass_UNION: 2797*5fdc4257SSteve Yin case TypeClass_EXCEPTION: 2798*5fdc4257SSteve Yin case TypeClass_ARRAY: 2799*5fdc4257SSteve Yin case TypeClass_INTERFACE: 2800*5fdc4257SSteve Yin case TypeClass_SERVICE: 2801*5fdc4257SSteve Yin case TypeClass_MODULE: 2802*5fdc4257SSteve Yin case TypeClass_INTERFACE_METHOD: 2803*5fdc4257SSteve Yin case TypeClass_INTERFACE_ATTRIBUTE: 2804*5fdc4257SSteve Yin case TypeClass_UNKNOWN: 2805*5fdc4257SSteve Yin case TypeClass_PROPERTY: 2806*5fdc4257SSteve Yin case TypeClass_CONSTANT: 2807*5fdc4257SSteve Yin case TypeClass_CONSTANTS: 2808*5fdc4257SSteve Yin case TypeClass_SINGLETON: 2809*5fdc4257SSteve Yin case TypeClass_MAKE_FIXED_SIZE: 2810*5fdc4257SSteve Yin break; 2811*5fdc4257SSteve Yin default: 2812*5fdc4257SSteve Yin break; 2813*5fdc4257SSteve Yin } 2814*5fdc4257SSteve Yin } 2815*5fdc4257SSteve Yin 2816*5fdc4257SSteve Yin void CMAccessible::get_OLECHAR4Numbering(const Any& pAny, short numberingLevel,const OUString& numberingPrefix,OLECHAR* pChar) 2817*5fdc4257SSteve Yin { 2818*5fdc4257SSteve Yin if(pChar == NULL) 2819*5fdc4257SSteve Yin return; 2820*5fdc4257SSteve Yin Reference< ::com::sun::star::container::XIndexReplace > pXIndex; 2821*5fdc4257SSteve Yin if((pAny>>=pXIndex) && (numberingLevel !=-1))//numbering level is -1,means invalid value 2822*5fdc4257SSteve Yin { 2823*5fdc4257SSteve Yin Any aAny = pXIndex->getByIndex(numberingLevel); 2824*5fdc4257SSteve Yin Sequence< ::com::sun::star::beans::PropertyValue > aProps; 2825*5fdc4257SSteve Yin aAny >>= aProps; 2826*5fdc4257SSteve Yin const ::com::sun::star::beans::PropertyValue* pPropArray = aProps.getConstArray(); 2827*5fdc4257SSteve Yin sal_Int32 nCount = aProps.getLength(); 2828*5fdc4257SSteve Yin swprintf(pChar,L"Numbering:NumberingLevel=%d,",numberingLevel); 2829*5fdc4257SSteve Yin for( sal_Int32 i=0; i<nCount; i++ ) 2830*5fdc4257SSteve Yin { 2831*5fdc4257SSteve Yin ::com::sun::star::beans::PropertyValue rProp = pPropArray[i]; 2832*5fdc4257SSteve Yin if( (rProp.Name.compareTo(OUString::createFromAscii("BulletChar"))==0)|| 2833*5fdc4257SSteve Yin (rProp.Name.compareTo(OUString::createFromAscii("GraphicURL"))==0)|| 2834*5fdc4257SSteve Yin (rProp.Name.compareTo(OUString::createFromAscii("NumberingType"))==0)) 2835*5fdc4257SSteve Yin { 2836*5fdc4257SSteve Yin OLECHAR propStr[512] = {NULL}; 2837*5fdc4257SSteve Yin swprintf(propStr,L"%s=",rProp.Name.getStr()); 2838*5fdc4257SSteve Yin OLECHAR pTemp[256] = {NULL}; 2839*5fdc4257SSteve Yin CMAccessible::get_OLECHARFromAny(rProp.Value,pTemp); 2840*5fdc4257SSteve Yin if(rProp.Name.compareTo(OUString::createFromAscii("GraphicURL"))==0) 2841*5fdc4257SSteve Yin { 2842*5fdc4257SSteve Yin OLECHAR* pOccur = wcschr(pTemp,':'); 2843*5fdc4257SSteve Yin if(pOccur) 2844*5fdc4257SSteve Yin *pOccur = '.'; 2845*5fdc4257SSteve Yin } 2846*5fdc4257SSteve Yin wcscat(propStr,pTemp); 2847*5fdc4257SSteve Yin wcscat(pChar,propStr); 2848*5fdc4257SSteve Yin wcscat(pChar,L","); 2849*5fdc4257SSteve Yin 2850*5fdc4257SSteve Yin if(rProp.Name.compareTo(OUString::createFromAscii("NumberingType"))==0) 2851*5fdc4257SSteve Yin { 2852*5fdc4257SSteve Yin if(numberingPrefix.getLength()!=0) 2853*5fdc4257SSteve Yin { 2854*5fdc4257SSteve Yin swprintf(pTemp,L"NumberingPrefix=%s,",numberingPrefix.getStr()); 2855*5fdc4257SSteve Yin wcscat(pChar,pTemp); 2856*5fdc4257SSteve Yin } 2857*5fdc4257SSteve Yin } 2858*5fdc4257SSteve Yin } 2859*5fdc4257SSteve Yin } 2860*5fdc4257SSteve Yin } 2861*5fdc4257SSteve Yin 2862*5fdc4257SSteve Yin //Because now have three types numbering level: 2863*5fdc4257SSteve Yin //1.real numbering list,numbering level>=0 and numbering Rule !=NULL; 2864*5fdc4257SSteve Yin //2.common paragraph, numbering level >=0, and numbering Rule == NULL; 2865*5fdc4257SSteve Yin //3.TOC paragraph, numbering level >0, and numbering Rule ==NULL; 2866*5fdc4257SSteve Yin // IAText:numberinglevel base on 0, but TOC's level base on 1, 2867*5fdc4257SSteve Yin // so NumberingLevel value will be decreased 1 in bridge code. 2868*5fdc4257SSteve Yin else if(numberingLevel >0) 2869*5fdc4257SSteve Yin { 2870*5fdc4257SSteve Yin swprintf(pChar,L"Numbering:NumberingLevel=%d,NumberingType=4,NumberingPrefix=,",numberingLevel-1); 2871*5fdc4257SSteve Yin } 2872*5fdc4257SSteve Yin else 2873*5fdc4257SSteve Yin { 2874*5fdc4257SSteve Yin swprintf(pChar,L"Numbering:"); 2875*5fdc4257SSteve Yin } 2876*5fdc4257SSteve Yin } 2877*5fdc4257SSteve Yin 2878*5fdc4257SSteve Yin void CMAccessible::ConvertAnyToVariant(const ::com::sun::star::uno::Any &rAnyVal, VARIANT *pvData) 2879*5fdc4257SSteve Yin { 2880*5fdc4257SSteve Yin if(rAnyVal.hasValue()) 2881*5fdc4257SSteve Yin { 2882*5fdc4257SSteve Yin // Clear VARIANT variable. 2883*5fdc4257SSteve Yin VariantClear(pvData); 2884*5fdc4257SSteve Yin 2885*5fdc4257SSteve Yin // Set value according to value type. 2886*5fdc4257SSteve Yin switch(rAnyVal.getValueTypeClass()) 2887*5fdc4257SSteve Yin { 2888*5fdc4257SSteve Yin case TypeClass_CHAR: 2889*5fdc4257SSteve Yin pvData->vt = VT_UI1; 2890*5fdc4257SSteve Yin memcpy(&pvData->bVal, rAnyVal.getValue(), sizeof(sal_Char)); 2891*5fdc4257SSteve Yin break; 2892*5fdc4257SSteve Yin 2893*5fdc4257SSteve Yin case TypeClass_BOOLEAN: 2894*5fdc4257SSteve Yin pvData->vt = VT_BOOL; 2895*5fdc4257SSteve Yin memcpy(&pvData->boolVal, rAnyVal.getValue(), sizeof(sal_Bool)); 2896*5fdc4257SSteve Yin break; 2897*5fdc4257SSteve Yin 2898*5fdc4257SSteve Yin case TypeClass_BYTE: 2899*5fdc4257SSteve Yin pvData->vt = VT_UI1; 2900*5fdc4257SSteve Yin memcpy(&pvData->bVal, rAnyVal.getValue(), sizeof(sal_Int8)); 2901*5fdc4257SSteve Yin break; 2902*5fdc4257SSteve Yin 2903*5fdc4257SSteve Yin case TypeClass_SHORT: 2904*5fdc4257SSteve Yin pvData->vt = VT_I2; 2905*5fdc4257SSteve Yin memcpy(&pvData->iVal, rAnyVal.getValue(), sizeof(sal_Int16)); 2906*5fdc4257SSteve Yin break; 2907*5fdc4257SSteve Yin 2908*5fdc4257SSteve Yin case TypeClass_UNSIGNED_SHORT: 2909*5fdc4257SSteve Yin pvData->vt = VT_I2; 2910*5fdc4257SSteve Yin memcpy(&pvData->iVal, rAnyVal.getValue(), sizeof(sal_uInt16)); 2911*5fdc4257SSteve Yin break; 2912*5fdc4257SSteve Yin 2913*5fdc4257SSteve Yin case TypeClass_LONG: 2914*5fdc4257SSteve Yin pvData->vt = VT_I4; 2915*5fdc4257SSteve Yin memcpy(&pvData->lVal, rAnyVal.getValue(), sizeof(sal_Int32)); 2916*5fdc4257SSteve Yin break; 2917*5fdc4257SSteve Yin 2918*5fdc4257SSteve Yin case TypeClass_UNSIGNED_LONG: 2919*5fdc4257SSteve Yin pvData->vt = VT_I4; 2920*5fdc4257SSteve Yin memcpy(&pvData->lVal, rAnyVal.getValue(), sizeof(sal_uInt32)); 2921*5fdc4257SSteve Yin break; 2922*5fdc4257SSteve Yin 2923*5fdc4257SSteve Yin case TypeClass_FLOAT: 2924*5fdc4257SSteve Yin pvData->vt = VT_R4; 2925*5fdc4257SSteve Yin memcpy(&pvData->fltVal, rAnyVal.getValue(), sizeof(float)); 2926*5fdc4257SSteve Yin break; 2927*5fdc4257SSteve Yin 2928*5fdc4257SSteve Yin case TypeClass_DOUBLE: 2929*5fdc4257SSteve Yin pvData->vt = VT_R8; 2930*5fdc4257SSteve Yin memcpy(&pvData->dblVal, rAnyVal.getValue(), sizeof(double)); 2931*5fdc4257SSteve Yin break; 2932*5fdc4257SSteve Yin 2933*5fdc4257SSteve Yin case TypeClass_STRING: 2934*5fdc4257SSteve Yin { 2935*5fdc4257SSteve Yin pvData->vt = VT_BSTR; 2936*5fdc4257SSteve Yin ::rtl::OUString val; 2937*5fdc4257SSteve Yin rAnyVal >>= val; 2938*5fdc4257SSteve Yin pvData->bstrVal = SysAllocString((OLECHAR *)val.getStr()); 2939*5fdc4257SSteve Yin break; 2940*5fdc4257SSteve Yin } 2941*5fdc4257SSteve Yin 2942*5fdc4257SSteve Yin case TypeClass_VOID: 2943*5fdc4257SSteve Yin case TypeClass_HYPER: 2944*5fdc4257SSteve Yin case TypeClass_UNSIGNED_HYPER: 2945*5fdc4257SSteve Yin case TypeClass_TYPE: 2946*5fdc4257SSteve Yin case TypeClass_ANY: 2947*5fdc4257SSteve Yin case TypeClass_ENUM: 2948*5fdc4257SSteve Yin case TypeClass_TYPEDEF: 2949*5fdc4257SSteve Yin case TypeClass_STRUCT: 2950*5fdc4257SSteve Yin case TypeClass_UNION: 2951*5fdc4257SSteve Yin case TypeClass_EXCEPTION: 2952*5fdc4257SSteve Yin case TypeClass_SEQUENCE: 2953*5fdc4257SSteve Yin case TypeClass_ARRAY: 2954*5fdc4257SSteve Yin case TypeClass_INTERFACE: 2955*5fdc4257SSteve Yin { 2956*5fdc4257SSteve Yin Reference< XAccessible > pXAcc; 2957*5fdc4257SSteve Yin if(rAnyVal >>= pXAcc) 2958*5fdc4257SSteve Yin { 2959*5fdc4257SSteve Yin if(pXAcc.is()) 2960*5fdc4257SSteve Yin { 2961*5fdc4257SSteve Yin IAccessible* pIAcc = NULL; 2962*5fdc4257SSteve Yin get_IAccessibleFromXAccessible((long)pXAcc.get(), &pIAcc); 2963*5fdc4257SSteve Yin if(pIAcc == NULL) 2964*5fdc4257SSteve Yin { 2965*5fdc4257SSteve Yin Reference< XAccessibleContext > pXAccContext = pXAcc->getAccessibleContext(); 2966*5fdc4257SSteve Yin g_pAgent->InsertAccObj(pXAcc.get(),pXAccContext->getAccessibleParent().get()); 2967*5fdc4257SSteve Yin get_IAccessibleFromXAccessible((long)pXAcc.get(), &pIAcc); 2968*5fdc4257SSteve Yin } 2969*5fdc4257SSteve Yin if(pIAcc) 2970*5fdc4257SSteve Yin { 2971*5fdc4257SSteve Yin pIAcc->AddRef(); 2972*5fdc4257SSteve Yin 2973*5fdc4257SSteve Yin pvData->vt = VT_UNKNOWN; 2974*5fdc4257SSteve Yin pvData->pdispVal = (IAccessible2*)pIAcc; 2975*5fdc4257SSteve Yin break; 2976*5fdc4257SSteve Yin } 2977*5fdc4257SSteve Yin } 2978*5fdc4257SSteve Yin } 2979*5fdc4257SSteve Yin } 2980*5fdc4257SSteve Yin case TypeClass_SERVICE: 2981*5fdc4257SSteve Yin case TypeClass_MODULE: 2982*5fdc4257SSteve Yin case TypeClass_INTERFACE_METHOD: 2983*5fdc4257SSteve Yin case TypeClass_INTERFACE_ATTRIBUTE: 2984*5fdc4257SSteve Yin case TypeClass_UNKNOWN: 2985*5fdc4257SSteve Yin case TypeClass_PROPERTY: 2986*5fdc4257SSteve Yin case TypeClass_CONSTANT: 2987*5fdc4257SSteve Yin case TypeClass_CONSTANTS: 2988*5fdc4257SSteve Yin case TypeClass_SINGLETON: 2989*5fdc4257SSteve Yin case TypeClass_MAKE_FIXED_SIZE: 2990*5fdc4257SSteve Yin // Output the type string, if there is other uno value type. 2991*5fdc4257SSteve Yin pvData->vt = VT_BSTR; 2992*5fdc4257SSteve Yin pvData->bstrVal = SysAllocString(rAnyVal.getValueTypeName().getStr()); 2993*5fdc4257SSteve Yin break; 2994*5fdc4257SSteve Yin 2995*5fdc4257SSteve Yin default: 2996*5fdc4257SSteve Yin break; 2997*5fdc4257SSteve Yin } 2998*5fdc4257SSteve Yin } 2999*5fdc4257SSteve Yin else 3000*5fdc4257SSteve Yin { 3001*5fdc4257SSteve Yin VariantClear(pvData); 3002*5fdc4257SSteve Yin } 3003*5fdc4257SSteve Yin } 3004*5fdc4257SSteve Yin 3005*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::Get_XAccChildID(long* childID) 3006*5fdc4257SSteve Yin { 3007*5fdc4257SSteve Yin // #CHECK# 3008*5fdc4257SSteve Yin if(childID == NULL) 3009*5fdc4257SSteve Yin { 3010*5fdc4257SSteve Yin return E_FAIL; 3011*5fdc4257SSteve Yin } 3012*5fdc4257SSteve Yin *childID = m_dChildID; 3013*5fdc4257SSteve Yin return S_OK; 3014*5fdc4257SSteve Yin } 3015*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_states(AccessibleStates __RPC_FAR *states ) 3016*5fdc4257SSteve Yin { 3017*5fdc4257SSteve Yin 3018*5fdc4257SSteve Yin CHECK_ENABLE_INF 3019*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3020*5fdc4257SSteve Yin ISDESTROY() 3021*5fdc4257SSteve Yin // #CHECK XInterface# 3022*5fdc4257SSteve Yin if( !pRContext.is() ) 3023*5fdc4257SSteve Yin return E_FAIL; 3024*5fdc4257SSteve Yin 3025*5fdc4257SSteve Yin Reference<XAccessibleStateSet> pRStateSet = pRContext.get()->getAccessibleStateSet(); 3026*5fdc4257SSteve Yin if(!pRStateSet.is()) 3027*5fdc4257SSteve Yin { 3028*5fdc4257SSteve Yin return S_OK; 3029*5fdc4257SSteve Yin } 3030*5fdc4257SSteve Yin Sequence<short> pStates = pRStateSet->getStates(); 3031*5fdc4257SSteve Yin 3032*5fdc4257SSteve Yin 3033*5fdc4257SSteve Yin long count = pStates.getLength() ; 3034*5fdc4257SSteve Yin *states = 0x0; 3035*5fdc4257SSteve Yin for( int i = 0; i < count; i++ ) 3036*5fdc4257SSteve Yin { 3037*5fdc4257SSteve Yin for( int j = 0; j < sizeof(UNO_STATES) / sizeof(UNO_STATES[0]); j++ ) 3038*5fdc4257SSteve Yin { 3039*5fdc4257SSteve Yin if( pStates[i] == UNO_STATES[j] ) 3040*5fdc4257SSteve Yin { 3041*5fdc4257SSteve Yin *states |= IA2_STATES[j]; 3042*5fdc4257SSteve Yin break; 3043*5fdc4257SSteve Yin } 3044*5fdc4257SSteve Yin } 3045*5fdc4257SSteve Yin } 3046*5fdc4257SSteve Yin return S_OK; 3047*5fdc4257SSteve Yin 3048*5fdc4257SSteve Yin 3049*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3050*5fdc4257SSteve Yin } 3051*5fdc4257SSteve Yin 3052*5fdc4257SSteve Yin // return the UNO roles 3053*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_extendedRole( BSTR __RPC_FAR * ) 3054*5fdc4257SSteve Yin { 3055*5fdc4257SSteve Yin 3056*5fdc4257SSteve Yin CHECK_ENABLE_INF 3057*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3058*5fdc4257SSteve Yin ISDESTROY() 3059*5fdc4257SSteve Yin 3060*5fdc4257SSteve Yin return E_NOTIMPL; 3061*5fdc4257SSteve Yin 3062*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3063*5fdc4257SSteve Yin } 3064*5fdc4257SSteve Yin 3065*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_localizedExtendedRole( BSTR __RPC_FAR * ) 3066*5fdc4257SSteve Yin { 3067*5fdc4257SSteve Yin 3068*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3069*5fdc4257SSteve Yin ISDESTROY() 3070*5fdc4257SSteve Yin return E_NOTIMPL; 3071*5fdc4257SSteve Yin 3072*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3073*5fdc4257SSteve Yin } 3074*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_nExtendedStates( long __RPC_FAR * ) 3075*5fdc4257SSteve Yin { 3076*5fdc4257SSteve Yin 3077*5fdc4257SSteve Yin CHECK_ENABLE_INF 3078*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3079*5fdc4257SSteve Yin ISDESTROY() 3080*5fdc4257SSteve Yin 3081*5fdc4257SSteve Yin return E_NOTIMPL; 3082*5fdc4257SSteve Yin 3083*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3084*5fdc4257SSteve Yin } 3085*5fdc4257SSteve Yin 3086*5fdc4257SSteve Yin 3087*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_localizedExtendedStates( long, BSTR __RPC_FAR *__RPC_FAR *, long __RPC_FAR *) 3088*5fdc4257SSteve Yin { 3089*5fdc4257SSteve Yin 3090*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3091*5fdc4257SSteve Yin ISDESTROY() 3092*5fdc4257SSteve Yin return E_NOTIMPL; 3093*5fdc4257SSteve Yin 3094*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3095*5fdc4257SSteve Yin } 3096*5fdc4257SSteve Yin 3097*5fdc4257SSteve Yin 3098*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_indexInParent( long __RPC_FAR *accParentIndex) 3099*5fdc4257SSteve Yin { 3100*5fdc4257SSteve Yin 3101*5fdc4257SSteve Yin CHECK_ENABLE_INF 3102*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3103*5fdc4257SSteve Yin ISDESTROY() 3104*5fdc4257SSteve Yin // #CHECK# 3105*5fdc4257SSteve Yin if(accParentIndex == NULL) 3106*5fdc4257SSteve Yin return E_INVALIDARG; 3107*5fdc4257SSteve Yin 3108*5fdc4257SSteve Yin // #CHECK XInterface# 3109*5fdc4257SSteve Yin if( !pRContext.is() ) 3110*5fdc4257SSteve Yin return E_FAIL; 3111*5fdc4257SSteve Yin 3112*5fdc4257SSteve Yin *accParentIndex = pRContext.get()->getAccessibleIndexInParent(); 3113*5fdc4257SSteve Yin return S_OK; 3114*5fdc4257SSteve Yin 3115*5fdc4257SSteve Yin 3116*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3117*5fdc4257SSteve Yin } 3118*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_locale( IA2Locale __RPC_FAR *locale ) 3119*5fdc4257SSteve Yin { 3120*5fdc4257SSteve Yin 3121*5fdc4257SSteve Yin CHECK_ENABLE_INF 3122*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3123*5fdc4257SSteve Yin ISDESTROY() 3124*5fdc4257SSteve Yin if(locale == NULL) 3125*5fdc4257SSteve Yin return E_INVALIDARG; 3126*5fdc4257SSteve Yin // #CHECK XInterface# 3127*5fdc4257SSteve Yin 3128*5fdc4257SSteve Yin if( !pRContext.is() ) 3129*5fdc4257SSteve Yin return E_FAIL; 3130*5fdc4257SSteve Yin 3131*5fdc4257SSteve Yin ::com::sun::star::lang::Locale unoLoc = pRContext.get()->getLocale(); 3132*5fdc4257SSteve Yin locale->language = SysAllocString((OLECHAR*)unoLoc.Language.getStr()); 3133*5fdc4257SSteve Yin locale->country = SysAllocString((OLECHAR*)unoLoc.Country.getStr()); 3134*5fdc4257SSteve Yin locale->variant = SysAllocString((OLECHAR*)unoLoc.Variant.getStr()); 3135*5fdc4257SSteve Yin 3136*5fdc4257SSteve Yin return S_OK; 3137*5fdc4257SSteve Yin 3138*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3139*5fdc4257SSteve Yin } 3140*5fdc4257SSteve Yin 3141*5fdc4257SSteve Yin DWORD GetMSAAStateFromUNO(short xState) 3142*5fdc4257SSteve Yin { 3143*5fdc4257SSteve Yin DWORD IState = STATE_SYSTEM_UNAVAILABLE; 3144*5fdc4257SSteve Yin switch( xState ) 3145*5fdc4257SSteve Yin { 3146*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::BUSY: 3147*5fdc4257SSteve Yin IState = STATE_SYSTEM_BUSY; 3148*5fdc4257SSteve Yin break; 3149*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::CHECKED: 3150*5fdc4257SSteve Yin IState = STATE_SYSTEM_CHECKED; 3151*5fdc4257SSteve Yin break; 3152*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::DEFUNC: 3153*5fdc4257SSteve Yin IState = STATE_SYSTEM_UNAVAILABLE; 3154*5fdc4257SSteve Yin break; 3155*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::EXPANDED: 3156*5fdc4257SSteve Yin IState = STATE_SYSTEM_EXPANDED; 3157*5fdc4257SSteve Yin break; 3158*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::FOCUSABLE: 3159*5fdc4257SSteve Yin IState = STATE_SYSTEM_FOCUSABLE; 3160*5fdc4257SSteve Yin break; 3161*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::FOCUSED: 3162*5fdc4257SSteve Yin IState = STATE_SYSTEM_FOCUSED; 3163*5fdc4257SSteve Yin break; 3164*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::INDETERMINATE: 3165*5fdc4257SSteve Yin IState = STATE_SYSTEM_MIXED; 3166*5fdc4257SSteve Yin break; 3167*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::MULTI_SELECTABLE: 3168*5fdc4257SSteve Yin IState = STATE_SYSTEM_MULTISELECTABLE; 3169*5fdc4257SSteve Yin break; 3170*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::PRESSED: 3171*5fdc4257SSteve Yin IState = STATE_SYSTEM_PRESSED; 3172*5fdc4257SSteve Yin break; 3173*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::RESIZABLE: 3174*5fdc4257SSteve Yin IState = STATE_SYSTEM_SIZEABLE; 3175*5fdc4257SSteve Yin break; 3176*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::SELECTABLE: 3177*5fdc4257SSteve Yin IState = STATE_SYSTEM_SELECTABLE; 3178*5fdc4257SSteve Yin break; 3179*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::SELECTED: 3180*5fdc4257SSteve Yin IState = STATE_SYSTEM_SELECTED; 3181*5fdc4257SSteve Yin break; 3182*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::ARMED: 3183*5fdc4257SSteve Yin IState = STATE_SYSTEM_FOCUSED; 3184*5fdc4257SSteve Yin break; 3185*5fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::EXPANDABLE: 3186*5fdc4257SSteve Yin IState = STATE_SYSTEM_COLLAPSED; 3187*5fdc4257SSteve Yin break; 3188*5fdc4257SSteve Yin default: 3189*5fdc4257SSteve Yin break; 3190*5fdc4257SSteve Yin } 3191*5fdc4257SSteve Yin return IState; 3192*5fdc4257SSteve Yin } 3193*5fdc4257SSteve Yin 3194*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_appName( BSTR __RPC_FAR *name) 3195*5fdc4257SSteve Yin { 3196*5fdc4257SSteve Yin 3197*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3198*5fdc4257SSteve Yin ISDESTROY() 3199*5fdc4257SSteve Yin if(name == NULL) 3200*5fdc4257SSteve Yin return E_INVALIDARG; 3201*5fdc4257SSteve Yin 3202*5fdc4257SSteve Yin *name = SysAllocString(OLESTR("Hannover")); 3203*5fdc4257SSteve Yin return S_OK; 3204*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3205*5fdc4257SSteve Yin } 3206*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_appVersion(BSTR __RPC_FAR *version) 3207*5fdc4257SSteve Yin { 3208*5fdc4257SSteve Yin 3209*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3210*5fdc4257SSteve Yin ISDESTROY() 3211*5fdc4257SSteve Yin if(version == NULL) 3212*5fdc4257SSteve Yin return E_INVALIDARG; 3213*5fdc4257SSteve Yin *version=SysAllocString(OLESTR("3.0")); 3214*5fdc4257SSteve Yin return S_OK; 3215*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3216*5fdc4257SSteve Yin } 3217*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_toolkitName(BSTR __RPC_FAR *name) 3218*5fdc4257SSteve Yin { 3219*5fdc4257SSteve Yin 3220*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3221*5fdc4257SSteve Yin ISDESTROY() 3222*5fdc4257SSteve Yin if(name == NULL) 3223*5fdc4257SSteve Yin return E_INVALIDARG; 3224*5fdc4257SSteve Yin *name = SysAllocString(OLESTR(" ")); 3225*5fdc4257SSteve Yin return S_OK; 3226*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3227*5fdc4257SSteve Yin } 3228*5fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_toolkitVersion(BSTR __RPC_FAR *version) 3229*5fdc4257SSteve Yin { 3230*5fdc4257SSteve Yin 3231*5fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3232*5fdc4257SSteve Yin ISDESTROY() 3233*5fdc4257SSteve Yin if(version == NULL) 3234*5fdc4257SSteve Yin return E_INVALIDARG; 3235*5fdc4257SSteve Yin *version = SysAllocString(OLESTR(" ")); 3236*5fdc4257SSteve Yin return S_OK; 3237*5fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3238*5fdc4257SSteve Yin } 3239*5fdc4257SSteve Yin 3240*5fdc4257SSteve Yin 3241*5fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_attributes(/*[out]*/ BSTR *pAttr) 3242*5fdc4257SSteve Yin { 3243*5fdc4257SSteve Yin CHECK_ENABLE_INF 3244*5fdc4257SSteve Yin Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext(); 3245*5fdc4257SSteve Yin if( !pRContext.is() ) 3246*5fdc4257SSteve Yin { 3247*5fdc4257SSteve Yin return E_FAIL; 3248*5fdc4257SSteve Yin } 3249*5fdc4257SSteve Yin Reference<XAccessibleExtendedAttributes> pRXI(pRContext,UNO_QUERY); 3250*5fdc4257SSteve Yin if( !pRXI.is() ) 3251*5fdc4257SSteve Yin return E_FAIL; 3252*5fdc4257SSteve Yin else 3253*5fdc4257SSteve Yin { 3254*5fdc4257SSteve Yin com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleExtendedAttributes> pRXAttr; 3255*5fdc4257SSteve Yin pRXAttr = pRXI.get(); 3256*5fdc4257SSteve Yin ::com::sun::star::uno::Any anyVal = pRXAttr->getExtendedAttributes(); 3257*5fdc4257SSteve Yin 3258*5fdc4257SSteve Yin ::rtl::OUString val; 3259*5fdc4257SSteve Yin anyVal >>= val; 3260*5fdc4257SSteve Yin 3261*5fdc4257SSteve Yin if(*pAttr) 3262*5fdc4257SSteve Yin SAFE_SYSFREESTRING(*pAttr); 3263*5fdc4257SSteve Yin *pAttr = SysAllocString((OLECHAR *)val.getStr()); 3264*5fdc4257SSteve Yin 3265*5fdc4257SSteve Yin return S_OK; 3266*5fdc4257SSteve Yin } 3267*5fdc4257SSteve Yin } 3268*5fdc4257SSteve Yin 3269