1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright IBM Corporation 2010. 6 * Copyright 2000, 2010 Oracle and/or its affiliates. 7 * 8 * OpenOffice.org - a multi-platform office productivity suite 9 * 10 * This file is part of OpenOffice.org. 11 * 12 * OpenOffice.org is free software: you can redistribute it and/or modify 13 * it under the terms of the GNU Lesser General Public License version 3 14 * only, as published by the Free Software Foundation. 15 * 16 * OpenOffice.org is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Lesser General Public License version 3 for more details 20 * (a copy is included in the LICENSE file that accompanied this code). 21 * 22 * You should have received a copy of the GNU Lesser General Public License 23 * version 3 along with OpenOffice.org. If not, see 24 * <http://www.openoffice.org/license.html> 25 * for a copy of the LGPLv3 License. 26 * 27 ************************************************************************/ 28 29 #ifndef __ACCTABLE_H_ 30 #define __ACCTABLE_H_ 31 32 #include "resource.h" // main symbols 33 34 #include <com/sun/star/uno/reference.hxx> 35 #include <com/sun/star/accessibility/XAccessibleTable.hpp> 36 #include "UNOXWrapper.h" 37 38 /** 39 * CAccTable implements IAccessibleTable interface. 40 */ 41 class ATL_NO_VTABLE CAccTable : 42 public CComObjectRoot, 43 public CComCoClass<CAccTable, &CLSID_AccTable>, 44 public IAccessibleTable, 45 public CUNOXWrapper 46 47 { 48 public: 49 CAccTable() 50 { 51 } 52 virtual ~CAccTable() 53 { 54 } 55 56 BEGIN_COM_MAP(CAccTable) 57 COM_INTERFACE_ENTRY(IAccessibleTable) 58 COM_INTERFACE_ENTRY(IUNOXWrapper) 59 COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI) 60 END_COM_MAP() 61 62 static HRESULT WINAPI _SmartQI(void* pv, 63 REFIID iid, void** ppvObject, DWORD) 64 { 65 return ((CAccTable*)pv)->SmartQI(iid,ppvObject); 66 } 67 68 HRESULT SmartQI(REFIID iid, void** ppvObject) 69 { 70 if( m_pOuterUnknown ) 71 return OuterQueryInterface(iid,ppvObject); 72 return E_FAIL; 73 } 74 75 DECLARE_REGISTRY_RESOURCEID(IDR_ACCTABLE) 76 77 // IAccessibleTable 78 public: 79 // IAccessibleTable 80 81 // Gets accessible table cell. 82 STDMETHOD(get_accessibleAt)(long row, long column, IUnknown * * accessible); 83 84 // Gets accessible table caption. 85 STDMETHOD(get_caption)(IUnknown * * accessible); 86 87 // Gets accessible column description (as string). 88 STDMETHOD(get_columnDescription)(long column, BSTR * description); 89 90 // Gets number of columns spanned by table cell. 91 STDMETHOD(get_columnExtentAt)(long row, long column, long * nColumnsSpanned); 92 93 // Gets accessible column header. 94 STDMETHOD(get_columnHeader)(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingRowIndex); 95 96 // Gets total number of columns in table. 97 STDMETHOD(get_nColumns)(long * columnCount); 98 99 // Gets total number of rows in table. 100 STDMETHOD(get_nRows)(long * rowCount); 101 102 // Gets total number of selected columns. 103 STDMETHOD(get_nSelectedColumns)(long * columnCount); 104 105 // Gets total number of selected rows. 106 STDMETHOD(get_nSelectedRows)(long * rowCount); 107 108 // Gets accessible row description (as string). 109 STDMETHOD(get_rowDescription)(long row, BSTR * description); 110 111 // Gets number of rows spanned by a table cell. 112 STDMETHOD(get_rowExtentAt)(long row, long column, long * nRowsSpanned); 113 114 // Gets accessible row header. 115 STDMETHOD(get_rowHeader)(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingColumnIndex); 116 117 // Gets list of row indexes currently selected (0-based). 118 STDMETHOD(get_selectedRows)(long maxRows, long **rows, long * nRows); 119 120 // Gets list of column indexes currently selected (0-based). 121 STDMETHOD(get_selectedColumns)(long maxColumns, long **columns, long * numColumns); 122 123 // Gets accessible table summary. 124 STDMETHOD(get_summary)(IUnknown * * accessible); 125 126 // Determines if table column is selected. 127 STDMETHOD(get_isColumnSelected)(long column, unsigned char * isSelected); 128 129 // Determines if table row is selected. 130 STDMETHOD(get_isRowSelected)(long row, unsigned char * isSelected); 131 132 // Determines if table cell is selected. 133 STDMETHOD(get_isSelected)(long row, long column, unsigned char * isSelected); 134 135 // Selects a row and unselect all previously selected rows. 136 STDMETHOD(selectRow)(long row ); 137 138 139 // Selects a column and unselect all previously selected columns. 140 141 STDMETHOD(selectColumn)(long column); 142 143 // Unselects one row, leaving other selected rows selected (if any). 144 STDMETHOD(unselectRow)(long row); 145 146 // Unselects one column, leaving other selected columns selected (if any). 147 STDMETHOD(unselectColumn)(long column); 148 149 //get Column index 150 STDMETHOD(get_columnIndex)(long childIndex, long * columnIndex); 151 152 STDMETHOD(get_rowIndex)(long childIndex, long * rowIndex); 153 154 STDMETHOD(get_childIndex)(long rowIndex,long columnIndex, long * childIndex); 155 156 STDMETHOD(get_nSelectedChildren)(long *childCount); 157 158 STDMETHOD(get_selectedChildren)(long maxChildren, long **children, long *nChildren); 159 160 STDMETHOD(get_rowColumnExtentsAtIndex)( long index, 161 long *row, 162 long *column, 163 long *rowExtents, 164 long *columnExtents, 165 boolean *isSelected) ; 166 167 STDMETHOD(get_modelChange)(IA2TableModelChange *modelChange); 168 169 // Overide of IUNOXWrapper. 170 STDMETHOD(put_XInterface)(long pXInterface); 171 172 private: 173 174 com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleTable> pRXTable; 175 176 inline com::sun::star::accessibility::XAccessibleTable* GetXInterface() 177 { 178 return pRXTable.get(); 179 } 180 }; 181 182 #endif //__ACCTABLE_H_ 183