2014-03-07 13:35:19 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_a11y_ProxyAccessible_h
|
|
|
|
#define mozilla_a11y_ProxyAccessible_h
|
|
|
|
|
|
|
|
#include "mozilla/a11y/Role.h"
|
2015-02-12 12:56:13 -08:00
|
|
|
#include "nsIAccessibleText.h"
|
2015-03-26 15:06:21 -07:00
|
|
|
#include "Accessible.h"
|
2014-03-07 13:35:19 -08:00
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsTArray.h"
|
2015-03-07 18:33:57 -08:00
|
|
|
#include "nsRect.h"
|
2015-03-26 15:06:45 -07:00
|
|
|
#include "Accessible.h"
|
2014-03-07 13:35:19 -08:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2014-10-24 02:29:48 -07:00
|
|
|
class Attribute;
|
2014-03-07 13:35:19 -08:00
|
|
|
class DocAccessibleParent;
|
2015-01-29 08:58:34 -08:00
|
|
|
enum class RelationType;
|
2014-03-07 13:35:19 -08:00
|
|
|
|
|
|
|
class ProxyAccessible
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ProxyAccessible(uint64_t aID, ProxyAccessible* aParent,
|
2014-09-23 02:53:03 -07:00
|
|
|
DocAccessibleParent* aDoc, role aRole) :
|
2014-12-30 18:04:43 -08:00
|
|
|
mParent(aParent), mDoc(aDoc), mWrapper(0), mID(aID), mRole(aRole),
|
|
|
|
mOuterDoc(false)
|
2014-03-07 13:35:19 -08:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(ProxyAccessible);
|
|
|
|
}
|
2014-12-12 14:33:28 -08:00
|
|
|
~ProxyAccessible()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(ProxyAccessible);
|
|
|
|
MOZ_ASSERT(!mWrapper);
|
|
|
|
}
|
2014-03-07 13:35:19 -08:00
|
|
|
|
|
|
|
void AddChildAt(uint32_t aIdx, ProxyAccessible* aChild)
|
|
|
|
{ mChildren.InsertElementAt(aIdx, aChild); }
|
|
|
|
|
|
|
|
uint32_t ChildrenCount() const { return mChildren.Length(); }
|
2015-01-21 15:31:27 -08:00
|
|
|
ProxyAccessible* ChildAt(uint32_t aIdx) const { return mChildren[aIdx]; }
|
2015-02-09 08:57:23 -08:00
|
|
|
|
|
|
|
// XXX evaluate if this is fast enough.
|
|
|
|
size_t IndexInParent() const { return mParent->mChildren.IndexOf(this); }
|
2015-01-21 15:31:27 -08:00
|
|
|
bool MustPruneChildren() const;
|
2014-03-07 13:35:19 -08:00
|
|
|
|
|
|
|
void Shutdown();
|
|
|
|
|
|
|
|
void SetChildDoc(DocAccessibleParent*);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove The given child.
|
|
|
|
*/
|
|
|
|
void RemoveChild(ProxyAccessible* aChild)
|
|
|
|
{ mChildren.RemoveElement(aChild); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the proxy for the parent of the wrapped accessible.
|
|
|
|
*/
|
|
|
|
ProxyAccessible* Parent() const { return mParent; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the role of the accessible we're proxying.
|
|
|
|
*/
|
|
|
|
role Role() const { return mRole; }
|
|
|
|
|
2014-09-23 01:35:33 -07:00
|
|
|
/*
|
|
|
|
* Return the states for the proxied accessible.
|
|
|
|
*/
|
|
|
|
uint64_t State() const;
|
|
|
|
|
2014-09-23 02:53:03 -07:00
|
|
|
/*
|
|
|
|
* Set aName to the name of the proxied accessible.
|
|
|
|
*/
|
|
|
|
void Name(nsString& aName) const;
|
|
|
|
|
2015-02-11 12:00:11 -08:00
|
|
|
/*
|
|
|
|
* Set aValue to the value of the proxied accessible.
|
|
|
|
*/
|
|
|
|
void Value(nsString& aValue) const;
|
|
|
|
|
2014-10-23 20:21:44 -07:00
|
|
|
/**
|
|
|
|
* Set aDesc to the description of the proxied accessible.
|
|
|
|
*/
|
|
|
|
void Description(nsString& aDesc) const;
|
|
|
|
|
2014-10-24 02:29:48 -07:00
|
|
|
/**
|
|
|
|
* Get the set of attributes on the proxied accessible.
|
|
|
|
*/
|
|
|
|
void Attributes(nsTArray<Attribute> *aAttrs) const;
|
|
|
|
|
2015-01-29 08:58:34 -08:00
|
|
|
/**
|
|
|
|
* Return set of targets of given relation type.
|
|
|
|
*/
|
|
|
|
nsTArray<ProxyAccessible*> RelationByType(RelationType aType) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get all relations for this accessible.
|
|
|
|
*/
|
|
|
|
void Relations(nsTArray<RelationType>* aTypes,
|
|
|
|
nsTArray<nsTArray<ProxyAccessible*>>* aTargetSets) const;
|
|
|
|
|
2015-03-06 12:43:25 -08:00
|
|
|
int32_t CaretOffset();
|
|
|
|
bool SetCaretOffset(int32_t aOffset);
|
|
|
|
|
2015-02-25 04:18:17 -08:00
|
|
|
int32_t CharacterCount();
|
|
|
|
int32_t SelectionCount();
|
|
|
|
|
2015-01-09 12:01:39 -08:00
|
|
|
/**
|
|
|
|
* Get the text between the given offsets.
|
|
|
|
*/
|
2015-04-06 03:04:44 -07:00
|
|
|
bool TextSubstring(int32_t aStartOffset, int32_t aEndOfset,
|
2015-01-09 12:01:39 -08:00
|
|
|
nsString& aText) const;
|
|
|
|
|
2015-02-12 12:56:13 -08:00
|
|
|
void GetTextAfterOffset(int32_t aOffset, AccessibleTextBoundary aBoundaryType,
|
|
|
|
nsString& aText, int32_t* aStartOffset,
|
|
|
|
int32_t* aEndOffset);
|
|
|
|
|
|
|
|
void GetTextAtOffset(int32_t aOffset, AccessibleTextBoundary aBoundaryType,
|
|
|
|
nsString& aText, int32_t* aStartOffset,
|
|
|
|
int32_t* aEndOffset);
|
|
|
|
|
|
|
|
void GetTextBeforeOffset(int32_t aOffset, AccessibleTextBoundary aBoundaryType,
|
|
|
|
nsString& aText, int32_t* aStartOffset,
|
|
|
|
int32_t* aEndOffset);
|
|
|
|
|
2015-03-06 09:37:37 -08:00
|
|
|
char16_t CharAt(int32_t aOffset);
|
|
|
|
|
2015-03-06 12:44:02 -08:00
|
|
|
void TextAttributes(bool aIncludeDefAttrs,
|
|
|
|
const int32_t aOffset,
|
|
|
|
nsTArray<Attribute>* aAttributes,
|
|
|
|
int32_t* aStartOffset,
|
|
|
|
int32_t* aEndOffset);
|
|
|
|
void DefaultTextAttributes(nsTArray<Attribute>* aAttrs);
|
|
|
|
|
2015-03-07 18:33:57 -08:00
|
|
|
nsIntRect TextBounds(int32_t aStartOffset, int32_t aEndOffset,
|
|
|
|
uint32_t aCoordType);
|
|
|
|
|
|
|
|
nsIntRect CharBounds(int32_t aOffset, uint32_t aCoordType);
|
|
|
|
|
2015-03-08 05:05:55 -07:00
|
|
|
int32_t OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType);
|
|
|
|
|
2015-03-09 13:50:16 -07:00
|
|
|
bool SelectionBoundsAt(int32_t aSelectionNum,
|
|
|
|
nsString& aData,
|
|
|
|
int32_t* aStartOffset,
|
|
|
|
int32_t* aEndOffset);
|
|
|
|
|
|
|
|
bool SetSelectionBoundsAt(int32_t aSelectionNum,
|
|
|
|
int32_t aStartOffset,
|
|
|
|
int32_t aEndOffset);
|
|
|
|
|
|
|
|
bool AddToSelection(int32_t aStartOffset,
|
|
|
|
int32_t aEndOffset);
|
|
|
|
|
|
|
|
bool RemoveFromSelection(int32_t aSelectionNum);
|
|
|
|
|
2015-03-09 13:51:02 -07:00
|
|
|
void ScrollSubstringTo(int32_t aStartOffset, int32_t aEndOffset,
|
|
|
|
uint32_t aScrollType);
|
|
|
|
|
|
|
|
void ScrollSubstringToPoint(int32_t aStartOffset,
|
|
|
|
int32_t aEndOffset,
|
|
|
|
uint32_t aCoordinateType,
|
|
|
|
int32_t aX, int32_t aY);
|
|
|
|
|
2015-03-09 14:04:02 -07:00
|
|
|
void ReplaceText(const nsString& aText);
|
|
|
|
|
2015-04-06 03:04:44 -07:00
|
|
|
bool InsertText(const nsString& aText, int32_t aPosition);
|
2015-03-09 14:04:02 -07:00
|
|
|
|
2015-04-06 03:04:44 -07:00
|
|
|
bool CopyText(int32_t aStartPos, int32_t aEndPos);
|
2015-03-09 14:04:02 -07:00
|
|
|
|
2015-04-06 03:04:44 -07:00
|
|
|
bool CutText(int32_t aStartPos, int32_t aEndPos);
|
2015-03-09 14:04:02 -07:00
|
|
|
|
2015-04-06 03:04:44 -07:00
|
|
|
bool DeleteText(int32_t aStartPos, int32_t aEndPos);
|
2015-03-09 14:04:02 -07:00
|
|
|
|
2015-04-06 03:04:44 -07:00
|
|
|
bool PasteText(int32_t aPosition);
|
2015-03-09 14:04:02 -07:00
|
|
|
|
2015-03-22 14:44:12 -07:00
|
|
|
nsIntPoint ImagePosition(uint32_t aCoordType);
|
|
|
|
|
|
|
|
nsIntSize ImageSize();
|
|
|
|
|
2015-03-25 07:03:13 -07:00
|
|
|
uint32_t StartOffset(bool* aOk);
|
|
|
|
|
|
|
|
uint32_t EndOffset(bool* aOk);
|
|
|
|
|
|
|
|
bool IsLinkValid();
|
|
|
|
|
|
|
|
uint32_t AnchorCount(bool* aOk);
|
|
|
|
|
|
|
|
void AnchorURIAt(uint32_t aIndex, nsCString& aURI, bool* aOk);
|
|
|
|
|
|
|
|
ProxyAccessible* AnchorAt(uint32_t aIndex);
|
|
|
|
|
2015-03-25 07:05:18 -07:00
|
|
|
uint32_t LinkCount();
|
|
|
|
|
|
|
|
ProxyAccessible* LinkAt(const uint32_t& aIndex);
|
|
|
|
|
|
|
|
int32_t LinkIndexOf(ProxyAccessible* aLink);
|
|
|
|
|
|
|
|
int32_t LinkIndexAtOffset(uint32_t aOffset);
|
|
|
|
|
2015-03-25 07:14:28 -07:00
|
|
|
ProxyAccessible* TableOfACell();
|
|
|
|
|
|
|
|
uint32_t ColIdx();
|
|
|
|
|
|
|
|
uint32_t RowIdx();
|
|
|
|
|
|
|
|
uint32_t ColExtent();
|
|
|
|
|
|
|
|
uint32_t RowExtent();
|
|
|
|
|
|
|
|
void ColHeaderCells(nsTArray<uint64_t>* aCells);
|
|
|
|
|
|
|
|
void RowHeaderCells(nsTArray<uint64_t>* aCells);
|
|
|
|
|
|
|
|
bool IsCellSelected();
|
|
|
|
|
2015-03-25 07:16:24 -07:00
|
|
|
ProxyAccessible* TableCaption();
|
|
|
|
void TableSummary(nsString& aSummary);
|
|
|
|
uint32_t TableColumnCount();
|
|
|
|
uint32_t TableRowCount();
|
|
|
|
ProxyAccessible* TableCellAt(uint32_t aRow, uint32_t aCol);
|
|
|
|
int32_t TableCellIndexAt(uint32_t aRow, uint32_t aCol);
|
|
|
|
int32_t TableColumnIndexAt(uint32_t aCellIndex);
|
|
|
|
int32_t TableRowIndexAt(uint32_t aCellIndex);
|
|
|
|
void TableRowAndColumnIndicesAt(uint32_t aCellIndex,
|
|
|
|
int32_t* aRow, int32_t* aCol);
|
|
|
|
uint32_t TableColumnExtentAt(uint32_t aRow, uint32_t aCol);
|
|
|
|
uint32_t TableRowExtentAt(uint32_t aRow, uint32_t aCol);
|
|
|
|
void TableColumnDescription(uint32_t aCol, nsString& aDescription);
|
|
|
|
void TableRowDescription(uint32_t aRow, nsString& aDescription);
|
|
|
|
bool TableColumnSelected(uint32_t aCol);
|
|
|
|
bool TableRowSelected(uint32_t aRow);
|
|
|
|
bool TableCellSelected(uint32_t aRow, uint32_t aCol);
|
|
|
|
uint32_t TableSelectedCellCount();
|
|
|
|
uint32_t TableSelectedColumnCount();
|
|
|
|
uint32_t TableSelectedRowCount();
|
|
|
|
void TableSelectedCells(nsTArray<ProxyAccessible*>* aCellIDs);
|
|
|
|
void TableSelectedCellIndices(nsTArray<uint32_t>* aCellIndices);
|
|
|
|
void TableSelectedColumnIndices(nsTArray<uint32_t>* aColumnIndices);
|
|
|
|
void TableSelectedRowIndices(nsTArray<uint32_t>* aRowIndices);
|
|
|
|
void TableSelectColumn(uint32_t aCol);
|
|
|
|
void TableSelectRow(uint32_t aRow);
|
|
|
|
void TableUnselectColumn(uint32_t aCol);
|
|
|
|
void TableUnselectRow(uint32_t aRow);
|
|
|
|
bool TableIsProbablyForLayout();
|
|
|
|
|
2015-03-25 07:19:12 -07:00
|
|
|
void SelectedItems(nsTArray<ProxyAccessible*>* aSelectedItems);
|
|
|
|
uint32_t SelectedItemCount();
|
|
|
|
ProxyAccessible* GetSelectedItem(uint32_t aIndex);
|
|
|
|
bool IsItemSelected(uint32_t aIndex);
|
|
|
|
bool AddItemToSelection(uint32_t aIndex);
|
|
|
|
bool RemoveItemFromSelection(uint32_t aIndex);
|
|
|
|
bool SelectAll();
|
|
|
|
bool UnselectAll();
|
|
|
|
|
2015-03-26 15:06:21 -07:00
|
|
|
bool DoAction(uint8_t aIndex);
|
|
|
|
uint8_t ActionCount();
|
|
|
|
void ActionDescriptionAt(uint8_t aIndex, nsString& aDescription);
|
|
|
|
void ActionNameAt(uint8_t aIndex, nsString& aName);
|
|
|
|
KeyBinding AccessKey();
|
|
|
|
KeyBinding KeyboardShortcut();
|
|
|
|
|
2015-03-26 15:06:38 -07:00
|
|
|
double CurValue();
|
|
|
|
bool SetCurValue(double aValue);
|
|
|
|
double MinValue();
|
|
|
|
double MaxValue();
|
|
|
|
double Step();
|
|
|
|
|
2015-03-26 15:06:45 -07:00
|
|
|
void TakeFocus();
|
|
|
|
ProxyAccessible* ChildAtPoint(int32_t aX, int32_t aY,
|
|
|
|
Accessible::EWhichChildAtPoint aWhichChild);
|
|
|
|
nsIntRect Bounds();
|
|
|
|
|
2015-03-27 08:41:04 -07:00
|
|
|
void Language(nsString& aLocale);
|
|
|
|
void DocType(nsString& aType);
|
|
|
|
void URL(nsString& aURL);
|
|
|
|
void MimeType(nsString aMime);
|
|
|
|
void URLDocTypeMimeType(nsString& aURL, nsString& aDocType,
|
|
|
|
nsString& aMimeType);
|
|
|
|
|
2014-03-07 13:35:19 -08:00
|
|
|
/**
|
|
|
|
* Allow the platform to store a pointers worth of data on us.
|
|
|
|
*/
|
|
|
|
uintptr_t GetWrapper() const { return mWrapper; }
|
|
|
|
void SetWrapper(uintptr_t aWrapper) { mWrapper = aWrapper; }
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the ID of the accessible being proxied.
|
|
|
|
*/
|
|
|
|
uint64_t ID() const { return mID; }
|
|
|
|
|
|
|
|
protected:
|
2014-12-13 11:17:04 -08:00
|
|
|
explicit ProxyAccessible(DocAccessibleParent* aThisAsDoc) :
|
2014-12-11 14:36:59 -08:00
|
|
|
mParent(nullptr), mDoc(aThisAsDoc), mWrapper(0), mID(0),
|
|
|
|
mRole(roles::DOCUMENT)
|
2014-09-29 14:14:08 -07:00
|
|
|
{ MOZ_COUNT_CTOR(ProxyAccessible); }
|
2014-03-07 13:35:19 -08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
ProxyAccessible* mParent;
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsTArray<ProxyAccessible*> mChildren;
|
|
|
|
DocAccessibleParent* mDoc;
|
|
|
|
uintptr_t mWrapper;
|
|
|
|
uint64_t mID;
|
|
|
|
role mRole : 31;
|
|
|
|
bool mOuterDoc : 1;
|
|
|
|
};
|
|
|
|
|
2015-01-09 12:01:39 -08:00
|
|
|
enum Interfaces
|
|
|
|
{
|
2015-04-29 06:55:29 -07:00
|
|
|
HYPERTEXT = 1,
|
|
|
|
HYPERLINK = 2,
|
|
|
|
IMAGE = 4,
|
|
|
|
VALUE = 8,
|
|
|
|
TABLE = 16,
|
|
|
|
TABLECELL = 32,
|
2015-01-09 12:01:39 -08:00
|
|
|
};
|
|
|
|
|
2014-03-07 13:35:19 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|