From d3a20ef7994246cf383976d4aa9e502fc4406796 Mon Sep 17 00:00:00 2001 From: "surkov.alexander@gmail.com" Date: Sat, 5 May 2007 23:09:49 -0700 Subject: [PATCH] Fix for bug 379585 - implement IAccessibleTable, r=aaronlev --- accessible/src/atk/Makefile.in | 1 + .../src/atk/nsHTMLTableAccessibleWrap.h | 51 ++ .../src/base/nsAccessibilityService.cpp | 8 +- accessible/src/mac/Makefile.in | 1 + .../src/mac/nsHTMLTableAccessibleWrap.h | 51 ++ accessible/src/msaa/CAccessibleTable.cpp | 495 ++++++++++++++++++ accessible/src/msaa/CAccessibleTable.h | 175 +++++++ accessible/src/msaa/Makefile.in | 4 + .../src/msaa/nsHTMLTableAccessibleWrap.cpp | 56 ++ .../src/msaa/nsHTMLTableAccessibleWrap.h | 76 +++ accessible/src/other/Makefile.in | 1 + .../src/other/nsHTMLTableAccessibleWrap.h | 51 ++ 12 files changed, 966 insertions(+), 4 deletions(-) create mode 100644 accessible/src/atk/nsHTMLTableAccessibleWrap.h create mode 100755 accessible/src/mac/nsHTMLTableAccessibleWrap.h create mode 100755 accessible/src/msaa/CAccessibleTable.cpp create mode 100755 accessible/src/msaa/CAccessibleTable.h create mode 100755 accessible/src/msaa/nsHTMLTableAccessibleWrap.cpp create mode 100755 accessible/src/msaa/nsHTMLTableAccessibleWrap.h create mode 100755 accessible/src/other/nsHTMLTableAccessibleWrap.h diff --git a/accessible/src/atk/Makefile.in b/accessible/src/atk/Makefile.in index 7cd5bc4278ed..3b1eb3ae85ab 100644 --- a/accessible/src/atk/Makefile.in +++ b/accessible/src/atk/Makefile.in @@ -97,6 +97,7 @@ EXPORTS = \ nsXULMenuAccessibleWrap.h \ nsXULTreeAccessibleWrap.h \ nsHyperTextAccessibleWrap.h \ + nsHTMLTableAccessibleWrap \ $(NULL) # we want to force the creation of a static lib. diff --git a/accessible/src/atk/nsHTMLTableAccessibleWrap.h b/accessible/src/atk/nsHTMLTableAccessibleWrap.h new file mode 100644 index 000000000000..0e90f9d6ab32 --- /dev/null +++ b/accessible/src/atk/nsHTMLTableAccessibleWrap.h @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:expandtab:shiftwidth=2:tabstop=2: + */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alexander Surkov (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef _NSHTMLTABLEACCESSIBLEWRAP_H +#define _NSHTMLTABLEACCESSIBLEWRAP_H + +#include "nsHTMLTableAccessible.h" + +typedef class nsHTMLTableAccessible nsHTMLTableAccessibleWrap; + +typedef class nsHTMLTableHeadAccessible nsHTMLTableHeadAccessibleWrap; + +#endif + diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index 3159a9065d3f..8e503f1fe3fe 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -45,7 +45,7 @@ #include "nsHTMLImageAccessible.h" #include "nsHTMLLinkAccessible.h" #include "nsHTMLSelectAccessible.h" -#include "nsHTMLTableAccessible.h" +#include "nsHTMLTableAccessibleWrap.h" #include "nsHTMLTextAccessible.h" #include "nsHyperTextAccessibleWrap.h" #include "nsIAccessibilityService.h" @@ -746,7 +746,7 @@ nsAccessibilityService::CreateHTMLTableAccessible(nsISupports *aFrame, nsIAccess if (NS_FAILED(rv)) return rv; - *_retval = new nsHTMLTableAccessible(node, weakShell); + *_retval = new nsHTMLTableAccessibleWrap(node, weakShell); if (! *_retval) return NS_ERROR_OUT_OF_MEMORY; @@ -769,8 +769,8 @@ nsAccessibilityService::CreateHTMLTableHeadAccessible(nsIDOMNode *aDOMNode, nsIA rv = GetShellFromNode(aDOMNode, getter_AddRefs(weakShell)); NS_ENSURE_SUCCESS(rv, rv); - nsHTMLTableHeadAccessible* accTableHead = - new nsHTMLTableHeadAccessible(aDOMNode, weakShell); + nsHTMLTableHeadAccessibleWrap* accTableHead = + new nsHTMLTableHeadAccessibleWrap(aDOMNode, weakShell); NS_ENSURE_TRUE(accTableHead, NS_ERROR_OUT_OF_MEMORY); diff --git a/accessible/src/mac/Makefile.in b/accessible/src/mac/Makefile.in index 3fd715b1476b..937607f54ba6 100644 --- a/accessible/src/mac/Makefile.in +++ b/accessible/src/mac/Makefile.in @@ -82,6 +82,7 @@ EXPORTS = \ nsXULMenuAccessibleWrap.h \ nsXULTreeAccessibleWrap.h \ nsHyperTextAccessibleWrap.h \ + nsHTMLTableAccessibleWrap.h \ mozDocAccessible.h \ mozAccessible.h \ mozAccessibleWrapper.h \ diff --git a/accessible/src/mac/nsHTMLTableAccessibleWrap.h b/accessible/src/mac/nsHTMLTableAccessibleWrap.h new file mode 100755 index 000000000000..0e90f9d6ab32 --- /dev/null +++ b/accessible/src/mac/nsHTMLTableAccessibleWrap.h @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:expandtab:shiftwidth=2:tabstop=2: + */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alexander Surkov (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef _NSHTMLTABLEACCESSIBLEWRAP_H +#define _NSHTMLTABLEACCESSIBLEWRAP_H + +#include "nsHTMLTableAccessible.h" + +typedef class nsHTMLTableAccessible nsHTMLTableAccessibleWrap; + +typedef class nsHTMLTableHeadAccessible nsHTMLTableHeadAccessibleWrap; + +#endif + diff --git a/accessible/src/msaa/CAccessibleTable.cpp b/accessible/src/msaa/CAccessibleTable.cpp new file mode 100755 index 000000000000..f722cb19efc5 --- /dev/null +++ b/accessible/src/msaa/CAccessibleTable.cpp @@ -0,0 +1,495 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:expandtab:shiftwidth=2:tabstop=2: + */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alexander Surkov (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "CAccessibleTable.h" + +#include "Accessible2.h" +#include "AccessibleTable_i.c" + +#include "nsIAccessible.h" +#include "nsIAccessibleTable.h" +#include "nsIWinAccessNode.h" + +#include "nsCOMPtr.h" +#include "nsString.h" + +#define CANT_QUERY_ASSERTION_MSG \ +"Subclass of CAccessibleTable doesn't implement nsIAccessibleTable"\ + +// IUnknown + +STDMETHODIMP +CAccessibleTable::QueryInterface(REFIID iid, void** ppv) +{ + *ppv = NULL; + + if (IID_IAccessibleTable == iid) { + *ppv = NS_STATIC_CAST(IAccessibleTable*, this); + (NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef(); + return S_OK; + } + + return E_NOINTERFACE; +} + +// IAccessibleTable + +STDMETHODIMP +CAccessibleTable::get_accessibleAt(long aRow, long aColumn, + IUnknown **aAccessible) +{ + *aAccessible = NULL; + + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + nsCOMPtr cell; + tableAcc->CellRefAt(aRow, aColumn, getter_AddRefs(cell)); + + nsCOMPtr winAccessNode(do_QueryInterface(cell)); + if (!winAccessNode) + return E_FAIL; + + void *instancePtr = NULL; + nsresult rv = winAccessNode->QueryNativeInterface(IID_IAccessible2, + &instancePtr); + if (NS_FAILED(rv)) + return E_FAIL; + + *aAccessible = NS_STATIC_CAST(IUnknown*, instancePtr); + return S_OK; +} + +STDMETHODIMP +CAccessibleTable::get_caption(IUnknown **aAccessible) +{ + *aAccessible = NULL; + + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + nsCOMPtr caption; + tableAcc->GetCaption(getter_AddRefs(caption)); + + nsCOMPtr winAccessNode(do_QueryInterface(caption)); + if (!winAccessNode) + return E_FAIL; + + void *instancePtr = NULL; + nsresult rv = winAccessNode->QueryNativeInterface(IID_IAccessible2, + &instancePtr); + if (NS_FAILED(rv)) + return E_FAIL; + + *aAccessible = NS_STATIC_CAST(IUnknown*, instancePtr); + return S_OK; +} + +STDMETHODIMP +CAccessibleTable::get_childIndex(long aRowIndex, long aColumnIndex, + long *aChildIndex) +{ + *aChildIndex = 0; + + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + PRInt32 childIndex = 0; + nsresult rv = tableAcc->GetIndexAt(aRowIndex, aColumnIndex, &childIndex); + *aChildIndex = childIndex; + + return NS_FAILED(rv) ? E_FAIL : S_OK; +} + +STDMETHODIMP +CAccessibleTable::get_columnDescription(long aColumn, BSTR *aDescription) +{ + *aDescription = NULL; + + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + nsAutoString descr; + nsresult rv = tableAcc->GetColumnDescription (aColumn, descr); + if (NS_FAILED(rv)) + return E_FAIL; + + return ::SysReAllocStringLen(aDescription, descr.get(), descr.Length()); +} + +STDMETHODIMP +CAccessibleTable::get_columnExtentAt(long aRow, long aColumn, + long *nColumnsSpanned) +{ + *nColumnsSpanned = 0; + + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + PRInt32 columnsSpanned = 0; + nsresult rv = tableAcc->GetColumnExtentAt(aRow, aColumn, &columnsSpanned); + *nColumnsSpanned = columnsSpanned; + + return NS_FAILED(rv) ? E_FAIL : S_OK; +} + +STDMETHODIMP +CAccessibleTable::get_columnHeader(IAccessibleTable **aAccessibleTable, + long *aStartingRowIndex) +{ + *aAccessibleTable = NULL; + + // XXX: starting row index is always 0. + *aStartingRowIndex = 0; + + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + nsCOMPtr header; + nsresult rv = tableAcc->GetColumnHeader(getter_AddRefs(header)); + if (NS_FAILED(rv)) + return E_FAIL; + + nsCOMPtr winAccessNode(do_QueryInterface(header)); + if (!winAccessNode) + return E_FAIL; + + void *instancePtr = NULL; + rv = winAccessNode->QueryNativeInterface(IID_IAccessibleTable, &instancePtr); + if (NS_FAILED(rv)) + return E_FAIL; + + *aAccessibleTable = NS_STATIC_CAST(IAccessibleTable*, instancePtr); + return S_OK; +} + +STDMETHODIMP +CAccessibleTable::get_columnIndex(long aChildIndex, long *aColumnIndex) +{ + *aColumnIndex = 0; + + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + PRInt32 columnIndex = 0; + nsresult rv = tableAcc->GetColumnAtIndex(aChildIndex, &columnIndex); + *aColumnIndex = columnIndex; + + return NS_FAILED(rv) ? E_FAIL : S_OK; +} + +STDMETHODIMP +CAccessibleTable::get_nColumns(long *aColumnCount) +{ + *aColumnCount = 0; + + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + PRInt32 columnCount = 0; + nsresult rv = tableAcc->GetColumns(&columnCount); + *aColumnCount = columnCount; + + return NS_FAILED(rv) ? E_FAIL : S_OK; +} + +STDMETHODIMP +CAccessibleTable::get_nRows(long *aRowCount) +{ + *aRowCount = 0; + + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + PRInt32 rowCount = 0; + nsresult rv = tableAcc->GetRows(&rowCount); + *aRowCount = rowCount; + + return NS_FAILED(rv) ? E_FAIL : S_OK; +} + +STDMETHODIMP +CAccessibleTable::get_nSelectedChildren(long *aChildCount) +{ + *aChildCount = 0; + return E_NOTIMPL; +} + +STDMETHODIMP +CAccessibleTable::get_nSelectedColumns(long *aColumnCount) +{ + *aColumnCount = 0; + return E_NOTIMPL; +} + +STDMETHODIMP +CAccessibleTable::get_nSelectedRows(long *aRowCount) +{ + *aRowCount = 0; + return E_NOTIMPL; +} + +STDMETHODIMP +CAccessibleTable::get_rowDescription(long aRow, BSTR *aDescription) +{ + *aDescription = NULL; + + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + nsAutoString descr; + nsresult rv = tableAcc->GetRowDescription (aRow, descr); + if (NS_FAILED(rv)) + return E_FAIL; + + return ::SysReAllocStringLen(aDescription, descr.get(), descr.Length()); +} + +STDMETHODIMP +CAccessibleTable::get_rowExtentAt(long aRow, long aColumn, long *aNRowsSpanned) +{ + *aNRowsSpanned = 0; + + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + PRInt32 rowsSpanned = 0; + nsresult rv = tableAcc->GetRowExtentAt(aRow, aColumn, &rowsSpanned); + *aNRowsSpanned = rowsSpanned; + + return NS_FAILED(rv) ? E_FAIL : S_OK; +} + +STDMETHODIMP +CAccessibleTable::get_rowHeader(IAccessibleTable **aAccessibleTable, + long *aStartingColumnIndex) +{ + *aAccessibleTable = NULL; + + // XXX: starting column index is always 0. + *aStartingColumnIndex = 0; + + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + nsCOMPtr header; + nsresult rv = tableAcc->GetRowHeader(getter_AddRefs(header)); + if (NS_FAILED(rv)) + return E_FAIL; + + nsCOMPtr winAccessNode(do_QueryInterface(header)); + if (!winAccessNode) + return E_FAIL; + + void *instancePtr = NULL; + rv = winAccessNode->QueryNativeInterface(IID_IAccessibleTable, + &instancePtr); + if (NS_FAILED(rv)) + return E_FAIL; + + *aAccessibleTable = NS_STATIC_CAST(IAccessibleTable*, instancePtr); + return S_OK; +} + +STDMETHODIMP +CAccessibleTable::get_rowIndex(long aChildIndex, long *aRowIndex) +{ + *aRowIndex = 0; + + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + PRInt32 rowIndex = 0; + nsresult rv = tableAcc->GetRowAtIndex(aChildIndex, &rowIndex); + *aRowIndex = rowIndex; + + return NS_FAILED(rv) ? E_FAIL : S_OK; +} + +STDMETHODIMP +CAccessibleTable::get_selectedChildren(long aMaxChildren, long **aChildren, + long *nChildren) +{ + *aChildren = NULL; + *nChildren = 0; + return E_NOTIMPL; +} + +STDMETHODIMP +CAccessibleTable::get_selectedColumns(long aMaxColumns, long **aColumns, + long *aNColumns) +{ + *aColumns = NULL; + *aNColumns = 0; + return E_NOTIMPL; +} + +STDMETHODIMP +CAccessibleTable::get_selectedRows(long aMaxRows, long **aRows, long *aNRows) +{ + *aRows = NULL; + *aNRows = 0; + return E_NOTIMPL; +} + +STDMETHODIMP +CAccessibleTable::get_summary(IUnknown **aAccessible) +{ + *aAccessible = NULL; + return E_NOTIMPL; +} + +STDMETHODIMP +CAccessibleTable::get_isColumnSelected(long aColumn, boolean *aIsSelected) +{ + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + PRBool isSelected = PR_FALSE; + nsresult rv = tableAcc->IsColumnSelected(aColumn, &isSelected); + *aIsSelected = isSelected; + + return NS_FAILED(rv) ? E_FAIL : S_OK; +} + +STDMETHODIMP +CAccessibleTable::get_isRowSelected(long aRow, boolean *aIsSelected) +{ + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + PRBool isSelected = PR_FALSE; + nsresult rv = tableAcc->IsRowSelected(aRow, &isSelected); + *aIsSelected = isSelected; + + return NS_FAILED(rv) ? E_FAIL : S_OK; +} + +STDMETHODIMP +CAccessibleTable::get_isSelected(long aRow, long aColumn, boolean *aIsSelected) +{ + nsCOMPtr tableAcc(do_QueryInterface(this)); + NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG); + if (!tableAcc) + return E_FAIL; + + PRBool isSelected = PR_FALSE; + nsresult rv = tableAcc->IsCellSelected(aRow, aColumn, &isSelected); + *aIsSelected = isSelected; + + return NS_FAILED(rv) ? E_FAIL : S_OK; +} + +STDMETHODIMP +CAccessibleTable::selectRow(long aRow) +{ + return E_NOTIMPL; +} + +STDMETHODIMP +CAccessibleTable::selectColumn(long aColumn) +{ + return E_NOTIMPL; +} + +STDMETHODIMP +CAccessibleTable::unselectRow(long aRow) +{ + return E_NOTIMPL; +} + +STDMETHODIMP +CAccessibleTable::unselectColumn(long aColumn) +{ + return E_NOTIMPL; +} + +STDMETHODIMP +CAccessibleTable::get_rowColumnExtentsAtIndex(long aIndex, long *aRow, + long *aColumn, + long *aRowExtents, + long *aColumnExtents, + boolean *aIsSelected) +{ + *aRow = 0; + *aColumn = 0; + *aRowExtents = 0; + *aColumnExtents = 0; + + return E_NOTIMPL; +} + +STDMETHODIMP +CAccessibleTable::get_modelChange(IA2TableModelChange *aModelChange) +{ + aModelChange = NULL; + return E_NOTIMPL; +} + diff --git a/accessible/src/msaa/CAccessibleTable.h b/accessible/src/msaa/CAccessibleTable.h new file mode 100755 index 000000000000..dfd1c44dcb8d --- /dev/null +++ b/accessible/src/msaa/CAccessibleTable.h @@ -0,0 +1,175 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:expandtab:shiftwidth=2:tabstop=2: + */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alexander Surkov (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef _ACCESSIBLE_TABLE_H +#define _ACCESSIBLE_TABLE_H + +#include "nsISupports.h" + +#include "AccessibleTable.h" + +class CAccessibleTable: public nsISupports, + public IAccessibleTable +{ +public: + + // IUnknown + STDMETHODIMP QueryInterface(REFIID, void**); + + // IAccessibleTable + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_accessibleAt( + /* [in] */ long row, + /* [in] */ long column, + /* [retval][out] */ IUnknown **accessible); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_caption( + /* [retval][out] */ IUnknown **accessible); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_childIndex( + /* [in] */ long rowIndex, + /* [in] */ long columnIndex, + /* [retval][out] */ long *childIndex); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnDescription( + /* [in] */ long column, + /* [retval][out] */ BSTR *description); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnExtentAt( + /* [in] */ long row, + /* [in] */ long column, + /* [retval][out] */ long *nColumnsSpanned); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnHeader( + /* [out] */ IAccessibleTable **accessibleTable, + /* [retval][out] */ long *startingRowIndex); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnIndex( + /* [in] */ long childIndex, + /* [retval][out] */ long *columnIndex); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nColumns( + /* [retval][out] */ long *columnCount); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nRows( + /* [retval][out] */ long *rowCount); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelectedChildren( + /* [retval][out] */ long *childCount); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelectedColumns( + /* [retval][out] */ long *columnCount); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelectedRows( + /* [retval][out] */ long *rowCount); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowDescription( + /* [in] */ long row, + /* [retval][out] */ BSTR *description); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowExtentAt( + /* [in] */ long row, + /* [in] */ long column, + /* [retval][out] */ long *nRowsSpanned); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowHeader( + /* [out] */ IAccessibleTable **accessibleTable, + /* [retval][out] */ long *startingColumnIndex); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowIndex( + /* [in] */ long childIndex, + /* [retval][out] */ long *rowIndex); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectedChildren( + /* [in] */ long maxChildren, + /* [length_is][length_is][size_is][size_is][out] */ long **children, + /* [retval][out] */ long *nChildren); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectedColumns( + /* [in] */ long maxColumns, + /* [length_is][length_is][size_is][size_is][out] */ long **columns, + /* [retval][out] */ long *nColumns); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectedRows( + /* [in] */ long maxRows, + /* [length_is][length_is][size_is][size_is][out] */ long **rows, + /* [retval][out] */ long *nRows); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_summary( + /* [retval][out] */ IUnknown **accessible); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_isColumnSelected( + /* [in] */ long column, + /* [retval][out] */ boolean *isSelected); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_isRowSelected( + /* [in] */ long row, + /* [retval][out] */ boolean *isSelected); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_isSelected( + /* [in] */ long row, + /* [in] */ long column, + /* [retval][out] */ boolean *isSelected); + + virtual HRESULT STDMETHODCALLTYPE selectRow( + /* [in] */ long row); + + virtual HRESULT STDMETHODCALLTYPE selectColumn( + /* [in] */ long column); + + virtual HRESULT STDMETHODCALLTYPE unselectRow( + /* [in] */ long row); + + virtual HRESULT STDMETHODCALLTYPE unselectColumn( + /* [in] */ long column); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowColumnExtentsAtIndex( + /* [in] */ long index, + /* [out] */ long *row, + /* [out] */ long *column, + /* [out] */ long *rowExtents, + /* [out] */ long *columnExtents, + /* [retval][out] */ boolean *isSelected); + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_modelChange( + /* [retval][out] */ IA2TableModelChange *modelChange); +}; + +#endif + diff --git a/accessible/src/msaa/Makefile.in b/accessible/src/msaa/Makefile.in index feda8b688edf..5a86288f91af 100644 --- a/accessible/src/msaa/Makefile.in +++ b/accessible/src/msaa/Makefile.in @@ -76,8 +76,10 @@ CPPSRCS = \ nsXULMenuAccessibleWrap.cpp \ nsXULTreeAccessibleWrap.cpp \ nsHyperTextAccessibleWrap.cpp \ + nsHTMLTableAccessibleWrap.cpp \ CAccessibleText.cpp \ CAccessibleEditableText.cpp \ + CAccessibleTable.cpp \ $(NULL) EXPORTS = \ @@ -90,8 +92,10 @@ EXPORTS = \ nsXULMenuAccessibleWrap.h \ nsXULTreeAccessibleWrap.h \ nsHyperTextAccessibleWrap.h \ + nsHTMLTableAccessibleWrap.h \ CAccessibleText.h \ CAccessibleEditableText.h \ + CAccessibleTable.h \ $(NULL) # we don't want the shared lib, but we want to force the creation of a static lib. diff --git a/accessible/src/msaa/nsHTMLTableAccessibleWrap.cpp b/accessible/src/msaa/nsHTMLTableAccessibleWrap.cpp new file mode 100755 index 000000000000..55e45070c8b6 --- /dev/null +++ b/accessible/src/msaa/nsHTMLTableAccessibleWrap.cpp @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:expandtab:shiftwidth=2:tabstop=2: + */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alexander Surkov (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsHTMLTableAccessibleWrap.h" + +NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableAccessibleWrap, + nsHTMLTableAccessible) + +IMPL_IUNKNOWN_INHERITED1(nsHTMLTableAccessibleWrap, + nsAccessibleWrap, + CAccessibleTable); + +NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableHeadAccessibleWrap, + nsHTMLTableHeadAccessible) + +IMPL_IUNKNOWN_INHERITED1(nsHTMLTableHeadAccessibleWrap, + nsAccessibleWrap, + CAccessibleTable); + diff --git a/accessible/src/msaa/nsHTMLTableAccessibleWrap.h b/accessible/src/msaa/nsHTMLTableAccessibleWrap.h new file mode 100755 index 000000000000..a9c7fe1a1349 --- /dev/null +++ b/accessible/src/msaa/nsHTMLTableAccessibleWrap.h @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:expandtab:shiftwidth=2:tabstop=2: + */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alexander Surkov (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef _NSHTMLTABLEACCESSIBLEWRAP_H +#define _NSHTMLTABLEACCESSIBLEWRAP_H + +#include "nsHTMLTableAccessible.h" +#include "CAccessibleTable.h" + +class nsHTMLTableAccessibleWrap : public nsHTMLTableAccessible, + public CAccessibleTable +{ +public: + nsHTMLTableAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell) : + nsHTMLTableAccessible(aNode, aShell){} + + // IUnknown + DECL_IUNKNOWN_INHERITED + + // nsISupports + NS_DECL_ISUPPORTS_INHERITED +}; + +class nsHTMLTableHeadAccessibleWrap : public nsHTMLTableHeadAccessible, + public CAccessibleTable +{ +public: + nsHTMLTableHeadAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell) : + nsHTMLTableHeadAccessible(aNode, aShell){} + + // IUnknown + DECL_IUNKNOWN_INHERITED + + // nsISupports + NS_DECL_ISUPPORTS_INHERITED +}; + +#endif + diff --git a/accessible/src/other/Makefile.in b/accessible/src/other/Makefile.in index a08fd348b12b..94a38b2b040c 100755 --- a/accessible/src/other/Makefile.in +++ b/accessible/src/other/Makefile.in @@ -82,6 +82,7 @@ EXPORTS = \ nsXULMenuAccessibleWrap.h \ nsXULTreeAccessibleWrap.h \ nsHyperTextAccessibleWrap.h \ + nsHTMLTableAccessibleWrap.h \ $(NULL) # we don't want the shared lib, but we want to force the creation of a static lib. diff --git a/accessible/src/other/nsHTMLTableAccessibleWrap.h b/accessible/src/other/nsHTMLTableAccessibleWrap.h new file mode 100755 index 000000000000..0e90f9d6ab32 --- /dev/null +++ b/accessible/src/other/nsHTMLTableAccessibleWrap.h @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:expandtab:shiftwidth=2:tabstop=2: + */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alexander Surkov (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef _NSHTMLTABLEACCESSIBLEWRAP_H +#define _NSHTMLTABLEACCESSIBLEWRAP_H + +#include "nsHTMLTableAccessible.h" + +typedef class nsHTMLTableAccessible nsHTMLTableAccessibleWrap; + +typedef class nsHTMLTableHeadAccessible nsHTMLTableHeadAccessibleWrap; + +#endif +