зеркало из https://github.com/mozilla/pjs.git
Fix for bug 378038 - expose IAccessibleText and IAccessibleEditableText, r=aaronlev, sr=neil
This commit is contained in:
Родитель
3da99bce20
Коммит
daf2cd995d
|
@ -50,6 +50,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
XPIDLSRCS = \
|
||||
nsIAccessibleWin32Object.idl \
|
||||
nsIWinAccessNode.idl \
|
||||
$(NULL)
|
||||
|
||||
DEFINES += -DREGISTER_PROXY_DLL -D_WIN32_WINNT=0x400
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 the Mozilla browser.
|
||||
*
|
||||
* 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 <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 "nsISupports.idl"
|
||||
|
||||
%{C++
|
||||
#include "Guiddef.h"
|
||||
%}
|
||||
|
||||
[ref] native MSCOMIIDRef(IID);
|
||||
|
||||
[uuid(63efe9c5-2610-4d2f-861b-e4ddfe1b70d9)]
|
||||
interface nsIWinAccessNode : nsISupports
|
||||
{
|
||||
voidPtr queryNativeInterface([const] in MSCOMIIDRef aIID);
|
||||
};
|
||||
|
|
@ -96,6 +96,7 @@ EXPORTS = \
|
|||
nsTextAccessibleWrap.h \
|
||||
nsXULMenuAccessibleWrap.h \
|
||||
nsXULTreeAccessibleWrap.h \
|
||||
nsHyperTextAccessibleWrap.h \
|
||||
$(NULL)
|
||||
|
||||
# we want to force the creation of a static lib.
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 _NSHYPERTEXTACCESSIBLEWRAP_H
|
||||
#define _NSHYPERTEXTACCESSIBLEWRAP_H
|
||||
|
||||
#include "nsHyperTextAccessible.h"
|
||||
|
||||
typedef class nsHyperTextAccessible nsHyperTextAccessibleWrap;
|
||||
|
||||
#endif
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
#include "nsHTMLSelectAccessible.h"
|
||||
#include "nsHTMLTableAccessible.h"
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
#include "nsHyperTextAccessible.h"
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIAccessibleProvider.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
@ -538,7 +538,7 @@ nsAccessibilityService::CreateHyperTextAccessible(nsISupports *aFrame, nsIAccess
|
|||
*aAccessible = new nsLinkableAccessible(node, weakShell);
|
||||
}
|
||||
else {
|
||||
*aAccessible = new nsHyperTextAccessible(node, weakShell);
|
||||
*aAccessible = new nsHyperTextAccessibleWrap(node, weakShell);
|
||||
}
|
||||
if (nsnull == *aAccessible)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsAccessibleWrap.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsHyperTextAccessible.h"
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
@ -96,14 +96,14 @@ nsLeafAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
|
|||
//----------------
|
||||
|
||||
nsLinkableAccessible::nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsHyperTextAccessible(aNode, aShell),
|
||||
nsHyperTextAccessibleWrap(aNode, aShell),
|
||||
mActionContent(nsnull),
|
||||
mIsLink(PR_FALSE),
|
||||
mIsOnclick(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsLinkableAccessible, nsHyperTextAccessible)
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsLinkableAccessible, nsHyperTextAccessibleWrap)
|
||||
|
||||
NS_IMETHODIMP nsLinkableAccessible::TakeFocus()
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ NS_IMETHODIMP nsLinkableAccessible::TakeFocus()
|
|||
NS_IMETHODIMP
|
||||
nsLinkableAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessible::GetState(aState, aExtraState);
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetState(aState, aExtraState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mIsLink) {
|
||||
|
@ -283,13 +283,13 @@ NS_IMETHODIMP nsLinkableAccessible::GetURI(PRInt32 aIndex, nsIURI **aURI)
|
|||
NS_IMETHODIMP nsLinkableAccessible::Init()
|
||||
{
|
||||
CacheActionContent();
|
||||
return nsHyperTextAccessible::Init();
|
||||
return nsHyperTextAccessibleWrap::Init();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLinkableAccessible::Shutdown()
|
||||
{
|
||||
mActionContent = nsnull;
|
||||
return nsHyperTextAccessible::Shutdown();
|
||||
return nsHyperTextAccessibleWrap::Shutdown();
|
||||
}
|
||||
|
||||
//---------------------
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#define _nsBaseWidgetAccessible_H_
|
||||
|
||||
#include "nsAccessibleWrap.h"
|
||||
#include "nsHyperTextAccessible.h"
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
class nsIDOMNode;
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
* It knows how to report the state of the link ( traveled or not )
|
||||
* and can activate ( click ) the link programmatically.
|
||||
*/
|
||||
class nsLinkableAccessible : public nsHyperTextAccessible
|
||||
class nsLinkableAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
enum { eAction_Jump = 0 };
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessible(aDOMNode, aShell), mWnd(nsnull),
|
||||
nsHyperTextAccessibleWrap(aDOMNode, aShell), mWnd(nsnull),
|
||||
mScrollPositionChangedTicks(0), mIsContentLoaded(PR_FALSE)
|
||||
{
|
||||
// For GTK+ native window, we do nothing here.
|
||||
|
@ -492,7 +492,7 @@ NS_IMETHODIMP nsDocAccessible::Init()
|
|||
|
||||
AddEventListeners();
|
||||
|
||||
nsresult rv = nsHyperTextAccessible::Init();
|
||||
nsresult rv = nsHyperTextAccessibleWrap::Init();
|
||||
|
||||
if (mRoleMapEntry && mRoleMapEntry->role != nsIAccessibleRole::ROLE_DIALOG &&
|
||||
mRoleMapEntry->role != nsIAccessibleRole::ROLE_APPLICATION &&
|
||||
|
@ -548,7 +548,7 @@ NS_IMETHODIMP nsDocAccessible::Shutdown()
|
|||
|
||||
mDocument = nsnull;
|
||||
|
||||
return nsHyperTextAccessible::Shutdown();
|
||||
return nsHyperTextAccessibleWrap::Shutdown();
|
||||
}
|
||||
|
||||
void nsDocAccessible::ShutdownChildDocuments(nsIDocShellTreeItem *aStart)
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#ifndef _nsDocAccessible_H_
|
||||
#define _nsDocAccessible_H_
|
||||
|
||||
#include "nsHyperTextAccessible.h"
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsPIAccessibleDocument.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
|
@ -58,7 +58,7 @@ class nsIScrollableView;
|
|||
|
||||
const PRUint32 kDefaultCacheSize = 256;
|
||||
|
||||
class nsDocAccessible : public nsHyperTextAccessible,
|
||||
class nsDocAccessible : public nsHyperTextAccessibleWrap,
|
||||
public nsIAccessibleDocument,
|
||||
public nsPIAccessibleDocument,
|
||||
public nsIDocumentObserver,
|
||||
|
|
|
@ -211,7 +211,7 @@ nsHTMLRadioButtonAccessible::GetAttributesInternal(nsIPersistentProperties *aAtt
|
|||
// ----- Button -----
|
||||
|
||||
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessible(aNode, aShell)
|
||||
nsHyperTextAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ nsHTMLButtonAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = nsHyperTextAccessible::GetState(aState, aExtraState);
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetState(aState, aExtraState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoString buttonType;
|
||||
|
@ -307,7 +307,7 @@ NS_IMETHODIMP nsHTMLButtonAccessible::GetName(nsAString& aName)
|
|||
// ----- HTML 4 Button: can contain arbitrary HTML content -----
|
||||
|
||||
nsHTML4ButtonAccessible::nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessible(aNode, aShell)
|
||||
nsHyperTextAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ nsHTML4ButtonAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE); // Button accessible shut down
|
||||
|
||||
nsresult rv = nsHyperTextAccessible::GetState(aState, aExtraState);
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetState(aState, aExtraState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
|
@ -362,17 +362,17 @@ nsHTML4ButtonAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
// --- textfield -----
|
||||
|
||||
nsHTMLTextFieldAccessible::nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessible(aNode, aShell)
|
||||
nsHyperTextAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTextFieldAccessible, nsHyperTextAccessible,
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTextFieldAccessible, nsHyperTextAccessibleWrap,
|
||||
nsIAccessibleText)
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::Init()
|
||||
{
|
||||
CheckForEditor();
|
||||
return nsHyperTextAccessible::Init();
|
||||
return nsHyperTextAccessibleWrap::Init();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::Shutdown()
|
||||
|
@ -381,7 +381,7 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::Shutdown()
|
|||
mEditor->RemoveEditActionListener(this);
|
||||
mEditor = nsnull;
|
||||
}
|
||||
return nsHyperTextAccessible::Shutdown();
|
||||
return nsHyperTextAccessibleWrap::Shutdown();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetRole(PRUint32 *aRole)
|
||||
|
@ -419,7 +419,7 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetValue(nsAString& _retval)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLTextFieldAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessible::GetState(aState, aExtraState);
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetState(aState, aExtraState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// can be focusable, focused, protected. readonly, unavailable, selected
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#define _nsHTMLFormControlAccessible_H_
|
||||
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsHyperTextAccessible.h"
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
|
||||
class nsHTMLCheckboxAccessible : public nsFormControlAccessible
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
};
|
||||
|
||||
class nsHTMLButtonAccessible : public nsHyperTextAccessible
|
||||
class nsHTMLButtonAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
|
||||
public:
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
NS_IMETHOD DoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsHTML4ButtonAccessible : public nsHyperTextAccessible
|
||||
class nsHTML4ButtonAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
|
||||
public:
|
||||
|
@ -96,7 +96,7 @@ public:
|
|||
NS_IMETHOD DoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsHTMLTextFieldAccessible : public nsHyperTextAccessible
|
||||
class nsHTMLTextFieldAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
|
||||
public:
|
||||
|
|
|
@ -450,7 +450,7 @@ void nsHTMLSelectListAccessible::CacheChildren()
|
|||
|
||||
/** Default Constructor */
|
||||
nsHTMLSelectOptionAccessible::nsHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessible(aDOMNode, aShell)
|
||||
nsHyperTextAccessibleWrap(aDOMNode, aShell)
|
||||
{
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
|
@ -532,7 +532,7 @@ nsHTMLSelectOptionAccessible::GetAttributesInternal(nsIPersistentProperties *aAt
|
|||
return NS_ERROR_FAILURE; // Accessible shut down
|
||||
}
|
||||
|
||||
nsresult rv = nsHyperTextAccessible::GetAttributesInternal(aAttributes);
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
|
|
|
@ -148,7 +148,7 @@ protected:
|
|||
/*
|
||||
* Options inside the select, contained within the list
|
||||
*/
|
||||
class nsHTMLSelectOptionAccessible : public nsHyperTextAccessible
|
||||
class nsHTMLSelectOptionAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
enum { eAction_Select = 0 };
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableCellAccessible, nsHyperTextAccessible)
|
||||
|
||||
nsHTMLTableCellAccessible::nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessible(aDomNode, aShell)
|
||||
nsHyperTextAccessibleWrap(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsIAccessibleTable.h"
|
||||
|
||||
class nsHTMLTableCellAccessible : public nsHyperTextAccessible
|
||||
class nsHTMLTableCellAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
|
|
@ -234,7 +234,7 @@ NS_IMETHODIMP nsHTMLLabelAccessible::GetChildCount(PRInt32 *aAccChildCount)
|
|||
|
||||
nsHTMLLIAccessible::nsHTMLLIAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
|
||||
nsIFrame *aBulletFrame, const nsAString& aBulletText):
|
||||
nsHyperTextAccessible(aDOMNode, aShell)
|
||||
nsHyperTextAccessibleWrap(aDOMNode, aShell)
|
||||
{
|
||||
if (!aBulletText.IsEmpty()) {
|
||||
mBulletAccessible = new nsHTMLListBulletAccessible(mDOMNode, mWeakShell,
|
||||
|
@ -252,7 +252,7 @@ NS_IMETHODIMP nsHTMLLIAccessible::Shutdown()
|
|||
// Ensure that weak pointer to this is nulled out
|
||||
mBulletAccessible->Shutdown();
|
||||
}
|
||||
nsresult rv = nsHyperTextAccessible::Shutdown();
|
||||
nsresult rv = nsHyperTextAccessibleWrap::Shutdown();
|
||||
mBulletAccessible = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ nsHTMLListBulletAccessible::GetContentText(nsAString& aText)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLListAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessible::GetState(aState, aExtraState);
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetState(aState, aExtraState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
|
|
|
@ -123,16 +123,16 @@ protected:
|
|||
nsString mBulletText;
|
||||
};
|
||||
|
||||
class nsHTMLListAccessible : public nsHyperTextAccessible
|
||||
class nsHTMLListAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsHTMLListAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessible(aDOMNode, aShell) { }
|
||||
nsHyperTextAccessibleWrap(aDOMNode, aShell) { }
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole) { *aRole = nsIAccessibleRole::ROLE_LIST; return NS_OK; }
|
||||
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
};
|
||||
|
||||
class nsHTMLLIAccessible : public nsHyperTextAccessible
|
||||
class nsHTMLLIAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsHTMLLIAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
|
||||
|
|
|
@ -81,6 +81,7 @@ EXPORTS = \
|
|||
nsRootAccessibleWrap.h \
|
||||
nsXULMenuAccessibleWrap.h \
|
||||
nsXULTreeAccessibleWrap.h \
|
||||
nsHyperTextAccessibleWrap.h \
|
||||
mozDocAccessible.h \
|
||||
mozAccessible.h \
|
||||
mozAccessibleWrapper.h \
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 _NSHYPERTEXTACCESSIBLEWRAP_H
|
||||
#define _NSHYPERTEXTACCESSIBLEWRAP_H
|
||||
|
||||
#include "nsHyperTextAccessible.h"
|
||||
|
||||
typedef class nsHyperTextAccessible nsHyperTextAccessibleWrap;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
/* -*- 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 <surkov.alexander@gmail.com> (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 "CAccessibleEditableText.h"
|
||||
|
||||
#include "nsIAccessibleEditableText.h"
|
||||
#include "AccessibleEditableText_i.c"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#define GET_NSIACCESSIBLEEDITABLETEXT \
|
||||
nsCOMPtr<nsIAccessibleEditableText> textAcc(do_QueryInterface(this));\
|
||||
NS_ASSERTION(textAcc,\
|
||||
"Subclass of CAccessibleEditableText doesn't implement nsIAccessibleEditableText");\
|
||||
if (!textAcc)\
|
||||
return E_FAIL;\
|
||||
|
||||
// IUnknown
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleEditableText::QueryInterface(REFIID iid, void** ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
|
||||
if (IID_IAccessibleEditableText == iid) {
|
||||
*ppv = NS_STATIC_CAST(IAccessibleEditableText*, this);
|
||||
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
// IAccessibleEditableText
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleEditableText::copyText(long aStartOffset, long aEndOffset)
|
||||
{
|
||||
GET_NSIACCESSIBLEEDITABLETEXT
|
||||
|
||||
nsresult rv = textAcc->CopyText(aStartOffset, aEndOffset);
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleEditableText::deleteText(long aStartOffset, long aEndOffset)
|
||||
{
|
||||
GET_NSIACCESSIBLEEDITABLETEXT
|
||||
|
||||
nsresult rv = textAcc->DeleteText(aStartOffset, aEndOffset);
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleEditableText::insertText(long aOffset, BSTR *aText)
|
||||
{
|
||||
GET_NSIACCESSIBLEEDITABLETEXT
|
||||
|
||||
PRUint32 length = ::SysStringLen(*aText);
|
||||
nsAutoString text(*aText, length);
|
||||
|
||||
nsresult rv = textAcc->InsertText(text, aOffset);
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleEditableText::cutText(long aStartOffset, long aEndOffset)
|
||||
{
|
||||
GET_NSIACCESSIBLEEDITABLETEXT
|
||||
|
||||
nsresult rv = textAcc->CutText(aStartOffset, aEndOffset);
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleEditableText::pasteText(long aOffset)
|
||||
{
|
||||
GET_NSIACCESSIBLEEDITABLETEXT
|
||||
|
||||
nsresult rv = textAcc->PasteText(aOffset);
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleEditableText::replaceText(long aStartOffset, long aEndOffset,
|
||||
BSTR *aText)
|
||||
{
|
||||
GET_NSIACCESSIBLEEDITABLETEXT
|
||||
|
||||
nsresult rv = textAcc->DeleteText(aStartOffset, aEndOffset);
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
PRUint32 length = ::SysStringLen(*aText);
|
||||
nsAutoString text(*aText, length);
|
||||
|
||||
rv = textAcc->InsertText(text, aStartOffset);
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleEditableText::setAttributes(long aStartOffset, long aEndOffset,
|
||||
BSTR *aAttributes)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
/* -*- 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 <surkov.alexander@gmail.com> (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_EDITABLETEXT_H
|
||||
#define _ACCESSIBLE_EDITABLETEXT_H
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIAccessibleEditableText.h"
|
||||
|
||||
#include "AccessibleEditableText.h"
|
||||
|
||||
class CAccessibleEditableText: public nsISupports,
|
||||
public IAccessibleEditableText
|
||||
{
|
||||
public:
|
||||
|
||||
// IUnknown
|
||||
STDMETHODIMP QueryInterface(REFIID, void**);
|
||||
|
||||
// IAccessibleEditableText
|
||||
virtual HRESULT STDMETHODCALLTYPE copyText(
|
||||
/* [in] */ long startOffset,
|
||||
/* [in] */ long endOffset);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE deleteText(
|
||||
/* [in] */ long startOffset,
|
||||
/* [in] */ long endOffset);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE insertText(
|
||||
/* [in] */ long offset,
|
||||
/* [in] */ BSTR *text);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE cutText(
|
||||
/* [in] */ long startOffset,
|
||||
/* [in] */ long endOffset);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE pasteText(
|
||||
/* [in] */ long offset);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE replaceText(
|
||||
/* [in] */ long startOffset,
|
||||
/* [in] */ long endOffset,
|
||||
/* [in] */ BSTR *text);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE setAttributes(
|
||||
/* [in] */ long startOffset,
|
||||
/* [in] */ long endOffset,
|
||||
/* [in] */ BSTR *attributes);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,467 @@
|
|||
/* -*- 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 <surkov.alexander@gmail.com> (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 "CAccessibleText.h"
|
||||
|
||||
#include "Accessible2.h"
|
||||
#include "AccessibleText_i.c"
|
||||
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibleText.h"
|
||||
#include "nsIAccessibleTypes.h"
|
||||
#include "nsIWinAccessNode.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#define GET_NSIACCESSIBLETEXT \
|
||||
nsCOMPtr<nsIAccessibleText> textAcc(do_QueryInterface(this));\
|
||||
NS_ASSERTION(textAcc,\
|
||||
"Subclass of CAccessibleText doesn't implement nsIAccessibleText");\
|
||||
if (!textAcc)\
|
||||
return E_FAIL;\
|
||||
|
||||
// IUnknown
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::QueryInterface(REFIID iid, void** ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
|
||||
if (IID_IAccessibleText == iid) {
|
||||
*ppv = NS_STATIC_CAST(IAccessibleText*, this);
|
||||
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
// IAccessibleText
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::addSelection(long aStartOffset, long aEndOffset)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsresult rv = textAcc->AddSelection(aStartOffset, aEndOffset);
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::get_attributes(long aOffset, long *aStartOffset,
|
||||
long *aEndOffset, BSTR *aTextAttributes)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
PRInt32 startOffset = 0, endOffset = 0;
|
||||
textAcc->GetAttributeRange(aOffset, &startOffset, &endOffset,
|
||||
getter_AddRefs(accessible));
|
||||
if (!accessible)
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryInterface(accessible));
|
||||
if (!winAccessNode)
|
||||
return E_FAIL;
|
||||
|
||||
void **instancePtr = 0;
|
||||
winAccessNode->QueryNativeInterface(IID_IAccessible2, instancePtr);
|
||||
if (!instancePtr)
|
||||
return E_FAIL;
|
||||
|
||||
IAccessible2 *pAccessible2 = NS_STATIC_CAST(IAccessible2*, *instancePtr);
|
||||
HRESULT hr = pAccessible2->get_attributes(aTextAttributes);
|
||||
pAccessible2->Release();
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::get_caretOffset(long *aOffset)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
PRInt32 offset = 0;
|
||||
nsresult rv = textAcc->GetCaretOffset(&offset);
|
||||
*aOffset = offset;
|
||||
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::get_characterExtents(long aOffset,
|
||||
enum IA2CoordinateType aCoordType,
|
||||
long *aX, long *aY,
|
||||
long *aWidth, long *aHeight)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
|
||||
|
||||
PRInt32 x = 0, y =0, width = 0, height = 0;
|
||||
nsresult rv = textAcc->GetCharacterExtents (aOffset, &x, &y, &width, &height,
|
||||
geckoCoordType);
|
||||
*aX = x;
|
||||
*aY = y;
|
||||
*aWidth = width;
|
||||
*aHeight = height;
|
||||
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::get_nSelections(long *aNSelections)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
PRInt32 selCount = 0;
|
||||
nsresult rv = textAcc->GetSelectionCount(&selCount);
|
||||
*aNSelections = selCount;
|
||||
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::get_offsetAtPoint(long aX, long aY,
|
||||
enum IA2CoordinateType aCoordType,
|
||||
long *aOffset)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
|
||||
|
||||
PRInt32 offset = 0;
|
||||
nsresult rv = textAcc->GetOffsetAtPoint(aX, aY, geckoCoordType, &offset);
|
||||
*aOffset = offset;
|
||||
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::get_selection(long aSelectionIndex, long *aStartOffset,
|
||||
long *aEndOffset)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
PRInt32 startOffset = 0, endOffset = 0;
|
||||
nsresult rv = textAcc->GetSelectionBounds(aSelectionIndex,
|
||||
&startOffset, &endOffset);
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsAutoString text;
|
||||
nsresult rv = textAcc->GetText(aStartOffset, aEndOffset, text);
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
return ::SysReAllocStringLen(aText, text.get(), text.Length());
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::get_textBeforeOffset(long aOffset,
|
||||
enum IA2TextBoundaryType aBoundaryType,
|
||||
long *aStartOffset, long *aEndOffset,
|
||||
BSTR *aText)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoString text;
|
||||
PRInt32 startOffset = 0, endOffset = 0;
|
||||
|
||||
if (aBoundaryType == IA2_TEXT_BOUNDARY_ALL) {
|
||||
startOffset = 0;
|
||||
textAcc->GetCharacterCount(&endOffset);
|
||||
rv = textAcc->GetText(startOffset, endOffset, text);
|
||||
} else {
|
||||
nsAccessibleTextBoundary boundaryType = GetGeckoTextBoundary(aBoundaryType);
|
||||
if (boundaryType != -1) {
|
||||
rv = textAcc->GetTextBeforeOffset(aOffset, boundaryType,
|
||||
&startOffset, &endOffset, text);
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
return ::SysReAllocStringLen(aText, text.get(), text.Length());
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::get_textAfterOffset(long aOffset,
|
||||
enum IA2TextBoundaryType aBoundaryType,
|
||||
long *aStartOffset, long *aEndOffset,
|
||||
BSTR *aText)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoString text;
|
||||
PRInt32 startOffset = 0, endOffset = 0;
|
||||
|
||||
if (aBoundaryType == IA2_TEXT_BOUNDARY_ALL) {
|
||||
startOffset = 0;
|
||||
textAcc->GetCharacterCount(&endOffset);
|
||||
rv = textAcc->GetText(startOffset, endOffset, text);
|
||||
} else {
|
||||
nsAccessibleTextBoundary boundaryType = GetGeckoTextBoundary(aBoundaryType);
|
||||
if (boundaryType != -1) {
|
||||
rv = textAcc->GetTextAfterOffset(aOffset, boundaryType,
|
||||
&startOffset, &endOffset, text);
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
return ::SysReAllocStringLen(aText, text.get(), text.Length());
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::get_textAtOffset(long aOffset,
|
||||
enum IA2TextBoundaryType aBoundaryType,
|
||||
long *aStartOffset, long *aEndOffset,
|
||||
BSTR *aText)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoString text;
|
||||
PRInt32 startOffset = 0, endOffset = 0;
|
||||
|
||||
if (aBoundaryType == IA2_TEXT_BOUNDARY_ALL) {
|
||||
startOffset = 0;
|
||||
textAcc->GetCharacterCount(&endOffset);
|
||||
rv = textAcc->GetText(startOffset, endOffset, text);
|
||||
} else {
|
||||
nsAccessibleTextBoundary boundaryType = GetGeckoTextBoundary(aBoundaryType);
|
||||
if (boundaryType != -1) {
|
||||
rv = textAcc->GetTextAtOffset(aOffset, boundaryType,
|
||||
&startOffset, &endOffset, text);
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
return ::SysReAllocStringLen(aText, text.get(), text.Length());
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::removeSelection(long aSelectionIndex)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsresult rv = textAcc->RemoveSelection(aSelectionIndex);
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::setCaretOffset(long aOffset)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsresult rv = textAcc->SetCaretOffset(aOffset);
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::setSelection(long aSelectionIndex, long aStartOffset,
|
||||
long aEndOffset)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsresult rv = textAcc->SetSelectionBounds(aSelectionIndex,
|
||||
aStartOffset, aEndOffset);
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::get_nCharacters(long *aNCharacters)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
PRInt32 charCount = 0;
|
||||
nsresult rv = textAcc->GetCharacterCount(&charCount);
|
||||
*aNCharacters = charCount;
|
||||
|
||||
return NS_FAILED(rv) ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
|
||||
enum IA2ScrollType aScrollType)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
PRInt32 startOffset = 0, endOffset = 0;
|
||||
|
||||
// XXX: aEndIndex isn't used.
|
||||
textAcc->GetAttributeRange(aStartIndex, &startOffset, &endOffset,
|
||||
getter_AddRefs(accessible));
|
||||
if (!accessible)
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryInterface(accessible));
|
||||
if (!winAccessNode)
|
||||
return E_FAIL;
|
||||
|
||||
void **instancePtr = 0;
|
||||
winAccessNode->QueryNativeInterface(IID_IAccessible2, instancePtr);
|
||||
if (!instancePtr)
|
||||
return E_FAIL;
|
||||
|
||||
IAccessible2 *pAccessible2 = NS_STATIC_CAST(IAccessible2*, *instancePtr);
|
||||
HRESULT hr = pAccessible2->scrollTo(aScrollType);
|
||||
pAccessible2->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
|
||||
enum IA2CoordinateType aCoordinateType,
|
||||
long aX, long aY)
|
||||
{
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
PRInt32 startOffset = 0, endOffset = 0;
|
||||
|
||||
// XXX: aEndIndex isn't used.
|
||||
textAcc->GetAttributeRange(aStartIndex, &startOffset, &endOffset,
|
||||
getter_AddRefs(accessible));
|
||||
if (!accessible)
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryInterface(accessible));
|
||||
if (!winAccessNode)
|
||||
return E_FAIL;
|
||||
|
||||
void **instancePtr = 0;
|
||||
winAccessNode->QueryNativeInterface(IID_IAccessible2, instancePtr);
|
||||
if (!instancePtr)
|
||||
return E_FAIL;
|
||||
|
||||
IAccessible2 *pAccessible2 = NS_STATIC_CAST(IAccessible2*, *instancePtr);
|
||||
HRESULT hr = pAccessible2->scrollToPoint(aCoordinateType, aX, aY);
|
||||
pAccessible2->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::get_newText(IA2TextSegment *aNewText)
|
||||
{
|
||||
return GetModifiedText(PR_TRUE, aNewText);
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleText::get_oldText(IA2TextSegment *aOldText)
|
||||
{
|
||||
return GetModifiedText(PR_FALSE, aOldText);
|
||||
}
|
||||
|
||||
// CAccessibleText
|
||||
|
||||
HRESULT
|
||||
CAccessibleText::GetModifiedText(PRBool aGetInsertedText,
|
||||
IA2TextSegment *aText)
|
||||
{
|
||||
PRUint32 startOffset = 0, endOffset = 0;
|
||||
nsAutoString text;
|
||||
|
||||
nsresult rv = GetModifiedText(aGetInsertedText, text,
|
||||
&startOffset, &endOffset);
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
aText->start = startOffset;
|
||||
aText->end = endOffset;
|
||||
|
||||
return ::SysReAllocStringLen(&(aText->text), text.get(), text.Length());
|
||||
}
|
||||
|
||||
nsAccessibleTextBoundary
|
||||
CAccessibleText::GetGeckoTextBoundary(enum IA2TextBoundaryType aBoundaryType)
|
||||
{
|
||||
switch (aBoundaryType) {
|
||||
case IA2_TEXT_BOUNDARY_CHAR:
|
||||
return nsIAccessibleText::BOUNDARY_CHAR;
|
||||
case IA2_TEXT_BOUNDARY_WORD:
|
||||
return nsIAccessibleText::BOUNDARY_WORD_START;
|
||||
case IA2_TEXT_BOUNDARY_SENTENCE:
|
||||
return nsIAccessibleText::BOUNDARY_SENTENCE_START;
|
||||
case IA2_TEXT_BOUNDARY_PARAGRAPH:
|
||||
// XXX: not implemented
|
||||
return nsIAccessibleText::BOUNDARY_LINE_START;
|
||||
case IA2_TEXT_BOUNDARY_LINE:
|
||||
return nsIAccessibleText::BOUNDARY_LINE_START;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
/* -*- 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 <surkov.alexander@gmail.com> (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_TEXT_H
|
||||
#define _ACCESSIBLE_TEXT_H
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIAccessibleText.h"
|
||||
|
||||
#include "AccessibleText.h"
|
||||
|
||||
class CAccessibleText: public nsISupports,
|
||||
public IAccessibleText
|
||||
{
|
||||
public:
|
||||
|
||||
// IUnknown
|
||||
STDMETHODIMP QueryInterface(REFIID, void**);
|
||||
|
||||
// IAccessibleText
|
||||
virtual HRESULT STDMETHODCALLTYPE addSelection(
|
||||
/* [in] */ long startOffset,
|
||||
/* [in] */ long endOffset);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_attributes(
|
||||
/* [in] */ long offset,
|
||||
/* [out] */ long *startOffset,
|
||||
/* [out] */ long *endOffset,
|
||||
/* [retval][out] */ BSTR *textAttributes);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_caretOffset(
|
||||
/* [retval][out] */ long *offset);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_characterExtents(
|
||||
/* [in] */ long offset,
|
||||
/* [in] */ enum IA2CoordinateType coordType,
|
||||
/* [out] */ long *x,
|
||||
/* [out] */ long *y,
|
||||
/* [out] */ long *width,
|
||||
/* [retval][out] */ long *height);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelections(
|
||||
/* [retval][out] */ long *nSelections);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_offsetAtPoint(
|
||||
/* [in] */ long x,
|
||||
/* [in] */ long y,
|
||||
/* [in] */ enum IA2CoordinateType coordType,
|
||||
/* [retval][out] */ long *offset);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selection(
|
||||
/* [in] */ long selectionIndex,
|
||||
/* [out] */ long *startOffset,
|
||||
/* [retval][out] */ long *endOffset);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_text(
|
||||
/* [in] */ long startOffset,
|
||||
/* [in] */ long endOffset,
|
||||
/* [retval][out] */ BSTR *text);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textBeforeOffset(
|
||||
/* [in] */ long offset,
|
||||
/* [in] */ enum IA2TextBoundaryType boundaryType,
|
||||
/* [out] */ long *startOffset,
|
||||
/* [out] */ long *endOffset,
|
||||
/* [retval][out] */ BSTR *text);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textAfterOffset(
|
||||
/* [in] */ long offset,
|
||||
/* [in] */ enum IA2TextBoundaryType boundaryType,
|
||||
/* [out] */ long *startOffset,
|
||||
/* [out] */ long *endOffset,
|
||||
/* [retval][out] */ BSTR *text);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textAtOffset(
|
||||
/* [in] */ long offset,
|
||||
/* [in] */ enum IA2TextBoundaryType boundaryType,
|
||||
/* [out] */ long *startOffset,
|
||||
/* [out] */ long *endOffset,
|
||||
/* [retval][out] */ BSTR *text);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE removeSelection(
|
||||
/* [in] */ long selectionIndex);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE setCaretOffset(
|
||||
/* [in] */ long offset);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE setSelection(
|
||||
/* [in] */ long selectionIndex,
|
||||
/* [in] */ long startOffset,
|
||||
/* [in] */ long endOffset);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nCharacters(
|
||||
/* [retval][out] */ long *nCharacters);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE scrollSubstringTo(
|
||||
/* [in] */ long startIndex,
|
||||
/* [in] */ long endIndex,
|
||||
/* [in] */ enum IA2ScrollType scrollType);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE scrollSubstringToPoint(
|
||||
/* [in] */ long startIndex,
|
||||
/* [in] */ long endIndex,
|
||||
/* [in] */ enum IA2CoordinateType coordinateType,
|
||||
/* [in] */ long x,
|
||||
/* [in] */ long y);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_newText(
|
||||
/* [retval][out] */ IA2TextSegment *newText);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_oldText(
|
||||
/* [retval][out] */ IA2TextSegment *oldText);
|
||||
|
||||
protected:
|
||||
virtual nsresult GetModifiedText(PRBool aGetInsertedText, nsAString& aText,
|
||||
PRUint32 *aStartOffset,
|
||||
PRUint32 *aEndOffset) = 0;
|
||||
|
||||
private:
|
||||
HRESULT GetModifiedText(PRBool aGetInsertedText, IA2TextSegment *aNewText);
|
||||
nsAccessibleTextBoundary GetGeckoTextBoundary(enum IA2TextBoundaryType coordinateType);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -75,6 +75,9 @@ CPPSRCS = \
|
|||
nsHTMLWin32ObjectAccessible.cpp \
|
||||
nsXULMenuAccessibleWrap.cpp \
|
||||
nsXULTreeAccessibleWrap.cpp \
|
||||
nsHyperTextAccessibleWrap.cpp \
|
||||
CAccessibleText.cpp \
|
||||
CAccessibleEditableText.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
|
@ -86,6 +89,9 @@ EXPORTS = \
|
|||
nsHTMLWin32ObjectAccessible.h \
|
||||
nsXULMenuAccessibleWrap.h \
|
||||
nsXULTreeAccessibleWrap.h \
|
||||
nsHyperTextAccessibleWrap.h \
|
||||
CAccessibleText.h \
|
||||
CAccessibleEditableText.h \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
|
|
|
@ -89,21 +89,26 @@ nsAccessNodeWrap::~nsAccessNodeWrap()
|
|||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// nsISupports methods
|
||||
//-----------------------------------------------------
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccessNodeWrap, nsAccessNode, nsIWinAccessNode);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// nsIWinAccessNode methods
|
||||
//-----------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNodeWrap::QueryNativeInterface(REFIID aIID, void** aInstancePtr)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// IUnknown interface methods - see iunknown.h for documentation
|
||||
//-----------------------------------------------------
|
||||
|
||||
STDMETHODIMP_(ULONG) nsAccessNodeWrap::AddRef()
|
||||
{
|
||||
return nsAccessNode::AddRef();
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) nsAccessNodeWrap::Release()
|
||||
{
|
||||
return nsAccessNode::Release();
|
||||
}
|
||||
|
||||
STDMETHODIMP nsAccessNodeWrap::QueryInterface(REFIID iid, void** ppv)
|
||||
{
|
||||
*ppv = nsnull;
|
||||
|
@ -118,7 +123,6 @@ STDMETHODIMP nsAccessNodeWrap::QueryInterface(REFIID iid, void** ppv)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// ISimpleDOMNode methods
|
||||
//-----------------------------------------------------
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIWinAccessNode.h"
|
||||
#include "ISimpleDOMNode.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIContent.h"
|
||||
|
@ -57,15 +58,19 @@
|
|||
typedef LRESULT (STDAPICALLTYPE *LPFNNOTIFYWINEVENT)(DWORD event,HWND hwnd,LONG idObjectType,LONG idObject);
|
||||
typedef LRESULT (STDAPICALLTYPE *LPFNGETGUITHREADINFO)(DWORD idThread, GUITHREADINFO* pgui);
|
||||
|
||||
class nsAccessNodeWrap : public nsAccessNode, public ISimpleDOMNode
|
||||
class nsAccessNodeWrap : public nsAccessNode,
|
||||
public nsIWinAccessNode,
|
||||
public ISimpleDOMNode
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWINACCESSNODE
|
||||
|
||||
public: // construction, destruction
|
||||
nsAccessNodeWrap(nsIDOMNode *, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessNodeWrap();
|
||||
|
||||
// IUnknown methods - see iunknown.h for documentation
|
||||
STDMETHODIMP_(ULONG) AddRef();
|
||||
STDMETHODIMP_(ULONG) Release();
|
||||
// IUnknown
|
||||
STDMETHODIMP QueryInterface(REFIID, void**);
|
||||
|
||||
public:
|
||||
|
|
|
@ -94,18 +94,11 @@ nsAccessibleWrap::~nsAccessibleWrap()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsAccessibleWrap, nsAccessible);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// IUnknown interface methods - see iunknown.h for documentation
|
||||
//-----------------------------------------------------
|
||||
STDMETHODIMP_(ULONG) nsAccessibleWrap::AddRef()
|
||||
{
|
||||
return nsAccessNode::AddRef();
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) nsAccessibleWrap::Release()
|
||||
{
|
||||
return nsAccessNode::Release();
|
||||
}
|
||||
|
||||
// Microsoft COM QueryInterface
|
||||
STDMETHODIMP nsAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
|
||||
|
|
|
@ -48,6 +48,45 @@
|
|||
#include "Accessible2.h"
|
||||
#include "AccessibleAction.h"
|
||||
|
||||
#define DECL_IUNKNOWN_INHERITED \
|
||||
public: \
|
||||
STDMETHODIMP QueryInterface(REFIID, void**); \
|
||||
|
||||
#define IMPL_IUNKNOWN_QUERY_HEAD(Class) \
|
||||
STDMETHODIMP \
|
||||
Class::QueryInterface(REFIID iid, void** ppv) \
|
||||
{ \
|
||||
HRESULT hr = E_NOINTERFACE; \
|
||||
*ppv = NULL; \
|
||||
|
||||
#define IMPL_IUNKNOWN_QUERY_TAIL \
|
||||
return hr; \
|
||||
} \
|
||||
|
||||
#define IMPL_IUNKNOWN_QUERY_ENTRY(Class) \
|
||||
hr = Class::QueryInterface(iid, ppv); \
|
||||
if (SUCCEEDED(hr)) \
|
||||
return hr; \
|
||||
|
||||
#define IMPL_IUNKNOWN_INHERITED0(Class, Super) \
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(Class) \
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY(Super) \
|
||||
IMPL_IUNKNOWN_QUERY_TAIL \
|
||||
|
||||
#define IMPL_IUNKNOWN_INHERITED1(Class, Super, I1) \
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(Class) \
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY(I1); \
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY(Super) \
|
||||
IMPL_IUNKNOWN_QUERY_TAIL \
|
||||
|
||||
#define IMPL_IUNKNOWN_INHERITED2(Class, Super, I1, I2) \
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(Class) \
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY(I1); \
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY(I2); \
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY(Super) \
|
||||
IMPL_IUNKNOWN_QUERY_TAIL \
|
||||
|
||||
|
||||
class nsAccessibleWrap : public nsAccessible,
|
||||
public IAccessible2,
|
||||
public IAccessibleAction,
|
||||
|
@ -58,9 +97,10 @@ class nsAccessibleWrap : public nsAccessible,
|
|||
nsAccessibleWrap(nsIDOMNode*, nsIWeakReference *aShell);
|
||||
virtual ~nsAccessibleWrap();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
public: // IUnknown methods - see iunknown.h for documentation
|
||||
STDMETHODIMP_(ULONG) AddRef();
|
||||
STDMETHODIMP_(ULONG) Release();
|
||||
STDMETHODIMP QueryInterface(REFIID, void**);
|
||||
|
||||
public: // IServiceProvider
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
/* -*- 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 <surkov.alexander@gmail.com> (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 "nsHyperTextAccessibleWrap.h"
|
||||
|
||||
nsString nsHyperTextAccessibleWrap::sText;
|
||||
PRInt32 nsHyperTextAccessibleWrap::sOffset = 0;
|
||||
PRUint32 nsHyperTextAccessibleWrap::sLength = 0;
|
||||
PRBool nsHyperTextAccessibleWrap::sIsInserted = PR_FALSE;
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsHyperTextAccessibleWrap,
|
||||
nsHyperTextAccessible)
|
||||
|
||||
IMPL_IUNKNOWN_INHERITED2(nsHyperTextAccessibleWrap, nsAccessibleWrap,
|
||||
CAccessibleText, CAccessibleEditableText);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHyperTextAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
{
|
||||
PRUint32 eventType;
|
||||
aEvent->GetEventType(&eventType);
|
||||
|
||||
if (eventType == nsIAccessibleEvent::EVENT_TEXT_CHANGED) {
|
||||
nsCOMPtr<nsIAccessibleTextChangeEvent> textEvent(do_QueryInterface(aEvent));
|
||||
NS_ENSURE_STATE(textEvent);
|
||||
|
||||
textEvent->GetStart(&sOffset);
|
||||
textEvent->GetLength(&sLength);
|
||||
textEvent->IsInserted(&sIsInserted);
|
||||
|
||||
GetText(sOffset, sOffset + sLength, sText);
|
||||
}
|
||||
|
||||
return nsHyperTextAccessible::FireAccessibleEvent(aEvent);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHyperTextAccessibleWrap::GetModifiedText(PRBool aGetInsertedText,
|
||||
nsAString& aText,
|
||||
PRUint32 *aStartOffset,
|
||||
PRUint32 *aEndOffset)
|
||||
{
|
||||
if ((aGetInsertedText && sIsInserted) || (!aGetInsertedText && !sIsInserted)) {
|
||||
aText.Assign(sText);
|
||||
*aStartOffset = sOffset;
|
||||
*aEndOffset = sOffset + sLength;
|
||||
} else {
|
||||
aText.Truncate();
|
||||
*aStartOffset = 0;
|
||||
*aEndOffset = 0;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
/* -*- 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 <surkov.alexander@gmail.com> (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 _NSHYPERTEXTACCESSIBLEWRAP_H
|
||||
#define _NSHYPERTEXTACCESSIBLEWRAP_H
|
||||
|
||||
#include "nsHyperTextAccessible.h"
|
||||
#include "CAccessibleText.h"
|
||||
#include "CAccessibleEditableText.h"
|
||||
|
||||
class nsHyperTextAccessibleWrap : public nsHyperTextAccessible,
|
||||
public CAccessibleText,
|
||||
public CAccessibleEditableText
|
||||
{
|
||||
public:
|
||||
nsHyperTextAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsHyperTextAccessible(aNode, aShell){}
|
||||
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN_INHERITED
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD FireAccessibleEvent(nsIAccessibleEvent *aEvent);
|
||||
|
||||
protected:
|
||||
virtual nsresult GetModifiedText(PRBool aGetInsertedText, nsAString& aText,
|
||||
PRUint32 *aStartOffset,
|
||||
PRUint32 *aEndOffset);
|
||||
|
||||
private:
|
||||
static nsString sText;
|
||||
static PRInt32 sOffset;
|
||||
static PRUint32 sLength;
|
||||
static PRBool sIsInserted;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -81,6 +81,7 @@ EXPORTS = \
|
|||
nsRootAccessibleWrap.h \
|
||||
nsXULMenuAccessibleWrap.h \
|
||||
nsXULTreeAccessibleWrap.h \
|
||||
nsHyperTextAccessibleWrap.h \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 _NSHYPERTEXTACCESSIBLEWRAP_H
|
||||
#define _NSHYPERTEXTACCESSIBLEWRAP_H
|
||||
|
||||
#include "nsHyperTextAccessible.h"
|
||||
|
||||
typedef class nsHyperTextAccessible nsHyperTextAccessibleWrap;
|
||||
|
||||
#endif
|
||||
|
|
@ -64,7 +64,7 @@ nsXFormsAccessibleBase::nsXFormsAccessibleBase()
|
|||
|
||||
nsXFormsAccessible::
|
||||
nsXFormsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessible(aNode, aShell)
|
||||
nsHyperTextAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ nsXFormsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
rv = sXFormsService->IsValid(mDOMNode, &isValid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = nsHyperTextAccessible::GetState(aState, aExtraState);
|
||||
rv = nsHyperTextAccessibleWrap::GetState(aState, aExtraState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!isRelevant)
|
||||
|
@ -246,7 +246,7 @@ nsXFormsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
|
||||
nsresult rv = nsHyperTextAccessible::GetAttributesInternal(aAttributes);
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoString name;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#ifndef _nsXFormsAccessible_H_
|
||||
#define _nsXFormsAccessible_H_
|
||||
|
||||
#include "nsHyperTextAccessible.h"
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
#include "nsIXFormsUtilityService.h"
|
||||
|
||||
#define NS_NAMESPACE_XFORMS "http://www.w3.org/2002/xforms"
|
||||
|
@ -66,7 +66,7 @@ protected:
|
|||
* XForms hint and XForms label elements should have accessible object. This
|
||||
* class is base class for accessible objects for these XForms elements.
|
||||
*/
|
||||
class nsXFormsAccessible : public nsHyperTextAccessible,
|
||||
class nsXFormsAccessible : public nsHyperTextAccessibleWrap,
|
||||
public nsXFormsAccessibleBase
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -671,7 +671,7 @@ nsXULToolbarSeparatorAccessible::GetState(PRUint32 *aState,
|
|||
*/
|
||||
|
||||
nsXULTextFieldAccessible::nsXULTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsHyperTextAccessible(aNode, aShell)
|
||||
nsHyperTextAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -681,7 +681,7 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXULTextFieldAccessible, nsHyperTextAccessible,
|
|||
NS_IMETHODIMP nsXULTextFieldAccessible::Init()
|
||||
{
|
||||
CheckForEditor();
|
||||
return nsHyperTextAccessible::Init();
|
||||
return nsHyperTextAccessibleWrap::Init();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULTextFieldAccessible::Shutdown()
|
||||
|
@ -690,7 +690,7 @@ NS_IMETHODIMP nsXULTextFieldAccessible::Shutdown()
|
|||
mEditor->RemoveEditActionListener(this);
|
||||
mEditor = nsnull;
|
||||
}
|
||||
return nsHyperTextAccessible::Shutdown();
|
||||
return nsHyperTextAccessibleWrap::Shutdown();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULTextFieldAccessible::GetValue(nsAString& aValue)
|
||||
|
@ -732,7 +732,7 @@ nsXULTextFieldAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
{
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = nsHyperTextAccessible::GetState(aState, aExtraState);
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetState(aState, aExtraState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> inputField = GetInputField();
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "nsAccessibleWrap.h"
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsXULSelectAccessible.h"
|
||||
#include "nsHyperTextAccessible.h"
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
|
||||
class nsXULButtonAccessible : public nsAccessibleWrap
|
||||
// Don't inherit from nsFormControlAccessible - it doesn't allow children and a button can have a dropmarker child
|
||||
|
@ -148,7 +148,7 @@ public:
|
|||
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
};
|
||||
|
||||
class nsXULTextFieldAccessible : public nsHyperTextAccessible
|
||||
class nsXULTextFieldAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
enum { eAction_Click = 0 };
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
* For XUL descriptions and labels
|
||||
*/
|
||||
nsXULTextAccessible::nsXULTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessible(aDomNode, aShell)
|
||||
nsHyperTextAccessibleWrap(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ NS_IMETHODIMP nsXULTextAccessible::GetName(nsAString& aName)
|
|||
NS_IMETHODIMP
|
||||
nsXULTextAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessible::GetState(aState, aExtraState);
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetState(aState, aExtraState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Labels and description have read only state
|
||||
|
|
|
@ -42,11 +42,11 @@
|
|||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsTextAccessibleWrap.h"
|
||||
#include "nsHyperTextAccessible.h"
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
|
||||
class nsIWeakReference;
|
||||
|
||||
class nsXULTextAccessible : public nsHyperTextAccessible
|
||||
class nsXULTextAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
|
||||
public:
|
||||
|
|
Загрузка…
Ссылка в новой задаче