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 105fdc4257SSteve Yin * 11*3a700b0aSSteve Yin * http://www.apache.org/licenses/LICENSE-2.0 125fdc4257SSteve 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. 195fdc4257SSteve Yin * 20*3a700b0aSSteve Yin *************************************************************/ 215fdc4257SSteve Yin 225fdc4257SSteve Yin /** 235fdc4257SSteve Yin * AccTable.cpp : Implementation of CAccTable. 245fdc4257SSteve Yin */ 255fdc4257SSteve Yin #include "stdafx.h" 265fdc4257SSteve Yin #include "UAccCOM2.h" 275fdc4257SSteve Yin #include "AccTable.h" 285fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessible.hpp> 295fdc4257SSteve Yin #include "MAccessible.h" 305fdc4257SSteve Yin 31*3a700b0aSSteve Yin 325fdc4257SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLETABLEEXTENT_HPP_ 335fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleTableSelection.hpp> 345fdc4257SSteve Yin #endif 355fdc4257SSteve Yin 365fdc4257SSteve Yin using namespace com::sun::star::accessibility; 375fdc4257SSteve Yin using namespace com::sun::star::uno; 385fdc4257SSteve Yin /** 395fdc4257SSteve Yin * Gets accessible table cell. 405fdc4257SSteve Yin * 415fdc4257SSteve Yin * @param row the row of the specified cell. 425fdc4257SSteve Yin * @param column the column of the specified cell. 435fdc4257SSteve Yin * @param accessible the accessible object of the cell. 445fdc4257SSteve Yin */ 455fdc4257SSteve Yin 465fdc4257SSteve Yin STDMETHODIMP CAccTable::get_accessibleAt(long row, long column, IUnknown * * accessible) 475fdc4257SSteve Yin { 485fdc4257SSteve Yin 495fdc4257SSteve Yin CHECK_ENABLE_INF 505fdc4257SSteve Yin 515fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 525fdc4257SSteve Yin 535fdc4257SSteve Yin // #CHECK# 545fdc4257SSteve Yin if(accessible == NULL) 555fdc4257SSteve Yin return E_INVALIDARG; 565fdc4257SSteve Yin // #CHECK XInterface# 575fdc4257SSteve Yin if(!pRXTable.is()) 585fdc4257SSteve Yin return E_FAIL; 595fdc4257SSteve Yin 605fdc4257SSteve Yin Reference<XAccessible> pRAcc = GetXInterface()->getAccessibleCellAt(row,column); 615fdc4257SSteve Yin 625fdc4257SSteve Yin if(!pRAcc.is()) 635fdc4257SSteve Yin { 645fdc4257SSteve Yin *accessible = NULL; 655fdc4257SSteve Yin return E_FAIL; 665fdc4257SSteve Yin } 675fdc4257SSteve Yin 685fdc4257SSteve Yin IAccessible* pRet = NULL; 695fdc4257SSteve Yin 705fdc4257SSteve Yin BOOL isTRUE = CMAccessible::get_IAccessibleFromXAccessible((long)pRAcc.get(),&pRet); 715fdc4257SSteve Yin if(isTRUE) 725fdc4257SSteve Yin { 735fdc4257SSteve Yin *accessible = (IAccessible2 *)pRet; 745fdc4257SSteve Yin pRet->AddRef(); 755fdc4257SSteve Yin return S_OK; 765fdc4257SSteve Yin } 775fdc4257SSteve Yin else if(pRAcc.is()) 785fdc4257SSteve Yin { 795fdc4257SSteve Yin Reference<XAccessible> pxTable(GetXInterface(),UNO_QUERY); 805fdc4257SSteve Yin 815fdc4257SSteve Yin CMAccessible::g_pAgent->InsertAccObj(pRAcc.get(),pxTable.get()); 825fdc4257SSteve Yin isTRUE = CMAccessible::get_IAccessibleFromXAccessible((long)pRAcc.get(),&pRet); 835fdc4257SSteve Yin 845fdc4257SSteve Yin if(isTRUE) 855fdc4257SSteve Yin { 865fdc4257SSteve Yin *accessible = (IAccessible2 *)pRet; 875fdc4257SSteve Yin pRet->AddRef(); 885fdc4257SSteve Yin return S_OK; 895fdc4257SSteve Yin } 905fdc4257SSteve Yin } 915fdc4257SSteve Yin return E_FAIL; 925fdc4257SSteve Yin 935fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 945fdc4257SSteve Yin } 955fdc4257SSteve Yin 965fdc4257SSteve Yin /** 975fdc4257SSteve Yin * Gets accessible table caption. 985fdc4257SSteve Yin * 995fdc4257SSteve Yin * @param accessible the accessible object of table cpation. 1005fdc4257SSteve Yin */ 1015fdc4257SSteve Yin STDMETHODIMP CAccTable::get_caption(IUnknown * *) 1025fdc4257SSteve Yin { 1035fdc4257SSteve Yin 1045fdc4257SSteve Yin 1055fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1065fdc4257SSteve Yin 1075fdc4257SSteve Yin return E_NOTIMPL; 1085fdc4257SSteve Yin 1095fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1105fdc4257SSteve Yin } 1115fdc4257SSteve Yin 1125fdc4257SSteve Yin /** 1135fdc4257SSteve Yin * Gets accessible column description (as string). 1145fdc4257SSteve Yin * 1155fdc4257SSteve Yin * @param column the column index. 1165fdc4257SSteve Yin * @param description the description of the specified column. 1175fdc4257SSteve Yin */ 1185fdc4257SSteve Yin STDMETHODIMP CAccTable::get_columnDescription(long column, BSTR * description) 1195fdc4257SSteve Yin { 1205fdc4257SSteve Yin 1215fdc4257SSteve Yin CHECK_ENABLE_INF 1225fdc4257SSteve Yin 1235fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1245fdc4257SSteve Yin 1255fdc4257SSteve Yin // #CHECK# 1265fdc4257SSteve Yin if(description == NULL) 1275fdc4257SSteve Yin return E_INVALIDARG; 1285fdc4257SSteve Yin 1295fdc4257SSteve Yin // #CHECK XInterface# 1305fdc4257SSteve Yin if(!pRXTable.is()) 1315fdc4257SSteve Yin return E_FAIL; 1325fdc4257SSteve Yin 1335fdc4257SSteve Yin const ::rtl::OUString& ouStr = GetXInterface()->getAccessibleColumnDescription(column); 1345fdc4257SSteve Yin // #CHECK# 1355fdc4257SSteve Yin 1365fdc4257SSteve Yin SAFE_SYSFREESTRING(*description);//?? 1375fdc4257SSteve Yin *description = SysAllocString((OLECHAR*)ouStr.getStr()); 1385fdc4257SSteve Yin if(description==NULL) 1395fdc4257SSteve Yin return E_FAIL; 1405fdc4257SSteve Yin return S_OK; 1415fdc4257SSteve Yin 1425fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1435fdc4257SSteve Yin } 1445fdc4257SSteve Yin 1455fdc4257SSteve Yin /** 1465fdc4257SSteve Yin * Gets number of columns spanned by table cell. 1475fdc4257SSteve Yin * 1485fdc4257SSteve Yin * @param row the row of the specified cell. 1495fdc4257SSteve Yin * @param column the column of the specified cell. 1505fdc4257SSteve Yin * @param spanColumns the column span of the specified cell. 1515fdc4257SSteve Yin */ 1525fdc4257SSteve Yin STDMETHODIMP CAccTable::get_columnExtentAt(long row, long column, long * nColumnsSpanned) 1535fdc4257SSteve Yin { 1545fdc4257SSteve Yin 1555fdc4257SSteve Yin CHECK_ENABLE_INF 1565fdc4257SSteve Yin 1575fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1585fdc4257SSteve Yin 1595fdc4257SSteve Yin XAccessibleTable *pXAccTable = GetXInterface(); 1605fdc4257SSteve Yin 1615fdc4257SSteve Yin // Check pointer. 1625fdc4257SSteve Yin if(nColumnsSpanned == NULL) 1635fdc4257SSteve Yin return E_INVALIDARG; 1645fdc4257SSteve Yin 1655fdc4257SSteve Yin // Get Extent. 1665fdc4257SSteve Yin if(pXAccTable) 1675fdc4257SSteve Yin { 1685fdc4257SSteve Yin long lExt = pXAccTable->getAccessibleColumnExtentAt(row,column); 1695fdc4257SSteve Yin 1705fdc4257SSteve Yin // Fill Extent struct. 1715fdc4257SSteve Yin *nColumnsSpanned = lExt; 1725fdc4257SSteve Yin return S_OK; 1735fdc4257SSteve Yin } 1745fdc4257SSteve Yin 1755fdc4257SSteve Yin return E_FAIL; 1765fdc4257SSteve Yin 1775fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 1785fdc4257SSteve Yin } 1795fdc4257SSteve Yin 1805fdc4257SSteve Yin /** 1815fdc4257SSteve Yin * Gets accessible column header. 1825fdc4257SSteve Yin * 1835fdc4257SSteve Yin * @param column the column index. 1845fdc4257SSteve Yin * @param accessible the accessible object of the specified column. 1855fdc4257SSteve Yin */ 1865fdc4257SSteve Yin STDMETHODIMP CAccTable::get_columnHeader(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingRowIndex) 1875fdc4257SSteve Yin { 1885fdc4257SSteve Yin 1895fdc4257SSteve Yin CHECK_ENABLE_INF 1905fdc4257SSteve Yin 1915fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 1925fdc4257SSteve Yin 1935fdc4257SSteve Yin // #CHECK# 1945fdc4257SSteve Yin if(accessibleTable == NULL || startingRowIndex == NULL) 1955fdc4257SSteve Yin return E_INVALIDARG; 1965fdc4257SSteve Yin 1975fdc4257SSteve Yin // #CHECK XInterface# 1985fdc4257SSteve Yin if(!pRXTable.is()) 1995fdc4257SSteve Yin return E_FAIL; 2005fdc4257SSteve Yin 2015fdc4257SSteve Yin Reference<XAccessibleTable> pRColumnHeaderTable = GetXInterface()->getAccessibleColumnHeaders(); 2025fdc4257SSteve Yin if(!pRColumnHeaderTable.is()) 2035fdc4257SSteve Yin { 2045fdc4257SSteve Yin *accessibleTable = NULL; 2055fdc4257SSteve Yin return E_FAIL; 2065fdc4257SSteve Yin } 2075fdc4257SSteve Yin 2085fdc4257SSteve Yin Reference<XAccessible> pRXColumnHeader(pRColumnHeaderTable,UNO_QUERY); 2095fdc4257SSteve Yin 2105fdc4257SSteve Yin if(!pRXColumnHeader.is()) 2115fdc4257SSteve Yin { 2125fdc4257SSteve Yin *accessibleTable = NULL; 2135fdc4257SSteve Yin return E_FAIL; 2145fdc4257SSteve Yin } 2155fdc4257SSteve Yin *startingRowIndex = 0 ; 2165fdc4257SSteve Yin 2175fdc4257SSteve Yin IAccessible* m_pIMacc = NULL; 2185fdc4257SSteve Yin HRESULT hr = CoCreateInstance( CLSID_MAccessible, NULL, CLSCTX_ALL , 2195fdc4257SSteve Yin IID_IMAccessible, 2205fdc4257SSteve Yin (void **)&m_pIMacc 2215fdc4257SSteve Yin ); 2225fdc4257SSteve Yin ((CMAccessible*)m_pIMacc)->SetXAccessible((long)pRXColumnHeader.get()); 2235fdc4257SSteve Yin m_pIMacc->QueryInterface(IID_IAccessibleTable,(void **)accessibleTable); 2245fdc4257SSteve Yin if( SUCCEEDED(hr) ) 2255fdc4257SSteve Yin { 2265fdc4257SSteve Yin return S_OK; 2275fdc4257SSteve Yin } 2285fdc4257SSteve Yin 2295fdc4257SSteve Yin return E_FAIL; 2305fdc4257SSteve Yin 2315fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2325fdc4257SSteve Yin } 2335fdc4257SSteve Yin 2345fdc4257SSteve Yin /** 2355fdc4257SSteve Yin * Gets total number of columns in table. 2365fdc4257SSteve Yin * 2375fdc4257SSteve Yin * @param columnCount the number of columns in table. 2385fdc4257SSteve Yin */ 2395fdc4257SSteve Yin STDMETHODIMP CAccTable::get_nColumns(long * columnCount) 2405fdc4257SSteve Yin { 2415fdc4257SSteve Yin 2425fdc4257SSteve Yin CHECK_ENABLE_INF 2435fdc4257SSteve Yin 2445fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2455fdc4257SSteve Yin 2465fdc4257SSteve Yin // #CHECK# 2475fdc4257SSteve Yin if(columnCount == NULL) 2485fdc4257SSteve Yin return E_INVALIDARG; 2495fdc4257SSteve Yin 2505fdc4257SSteve Yin // #CHECK XInterface# 2515fdc4257SSteve Yin if(!pRXTable.is()) 2525fdc4257SSteve Yin return E_FAIL; 2535fdc4257SSteve Yin 2545fdc4257SSteve Yin *columnCount = GetXInterface()->getAccessibleColumnCount(); 2555fdc4257SSteve Yin return S_OK; 2565fdc4257SSteve Yin 2575fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2585fdc4257SSteve Yin } 2595fdc4257SSteve Yin 2605fdc4257SSteve Yin /** 2615fdc4257SSteve Yin * Gets total number of rows in table. 2625fdc4257SSteve Yin * 2635fdc4257SSteve Yin * @param rowCount the number of rows in table. 2645fdc4257SSteve Yin */ 2655fdc4257SSteve Yin STDMETHODIMP CAccTable::get_nRows(long * rowCount) 2665fdc4257SSteve Yin { 2675fdc4257SSteve Yin 2685fdc4257SSteve Yin CHECK_ENABLE_INF 2695fdc4257SSteve Yin 2705fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2715fdc4257SSteve Yin 2725fdc4257SSteve Yin // #CHECK# 2735fdc4257SSteve Yin if(rowCount == NULL) 2745fdc4257SSteve Yin return E_INVALIDARG; 2755fdc4257SSteve Yin 2765fdc4257SSteve Yin // #CHECK XInterface# 2775fdc4257SSteve Yin if(!pRXTable.is()) 2785fdc4257SSteve Yin return E_FAIL; 2795fdc4257SSteve Yin 2805fdc4257SSteve Yin *rowCount = GetXInterface()->getAccessibleRowCount(); 2815fdc4257SSteve Yin return S_OK; 2825fdc4257SSteve Yin 2835fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 2845fdc4257SSteve Yin } 2855fdc4257SSteve Yin 2865fdc4257SSteve Yin /** 2875fdc4257SSteve Yin * Gets total number of selected columns. 2885fdc4257SSteve Yin * 2895fdc4257SSteve Yin * @param columnCount the number of selected columns. 2905fdc4257SSteve Yin */ 2915fdc4257SSteve Yin STDMETHODIMP CAccTable::get_nSelectedColumns(long * columnCount) 2925fdc4257SSteve Yin { 2935fdc4257SSteve Yin 2945fdc4257SSteve Yin CHECK_ENABLE_INF 2955fdc4257SSteve Yin 2965fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 2975fdc4257SSteve Yin 2985fdc4257SSteve Yin // #CHECK# 2995fdc4257SSteve Yin if(columnCount == NULL) 3005fdc4257SSteve Yin return E_INVALIDARG; 3015fdc4257SSteve Yin 3025fdc4257SSteve Yin // #CHECK XInterface# 3035fdc4257SSteve Yin if(!pRXTable.is()) 3045fdc4257SSteve Yin return E_FAIL; 3055fdc4257SSteve Yin 3065fdc4257SSteve Yin Sequence<long> pSelected = GetXInterface()->getSelectedAccessibleColumns(); 3075fdc4257SSteve Yin *columnCount = pSelected.getLength(); 3085fdc4257SSteve Yin return S_OK; 3095fdc4257SSteve Yin 3105fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3115fdc4257SSteve Yin } 3125fdc4257SSteve Yin 3135fdc4257SSteve Yin /** 3145fdc4257SSteve Yin * Gets total number of selected rows. 3155fdc4257SSteve Yin * 3165fdc4257SSteve Yin * @param rowCount the number of selected rows. 3175fdc4257SSteve Yin */ 3185fdc4257SSteve Yin STDMETHODIMP CAccTable::get_nSelectedRows(long * rowCount) 3195fdc4257SSteve Yin { 3205fdc4257SSteve Yin 3215fdc4257SSteve Yin CHECK_ENABLE_INF 3225fdc4257SSteve Yin 3235fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3245fdc4257SSteve Yin 3255fdc4257SSteve Yin // #CHECK# 3265fdc4257SSteve Yin if(rowCount == NULL) 3275fdc4257SSteve Yin return E_INVALIDARG; 3285fdc4257SSteve Yin 3295fdc4257SSteve Yin // #CHECK XInterface# 3305fdc4257SSteve Yin if(!pRXTable.is()) 3315fdc4257SSteve Yin return E_FAIL; 3325fdc4257SSteve Yin 3335fdc4257SSteve Yin Sequence<long> pSelected = GetXInterface()->getSelectedAccessibleRows(); 3345fdc4257SSteve Yin *rowCount = pSelected.getLength(); 3355fdc4257SSteve Yin return S_OK; 3365fdc4257SSteve Yin 3375fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3385fdc4257SSteve Yin } 3395fdc4257SSteve Yin 3405fdc4257SSteve Yin /** 3415fdc4257SSteve Yin * Gets accessible row description (as string). 3425fdc4257SSteve Yin * 3435fdc4257SSteve Yin * @param row the row index. 3445fdc4257SSteve Yin * @param description the description of the specified row. 3455fdc4257SSteve Yin */ 3465fdc4257SSteve Yin STDMETHODIMP CAccTable::get_rowDescription(long row, BSTR * description) 3475fdc4257SSteve Yin { 3485fdc4257SSteve Yin 3495fdc4257SSteve Yin CHECK_ENABLE_INF 3505fdc4257SSteve Yin 3515fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3525fdc4257SSteve Yin 3535fdc4257SSteve Yin // #CHECK# 3545fdc4257SSteve Yin if(description == NULL) 3555fdc4257SSteve Yin return E_INVALIDARG; 3565fdc4257SSteve Yin 3575fdc4257SSteve Yin // #CHECK XInterface# 3585fdc4257SSteve Yin if(!pRXTable.is()) 3595fdc4257SSteve Yin return E_FAIL; 3605fdc4257SSteve Yin 3615fdc4257SSteve Yin const ::rtl::OUString& ouStr = GetXInterface()->getAccessibleRowDescription(row); 3625fdc4257SSteve Yin // #CHECK# 3635fdc4257SSteve Yin 3645fdc4257SSteve Yin SAFE_SYSFREESTRING(*description); 3655fdc4257SSteve Yin *description = SysAllocString((OLECHAR*)ouStr.getStr()); 3665fdc4257SSteve Yin if(description==NULL) 3675fdc4257SSteve Yin return E_FAIL; 3685fdc4257SSteve Yin 3695fdc4257SSteve Yin return S_OK; 3705fdc4257SSteve Yin 3715fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 3725fdc4257SSteve Yin } 3735fdc4257SSteve Yin 3745fdc4257SSteve Yin /** 3755fdc4257SSteve Yin * Gets number of rows spanned by a table cell. 3765fdc4257SSteve Yin * 3775fdc4257SSteve Yin * @param row the row of the specified cell. 3785fdc4257SSteve Yin * @param column the column of the specified cell. 3795fdc4257SSteve Yin * @param spanRows the row span of the specified cell. 3805fdc4257SSteve Yin */ 3815fdc4257SSteve Yin STDMETHODIMP CAccTable::get_rowExtentAt(long row, long column, long * nRowsSpanned) 3825fdc4257SSteve Yin { 3835fdc4257SSteve Yin 3845fdc4257SSteve Yin CHECK_ENABLE_INF 3855fdc4257SSteve Yin 3865fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 3875fdc4257SSteve Yin 3885fdc4257SSteve Yin XAccessibleTable *pXAccTable = GetXInterface(); 3895fdc4257SSteve Yin 3905fdc4257SSteve Yin // Check pointer. 3915fdc4257SSteve Yin if(nRowsSpanned == NULL) 3925fdc4257SSteve Yin return E_INVALIDARG; 3935fdc4257SSteve Yin 3945fdc4257SSteve Yin // Get Extent. 3955fdc4257SSteve Yin if(pXAccTable) 3965fdc4257SSteve Yin { 3975fdc4257SSteve Yin long lExt = GetXInterface()->getAccessibleRowExtentAt(row,column); 3985fdc4257SSteve Yin 3995fdc4257SSteve Yin // Fill Extent struct. 4005fdc4257SSteve Yin *nRowsSpanned= lExt; 4015fdc4257SSteve Yin 4025fdc4257SSteve Yin return S_OK; 4035fdc4257SSteve Yin } 4045fdc4257SSteve Yin 4055fdc4257SSteve Yin return E_FAIL; 4065fdc4257SSteve Yin 4075fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 4085fdc4257SSteve Yin } 4095fdc4257SSteve Yin 4105fdc4257SSteve Yin /** 4115fdc4257SSteve Yin * Gets accessible row header. 4125fdc4257SSteve Yin * 4135fdc4257SSteve Yin * @param row the row index. 4145fdc4257SSteve Yin * @param accessible the accessible object of the row header. 4155fdc4257SSteve Yin */ 4165fdc4257SSteve Yin STDMETHODIMP CAccTable::get_rowHeader(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingColumnIndex) 4175fdc4257SSteve Yin { 4185fdc4257SSteve Yin 4195fdc4257SSteve Yin CHECK_ENABLE_INF 4205fdc4257SSteve Yin 4215fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 4225fdc4257SSteve Yin 4235fdc4257SSteve Yin // #CHECK# 4245fdc4257SSteve Yin if(accessibleTable == NULL || startingColumnIndex == NULL) 4255fdc4257SSteve Yin return E_INVALIDARG; 4265fdc4257SSteve Yin 4275fdc4257SSteve Yin // #CHECK XInterface# 4285fdc4257SSteve Yin if(!pRXTable.is()) 4295fdc4257SSteve Yin return E_FAIL; 4305fdc4257SSteve Yin 4315fdc4257SSteve Yin Reference<XAccessibleTable> pRRowHeaderTable = GetXInterface()->getAccessibleRowHeaders(); 4325fdc4257SSteve Yin if(!pRRowHeaderTable.is()) 4335fdc4257SSteve Yin { 4345fdc4257SSteve Yin *accessibleTable = NULL; 4355fdc4257SSteve Yin return E_FAIL; 4365fdc4257SSteve Yin } 4375fdc4257SSteve Yin 4385fdc4257SSteve Yin Reference<XAccessible> pRXRowHeader(pRRowHeaderTable,UNO_QUERY); 4395fdc4257SSteve Yin 4405fdc4257SSteve Yin if(!pRXRowHeader.is()) 4415fdc4257SSteve Yin { 4425fdc4257SSteve Yin *accessibleTable = NULL; 4435fdc4257SSteve Yin return E_FAIL; 4445fdc4257SSteve Yin } 4455fdc4257SSteve Yin *startingColumnIndex = 0 ; 4465fdc4257SSteve Yin 4475fdc4257SSteve Yin IAccessible* m_pIMacc = NULL; 4485fdc4257SSteve Yin HRESULT hr = CoCreateInstance( CLSID_MAccessible, NULL, CLSCTX_ALL , 4495fdc4257SSteve Yin IID_IMAccessible, 4505fdc4257SSteve Yin (void **)&m_pIMacc 4515fdc4257SSteve Yin ); 4525fdc4257SSteve Yin ((CMAccessible*)m_pIMacc)->SetXAccessible((long)pRXRowHeader.get()); 4535fdc4257SSteve Yin m_pIMacc->QueryInterface(IID_IAccessibleTable,(void **)accessibleTable); 4545fdc4257SSteve Yin if( SUCCEEDED(hr) ) 4555fdc4257SSteve Yin { 4565fdc4257SSteve Yin return S_OK; 4575fdc4257SSteve Yin } 4585fdc4257SSteve Yin 4595fdc4257SSteve Yin return E_FAIL; 4605fdc4257SSteve Yin 4615fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 4625fdc4257SSteve Yin } 4635fdc4257SSteve Yin 4645fdc4257SSteve Yin /** 4655fdc4257SSteve Yin * Gets list of row indexes currently selected (0-based). 4665fdc4257SSteve Yin * 4675fdc4257SSteve Yin * @param maxRows the max number of the rows. 4685fdc4257SSteve Yin * @param accessible the accessible object array of the selected rows. 4695fdc4257SSteve Yin * @param nRows the actual size of the accessible object array. 4705fdc4257SSteve Yin */ 4715fdc4257SSteve Yin STDMETHODIMP CAccTable::get_selectedRows(long, long ** rows, long * nRows) 4725fdc4257SSteve Yin { 4735fdc4257SSteve Yin 4745fdc4257SSteve Yin CHECK_ENABLE_INF 4755fdc4257SSteve Yin 4765fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 4775fdc4257SSteve Yin 4785fdc4257SSteve Yin // #CHECK# 4795fdc4257SSteve Yin if(rows == NULL || nRows == NULL) 4805fdc4257SSteve Yin return E_INVALIDARG; 4815fdc4257SSteve Yin 4825fdc4257SSteve Yin // #CHECK XInterface# 4835fdc4257SSteve Yin if(!pRXTable.is()) 4845fdc4257SSteve Yin return E_FAIL; 4855fdc4257SSteve Yin 4865fdc4257SSteve Yin Sequence<long> pSelected = GetXInterface()->getSelectedAccessibleRows(); 4875fdc4257SSteve Yin long count = pSelected.getLength() ; 4885fdc4257SSteve Yin *nRows = count; 4895fdc4257SSteve Yin 4905fdc4257SSteve Yin *rows = reinterpret_cast<long*>(CoTaskMemAlloc((count) * sizeof(long))); 4915fdc4257SSteve Yin // #CHECK Memory Allocation# 4925fdc4257SSteve Yin if(*rows == NULL) 4935fdc4257SSteve Yin { 4945fdc4257SSteve Yin return E_FAIL; 4955fdc4257SSteve Yin } 4965fdc4257SSteve Yin for(int i=0; i<count; i++) 4975fdc4257SSteve Yin (*rows)[i] = pSelected[i]; 4985fdc4257SSteve Yin 4995fdc4257SSteve Yin return S_OK; 5005fdc4257SSteve Yin 5015fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 5025fdc4257SSteve Yin } 5035fdc4257SSteve Yin 5045fdc4257SSteve Yin /** 5055fdc4257SSteve Yin * Gets list of column indexes currently selected (0-based). 5065fdc4257SSteve Yin * 5075fdc4257SSteve Yin * @param maxColumns the max number of the columns. 5085fdc4257SSteve Yin * @param accessible the accessible object array of the selected columns. 5095fdc4257SSteve Yin * @param numColumns the actual size of accessible object array. 5105fdc4257SSteve Yin */ 5115fdc4257SSteve Yin STDMETHODIMP CAccTable::get_selectedColumns(long, long ** columns, long * numColumns) 5125fdc4257SSteve Yin { 5135fdc4257SSteve Yin 5145fdc4257SSteve Yin CHECK_ENABLE_INF 5155fdc4257SSteve Yin 5165fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 5175fdc4257SSteve Yin 5185fdc4257SSteve Yin // #CHECK# 5195fdc4257SSteve Yin if(columns == NULL || numColumns == NULL) 5205fdc4257SSteve Yin return E_INVALIDARG; 5215fdc4257SSteve Yin 5225fdc4257SSteve Yin // #CHECK XInterface# 5235fdc4257SSteve Yin if(!pRXTable.is()) 5245fdc4257SSteve Yin return E_FAIL; 5255fdc4257SSteve Yin 5265fdc4257SSteve Yin Sequence<long> pSelected = GetXInterface()->getSelectedAccessibleColumns(); 5275fdc4257SSteve Yin long count = pSelected.getLength() ; 5285fdc4257SSteve Yin *numColumns = count; 5295fdc4257SSteve Yin 5305fdc4257SSteve Yin *columns = reinterpret_cast<long*>(CoTaskMemAlloc((count) * sizeof(long))); 5315fdc4257SSteve Yin // #CHECK Memory Allocation# 5325fdc4257SSteve Yin if(*columns == NULL) 5335fdc4257SSteve Yin { 5345fdc4257SSteve Yin return E_FAIL; 5355fdc4257SSteve Yin } 5365fdc4257SSteve Yin for(int i=0; i<count; i++) 5375fdc4257SSteve Yin (*columns)[i] = pSelected[i]; 5385fdc4257SSteve Yin 5395fdc4257SSteve Yin return S_OK; 5405fdc4257SSteve Yin 5415fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 5425fdc4257SSteve Yin } 5435fdc4257SSteve Yin 5445fdc4257SSteve Yin /** 5455fdc4257SSteve Yin * Gets accessible table summary. 5465fdc4257SSteve Yin * 5475fdc4257SSteve Yin * @param accessible the accessible object of the summary. 5485fdc4257SSteve Yin */ 5495fdc4257SSteve Yin STDMETHODIMP CAccTable::get_summary(IUnknown * * accessible) 5505fdc4257SSteve Yin { 5515fdc4257SSteve Yin 5525fdc4257SSteve Yin CHECK_ENABLE_INF 5535fdc4257SSteve Yin 5545fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 5555fdc4257SSteve Yin 5565fdc4257SSteve Yin // #CHECK# 5575fdc4257SSteve Yin if(accessible == NULL) 5585fdc4257SSteve Yin return E_INVALIDARG; 5595fdc4257SSteve Yin 5605fdc4257SSteve Yin // #CHECK XInterface# 5615fdc4257SSteve Yin if(!pRXTable.is()) 5625fdc4257SSteve Yin { 5635fdc4257SSteve Yin return E_FAIL; 5645fdc4257SSteve Yin } 5655fdc4257SSteve Yin Reference<XAccessible> pRAcc = GetXInterface()->getAccessibleSummary(); 5665fdc4257SSteve Yin 5675fdc4257SSteve Yin IAccessible* pRet = NULL; 5685fdc4257SSteve Yin BOOL isTRUE = CMAccessible::get_IAccessibleFromXAccessible((long)pRAcc.get(),&pRet); 5695fdc4257SSteve Yin 5705fdc4257SSteve Yin if(pRet) 5715fdc4257SSteve Yin { 5725fdc4257SSteve Yin *accessible = (IAccessible2 *)pRet; 5735fdc4257SSteve Yin pRet->AddRef(); 5745fdc4257SSteve Yin return S_OK; 5755fdc4257SSteve Yin } 5765fdc4257SSteve Yin 5775fdc4257SSteve Yin return E_FAIL; 5785fdc4257SSteve Yin 5795fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 5805fdc4257SSteve Yin } 5815fdc4257SSteve Yin 5825fdc4257SSteve Yin /** 5835fdc4257SSteve Yin * Determines if table column is selected. 5845fdc4257SSteve Yin * 5855fdc4257SSteve Yin * @param column the column index. 5865fdc4257SSteve Yin * @param isSelected the result. 5875fdc4257SSteve Yin */ 5885fdc4257SSteve Yin STDMETHODIMP CAccTable::get_isColumnSelected(long column, unsigned char * isSelected) 5895fdc4257SSteve Yin { 5905fdc4257SSteve Yin 5915fdc4257SSteve Yin CHECK_ENABLE_INF 5925fdc4257SSteve Yin 5935fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 5945fdc4257SSteve Yin 5955fdc4257SSteve Yin // #CHECK# 5965fdc4257SSteve Yin if(isSelected == NULL) 5975fdc4257SSteve Yin return E_INVALIDARG; 5985fdc4257SSteve Yin 5995fdc4257SSteve Yin // #CHECK XInterface# 6005fdc4257SSteve Yin if(!pRXTable.is()) 6015fdc4257SSteve Yin return E_FAIL; 6025fdc4257SSteve Yin 6035fdc4257SSteve Yin *isSelected = GetXInterface()->isAccessibleColumnSelected(column); 6045fdc4257SSteve Yin return S_OK; 6055fdc4257SSteve Yin 6065fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 6075fdc4257SSteve Yin } 6085fdc4257SSteve Yin 6095fdc4257SSteve Yin /** 6105fdc4257SSteve Yin * Determines if table row is selected. 6115fdc4257SSteve Yin * 6125fdc4257SSteve Yin * @param row the row index. 6135fdc4257SSteve Yin * @param isSelected the result. 6145fdc4257SSteve Yin */ 6155fdc4257SSteve Yin STDMETHODIMP CAccTable::get_isRowSelected(long row, unsigned char * isSelected) 6165fdc4257SSteve Yin { 6175fdc4257SSteve Yin 6185fdc4257SSteve Yin CHECK_ENABLE_INF 6195fdc4257SSteve Yin 6205fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 6215fdc4257SSteve Yin 6225fdc4257SSteve Yin // #CHECK# 6235fdc4257SSteve Yin if(isSelected == NULL) 6245fdc4257SSteve Yin return E_INVALIDARG; 6255fdc4257SSteve Yin 6265fdc4257SSteve Yin // #CHECK XInterface# 6275fdc4257SSteve Yin if(!pRXTable.is()) 6285fdc4257SSteve Yin { 6295fdc4257SSteve Yin return E_FAIL; 6305fdc4257SSteve Yin } 6315fdc4257SSteve Yin *isSelected = GetXInterface()->isAccessibleRowSelected(row); 6325fdc4257SSteve Yin return S_OK; 6335fdc4257SSteve Yin 6345fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 6355fdc4257SSteve Yin } 6365fdc4257SSteve Yin 6375fdc4257SSteve Yin /** 6385fdc4257SSteve Yin * Determines if table cell is selected. 6395fdc4257SSteve Yin * 6405fdc4257SSteve Yin * @param row the row index. 6415fdc4257SSteve Yin * @param column the column index. 6425fdc4257SSteve Yin * @param isSelected the result. 6435fdc4257SSteve Yin */ 6445fdc4257SSteve Yin STDMETHODIMP CAccTable::get_isSelected(long row, long column, unsigned char * isSelected) 6455fdc4257SSteve Yin { 6465fdc4257SSteve Yin 6475fdc4257SSteve Yin CHECK_ENABLE_INF 6485fdc4257SSteve Yin 6495fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 6505fdc4257SSteve Yin 6515fdc4257SSteve Yin // #CHECK# 6525fdc4257SSteve Yin if(isSelected == NULL) 6535fdc4257SSteve Yin return E_INVALIDARG; 6545fdc4257SSteve Yin 6555fdc4257SSteve Yin // #CHECK XInterface# 6565fdc4257SSteve Yin if(!pRXTable.is()) 6575fdc4257SSteve Yin return E_FAIL; 6585fdc4257SSteve Yin 6595fdc4257SSteve Yin *isSelected = GetXInterface()->isAccessibleSelected(row,column); 6605fdc4257SSteve Yin return S_OK; 6615fdc4257SSteve Yin 6625fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 6635fdc4257SSteve Yin } 6645fdc4257SSteve Yin 6655fdc4257SSteve Yin /** 6665fdc4257SSteve Yin * Selects a row and unselect all previously selected rows. 6675fdc4257SSteve Yin * 6685fdc4257SSteve Yin * @param row the row index. 6695fdc4257SSteve Yin * @param success the result. 6705fdc4257SSteve Yin */ 6715fdc4257SSteve Yin STDMETHODIMP CAccTable::selectRow(long row) 6725fdc4257SSteve Yin { 6735fdc4257SSteve Yin 6745fdc4257SSteve Yin CHECK_ENABLE_INF 6755fdc4257SSteve Yin 6765fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 6775fdc4257SSteve Yin 6785fdc4257SSteve Yin // Check XAccessibleTable reference. 6795fdc4257SSteve Yin if(!pRXTable.is()) 6805fdc4257SSteve Yin return E_FAIL; 6815fdc4257SSteve Yin 6825fdc4257SSteve Yin Reference<XAccessibleTableSelection> pRTableExtent(pRXTable, UNO_QUERY); 6835fdc4257SSteve Yin if(pRTableExtent.is()) 6845fdc4257SSteve Yin { 6855fdc4257SSteve Yin pRTableExtent.get()->selectRow(row); 6865fdc4257SSteve Yin return S_OK; 6875fdc4257SSteve Yin } 6885fdc4257SSteve Yin else 6895fdc4257SSteve Yin { 6905fdc4257SSteve Yin // Get XAccessibleSelection. 6915fdc4257SSteve Yin Reference<XAccessibleSelection> pRSelection(GetXInterface(), UNO_QUERY); 6925fdc4257SSteve Yin if(!pRSelection.is()) 6935fdc4257SSteve Yin return E_FAIL; 6945fdc4257SSteve Yin 6955fdc4257SSteve Yin // Select row. 6965fdc4257SSteve Yin long lCol, lColumnCount, lChildIndex; 6975fdc4257SSteve Yin lColumnCount = GetXInterface()->getAccessibleColumnCount(); 6985fdc4257SSteve Yin for(lCol = 0; lCol < lColumnCount; lCol ++) 6995fdc4257SSteve Yin { 7005fdc4257SSteve Yin lChildIndex = GetXInterface()->getAccessibleIndex(row, lCol); 7015fdc4257SSteve Yin pRSelection.get()->selectAccessibleChild(lChildIndex); 7025fdc4257SSteve Yin } 7035fdc4257SSteve Yin 7045fdc4257SSteve Yin return S_OK; 7055fdc4257SSteve Yin } 7065fdc4257SSteve Yin return S_OK; 7075fdc4257SSteve Yin 7085fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 7095fdc4257SSteve Yin } 7105fdc4257SSteve Yin 7115fdc4257SSteve Yin /** 7125fdc4257SSteve Yin * Selects a column and unselect all previously selected columns. 7135fdc4257SSteve Yin * 7145fdc4257SSteve Yin * @param column the column index. 7155fdc4257SSteve Yin * @param success the result. 7165fdc4257SSteve Yin */ 7175fdc4257SSteve Yin STDMETHODIMP CAccTable::selectColumn(long column) 7185fdc4257SSteve Yin { 7195fdc4257SSteve Yin 7205fdc4257SSteve Yin CHECK_ENABLE_INF 7215fdc4257SSteve Yin 7225fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 7235fdc4257SSteve Yin 7245fdc4257SSteve Yin // Check XAccessibleTable reference. 7255fdc4257SSteve Yin if(!pRXTable.is()) 7265fdc4257SSteve Yin return E_FAIL; 7275fdc4257SSteve Yin 7285fdc4257SSteve Yin Reference<XAccessibleTableSelection> pRTableExtent(GetXInterface(), UNO_QUERY); 7295fdc4257SSteve Yin if(pRTableExtent.is()) 7305fdc4257SSteve Yin { 7315fdc4257SSteve Yin pRTableExtent.get()->selectColumn(column); 7325fdc4257SSteve Yin return S_OK; 7335fdc4257SSteve Yin } 7345fdc4257SSteve Yin else 7355fdc4257SSteve Yin { 7365fdc4257SSteve Yin // Get XAccessibleSelection. 7375fdc4257SSteve Yin Reference<XAccessibleSelection> pRSelection(pRXTable, UNO_QUERY); 7385fdc4257SSteve Yin if(!pRSelection.is()) 7395fdc4257SSteve Yin return E_FAIL; 7405fdc4257SSteve Yin 7415fdc4257SSteve Yin // Select column. 7425fdc4257SSteve Yin long lRow, lRowCount, lChildIndex; 7435fdc4257SSteve Yin lRowCount = GetXInterface()->getAccessibleRowCount(); 7445fdc4257SSteve Yin for(lRow = 0; lRow < lRowCount; lRow ++) 7455fdc4257SSteve Yin { 7465fdc4257SSteve Yin lChildIndex = GetXInterface()->getAccessibleIndex(lRow, column); 7475fdc4257SSteve Yin pRSelection.get()->selectAccessibleChild(lChildIndex); 7485fdc4257SSteve Yin } 7495fdc4257SSteve Yin 7505fdc4257SSteve Yin return S_OK; 7515fdc4257SSteve Yin } 7525fdc4257SSteve Yin return S_OK; 7535fdc4257SSteve Yin // End of added. 7545fdc4257SSteve Yin 7555fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 7565fdc4257SSteve Yin } 7575fdc4257SSteve Yin 7585fdc4257SSteve Yin /** 7595fdc4257SSteve Yin * Unselects one row, leaving other selected rows selected (if any). 7605fdc4257SSteve Yin * 7615fdc4257SSteve Yin * @param row the row index. 7625fdc4257SSteve Yin * @param success the result. 7635fdc4257SSteve Yin */ 7645fdc4257SSteve Yin STDMETHODIMP CAccTable::unselectRow(long row) 7655fdc4257SSteve Yin { 7665fdc4257SSteve Yin 7675fdc4257SSteve Yin CHECK_ENABLE_INF 7685fdc4257SSteve Yin 7695fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 7705fdc4257SSteve Yin 7715fdc4257SSteve Yin // Check XAccessibleTable reference. 7725fdc4257SSteve Yin if(!pRXTable.is()) 7735fdc4257SSteve Yin return E_FAIL; 7745fdc4257SSteve Yin 7755fdc4257SSteve Yin Reference<XAccessibleTableSelection> pRTableExtent(GetXInterface(), UNO_QUERY); 7765fdc4257SSteve Yin if(pRTableExtent.is()) 7775fdc4257SSteve Yin { 7785fdc4257SSteve Yin if(pRTableExtent.get()->unselectRow(row)) 7795fdc4257SSteve Yin return S_OK; 7805fdc4257SSteve Yin else 7815fdc4257SSteve Yin return E_FAIL; 7825fdc4257SSteve Yin } 7835fdc4257SSteve Yin else 7845fdc4257SSteve Yin { 7855fdc4257SSteve Yin // Get XAccessibleSelection. 7865fdc4257SSteve Yin Reference<XAccessibleSelection> pRSelection(pRXTable, UNO_QUERY); 7875fdc4257SSteve Yin if(!pRSelection.is()) 7885fdc4257SSteve Yin return E_FAIL; 7895fdc4257SSteve Yin 7905fdc4257SSteve Yin // Select column. 7915fdc4257SSteve Yin long lColumn, lColumnCount, lChildIndex; 7925fdc4257SSteve Yin lColumnCount = GetXInterface()->getAccessibleColumnCount(); 7935fdc4257SSteve Yin for(lColumn = 0; lColumn < lColumnCount; lColumn ++) 7945fdc4257SSteve Yin { 7955fdc4257SSteve Yin lChildIndex = GetXInterface()->getAccessibleIndex(row,lColumn); 7965fdc4257SSteve Yin pRSelection.get()->deselectAccessibleChild(lChildIndex); 7975fdc4257SSteve Yin } 7985fdc4257SSteve Yin 7995fdc4257SSteve Yin return S_OK; 8005fdc4257SSteve Yin } 8015fdc4257SSteve Yin return S_OK; 8025fdc4257SSteve Yin // End of added. 8035fdc4257SSteve Yin 8045fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 8055fdc4257SSteve Yin } 8065fdc4257SSteve Yin 8075fdc4257SSteve Yin /** 8085fdc4257SSteve Yin * Unselects one column, leaving other selected columns selected (if any). 8095fdc4257SSteve Yin * 8105fdc4257SSteve Yin * @param column the column index. 8115fdc4257SSteve Yin * @param success the result. 8125fdc4257SSteve Yin */ 8135fdc4257SSteve Yin STDMETHODIMP CAccTable::unselectColumn(long column) 8145fdc4257SSteve Yin { 8155fdc4257SSteve Yin 8165fdc4257SSteve Yin CHECK_ENABLE_INF 8175fdc4257SSteve Yin 8185fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 8195fdc4257SSteve Yin 8205fdc4257SSteve Yin // Check XAccessibleTable reference. 8215fdc4257SSteve Yin if(!pRXTable.is()) 8225fdc4257SSteve Yin return E_FAIL; 8235fdc4257SSteve Yin 8245fdc4257SSteve Yin Reference<XAccessibleTableSelection> pRTableExtent(GetXInterface(), UNO_QUERY); 8255fdc4257SSteve Yin if(pRTableExtent.is()) 8265fdc4257SSteve Yin { 8275fdc4257SSteve Yin if(pRTableExtent.get()->unselectColumn(column)) 8285fdc4257SSteve Yin return S_OK; 8295fdc4257SSteve Yin else 8305fdc4257SSteve Yin return E_FAIL; 8315fdc4257SSteve Yin } 8325fdc4257SSteve Yin else 8335fdc4257SSteve Yin { 8345fdc4257SSteve Yin // Get XAccessibleSelection. 8355fdc4257SSteve Yin Reference<XAccessibleSelection> pRSelection(pRXTable, UNO_QUERY); 8365fdc4257SSteve Yin if(!pRSelection.is()) 8375fdc4257SSteve Yin return E_FAIL; 8385fdc4257SSteve Yin 8395fdc4257SSteve Yin // Unselect columns. 8405fdc4257SSteve Yin long lRow, lRowCount, lChildIndex; 8415fdc4257SSteve Yin lRowCount = GetXInterface()->getAccessibleRowCount(); 8425fdc4257SSteve Yin 8435fdc4257SSteve Yin for(lRow = 0; lRow < lRowCount; lRow ++) 8445fdc4257SSteve Yin { 8455fdc4257SSteve Yin lChildIndex = GetXInterface()->getAccessibleIndex(lRow, column); 8465fdc4257SSteve Yin pRSelection.get()->deselectAccessibleChild(lChildIndex); 8475fdc4257SSteve Yin } 8485fdc4257SSteve Yin return S_OK; 8495fdc4257SSteve Yin } 8505fdc4257SSteve Yin 8515fdc4257SSteve Yin return S_OK; 8525fdc4257SSteve Yin 8535fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 8545fdc4257SSteve Yin } 8555fdc4257SSteve Yin 8565fdc4257SSteve Yin /** 8575fdc4257SSteve Yin * Overide of IUNOXWrapper. 8585fdc4257SSteve Yin * 8595fdc4257SSteve Yin * @param pXInterface the pointer of UNO interface. 8605fdc4257SSteve Yin */ 8615fdc4257SSteve Yin STDMETHODIMP CAccTable::put_XInterface(long pXInterface) 8625fdc4257SSteve Yin { 8635fdc4257SSteve Yin 8645fdc4257SSteve Yin CHECK_ENABLE_INF 8655fdc4257SSteve Yin 8665fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 8675fdc4257SSteve Yin 8685fdc4257SSteve Yin CUNOXWrapper::put_XInterface(pXInterface); 8695fdc4257SSteve Yin //special query. 8705fdc4257SSteve Yin if(pUNOInterface == NULL) 8715fdc4257SSteve Yin return E_INVALIDARG; 8725fdc4257SSteve Yin 8735fdc4257SSteve Yin Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext(); 8745fdc4257SSteve Yin if( !pRContext.is() ) 8755fdc4257SSteve Yin return E_FAIL; 8765fdc4257SSteve Yin 8775fdc4257SSteve Yin Reference<XAccessibleTable> pRXI(pRContext,UNO_QUERY); 8785fdc4257SSteve Yin if( !pRXI.is() ) 8795fdc4257SSteve Yin pRXTable = NULL; 8805fdc4257SSteve Yin else 8815fdc4257SSteve Yin pRXTable = pRXI.get(); 8825fdc4257SSteve Yin return S_OK; 8835fdc4257SSteve Yin 8845fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 8855fdc4257SSteve Yin } 8865fdc4257SSteve Yin 8875fdc4257SSteve Yin /** 8885fdc4257SSteve Yin * Gets columnIndex of childIndex. 8895fdc4257SSteve Yin * 8905fdc4257SSteve Yin * @param childIndex childIndex 8915fdc4257SSteve Yin */ 8925fdc4257SSteve Yin STDMETHODIMP CAccTable::get_columnIndex(long childIndex, long * columnIndex) 8935fdc4257SSteve Yin { 8945fdc4257SSteve Yin 8955fdc4257SSteve Yin CHECK_ENABLE_INF 8965fdc4257SSteve Yin 8975fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 8985fdc4257SSteve Yin 8995fdc4257SSteve Yin // #CHECK# 9005fdc4257SSteve Yin if(columnIndex == NULL) 9015fdc4257SSteve Yin return E_INVALIDARG; 9025fdc4257SSteve Yin 9035fdc4257SSteve Yin // #CHECK XInterface# 9045fdc4257SSteve Yin if(!pRXTable.is()) 9055fdc4257SSteve Yin return E_FAIL; 9065fdc4257SSteve Yin 9075fdc4257SSteve Yin *columnIndex = GetXInterface()->getAccessibleColumn(childIndex); 9085fdc4257SSteve Yin return S_OK; 9095fdc4257SSteve Yin 9105fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 9115fdc4257SSteve Yin } 9125fdc4257SSteve Yin /** 9135fdc4257SSteve Yin * Gets rowIndex of childIndex. 9145fdc4257SSteve Yin * 9155fdc4257SSteve Yin * @param childIndex childIndex 9165fdc4257SSteve Yin */ 9175fdc4257SSteve Yin STDMETHODIMP CAccTable::get_rowIndex(long childIndex, long * rowIndex) 9185fdc4257SSteve Yin { 9195fdc4257SSteve Yin 9205fdc4257SSteve Yin CHECK_ENABLE_INF 9215fdc4257SSteve Yin 9225fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 9235fdc4257SSteve Yin 9245fdc4257SSteve Yin // #CHECK# 9255fdc4257SSteve Yin if(rowIndex == NULL) 9265fdc4257SSteve Yin return E_INVALIDARG; 9275fdc4257SSteve Yin 9285fdc4257SSteve Yin // #CHECK XInterface# 9295fdc4257SSteve Yin if(!pRXTable.is()) 9305fdc4257SSteve Yin return E_FAIL; 9315fdc4257SSteve Yin 9325fdc4257SSteve Yin *rowIndex = GetXInterface()->getAccessibleRow(childIndex); 9335fdc4257SSteve Yin return S_OK; 9345fdc4257SSteve Yin 9355fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 9365fdc4257SSteve Yin } 9375fdc4257SSteve Yin /** 9385fdc4257SSteve Yin * Gets childIndex of childIndex. 9395fdc4257SSteve Yin * 9405fdc4257SSteve Yin * @param childIndex childIndex 9415fdc4257SSteve Yin */ 9425fdc4257SSteve Yin STDMETHODIMP CAccTable::get_childIndex(long RowIndex , long columnIndex, long * childIndex ) 9435fdc4257SSteve Yin { 9445fdc4257SSteve Yin 9455fdc4257SSteve Yin CHECK_ENABLE_INF 9465fdc4257SSteve Yin 9475fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 9485fdc4257SSteve Yin 9495fdc4257SSteve Yin // #CHECK# 9505fdc4257SSteve Yin if(childIndex == NULL) 9515fdc4257SSteve Yin return E_INVALIDARG; 9525fdc4257SSteve Yin 9535fdc4257SSteve Yin // #CHECK XInterface# 9545fdc4257SSteve Yin if(!pRXTable.is()) 9555fdc4257SSteve Yin return E_FAIL; 9565fdc4257SSteve Yin 9575fdc4257SSteve Yin *childIndex = GetXInterface()->getAccessibleIndex(RowIndex, columnIndex); 9585fdc4257SSteve Yin return S_OK; 9595fdc4257SSteve Yin 9605fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 9615fdc4257SSteve Yin } 9625fdc4257SSteve Yin 9635fdc4257SSteve Yin STDMETHODIMP CAccTable::get_rowColumnExtentsAtIndex(long, 9645fdc4257SSteve Yin long *, 9655fdc4257SSteve Yin long *, 9665fdc4257SSteve Yin long *, 9675fdc4257SSteve Yin long *, 9685fdc4257SSteve Yin boolean *) 9695fdc4257SSteve Yin { 9705fdc4257SSteve Yin 9715fdc4257SSteve Yin CHECK_ENABLE_INF 9725fdc4257SSteve Yin 9735fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 9745fdc4257SSteve Yin 9755fdc4257SSteve Yin return E_NOTIMPL; 9765fdc4257SSteve Yin 9775fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 9785fdc4257SSteve Yin } 9795fdc4257SSteve Yin 9805fdc4257SSteve Yin STDMETHODIMP CAccTable::get_modelChange(IA2TableModelChange *) 9815fdc4257SSteve Yin { 9825fdc4257SSteve Yin 9835fdc4257SSteve Yin return E_NOTIMPL; 9845fdc4257SSteve Yin } 9855fdc4257SSteve Yin 9865fdc4257SSteve Yin // @brief Returns the total number of selected children 9875fdc4257SSteve Yin // @param [out] childCount 9885fdc4257SSteve Yin // Number of children currently selected 9895fdc4257SSteve Yin STDMETHODIMP CAccTable::get_nSelectedChildren(long *childCount) 9905fdc4257SSteve Yin { 9915fdc4257SSteve Yin 9925fdc4257SSteve Yin CHECK_ENABLE_INF 9935fdc4257SSteve Yin 9945fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 9955fdc4257SSteve Yin 9965fdc4257SSteve Yin // #CHECK# 9975fdc4257SSteve Yin if(childCount == NULL) 9985fdc4257SSteve Yin return E_INVALIDARG; 9995fdc4257SSteve Yin 10005fdc4257SSteve Yin // #CHECK XInterface# 10015fdc4257SSteve Yin if(!pRXTable.is()) 10025fdc4257SSteve Yin return E_FAIL; 10035fdc4257SSteve Yin 10045fdc4257SSteve Yin Reference<XAccessibleSelection> pRSelection(GetXInterface(), UNO_QUERY); 10055fdc4257SSteve Yin if(!pRSelection.is()) 10065fdc4257SSteve Yin return E_FAIL; 10075fdc4257SSteve Yin 10085fdc4257SSteve Yin *childCount = pRSelection->getSelectedAccessibleChildCount(); 10095fdc4257SSteve Yin return S_OK; 10105fdc4257SSteve Yin 10115fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 10125fdc4257SSteve Yin } 10135fdc4257SSteve Yin 10145fdc4257SSteve Yin // @brief Returns a list of child indexes currently selected (0-based). 10155fdc4257SSteve Yin // @param [in] maxChildren 10165fdc4257SSteve Yin // Max children requested (possibly from IAccessibleTable::nSelectedChildren) 10175fdc4257SSteve Yin // @param [out] children 10185fdc4257SSteve Yin // array of indexes of selected children (each index is 0-based) 10195fdc4257SSteve Yin // @param [out] nChildren 10205fdc4257SSteve Yin // Length of array (not more than maxChildren) 10215fdc4257SSteve Yin STDMETHODIMP CAccTable::get_selectedChildren(long, long **children, long *nChildren) 10225fdc4257SSteve Yin { 10235fdc4257SSteve Yin 10245fdc4257SSteve Yin CHECK_ENABLE_INF 10255fdc4257SSteve Yin 10265fdc4257SSteve Yin ENTER_PROTECTED_BLOCK 10275fdc4257SSteve Yin 10285fdc4257SSteve Yin // #CHECK# 10295fdc4257SSteve Yin if(children == NULL || nChildren == NULL) 10305fdc4257SSteve Yin return E_INVALIDARG; 10315fdc4257SSteve Yin 10325fdc4257SSteve Yin // #CHECK XInterface# 10335fdc4257SSteve Yin if(!pRXTable.is()) 10345fdc4257SSteve Yin return E_FAIL; 10355fdc4257SSteve Yin 10365fdc4257SSteve Yin Reference<XAccessibleSelection> pRSelection(GetXInterface(), UNO_QUERY); 10375fdc4257SSteve Yin if(!pRSelection.is()) 10385fdc4257SSteve Yin return E_FAIL; 10395fdc4257SSteve Yin 10405fdc4257SSteve Yin long childCount = pRSelection->getSelectedAccessibleChildCount() ; 10415fdc4257SSteve Yin 10425fdc4257SSteve Yin *nChildren = childCount; 10435fdc4257SSteve Yin 10445fdc4257SSteve Yin *children = reinterpret_cast<long*>(CoTaskMemAlloc((childCount) * sizeof(long))); 10455fdc4257SSteve Yin 10465fdc4257SSteve Yin for( long i = 0; i< childCount; i++) 10475fdc4257SSteve Yin { 10485fdc4257SSteve Yin Reference<XAccessible> pRAcc = pRSelection->getSelectedAccessibleChild(i); 10495fdc4257SSteve Yin if(pRAcc.is()) 10505fdc4257SSteve Yin { 10515fdc4257SSteve Yin Reference<XAccessibleContext> pRContext(pRAcc, UNO_QUERY); 10525fdc4257SSteve Yin if( !pRContext.is() ) 10535fdc4257SSteve Yin return E_FAIL; 10545fdc4257SSteve Yin 10555fdc4257SSteve Yin long childIndex = pRContext->getAccessibleIndexInParent(); 10565fdc4257SSteve Yin (*children)[i] = childIndex; 10575fdc4257SSteve Yin } 10585fdc4257SSteve Yin } 10595fdc4257SSteve Yin 10605fdc4257SSteve Yin return S_OK; 10615fdc4257SSteve Yin 10625fdc4257SSteve Yin LEAVE_PROTECTED_BLOCK 10635fdc4257SSteve Yin 10645fdc4257SSteve Yin } 1065