2001-09-25 00:48:50 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
2001-02-14 20:51:33 +00:00
|
|
|
*
|
2001-09-25 00:48:50 +00:00
|
|
|
* The contents of this file are subject to the Netscape 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/NPL/
|
2001-02-14 20:51:33 +00:00
|
|
|
*
|
2001-09-25 00:48:50 +00:00
|
|
|
* 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.
|
2001-02-14 20:51:33 +00:00
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-25 00:48:50 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2001-02-14 20:51:33 +00:00
|
|
|
*
|
2001-09-25 00:48:50 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* 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 NPL, 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 NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2001-02-14 20:51:33 +00:00
|
|
|
|
|
|
|
#ifndef _nsAccessible_H_
|
|
|
|
#define _nsAccessible_H_
|
|
|
|
|
|
|
|
#include "nsISupports.h"
|
2001-06-30 00:25:09 +00:00
|
|
|
#include "nsGenericAccessible.h"
|
2001-02-14 20:51:33 +00:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsIDOMNode.h"
|
2001-03-04 02:31:28 +00:00
|
|
|
#include "nsIPresShell.h"
|
2001-03-29 00:16:20 +00:00
|
|
|
#include "nsIPresContext.h"
|
2001-03-04 02:31:28 +00:00
|
|
|
#include "nsWeakReference.h"
|
2001-05-11 21:11:38 +00:00
|
|
|
#include "nsIFocusController.h"
|
|
|
|
#include "nsRect.h"
|
|
|
|
#include "nsPoint.h"
|
|
|
|
|
|
|
|
#define ACCESSIBLE_BUNDLE_URL "chrome://global/locale/accessible.properties"
|
2001-02-14 20:51:33 +00:00
|
|
|
|
|
|
|
class nsIFrame;
|
2001-05-11 21:11:38 +00:00
|
|
|
class nsIDocShell;
|
|
|
|
class nsIWebShell;
|
|
|
|
class nsIContent;
|
2001-02-14 20:51:33 +00:00
|
|
|
|
2001-06-30 00:25:09 +00:00
|
|
|
class nsAccessible : public nsGenericAccessible
|
2001-02-14 20:51:33 +00:00
|
|
|
{
|
2001-06-30 00:25:09 +00:00
|
|
|
public:
|
2001-08-09 04:58:01 +00:00
|
|
|
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
2001-06-30 00:25:09 +00:00
|
|
|
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
|
|
|
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
|
|
|
NS_IMETHOD GetAccFocused(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
|
|
|
NS_IMETHOD AccRemoveSelection(void);
|
|
|
|
NS_IMETHOD AccTakeSelection(void);
|
|
|
|
NS_IMETHOD AccTakeFocus(void);
|
|
|
|
NS_IMETHOD AccGetDOMNode(nsIDOMNode **_retval);
|
2001-02-14 20:51:33 +00:00
|
|
|
|
2001-05-11 21:11:38 +00:00
|
|
|
public:
|
2001-06-30 00:25:09 +00:00
|
|
|
nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
2001-05-11 21:11:38 +00:00
|
|
|
virtual ~nsAccessible();
|
2001-02-14 20:51:33 +00:00
|
|
|
|
2001-03-28 00:49:05 +00:00
|
|
|
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList) { aList = nsnull; }
|
|
|
|
|
2001-05-11 21:11:38 +00:00
|
|
|
// Helper Routines for Sub-Docs
|
|
|
|
static nsresult GetDocShellFromPS(nsIPresShell* aPresShell, nsIDocShell** aDocShell);
|
|
|
|
static nsresult GetDocShellObjects(nsIDocShell* aDocShell,
|
|
|
|
nsIPresShell** aPresShell,
|
|
|
|
nsIPresContext** aPresContext,
|
|
|
|
nsIContent** aContent);
|
|
|
|
static nsresult GetDocShells(nsIPresShell* aPresShell,
|
|
|
|
nsIDocShell** aDocShell,
|
|
|
|
nsIDocShell** aParentDocShell);
|
|
|
|
static nsresult GetParentPresShellAndContent(nsIPresShell* aPresShell,
|
|
|
|
nsIPresShell** aParentPresShell,
|
|
|
|
nsIContent** aSubShellContent);
|
|
|
|
|
|
|
|
static PRBool FindContentForWebShell(nsIPresShell* aParentPresShell,
|
|
|
|
nsIContent* aParentContent,
|
|
|
|
nsIWebShell* aWebShell,
|
|
|
|
nsIContent** aFoundContent);
|
|
|
|
nsresult CalcOffset(nsIFrame* aFrame,
|
|
|
|
nsIPresContext * aPresContext,
|
|
|
|
nsRect& aRect);
|
|
|
|
nsresult GetAbsPosition(nsIPresShell* aPresShell, nsPoint& aPoint);
|
|
|
|
nsresult GetAbsoluteFramePosition(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame *aFrame,
|
|
|
|
nsRect& aAbsoluteTwipsRect,
|
|
|
|
nsRect& aAbsolutePixelRect);
|
|
|
|
static nsresult GetTranslatedString(PRUnichar *aKey, nsAWritableString *aStringOut);
|
2001-07-14 02:53:42 +00:00
|
|
|
|
|
|
|
// helper method to verify frames
|
|
|
|
static PRBool IsCorrectFrameType(nsIFrame* aFrame, nsIAtom* aAtom);
|
|
|
|
|
2001-02-14 20:51:33 +00:00
|
|
|
protected:
|
2001-03-04 02:31:28 +00:00
|
|
|
virtual nsIFrame* GetFrame();
|
2001-03-28 00:49:05 +00:00
|
|
|
virtual nsIFrame* GetBoundsFrame();
|
2001-05-17 23:52:32 +00:00
|
|
|
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
2001-03-04 02:31:28 +00:00
|
|
|
virtual void GetPresContext(nsCOMPtr<nsIPresContext>& aContext);
|
2001-06-30 00:25:09 +00:00
|
|
|
NS_IMETHOD AppendFlatStringFromSubtree(nsIContent *aContent, nsAWritableString *aFlatString);
|
|
|
|
NS_IMETHOD AppendFlatStringFromContentNode(nsIContent *aContent, nsAWritableString *aFlatString);
|
2001-02-14 20:51:33 +00:00
|
|
|
|
2001-05-11 21:11:38 +00:00
|
|
|
// Data Members
|
|
|
|
nsCOMPtr<nsIDOMNode> mDOMNode;
|
2001-03-05 20:21:39 +00:00
|
|
|
nsCOMPtr<nsIWeakReference> mPresShell;
|
2001-05-11 21:11:38 +00:00
|
|
|
nsCOMPtr<nsIFocusController> mFocusController;
|
2001-06-30 00:25:09 +00:00
|
|
|
|
2001-02-14 20:51:33 +00:00
|
|
|
};
|
|
|
|
|
2001-03-04 02:31:28 +00:00
|
|
|
/* Special Accessible that knows how to handle hit detection for flowing text */
|
|
|
|
class nsHTMLBlockAccessible : public nsAccessible
|
|
|
|
{
|
|
|
|
public:
|
2001-06-30 00:25:09 +00:00
|
|
|
nsHTMLBlockAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
2001-03-04 02:31:28 +00:00
|
|
|
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
|
|
|
};
|
|
|
|
|
2001-06-30 00:25:09 +00:00
|
|
|
/* Leaf version of DOM Accessible
|
|
|
|
* has no children
|
|
|
|
*/
|
|
|
|
class nsLeafAccessible : public nsAccessible
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
|
|
|
|
|
|
|
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
|
|
|
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class nsLinkableAccessible : public nsAccessible
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
|
|
|
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
|
|
|
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
|
|
|
NS_IMETHOD AccDoAction(PRUint8 index);
|
|
|
|
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
2001-08-09 04:58:01 +00:00
|
|
|
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
2001-06-30 00:25:09 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
PRBool IsALink();
|
|
|
|
PRBool mIsALinkCached; // -1 = unknown, 0 = not a link, 1 = is a link
|
|
|
|
nsCOMPtr<nsIContent> mLinkContent;
|
|
|
|
PRBool mIsLinkVisited;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-02-14 20:51:33 +00:00
|
|
|
#endif
|