1*3a700b0aSSteve Yin /************************************************************** 25fdc4257SSteve Yin * 3*3a700b0aSSteve Yin * Licensed to the Apache Software Foundation (ASF) under one 4*3a700b0aSSteve Yin * or more contributor license agreements. See the NOTICE file 5*3a700b0aSSteve Yin * distributed with this work for additional information 6*3a700b0aSSteve Yin * regarding copyright ownership. The ASF licenses this file 7*3a700b0aSSteve Yin * to you under the Apache License, Version 2.0 (the 8*3a700b0aSSteve Yin * "License"); you may not use this file except in compliance 9*3a700b0aSSteve Yin * with the License. You may obtain a copy of the License at 10*3a700b0aSSteve Yin * 11*3a700b0aSSteve Yin * http://www.apache.org/licenses/LICENSE-2.0 12*3a700b0aSSteve Yin * 13*3a700b0aSSteve Yin * Unless required by applicable law or agreed to in writing, 14*3a700b0aSSteve Yin * software distributed under the License is distributed on an 15*3a700b0aSSteve Yin * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*3a700b0aSSteve Yin * KIND, either express or implied. See the License for the 17*3a700b0aSSteve Yin * specific language governing permissions and limitations 18*3a700b0aSSteve Yin * under the License. 19*3a700b0aSSteve Yin * 20*3a700b0aSSteve Yin *************************************************************/ 215fdc4257SSteve Yin 225fdc4257SSteve Yin #include "stdafx.h" 235fdc4257SSteve Yin #include "UAccCOM2.h" 245fdc4257SSteve Yin #include "MAccessible.h" 255fdc4257SSteve Yin 265fdc4257SSteve Yin #include <algorithm> 275fdc4257SSteve Yin #include "AccAction.h" 285fdc4257SSteve Yin 295fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleText.hpp> 305fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> 315fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleImage.hpp> 325fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleTable.hpp> 335fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp> 345fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleAction.hpp> 355fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp> 365fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleHyperText.hpp> 375fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleHyperlink.hpp> 385fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> 395fdc4257SSteve Yin #include <com/sun/star/accessibility/AccessibleStateType.hpp> 405fdc4257SSteve Yin #include <com/sun/star/accessibility/AccessibleRole.hpp> 415fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleGroupPosition.hpp> 425fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleValue.hpp> 435fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp> 445fdc4257SSteve Yin #include <com/sun/star/style/LineSpacing.hpp> 455fdc4257SSteve Yin #include <com/sun/star/style/TabStop.hpp> 465fdc4257SSteve Yin #include <com/sun/star/container/XIndexReplace.hpp> 475fdc4257SSteve Yin 485fdc4257SSteve Yin #include "AccessibleRole.h" 495fdc4257SSteve Yin 50*3a700b0aSSteve Yin 515fdc4257SSteve Yin using namespace com::sun::star::accessibility::AccessibleStateType; 525fdc4257SSteve Yin 535fdc4257SSteve Yin // IA2 states mapping, and name 545fdc4257SSteve Yin // maintenance the consistency, change one array, change the three all 555fdc4257SSteve Yin long IA2_STATES[] = 565fdc4257SSteve Yin { 575fdc4257SSteve Yin IA2_STATE_ACTIVE, // = 0x1; 585fdc4257SSteve Yin IA2_STATE_ARMED, // = 0x2; 595fdc4257SSteve Yin IA2_STATE_DEFUNCT, // = 0x4; 605fdc4257SSteve Yin IA2_STATE_EDITABLE, // = 0x8; 615fdc4257SSteve Yin IA2_STATE_HORIZONTAL, // = 0x10; 625fdc4257SSteve Yin IA2_STATE_ICONIFIED, // = 0x20; 635fdc4257SSteve Yin IA2_STATE_INVALID_ENTRY, // = 0x80; 645fdc4257SSteve Yin IA2_STATE_MANAGES_DESCENDANTS, // = 0x100; 655fdc4257SSteve Yin IA2_STATE_MODAL, // = 0x200; 665fdc4257SSteve Yin IA2_STATE_MULTI_LINE, // = 0x400; 675fdc4257SSteve Yin IA2_STATE_OPAQUE, // = 0x800; 685fdc4257SSteve Yin IA2_STATE_REQUIRED, // = 0x2000; 695fdc4257SSteve Yin IA2_STATE_SELECTABLE_TEXT, // = 0x3000; 705fdc4257SSteve Yin IA2_STATE_SINGLE_LINE, // = 0x4000; 715fdc4257SSteve Yin IA2_STATE_STALE, // = 0x8000; 725fdc4257SSteve Yin IA2_STATE_SUPPORTS_AUTOCOMPLETION, // = 0x10000; 735fdc4257SSteve Yin IA2_STATE_TRANSIENT, //= 0x20000; 745fdc4257SSteve Yin IA2_STATE_VERTICAL // = 0x40000; 755fdc4257SSteve Yin }; 765fdc4257SSteve Yin /* 775fdc4257SSteve Yin 785fdc4257SSteve Yin <=== map ===> 795fdc4257SSteve Yin 805fdc4257SSteve Yin */ 815fdc4257SSteve Yin short UNO_STATES[] = 825fdc4257SSteve Yin { 835fdc4257SSteve Yin ACTIVE, // = (sal_Int16)1; 845fdc4257SSteve Yin ARMED, // = (sal_Int16)2; 855fdc4257SSteve Yin DEFUNC, // = (sal_Int16)5; 865fdc4257SSteve Yin EDITABLE, // = (sal_Int16)6; 875fdc4257SSteve Yin HORIZONTAL, // = (sal_Int16)12; 885fdc4257SSteve Yin ICONIFIED, // = (sal_Int16)13; 895fdc4257SSteve Yin -1, //IA2_STATE_INVALID_ENTRY 905fdc4257SSteve Yin MANAGES_DESCENDANTS, // = (sal_Int16)15; 915fdc4257SSteve Yin MODAL, // = (sal_Int16)16; 925fdc4257SSteve Yin MULTI_LINE, // = (sal_Int16)17; 935fdc4257SSteve Yin OPAQUE, // = (sal_Int16)19; 945fdc4257SSteve Yin -1, //IA2_STATE_REQUIRED 955fdc4257SSteve Yin -1, //IA2_STATE_SELECTABLE_TEXT 965fdc4257SSteve Yin SINGLE_LINE, // = (sal_Int16)26; 975fdc4257SSteve Yin STALE, // = (sal_Int16)27; 985fdc4257SSteve Yin -1, //IA2_STATE_SUPPORTS_AUTOCOMPLETION 995fdc4257SSteve Yin TRANSIENT, //IA2_STATE_TRANSIENT 1005fdc4257SSteve Yin VERTICAL // = (sal_Int16)29; 1015fdc4257SSteve Yin }; 1025fdc4257SSteve Yin 1035fdc4257SSteve Yin // <=== map ===> 1045fdc4257SSteve Yin 1055fdc4257SSteve Yin BSTR IA2_STATES_NAME[] = 1065fdc4257SSteve Yin { 1075fdc4257SSteve Yin _T("Active"), 1085fdc4257SSteve Yin _T("Armed"), 1095fdc4257SSteve Yin _T("Defunct"), 1105fdc4257SSteve Yin _T("Editable"), 1115fdc4257SSteve Yin _T("Horizontal"), 1125fdc4257SSteve Yin _T("Iconified"), 1135fdc4257SSteve Yin _T("Invalid Entry"), 1145fdc4257SSteve Yin _T("Manages Decendents"), 1155fdc4257SSteve Yin _T("Modal"), 1165fdc4257SSteve Yin _T("Multi Line"), 1175fdc4257SSteve Yin _T("Opaque"), 1185fdc4257SSteve Yin _T("Required"), 1195fdc4257SSteve Yin _T("Selectable Text"), 1205fdc4257SSteve Yin _T("Single Line"), 1215fdc4257SSteve Yin _T("Stale"), 1225fdc4257SSteve Yin _T("Supports Autocompletion"), 1235fdc4257SSteve Yin _T("Transient"), 1245fdc4257SSteve Yin _T("Vertical") 1255fdc4257SSteve Yin }; 1265fdc4257SSteve Yin 1275fdc4257SSteve Yin // IA2 states mapping, and name 1285fdc4257SSteve Yin // maintenance the consistency. change one, change them all 1295fdc4257SSteve Yin 1305fdc4257SSteve Yin BSTR UNO_ALL_STATES[] = 1315fdc4257SSteve Yin { 1325fdc4257SSteve Yin _T("INVALID"), // INVALID ( 0 ) 1335fdc4257SSteve Yin _T("ACTIVE"), // ACTIVE ( 1 ) 1345fdc4257SSteve Yin _T("ARMED"), // ARMED ( 2 ) 1355fdc4257SSteve Yin _T("BUSY"), // BUSY ( 3 ) 1365fdc4257SSteve Yin _T("CHECKED"), // CHECKED ( 4 ) 1375fdc4257SSteve Yin _T("DEFUNC"), // DEFUNC ( 5 ) 1385fdc4257SSteve Yin _T("EDITABLE"), // EDITABLE ( 6 ) 1395fdc4257SSteve Yin _T("ENABLED"), // ENABLED ( 7 ) 1405fdc4257SSteve Yin _T("EXPANDABLE"), // EXPANDABLE ( 8 ) 1415fdc4257SSteve Yin _T("EXPANDED"), // EXPANDED ( 9 ) 1425fdc4257SSteve Yin _T("FOCUSABLE"), // FOCUSABLE ( 10 ) 1435fdc4257SSteve Yin _T("FOCUSED"), // FOCUSED ( 11 ) 1445fdc4257SSteve Yin _T("HORIZONTAL"), // HORIZONTAL ( 12 ) 1455fdc4257SSteve Yin _T("ICONIFIED"), // ICONIFIED ( 13 ) 1465fdc4257SSteve Yin _T("INDETERMINATE"), // INDETERMINATE ( 14 ) 1475fdc4257SSteve Yin _T("MANAGES_DESCENDANTS"),// MANAGES_DESCENDANTS ( 15 ) 1485fdc4257SSteve Yin _T("MODAL"), // MODAL ( 16 ) 1495fdc4257SSteve Yin _T("MULTI_LINE"), // MULTI_LINE ( 17 ) 1505fdc4257SSteve Yin _T("MULTI_SELECTABLE"), // MULTI_SELECTABLE ( 18 ) 1515fdc4257SSteve Yin _T("OPAQUE"), // OPAQUE ( 19 ) 1525fdc4257SSteve Yin _T("PRESSED"), // PRESSED ( 20 ) 1535fdc4257SSteve Yin _T("RESIZABLE"), // RESIZABLE ( 21 ) 1545fdc4257SSteve Yin _T("SELECTABLE"), // SELECTABLE ( 22 ) 1555fdc4257SSteve Yin _T("SELECTED"), // SELECTED ( 23 ) 1565fdc4257SSteve Yin _T("SENSITIVE"), // SENSITIVE ( 24 ) 1575fdc4257SSteve Yin _T("SHOWING"), // SHOWING ( 25 ) 1585fdc4257SSteve Yin _T("SINGLE_LINE"), // SINGLE_LINE ( 26 ) 1595fdc4257SSteve Yin _T("STALE"), // STALE ( 27 ) 1605fdc4257SSteve Yin _T("TRANSIENT"), // TRANSIENT ( 28 ) 1615fdc4257SSteve Yin _T("VERTICAL"), // VERTICAL ( 29 ) 1625fdc4257SSteve Yin _T("VISIBLE"), // VISIBLE ( 30 ) 1635fdc4257SSteve Yin _T("MOVEABLE"), // MOVEABLE ( 31 ) 1645fdc4257SSteve Yin _T("OFFSCREEN"), // OFFSCREEN ( 32 ) 1655fdc4257SSteve Yin _T("COLLAPSE"), // COLLAPSE ( 33 ) 1665fdc4257SSteve Yin _T("DEFAULT") // DEFAULT ( 34 ) 1675fdc4257SSteve Yin }; 1685fdc4257SSteve Yin 1695fdc4257SSteve Yin 1705fdc4257SSteve Yin using namespace com::sun::star::accessibility::AccessibleRole; 1715fdc4257SSteve Yin 1725fdc4257SSteve Yin 1735fdc4257SSteve Yin 1745fdc4257SSteve Yin #define QUERYXINTERFACE(ainterface) \ 1755fdc4257SSteve Yin { \ 1765fdc4257SSteve Yin if(pXAcc == NULL) \ 1775fdc4257SSteve Yin return FALSE; \ 1785fdc4257SSteve Yin pRContext = pXAcc->getAccessibleContext(); \ 1795fdc4257SSteve Yin if( !pRContext.is() ) \ 1805fdc4257SSteve Yin { \ 1815fdc4257SSteve Yin return FALSE; \ 1825fdc4257SSteve Yin } \ 1835fdc4257SSteve Yin Reference<X##ainterface> pRXI(pRContext,UNO_QUERY);\ 1845fdc4257SSteve Yin if( !pRXI.is() ) \ 1855fdc4257SSteve Yin { \ 1865fdc4257SSteve Yin return FALSE; \ 1875fdc4257SSteve Yin } \ 1885fdc4257SSteve Yin *ppXI = (XInterface*)pRXI.get(); \ 1895fdc4257SSteve Yin return TRUE; \ 1905fdc4257SSteve Yin } 1915fdc4257SSteve Yin 1925fdc4257SSteve Yin #define ISDESTROY() \ 1935fdc4257SSteve Yin if(m_isDestroy) \ 1945fdc4257SSteve Yin return S_FALSE; 1955fdc4257SSteve Yin 1965fdc4257SSteve Yin 1975fdc4257SSteve Yin AccObjectManagerAgent* CMAccessible::g_pAgent = NULL; 1985fdc4257SSteve Yin 1995fdc4257SSteve Yin CMAccessible::CMAccessible(): 2005fdc4257SSteve Yin m_iRole(0x00), 2015fdc4257SSteve Yin m_dState(0x00), 2025fdc4257SSteve Yin m_dChildID(0x00), 2035fdc4257SSteve Yin m_dFocusChildID(UACC_NO_FOCUS), 2045fdc4257SSteve Yin m_hwnd(NULL), 2055fdc4257SSteve Yin m_pIParent(NULL), 2065fdc4257SSteve Yin m_pszName(NULL), 2075fdc4257SSteve Yin m_pszValue(NULL), 2085fdc4257SSteve Yin m_pszDescription(NULL), 2095fdc4257SSteve Yin m_isDestroy(FALSE), 2105fdc4257SSteve Yin m_pszActionDescription(NULL), 2115fdc4257SSteve Yin m_pXAction(NULL), 2125fdc4257SSteve Yin m_bRequiresSave(FALSE), 2135fdc4257SSteve Yin pUNOInterface(NULL) 2145fdc4257SSteve Yin { 2155fdc4257SSteve Yin m_sLocation.m_dLeft=0; 2165fdc4257SSteve Yin m_sLocation.m_dTop = 0; 2175fdc4257SSteve Yin m_sLocation.m_dWidth=0; 2185fdc4257SSteve Yin m_sLocation.m_dHeight=0; 2195fdc4257SSteve Yin CEnumVariant::Create(&m_pEnumVar); 2205fdc4257SSteve Yin } 2215fdc4257SSteve Yin 2225fdc4257SSteve Yin CMAccessible::~CMAccessible() 2235fdc4257SSteve Yin { 2245fdc4257SSteve Yin if(m_pszName!=NULL) 2255fdc4257SSteve Yin { 2265fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszName); 2275fdc4257SSteve Yin m_pszName=NULL; 2285fdc4257SSteve Yin } 2295fdc4257SSteve Yin if(m_pszValue!=NULL) 2305fdc4257SSteve Yin { 2315fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszValue); 2325fdc4257SSteve Yin m_pszValue=NULL; 2335fdc4257SSteve Yin } 2345fdc4257SSteve Yin if(m_pszDescription!=NULL) 2355fdc4257SSteve Yin { 2365fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszDescription); 2375fdc4257SSteve Yin m_pszDescription=NULL; 2385fdc4257SSteve Yin } 2395fdc4257SSteve Yin 2405fdc4257SSteve Yin if(m_pszActionDescription!=NULL) 2415fdc4257SSteve Yin { 2425fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszActionDescription); 2435fdc4257SSteve Yin m_pszActionDescription=NULL; 2445fdc4257SSteve Yin } 2455fdc4257SSteve Yin 2465fdc4257SSteve Yin if(m_pIParent) 2475fdc4257SSteve Yin { 2485fdc4257SSteve Yin m_pIParent->Release(); 2495fdc4257SSteve Yin m_pIParent=NULL; 2505fdc4257SSteve Yin } 2515fdc4257SSteve Yin pRef = NULL; 2525fdc4257SSteve Yin m_pEnumVar->Release(); 2535fdc4257SSteve Yin m_containedObjects.clear(); 2545fdc4257SSteve Yin pRContext = NULL; 2555fdc4257SSteve Yin } 2565fdc4257SSteve Yin 2575fdc4257SSteve Yin /** 2585fdc4257SSteve Yin * Returns the Parent IAccessible interface pointer to AT. 2595fdc4257SSteve Yin * It should add reference, and the client should release the component. 2605fdc4257SSteve Yin * It should return E_FAIL when the parent point is null. 2615fdc4257SSteve Yin * @param ppdispParent [in,out] used to return the parent interface point. 2625fdc4257SSteve Yin * when the point is null, should return null. 2635fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if the m_pIParent is NULL. 2645fdc4257SSteve Yin */ 2655fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accParent(IDispatch **ppdispParent) 2665fdc4257SSteve Yin { 2675fdc4257SSteve Yin 2685fdc4257SSteve Yin CHECK_ENABLE_INF 2695fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2705fdc4257SSteve Yin ISDESTROY() 2715fdc4257SSteve Yin // #CHECK# 2725fdc4257SSteve Yin if(ppdispParent == NULL) 2735fdc4257SSteve Yin { 2745fdc4257SSteve Yin return E_INVALIDARG; 2755fdc4257SSteve Yin } 2765fdc4257SSteve Yin 2775fdc4257SSteve Yin if(m_pIParent) 2785fdc4257SSteve Yin { 2795fdc4257SSteve Yin *ppdispParent = m_pIParent; 2805fdc4257SSteve Yin (*ppdispParent)->AddRef(); 2815fdc4257SSteve Yin return S_OK; 2825fdc4257SSteve Yin } 2835fdc4257SSteve Yin else if(m_hwnd) 2845fdc4257SSteve Yin { 2855fdc4257SSteve Yin HRESULT hr = AccessibleObjectFromWindow(m_hwnd, OBJID_WINDOW, IID_IAccessible, (void**)ppdispParent); 2865fdc4257SSteve Yin if( ! SUCCEEDED( hr ) || ! ppdispParent ) 2875fdc4257SSteve Yin { 2885fdc4257SSteve Yin return S_FALSE; 2895fdc4257SSteve Yin } 2905fdc4257SSteve Yin return S_OK; 2915fdc4257SSteve Yin } 2925fdc4257SSteve Yin return S_FALSE; 2935fdc4257SSteve Yin 2945fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2955fdc4257SSteve Yin } 2965fdc4257SSteve Yin 2975fdc4257SSteve Yin /** 2985fdc4257SSteve Yin * Returns child count of current COM object. 2995fdc4257SSteve Yin * @param pcountChildren [in,out] used to return the children count. 3005fdc4257SSteve Yin * @return S_OK if successful. 3015fdc4257SSteve Yin */ 3025fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accChildCount(long *pcountChildren) 3035fdc4257SSteve Yin { 3045fdc4257SSteve Yin 3055fdc4257SSteve Yin CHECK_ENABLE_INF 3065fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3075fdc4257SSteve Yin ISDESTROY() 3085fdc4257SSteve Yin // #CHECK# 3095fdc4257SSteve Yin if(pcountChildren == NULL) 3105fdc4257SSteve Yin { 3115fdc4257SSteve Yin return E_INVALIDARG; 3125fdc4257SSteve Yin } 3135fdc4257SSteve Yin 3145fdc4257SSteve Yin if(!pUNOInterface) 3155fdc4257SSteve Yin return S_FALSE; 3165fdc4257SSteve Yin 3175fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext(); 3185fdc4257SSteve Yin if( pRContext.is() ) 3195fdc4257SSteve Yin { 3205fdc4257SSteve Yin *pcountChildren = pRContext->getAccessibleChildCount(); 3215fdc4257SSteve Yin } 3225fdc4257SSteve Yin 3235fdc4257SSteve Yin return S_OK; 3245fdc4257SSteve Yin 3255fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3265fdc4257SSteve Yin } 3275fdc4257SSteve Yin 3285fdc4257SSteve Yin /** 3295fdc4257SSteve Yin * Returns child interface pointer for AT according to input child ID. 3305fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 3315fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 3325fdc4257SSteve Yin * @param ppdispChild, [in,out] use to return the child interface point. 3335fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 3345fdc4257SSteve Yin */ 3355fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accChild(VARIANT varChild, IDispatch **ppdispChild) 3365fdc4257SSteve Yin { 3375fdc4257SSteve Yin 3385fdc4257SSteve Yin CHECK_ENABLE_INF 3395fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3405fdc4257SSteve Yin ISDESTROY() 3415fdc4257SSteve Yin // #CHECK# 3425fdc4257SSteve Yin if(ppdispChild == NULL) 3435fdc4257SSteve Yin { 3445fdc4257SSteve Yin return E_INVALIDARG; 3455fdc4257SSteve Yin } 3465fdc4257SSteve Yin if(varChild.vt==VT_I4) 3475fdc4257SSteve Yin { 3485fdc4257SSteve Yin //get child interface pointer due to child ID 3495fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 3505fdc4257SSteve Yin { 3515fdc4257SSteve Yin AddRef(); 3525fdc4257SSteve Yin *ppdispChild = this; 3535fdc4257SSteve Yin return S_OK; 3545fdc4257SSteve Yin } 3555fdc4257SSteve Yin *ppdispChild = GetChildInterface(varChild.lVal); 3565fdc4257SSteve Yin (*ppdispChild)->AddRef(); 3575fdc4257SSteve Yin return (*ppdispChild)?S_OK:S_FALSE; 3585fdc4257SSteve Yin } 3595fdc4257SSteve Yin return S_FALSE; 3605fdc4257SSteve Yin 3615fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3625fdc4257SSteve Yin } 3635fdc4257SSteve Yin 3645fdc4257SSteve Yin /** 3655fdc4257SSteve Yin * Returns the accessible name of the current COM object self or its one child to AT. 3665fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 3675fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 3685fdc4257SSteve Yin * @param pszName, [in,out] use to return the name of the proper object. 3695fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 3705fdc4257SSteve Yin */ 3715fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accName(VARIANT varChild, BSTR *pszName) 3725fdc4257SSteve Yin { 3735fdc4257SSteve Yin 3745fdc4257SSteve Yin CHECK_ENABLE_INF 3755fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3765fdc4257SSteve Yin ISDESTROY() 3775fdc4257SSteve Yin // #CHECK# 3785fdc4257SSteve Yin if(pszName == NULL) 3795fdc4257SSteve Yin { 3805fdc4257SSteve Yin return E_INVALIDARG; 3815fdc4257SSteve Yin } 3825fdc4257SSteve Yin if(varChild.vt==VT_I4) 3835fdc4257SSteve Yin { 3845fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 3855fdc4257SSteve Yin { 3865fdc4257SSteve Yin SAFE_SYSFREESTRING(*pszName); 3875fdc4257SSteve Yin *pszName = SysAllocString(m_pszName); 3885fdc4257SSteve Yin return S_OK; 3895fdc4257SSteve Yin } 3905fdc4257SSteve Yin 3915fdc4257SSteve Yin long lVal = varChild.lVal; 3925fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 3935fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 3945fdc4257SSteve Yin if(!pChild) 3955fdc4257SSteve Yin return E_FAIL; 3965fdc4257SSteve Yin return pChild->get_accName(varChild,pszName); 3975fdc4257SSteve Yin } 3985fdc4257SSteve Yin return S_FALSE; 3995fdc4257SSteve Yin 4005fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 4015fdc4257SSteve Yin } 4025fdc4257SSteve Yin 4035fdc4257SSteve Yin /** 4045fdc4257SSteve Yin * Returns the accessible value of the current COM object self or its one child to AT. 4055fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 4065fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 4075fdc4257SSteve Yin * @param pszValue, [in,out] use to return the value of the proper object. 4085fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 4095fdc4257SSteve Yin */ 4105fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accValue(VARIANT varChild, BSTR *pszValue) 4115fdc4257SSteve Yin { 4125fdc4257SSteve Yin 4135fdc4257SSteve Yin CHECK_ENABLE_INF 4145fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 4155fdc4257SSteve Yin ISDESTROY() 4165fdc4257SSteve Yin // #CHECK# 4175fdc4257SSteve Yin if( pszValue == NULL ) 4185fdc4257SSteve Yin { 4195fdc4257SSteve Yin return E_INVALIDARG; 4205fdc4257SSteve Yin } 4215fdc4257SSteve Yin if( varChild.vt==VT_I4 ) 4225fdc4257SSteve Yin { 4235fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 4245fdc4257SSteve Yin { 4255fdc4257SSteve Yin if(m_dState & STATE_SYSTEM_PROTECTED) 4265fdc4257SSteve Yin return E_ACCESSDENIED; 4275fdc4257SSteve Yin 4285fdc4257SSteve Yin if ( m_pszValue !=NULL && wcslen(m_pszValue) == 0 ) 4295fdc4257SSteve Yin return S_OK; 4305fdc4257SSteve Yin 4315fdc4257SSteve Yin SAFE_SYSFREESTRING(*pszValue); 4325fdc4257SSteve Yin *pszValue = SysAllocString(m_pszValue); 4335fdc4257SSteve Yin return S_OK; 4345fdc4257SSteve Yin } 4355fdc4257SSteve Yin 4365fdc4257SSteve Yin long lVal = varChild.lVal; 4375fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 4385fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 4395fdc4257SSteve Yin if(!pChild) 4405fdc4257SSteve Yin return E_FAIL; 4415fdc4257SSteve Yin return pChild->get_accValue(varChild,pszValue); 4425fdc4257SSteve Yin } 4435fdc4257SSteve Yin return S_FALSE; 4445fdc4257SSteve Yin 4455fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 4465fdc4257SSteve Yin } 4475fdc4257SSteve Yin 4485fdc4257SSteve Yin /** 4495fdc4257SSteve Yin * Returns the accessible description of the current COM object self or its one child to AT. 4505fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 4515fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 4525fdc4257SSteve Yin * @param pszDescription, [in,out] use to return the description of the proper object. 4535fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 4545fdc4257SSteve Yin */ 4555fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accDescription(VARIANT varChild, BSTR *pszDescription) 4565fdc4257SSteve Yin { 4575fdc4257SSteve Yin 4585fdc4257SSteve Yin CHECK_ENABLE_INF 4595fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 4605fdc4257SSteve Yin ISDESTROY() 4615fdc4257SSteve Yin // #CHECK# 4625fdc4257SSteve Yin if(pszDescription == NULL) 4635fdc4257SSteve Yin { 4645fdc4257SSteve Yin return E_INVALIDARG; 4655fdc4257SSteve Yin } 4665fdc4257SSteve Yin if(varChild.vt==VT_I4) 4675fdc4257SSteve Yin { 4685fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 4695fdc4257SSteve Yin { 4705fdc4257SSteve Yin SAFE_SYSFREESTRING(*pszDescription); 4715fdc4257SSteve Yin *pszDescription = SysAllocString(m_pszDescription); 4725fdc4257SSteve Yin return S_OK; 4735fdc4257SSteve Yin } 4745fdc4257SSteve Yin 4755fdc4257SSteve Yin long lVal = varChild.lVal; 4765fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 4775fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 4785fdc4257SSteve Yin if(!pChild) 4795fdc4257SSteve Yin return E_FAIL; 4805fdc4257SSteve Yin return pChild->get_accDescription(varChild,pszDescription); 4815fdc4257SSteve Yin } 4825fdc4257SSteve Yin return S_FALSE; 4835fdc4257SSteve Yin 4845fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 4855fdc4257SSteve Yin } 4865fdc4257SSteve Yin 4875fdc4257SSteve Yin /** 4885fdc4257SSteve Yin * Returns the accessible role of the current COM object self or its one child to AT. 4895fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 4905fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 4915fdc4257SSteve Yin * @param pvarRole, [in,out] use to return the role of the proper object. 4925fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 4935fdc4257SSteve Yin */ 4945fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accRole(VARIANT varChild, VARIANT *pvarRole) 4955fdc4257SSteve Yin { 4965fdc4257SSteve Yin 4975fdc4257SSteve Yin CHECK_ENABLE_INF 4985fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 4995fdc4257SSteve Yin ISDESTROY() 5005fdc4257SSteve Yin // #CHECK# 5015fdc4257SSteve Yin if(pvarRole == NULL) 5025fdc4257SSteve Yin { 5035fdc4257SSteve Yin return E_INVALIDARG; 5045fdc4257SSteve Yin } 5055fdc4257SSteve Yin if(varChild.vt == VT_I4) 5065fdc4257SSteve Yin { 5075fdc4257SSteve Yin 5085fdc4257SSteve Yin if(varChild.lVal == CHILDID_SELF) 5095fdc4257SSteve Yin { 5105fdc4257SSteve Yin if( m_iRole < IA2_ROLE_CAPTION ) 5115fdc4257SSteve Yin { 5125fdc4257SSteve Yin VariantInit(pvarRole); 5135fdc4257SSteve Yin pvarRole->vt = VT_I4; 5145fdc4257SSteve Yin pvarRole->lVal = m_iRole; 5155fdc4257SSteve Yin } 5165fdc4257SSteve Yin else 5175fdc4257SSteve Yin { 5185fdc4257SSteve Yin VariantInit(pvarRole); 5195fdc4257SSteve Yin pvarRole->vt = VT_I4; 5205fdc4257SSteve Yin pvarRole->lVal = ROLE_SYSTEM_CLIENT; 5215fdc4257SSteve Yin } 5225fdc4257SSteve Yin return S_OK; 5235fdc4257SSteve Yin } 5245fdc4257SSteve Yin 5255fdc4257SSteve Yin 5265fdc4257SSteve Yin long lVal = varChild.lVal; 5275fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 5285fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 5295fdc4257SSteve Yin if(!pChild) 5305fdc4257SSteve Yin return E_FAIL; 5315fdc4257SSteve Yin return pChild->get_accRole(varChild,pvarRole); 5325fdc4257SSteve Yin } 5335fdc4257SSteve Yin return S_FALSE; 5345fdc4257SSteve Yin 5355fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 5365fdc4257SSteve Yin } 5375fdc4257SSteve Yin 5385fdc4257SSteve Yin /** 5395fdc4257SSteve Yin * Returns the accessible state of the current COM object self or its one child to AT. 5405fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 5415fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 5425fdc4257SSteve Yin * @param pvarState, [in,out] use to return the state of the proper object. 5435fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 5445fdc4257SSteve Yin */ 5455fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accState(VARIANT varChild, VARIANT *pvarState) 5465fdc4257SSteve Yin { 5475fdc4257SSteve Yin 5485fdc4257SSteve Yin CHECK_ENABLE_INF 5495fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 5505fdc4257SSteve Yin ISDESTROY() 5515fdc4257SSteve Yin // #CHECK# 5525fdc4257SSteve Yin if(pvarState == NULL) 5535fdc4257SSteve Yin { 5545fdc4257SSteve Yin return E_INVALIDARG; 5555fdc4257SSteve Yin } 5565fdc4257SSteve Yin if(varChild.vt==VT_I4) 5575fdc4257SSteve Yin { 5585fdc4257SSteve Yin if(varChild.lVal == CHILDID_SELF) 5595fdc4257SSteve Yin { 5605fdc4257SSteve Yin if(pUNOInterface) 5615fdc4257SSteve Yin { 5625fdc4257SSteve Yin Reference< XAccessibleContext > pContext = pUNOInterface->getAccessibleContext(); 5635fdc4257SSteve Yin if(pContext.is()) 5645fdc4257SSteve Yin { 5655fdc4257SSteve Yin // add the STATE_SYSTEM_LINKED state 5665fdc4257SSteve Yin Reference< XAccessibleHypertext > pRHypertext(pContext,UNO_QUERY); 5675fdc4257SSteve Yin if(pRHypertext.is()) 5685fdc4257SSteve Yin { 5695fdc4257SSteve Yin if( pRHypertext->getHyperLinkCount() > 0 ) 5705fdc4257SSteve Yin m_dState |= STATE_SYSTEM_LINKED; 5715fdc4257SSteve Yin else 5725fdc4257SSteve Yin m_dState &= ~STATE_SYSTEM_LINKED; 5735fdc4257SSteve Yin } 5745fdc4257SSteve Yin else 5755fdc4257SSteve Yin m_dState &= ~STATE_SYSTEM_LINKED; 5765fdc4257SSteve Yin } 5775fdc4257SSteve Yin } 5785fdc4257SSteve Yin 5795fdc4257SSteve Yin VariantInit(pvarState); 5805fdc4257SSteve Yin pvarState->vt = VT_I4; 5815fdc4257SSteve Yin pvarState->lVal = m_dState; 5825fdc4257SSteve Yin return S_OK; 5835fdc4257SSteve Yin } 5845fdc4257SSteve Yin 5855fdc4257SSteve Yin long lVal = varChild.lVal; 5865fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 5875fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 5885fdc4257SSteve Yin if(!pChild) 5895fdc4257SSteve Yin return E_FAIL; 5905fdc4257SSteve Yin return pChild->get_accState(varChild,pvarState); 5915fdc4257SSteve Yin } 5925fdc4257SSteve Yin return S_FALSE; 5935fdc4257SSteve Yin 5945fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 5955fdc4257SSteve Yin } 5965fdc4257SSteve Yin 5975fdc4257SSteve Yin /** 5985fdc4257SSteve Yin * Returns the accessible helpString of the current COM object self or its one child to AT. 5995fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 6005fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 6015fdc4257SSteve Yin * @param pszHelp, [in,out] use to return the helpString of the proper object. 6025fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 6035fdc4257SSteve Yin */ 6045fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accHelp(VARIANT, BSTR *) 6055fdc4257SSteve Yin { 6065fdc4257SSteve Yin return E_NOTIMPL; 6075fdc4257SSteve Yin } 6085fdc4257SSteve Yin 6095fdc4257SSteve Yin /** 6105fdc4257SSteve Yin * Returns the accessible HelpTopic of the current COM object self or its one child to AT. 6115fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 6125fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 6135fdc4257SSteve Yin * @param pszHelpFile, [in,out] use to return the HelpTopic of the proper object. 6145fdc4257SSteve Yin * @param pidTopic, use to return the HelpTopic ID of the proper object. 6155fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 6165fdc4257SSteve Yin * Not implemented yet 6175fdc4257SSteve Yin */ 6185fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accHelpTopic(BSTR *, VARIANT, long *) 6195fdc4257SSteve Yin { 6205fdc4257SSteve Yin return E_NOTIMPL; 6215fdc4257SSteve Yin } 6225fdc4257SSteve Yin 6235fdc4257SSteve Yin static void GetMnemonicChar( const ::rtl::OUString& aStr, WCHAR* wStr) 6245fdc4257SSteve Yin { 6255fdc4257SSteve Yin int nLen = aStr.pData->length; 6265fdc4257SSteve Yin int i = 0; 6275fdc4257SSteve Yin WCHAR* text = aStr.pData->buffer; 6285fdc4257SSteve Yin 6295fdc4257SSteve Yin while ( i < nLen ) 6305fdc4257SSteve Yin { 6315fdc4257SSteve Yin if ( text[i] == L'~' ) 6325fdc4257SSteve Yin if ( text[i+1] != L'~' ) 6335fdc4257SSteve Yin { 6345fdc4257SSteve Yin wStr[0] = text[i+1]; 6355fdc4257SSteve Yin break; 6365fdc4257SSteve Yin } 6375fdc4257SSteve Yin i++; 6385fdc4257SSteve Yin } 6395fdc4257SSteve Yin } 6405fdc4257SSteve Yin 6415fdc4257SSteve Yin /** 6425fdc4257SSteve Yin * Returns the accessible keyboard shortcut of the current COM object self or its one child to AT. 6435fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 6445fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 6455fdc4257SSteve Yin * @param pszKeyboardShortcut, [in,out] use to return the kbshortcut of the proper object. 6465fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 6475fdc4257SSteve Yin */ 6485fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accKeyboardShortcut(VARIANT varChild, BSTR *pszKeyboardShortcut) 6495fdc4257SSteve Yin { 6505fdc4257SSteve Yin 6515fdc4257SSteve Yin CHECK_ENABLE_INF 6525fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 6535fdc4257SSteve Yin 6545fdc4257SSteve Yin ISDESTROY() 6555fdc4257SSteve Yin // #CHECK# 6565fdc4257SSteve Yin if(pszKeyboardShortcut == NULL) 6575fdc4257SSteve Yin { 6585fdc4257SSteve Yin return E_INVALIDARG; 6595fdc4257SSteve Yin } 6605fdc4257SSteve Yin 6615fdc4257SSteve Yin if(varChild.vt==VT_I4) 6625fdc4257SSteve Yin { 6635fdc4257SSteve Yin if(varChild.lVal == CHILDID_SELF) 6645fdc4257SSteve Yin { 6655fdc4257SSteve Yin if( pUNOInterface ) 6665fdc4257SSteve Yin { 6675fdc4257SSteve Yin Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext(); 6685fdc4257SSteve Yin if( !pRContext.is() ) 6695fdc4257SSteve Yin return S_FALSE; 6705fdc4257SSteve Yin 6715fdc4257SSteve Yin Reference<XAccessibleAction> pRXI(pRContext,UNO_QUERY); 6725fdc4257SSteve Yin 6735fdc4257SSteve Yin OLECHAR wString[64]={0}; 6745fdc4257SSteve Yin 6755fdc4257SSteve Yin if( pRXI.is() && pRXI->getAccessibleActionCount() >= 1) 6765fdc4257SSteve Yin { 6775fdc4257SSteve Yin Reference< XAccessibleKeyBinding > binding = pRXI->getAccessibleActionKeyBinding(0); 6785fdc4257SSteve Yin if( binding.is() ) 6795fdc4257SSteve Yin { 6805fdc4257SSteve Yin long nCount = binding->getAccessibleKeyBindingCount(); 6815fdc4257SSteve Yin if(nCount >= 1) 6825fdc4257SSteve Yin { 6835fdc4257SSteve Yin CAccAction::GetkeyBindingStrByXkeyBinding( binding->getAccessibleKeyBinding(0),wString ); 6845fdc4257SSteve Yin } 6855fdc4257SSteve Yin } 6865fdc4257SSteve Yin } 6875fdc4257SSteve Yin if(wString[0] == 0) 6885fdc4257SSteve Yin { 6895fdc4257SSteve Yin Reference<XAccessibleRelationSet> pRrelationSet = pRContext->getAccessibleRelationSet(); 6905fdc4257SSteve Yin if(!pRrelationSet.is()) 6915fdc4257SSteve Yin { 6925fdc4257SSteve Yin return S_FALSE; 6935fdc4257SSteve Yin } 6945fdc4257SSteve Yin 6955fdc4257SSteve Yin long nRelCount = pRrelationSet->getRelationCount(); 6965fdc4257SSteve Yin 6975fdc4257SSteve Yin // Modified by Steve Yin, for SODC_1552 6985fdc4257SSteve Yin if( /*nRelCount <= 0 &&*/ m_iRole == ROLE_SYSTEM_TEXT ) 6995fdc4257SSteve Yin { 7005fdc4257SSteve Yin VARIANT varParentRole; 7015fdc4257SSteve Yin VariantInit( &varParentRole ); 7025fdc4257SSteve Yin 7035fdc4257SSteve Yin m_pIParent->get_accRole(varChild, &varParentRole); 7045fdc4257SSteve Yin 7055fdc4257SSteve Yin if( m_pIParent && varParentRole.lVal == ROLE_SYSTEM_COMBOBOX ) // edit in comoboBox 7065fdc4257SSteve Yin { 7075fdc4257SSteve Yin m_pIParent->get_accKeyboardShortcut(varChild, pszKeyboardShortcut); 7085fdc4257SSteve Yin return S_OK; 7095fdc4257SSteve Yin } 7105fdc4257SSteve Yin } 7115fdc4257SSteve Yin 7125fdc4257SSteve Yin AccessibleRelation *paccRelation = NULL; 7135fdc4257SSteve Yin AccessibleRelation accRelation; 7145fdc4257SSteve Yin for(int i=0; i<nRelCount ; i++) 7155fdc4257SSteve Yin { 7165fdc4257SSteve Yin if( pRrelationSet->getRelation(i).RelationType == 6 ) 7175fdc4257SSteve Yin { 7185fdc4257SSteve Yin accRelation = pRrelationSet->getRelation(i); 7195fdc4257SSteve Yin paccRelation = &accRelation; 7205fdc4257SSteve Yin } 7215fdc4257SSteve Yin } 7225fdc4257SSteve Yin 7235fdc4257SSteve Yin if(paccRelation == NULL) 7245fdc4257SSteve Yin return S_FALSE; 7255fdc4257SSteve Yin 7265fdc4257SSteve Yin Sequence< Reference< XInterface > > xTargets = paccRelation->TargetSet; 7275fdc4257SSteve Yin Reference<XInterface> pRAcc = xTargets[0]; 7285fdc4257SSteve Yin 7295fdc4257SSteve Yin XAccessible* pXAcc = (XAccessible*)pRAcc.get(); 7305fdc4257SSteve Yin 7315fdc4257SSteve Yin Reference<XAccessibleContext> pRLebelContext = pXAcc->getAccessibleContext(); 7325fdc4257SSteve Yin if(!pRLebelContext.is()) 7335fdc4257SSteve Yin return S_FALSE; 7345fdc4257SSteve Yin 7355fdc4257SSteve Yin pRrelationSet = pRLebelContext->getAccessibleRelationSet(); 7365fdc4257SSteve Yin nRelCount = pRrelationSet->getRelationCount(); 7375fdc4257SSteve Yin 7385fdc4257SSteve Yin paccRelation = NULL; 7395fdc4257SSteve Yin for(int j=0; j<nRelCount ; j++) 7405fdc4257SSteve Yin { 7415fdc4257SSteve Yin if( pRrelationSet->getRelation(j).RelationType == 5 ) 7425fdc4257SSteve Yin { 7435fdc4257SSteve Yin accRelation = pRrelationSet->getRelation(j); 7445fdc4257SSteve Yin paccRelation = &accRelation; 7455fdc4257SSteve Yin } 7465fdc4257SSteve Yin } 7475fdc4257SSteve Yin 7485fdc4257SSteve Yin if(paccRelation) 7495fdc4257SSteve Yin { 7505fdc4257SSteve Yin xTargets = paccRelation->TargetSet; 7515fdc4257SSteve Yin pRAcc = xTargets[0]; 7525fdc4257SSteve Yin if(pUNOInterface != (XAccessible*)pRAcc.get()) 7535fdc4257SSteve Yin return S_FALSE; 7545fdc4257SSteve Yin } 7555fdc4257SSteve Yin 7565fdc4257SSteve Yin Reference<XAccessibleExtendedComponent> pRXIE(pRLebelContext,UNO_QUERY); 7575fdc4257SSteve Yin if(!pRXIE.is()) 7585fdc4257SSteve Yin return S_FALSE; 7595fdc4257SSteve Yin 7605fdc4257SSteve Yin ::rtl::OUString ouStr = pRXIE->getTitledBorderText(); 7615fdc4257SSteve Yin WCHAR key[2] = {NULL}; 7625fdc4257SSteve Yin GetMnemonicChar(ouStr, key); 7635fdc4257SSteve Yin if(key[0] != 0) 7645fdc4257SSteve Yin { 7655fdc4257SSteve Yin wcscat(wString, L"Alt+"); 7665fdc4257SSteve Yin wcscat(wString, key); 7675fdc4257SSteve Yin } 7685fdc4257SSteve Yin else 7695fdc4257SSteve Yin return S_FALSE; 7705fdc4257SSteve Yin } 7715fdc4257SSteve Yin 7725fdc4257SSteve Yin SAFE_SYSFREESTRING(*pszKeyboardShortcut); 7735fdc4257SSteve Yin *pszKeyboardShortcut = SysAllocString(wString); 7745fdc4257SSteve Yin 7755fdc4257SSteve Yin return S_OK; 7765fdc4257SSteve Yin } 7775fdc4257SSteve Yin else 7785fdc4257SSteve Yin { 7795fdc4257SSteve Yin return S_FALSE; 7805fdc4257SSteve Yin } 7815fdc4257SSteve Yin } 7825fdc4257SSteve Yin 7835fdc4257SSteve Yin long lVal = varChild.lVal; 7845fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 7855fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 7865fdc4257SSteve Yin if(!pChild) 7875fdc4257SSteve Yin return E_FAIL; 7885fdc4257SSteve Yin 7895fdc4257SSteve Yin return pChild->get_accKeyboardShortcut(varChild,pszKeyboardShortcut); 7905fdc4257SSteve Yin } 7915fdc4257SSteve Yin return S_FALSE; 7925fdc4257SSteve Yin 7935fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 7945fdc4257SSteve Yin } 7955fdc4257SSteve Yin 7965fdc4257SSteve Yin /** 7975fdc4257SSteve Yin * Returns the current focused child to AT. 7985fdc4257SSteve Yin * @param pvarChild, [in,out] vt member of pvarChild must be VT_I4,and lVal member stores the child ID, 7995fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 8005fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 8015fdc4257SSteve Yin */ 8025fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accFocus(VARIANT *pvarChild) 8035fdc4257SSteve Yin { 8045fdc4257SSteve Yin 8055fdc4257SSteve Yin CHECK_ENABLE_INF 8065fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 8075fdc4257SSteve Yin ISDESTROY() 8085fdc4257SSteve Yin // #CHECK# 8095fdc4257SSteve Yin if(pvarChild == NULL) 8105fdc4257SSteve Yin { 8115fdc4257SSteve Yin return E_INVALIDARG; 8125fdc4257SSteve Yin } 8135fdc4257SSteve Yin if( m_dFocusChildID==UACC_NO_FOCUS ) 8145fdc4257SSteve Yin { 8155fdc4257SSteve Yin pvarChild->vt = VT_EMPTY;//no focus on the object and its children 8165fdc4257SSteve Yin return S_OK; 8175fdc4257SSteve Yin } 8185fdc4257SSteve Yin //if the descendant of current object has focus indicated by m_dFocusChildID, return the IDispatch of this focused object 8195fdc4257SSteve Yin else 8205fdc4257SSteve Yin { 8215fdc4257SSteve Yin IMAccessible* pIMAcc = NULL; 8225fdc4257SSteve Yin g_pAgent->GetIAccessibleFromResID(m_dFocusChildID,&pIMAcc); 8235fdc4257SSteve Yin pIMAcc->AddRef(); 8245fdc4257SSteve Yin pvarChild->vt = VT_DISPATCH; 8255fdc4257SSteve Yin pvarChild->pdispVal = pIMAcc; 8265fdc4257SSteve Yin 8275fdc4257SSteve Yin } 8285fdc4257SSteve Yin return S_OK; 8295fdc4257SSteve Yin 8305fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 8315fdc4257SSteve Yin } 8325fdc4257SSteve Yin 8335fdc4257SSteve Yin /** 8345fdc4257SSteve Yin * Returns the selection of the current COM object to AT. 8355fdc4257SSteve Yin * @param pvarChildren,[in,out] 8365fdc4257SSteve Yin * if selection num is 0,return VT_EMPTY for vt, 8375fdc4257SSteve Yin * if selection num is 1,return VT_I4 for vt,and child index for lVal 8385fdc4257SSteve Yin * if selection num >1,return VT_UNKNOWN for vt, and IEnumVariant* for punkVal 8395fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 8405fdc4257SSteve Yin */ 8415fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_accSelection(VARIANT *pvarChildren) 8425fdc4257SSteve Yin { 8435fdc4257SSteve Yin 8445fdc4257SSteve Yin CHECK_ENABLE_INF 8455fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 8465fdc4257SSteve Yin ISDESTROY() 8475fdc4257SSteve Yin // #CHECK# 8485fdc4257SSteve Yin if(pvarChildren == NULL) 8495fdc4257SSteve Yin { 8505fdc4257SSteve Yin return E_INVALIDARG; 8515fdc4257SSteve Yin } 8525fdc4257SSteve Yin switch(m_pEnumVar->GetCountOfElements()) 8535fdc4257SSteve Yin { 8545fdc4257SSteve Yin case 0: 8555fdc4257SSteve Yin pvarChildren->vt = VT_EMPTY; 8565fdc4257SSteve Yin break; 8575fdc4257SSteve Yin case 1: 8585fdc4257SSteve Yin VARIANT varTmp[1]; 8595fdc4257SSteve Yin ULONG count; 8605fdc4257SSteve Yin VariantInit(&varTmp[0]); 8615fdc4257SSteve Yin m_pEnumVar->Next(1,varTmp,&count); 8625fdc4257SSteve Yin if(count!=1) 8635fdc4257SSteve Yin return S_FALSE; 8645fdc4257SSteve Yin pvarChildren->vt = VT_I4; 8655fdc4257SSteve Yin pvarChildren->lVal = varTmp[0].lVal; 8665fdc4257SSteve Yin VariantClear(&varTmp[0]); 8675fdc4257SSteve Yin m_pEnumVar->Reset(); 8685fdc4257SSteve Yin break; 8695fdc4257SSteve Yin default: 8705fdc4257SSteve Yin pvarChildren->vt = VT_UNKNOWN; 8715fdc4257SSteve Yin m_pEnumVar->AddRef(); 8725fdc4257SSteve Yin pvarChildren->punkVal = m_pEnumVar; 8735fdc4257SSteve Yin break; 8745fdc4257SSteve Yin } 8755fdc4257SSteve Yin return S_OK; 8765fdc4257SSteve Yin 8775fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 8785fdc4257SSteve Yin } 8795fdc4257SSteve Yin 8805fdc4257SSteve Yin /** 8815fdc4257SSteve Yin * Returns the location of the current COM object self or its one child to AT. 8825fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 8835fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 8845fdc4257SSteve Yin * @param pxLeft, [in,out] use to return the x-coordination of the proper object. 8855fdc4257SSteve Yin * @param pyTop, [in,out] use to return the y-coordination of the proper object. 8865fdc4257SSteve Yin * @param pcxWidth, [in,out] use to return the x-coordination width of the proper object. 8875fdc4257SSteve Yin * @param pcyHeight, [in,out] use to return the y-coordination height of the proper object. 8885fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 8895fdc4257SSteve Yin */ 8905fdc4257SSteve Yin STDMETHODIMP CMAccessible::accLocation(long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varChild) 8915fdc4257SSteve Yin { 8925fdc4257SSteve Yin 8935fdc4257SSteve Yin CHECK_ENABLE_INF 8945fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 8955fdc4257SSteve Yin ISDESTROY() 8965fdc4257SSteve Yin // #CHECK# 8975fdc4257SSteve Yin if(pxLeft == NULL || pyTop == NULL || pcxWidth == NULL || pcyHeight == NULL) 8985fdc4257SSteve Yin { 8995fdc4257SSteve Yin return E_INVALIDARG; 9005fdc4257SSteve Yin } 9015fdc4257SSteve Yin 9025fdc4257SSteve Yin if(varChild.vt==VT_I4) 9035fdc4257SSteve Yin { 9045fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 9055fdc4257SSteve Yin { 9065fdc4257SSteve Yin 9075fdc4257SSteve Yin if(pUNOInterface) 9085fdc4257SSteve Yin { 9095fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext(); 9105fdc4257SSteve Yin if( !pRContext.is() ) 9115fdc4257SSteve Yin return S_FALSE; 9125fdc4257SSteve Yin Reference< XAccessibleComponent > pRComponent(pRContext,UNO_QUERY); 9135fdc4257SSteve Yin if( !pRComponent.is() ) 9145fdc4257SSteve Yin return S_FALSE; 9155fdc4257SSteve Yin 9165fdc4257SSteve Yin ::com::sun::star::awt::Point pCPoint = pRComponent->getLocationOnScreen(); 9175fdc4257SSteve Yin ::com::sun::star::awt::Size pCSize = pRComponent->getSize(); 9185fdc4257SSteve Yin *pxLeft = pCPoint.X; 9195fdc4257SSteve Yin *pyTop = pCPoint.Y; 9205fdc4257SSteve Yin *pcxWidth = pCSize.Width; 9215fdc4257SSteve Yin *pcyHeight = pCSize.Height; 9225fdc4257SSteve Yin return S_OK; 9235fdc4257SSteve Yin } 9245fdc4257SSteve Yin else 9255fdc4257SSteve Yin { 9265fdc4257SSteve Yin *pxLeft = m_sLocation.m_dLeft; 9275fdc4257SSteve Yin *pyTop = m_sLocation.m_dTop; 9285fdc4257SSteve Yin *pcxWidth = m_sLocation.m_dWidth; 9295fdc4257SSteve Yin *pcyHeight = m_sLocation.m_dHeight; 9305fdc4257SSteve Yin return S_OK; 9315fdc4257SSteve Yin } 9325fdc4257SSteve Yin } 9335fdc4257SSteve Yin 9345fdc4257SSteve Yin } 9355fdc4257SSteve Yin return S_FALSE; 9365fdc4257SSteve Yin 9375fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 9385fdc4257SSteve Yin } 9395fdc4257SSteve Yin 9405fdc4257SSteve Yin /** 9415fdc4257SSteve Yin * Returns the current focused child to AT. 9425fdc4257SSteve Yin * @param navDir, the direction flag of the navigation. 9435fdc4257SSteve Yin * @param varStart, the start child id of this navigation action. 9445fdc4257SSteve Yin * @param pvarEndUpAt, [in,out] the end up child of this navigation action. 9455fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 9465fdc4257SSteve Yin */ 9475fdc4257SSteve Yin STDMETHODIMP CMAccessible::accNavigate(long navDir, VARIANT varStart, VARIANT *pvarEndUpAt) 9485fdc4257SSteve Yin { 9495fdc4257SSteve Yin 9505fdc4257SSteve Yin CHECK_ENABLE_INF 9515fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 9525fdc4257SSteve Yin ISDESTROY() 9535fdc4257SSteve Yin // #CHECK# 9545fdc4257SSteve Yin if(pvarEndUpAt == NULL) 9555fdc4257SSteve Yin { 9565fdc4257SSteve Yin return E_INVALIDARG; 9575fdc4257SSteve Yin } 9585fdc4257SSteve Yin HRESULT ret = E_FAIL; 9595fdc4257SSteve Yin switch (navDir) 9605fdc4257SSteve Yin { 9615fdc4257SSteve Yin case NAVDIR_FIRSTCHILD: 9625fdc4257SSteve Yin ret = GetFirstChild(varStart,pvarEndUpAt); 9635fdc4257SSteve Yin break; 9645fdc4257SSteve Yin case NAVDIR_LASTCHILD: 9655fdc4257SSteve Yin ret = GetLastChild(varStart,pvarEndUpAt); 9665fdc4257SSteve Yin break; 9675fdc4257SSteve Yin case NAVDIR_NEXT: 9685fdc4257SSteve Yin ret = GetNextSibling(varStart,pvarEndUpAt); 9695fdc4257SSteve Yin break; 9705fdc4257SSteve Yin case NAVDIR_PREVIOUS: 9715fdc4257SSteve Yin ret = GetPreSibling(varStart,pvarEndUpAt); 9725fdc4257SSteve Yin break; 9735fdc4257SSteve Yin case NAVDIR_DOWN://do not implement temporarily 9745fdc4257SSteve Yin break; 9755fdc4257SSteve Yin case NAVDIR_UP://do not implement temporarily 9765fdc4257SSteve Yin break; 9775fdc4257SSteve Yin case NAVDIR_LEFT://do not implement temporarily 9785fdc4257SSteve Yin break; 9795fdc4257SSteve Yin case NAVDIR_RIGHT://do not implement temporarily 9805fdc4257SSteve Yin break; 9815fdc4257SSteve Yin default: 9825fdc4257SSteve Yin break; 9835fdc4257SSteve Yin }; 9845fdc4257SSteve Yin return ret; 9855fdc4257SSteve Yin 9865fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 9875fdc4257SSteve Yin } 9885fdc4257SSteve Yin 9895fdc4257SSteve Yin STDMETHODIMP CMAccessible::accHitTest(long xLeft, long yTop, VARIANT *pvarChild) 9905fdc4257SSteve Yin { 9915fdc4257SSteve Yin 9925fdc4257SSteve Yin CHECK_ENABLE_INF 9935fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 9945fdc4257SSteve Yin ISDESTROY() 9955fdc4257SSteve Yin // #CHECK# 9965fdc4257SSteve Yin if(pvarChild == NULL) 9975fdc4257SSteve Yin { 9985fdc4257SSteve Yin return E_INVALIDARG; 9995fdc4257SSteve Yin } 10005fdc4257SSteve Yin long x, y, w, h; 10015fdc4257SSteve Yin VARIANT varSelf; 10025fdc4257SSteve Yin VariantInit(&varSelf); 10035fdc4257SSteve Yin varSelf.vt = VT_I4; 10045fdc4257SSteve Yin varSelf.lVal = CHILDID_SELF; 10055fdc4257SSteve Yin accLocation(&x,&y,&w,&h,varSelf); 10065fdc4257SSteve Yin if( (x < xLeft && (x + w) >xLeft) && (y < yTop && (y + h) >yTop) ) 10075fdc4257SSteve Yin { 10085fdc4257SSteve Yin int i, nCount; 10095fdc4257SSteve Yin pvarChild->vt = VT_EMPTY; 10105fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = GetContextByXAcc(pUNOInterface); 10115fdc4257SSteve Yin nCount = pRContext->getAccessibleChildCount(); 10125fdc4257SSteve Yin if(nCount > 256) 10135fdc4257SSteve Yin return E_FAIL; 10145fdc4257SSteve Yin IMAccessible* child = NULL; 10155fdc4257SSteve Yin for( i = 0; i<nCount; i++) 10165fdc4257SSteve Yin { 10175fdc4257SSteve Yin 10185fdc4257SSteve Yin child = GetChildInterface(i + 1); 10195fdc4257SSteve Yin if(child && child->accHitTest(xLeft,yTop,pvarChild) == S_OK) 10205fdc4257SSteve Yin break; 10215fdc4257SSteve Yin } 10225fdc4257SSteve Yin 10235fdc4257SSteve Yin if(pvarChild->vt == VT_DISPATCH) 10245fdc4257SSteve Yin return S_OK; 10255fdc4257SSteve Yin 10265fdc4257SSteve Yin if( i < nCount) 10275fdc4257SSteve Yin { 10285fdc4257SSteve Yin pvarChild->vt = VT_DISPATCH; 10295fdc4257SSteve Yin pvarChild->pdispVal = child; 10305fdc4257SSteve Yin child->AddRef(); 10315fdc4257SSteve Yin } 10325fdc4257SSteve Yin else 10335fdc4257SSteve Yin { 10345fdc4257SSteve Yin pvarChild->vt = VT_I4; 10355fdc4257SSteve Yin pvarChild->lVal = CHILDID_SELF; 10365fdc4257SSteve Yin } 10375fdc4257SSteve Yin return S_OK; 10385fdc4257SSteve Yin } 10395fdc4257SSteve Yin return S_FALSE; 10405fdc4257SSteve Yin 10415fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 10425fdc4257SSteve Yin } 10435fdc4257SSteve Yin 10445fdc4257SSteve Yin /** 10455fdc4257SSteve Yin * Get The other Interface from CMAccessible. 10465fdc4257SSteve Yin * @param guidService, must be IID_IAccessible here. 10475fdc4257SSteve Yin * @param riid, the IID interface . 10485fdc4257SSteve Yin * @return S_OK if successful and S_FALSE if failure. 10495fdc4257SSteve Yin */ 10505fdc4257SSteve Yin STDMETHODIMP CMAccessible::QueryService(REFGUID guidService, REFIID riid, void** ppvObject) 10515fdc4257SSteve Yin { 10525fdc4257SSteve Yin if( InlineIsEqualGUID(guidService, IID_IAccessible) ) 10535fdc4257SSteve Yin return QueryInterface(riid, ppvObject); 10545fdc4257SSteve Yin return S_FALSE; 10555fdc4257SSteve Yin } 10565fdc4257SSteve Yin 10575fdc4257SSteve Yin /** 10585fdc4257SSteve Yin * Set the accessible name of the current COM object self or its one child from UNO. 10595fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 10605fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 10615fdc4257SSteve Yin * @param szName, the name used to set the name of the proper object. 10625fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 10635fdc4257SSteve Yin */ 10645fdc4257SSteve Yin STDMETHODIMP CMAccessible::put_accName(VARIANT varChild, BSTR szName) 10655fdc4257SSteve Yin { 10665fdc4257SSteve Yin 10675fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 10685fdc4257SSteve Yin ISDESTROY() 10695fdc4257SSteve Yin if(varChild.vt==VT_I4) 10705fdc4257SSteve Yin { 10715fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 10725fdc4257SSteve Yin { 10735fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszName); 10745fdc4257SSteve Yin m_pszName=SysAllocString(szName); 10755fdc4257SSteve Yin return S_OK; 10765fdc4257SSteve Yin } 10775fdc4257SSteve Yin 10785fdc4257SSteve Yin long lVal = varChild.lVal; 10795fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 10805fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 10815fdc4257SSteve Yin if(!pChild) 10825fdc4257SSteve Yin return E_FAIL; 10835fdc4257SSteve Yin return pChild->put_accName(varChild,szName); 10845fdc4257SSteve Yin } 10855fdc4257SSteve Yin return E_FAIL; 10865fdc4257SSteve Yin 10875fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 10885fdc4257SSteve Yin } 10895fdc4257SSteve Yin 10905fdc4257SSteve Yin /** 10915fdc4257SSteve Yin * Set the accessible value of the current COM object self or its one child from UNO. 10925fdc4257SSteve Yin * @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID, 10935fdc4257SSteve Yin * the child ID specify child index from 0 to children count, 0 stands for object self. 10945fdc4257SSteve Yin * @param szValue, the value used to set the value of the proper object. 10955fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 10965fdc4257SSteve Yin */ 10975fdc4257SSteve Yin STDMETHODIMP CMAccessible::put_accValue(VARIANT varChild, BSTR szValue) 10985fdc4257SSteve Yin { 10995fdc4257SSteve Yin 11005fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 11015fdc4257SSteve Yin ISDESTROY() 11025fdc4257SSteve Yin if(varChild.vt==VT_I4) 11035fdc4257SSteve Yin { 11045fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 11055fdc4257SSteve Yin { 11065fdc4257SSteve Yin SysAllocString(m_pszValue); 11075fdc4257SSteve Yin m_pszValue=SysAllocString(szValue); 11085fdc4257SSteve Yin return S_OK; 11095fdc4257SSteve Yin } 11105fdc4257SSteve Yin 11115fdc4257SSteve Yin long lVal = varChild.lVal; 11125fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 11135fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 11145fdc4257SSteve Yin if(!pChild) 11155fdc4257SSteve Yin return E_FAIL; 11165fdc4257SSteve Yin return pChild->put_accValue(varChild,szValue); 11175fdc4257SSteve Yin } 11185fdc4257SSteve Yin return E_FAIL; 11195fdc4257SSteve Yin 11205fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 11215fdc4257SSteve Yin } 11225fdc4257SSteve Yin 11235fdc4257SSteve Yin /** 11245fdc4257SSteve Yin * Set the accessible name of the current COM object self from UNO. 11255fdc4257SSteve Yin * @param pszName, the name value used to set the name of the current object. 11265fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 11275fdc4257SSteve Yin */ 11285fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccName(const OLECHAR __RPC_FAR *pszName) 11295fdc4257SSteve Yin { 11305fdc4257SSteve Yin 11315fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 11325fdc4257SSteve Yin ISDESTROY() 11335fdc4257SSteve Yin // #CHECK# 11345fdc4257SSteve Yin if(pszName == NULL) 11355fdc4257SSteve Yin { 11365fdc4257SSteve Yin return E_INVALIDARG; 11375fdc4257SSteve Yin } 11385fdc4257SSteve Yin 11395fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszName);//?? 11405fdc4257SSteve Yin m_pszName = SysAllocString(pszName); 11415fdc4257SSteve Yin if(m_pszName==NULL) 11425fdc4257SSteve Yin return E_FAIL; 11435fdc4257SSteve Yin return S_OK; 11445fdc4257SSteve Yin 11455fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 11465fdc4257SSteve Yin } 11475fdc4257SSteve Yin 11485fdc4257SSteve Yin /** 11495fdc4257SSteve Yin * Set the accessible role of the current COM object self from UNO. 11505fdc4257SSteve Yin * @param pRole, the role value used to set the role of the current object. 11515fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 11525fdc4257SSteve Yin */ 11535fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccRole(unsigned short pRole) 11545fdc4257SSteve Yin { 11555fdc4257SSteve Yin m_iRole = pRole; 11565fdc4257SSteve Yin return S_OK; 11575fdc4257SSteve Yin } 11585fdc4257SSteve Yin 11595fdc4257SSteve Yin /** 11605fdc4257SSteve Yin * Add one state into the current state set for the current COM object from UNO. 11615fdc4257SSteve Yin * @param pXSate, the state used to set the name of the current object. 11625fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 11635fdc4257SSteve Yin */ 11645fdc4257SSteve Yin STDMETHODIMP CMAccessible::DecreaseState(DWORD pXSate) 11655fdc4257SSteve Yin { 11665fdc4257SSteve Yin m_dState &= (~pXSate); 11675fdc4257SSteve Yin return S_OK; 11685fdc4257SSteve Yin } 11695fdc4257SSteve Yin 11705fdc4257SSteve Yin /** 11715fdc4257SSteve Yin * Delete one state into the current state set for the current COM object from UNO. 11725fdc4257SSteve Yin * @param pXSate, the state used to set the name of the current object. 11735fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 11745fdc4257SSteve Yin */ 11755fdc4257SSteve Yin STDMETHODIMP CMAccessible::IncreaseState(DWORD pXSate) 11765fdc4257SSteve Yin { 11775fdc4257SSteve Yin m_dState |= pXSate; 11785fdc4257SSteve Yin return S_OK; 11795fdc4257SSteve Yin } 11805fdc4257SSteve Yin 11815fdc4257SSteve Yin /** 11825fdc4257SSteve Yin * Set state into the current state set for the current COM object from UNO. 11835fdc4257SSteve Yin * @param pXSate, the state used to set the name of the current object. 11845fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 11855fdc4257SSteve Yin */ 11865fdc4257SSteve Yin STDMETHODIMP CMAccessible::SetState(DWORD pXSate) 11875fdc4257SSteve Yin { 11885fdc4257SSteve Yin m_dState = pXSate; 11895fdc4257SSteve Yin return S_OK; 11905fdc4257SSteve Yin } 11915fdc4257SSteve Yin 11925fdc4257SSteve Yin 11935fdc4257SSteve Yin 11945fdc4257SSteve Yin /** 11955fdc4257SSteve Yin * Set the accessible description of the current COM object self from UNO. 11965fdc4257SSteve Yin * @param pszDescription, the name used to set the description of the current object. 11975fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 11985fdc4257SSteve Yin */ 11995fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccDescription(const OLECHAR __RPC_FAR *pszDescription) 12005fdc4257SSteve Yin { 12015fdc4257SSteve Yin 12025fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 12035fdc4257SSteve Yin ISDESTROY() 12045fdc4257SSteve Yin // #CHECK# 12055fdc4257SSteve Yin if(pszDescription == NULL) 12065fdc4257SSteve Yin { 12075fdc4257SSteve Yin return E_INVALIDARG; 12085fdc4257SSteve Yin } 12095fdc4257SSteve Yin 12105fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszDescription); 12115fdc4257SSteve Yin m_pszDescription = SysAllocString(pszDescription); 12125fdc4257SSteve Yin 12135fdc4257SSteve Yin if(m_pszDescription==NULL) 12145fdc4257SSteve Yin return E_FAIL; 12155fdc4257SSteve Yin return S_OK; 12165fdc4257SSteve Yin 12175fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 12185fdc4257SSteve Yin } 12195fdc4257SSteve Yin 12205fdc4257SSteve Yin /** 12215fdc4257SSteve Yin * Set the accessible value of the current COM object self from UNO. 12225fdc4257SSteve Yin * @param pszAccValue, the name used to set the value of the current object. 12235fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 12245fdc4257SSteve Yin */ 12255fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccValue(const OLECHAR __RPC_FAR *pszAccValue) 12265fdc4257SSteve Yin { 12275fdc4257SSteve Yin 12285fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 12295fdc4257SSteve Yin ISDESTROY() 12305fdc4257SSteve Yin // #CHECK# 12315fdc4257SSteve Yin if(pszAccValue == NULL) 12325fdc4257SSteve Yin { 12335fdc4257SSteve Yin return E_INVALIDARG; 12345fdc4257SSteve Yin } 12355fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszValue); 12365fdc4257SSteve Yin m_pszValue = SysAllocString(pszAccValue); 12375fdc4257SSteve Yin if(m_pszValue==NULL) 12385fdc4257SSteve Yin return E_FAIL; 12395fdc4257SSteve Yin return S_OK; 12405fdc4257SSteve Yin 12415fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 12425fdc4257SSteve Yin } 12435fdc4257SSteve Yin 12445fdc4257SSteve Yin /** 12455fdc4257SSteve Yin * Set the HWND value of the current COM object self from UNO. It should set the parent IAccessible 12465fdc4257SSteve Yin * Object through the method AccessibleObjectFromWindow(...). 12475fdc4257SSteve Yin * @param hwnd, the HWND used to set the value of the current object. 12485fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 12495fdc4257SSteve Yin */ 12505fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccWindowHandle(HWND hwnd) 12515fdc4257SSteve Yin { 12525fdc4257SSteve Yin 12535fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 12545fdc4257SSteve Yin ISDESTROY() 12555fdc4257SSteve Yin m_hwnd = hwnd; 12565fdc4257SSteve Yin return S_OK; 12575fdc4257SSteve Yin 12585fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 12595fdc4257SSteve Yin } 12605fdc4257SSteve Yin 12615fdc4257SSteve Yin /** 12625fdc4257SSteve Yin * Set accessible focus by specifying child ID 12635fdc4257SSteve Yin * @param dChildID, the child id identifies the focus child. 12645fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 12655fdc4257SSteve Yin */ 12665fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccFocus(long dChildID) 12675fdc4257SSteve Yin { 12685fdc4257SSteve Yin 12695fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 12705fdc4257SSteve Yin ISDESTROY() 12715fdc4257SSteve Yin 12725fdc4257SSteve Yin if(dChildID==CHILDID_SELF) 12735fdc4257SSteve Yin { 12745fdc4257SSteve Yin if(m_pIParent) 12755fdc4257SSteve Yin { 12765fdc4257SSteve Yin m_pIParent->Put_XAccFocus(m_dChildID); 12775fdc4257SSteve Yin } 12785fdc4257SSteve Yin } 12795fdc4257SSteve Yin else 12805fdc4257SSteve Yin { 12815fdc4257SSteve Yin m_dFocusChildID = dChildID; 12825fdc4257SSteve Yin //traverse all ancestors to set the focused child ID so that when the get_accFocus is called on 12835fdc4257SSteve Yin //any of the ancestors, this id can be used to get the IAccessible of focused object. 12845fdc4257SSteve Yin if(m_pIParent) 12855fdc4257SSteve Yin { 12865fdc4257SSteve Yin m_pIParent->Put_XAccFocus(dChildID); 12875fdc4257SSteve Yin } 12885fdc4257SSteve Yin } 12895fdc4257SSteve Yin return S_OK; 12905fdc4257SSteve Yin 12915fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 12925fdc4257SSteve Yin } 12935fdc4257SSteve Yin 12945fdc4257SSteve Yin /** 12955fdc4257SSteve Yin *Set accessible object location for the current COM object 12965fdc4257SSteve Yin * @param sLocation, the location of the current object. 12975fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 12985fdc4257SSteve Yin */ 12995fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccLocation(const Location sLocation) 13005fdc4257SSteve Yin { 13015fdc4257SSteve Yin 13025fdc4257SSteve Yin this->m_sLocation = sLocation; 13035fdc4257SSteve Yin return S_OK; 13045fdc4257SSteve Yin } 13055fdc4257SSteve Yin 13065fdc4257SSteve Yin /** 13075fdc4257SSteve Yin * Set accessible parent object for the current COM object if 13085fdc4257SSteve Yin * the current object is a child of some COM object 13095fdc4257SSteve Yin * @param pIParent, the parent of the current object. 13105fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 13115fdc4257SSteve Yin */ 13125fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccParent(IMAccessible __RPC_FAR *pIParent) 13135fdc4257SSteve Yin { 13145fdc4257SSteve Yin this->m_pIParent = pIParent; 13155fdc4257SSteve Yin 13165fdc4257SSteve Yin if(pIParent) 13175fdc4257SSteve Yin m_pIParent->AddRef(); 13185fdc4257SSteve Yin 13195fdc4257SSteve Yin return S_OK; 13205fdc4257SSteve Yin } 13215fdc4257SSteve Yin 13225fdc4257SSteve Yin /** 13235fdc4257SSteve Yin * Set unique child id to COM 13245fdc4257SSteve Yin * @param dChildID, the id of the current object. 13255fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 13265fdc4257SSteve Yin */ 13275fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccChildID(long dChildID) 13285fdc4257SSteve Yin { 13295fdc4257SSteve Yin 13305fdc4257SSteve Yin this->m_dChildID = dChildID; 13315fdc4257SSteve Yin return S_OK; 13325fdc4257SSteve Yin } 13335fdc4257SSteve Yin 13345fdc4257SSteve Yin /** 13355fdc4257SSteve Yin * Set AccObjectManagerAgent object pointer to COM 13365fdc4257SSteve Yin * @param pAgent, the AccObjectManagerAgent point. 13375fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 13385fdc4257SSteve Yin */ 13395fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_XAccAgent(long pAgent) 13405fdc4257SSteve Yin { 13415fdc4257SSteve Yin g_pAgent = (AccObjectManagerAgent*)pAgent; 13425fdc4257SSteve Yin return S_OK; 13435fdc4257SSteve Yin } 13445fdc4257SSteve Yin 13455fdc4257SSteve Yin /** 13465fdc4257SSteve Yin * When a UNO control disposing, it disposes its listeners, 13475fdc4257SSteve Yin * then notify AccObject in bridge management, then notify 13485fdc4257SSteve Yin * COM that the XAccessible is invalid,so set pUNOInterface as NULL 13495fdc4257SSteve Yin * @param isDestroy, true is it need to be destroyed. 13505fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 13515fdc4257SSteve Yin */ 13525fdc4257SSteve Yin STDMETHODIMP CMAccessible::NotifyDestroy(BOOL isDestroy) 13535fdc4257SSteve Yin { 13545fdc4257SSteve Yin 13555fdc4257SSteve Yin m_isDestroy = isDestroy; 13565fdc4257SSteve Yin pUNOInterface = NULL; 13575fdc4257SSteve Yin return S_OK; 13585fdc4257SSteve Yin } 13595fdc4257SSteve Yin 13605fdc4257SSteve Yin /** 13615fdc4257SSteve Yin *private methods that help implement public functions 13625fdc4257SSteve Yin */ 13635fdc4257SSteve Yin 13645fdc4257SSteve Yin /** 13655fdc4257SSteve Yin * Return child interface pointer by child ID,note: need to call AddRef() 13665fdc4257SSteve Yin * @param lChildID, specify child index,which AT(such as Inspect32) gives. 13675fdc4257SSteve Yin * @return IMAccessible*, pointer to the corresponding child object. 13685fdc4257SSteve Yin */ 13695fdc4257SSteve Yin IMAccessible* CMAccessible::GetChildInterface(long dChildID)//for test 13705fdc4257SSteve Yin { 13715fdc4257SSteve Yin 13725fdc4257SSteve Yin long dChildIndex = 0; 13735fdc4257SSteve Yin if(dChildID<0) 13745fdc4257SSteve Yin { 13755fdc4257SSteve Yin if(g_pAgent) 13765fdc4257SSteve Yin { 13775fdc4257SSteve Yin IMAccessible* pIMAcc = NULL; 13785fdc4257SSteve Yin g_pAgent->GetIAccessibleFromResID(dChildID,&pIMAcc); 13795fdc4257SSteve Yin return pIMAcc; 13805fdc4257SSteve Yin } 13815fdc4257SSteve Yin return NULL; 13825fdc4257SSteve Yin } 13835fdc4257SSteve Yin else 13845fdc4257SSteve Yin { 13855fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext(); 13865fdc4257SSteve Yin if( !pRContext.is() ) 13875fdc4257SSteve Yin return NULL; 13885fdc4257SSteve Yin 13895fdc4257SSteve Yin if(dChildID<1 || dChildID>pRContext->getAccessibleChildCount()) 13905fdc4257SSteve Yin return NULL; 13915fdc4257SSteve Yin 13925fdc4257SSteve Yin IAccessible* pChild = NULL; 13935fdc4257SSteve Yin Reference< XAccessible > pXChild = pRContext->getAccessibleChild(dChildID-1); 13945fdc4257SSteve Yin BOOL isGet = get_IAccessibleFromXAccessible((long)pXChild.get(),&pChild); 13955fdc4257SSteve Yin 13965fdc4257SSteve Yin if(!isGet) 13975fdc4257SSteve Yin { 13985fdc4257SSteve Yin g_pAgent->InsertAccObj(pXChild.get(),pUNOInterface,(long)m_hwnd); 13995fdc4257SSteve Yin isGet = get_IAccessibleFromXAccessible((long)pXChild.get(),&pChild); 14005fdc4257SSteve Yin } 14015fdc4257SSteve Yin 14025fdc4257SSteve Yin if(isGet) 14035fdc4257SSteve Yin { 14045fdc4257SSteve Yin IMAccessible* pIMAcc = (IMAccessible*)pChild; 14055fdc4257SSteve Yin return pIMAcc; 14065fdc4257SSteve Yin } 14075fdc4257SSteve Yin } 14085fdc4257SSteve Yin 14095fdc4257SSteve Yin return NULL; 14105fdc4257SSteve Yin } 14115fdc4257SSteve Yin 14125fdc4257SSteve Yin /** 14135fdc4257SSteve Yin * For List, tree and table,these roles belong to manage_decendant in UNO, 14145fdc4257SSteve Yin * need to process specifically when navigate 14155fdc4257SSteve Yin * @return BOOL, if it is decendantmanager, return true. 14165fdc4257SSteve Yin */ 14175fdc4257SSteve Yin BOOL CMAccessible::IsDecendantManage() 14185fdc4257SSteve Yin { 14195fdc4257SSteve Yin 14205fdc4257SSteve Yin return (m_iRole==ROLE_SYSTEM_LIST)||(m_iRole==ROLE_SYSTEM_OUTLINE)||(m_iRole==ROLE_SYSTEM_TABLE); 14215fdc4257SSteve Yin } 14225fdc4257SSteve Yin 14235fdc4257SSteve Yin /** 14245fdc4257SSteve Yin * for decendantmanager circumstance,provide child interface when navigate 14255fdc4257SSteve Yin * @param varCur, the current child. 14265fdc4257SSteve Yin * @param flags, the navigation direction. 14275fdc4257SSteve Yin * @return IMAccessible*, the child of the end up node. 14285fdc4257SSteve Yin */ 14295fdc4257SSteve Yin IMAccessible* CMAccessible::GetNavigateChildForDM(VARIANT varCur, short flags) 14305fdc4257SSteve Yin { 14315fdc4257SSteve Yin 14325fdc4257SSteve Yin XAccessibleContext* pXContext = GetContextByXAcc(pUNOInterface); 14335fdc4257SSteve Yin if(pXContext==NULL) 14345fdc4257SSteve Yin { 14355fdc4257SSteve Yin return NULL; 14365fdc4257SSteve Yin } 14375fdc4257SSteve Yin 14385fdc4257SSteve Yin int count = pXContext->getAccessibleChildCount(); 14395fdc4257SSteve Yin if(count<1) 14405fdc4257SSteve Yin { 14415fdc4257SSteve Yin return NULL; 14425fdc4257SSteve Yin } 14435fdc4257SSteve Yin 14445fdc4257SSteve Yin IMAccessible* pCurChild = NULL; 14455fdc4257SSteve Yin XAccessible* pChildXAcc = NULL; 14465fdc4257SSteve Yin Reference<XAccessible> pRChildXAcc; 14475fdc4257SSteve Yin XAccessibleContext* pChildContext = NULL; 14485fdc4257SSteve Yin int index = 0,delta=0; 14495fdc4257SSteve Yin switch(flags) 14505fdc4257SSteve Yin { 14515fdc4257SSteve Yin case DM_FIRSTCHILD: 14525fdc4257SSteve Yin pRChildXAcc = pXContext->getAccessibleChild(0); 14535fdc4257SSteve Yin break; 14545fdc4257SSteve Yin case DM_LASTCHILD: 14555fdc4257SSteve Yin pRChildXAcc = pXContext->getAccessibleChild(count-1); 14565fdc4257SSteve Yin break; 14575fdc4257SSteve Yin case DM_NEXTCHILD: 14585fdc4257SSteve Yin case DM_PREVCHILD: 14595fdc4257SSteve Yin pCurChild = GetChildInterface(varCur.lVal); 14605fdc4257SSteve Yin if(pCurChild==NULL) 14615fdc4257SSteve Yin { 14625fdc4257SSteve Yin return NULL; 14635fdc4257SSteve Yin } 14645fdc4257SSteve Yin pCurChild->GetUNOInterface((long*)&pChildXAcc); 14655fdc4257SSteve Yin if(pChildXAcc==NULL) 14665fdc4257SSteve Yin { 14675fdc4257SSteve Yin return NULL; 14685fdc4257SSteve Yin } 14695fdc4257SSteve Yin pChildContext = GetContextByXAcc(pChildXAcc); 14705fdc4257SSteve Yin if(pChildContext == NULL) 14715fdc4257SSteve Yin { 14725fdc4257SSteve Yin return NULL; 14735fdc4257SSteve Yin } 14745fdc4257SSteve Yin delta = (flags==DM_NEXTCHILD)?1:-1; 14755fdc4257SSteve Yin //currently, getAccessibleIndexInParent is error in UNO for 14765fdc4257SSteve Yin //some kind of List,such as ValueSet, the index will be less 1 than 14775fdc4257SSteve Yin //what should be, need to fix UNO code 14785fdc4257SSteve Yin index = pChildContext->getAccessibleIndexInParent()+delta; 14795fdc4257SSteve Yin if((index>=0)&&(index<=count-1)) 14805fdc4257SSteve Yin { 14815fdc4257SSteve Yin pRChildXAcc = pXContext->getAccessibleChild(index); 14825fdc4257SSteve Yin } 14835fdc4257SSteve Yin break; 14845fdc4257SSteve Yin default: 14855fdc4257SSteve Yin break; 14865fdc4257SSteve Yin } 14875fdc4257SSteve Yin 14885fdc4257SSteve Yin if(!pRChildXAcc.is()) 14895fdc4257SSteve Yin { 14905fdc4257SSteve Yin return NULL; 14915fdc4257SSteve Yin } 14925fdc4257SSteve Yin pChildXAcc = pRChildXAcc.get(); 14935fdc4257SSteve Yin g_pAgent->InsertAccObj(pChildXAcc,pUNOInterface); 14945fdc4257SSteve Yin return g_pAgent->GetIMAccByXAcc(pChildXAcc); 14955fdc4257SSteve Yin } 14965fdc4257SSteve Yin 14975fdc4257SSteve Yin /** 14985fdc4257SSteve Yin *the following 4 private methods are for accNavigate implementation 14995fdc4257SSteve Yin */ 15005fdc4257SSteve Yin 15015fdc4257SSteve Yin /** 15025fdc4257SSteve Yin * Return first child for parent container, process differently according 15035fdc4257SSteve Yin * to whether it is decendant manage 15045fdc4257SSteve Yin * @param varStart, the start child id of this navigation action. 15055fdc4257SSteve Yin * @param pvarEndUpAt, [in,out] the end up child of this navigation action. 15065fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 15075fdc4257SSteve Yin */ 15085fdc4257SSteve Yin HRESULT CMAccessible::GetFirstChild(VARIANT varStart,VARIANT* pvarEndUpAt) 15095fdc4257SSteve Yin { 15105fdc4257SSteve Yin 15115fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 15125fdc4257SSteve Yin ISDESTROY() 15135fdc4257SSteve Yin // #CHECK# 15145fdc4257SSteve Yin if(pvarEndUpAt == NULL) 15155fdc4257SSteve Yin { 15165fdc4257SSteve Yin return E_INVALIDARG; 15175fdc4257SSteve Yin } 15185fdc4257SSteve Yin if(varStart.vt != VT_I4) 15195fdc4257SSteve Yin { 15205fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 15215fdc4257SSteve Yin return E_INVALIDARG; 15225fdc4257SSteve Yin } 15235fdc4257SSteve Yin 15245fdc4257SSteve Yin pvarEndUpAt->pdispVal = GetNavigateChildForDM(varStart, DM_FIRSTCHILD); 15255fdc4257SSteve Yin if(pvarEndUpAt->pdispVal) 15265fdc4257SSteve Yin { 15275fdc4257SSteve Yin pvarEndUpAt->pdispVal->AddRef(); 15285fdc4257SSteve Yin pvarEndUpAt->vt = VT_DISPATCH; 15295fdc4257SSteve Yin return S_OK; 15305fdc4257SSteve Yin } 15315fdc4257SSteve Yin 15325fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 15335fdc4257SSteve Yin return E_FAIL; 15345fdc4257SSteve Yin 15355fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 15365fdc4257SSteve Yin } 15375fdc4257SSteve Yin 15385fdc4257SSteve Yin /** 15395fdc4257SSteve Yin * Return last child for parent container, process differently according 15405fdc4257SSteve Yin * to whether it is decendant manage 15415fdc4257SSteve Yin * @param varStart, the start child id of this navigation action. 15425fdc4257SSteve Yin * @param pvarEndUpAt, [in,out] the end up child of this navigation action. 15435fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 15445fdc4257SSteve Yin */ 15455fdc4257SSteve Yin HRESULT CMAccessible::GetLastChild(VARIANT varStart,VARIANT* pvarEndUpAt) 15465fdc4257SSteve Yin { 15475fdc4257SSteve Yin 15485fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 15495fdc4257SSteve Yin ISDESTROY() 15505fdc4257SSteve Yin // #CHECK# 15515fdc4257SSteve Yin if(pvarEndUpAt == NULL) 15525fdc4257SSteve Yin { 15535fdc4257SSteve Yin return E_INVALIDARG; 15545fdc4257SSteve Yin } 15555fdc4257SSteve Yin if(varStart.vt != VT_I4) 15565fdc4257SSteve Yin { 15575fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 15585fdc4257SSteve Yin return E_INVALIDARG; 15595fdc4257SSteve Yin } 15605fdc4257SSteve Yin 15615fdc4257SSteve Yin pvarEndUpAt->pdispVal = GetNavigateChildForDM(varStart, DM_LASTCHILD); 15625fdc4257SSteve Yin if(pvarEndUpAt->pdispVal) 15635fdc4257SSteve Yin { 15645fdc4257SSteve Yin pvarEndUpAt->pdispVal->AddRef(); 15655fdc4257SSteve Yin pvarEndUpAt->vt = VT_DISPATCH; 15665fdc4257SSteve Yin return S_OK; 15675fdc4257SSteve Yin } 15685fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 15695fdc4257SSteve Yin return E_FAIL; 15705fdc4257SSteve Yin 15715fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 15725fdc4257SSteve Yin } 15735fdc4257SSteve Yin 15745fdc4257SSteve Yin /** 15755fdc4257SSteve Yin * The method GetNextSibling is general, whatever it is decendant manage or not 15765fdc4257SSteve Yin * Get the next sibling object. 15775fdc4257SSteve Yin * @param varStart, the start child id of this navigation action. 15785fdc4257SSteve Yin * @param pvarEndUpAt, [in,out] the end up child of this navigation action. 15795fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 15805fdc4257SSteve Yin */ 15815fdc4257SSteve Yin HRESULT CMAccessible::GetNextSibling(VARIANT varStart,VARIANT* pvarEndUpAt) 15825fdc4257SSteve Yin { 15835fdc4257SSteve Yin 15845fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 15855fdc4257SSteve Yin ISDESTROY() 15865fdc4257SSteve Yin if(varStart.vt != VT_I4) 15875fdc4257SSteve Yin { 15885fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 15895fdc4257SSteve Yin return E_INVALIDARG; 15905fdc4257SSteve Yin } 15915fdc4257SSteve Yin 15925fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = GetContextByXAcc(pUNOInterface); 15935fdc4257SSteve Yin if(pRContext.is()) 15945fdc4257SSteve Yin { 15955fdc4257SSteve Yin varStart.iVal = sal_Int16(pRContext->getAccessibleIndexInParent() + 2); 15965fdc4257SSteve Yin if(m_pIParent) 15975fdc4257SSteve Yin if( m_pIParent->get_accChild(varStart,&pvarEndUpAt->pdispVal) == S_OK) 15985fdc4257SSteve Yin { 15995fdc4257SSteve Yin pvarEndUpAt->vt = VT_DISPATCH; 16005fdc4257SSteve Yin return S_OK; 16015fdc4257SSteve Yin } 16025fdc4257SSteve Yin } 16035fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 16045fdc4257SSteve Yin return E_FAIL; 16055fdc4257SSteve Yin 16065fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 16075fdc4257SSteve Yin } 16085fdc4257SSteve Yin 16095fdc4257SSteve Yin /** 16105fdc4257SSteve Yin *the method GetPreSibling is general, whatever it is decendant manage or not 16115fdc4257SSteve Yin * @param varStart, the start child id of this navigation action. 16125fdc4257SSteve Yin * @param pvarEndUpAt, [in,out] the end up child of this navigation action. 16135fdc4257SSteve Yin * @return S_OK if successful and E_FAIL if failure. 16145fdc4257SSteve Yin */ 16155fdc4257SSteve Yin HRESULT CMAccessible::GetPreSibling(VARIANT varStart,VARIANT* pvarEndUpAt) 16165fdc4257SSteve Yin { 16175fdc4257SSteve Yin 16185fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 16195fdc4257SSteve Yin ISDESTROY() 16205fdc4257SSteve Yin // #CHECK# 16215fdc4257SSteve Yin if(pvarEndUpAt == NULL) 16225fdc4257SSteve Yin { 16235fdc4257SSteve Yin return E_INVALIDARG; 16245fdc4257SSteve Yin } 16255fdc4257SSteve Yin if(varStart.vt != VT_I4) 16265fdc4257SSteve Yin { 16275fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 16285fdc4257SSteve Yin return E_INVALIDARG; 16295fdc4257SSteve Yin } 16305fdc4257SSteve Yin 16315fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = GetContextByXAcc(pUNOInterface); 16325fdc4257SSteve Yin if(pRContext.is()) 16335fdc4257SSteve Yin { 16345fdc4257SSteve Yin varStart.iVal = sal_Int16(pRContext->getAccessibleIndexInParent()); 16355fdc4257SSteve Yin if(m_pIParent && varStart.iVal > 0) 16365fdc4257SSteve Yin if( m_pIParent->get_accChild(varStart,&pvarEndUpAt->pdispVal) == S_OK) 16375fdc4257SSteve Yin { 16385fdc4257SSteve Yin pvarEndUpAt->vt = VT_DISPATCH; 16395fdc4257SSteve Yin return S_OK; 16405fdc4257SSteve Yin } 16415fdc4257SSteve Yin } 16425fdc4257SSteve Yin pvarEndUpAt->vt = VT_EMPTY; 16435fdc4257SSteve Yin return E_FAIL; 16445fdc4257SSteve Yin 16455fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 16465fdc4257SSteve Yin } 16475fdc4257SSteve Yin 16485fdc4257SSteve Yin /** 16495fdc4257SSteve Yin * For IAccessible2 implementation methods 16505fdc4257SSteve Yin */ 16515fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_nRelations( long __RPC_FAR *nRelations) 16525fdc4257SSteve Yin { 16535fdc4257SSteve Yin 16545fdc4257SSteve Yin CHECK_ENABLE_INF 16555fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 16565fdc4257SSteve Yin 16575fdc4257SSteve Yin // #CHECK# 16585fdc4257SSteve Yin if(nRelations == NULL) 16595fdc4257SSteve Yin { 16605fdc4257SSteve Yin return E_INVALIDARG; 16615fdc4257SSteve Yin } 16625fdc4257SSteve Yin 16635fdc4257SSteve Yin *nRelations = 0; 16645fdc4257SSteve Yin 16655fdc4257SSteve Yin if( !pRContext.is() ) 16665fdc4257SSteve Yin return E_FAIL; 16675fdc4257SSteve Yin Reference<XAccessibleRelationSet> pRrelationSet = pRContext.get()->getAccessibleRelationSet(); 16685fdc4257SSteve Yin if(!pRrelationSet.is()) 16695fdc4257SSteve Yin { 16705fdc4257SSteve Yin *nRelations = 0; 16715fdc4257SSteve Yin return S_OK; 16725fdc4257SSteve Yin } 16735fdc4257SSteve Yin 16745fdc4257SSteve Yin *nRelations = pRrelationSet->getRelationCount(); 16755fdc4257SSteve Yin return S_OK; 16765fdc4257SSteve Yin 16775fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 16785fdc4257SSteve Yin } 16795fdc4257SSteve Yin 16805fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_relation( long relationIndex, IAccessibleRelation __RPC_FAR *__RPC_FAR *relation) 16815fdc4257SSteve Yin { 16825fdc4257SSteve Yin 16835fdc4257SSteve Yin CHECK_ENABLE_INF 16845fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 16855fdc4257SSteve Yin ISDESTROY() 16865fdc4257SSteve Yin // #CHECK# 16875fdc4257SSteve Yin if(relation == NULL) 16885fdc4257SSteve Yin { 16895fdc4257SSteve Yin return E_INVALIDARG; 16905fdc4257SSteve Yin } 16915fdc4257SSteve Yin 16925fdc4257SSteve Yin if( !pRContext.is() ) 16935fdc4257SSteve Yin return E_FAIL; 16945fdc4257SSteve Yin 16955fdc4257SSteve Yin 16965fdc4257SSteve Yin long nMax = 0; 16975fdc4257SSteve Yin long nReal = 0; 16985fdc4257SSteve Yin get_nRelations(&nMax); 16995fdc4257SSteve Yin 17005fdc4257SSteve Yin *relation = (IAccessibleRelation*)::CoTaskMemAlloc(sizeof(IAccessibleRelation)); 17015fdc4257SSteve Yin 17025fdc4257SSteve Yin // #CHECK Memory Allocation# 17035fdc4257SSteve Yin if(*relation == NULL) 17045fdc4257SSteve Yin { 17055fdc4257SSteve Yin return E_FAIL; 17065fdc4257SSteve Yin } 17075fdc4257SSteve Yin 17085fdc4257SSteve Yin if( relationIndex < nMax ) 17095fdc4257SSteve Yin { 17105fdc4257SSteve Yin 17115fdc4257SSteve Yin 17125fdc4257SSteve Yin Reference<XAccessibleRelationSet> pRrelationSet = pRContext.get()->getAccessibleRelationSet(); 17135fdc4257SSteve Yin if(!pRrelationSet.is()) 17145fdc4257SSteve Yin { 17155fdc4257SSteve Yin 17165fdc4257SSteve Yin return E_FAIL; 17175fdc4257SSteve Yin } 17185fdc4257SSteve Yin 17195fdc4257SSteve Yin IAccessibleRelation* pRelation = NULL; 1720*3a700b0aSSteve Yin HRESULT hr = CoCreateInstance( CLSID_AccRelation, NULL, CLSCTX_SERVER , 17215fdc4257SSteve Yin IID_IAccessibleRelation, 17225fdc4257SSteve Yin (void **)&pRelation); 17235fdc4257SSteve Yin if(SUCCEEDED(hr)) 17245fdc4257SSteve Yin { 17255fdc4257SSteve Yin IUNOXWrapper* wrapper = NULL; 17265fdc4257SSteve Yin hr = pRelation->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper); 17275fdc4257SSteve Yin if(SUCCEEDED(hr)) 17285fdc4257SSteve Yin { 17295fdc4257SSteve Yin AccessibleRelation accRelation = pRrelationSet->getRelation(relationIndex); 17305fdc4257SSteve Yin wrapper->put_XSubInterface((long)&accRelation); 17315fdc4257SSteve Yin wrapper->Release(); 17325fdc4257SSteve Yin *relation = pRelation; 17335fdc4257SSteve Yin return S_OK; 17345fdc4257SSteve Yin } 17355fdc4257SSteve Yin 17365fdc4257SSteve Yin } 17375fdc4257SSteve Yin } 17385fdc4257SSteve Yin 17395fdc4257SSteve Yin return E_FAIL; 17405fdc4257SSteve Yin 17415fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 17425fdc4257SSteve Yin } 17435fdc4257SSteve Yin 17445fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_relations( long, IAccessibleRelation __RPC_FAR *__RPC_FAR *relation, long __RPC_FAR *nRelations) 17455fdc4257SSteve Yin { 17465fdc4257SSteve Yin 17475fdc4257SSteve Yin CHECK_ENABLE_INF 17485fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 17495fdc4257SSteve Yin 17505fdc4257SSteve Yin // #CHECK# 17515fdc4257SSteve Yin if(relation == NULL || nRelations == NULL) 17525fdc4257SSteve Yin { 17535fdc4257SSteve Yin return E_INVALIDARG; 17545fdc4257SSteve Yin } 17555fdc4257SSteve Yin // #CHECK XInterface# 17565fdc4257SSteve Yin 17575fdc4257SSteve Yin if( !pRContext.is() ) 17585fdc4257SSteve Yin return E_FAIL; 17595fdc4257SSteve Yin 17605fdc4257SSteve Yin Reference<XAccessibleRelationSet> pRrelationSet = pRContext.get()->getAccessibleRelationSet(); 17615fdc4257SSteve Yin if(!pRrelationSet.is()) 17625fdc4257SSteve Yin { 17635fdc4257SSteve Yin *nRelations = 0; 17645fdc4257SSteve Yin return S_OK; 17655fdc4257SSteve Yin } 17665fdc4257SSteve Yin 17675fdc4257SSteve Yin long nCount = pRrelationSet->getRelationCount(); 17685fdc4257SSteve Yin 17695fdc4257SSteve Yin *relation = (IAccessibleRelation*)::CoTaskMemAlloc(nCount*sizeof(IAccessibleRelation)); 17705fdc4257SSteve Yin 17715fdc4257SSteve Yin // #CHECK Memory Allocation# 17725fdc4257SSteve Yin if(*relation == NULL) 17735fdc4257SSteve Yin { 17745fdc4257SSteve Yin return E_FAIL; 17755fdc4257SSteve Yin } 17765fdc4257SSteve Yin 17775fdc4257SSteve Yin for(int i=0; i<nCount ; i++) 17785fdc4257SSteve Yin { 17795fdc4257SSteve Yin IAccessibleRelation* pRelation = NULL; 1780*3a700b0aSSteve Yin HRESULT hr = CoCreateInstance( CLSID_AccRelation, NULL, CLSCTX_SERVER , 17815fdc4257SSteve Yin IID_IAccessibleRelation, 17825fdc4257SSteve Yin (void **)&pRelation); 17835fdc4257SSteve Yin if(SUCCEEDED(hr)) 17845fdc4257SSteve Yin { 17855fdc4257SSteve Yin IUNOXWrapper* wrapper = NULL; 17865fdc4257SSteve Yin hr = pRelation->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper); 17875fdc4257SSteve Yin if(SUCCEEDED(hr)) 17885fdc4257SSteve Yin { 17895fdc4257SSteve Yin AccessibleRelation accRelation = pRrelationSet->getRelation(i); 17905fdc4257SSteve Yin wrapper->put_XSubInterface((long)&accRelation); 17915fdc4257SSteve Yin wrapper->Release(); 17925fdc4257SSteve Yin } 17935fdc4257SSteve Yin (relation)[i] = pRelation; 17945fdc4257SSteve Yin } 17955fdc4257SSteve Yin } 17965fdc4257SSteve Yin 17975fdc4257SSteve Yin *nRelations = nCount; 17985fdc4257SSteve Yin return S_OK; 17995fdc4257SSteve Yin 18005fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 18015fdc4257SSteve Yin } 18025fdc4257SSteve Yin 18035fdc4257SSteve Yin STDMETHODIMP CMAccessible::role(long __RPC_FAR *role) 18045fdc4257SSteve Yin { 18055fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 18065fdc4257SSteve Yin 18075fdc4257SSteve Yin (*role) = m_iRole; 18085fdc4257SSteve Yin 18095fdc4257SSteve Yin return S_OK; 18105fdc4257SSteve Yin 18115fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 18125fdc4257SSteve Yin } 18135fdc4257SSteve Yin 18145fdc4257SSteve Yin 18155fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_nActions(long __RPC_FAR *nActions) 18165fdc4257SSteve Yin { 18175fdc4257SSteve Yin 18185fdc4257SSteve Yin try 18195fdc4257SSteve Yin { 18205fdc4257SSteve Yin ISDESTROY() 18215fdc4257SSteve Yin // #CHECK# 18225fdc4257SSteve Yin if(nActions == NULL) 18235fdc4257SSteve Yin { 18245fdc4257SSteve Yin return E_INVALIDARG; 18255fdc4257SSteve Yin } 18265fdc4257SSteve Yin *nActions = 0L; 18275fdc4257SSteve Yin IAccessibleAction* pAcc = NULL; 18285fdc4257SSteve Yin HRESULT hr = QueryInterface(IID_IAccessibleAction, (void**)&pAcc); 18295fdc4257SSteve Yin if( hr == S_OK ) 18305fdc4257SSteve Yin { 18315fdc4257SSteve Yin pAcc->nActions(nActions); 18325fdc4257SSteve Yin pAcc->Release(); 18335fdc4257SSteve Yin } 18345fdc4257SSteve Yin 18355fdc4257SSteve Yin return S_OK; 18365fdc4257SSteve Yin } 18375fdc4257SSteve Yin catch(...) 18385fdc4257SSteve Yin { 18395fdc4257SSteve Yin *nActions = 0L; 18405fdc4257SSteve Yin return S_OK; 18415fdc4257SSteve Yin } 18425fdc4257SSteve Yin } 18435fdc4257SSteve Yin 18445fdc4257SSteve Yin 18455fdc4257SSteve Yin STDMETHODIMP CMAccessible:: scrollToPoint(enum IA2CoordinateType, long, long) 18465fdc4257SSteve Yin { 18475fdc4257SSteve Yin 18485fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 18495fdc4257SSteve Yin ISDESTROY() 18505fdc4257SSteve Yin return E_NOTIMPL; 18515fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 18525fdc4257SSteve Yin 18535fdc4257SSteve Yin } 18545fdc4257SSteve Yin STDMETHODIMP CMAccessible:: scrollTo(enum IA2ScrollType) 18555fdc4257SSteve Yin { 18565fdc4257SSteve Yin 18575fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 18585fdc4257SSteve Yin ISDESTROY() 18595fdc4257SSteve Yin 18605fdc4257SSteve Yin return E_NOTIMPL; 18615fdc4257SSteve Yin 18625fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 18635fdc4257SSteve Yin } 18645fdc4257SSteve Yin 18655fdc4257SSteve Yin static XAccessible* getTheParentOfMember(XAccessible* pXAcc) 18665fdc4257SSteve Yin { 18675fdc4257SSteve Yin // #CHECK# 18685fdc4257SSteve Yin if(pXAcc == NULL) 18695fdc4257SSteve Yin { 18705fdc4257SSteve Yin return NULL; 18715fdc4257SSteve Yin } 18725fdc4257SSteve Yin Reference<XAccessibleContext> pRContext = pXAcc->getAccessibleContext(); 18735fdc4257SSteve Yin Reference<XAccessibleRelationSet> pRrelationSet = pRContext->getAccessibleRelationSet(); 18745fdc4257SSteve Yin long nRelations = pRrelationSet->getRelationCount(); 18755fdc4257SSteve Yin for(int i=0 ; i<nRelations ; i++) 18765fdc4257SSteve Yin { 18775fdc4257SSteve Yin AccessibleRelation accRelation = pRrelationSet->getRelation(i); 18785fdc4257SSteve Yin if(accRelation.RelationType == 7) 18795fdc4257SSteve Yin { 18805fdc4257SSteve Yin Sequence< Reference< XInterface > > xTargets = accRelation.TargetSet; 18815fdc4257SSteve Yin return (XAccessible*)xTargets[0].get(); 18825fdc4257SSteve Yin } 18835fdc4257SSteve Yin } 18845fdc4257SSteve Yin return NULL; 18855fdc4257SSteve Yin } 18865fdc4257SSteve Yin 18875fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_groupPosition(long __RPC_FAR *groupLevel,long __RPC_FAR *similarItemsInGroup,long __RPC_FAR *positionInGroup) 18885fdc4257SSteve Yin { 18895fdc4257SSteve Yin 18905fdc4257SSteve Yin CHECK_ENABLE_INF 18915fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 18925fdc4257SSteve Yin ISDESTROY() 18935fdc4257SSteve Yin // #CHECK# 18945fdc4257SSteve Yin if(groupLevel == NULL || similarItemsInGroup == NULL || positionInGroup == NULL) 18955fdc4257SSteve Yin { 18965fdc4257SSteve Yin return E_INVALIDARG; 18975fdc4257SSteve Yin } 18985fdc4257SSteve Yin 18995fdc4257SSteve Yin Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext(); 19005fdc4257SSteve Yin if(!pRContext.is()) 19015fdc4257SSteve Yin return E_FAIL; 19025fdc4257SSteve Yin long Role = pRContext->getAccessibleRole(); 19035fdc4257SSteve Yin 19045fdc4257SSteve Yin *groupLevel = 0; 19055fdc4257SSteve Yin *similarItemsInGroup = 0; 19065fdc4257SSteve Yin *positionInGroup = 0; 19075fdc4257SSteve Yin 19085fdc4257SSteve Yin if (Role != AccessibleRole::DOCUMENT) 19095fdc4257SSteve Yin { 19105fdc4257SSteve Yin Reference< XAccessibleGroupPosition > xGroupPosition( pRContext, UNO_QUERY ); 19115fdc4257SSteve Yin if ( xGroupPosition.is() ) 19125fdc4257SSteve Yin { 19135fdc4257SSteve Yin Sequence< sal_Int32 > rSeq = xGroupPosition->getGroupPosition( makeAny( pRContext ) ); 19145fdc4257SSteve Yin sal_Int32* pSeq = rSeq.getArray(); 19155fdc4257SSteve Yin if ( pSeq ) 19165fdc4257SSteve Yin { 19175fdc4257SSteve Yin *groupLevel = pSeq[0]; 19185fdc4257SSteve Yin *similarItemsInGroup = pSeq[1]; 19195fdc4257SSteve Yin *positionInGroup = pSeq[2]; 19205fdc4257SSteve Yin return S_OK; 19215fdc4257SSteve Yin } 19225fdc4257SSteve Yin return S_OK; 19235fdc4257SSteve Yin } 19245fdc4257SSteve Yin } 19255fdc4257SSteve Yin 19265fdc4257SSteve Yin Reference< XAccessible> pParentAcc = pRContext->getAccessibleParent(); 19275fdc4257SSteve Yin if( !pParentAcc.is() ) 19285fdc4257SSteve Yin { 19295fdc4257SSteve Yin return S_OK; 19305fdc4257SSteve Yin } 19315fdc4257SSteve Yin 19325fdc4257SSteve Yin Reference<XAccessibleContext> pRParentContext = pParentAcc->getAccessibleContext(); 19335fdc4257SSteve Yin 19345fdc4257SSteve Yin int level = 0; 19355fdc4257SSteve Yin int index = 0; 19365fdc4257SSteve Yin int number = 0; 19375fdc4257SSteve Yin 19385fdc4257SSteve Yin if( Role == RADIO_BUTTON ) 19395fdc4257SSteve Yin { 19405fdc4257SSteve Yin Reference<XAccessibleRelationSet> pRrelationSet = pRContext->getAccessibleRelationSet(); 19415fdc4257SSteve Yin long nRel = pRrelationSet->getRelationCount(); 19425fdc4257SSteve Yin for(int i=0 ; i<nRel ; i++) 19435fdc4257SSteve Yin { 19445fdc4257SSteve Yin AccessibleRelation accRelation = pRrelationSet->getRelation(i); 19455fdc4257SSteve Yin if(accRelation.RelationType == 7) 19465fdc4257SSteve Yin { 19475fdc4257SSteve Yin Sequence< Reference< XInterface > > xTargets = accRelation.TargetSet; 19485fdc4257SSteve Yin int nCount = xTargets.getLength(); 19495fdc4257SSteve Yin 19505fdc4257SSteve Yin Reference<XInterface> pRAcc = xTargets[0]; 19515fdc4257SSteve Yin for(int j=0; j<pRParentContext->getAccessibleChildCount(); j++) 19525fdc4257SSteve Yin { 19535fdc4257SSteve Yin if( getTheParentOfMember(pRParentContext->getAccessibleChild(j).get()) 19545fdc4257SSteve Yin == (XAccessible*)pRAcc.get() && 19555fdc4257SSteve Yin pRParentContext->getAccessibleChild(j)->getAccessibleContext()->getAccessibleRole() == RADIO_BUTTON) 19565fdc4257SSteve Yin number++; 19575fdc4257SSteve Yin if(pRParentContext->getAccessibleChild(j).get() == pUNOInterface) 19585fdc4257SSteve Yin index = number; 19595fdc4257SSteve Yin } 19605fdc4257SSteve Yin } 19615fdc4257SSteve Yin } 19625fdc4257SSteve Yin *groupLevel = 1; 19635fdc4257SSteve Yin *similarItemsInGroup = number; 19645fdc4257SSteve Yin *positionInGroup = index; 19655fdc4257SSteve Yin return S_OK; 19665fdc4257SSteve Yin } 19675fdc4257SSteve Yin 19685fdc4257SSteve Yin else if ( COMBO_BOX == Role ) 19695fdc4257SSteve Yin { 19705fdc4257SSteve Yin *groupLevel = 1; 19715fdc4257SSteve Yin *similarItemsInGroup = 0; 19725fdc4257SSteve Yin *positionInGroup = -1; 19735fdc4257SSteve Yin 19745fdc4257SSteve Yin long nCount = pRContext->getAccessibleChildCount(); 19755fdc4257SSteve Yin if( 2 != nCount) 19765fdc4257SSteve Yin { 19775fdc4257SSteve Yin return S_OK; 19785fdc4257SSteve Yin } 19795fdc4257SSteve Yin Reference<XAccessible> xList=pRContext->getAccessibleChild(1); 19805fdc4257SSteve Yin if (!xList.is()) 19815fdc4257SSteve Yin { 19825fdc4257SSteve Yin return S_OK; 19835fdc4257SSteve Yin } 19845fdc4257SSteve Yin Reference<XAccessibleContext> xListContext(xList,UNO_QUERY); 19855fdc4257SSteve Yin if (!xListContext.is()) 19865fdc4257SSteve Yin { 19875fdc4257SSteve Yin return S_OK; 19885fdc4257SSteve Yin } 19895fdc4257SSteve Yin Reference<XAccessibleSelection> xListSel(xList,UNO_QUERY); 19905fdc4257SSteve Yin if (!xListSel.is()) 19915fdc4257SSteve Yin { 19925fdc4257SSteve Yin return S_OK; 19935fdc4257SSteve Yin } 19945fdc4257SSteve Yin *similarItemsInGroup = xListContext->getAccessibleChildCount(); 19955fdc4257SSteve Yin if (*similarItemsInGroup > 0 ) 19965fdc4257SSteve Yin { 19975fdc4257SSteve Yin try 19985fdc4257SSteve Yin { 19995fdc4257SSteve Yin Reference<XAccessible> xChild = xListSel->getSelectedAccessibleChild(0); 20005fdc4257SSteve Yin if (xChild.is()) 20015fdc4257SSteve Yin { 20025fdc4257SSteve Yin Reference<XAccessibleContext> xChildContext(xChild,UNO_QUERY); 20035fdc4257SSteve Yin if (xChildContext.is()) 20045fdc4257SSteve Yin { 20055fdc4257SSteve Yin *positionInGroup=xChildContext->getAccessibleIndexInParent() + 1 ; 20065fdc4257SSteve Yin return S_OK; 20075fdc4257SSteve Yin } 20085fdc4257SSteve Yin } 20095fdc4257SSteve Yin } 20105fdc4257SSteve Yin catch(...) 20115fdc4257SSteve Yin {} 20125fdc4257SSteve Yin } 20135fdc4257SSteve Yin return S_OK; 20145fdc4257SSteve Yin } 20155fdc4257SSteve Yin else if ( PAGE_TAB == Role ) 20165fdc4257SSteve Yin { 20175fdc4257SSteve Yin *groupLevel = 1; 20185fdc4257SSteve Yin *similarItemsInGroup = pRParentContext->getAccessibleChildCount(); 20195fdc4257SSteve Yin 20205fdc4257SSteve Yin if (*similarItemsInGroup > 0 ) 20215fdc4257SSteve Yin { 20225fdc4257SSteve Yin *positionInGroup=pRContext->getAccessibleIndexInParent() + 1 ; 20235fdc4257SSteve Yin } 20245fdc4257SSteve Yin else 20255fdc4257SSteve Yin { 20265fdc4257SSteve Yin *positionInGroup = -1; 20275fdc4257SSteve Yin } 20285fdc4257SSteve Yin return S_OK; 20295fdc4257SSteve Yin } 20305fdc4257SSteve Yin 20315fdc4257SSteve Yin 20325fdc4257SSteve Yin BOOL isFound = FALSE; 20335fdc4257SSteve Yin while( pParentAcc.is() && !isFound) 20345fdc4257SSteve Yin { 20355fdc4257SSteve Yin level++; 20365fdc4257SSteve Yin pRParentContext = pParentAcc->getAccessibleContext(); 20375fdc4257SSteve Yin Role = pRParentContext->getAccessibleRole(); 20385fdc4257SSteve Yin if( (Role == TREE) || (Role == LIST) ) 20395fdc4257SSteve Yin isFound = TRUE; 20405fdc4257SSteve Yin pParentAcc = pRParentContext->getAccessibleParent(); 20415fdc4257SSteve Yin } 20425fdc4257SSteve Yin 20435fdc4257SSteve Yin if( isFound ) 20445fdc4257SSteve Yin { 20455fdc4257SSteve Yin Reference< XAccessible> pTempAcc = pRContext->getAccessibleParent(); 20465fdc4257SSteve Yin pRParentContext = pTempAcc->getAccessibleContext(); 20475fdc4257SSteve Yin *groupLevel = level; 20485fdc4257SSteve Yin *similarItemsInGroup = pRParentContext->getAccessibleChildCount(); 20495fdc4257SSteve Yin *positionInGroup = pRContext->getAccessibleIndexInParent() + 1; 20505fdc4257SSteve Yin } 20515fdc4257SSteve Yin else 20525fdc4257SSteve Yin { 20535fdc4257SSteve Yin *groupLevel = 0; 20545fdc4257SSteve Yin *similarItemsInGroup = 0; 20555fdc4257SSteve Yin *positionInGroup = 0; 20565fdc4257SSteve Yin } 20575fdc4257SSteve Yin return S_OK; 20585fdc4257SSteve Yin 20595fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 20605fdc4257SSteve Yin } 20615fdc4257SSteve Yin 20625fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_extendedStates( long, BSTR __RPC_FAR *__RPC_FAR *, long __RPC_FAR *) 20635fdc4257SSteve Yin { 20645fdc4257SSteve Yin 20655fdc4257SSteve Yin CHECK_ENABLE_INF 20665fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 20675fdc4257SSteve Yin ISDESTROY() 20685fdc4257SSteve Yin 20695fdc4257SSteve Yin return E_NOTIMPL; 20705fdc4257SSteve Yin 20715fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 20725fdc4257SSteve Yin } 20735fdc4257SSteve Yin 20745fdc4257SSteve Yin 20755fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_uniqueID(long __RPC_FAR *uniqueID) 20765fdc4257SSteve Yin { 20775fdc4257SSteve Yin 20785fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 20795fdc4257SSteve Yin ISDESTROY() 20805fdc4257SSteve Yin // #CHECK# 20815fdc4257SSteve Yin if(uniqueID == NULL) 20825fdc4257SSteve Yin { 20835fdc4257SSteve Yin return E_INVALIDARG; 20845fdc4257SSteve Yin } 20855fdc4257SSteve Yin *uniqueID = m_dChildID; 20865fdc4257SSteve Yin return S_OK; 20875fdc4257SSteve Yin 20885fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 20895fdc4257SSteve Yin } 20905fdc4257SSteve Yin 20915fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_windowHandle(HWND __RPC_FAR *windowHandle) 20925fdc4257SSteve Yin { 20935fdc4257SSteve Yin 20945fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 20955fdc4257SSteve Yin ISDESTROY() 20965fdc4257SSteve Yin // #CHECK# 20975fdc4257SSteve Yin if(windowHandle == NULL) 20985fdc4257SSteve Yin { 20995fdc4257SSteve Yin return E_INVALIDARG; 21005fdc4257SSteve Yin } 21015fdc4257SSteve Yin 21025fdc4257SSteve Yin HWND nHwnd = m_hwnd; 21035fdc4257SSteve Yin IAccessible* pParent = m_pIParent; 21045fdc4257SSteve Yin CMAccessible* pChild = this; 21055fdc4257SSteve Yin while((nHwnd==0) && pParent) 21065fdc4257SSteve Yin { 21075fdc4257SSteve Yin pChild = (CMAccessible*)pParent; 21085fdc4257SSteve Yin if(pChild) 21095fdc4257SSteve Yin { 21105fdc4257SSteve Yin pParent = (IAccessible*)pChild->m_pIParent; 21115fdc4257SSteve Yin nHwnd = (HWND)pChild->m_hwnd; 21125fdc4257SSteve Yin } 21135fdc4257SSteve Yin else 21145fdc4257SSteve Yin pParent = NULL; 21155fdc4257SSteve Yin } 21165fdc4257SSteve Yin 21175fdc4257SSteve Yin *windowHandle = nHwnd; 21185fdc4257SSteve Yin return S_OK; 21195fdc4257SSteve Yin 21205fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 21215fdc4257SSteve Yin } 21225fdc4257SSteve Yin 21235fdc4257SSteve Yin /** 21245fdc4257SSteve Yin * Get XAccessibleContext directly from UNO by the stored XAccessible pointer 21255fdc4257SSteve Yin * @param pXAcc, UNO XAccessible object point. 21265fdc4257SSteve Yin * @return XAccessibleContext*, the context of the pXAcc. 21275fdc4257SSteve Yin */ 21285fdc4257SSteve Yin XAccessibleContext* CMAccessible::GetContextByXAcc( XAccessible* pXAcc ) 21295fdc4257SSteve Yin { 21305fdc4257SSteve Yin Reference< XAccessibleContext > pRContext; 21315fdc4257SSteve Yin if( pXAcc == NULL) 21325fdc4257SSteve Yin return NULL; 21335fdc4257SSteve Yin 21345fdc4257SSteve Yin pRContext = pXAcc->getAccessibleContext(); 21355fdc4257SSteve Yin if( !pRContext.is() ) 21365fdc4257SSteve Yin return NULL; 21375fdc4257SSteve Yin return pRContext.get(); 21385fdc4257SSteve Yin } 21395fdc4257SSteve Yin 21405fdc4257SSteve Yin /** 21415fdc4257SSteve Yin * Return the member variable m_pXAccessibleSelection, instead of 21425fdc4257SSteve Yin * get XAccessibleSelection according to XAccessibleContext because if so,it will 21435fdc4257SSteve Yin * depend on the UNO implementation code,so when COM is created, put XAccessibleSelection 21445fdc4257SSteve Yin * by bridge management system 21455fdc4257SSteve Yin * @return XAccessibleSelection*, the selection of the current object. 21465fdc4257SSteve Yin */ 21475fdc4257SSteve Yin Reference< XAccessibleSelection > CMAccessible::GetSelection() 21485fdc4257SSteve Yin { 21495fdc4257SSteve Yin if( pUNOInterface == NULL ) 21505fdc4257SSteve Yin return NULL; 21515fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext(); 21525fdc4257SSteve Yin if(pRContext.is()) 21535fdc4257SSteve Yin { 21545fdc4257SSteve Yin Reference< XAccessibleSelection > pRSelection(pRContext,UNO_QUERY); 21555fdc4257SSteve Yin return pRSelection; 21565fdc4257SSteve Yin } 21575fdc4257SSteve Yin return NULL; 21585fdc4257SSteve Yin } 21595fdc4257SSteve Yin 21605fdc4257SSteve Yin /** 21615fdc4257SSteve Yin * Select one XAccessible item, for accSelect implementation 21625fdc4257SSteve Yin * @param pItem, the item should be selected. 21635fdc4257SSteve Yin * @return S_OK if successful. 21645fdc4257SSteve Yin */ 21655fdc4257SSteve Yin HRESULT CMAccessible::SelectChild(XAccessible* pItem) 21665fdc4257SSteve Yin { 21675fdc4257SSteve Yin 21685fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 21695fdc4257SSteve Yin ISDESTROY() 21705fdc4257SSteve Yin XAccessibleContext* pParentContext = GetContextByXAcc( pUNOInterface ); 21715fdc4257SSteve Yin XAccessibleContext* pContext = GetContextByXAcc( pItem ); 21725fdc4257SSteve Yin if( pParentContext == NULL || pContext == NULL ) 21735fdc4257SSteve Yin return E_FAIL; 21745fdc4257SSteve Yin 21755fdc4257SSteve Yin Reference< XAccessibleSelection > pRSelection = GetSelection(); 21765fdc4257SSteve Yin if( !pRSelection.is() ) 21775fdc4257SSteve Yin return E_FAIL; 21785fdc4257SSteve Yin long Index = pContext->getAccessibleIndexInParent(); 21795fdc4257SSteve Yin pRSelection->selectAccessibleChild( Index ); 21805fdc4257SSteve Yin return S_OK; 21815fdc4257SSteve Yin 21825fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 21835fdc4257SSteve Yin } 21845fdc4257SSteve Yin 21855fdc4257SSteve Yin /** 21865fdc4257SSteve Yin * Deselect one XAccessible item, for accSelect implimentation 21875fdc4257SSteve Yin * @param pItem, the item should be deselected. 21885fdc4257SSteve Yin * @return S_OK if successful. 21895fdc4257SSteve Yin */ 21905fdc4257SSteve Yin HRESULT CMAccessible::DeSelectChild(XAccessible* pItem) 21915fdc4257SSteve Yin { 21925fdc4257SSteve Yin 21935fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 21945fdc4257SSteve Yin ISDESTROY() 21955fdc4257SSteve Yin XAccessibleContext* pParentContext = GetContextByXAcc( pUNOInterface ); 21965fdc4257SSteve Yin ; 21975fdc4257SSteve Yin XAccessibleContext* pContext = GetContextByXAcc( pItem ); 21985fdc4257SSteve Yin if( pParentContext == NULL || pContext == NULL ) 21995fdc4257SSteve Yin return E_INVALIDARG; 22005fdc4257SSteve Yin 22015fdc4257SSteve Yin Reference< XAccessibleSelection > pRSelection = GetSelection(); 22025fdc4257SSteve Yin if( !pRSelection.is() ) 22035fdc4257SSteve Yin return E_FAIL; 22045fdc4257SSteve Yin long Index = pContext->getAccessibleIndexInParent(); 22055fdc4257SSteve Yin pRSelection->deselectAccessibleChild( Index ); 22065fdc4257SSteve Yin 22075fdc4257SSteve Yin return S_OK; 22085fdc4257SSteve Yin 22095fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 22105fdc4257SSteve Yin } 22115fdc4257SSteve Yin 22125fdc4257SSteve Yin /** 22135fdc4257SSteve Yin * Select multiple XAccessible items,for implementation of accSelect 22145fdc4257SSteve Yin * @param pItem, the items should be selected. 22155fdc4257SSteve Yin * @param size, the size of the items. 22165fdc4257SSteve Yin * @return S_OK if successful. 22175fdc4257SSteve Yin */ 22185fdc4257SSteve Yin HRESULT CMAccessible::SelectMutipleChidren( XAccessible** pItem,int size ) 22195fdc4257SSteve Yin { 22205fdc4257SSteve Yin 22215fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 22225fdc4257SSteve Yin ISDESTROY() 22235fdc4257SSteve Yin // #CHECK# 22245fdc4257SSteve Yin if(pItem == NULL) 22255fdc4257SSteve Yin { 22265fdc4257SSteve Yin return E_INVALIDARG; 22275fdc4257SSteve Yin } 22285fdc4257SSteve Yin for(int index = 0;index < size;index++) 22295fdc4257SSteve Yin { 22305fdc4257SSteve Yin SelectChild( pItem[index] ); 22315fdc4257SSteve Yin } 22325fdc4257SSteve Yin return S_OK; 22335fdc4257SSteve Yin 22345fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 22355fdc4257SSteve Yin } 22365fdc4257SSteve Yin 22375fdc4257SSteve Yin /** 22385fdc4257SSteve Yin * Deselect multiple XAccessible items,for implementation of accSelect 22395fdc4257SSteve Yin * @param pItem, the items should be selected. 22405fdc4257SSteve Yin * @param size, the size of the items. 22415fdc4257SSteve Yin * @return S_OK if successful. 22425fdc4257SSteve Yin */ 22435fdc4257SSteve Yin HRESULT CMAccessible::DeSelectMutipleChildren( XAccessible** pItem,int size ) 22445fdc4257SSteve Yin { 22455fdc4257SSteve Yin 22465fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 22475fdc4257SSteve Yin ISDESTROY() 22485fdc4257SSteve Yin // #CHECK# 22495fdc4257SSteve Yin if(pItem == NULL) 22505fdc4257SSteve Yin { 22515fdc4257SSteve Yin return E_INVALIDARG; 22525fdc4257SSteve Yin } 22535fdc4257SSteve Yin for(int index = 0;index < size;index++) 22545fdc4257SSteve Yin { 22555fdc4257SSteve Yin DeSelectChild( pItem[index] ); 22565fdc4257SSteve Yin } 22575fdc4257SSteve Yin return S_OK; 22585fdc4257SSteve Yin 22595fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 22605fdc4257SSteve Yin } 22615fdc4257SSteve Yin 22625fdc4257SSteve Yin /** 22635fdc4257SSteve Yin * When COM is created, UNO set XAccessible pointer to it 22645fdc4257SSteve Yin * in order to COM can operate UNO information 22655fdc4257SSteve Yin * @param pXAcc, the XAccessible object of current object. 22665fdc4257SSteve Yin * @return S_OK if successful. 22675fdc4257SSteve Yin */ 22685fdc4257SSteve Yin STDMETHODIMP CMAccessible::SetXAccessible(long pXAcc) 22695fdc4257SSteve Yin { 22705fdc4257SSteve Yin pUNOInterface = (XAccessible*)pXAcc; 22715fdc4257SSteve Yin pRef = pUNOInterface; 22725fdc4257SSteve Yin m_pEnumVar->PutSelection(/*XAccessibleSelection*/(long)pUNOInterface); 22735fdc4257SSteve Yin 22745fdc4257SSteve Yin pRContext = pUNOInterface->getAccessibleContext(); 22755fdc4257SSteve Yin pRContextInterface = (XAccessibleContext*)pRContext.is(); 22765fdc4257SSteve Yin 22775fdc4257SSteve Yin return S_OK; 22785fdc4257SSteve Yin } 22795fdc4257SSteve Yin 22805fdc4257SSteve Yin /** 22815fdc4257SSteve Yin * accSelect method has many optional flags, needs to process comprehensively 22825fdc4257SSteve Yin * Mozilla and Microsoft do not implement SELFLAG_EXTENDSELECTION flag. 22835fdc4257SSteve Yin * The implementation of this flag is a little trouble-shooting,so we also 22845fdc4257SSteve Yin * do not implement it now 22855fdc4257SSteve Yin * @param flagsSelect, the selection flag of the select action. 22865fdc4257SSteve Yin * @param varChild, the child object pointer of current action. 22875fdc4257SSteve Yin * @return S_OK if successful. 22885fdc4257SSteve Yin */ 22895fdc4257SSteve Yin STDMETHODIMP CMAccessible::accSelect(long flagsSelect, VARIANT varChild) 22905fdc4257SSteve Yin { 22915fdc4257SSteve Yin 22925fdc4257SSteve Yin CHECK_ENABLE_INF 22935fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 22945fdc4257SSteve Yin ISDESTROY() 22955fdc4257SSteve Yin if( (flagsSelect&SELFLAG_ADDSELECTION) && 22965fdc4257SSteve Yin (SELFLAG_REMOVESELECTION&flagsSelect) ) 22975fdc4257SSteve Yin return E_INVALIDARG; 22985fdc4257SSteve Yin 22995fdc4257SSteve Yin if ( (flagsSelect&SELFLAG_TAKESELECTION) && 23005fdc4257SSteve Yin ( 23015fdc4257SSteve Yin (flagsSelect&SELFLAG_ADDSELECTION) || 23025fdc4257SSteve Yin (flagsSelect&SELFLAG_REMOVESELECTION) || 23035fdc4257SSteve Yin (flagsSelect&SELFLAG_EXTENDSELECTION ) 23045fdc4257SSteve Yin ) 23055fdc4257SSteve Yin ) 23065fdc4257SSteve Yin return E_INVALIDARG; 23075fdc4257SSteve Yin 23085fdc4257SSteve Yin if ( varChild.vt != VT_I4 ) 23095fdc4257SSteve Yin return E_INVALIDARG; 23105fdc4257SSteve Yin 23115fdc4257SSteve Yin IMAccessible* pSelectAcc; 23125fdc4257SSteve Yin if( varChild.lVal == CHILDID_SELF ) 23135fdc4257SSteve Yin { 23145fdc4257SSteve Yin pSelectAcc = this; 23155fdc4257SSteve Yin pSelectAcc->AddRef(); 23165fdc4257SSteve Yin } 23175fdc4257SSteve Yin else 23185fdc4257SSteve Yin { 23195fdc4257SSteve Yin pSelectAcc = GetChildInterface(varChild.lVal); 23205fdc4257SSteve Yin } 23215fdc4257SSteve Yin 23225fdc4257SSteve Yin if( pSelectAcc == NULL ) 23235fdc4257SSteve Yin return E_INVALIDARG; 23245fdc4257SSteve Yin 23255fdc4257SSteve Yin if( flagsSelect&SELFLAG_TAKEFOCUS ) 23265fdc4257SSteve Yin { 23275fdc4257SSteve Yin long pTempUNO = 0; 23285fdc4257SSteve Yin pSelectAcc->GetUNOInterface( &pTempUNO); 23295fdc4257SSteve Yin 23305fdc4257SSteve Yin if( pTempUNO == NULL ) 23315fdc4257SSteve Yin return NULL; 23325fdc4257SSteve Yin 23335fdc4257SSteve Yin Reference< XAccessibleContext > pRContext = ( (XAccessible*)pTempUNO)->getAccessibleContext(); 23345fdc4257SSteve Yin Reference< XAccessibleComponent > pRComponent(pRContext,UNO_QUERY); 23355fdc4257SSteve Yin Reference< XAccessible > pRParentXAcc = pRContext->getAccessibleParent(); 23365fdc4257SSteve Yin Reference< XAccessibleContext > pRParentContext = pRParentXAcc->getAccessibleContext(); 23375fdc4257SSteve Yin Reference< XAccessibleComponent > pRParentComponent(pRParentContext,UNO_QUERY); 23385fdc4257SSteve Yin Reference< XAccessibleSelection > pRParentSelection(pRParentContext,UNO_QUERY); 23395fdc4257SSteve Yin 23405fdc4257SSteve Yin 23415fdc4257SSteve Yin pRComponent->grabFocus(); 23425fdc4257SSteve Yin 23435fdc4257SSteve Yin if( flagsSelect & SELFLAG_TAKESELECTION ) 23445fdc4257SSteve Yin { 23455fdc4257SSteve Yin pRParentSelection->clearAccessibleSelection(); 23465fdc4257SSteve Yin pRParentSelection->selectAccessibleChild( pRContext->getAccessibleIndexInParent() ); 23475fdc4257SSteve Yin } 23485fdc4257SSteve Yin 23495fdc4257SSteve Yin if( flagsSelect & SELFLAG_ADDSELECTION ) 23505fdc4257SSteve Yin { 23515fdc4257SSteve Yin pRParentSelection->selectAccessibleChild( pRContext->getAccessibleIndexInParent() ); 23525fdc4257SSteve Yin } 23535fdc4257SSteve Yin 23545fdc4257SSteve Yin if( flagsSelect & SELFLAG_REMOVESELECTION ) 23555fdc4257SSteve Yin { 23565fdc4257SSteve Yin pRParentSelection->deselectAccessibleChild( pRContext->getAccessibleIndexInParent() ); 23575fdc4257SSteve Yin } 23585fdc4257SSteve Yin 23595fdc4257SSteve Yin if( flagsSelect & SELFLAG_EXTENDSELECTION ) 23605fdc4257SSteve Yin { 23615fdc4257SSteve Yin long indexInParrent = pRContext->getAccessibleIndexInParent(); 23625fdc4257SSteve Yin 23635fdc4257SSteve Yin if( pRParentSelection->isAccessibleChildSelected( indexInParrent + 1 ) || 23645fdc4257SSteve Yin pRParentSelection->isAccessibleChildSelected( indexInParrent - 1 ) ) 23655fdc4257SSteve Yin { 23665fdc4257SSteve Yin pRParentSelection->selectAccessibleChild( indexInParrent ); 23675fdc4257SSteve Yin } 23685fdc4257SSteve Yin } 23695fdc4257SSteve Yin 23705fdc4257SSteve Yin } 23715fdc4257SSteve Yin 23725fdc4257SSteve Yin pSelectAcc->Release(); 23735fdc4257SSteve Yin return S_OK; 23745fdc4257SSteve Yin 23755fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 23765fdc4257SSteve Yin } 23775fdc4257SSteve Yin 23785fdc4257SSteve Yin /** 23795fdc4257SSteve Yin * Return XAccessible interface pointer when needed 23805fdc4257SSteve Yin * @param pXAcc, [in, out] the Uno interface of the current object. 23815fdc4257SSteve Yin * @return S_OK if successful. 23825fdc4257SSteve Yin */ 23835fdc4257SSteve Yin STDMETHODIMP CMAccessible::GetUNOInterface(long* pXAcc) 23845fdc4257SSteve Yin { 23855fdc4257SSteve Yin // #CHECK# 23865fdc4257SSteve Yin if(pXAcc == NULL) 23875fdc4257SSteve Yin return E_INVALIDARG; 23885fdc4257SSteve Yin 23895fdc4257SSteve Yin *pXAcc = (long)pUNOInterface; 23905fdc4257SSteve Yin return S_OK; 23915fdc4257SSteve Yin } 23925fdc4257SSteve Yin 23935fdc4257SSteve Yin /** 23945fdc4257SSteve Yin * Helper method for Implementation of get_accDefaultAction 23955fdc4257SSteve Yin * @param pAction, the default action point of the current object. 23965fdc4257SSteve Yin * @return S_OK if successful. 23975fdc4257SSteve Yin */ 23985fdc4257SSteve Yin STDMETHODIMP CMAccessible::SetDefaultAction(long pAction) 23995fdc4257SSteve Yin { 24005fdc4257SSteve Yin m_pXAction = (XAccessibleAction*)pAction; 24015fdc4257SSteve Yin return S_OK; 24025fdc4257SSteve Yin } 24035fdc4257SSteve Yin 24045fdc4257SSteve Yin /** 24055fdc4257SSteve Yin * This method is called when AT open some UI elements initially 24065fdc4257SSteve Yin * the UI element takes the default action defined here 24075fdc4257SSteve Yin * @param varChild, the child id of the defaultaction. 24085fdc4257SSteve Yin * @param pszDefaultAction,[in/out] the description of the current action. 24095fdc4257SSteve Yin * @return S_OK if successful. 24105fdc4257SSteve Yin */ 24115fdc4257SSteve Yin HRESULT STDMETHODCALLTYPE CMAccessible::get_accDefaultAction(VARIANT varChild, BSTR *pszDefaultAction) 24125fdc4257SSteve Yin { 24135fdc4257SSteve Yin 24145fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 24155fdc4257SSteve Yin ISDESTROY() 24165fdc4257SSteve Yin // #CHECK# 24175fdc4257SSteve Yin if(pszDefaultAction == NULL) 24185fdc4257SSteve Yin { 24195fdc4257SSteve Yin return E_INVALIDARG; 24205fdc4257SSteve Yin } 24215fdc4257SSteve Yin if(varChild.vt==VT_I4) 24225fdc4257SSteve Yin { 24235fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 24245fdc4257SSteve Yin { 24255fdc4257SSteve Yin if( m_pXAction == NULL ) 24265fdc4257SSteve Yin return DISP_E_MEMBERNOTFOUND; 24275fdc4257SSteve Yin SAFE_SYSFREESTRING(*pszDefaultAction); 24285fdc4257SSteve Yin *pszDefaultAction = SysAllocString(m_pszActionDescription); 24295fdc4257SSteve Yin return S_OK; 24305fdc4257SSteve Yin } 24315fdc4257SSteve Yin 24325fdc4257SSteve Yin long lVal = varChild.lVal; 24335fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 24345fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 24355fdc4257SSteve Yin if(!pChild) 24365fdc4257SSteve Yin return E_FAIL; 24375fdc4257SSteve Yin return pChild->get_accDefaultAction(varChild,pszDefaultAction); 24385fdc4257SSteve Yin } 24395fdc4257SSteve Yin return S_FALSE; 24405fdc4257SSteve Yin 24415fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 24425fdc4257SSteve Yin } 24435fdc4257SSteve Yin 24445fdc4257SSteve Yin /** 24455fdc4257SSteve Yin * AT call this method to operate application 24465fdc4257SSteve Yin * @param varChild, the child id of the action object. 24475fdc4257SSteve Yin * @return S_OK if successful. 24485fdc4257SSteve Yin */ 24495fdc4257SSteve Yin HRESULT STDMETHODCALLTYPE CMAccessible::accDoDefaultAction(VARIANT varChild) 24505fdc4257SSteve Yin { 24515fdc4257SSteve Yin 24525fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 24535fdc4257SSteve Yin ISDESTROY() 24545fdc4257SSteve Yin if( varChild.vt != VT_I4 ) 24555fdc4257SSteve Yin return E_INVALIDARG; 24565fdc4257SSteve Yin if( m_pXAction == NULL ) 24575fdc4257SSteve Yin return E_FAIL; 24585fdc4257SSteve Yin if( m_pXAction->getAccessibleActionCount() == 0 ) 24595fdc4257SSteve Yin return E_FAIL; 24605fdc4257SSteve Yin 24615fdc4257SSteve Yin if(varChild.lVal==CHILDID_SELF) 24625fdc4257SSteve Yin { 24635fdc4257SSteve Yin if(m_pXAction->getAccessibleActionCount() > 0) 24645fdc4257SSteve Yin m_pXAction->doAccessibleAction(0); 24655fdc4257SSteve Yin return S_OK; 24665fdc4257SSteve Yin } 24675fdc4257SSteve Yin 24685fdc4257SSteve Yin long lVal = varChild.lVal; 24695fdc4257SSteve Yin varChild.lVal = CHILDID_SELF; 24705fdc4257SSteve Yin IMAccessible *pChild = this->GetChildInterface(lVal); 24715fdc4257SSteve Yin if(!pChild) 24725fdc4257SSteve Yin return E_FAIL; 24735fdc4257SSteve Yin return pChild->accDoDefaultAction( varChild ); 24745fdc4257SSteve Yin 24755fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 24765fdc4257SSteve Yin } 24775fdc4257SSteve Yin 24785fdc4257SSteve Yin /** 24795fdc4257SSteve Yin * UNO set description information for action to COM. 24805fdc4257SSteve Yin * @param szAction, the action description of the current object. 24815fdc4257SSteve Yin * @return S_OK if successful. 24825fdc4257SSteve Yin */ 24835fdc4257SSteve Yin STDMETHODIMP CMAccessible::Put_ActionDescription( const OLECHAR* szAction) 24845fdc4257SSteve Yin { 24855fdc4257SSteve Yin 24865fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 24875fdc4257SSteve Yin ISDESTROY() 24885fdc4257SSteve Yin // #CHECK# 24895fdc4257SSteve Yin if(szAction == NULL) 24905fdc4257SSteve Yin { 24915fdc4257SSteve Yin return E_INVALIDARG; 24925fdc4257SSteve Yin } 24935fdc4257SSteve Yin SAFE_SYSFREESTRING(m_pszActionDescription ); 24945fdc4257SSteve Yin m_pszActionDescription = SysAllocString( szAction ); 24955fdc4257SSteve Yin return S_OK; 24965fdc4257SSteve Yin 24975fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 24985fdc4257SSteve Yin } 24995fdc4257SSteve Yin 25005fdc4257SSteve Yin BOOL CMAccessible::GetXInterfaceFromXAccessible(XAccessible* pXAcc, XInterface** ppXI, int index) 25015fdc4257SSteve Yin { 25025fdc4257SSteve Yin Reference< XAccessibleContext > pRContext; 25035fdc4257SSteve Yin 25045fdc4257SSteve Yin switch(index) 25055fdc4257SSteve Yin { 25065fdc4257SSteve Yin case XI_COMPONENT: 25075fdc4257SSteve Yin QUERYXINTERFACE(AccessibleComponent) 25085fdc4257SSteve Yin break; 25095fdc4257SSteve Yin case XI_TEXT: 25105fdc4257SSteve Yin QUERYXINTERFACE(AccessibleText) 25115fdc4257SSteve Yin break; 25125fdc4257SSteve Yin case XI_EDITABLETEXT: 25135fdc4257SSteve Yin QUERYXINTERFACE(AccessibleEditableText) 25145fdc4257SSteve Yin break; 25155fdc4257SSteve Yin case XI_TABLE: 25165fdc4257SSteve Yin QUERYXINTERFACE(AccessibleTable) 25175fdc4257SSteve Yin break; 25185fdc4257SSteve Yin case XI_SELECTION: 25195fdc4257SSteve Yin QUERYXINTERFACE(AccessibleSelection) 25205fdc4257SSteve Yin break; 25215fdc4257SSteve Yin case XI_EXTENDEDCOMP: 25225fdc4257SSteve Yin QUERYXINTERFACE(AccessibleExtendedComponent) 25235fdc4257SSteve Yin break; 25245fdc4257SSteve Yin case XI_KEYBINDING: 25255fdc4257SSteve Yin QUERYXINTERFACE(AccessibleKeyBinding) 25265fdc4257SSteve Yin break; 25275fdc4257SSteve Yin case XI_ACTION: 25285fdc4257SSteve Yin QUERYXINTERFACE(AccessibleAction) 25295fdc4257SSteve Yin break; 25305fdc4257SSteve Yin case XI_VALUE: 25315fdc4257SSteve Yin QUERYXINTERFACE(AccessibleValue) 25325fdc4257SSteve Yin break; 25335fdc4257SSteve Yin case XI_HYPERTEXT: 25345fdc4257SSteve Yin QUERYXINTERFACE(AccessibleHypertext) 25355fdc4257SSteve Yin break; 25365fdc4257SSteve Yin case XI_HYPERLINK: 25375fdc4257SSteve Yin QUERYXINTERFACE(AccessibleHyperlink) 25385fdc4257SSteve Yin break; 25395fdc4257SSteve Yin case XI_IMAGE: 25405fdc4257SSteve Yin QUERYXINTERFACE(AccessibleImage) 25415fdc4257SSteve Yin break; 25425fdc4257SSteve Yin default: 25435fdc4257SSteve Yin break; 25445fdc4257SSteve Yin } 25455fdc4257SSteve Yin 25465fdc4257SSteve Yin return FALSE; 25475fdc4257SSteve Yin } 25485fdc4257SSteve Yin 25495fdc4257SSteve Yin HRESULT WINAPI CMAccessible::SmartQI(void* pv, REFIID iid, void** ppvObject) 25505fdc4257SSteve Yin { 25515fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 25525fdc4257SSteve Yin ISDESTROY() 25535fdc4257SSteve Yin if( ImplIsEqualGUID(iid,IID_IAccIdentity) || 25545fdc4257SSteve Yin ImplIsEqualGUID(iid,IID_IStdMarshalInfo) || 25555fdc4257SSteve Yin ImplIsEqualGUID(iid,IID_IMarshal) || 25565fdc4257SSteve Yin ImplIsEqualGUID(iid,IID_IExternalConnection)|| 25575fdc4257SSteve Yin ImplIsEqualGUID(iid,IID_IOleWindow)) 25585fdc4257SSteve Yin return E_FAIL; 25595fdc4257SSteve Yin 25605fdc4257SSteve Yin 25615fdc4257SSteve Yin _UNO_AGGMAP_ENTRY* pMap = _GetAggEntries(); 25625fdc4257SSteve Yin while(pMap && pMap->piid) 25635fdc4257SSteve Yin { 25645fdc4257SSteve Yin if(ImplIsEqualGUID(iid, *pMap->piid)) 25655fdc4257SSteve Yin { 25665fdc4257SSteve Yin XInterface* pXI = NULL; 25675fdc4257SSteve Yin BOOL bFound = GetXInterfaceFromXAccessible(pUNOInterface,&pXI,pMap->XIFIndex); 25685fdc4257SSteve Yin if(!bFound) 25695fdc4257SSteve Yin { 25705fdc4257SSteve Yin return E_FAIL; 25715fdc4257SSteve Yin } 25725fdc4257SSteve Yin 25735fdc4257SSteve Yin XGUIDToComObjHash::iterator pIndTemp = m_containedObjects.find( iid ); 25745fdc4257SSteve Yin if ( pIndTemp != m_containedObjects.end() ) 25755fdc4257SSteve Yin { 25765fdc4257SSteve Yin return pIndTemp->second.p->QueryInterface( iid, ppvObject ); 25775fdc4257SSteve Yin } 25785fdc4257SSteve Yin else 25795fdc4257SSteve Yin { 25805fdc4257SSteve Yin HRESULT hr = pMap->pfnCreateInstance(pv, iid, ppvObject); 25815fdc4257SSteve Yin if(hr == S_OK) 25825fdc4257SSteve Yin { 25835fdc4257SSteve Yin m_containedObjects.insert(XGUIDToComObjHash::value_type(*pMap->piid,(IUnknown*)*ppvObject)); 25845fdc4257SSteve Yin IUNOXWrapper* wrapper = NULL; 25855fdc4257SSteve Yin ((IUnknown*)*ppvObject)->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper); 25865fdc4257SSteve Yin if(wrapper) 25875fdc4257SSteve Yin { 25885fdc4257SSteve Yin wrapper->put_XInterface((long)pUNOInterface); 25895fdc4257SSteve Yin wrapper->Release(); 25905fdc4257SSteve Yin } 25915fdc4257SSteve Yin return S_OK; 25925fdc4257SSteve Yin } 25935fdc4257SSteve Yin } 25945fdc4257SSteve Yin return E_FAIL; 25955fdc4257SSteve Yin } 25965fdc4257SSteve Yin pMap++; 25975fdc4257SSteve Yin } 25985fdc4257SSteve Yin return E_FAIL; 25995fdc4257SSteve Yin 26005fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 26015fdc4257SSteve Yin } 26025fdc4257SSteve Yin 26035fdc4257SSteve Yin BOOL CMAccessible::get_IAccessibleFromXAccessible(long pXAcc, IAccessible **ppIA) 26045fdc4257SSteve Yin { 26055fdc4257SSteve Yin 26065fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 26075fdc4257SSteve Yin 26085fdc4257SSteve Yin // #CHECK# 26095fdc4257SSteve Yin if(ppIA == NULL) 26105fdc4257SSteve Yin { 26115fdc4257SSteve Yin return E_INVALIDARG; 26125fdc4257SSteve Yin } 26135fdc4257SSteve Yin BOOL isGet = FALSE; 26145fdc4257SSteve Yin if(g_pAgent) 26155fdc4257SSteve Yin isGet = g_pAgent->GetIAccessibleFromXAccessible((XAccessible*)pXAcc,ppIA); 26165fdc4257SSteve Yin 26175fdc4257SSteve Yin if(isGet) 26185fdc4257SSteve Yin return TRUE; 26195fdc4257SSteve Yin else 26205fdc4257SSteve Yin return FALSE; 26215fdc4257SSteve Yin 26225fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 26235fdc4257SSteve Yin } 26245fdc4257SSteve Yin 26255fdc4257SSteve Yin void CMAccessible::get_OLECHARFromAny(Any& pAny, OLECHAR* pChar) 26265fdc4257SSteve Yin { 26275fdc4257SSteve Yin // #CHECK# 26285fdc4257SSteve Yin if(pChar == NULL) 26295fdc4257SSteve Yin return; 26305fdc4257SSteve Yin 26315fdc4257SSteve Yin switch(pAny.getValueTypeClass()) 26325fdc4257SSteve Yin { 26335fdc4257SSteve Yin case TypeClass_CHAR: 26345fdc4257SSteve Yin { 26355fdc4257SSteve Yin sal_Int8 val; 26365fdc4257SSteve Yin pAny >>= val; 26375fdc4257SSteve Yin swprintf( pChar, L"%d", val); 26385fdc4257SSteve Yin break; 26395fdc4257SSteve Yin } 26405fdc4257SSteve Yin case TypeClass_BOOLEAN: 26415fdc4257SSteve Yin { 26425fdc4257SSteve Yin sal_Bool val; 26435fdc4257SSteve Yin pAny >>= val; 26445fdc4257SSteve Yin swprintf( pChar, L"%d", val); 26455fdc4257SSteve Yin break; 26465fdc4257SSteve Yin } 26475fdc4257SSteve Yin case TypeClass_BYTE: 26485fdc4257SSteve Yin { 26495fdc4257SSteve Yin sal_Int8 val; 26505fdc4257SSteve Yin pAny >>= val; 26515fdc4257SSteve Yin swprintf( pChar, L"%d", val); 26525fdc4257SSteve Yin break; 26535fdc4257SSteve Yin } 26545fdc4257SSteve Yin case TypeClass_SHORT: 26555fdc4257SSteve Yin { 26565fdc4257SSteve Yin SHORT val; 26575fdc4257SSteve Yin pAny >>= val; 26585fdc4257SSteve Yin swprintf( pChar, L"%d", val); 26595fdc4257SSteve Yin break; 26605fdc4257SSteve Yin } 26615fdc4257SSteve Yin case TypeClass_UNSIGNED_SHORT: 26625fdc4257SSteve Yin { 26635fdc4257SSteve Yin USHORT val; 26645fdc4257SSteve Yin pAny >>= val; 26655fdc4257SSteve Yin swprintf( pChar, L"%d", val); 26665fdc4257SSteve Yin break; 26675fdc4257SSteve Yin } 26685fdc4257SSteve Yin case TypeClass_LONG: 26695fdc4257SSteve Yin { 26705fdc4257SSteve Yin LONG val; 26715fdc4257SSteve Yin pAny >>= val; 26725fdc4257SSteve Yin swprintf( pChar, L"%ld", val); 26735fdc4257SSteve Yin break; 26745fdc4257SSteve Yin } 26755fdc4257SSteve Yin case TypeClass_UNSIGNED_LONG: 26765fdc4257SSteve Yin { 26775fdc4257SSteve Yin ULONG val; 26785fdc4257SSteve Yin pAny >>= val; 26795fdc4257SSteve Yin swprintf( pChar, L"%ld", val); 26805fdc4257SSteve Yin break; 26815fdc4257SSteve Yin } 26825fdc4257SSteve Yin case TypeClass_FLOAT: 26835fdc4257SSteve Yin { 26845fdc4257SSteve Yin FLOAT val; 26855fdc4257SSteve Yin pAny >>= val; 26865fdc4257SSteve Yin swprintf( pChar, L"%.3f", val); 26875fdc4257SSteve Yin break; 26885fdc4257SSteve Yin } 26895fdc4257SSteve Yin case TypeClass_DOUBLE: 26905fdc4257SSteve Yin { 26915fdc4257SSteve Yin DOUBLE val; 26925fdc4257SSteve Yin pAny >>= val; 26935fdc4257SSteve Yin swprintf( pChar, L"%.6lf", val); 26945fdc4257SSteve Yin break; 26955fdc4257SSteve Yin } 26965fdc4257SSteve Yin case TypeClass_STRING: 26975fdc4257SSteve Yin { 26985fdc4257SSteve Yin ::rtl::OUString val; 26995fdc4257SSteve Yin pAny >>= val; 27005fdc4257SSteve Yin wcscpy(pChar, val.getStr()); 27015fdc4257SSteve Yin break; 27025fdc4257SSteve Yin } 27035fdc4257SSteve Yin case TypeClass_SEQUENCE: 27045fdc4257SSteve Yin { 27055fdc4257SSteve Yin if(pAny.getValueType() == getCppuType( (Sequence< ::rtl::OUString > *)0 ) ) 27065fdc4257SSteve Yin { 27075fdc4257SSteve Yin Sequence < ::rtl::OUString > val; 27085fdc4257SSteve Yin pAny >>= val; 27095fdc4257SSteve Yin 27105fdc4257SSteve Yin ::rtl::OUString pString; 27115fdc4257SSteve Yin 27125fdc4257SSteve Yin int count = val.getLength(); 27135fdc4257SSteve Yin 27145fdc4257SSteve Yin for( int iIndex = 0;iIndex < count;iIndex++ ) 27155fdc4257SSteve Yin { 27165fdc4257SSteve Yin pString += val[iIndex]; 27175fdc4257SSteve Yin } 27185fdc4257SSteve Yin wcscpy(pChar, pString.getStr()); 27195fdc4257SSteve Yin } 27205fdc4257SSteve Yin else if (pAny.getValueType() == getCppuType( (Sequence< ::com::sun::star::style::TabStop >* )0 ) ) 27215fdc4257SSteve Yin { 27225fdc4257SSteve Yin Sequence < ::com::sun::star::style::TabStop > val; 27235fdc4257SSteve Yin pAny >>= val; 27245fdc4257SSteve Yin int count = val.getLength(); 27255fdc4257SSteve Yin 27265fdc4257SSteve Yin for( int iIndex = 0;iIndex < count;iIndex++ ) 27275fdc4257SSteve Yin { 27285fdc4257SSteve Yin OLECHAR pAttrs[512] = {NULL}; 27295fdc4257SSteve Yin 27305fdc4257SSteve Yin OLECHAR pAttrsPosition[512] = {NULL}; 27315fdc4257SSteve Yin OLECHAR pAttrsDescimalChar[512] = {NULL}; 27325fdc4257SSteve Yin OLECHAR pAttrsFillChar[512] = {NULL}; 27335fdc4257SSteve Yin 27345fdc4257SSteve Yin ::com::sun::star::style::TabStop sigleVal = val[iIndex]; 27355fdc4257SSteve Yin 27365fdc4257SSteve Yin swprintf( pAttrsPosition, L"Position=%ld,TabAlign=%ld", 27375fdc4257SSteve Yin sigleVal.Position, sigleVal.Alignment); 27385fdc4257SSteve Yin 27395fdc4257SSteve Yin if(sigleVal.DecimalChar==';' || sigleVal.DecimalChar == ':' || sigleVal.DecimalChar == ',' || 27405fdc4257SSteve Yin sigleVal.DecimalChar == '=' || sigleVal.DecimalChar == '\\') 27415fdc4257SSteve Yin swprintf( pAttrsDescimalChar, L"DecimalChar=\\%c",sigleVal.DecimalChar); 27425fdc4257SSteve Yin else 27435fdc4257SSteve Yin swprintf( pAttrsDescimalChar, L"DecimalChar=%c",sigleVal.DecimalChar); 27445fdc4257SSteve Yin 27455fdc4257SSteve Yin if(sigleVal.FillChar==';' || sigleVal.FillChar == ':' || sigleVal.FillChar == ',' || 27465fdc4257SSteve Yin sigleVal.FillChar == '=' || sigleVal.FillChar == '\\') 27475fdc4257SSteve Yin swprintf( pAttrsFillChar, L"FillChar=\\%c",sigleVal.FillChar); 27485fdc4257SSteve Yin else 27495fdc4257SSteve Yin swprintf( pAttrsFillChar, L"FillChar=%c",sigleVal.FillChar); 27505fdc4257SSteve Yin 27515fdc4257SSteve Yin swprintf( pAttrs, L"%s,%s,%s,",pAttrsPosition,pAttrsDescimalChar,pAttrsFillChar); 27525fdc4257SSteve Yin 27535fdc4257SSteve Yin wcscat(pChar,pAttrs); 27545fdc4257SSteve Yin } 27555fdc4257SSteve Yin } 27565fdc4257SSteve Yin break; 27575fdc4257SSteve Yin } 27585fdc4257SSteve Yin case TypeClass_ENUM: 27595fdc4257SSteve Yin { 27605fdc4257SSteve Yin if (pAny.getValueType() == getCppuType( (::com::sun::star::awt::FontSlant* )0 ) ) 27615fdc4257SSteve Yin { 27625fdc4257SSteve Yin com::sun::star::awt::FontSlant val; 27635fdc4257SSteve Yin pAny >>= val; 27645fdc4257SSteve Yin swprintf( pChar, L"%d", val); 27655fdc4257SSteve Yin } 27665fdc4257SSteve Yin } 27675fdc4257SSteve Yin case TypeClass_STRUCT: 27685fdc4257SSteve Yin { 27695fdc4257SSteve Yin if (pAny.getValueType() == getCppuType( (::com::sun::star::style::LineSpacing* )0 ) ) 27705fdc4257SSteve Yin { 27715fdc4257SSteve Yin com::sun::star::style::LineSpacing val; 27725fdc4257SSteve Yin pAny >>= val; 27735fdc4257SSteve Yin swprintf( pChar, L"Mode=%ld,Height=%ld,", val.Mode, val.Height); 27745fdc4257SSteve Yin } 27755fdc4257SSteve Yin else if (pAny.getValueType() == getCppuType( (com::sun::star::accessibility::TextSegment *)0 ) ) 27765fdc4257SSteve Yin { 27775fdc4257SSteve Yin com::sun::star::accessibility::TextSegment val; 27785fdc4257SSteve Yin pAny >>= val; 27795fdc4257SSteve Yin ::rtl::OUString realVal(val.SegmentText); 27805fdc4257SSteve Yin wcscpy(pChar, realVal.getStr()); 27815fdc4257SSteve Yin } 27825fdc4257SSteve Yin break; 27835fdc4257SSteve Yin } 27845fdc4257SSteve Yin case TypeClass_VOID: 27855fdc4257SSteve Yin case TypeClass_HYPER: 27865fdc4257SSteve Yin case TypeClass_UNSIGNED_HYPER: 27875fdc4257SSteve Yin case TypeClass_TYPE: 27885fdc4257SSteve Yin case TypeClass_ANY: 27895fdc4257SSteve Yin case TypeClass_TYPEDEF: 27905fdc4257SSteve Yin case TypeClass_UNION: 27915fdc4257SSteve Yin case TypeClass_EXCEPTION: 27925fdc4257SSteve Yin case TypeClass_ARRAY: 27935fdc4257SSteve Yin case TypeClass_INTERFACE: 27945fdc4257SSteve Yin case TypeClass_SERVICE: 27955fdc4257SSteve Yin case TypeClass_MODULE: 27965fdc4257SSteve Yin case TypeClass_INTERFACE_METHOD: 27975fdc4257SSteve Yin case TypeClass_INTERFACE_ATTRIBUTE: 27985fdc4257SSteve Yin case TypeClass_UNKNOWN: 27995fdc4257SSteve Yin case TypeClass_PROPERTY: 28005fdc4257SSteve Yin case TypeClass_CONSTANT: 28015fdc4257SSteve Yin case TypeClass_CONSTANTS: 28025fdc4257SSteve Yin case TypeClass_SINGLETON: 28035fdc4257SSteve Yin case TypeClass_MAKE_FIXED_SIZE: 28045fdc4257SSteve Yin break; 28055fdc4257SSteve Yin default: 28065fdc4257SSteve Yin break; 28075fdc4257SSteve Yin } 28085fdc4257SSteve Yin } 28095fdc4257SSteve Yin 28105fdc4257SSteve Yin void CMAccessible::get_OLECHAR4Numbering(const Any& pAny, short numberingLevel,const OUString& numberingPrefix,OLECHAR* pChar) 28115fdc4257SSteve Yin { 28125fdc4257SSteve Yin if(pChar == NULL) 28135fdc4257SSteve Yin return; 28145fdc4257SSteve Yin Reference< ::com::sun::star::container::XIndexReplace > pXIndex; 28155fdc4257SSteve Yin if((pAny>>=pXIndex) && (numberingLevel !=-1))//numbering level is -1,means invalid value 28165fdc4257SSteve Yin { 28175fdc4257SSteve Yin Any aAny = pXIndex->getByIndex(numberingLevel); 28185fdc4257SSteve Yin Sequence< ::com::sun::star::beans::PropertyValue > aProps; 28195fdc4257SSteve Yin aAny >>= aProps; 28205fdc4257SSteve Yin const ::com::sun::star::beans::PropertyValue* pPropArray = aProps.getConstArray(); 28215fdc4257SSteve Yin sal_Int32 nCount = aProps.getLength(); 28225fdc4257SSteve Yin swprintf(pChar,L"Numbering:NumberingLevel=%d,",numberingLevel); 28235fdc4257SSteve Yin for( sal_Int32 i=0; i<nCount; i++ ) 28245fdc4257SSteve Yin { 28255fdc4257SSteve Yin ::com::sun::star::beans::PropertyValue rProp = pPropArray[i]; 28265fdc4257SSteve Yin if( (rProp.Name.compareTo(OUString::createFromAscii("BulletChar"))==0)|| 28275fdc4257SSteve Yin (rProp.Name.compareTo(OUString::createFromAscii("GraphicURL"))==0)|| 28285fdc4257SSteve Yin (rProp.Name.compareTo(OUString::createFromAscii("NumberingType"))==0)) 28295fdc4257SSteve Yin { 28305fdc4257SSteve Yin OLECHAR propStr[512] = {NULL}; 28315fdc4257SSteve Yin swprintf(propStr,L"%s=",rProp.Name.getStr()); 28325fdc4257SSteve Yin OLECHAR pTemp[256] = {NULL}; 28335fdc4257SSteve Yin CMAccessible::get_OLECHARFromAny(rProp.Value,pTemp); 28345fdc4257SSteve Yin if(rProp.Name.compareTo(OUString::createFromAscii("GraphicURL"))==0) 28355fdc4257SSteve Yin { 28365fdc4257SSteve Yin OLECHAR* pOccur = wcschr(pTemp,':'); 28375fdc4257SSteve Yin if(pOccur) 28385fdc4257SSteve Yin *pOccur = '.'; 28395fdc4257SSteve Yin } 28405fdc4257SSteve Yin wcscat(propStr,pTemp); 28415fdc4257SSteve Yin wcscat(pChar,propStr); 28425fdc4257SSteve Yin wcscat(pChar,L","); 28435fdc4257SSteve Yin 28445fdc4257SSteve Yin if(rProp.Name.compareTo(OUString::createFromAscii("NumberingType"))==0) 28455fdc4257SSteve Yin { 28465fdc4257SSteve Yin if(numberingPrefix.getLength()!=0) 28475fdc4257SSteve Yin { 28485fdc4257SSteve Yin swprintf(pTemp,L"NumberingPrefix=%s,",numberingPrefix.getStr()); 28495fdc4257SSteve Yin wcscat(pChar,pTemp); 28505fdc4257SSteve Yin } 28515fdc4257SSteve Yin } 28525fdc4257SSteve Yin } 28535fdc4257SSteve Yin } 28545fdc4257SSteve Yin } 28555fdc4257SSteve Yin 28565fdc4257SSteve Yin //Because now have three types numbering level: 28575fdc4257SSteve Yin //1.real numbering list,numbering level>=0 and numbering Rule !=NULL; 28585fdc4257SSteve Yin //2.common paragraph, numbering level >=0, and numbering Rule == NULL; 28595fdc4257SSteve Yin //3.TOC paragraph, numbering level >0, and numbering Rule ==NULL; 28605fdc4257SSteve Yin // IAText:numberinglevel base on 0, but TOC's level base on 1, 28615fdc4257SSteve Yin // so NumberingLevel value will be decreased 1 in bridge code. 28625fdc4257SSteve Yin else if(numberingLevel >0) 28635fdc4257SSteve Yin { 28645fdc4257SSteve Yin swprintf(pChar,L"Numbering:NumberingLevel=%d,NumberingType=4,NumberingPrefix=,",numberingLevel-1); 28655fdc4257SSteve Yin } 28665fdc4257SSteve Yin else 28675fdc4257SSteve Yin { 28685fdc4257SSteve Yin swprintf(pChar,L"Numbering:"); 28695fdc4257SSteve Yin } 28705fdc4257SSteve Yin } 28715fdc4257SSteve Yin 28725fdc4257SSteve Yin void CMAccessible::ConvertAnyToVariant(const ::com::sun::star::uno::Any &rAnyVal, VARIANT *pvData) 28735fdc4257SSteve Yin { 28745fdc4257SSteve Yin if(rAnyVal.hasValue()) 28755fdc4257SSteve Yin { 28765fdc4257SSteve Yin // Clear VARIANT variable. 28775fdc4257SSteve Yin VariantClear(pvData); 28785fdc4257SSteve Yin 28795fdc4257SSteve Yin // Set value according to value type. 28805fdc4257SSteve Yin switch(rAnyVal.getValueTypeClass()) 28815fdc4257SSteve Yin { 28825fdc4257SSteve Yin case TypeClass_CHAR: 28835fdc4257SSteve Yin pvData->vt = VT_UI1; 28845fdc4257SSteve Yin memcpy(&pvData->bVal, rAnyVal.getValue(), sizeof(sal_Char)); 28855fdc4257SSteve Yin break; 28865fdc4257SSteve Yin 28875fdc4257SSteve Yin case TypeClass_BOOLEAN: 28885fdc4257SSteve Yin pvData->vt = VT_BOOL; 28895fdc4257SSteve Yin memcpy(&pvData->boolVal, rAnyVal.getValue(), sizeof(sal_Bool)); 28905fdc4257SSteve Yin break; 28915fdc4257SSteve Yin 28925fdc4257SSteve Yin case TypeClass_BYTE: 28935fdc4257SSteve Yin pvData->vt = VT_UI1; 28945fdc4257SSteve Yin memcpy(&pvData->bVal, rAnyVal.getValue(), sizeof(sal_Int8)); 28955fdc4257SSteve Yin break; 28965fdc4257SSteve Yin 28975fdc4257SSteve Yin case TypeClass_SHORT: 28985fdc4257SSteve Yin pvData->vt = VT_I2; 28995fdc4257SSteve Yin memcpy(&pvData->iVal, rAnyVal.getValue(), sizeof(sal_Int16)); 29005fdc4257SSteve Yin break; 29015fdc4257SSteve Yin 29025fdc4257SSteve Yin case TypeClass_UNSIGNED_SHORT: 29035fdc4257SSteve Yin pvData->vt = VT_I2; 29045fdc4257SSteve Yin memcpy(&pvData->iVal, rAnyVal.getValue(), sizeof(sal_uInt16)); 29055fdc4257SSteve Yin break; 29065fdc4257SSteve Yin 29075fdc4257SSteve Yin case TypeClass_LONG: 29085fdc4257SSteve Yin pvData->vt = VT_I4; 29095fdc4257SSteve Yin memcpy(&pvData->lVal, rAnyVal.getValue(), sizeof(sal_Int32)); 29105fdc4257SSteve Yin break; 29115fdc4257SSteve Yin 29125fdc4257SSteve Yin case TypeClass_UNSIGNED_LONG: 29135fdc4257SSteve Yin pvData->vt = VT_I4; 29145fdc4257SSteve Yin memcpy(&pvData->lVal, rAnyVal.getValue(), sizeof(sal_uInt32)); 29155fdc4257SSteve Yin break; 29165fdc4257SSteve Yin 29175fdc4257SSteve Yin case TypeClass_FLOAT: 29185fdc4257SSteve Yin pvData->vt = VT_R4; 29195fdc4257SSteve Yin memcpy(&pvData->fltVal, rAnyVal.getValue(), sizeof(float)); 29205fdc4257SSteve Yin break; 29215fdc4257SSteve Yin 29225fdc4257SSteve Yin case TypeClass_DOUBLE: 29235fdc4257SSteve Yin pvData->vt = VT_R8; 29245fdc4257SSteve Yin memcpy(&pvData->dblVal, rAnyVal.getValue(), sizeof(double)); 29255fdc4257SSteve Yin break; 29265fdc4257SSteve Yin 29275fdc4257SSteve Yin case TypeClass_STRING: 29285fdc4257SSteve Yin { 29295fdc4257SSteve Yin pvData->vt = VT_BSTR; 29305fdc4257SSteve Yin ::rtl::OUString val; 29315fdc4257SSteve Yin rAnyVal >>= val; 29325fdc4257SSteve Yin pvData->bstrVal = SysAllocString((OLECHAR *)val.getStr()); 29335fdc4257SSteve Yin break; 29345fdc4257SSteve Yin } 29355fdc4257SSteve Yin 29365fdc4257SSteve Yin case TypeClass_VOID: 29375fdc4257SSteve Yin case TypeClass_HYPER: 29385fdc4257SSteve Yin case TypeClass_UNSIGNED_HYPER: 29395fdc4257SSteve Yin case TypeClass_TYPE: 29405fdc4257SSteve Yin case TypeClass_ANY: 29415fdc4257SSteve Yin case TypeClass_ENUM: 29425fdc4257SSteve Yin case TypeClass_TYPEDEF: 29435fdc4257SSteve Yin case TypeClass_STRUCT: 29445fdc4257SSteve Yin case TypeClass_UNION: 29455fdc4257SSteve Yin case TypeClass_EXCEPTION: 29465fdc4257SSteve Yin case TypeClass_SEQUENCE: 29475fdc4257SSteve Yin case TypeClass_ARRAY: 29485fdc4257SSteve Yin case TypeClass_INTERFACE: 29495fdc4257SSteve Yin { 29505fdc4257SSteve Yin Reference< XAccessible > pXAcc; 29515fdc4257SSteve Yin if(rAnyVal >>= pXAcc) 29525fdc4257SSteve Yin { 29535fdc4257SSteve Yin if(pXAcc.is()) 29545fdc4257SSteve Yin { 29555fdc4257SSteve Yin IAccessible* pIAcc = NULL; 29565fdc4257SSteve Yin get_IAccessibleFromXAccessible((long)pXAcc.get(), &pIAcc); 29575fdc4257SSteve Yin if(pIAcc == NULL) 29585fdc4257SSteve Yin { 29595fdc4257SSteve Yin Reference< XAccessibleContext > pXAccContext = pXAcc->getAccessibleContext(); 29605fdc4257SSteve Yin g_pAgent->InsertAccObj(pXAcc.get(),pXAccContext->getAccessibleParent().get()); 29615fdc4257SSteve Yin get_IAccessibleFromXAccessible((long)pXAcc.get(), &pIAcc); 29625fdc4257SSteve Yin } 29635fdc4257SSteve Yin if(pIAcc) 29645fdc4257SSteve Yin { 29655fdc4257SSteve Yin pIAcc->AddRef(); 29665fdc4257SSteve Yin 29675fdc4257SSteve Yin pvData->vt = VT_UNKNOWN; 29685fdc4257SSteve Yin pvData->pdispVal = (IAccessible2*)pIAcc; 29695fdc4257SSteve Yin break; 29705fdc4257SSteve Yin } 29715fdc4257SSteve Yin } 29725fdc4257SSteve Yin } 29735fdc4257SSteve Yin } 29745fdc4257SSteve Yin case TypeClass_SERVICE: 29755fdc4257SSteve Yin case TypeClass_MODULE: 29765fdc4257SSteve Yin case TypeClass_INTERFACE_METHOD: 29775fdc4257SSteve Yin case TypeClass_INTERFACE_ATTRIBUTE: 29785fdc4257SSteve Yin case TypeClass_UNKNOWN: 29795fdc4257SSteve Yin case TypeClass_PROPERTY: 29805fdc4257SSteve Yin case TypeClass_CONSTANT: 29815fdc4257SSteve Yin case TypeClass_CONSTANTS: 29825fdc4257SSteve Yin case TypeClass_SINGLETON: 29835fdc4257SSteve Yin case TypeClass_MAKE_FIXED_SIZE: 29845fdc4257SSteve Yin // Output the type string, if there is other uno value type. 29855fdc4257SSteve Yin pvData->vt = VT_BSTR; 29865fdc4257SSteve Yin pvData->bstrVal = SysAllocString(rAnyVal.getValueTypeName().getStr()); 29875fdc4257SSteve Yin break; 29885fdc4257SSteve Yin 29895fdc4257SSteve Yin default: 29905fdc4257SSteve Yin break; 29915fdc4257SSteve Yin } 29925fdc4257SSteve Yin } 29935fdc4257SSteve Yin else 29945fdc4257SSteve Yin { 29955fdc4257SSteve Yin VariantClear(pvData); 29965fdc4257SSteve Yin } 29975fdc4257SSteve Yin } 29985fdc4257SSteve Yin 29995fdc4257SSteve Yin STDMETHODIMP CMAccessible::Get_XAccChildID(long* childID) 30005fdc4257SSteve Yin { 30015fdc4257SSteve Yin // #CHECK# 30025fdc4257SSteve Yin if(childID == NULL) 30035fdc4257SSteve Yin { 30045fdc4257SSteve Yin return E_FAIL; 30055fdc4257SSteve Yin } 30065fdc4257SSteve Yin *childID = m_dChildID; 30075fdc4257SSteve Yin return S_OK; 30085fdc4257SSteve Yin } 30095fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_states(AccessibleStates __RPC_FAR *states ) 30105fdc4257SSteve Yin { 30115fdc4257SSteve Yin 30125fdc4257SSteve Yin CHECK_ENABLE_INF 30135fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 30145fdc4257SSteve Yin ISDESTROY() 30155fdc4257SSteve Yin // #CHECK XInterface# 30165fdc4257SSteve Yin if( !pRContext.is() ) 30175fdc4257SSteve Yin return E_FAIL; 30185fdc4257SSteve Yin 30195fdc4257SSteve Yin Reference<XAccessibleStateSet> pRStateSet = pRContext.get()->getAccessibleStateSet(); 30205fdc4257SSteve Yin if(!pRStateSet.is()) 30215fdc4257SSteve Yin { 30225fdc4257SSteve Yin return S_OK; 30235fdc4257SSteve Yin } 30245fdc4257SSteve Yin Sequence<short> pStates = pRStateSet->getStates(); 30255fdc4257SSteve Yin 30265fdc4257SSteve Yin 30275fdc4257SSteve Yin long count = pStates.getLength() ; 30285fdc4257SSteve Yin *states = 0x0; 30295fdc4257SSteve Yin for( int i = 0; i < count; i++ ) 30305fdc4257SSteve Yin { 30315fdc4257SSteve Yin for( int j = 0; j < sizeof(UNO_STATES) / sizeof(UNO_STATES[0]); j++ ) 30325fdc4257SSteve Yin { 30335fdc4257SSteve Yin if( pStates[i] == UNO_STATES[j] ) 30345fdc4257SSteve Yin { 30355fdc4257SSteve Yin *states |= IA2_STATES[j]; 30365fdc4257SSteve Yin break; 30375fdc4257SSteve Yin } 30385fdc4257SSteve Yin } 30395fdc4257SSteve Yin } 30405fdc4257SSteve Yin return S_OK; 30415fdc4257SSteve Yin 30425fdc4257SSteve Yin 30435fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 30445fdc4257SSteve Yin } 30455fdc4257SSteve Yin 30465fdc4257SSteve Yin // return the UNO roles 30475fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_extendedRole( BSTR __RPC_FAR * ) 30485fdc4257SSteve Yin { 30495fdc4257SSteve Yin 30505fdc4257SSteve Yin CHECK_ENABLE_INF 30515fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 30525fdc4257SSteve Yin ISDESTROY() 30535fdc4257SSteve Yin 30545fdc4257SSteve Yin return E_NOTIMPL; 30555fdc4257SSteve Yin 30565fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 30575fdc4257SSteve Yin } 30585fdc4257SSteve Yin 30595fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_localizedExtendedRole( BSTR __RPC_FAR * ) 30605fdc4257SSteve Yin { 30615fdc4257SSteve Yin 30625fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 30635fdc4257SSteve Yin ISDESTROY() 30645fdc4257SSteve Yin return E_NOTIMPL; 30655fdc4257SSteve Yin 30665fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 30675fdc4257SSteve Yin } 30685fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_nExtendedStates( long __RPC_FAR * ) 30695fdc4257SSteve Yin { 30705fdc4257SSteve Yin 30715fdc4257SSteve Yin CHECK_ENABLE_INF 30725fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 30735fdc4257SSteve Yin ISDESTROY() 30745fdc4257SSteve Yin 30755fdc4257SSteve Yin return E_NOTIMPL; 30765fdc4257SSteve Yin 30775fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 30785fdc4257SSteve Yin } 30795fdc4257SSteve Yin 30805fdc4257SSteve Yin 30815fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_localizedExtendedStates( long, BSTR __RPC_FAR *__RPC_FAR *, long __RPC_FAR *) 30825fdc4257SSteve Yin { 30835fdc4257SSteve Yin 30845fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 30855fdc4257SSteve Yin ISDESTROY() 30865fdc4257SSteve Yin return E_NOTIMPL; 30875fdc4257SSteve Yin 30885fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 30895fdc4257SSteve Yin } 30905fdc4257SSteve Yin 30915fdc4257SSteve Yin 30925fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_indexInParent( long __RPC_FAR *accParentIndex) 30935fdc4257SSteve Yin { 30945fdc4257SSteve Yin 30955fdc4257SSteve Yin CHECK_ENABLE_INF 30965fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 30975fdc4257SSteve Yin ISDESTROY() 30985fdc4257SSteve Yin // #CHECK# 30995fdc4257SSteve Yin if(accParentIndex == NULL) 31005fdc4257SSteve Yin return E_INVALIDARG; 31015fdc4257SSteve Yin 31025fdc4257SSteve Yin // #CHECK XInterface# 31035fdc4257SSteve Yin if( !pRContext.is() ) 31045fdc4257SSteve Yin return E_FAIL; 31055fdc4257SSteve Yin 31065fdc4257SSteve Yin *accParentIndex = pRContext.get()->getAccessibleIndexInParent(); 31075fdc4257SSteve Yin return S_OK; 31085fdc4257SSteve Yin 31095fdc4257SSteve Yin 31105fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 31115fdc4257SSteve Yin } 31125fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_locale( IA2Locale __RPC_FAR *locale ) 31135fdc4257SSteve Yin { 31145fdc4257SSteve Yin 31155fdc4257SSteve Yin CHECK_ENABLE_INF 31165fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 31175fdc4257SSteve Yin ISDESTROY() 31185fdc4257SSteve Yin if(locale == NULL) 31195fdc4257SSteve Yin return E_INVALIDARG; 31205fdc4257SSteve Yin // #CHECK XInterface# 31215fdc4257SSteve Yin 31225fdc4257SSteve Yin if( !pRContext.is() ) 31235fdc4257SSteve Yin return E_FAIL; 31245fdc4257SSteve Yin 31255fdc4257SSteve Yin ::com::sun::star::lang::Locale unoLoc = pRContext.get()->getLocale(); 31265fdc4257SSteve Yin locale->language = SysAllocString((OLECHAR*)unoLoc.Language.getStr()); 31275fdc4257SSteve Yin locale->country = SysAllocString((OLECHAR*)unoLoc.Country.getStr()); 31285fdc4257SSteve Yin locale->variant = SysAllocString((OLECHAR*)unoLoc.Variant.getStr()); 31295fdc4257SSteve Yin 31305fdc4257SSteve Yin return S_OK; 31315fdc4257SSteve Yin 31325fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 31335fdc4257SSteve Yin } 31345fdc4257SSteve Yin 31355fdc4257SSteve Yin DWORD GetMSAAStateFromUNO(short xState) 31365fdc4257SSteve Yin { 31375fdc4257SSteve Yin DWORD IState = STATE_SYSTEM_UNAVAILABLE; 31385fdc4257SSteve Yin switch( xState ) 31395fdc4257SSteve Yin { 31405fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::BUSY: 31415fdc4257SSteve Yin IState = STATE_SYSTEM_BUSY; 31425fdc4257SSteve Yin break; 31435fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::CHECKED: 31445fdc4257SSteve Yin IState = STATE_SYSTEM_CHECKED; 31455fdc4257SSteve Yin break; 31465fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::DEFUNC: 31475fdc4257SSteve Yin IState = STATE_SYSTEM_UNAVAILABLE; 31485fdc4257SSteve Yin break; 31495fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::EXPANDED: 31505fdc4257SSteve Yin IState = STATE_SYSTEM_EXPANDED; 31515fdc4257SSteve Yin break; 31525fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::FOCUSABLE: 31535fdc4257SSteve Yin IState = STATE_SYSTEM_FOCUSABLE; 31545fdc4257SSteve Yin break; 31555fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::FOCUSED: 31565fdc4257SSteve Yin IState = STATE_SYSTEM_FOCUSED; 31575fdc4257SSteve Yin break; 31585fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::INDETERMINATE: 31595fdc4257SSteve Yin IState = STATE_SYSTEM_MIXED; 31605fdc4257SSteve Yin break; 31615fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::MULTI_SELECTABLE: 31625fdc4257SSteve Yin IState = STATE_SYSTEM_MULTISELECTABLE; 31635fdc4257SSteve Yin break; 31645fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::PRESSED: 31655fdc4257SSteve Yin IState = STATE_SYSTEM_PRESSED; 31665fdc4257SSteve Yin break; 31675fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::RESIZABLE: 31685fdc4257SSteve Yin IState = STATE_SYSTEM_SIZEABLE; 31695fdc4257SSteve Yin break; 31705fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::SELECTABLE: 31715fdc4257SSteve Yin IState = STATE_SYSTEM_SELECTABLE; 31725fdc4257SSteve Yin break; 31735fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::SELECTED: 31745fdc4257SSteve Yin IState = STATE_SYSTEM_SELECTED; 31755fdc4257SSteve Yin break; 31765fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::ARMED: 31775fdc4257SSteve Yin IState = STATE_SYSTEM_FOCUSED; 31785fdc4257SSteve Yin break; 31795fdc4257SSteve Yin case /*AccessibleStateType::*/AccessibleStateType::EXPANDABLE: 31805fdc4257SSteve Yin IState = STATE_SYSTEM_COLLAPSED; 31815fdc4257SSteve Yin break; 31825fdc4257SSteve Yin default: 31835fdc4257SSteve Yin break; 31845fdc4257SSteve Yin } 31855fdc4257SSteve Yin return IState; 31865fdc4257SSteve Yin } 31875fdc4257SSteve Yin 31885fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_appName( BSTR __RPC_FAR *name) 31895fdc4257SSteve Yin { 31905fdc4257SSteve Yin 31915fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 31925fdc4257SSteve Yin ISDESTROY() 31935fdc4257SSteve Yin if(name == NULL) 31945fdc4257SSteve Yin return E_INVALIDARG; 31955fdc4257SSteve Yin 31965fdc4257SSteve Yin *name = SysAllocString(OLESTR("Hannover")); 31975fdc4257SSteve Yin return S_OK; 31985fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 31995fdc4257SSteve Yin } 32005fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_appVersion(BSTR __RPC_FAR *version) 32015fdc4257SSteve Yin { 32025fdc4257SSteve Yin 32035fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 32045fdc4257SSteve Yin ISDESTROY() 32055fdc4257SSteve Yin if(version == NULL) 32065fdc4257SSteve Yin return E_INVALIDARG; 32075fdc4257SSteve Yin *version=SysAllocString(OLESTR("3.0")); 32085fdc4257SSteve Yin return S_OK; 32095fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 32105fdc4257SSteve Yin } 32115fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_toolkitName(BSTR __RPC_FAR *name) 32125fdc4257SSteve Yin { 32135fdc4257SSteve Yin 32145fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 32155fdc4257SSteve Yin ISDESTROY() 32165fdc4257SSteve Yin if(name == NULL) 32175fdc4257SSteve Yin return E_INVALIDARG; 32185fdc4257SSteve Yin *name = SysAllocString(OLESTR(" ")); 32195fdc4257SSteve Yin return S_OK; 32205fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 32215fdc4257SSteve Yin } 32225fdc4257SSteve Yin STDMETHODIMP CMAccessible:: get_toolkitVersion(BSTR __RPC_FAR *version) 32235fdc4257SSteve Yin { 32245fdc4257SSteve Yin 32255fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 32265fdc4257SSteve Yin ISDESTROY() 32275fdc4257SSteve Yin if(version == NULL) 32285fdc4257SSteve Yin return E_INVALIDARG; 32295fdc4257SSteve Yin *version = SysAllocString(OLESTR(" ")); 32305fdc4257SSteve Yin return S_OK; 32315fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 32325fdc4257SSteve Yin } 32335fdc4257SSteve Yin 32345fdc4257SSteve Yin 32355fdc4257SSteve Yin STDMETHODIMP CMAccessible::get_attributes(/*[out]*/ BSTR *pAttr) 32365fdc4257SSteve Yin { 32375fdc4257SSteve Yin CHECK_ENABLE_INF 32385fdc4257SSteve Yin Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext(); 32395fdc4257SSteve Yin if( !pRContext.is() ) 32405fdc4257SSteve Yin { 32415fdc4257SSteve Yin return E_FAIL; 32425fdc4257SSteve Yin } 32435fdc4257SSteve Yin Reference<XAccessibleExtendedAttributes> pRXI(pRContext,UNO_QUERY); 32445fdc4257SSteve Yin if( !pRXI.is() ) 32455fdc4257SSteve Yin return E_FAIL; 32465fdc4257SSteve Yin else 32475fdc4257SSteve Yin { 32485fdc4257SSteve Yin com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleExtendedAttributes> pRXAttr; 32495fdc4257SSteve Yin pRXAttr = pRXI.get(); 32505fdc4257SSteve Yin ::com::sun::star::uno::Any anyVal = pRXAttr->getExtendedAttributes(); 32515fdc4257SSteve Yin 32525fdc4257SSteve Yin ::rtl::OUString val; 32535fdc4257SSteve Yin anyVal >>= val; 32545fdc4257SSteve Yin 32555fdc4257SSteve Yin if(*pAttr) 32565fdc4257SSteve Yin SAFE_SYSFREESTRING(*pAttr); 32575fdc4257SSteve Yin *pAttr = SysAllocString((OLECHAR *)val.getStr()); 32585fdc4257SSteve Yin 32595fdc4257SSteve Yin return S_OK; 32605fdc4257SSteve Yin } 32615fdc4257SSteve Yin } 32625fdc4257SSteve Yin 3263