Back to index

lightning-sunbird  0.9+nobinonly
nsHTMLTableAccessibleWrap.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: NPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public
00006  * License Version 1.1 (the "License"); you may not use this file
00007  * except in compliance with the License. You may obtain a copy of
00008  * the License at http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS
00011  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
00012  * implied. See the License for the specific language governing
00013  * rights and limitations under the License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is Sun Microsystems, Inc.
00018  * Portions created by Sun Microsystems are Copyright (C) 2002 Sun
00019  * Microsystems, Inc. All Rights Reserved.
00020  *
00021  * Original Author: Pete Zha (pete.zha@sun.com)
00022  *
00023  * Contributor(s):
00024  *   Kyle Yuan (kyle.yuan@sun.com)
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either the GNU General Public License Version 2 or later (the "GPL"), or
00028  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the NPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the NPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #include "nsHTMLTableAccessibleWrap.h"
00041 #include "nsIAccessibilityService.h"
00042 #include "nsIDOMElement.h"
00043 #include "nsIDOMHTMLCollection.h"
00044 #include "nsIDOMHTMLTableCaptionElem.h"
00045 #include "nsIDOMHTMLTableCellElement.h"
00046 #include "nsIDOMHTMLTableElement.h"
00047 #include "nsIDOMHTMLTableRowElement.h"
00048 #include "nsIDOMHTMLTableSectionElem.h"
00049 #include "nsIDocument.h"
00050 #include "nsIPresShell.h"
00051 #include "nsIServiceManager.h"
00052 #include "nsITableLayout.h"
00053 
00054 // --------------------------------------------------------
00055 // nsHTMLTableCellAccessibleWrap Accessible
00056 // --------------------------------------------------------
00057 NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTableCellAccessibleWrap, nsHTMLTableCellAccessible, nsIAccessibleText, nsIAccessibleHyperText)
00058 
00059 nsHTMLTableCellAccessibleWrap::nsHTMLTableCellAccessibleWrap(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
00060 nsHTMLTableCellAccessible(aDomNode, aShell), nsAccessibleHyperText(aDomNode, aShell)
00061 {
00062 }
00063 
00064 NS_IMETHODIMP nsHTMLTableCellAccessibleWrap::Shutdown()
00065 {
00066   nsAccessibleHyperText::Shutdown();
00067   return nsHTMLTableCellAccessible::Shutdown();
00068 }
00069 
00070 // --------------------------------------------------------
00071 // nsHTMLTableAccessibleWrap Accessible
00072 // --------------------------------------------------------
00073 NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableAccessibleWrap, nsHTMLTableAccessible, nsIAccessibleTable)
00074 
00075 nsHTMLTableAccessibleWrap::nsHTMLTableAccessibleWrap(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
00076 nsHTMLTableAccessible(aDomNode, aShell)
00077 {
00078 }
00079 
00080 NS_IMETHODIMP
00081 nsHTMLTableAccessibleWrap::GetCaption(nsIAccessible **aCaption)
00082 {
00083   *aCaption = nsnull;
00084   nsresult rv = NS_OK;
00085 
00086   nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
00087   NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
00088 
00089   nsCOMPtr<nsIDOMHTMLTableCaptionElement> caption;
00090   rv = table->GetCaption(getter_AddRefs(caption));
00091   NS_ENSURE_SUCCESS(rv, rv);
00092 
00093   nsCOMPtr<nsIDOMNode> captionNode(do_QueryInterface(caption));
00094   NS_ENSURE_TRUE(captionNode, NS_ERROR_FAILURE);
00095 
00096   nsCOMPtr<nsIAccessibilityService>
00097     accService(do_GetService("@mozilla.org/accessibilityService;1"));
00098   NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
00099 
00100   accService->GetCachedAccessible(captionNode, mWeakShell, aCaption);
00101   if (*aCaption)
00102     return NS_OK;
00103 
00104   return accService->CreateHTMLTableCaptionAccessible(captionNode, aCaption);
00105 }
00106 
00107 NS_IMETHODIMP
00108 nsHTMLTableAccessibleWrap::SetCaption(nsIAccessible *aCaption)
00109 {
00110   nsresult rv = NS_OK;
00111 
00112   nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
00113   NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
00114 
00115   nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(aCaption));
00116   NS_ASSERTION(accessNode, "Unable to QI to nsIAccessNode");
00117   nsCOMPtr<nsIDOMNode> domNode;
00118   rv = accessNode->GetDOMNode(getter_AddRefs(domNode));
00119   NS_ENSURE_SUCCESS(rv, rv);
00120 
00121   nsCOMPtr<nsIDOMNode> newDOMNode;
00122   rv = domNode->CloneNode(PR_TRUE, getter_AddRefs(newDOMNode));
00123   NS_ENSURE_SUCCESS(rv, rv);
00124 
00125   nsCOMPtr<nsIDOMHTMLTableCaptionElement>
00126     captionElement(do_QueryInterface(newDOMNode));
00127   NS_ENSURE_TRUE(captionElement, NS_ERROR_FAILURE);
00128 
00129   return table->SetCaption(captionElement);
00130 }
00131 
00132 NS_IMETHODIMP
00133 nsHTMLTableAccessibleWrap::GetSummary(nsAString &aSummary)
00134 {
00135   nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
00136   NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
00137 
00138   return table->GetSummary(aSummary);
00139 }
00140 
00141 NS_IMETHODIMP
00142 nsHTMLTableAccessibleWrap::SetSummary(const nsAString &aSummary)
00143 {
00144   nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
00145   NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
00146 
00147   return table->SetSummary(aSummary);
00148 }
00149 
00150 NS_IMETHODIMP
00151 nsHTMLTableAccessibleWrap::GetColumns(PRInt32 *aColumns)
00152 {
00153   nsITableLayout *tableLayout;
00154   nsresult rv = GetTableLayout(&tableLayout);
00155   NS_ENSURE_SUCCESS(rv, rv);
00156 
00157   PRInt32 rows;
00158   return tableLayout->GetTableSize(rows, *aColumns);
00159 }
00160 
00161 NS_IMETHODIMP
00162 nsHTMLTableAccessibleWrap::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
00163 {
00164   nsresult rv = NS_OK;
00165 
00166   nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
00167   NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
00168 
00169   nsCOMPtr<nsIDOMHTMLTableSectionElement> section;
00170   rv = table->GetTHead(getter_AddRefs(section));
00171   NS_ENSURE_SUCCESS(rv, rv);
00172 
00173   nsCOMPtr<nsIAccessibilityService>
00174     accService(do_GetService("@mozilla.org/accessibilityService;1"));
00175   NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
00176 
00177   nsCOMPtr<nsIAccessible> accHead;
00178   nsCOMPtr<nsIDOMNode> sectionNode(do_QueryInterface(section));
00179   if (sectionNode) {
00180     rv = accService->GetCachedAccessible(sectionNode, mWeakShell,
00181                                     getter_AddRefs(accHead));
00182   }
00183 
00184   if (!accHead) {
00185     rv = accService->CreateHTMLTableHeadAccessible(section,
00186                                                    getter_AddRefs(accHead));
00187   }
00188   NS_ENSURE_SUCCESS(rv, rv);
00189 
00190   nsCOMPtr<nsIAccessibleTable> accTableHead(do_QueryInterface(accHead));
00191   NS_ENSURE_TRUE(accTableHead, NS_ERROR_FAILURE);
00192 
00193   *aColumnHeader = accTableHead;
00194   NS_IF_ADDREF(*aColumnHeader);
00195 
00196   return rv;
00197 }
00198 
00199 NS_IMETHODIMP
00200 nsHTMLTableAccessibleWrap::GetRows(PRInt32 *aRows)
00201 {
00202   nsITableLayout *tableLayout;
00203   nsresult rv = GetTableLayout(&tableLayout);
00204   NS_ENSURE_SUCCESS(rv, rv);
00205 
00206   PRInt32 columns;
00207   return tableLayout->GetTableSize(*aRows, columns);
00208 }
00209 
00210 NS_IMETHODIMP
00211 nsHTMLTableAccessibleWrap::GetRowHeader(nsIAccessibleTable **aRowHeader)
00212 {
00213   // Can not implement because there is no row header in html table
00214   return NS_ERROR_NOT_IMPLEMENTED;
00215 }
00216 
00217 NS_IMETHODIMP
00218 nsHTMLTableAccessibleWrap::GetSelectedColumns(PRUint32 *aNumColumns,
00219                                           PRInt32 **aColumns)
00220 {
00221   nsresult rv = NS_OK;
00222 
00223   PRInt32 columnCount;
00224   rv = GetColumns(&columnCount);
00225   NS_ENSURE_SUCCESS(rv, rv);
00226 
00227   PRBool *states = new PRBool[columnCount];
00228   NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
00229 
00230   *aNumColumns = 0;
00231   PRInt32 index;
00232   for (index = 0; index < columnCount; index++) {
00233     rv = IsColumnSelected(index, &states[index]);
00234     NS_ENSURE_SUCCESS(rv, rv);
00235 
00236     if (states[index]) {
00237       (*aNumColumns)++;
00238     }
00239   }
00240 
00241   PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumColumns) * sizeof(PRInt32));
00242   if (!outArray) {
00243     delete []states;
00244     return NS_ERROR_OUT_OF_MEMORY;
00245   }
00246 
00247   PRInt32 curr = 0;
00248   for (index = 0; index < columnCount; index++) {
00249     if (states[index]) {
00250       outArray[curr++] = index;
00251     }
00252   }
00253 
00254   delete []states;
00255   *aColumns = outArray;
00256   return rv;
00257 }
00258 
00259 NS_IMETHODIMP
00260 nsHTMLTableAccessibleWrap::GetSelectedRows(PRUint32 *aNumRows, PRInt32 **aRows)
00261 {
00262   nsresult rv = NS_OK;
00263 
00264   PRInt32 rowCount;
00265   rv = GetRows(&rowCount);
00266   NS_ENSURE_SUCCESS(rv, rv);
00267 
00268   PRBool *states = new PRBool[rowCount];
00269   NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
00270 
00271   *aNumRows = 0;
00272   PRInt32 index;
00273   for (index = 0; index < rowCount; index++) {
00274     rv = IsRowSelected(index, &states[index]);
00275     NS_ENSURE_SUCCESS(rv, rv);
00276 
00277     if (states[index]) {
00278       (*aNumRows)++;
00279     }
00280   }
00281 
00282   PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumRows) * sizeof(PRInt32));
00283   if (!outArray) {
00284     delete []states;
00285     return NS_ERROR_OUT_OF_MEMORY;
00286   }
00287 
00288   PRInt32 curr = 0;
00289   for (index = 0; index < rowCount; index++) {
00290     if (states[index]) {
00291       outArray[curr++] = index;
00292     }
00293   }
00294 
00295   delete []states;
00296   *aRows = outArray;
00297   return rv;
00298 }
00299 
00300 NS_IMETHODIMP
00301 nsHTMLTableAccessibleWrap::CellRefAt(PRInt32 aRow, PRInt32 aColumn,
00302                                  nsIAccessible **aTableCellAccessible)
00303 {
00304   nsresult rv = NS_OK;
00305 
00306   nsCOMPtr<nsIDOMElement> cellElement;
00307   rv = GetCellAt(aRow, aColumn, *getter_AddRefs(cellElement));
00308   NS_ENSURE_SUCCESS(rv, rv);
00309 
00310   nsCOMPtr<nsIAccessibilityService>
00311     accService(do_GetService("@mozilla.org/accessibilityService;1"));
00312   NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
00313 
00314   return accService->GetAccessibleInWeakShell(cellElement, mWeakShell,
00315                                               aTableCellAccessible);
00316 }
00317 
00318 NS_IMETHODIMP
00319 nsHTMLTableAccessibleWrap::GetIndexAt(PRInt32 aRow, PRInt32 aColumn,
00320                                   PRInt32 *_retval)
00321 {
00322   NS_ENSURE_ARG_POINTER(_retval);
00323 
00324   nsresult rv = NS_OK;
00325 
00326   PRInt32 columns;
00327   rv = GetColumns(&columns);
00328   NS_ENSURE_SUCCESS(rv, rv);
00329 
00330   *_retval = aRow * columns + aColumn;
00331 
00332   return NS_OK;
00333 }
00334 
00335 NS_IMETHODIMP
00336 nsHTMLTableAccessibleWrap::GetColumnAtIndex(PRInt32 aIndex, PRInt32 *_retval)
00337 {
00338   NS_ENSURE_ARG_POINTER(_retval);
00339 
00340   nsresult rv = NS_OK;
00341 
00342   PRInt32 columns;
00343   rv = GetColumns(&columns);
00344   NS_ENSURE_SUCCESS(rv, rv);
00345 
00346   *_retval = aIndex % columns;
00347 
00348   return NS_OK;
00349 }
00350 
00351 NS_IMETHODIMP
00352 nsHTMLTableAccessibleWrap::GetRowAtIndex(PRInt32 aIndex, PRInt32 *_retval)
00353 {
00354   NS_ENSURE_ARG_POINTER(_retval);
00355 
00356   nsresult rv = NS_OK;
00357 
00358   PRInt32 columns;
00359   rv = GetColumns(&columns);
00360   NS_ENSURE_SUCCESS(rv, rv);
00361 
00362   *_retval = aIndex / columns;
00363 
00364   return NS_OK;
00365 }
00366 
00367 NS_IMETHODIMP
00368 nsHTMLTableAccessibleWrap::GetColumnExtentAt(PRInt32 aRow, PRInt32 aColumn,
00369                                          PRInt32 *_retval)
00370 {
00371   nsresult rv = NS_OK;
00372 
00373   nsCOMPtr<nsIDOMElement> domElement;
00374   rv = GetCellAt(aRow, aColumn, *getter_AddRefs(domElement));
00375   NS_ENSURE_SUCCESS(rv, rv);
00376 
00377   nsCOMPtr<nsIDOMHTMLTableCellElement> cell(do_QueryInterface(domElement));
00378   NS_ENSURE_TRUE(cell, NS_ERROR_FAILURE);
00379 
00380   return cell->GetColSpan(_retval);
00381 }
00382 
00383 NS_IMETHODIMP
00384 nsHTMLTableAccessibleWrap::GetRowExtentAt(PRInt32 aRow, PRInt32 aColumn,
00385                                       PRInt32 *_retval)
00386 {
00387   nsresult rv = NS_OK;
00388 
00389   nsCOMPtr<nsIDOMElement> domElement;
00390   rv = GetCellAt(aRow, aColumn, *getter_AddRefs(domElement));
00391   NS_ENSURE_SUCCESS(rv, rv);
00392 
00393   nsCOMPtr<nsIDOMHTMLTableCellElement> cell(do_QueryInterface(domElement));
00394   NS_ENSURE_TRUE(cell, NS_ERROR_FAILURE);
00395 
00396   return cell->GetRowSpan(_retval);
00397 }
00398 
00399 NS_IMETHODIMP
00400 nsHTMLTableAccessibleWrap::GetColumnDescription(PRInt32 aColumn, nsAString &_retval)
00401 {
00402   return NS_ERROR_NOT_IMPLEMENTED;
00403 }
00404 
00405 NS_IMETHODIMP
00406 nsHTMLTableAccessibleWrap::GetRowDescription(PRInt32 aRow, nsAString &_retval)
00407 {
00408   return NS_ERROR_NOT_IMPLEMENTED;
00409 }
00410 
00411 NS_IMETHODIMP
00412 nsHTMLTableAccessibleWrap::IsColumnSelected(PRInt32 aColumn, PRBool *_retval)
00413 {
00414   NS_ENSURE_ARG_POINTER(_retval);
00415 
00416   nsresult rv = NS_OK;
00417 
00418   PRInt32 rows;
00419   rv = GetRows(&rows);
00420   NS_ENSURE_SUCCESS(rv, rv);
00421 
00422   for (PRInt32 index = 0; index < rows; index++) {
00423     rv = IsCellSelected(index, aColumn, _retval);
00424     NS_ENSURE_SUCCESS(rv, rv);
00425     if (!*_retval) {
00426       break;
00427     }
00428   }
00429 
00430   return rv;
00431 }
00432 
00433 NS_IMETHODIMP
00434 nsHTMLTableAccessibleWrap::IsRowSelected(PRInt32 aRow, PRBool *_retval)
00435 {
00436   NS_ENSURE_ARG_POINTER(_retval);
00437 
00438   nsresult rv = NS_OK;
00439 
00440   PRInt32 columns;
00441   rv = GetColumns(&columns);
00442   NS_ENSURE_SUCCESS(rv, rv);
00443 
00444   for (PRInt32 index = 0; index < columns; index++) {
00445     rv = IsCellSelected(aRow, index, _retval);
00446     NS_ENSURE_SUCCESS(rv, rv);
00447     if (!*_retval) {
00448       break;
00449     }
00450   }
00451 
00452   return rv;
00453 }
00454 
00455 NS_IMETHODIMP
00456 nsHTMLTableAccessibleWrap::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
00457                                       PRBool *_retval)
00458 {
00459   nsITableLayout *tableLayout;
00460   nsresult rv = GetTableLayout(&tableLayout);
00461   NS_ENSURE_SUCCESS(rv, rv);
00462 
00463   nsCOMPtr<nsIDOMElement> domElement;
00464   PRInt32 startRowIndex = 0, startColIndex = 0,
00465           rowSpan, colSpan, actualRowSpan, actualColSpan;
00466 
00467   return tableLayout->GetCellDataAt(aRow, aColumn,
00468                                     *getter_AddRefs(domElement),
00469                                     startRowIndex, startColIndex, rowSpan,
00470                                     colSpan, actualRowSpan, actualColSpan,
00471                                     *_retval);
00472 }
00473 
00474 nsresult
00475 nsHTMLTableAccessibleWrap::GetTableNode(nsIDOMNode **_retval)
00476 {
00477   nsresult rv = NS_OK;
00478 
00479   nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
00480   if (table) {
00481     *_retval = table;
00482     NS_IF_ADDREF(*_retval);
00483     return rv;
00484   }
00485 
00486   nsCOMPtr<nsIDOMHTMLTableSectionElement> section(do_QueryInterface(mDOMNode));
00487   if (section) {
00488     nsCOMPtr<nsIDOMNode> parent;
00489     rv = section->GetParentNode(getter_AddRefs(parent));
00490     NS_ENSURE_SUCCESS(rv, rv);
00491 
00492     *_retval = parent;
00493     NS_IF_ADDREF(*_retval);
00494     return rv;
00495   }
00496 
00497   return NS_ERROR_FAILURE;
00498 }
00499 
00500 nsresult
00501 nsHTMLTableAccessibleWrap::GetTableLayout(nsITableLayout **aLayoutObject)
00502 {
00503   *aLayoutObject = nsnull;
00504 
00505   nsresult rv = NS_OK;
00506 
00507   nsCOMPtr<nsIDOMNode> tableNode;
00508   rv = GetTableNode(getter_AddRefs(tableNode));
00509   NS_ENSURE_SUCCESS(rv, rv);
00510 
00511   nsCOMPtr<nsIContent> content(do_QueryInterface(tableNode));
00512   NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
00513 
00514   nsIPresShell *presShell = content->GetDocument()->GetShellAt(0);
00515 
00516   nsCOMPtr<nsISupports> layoutObject;
00517   rv = presShell->GetLayoutObjectFor(content, getter_AddRefs(layoutObject));
00518   NS_ENSURE_SUCCESS(rv, rv);
00519 
00520   return CallQueryInterface(layoutObject, aLayoutObject);
00521 }
00522 
00523 nsresult
00524 nsHTMLTableAccessibleWrap::GetCellAt(PRInt32        aRowIndex,
00525                                  PRInt32        aColIndex,
00526                                  nsIDOMElement* &aCell)
00527 {
00528   PRInt32 startRowIndex = 0, startColIndex = 0,
00529           rowSpan, colSpan, actualRowSpan, actualColSpan;
00530   PRBool isSelected;
00531 
00532   nsITableLayout *tableLayout;
00533   nsresult rv = GetTableLayout(&tableLayout);
00534   NS_ENSURE_SUCCESS(rv, rv);
00535 
00536   return tableLayout->GetCellDataAt(aRowIndex, aColIndex, aCell,
00537                                     startRowIndex, startColIndex,
00538                                     rowSpan, colSpan,
00539                                     actualRowSpan, actualColSpan,
00540                                     isSelected);
00541 }
00542 
00543 // --------------------------------------------------------
00544 // nsHTMLTableHeadAccessible Accessible
00545 // --------------------------------------------------------
00546 NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableHeadAccessible, nsHTMLTableAccessibleWrap)
00547 
00548 nsHTMLTableHeadAccessible::nsHTMLTableHeadAccessible(nsIDOMNode *aDomNode, nsIWeakReference *aShell):
00549 nsHTMLTableAccessibleWrap(aDomNode, aShell)
00550 {
00551   Init(); // Make sure this generated accessible of the table is cached
00552 }
00553 
00554 NS_IMETHODIMP
00555 nsHTMLTableHeadAccessible::GetRole(PRUint32 *aResult)
00556 {
00557   *aResult = ROLE_COLUMNHEADER;
00558   return NS_OK;
00559 }
00560 
00561 NS_IMETHODIMP
00562 nsHTMLTableHeadAccessible::GetCaption(nsIAccessible **aCaption)
00563 {
00564   return NS_ERROR_NOT_IMPLEMENTED;
00565 }
00566 
00567 NS_IMETHODIMP
00568 nsHTMLTableHeadAccessible::SetCaption(nsIAccessible *aCaption)
00569 {
00570   return NS_ERROR_NOT_IMPLEMENTED;
00571 }
00572 
00573 NS_IMETHODIMP
00574 nsHTMLTableHeadAccessible::GetSummary(nsAString &aSummary)
00575 {
00576   return NS_ERROR_NOT_IMPLEMENTED;
00577 }
00578 
00579 NS_IMETHODIMP
00580 nsHTMLTableHeadAccessible::SetSummary(const nsAString &aSummary)
00581 {
00582   return NS_ERROR_NOT_IMPLEMENTED;
00583 }
00584 
00585 NS_IMETHODIMP
00586 nsHTMLTableHeadAccessible::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
00587 {
00588   return NS_ERROR_NOT_IMPLEMENTED;
00589 }
00590 
00591 NS_IMETHODIMP
00592 nsHTMLTableHeadAccessible::GetRows(PRInt32 *aRows)
00593 {
00594   nsresult rv = NS_OK;
00595 
00596   nsCOMPtr<nsIDOMHTMLTableSectionElement> head(do_QueryInterface(mDOMNode));
00597   NS_ENSURE_TRUE(head, NS_ERROR_FAILURE);
00598 
00599   nsCOMPtr<nsIDOMHTMLCollection> rows;
00600   rv = head->GetRows(getter_AddRefs(rows));
00601   NS_ENSURE_SUCCESS(rv, rv);
00602 
00603   return rows->GetLength((PRUint32 *)aRows);
00604 }