LCOV - code coverage report
Current view: directory - accessible/src/html - nsHTMLTableAccessible.h (source / functions) Found Hit Coverage
Test: app.info Lines: 9 0 0.0 %
Date: 2012-06-02 Functions: 10 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is mozilla.org code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Netscape Communications Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 1998
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Author: Aaron Leventhal (aaronl@netscape.com)
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #ifndef _nsHTMLTableAccessible_H_
      40                 : #define _nsHTMLTableAccessible_H_
      41                 : 
      42                 : #include "nsHyperTextAccessibleWrap.h"
      43                 : #include "nsIAccessibleTable.h"
      44                 : 
      45                 : class nsITableLayout;
      46                 : class nsITableCellLayout;
      47                 : 
      48                 : /**
      49                 :  * HTML table cell accessible (html:td).
      50                 :  */
      51                 : class nsHTMLTableCellAccessible : public nsHyperTextAccessibleWrap,
      52                 :                                   public nsIAccessibleTableCell
      53               0 : {
      54                 : public:
      55                 :   nsHTMLTableCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
      56                 : 
      57                 :   // nsISupports
      58                 :   NS_DECL_ISUPPORTS_INHERITED
      59                 : 
      60                 :   // nsIAccessibleTableCell
      61                 :   NS_DECL_NSIACCESSIBLETABLECELL
      62                 : 
      63                 :   // nsAccessible
      64                 :   virtual mozilla::a11y::role NativeRole();
      65                 :   virtual PRUint64 NativeState();
      66                 :   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
      67                 : 
      68                 : protected:
      69                 :   /**
      70                 :    * Return host table accessible.
      71                 :    */
      72                 :   already_AddRefed<nsIAccessibleTable> GetTableAccessible();
      73                 :   
      74                 :   /**
      75                 :    * Return nsITableCellLayout of the table cell frame.
      76                 :    */
      77                 :   nsITableCellLayout* GetCellLayout();
      78                 : 
      79                 :   /**
      80                 :    * Return row and column indices of the cell.
      81                 :    */
      82                 :   nsresult GetCellIndexes(PRInt32& aRowIdx, PRInt32& aColIdx);
      83                 :   
      84                 :   /**
      85                 :    * Return an array of row or column header cells.
      86                 :    */
      87                 :   nsresult GetHeaderCells(PRInt32 aRowOrColumnHeaderCell,
      88                 :                           nsIArray **aHeaderCells);
      89                 : };
      90                 : 
      91                 : 
      92                 : /**
      93                 :  * HTML table row/column header accessible (html:th or html:td@scope).
      94                 :  */
      95                 : class nsHTMLTableHeaderCellAccessible : public nsHTMLTableCellAccessible
      96               0 : {
      97                 : public:
      98                 :   nsHTMLTableHeaderCellAccessible(nsIContent* aContent,
      99                 :                                   nsDocAccessible* aDoc);
     100                 : 
     101                 :   // nsAccessible
     102                 :   virtual mozilla::a11y::role NativeRole();
     103                 : };
     104                 : 
     105                 : 
     106                 : /**
     107                 :  * HTML table accessible (html:table).
     108                 :  */
     109                 : 
     110                 : // To turn on table debugging descriptions define SHOW_LAYOUT_HEURISTIC
     111                 : // This allow release trunk builds to be used by testers to refine the
     112                 : // data vs. layout heuristic
     113                 : // #define SHOW_LAYOUT_HEURISTIC
     114                 : 
     115                 : #define NS_TABLEACCESSIBLE_IMPL_CID                     \
     116                 : {  /* 8d6d9c40-74bd-47ac-88dc-4a23516aa23d */           \
     117                 :   0x8d6d9c40,                                           \
     118                 :   0x74bd,                                               \
     119                 :   0x47ac,                                               \
     120                 :   { 0x88, 0xdc, 0x4a, 0x23, 0x51, 0x6a, 0xa2, 0x3d }    \
     121                 : }
     122                 : 
     123                 : class nsHTMLTableAccessible : public nsAccessibleWrap,
     124                 :                               public nsIAccessibleTable
     125               0 : {
     126                 : public:
     127                 :   nsHTMLTableAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
     128                 : 
     129                 :   NS_DECL_ISUPPORTS_INHERITED
     130                 :   NS_DECL_NSIACCESSIBLETABLE
     131                 :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_TABLEACCESSIBLE_IMPL_CID)
     132                 : 
     133                 :   // nsAccessible
     134                 :   virtual void Description(nsString& aDescription);
     135                 :   virtual nsresult GetNameInternal(nsAString& aName);
     136                 :   virtual mozilla::a11y::role NativeRole();
     137                 :   virtual PRUint64 NativeState();
     138                 :   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
     139                 :   virtual Relation RelationByType(PRUint32 aRelationType);
     140                 : 
     141                 :   // TableAccessible
     142               0 :   inline nsAccessible* Caption() const
     143                 :   {
     144               0 :     nsAccessible* child = mChildren.SafeElementAt(0, nsnull);
     145               0 :     return child && child->Role() == mozilla::a11y::roles::CAPTION ? child : nsnull;
     146                 :   }
     147                 : 
     148                 :   // nsHTMLTableAccessible
     149                 : 
     150                 :   /**
     151                 :    * Retun cell element at the given row and column index.
     152                 :    */
     153                 :   nsresult GetCellAt(PRInt32 aRowIndex, PRInt32 aColIndex,
     154                 :                      nsIDOMElement* &aCell);
     155                 : 
     156                 :   /**
     157                 :    * Return nsITableLayout for the frame of the accessible table.
     158                 :    */
     159                 :   nsITableLayout* GetTableLayout();
     160                 : 
     161                 : protected:
     162                 : 
     163                 :   // nsAccessible
     164                 :   virtual void CacheChildren();
     165                 : 
     166                 :   // nsHTMLTableAccessible
     167                 : 
     168                 :   /**
     169                 :    * Add row or column to selection.
     170                 :    *
     171                 :    * @param aIndex   [in] index of row or column to be selected
     172                 :    * @param aTarget  [in] indicates what should be selected, either row or column
     173                 :    *                  (see nsISelectionPrivate)
     174                 :    */
     175                 :   nsresult AddRowOrColumnToSelection(PRInt32 aIndex, PRUint32 aTarget);
     176                 : 
     177                 :   /**
     178                 :    * Removes rows or columns at the given index or outside it from selection.
     179                 :    *
     180                 :    * @param  aIndex    [in] row or column index
     181                 :    * @param  aTarget   [in] indicates whether row or column should unselected
     182                 :    * @param  aIsOuter  [in] indicates whether all rows or column excepting
     183                 :    *                    the given one should be unselected or the given one
     184                 :    *                    should be unselected only
     185                 :    */
     186                 :   nsresult RemoveRowsOrColumnsFromSelection(PRInt32 aIndex,
     187                 :                                             PRUint32 aTarget,
     188                 :                                             bool aIsOuter);
     189                 : 
     190                 :   /**
     191                 :    * Return true if table has an element with the given tag name.
     192                 :    *
     193                 :    * @param  aTagName     [in] tag name of searched element
     194                 :    * @param  aAllowEmpty  [in, optional] points if found element can be empty
     195                 :    *                       or contain whitespace text only.
     196                 :    */
     197                 :   bool HasDescendant(const nsAString& aTagName, bool aAllowEmpty = true);
     198                 : 
     199                 : #ifdef SHOW_LAYOUT_HEURISTIC
     200                 :   nsString mLayoutHeuristic;
     201                 : #endif
     202                 : };
     203                 : 
     204                 : NS_DEFINE_STATIC_IID_ACCESSOR(nsHTMLTableAccessible,
     205                 :                               NS_TABLEACCESSIBLE_IMPL_CID)
     206                 : 
     207                 : 
     208                 : /**
     209                 :  * HTML caption accessible (html:caption).
     210                 :  */
     211                 : class nsHTMLCaptionAccessible : public nsHyperTextAccessibleWrap
     212                 : {
     213                 : public:
     214               0 :   nsHTMLCaptionAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     215               0 :     nsHyperTextAccessibleWrap(aContent, aDoc) { }
     216               0 :   virtual ~nsHTMLCaptionAccessible() { }
     217                 : 
     218                 :   // nsIAccessible
     219                 : 
     220                 :   // nsAccessible
     221                 :   virtual mozilla::a11y::role NativeRole();
     222                 :   virtual Relation RelationByType(PRUint32 aRelationType);
     223                 : };
     224                 : 
     225                 : #endif  

Generated by: LCOV version 1.7