Bug 339314 remove the unnecessary nsMaiInterface classes

r=aaronleventhal
This commit is contained in:
ginn.chen%sun.com 2006-05-29 05:46:38 +00:00
Родитель ef91b8c8bb
Коммит 475276a34c
22 изменённых файлов: 334 добавлений и 885 удалений

Просмотреть файл

@ -1,60 +0,0 @@
#
# ***** 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
# Sun Microsystems, Inc.
# Portions created by the Initial Developer are Copyright (C) 2003
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# 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 *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = accessibility
XPIDL_MODULE = accessibility-atk
GRE_MODULE = 1
XPIDLSRCS = \
nsIAccessibleAction.idl \
nsIAccessibleEditableText.idl \
nsIAccessibleHyperLink.idl \
nsIAccessibleHyperText.idl \
nsIAccessibleTable.idl \
nsIAccessibleText.idl \
nsIAccessibleValue.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -74,7 +74,6 @@ CPPSRCS = \
nsHTMLLinkAccessibleWrap.cpp \
nsHTMLTableAccessibleWrap.cpp \
nsHTMLBlockAccessible.cpp \
nsMaiInterface.cpp \
nsMaiInterfaceComponent.cpp \
nsMaiInterfaceAction.cpp \
nsMaiInterfaceText.cpp \

Просмотреть файл

@ -68,6 +68,47 @@ enum {
LAST_SIGNAL
};
enum MaiInterfaceType {
MAI_INTERFACE_COMPONENT, /* 0 */
MAI_INTERFACE_ACTION,
MAI_INTERFACE_VALUE,
MAI_INTERFACE_EDITABLE_TEXT,
MAI_INTERFACE_HYPERTEXT,
MAI_INTERFACE_SELECTION,
MAI_INTERFACE_TABLE,
MAI_INTERFACE_TEXT /* 7 */
};
static const GType AtkTypeForMai[] = {
ATK_TYPE_COMPONENT,
ATK_TYPE_ACTION,
ATK_TYPE_VALUE,
ATK_TYPE_EDITABLE_TEXT,
ATK_TYPE_HYPERTEXT,
ATK_TYPE_SELECTION,
ATK_TYPE_TABLE,
ATK_TYPE_TEXT
};
static const GInterfaceInfo atk_if_infos[] = {
{(GInterfaceInitFunc)componentInterfaceInitCB,
(GInterfaceFinalizeFunc) NULL, NULL},
{(GInterfaceInitFunc)actionInterfaceInitCB,
(GInterfaceFinalizeFunc) NULL, NULL},
{(GInterfaceInitFunc)valueInterfaceInitCB,
(GInterfaceFinalizeFunc) NULL, NULL},
{(GInterfaceInitFunc)editableTextInterfaceInitCB,
(GInterfaceFinalizeFunc) NULL, NULL},
{(GInterfaceInitFunc)hypertextInterfaceInitCB,
(GInterfaceFinalizeFunc) NULL, NULL},
{(GInterfaceInitFunc)selectionInterfaceInitCB,
(GInterfaceFinalizeFunc) NULL, NULL},
{(GInterfaceInitFunc)tableInterfaceInitCB,
(GInterfaceFinalizeFunc) NULL, NULL},
{(GInterfaceInitFunc)textInterfaceInitCB,
(GInterfaceFinalizeFunc) NULL, NULL}
};
/**
* This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
*/
@ -144,9 +185,8 @@ static AtkRelationSet* refRelationSetCB(AtkObject *aAtkObj);
*/
G_END_DECLS
static GType GetMaiAtkType(const PRUint32 & interfaceCount,
MaiInterface **interfaces);
static const char * GetUniqueMaiAtkTypeName(MaiInterface **interfaces);
static GType GetMaiAtkType(PRUint16 interfacesBits);
static const char * GetUniqueMaiAtkTypeName(PRUint16 interfacesBits);
static gpointer parent_class = NULL;
@ -183,9 +223,7 @@ PRInt32 nsAccessibleWrap::mAccWrapDeleted = 0;
nsAccessibleWrap::nsAccessibleWrap(nsIDOMNode* aNode,
nsIWeakReference *aShell)
: nsAccessible(aNode, aShell),
mMaiAtkObject(nsnull),
mInterfaces(nsnull),
mInterfaceCount(0)
mMaiAtkObject(nsnull)
{
#ifdef MAI_LOGGING
++mAccWrapCreated;
@ -209,11 +247,6 @@ nsAccessibleWrap::~nsAccessibleWrap()
MAI_ATK_OBJECT(mMaiAtkObject)->accWrap = nsnull;
g_object_unref(mMaiAtkObject);
}
if (mInterfaces) {
for (int index = 0; index < MAI_INTERFACE_NUM; ++index)
delete mInterfaces[index];
delete [] mInterfaces;
}
}
NS_IMETHODIMP nsAccessibleWrap::GetExtState(PRUint32 *aState)
@ -230,8 +263,7 @@ NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible)
*aOutAccessible = nsnull;
if (!mMaiAtkObject) {
CreateMaiInterfaces();
GType type = GetMaiAtkType(mInterfaceCount, mInterfaces);
GType type = GetMaiAtkType(CreateMaiInterfaces());
NS_ENSURE_TRUE(type, NS_ERROR_FAILURE);
mMaiAtkObject =
NS_REINTERPRET_CAST(AtkObject *,
@ -256,41 +288,25 @@ nsAccessibleWrap::GetAtkObject(void)
}
/* private */
nsresult
PRUint16
nsAccessibleWrap::CreateMaiInterfaces(void)
{
typedef MaiInterface * MaiInterfacePointer;
if (!mInterfaces) {
mInterfaces = new MaiInterfacePointer[MAI_INTERFACE_NUM];
for (PRUint16 index = 0; index < MAI_INTERFACE_NUM; ++index) {
mInterfaces[index] = nsnull;
}
NS_ENSURE_TRUE(mInterfaces, NS_ERROR_OUT_OF_MEMORY);
}
PRUint16 interfacesBits = 0;
// Add Interfaces for each nsIAccessible.ext interfaces
nsresult rv;
// the Component interface are supported by all nsIAccessible
MaiInterfaceComponent *maiInterfaceComponent =
new MaiInterfaceComponent(this);
NS_ENSURE_TRUE(maiInterfaceComponent, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceComponent);
NS_ENSURE_SUCCESS(rv, rv);
interfacesBits |= 1 << MAI_INTERFACE_COMPONENT;
// Add Action interface if the action count is more than zero.
PRUint8 actionCount = 0;
rv = GetNumActions(&actionCount);
nsresult rv = GetNumActions(&actionCount);
if (NS_SUCCEEDED(rv) && actionCount > 0) {
MaiInterfaceAction *maiInterfaceAction = new MaiInterfaceAction(this);
NS_ENSURE_TRUE(maiInterfaceAction, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceAction);
NS_ENSURE_SUCCESS(rv, rv);
interfacesBits |= 1 << MAI_INTERFACE_ACTION;
}
PRUint32 accRole;
rv = GetRole(&accRole);
GetRole(&accRole);
if (accRole != nsIAccessible::ROLE_HTML_CONTAINER) {
//nsIAccessibleText
@ -298,10 +314,7 @@ nsAccessibleWrap::CreateMaiInterfaces(void)
QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accessInterfaceText));
if (accessInterfaceText) {
MaiInterfaceText *maiInterfaceText = new MaiInterfaceText(this);
NS_ENSURE_TRUE(maiInterfaceText, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceText);
NS_ENSURE_SUCCESS(rv, rv);
interfacesBits |= 1 << MAI_INTERFACE_TEXT;
}
//nsIAccessibleEditableText
@ -309,11 +322,7 @@ nsAccessibleWrap::CreateMaiInterfaces(void)
QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
getter_AddRefs(accessInterfaceEditableText));
if (accessInterfaceEditableText) {
MaiInterfaceEditableText *maiInterfaceEditableText =
new MaiInterfaceEditableText(this);
NS_ENSURE_TRUE(maiInterfaceEditableText, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceEditableText);
NS_ENSURE_SUCCESS(rv, rv);
interfacesBits |= 1 << MAI_INTERFACE_EDITABLE_TEXT;
}
}
@ -322,11 +331,7 @@ nsAccessibleWrap::CreateMaiInterfaces(void)
QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
getter_AddRefs(accessInterfaceSelection));
if (accessInterfaceSelection) {
MaiInterfaceSelection *maiInterfaceSelection =
new MaiInterfaceSelection(this);
NS_ENSURE_TRUE(maiInterfaceSelection, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceSelection);
NS_ENSURE_SUCCESS(rv, rv);
interfacesBits |= 1 << MAI_INTERFACE_SELECTION;
}
//nsIAccessibleValue
@ -334,10 +339,7 @@ nsAccessibleWrap::CreateMaiInterfaces(void)
QueryInterface(NS_GET_IID(nsIAccessibleValue),
getter_AddRefs(accessInterfaceValue));
if (accessInterfaceValue) {
MaiInterfaceValue *maiInterfaceValue = new MaiInterfaceValue(this);
NS_ENSURE_TRUE(maiInterfaceValue, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceValue);
NS_ENSURE_SUCCESS(rv, rv);
interfacesBits |= 1 << MAI_INTERFACE_VALUE;
}
//nsIAccessibleHypertext
@ -346,13 +348,9 @@ nsAccessibleWrap::CreateMaiInterfaces(void)
QueryInterface(NS_GET_IID(nsIAccessibleHyperText),
getter_AddRefs(accessInterfaceHypertext));
if (accessInterfaceHypertext) {
rv = accessInterfaceHypertext->GetLinks(&linkCount);
nsresult rv = accessInterfaceHypertext->GetLinks(&linkCount);
if (NS_SUCCEEDED(rv) && (linkCount > 0)) {
MaiInterfaceHypertext *maiInterfaceHypertext =
new MaiInterfaceHypertext(this, mWeakShell);
NS_ENSURE_TRUE(maiInterfaceHypertext, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceHypertext);
NS_ENSURE_SUCCESS(rv, rv);
interfacesBits |= 1 << MAI_INTERFACE_HYPERTEXT;
}
}
@ -365,44 +363,15 @@ nsAccessibleWrap::CreateMaiInterfaces(void)
QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accessInterfaceTable));
if (accessInterfaceTable) {
MaiInterfaceTable *maiInterfaceTable = new MaiInterfaceTable(this);
NS_ENSURE_TRUE(maiInterfaceTable, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceTable);
NS_ENSURE_SUCCESS(rv, rv);
interfacesBits |= 1 << MAI_INTERFACE_TABLE;
}
}
return rv;
}
nsresult
nsAccessibleWrap::AddMaiInterface(MaiInterface *aMaiIface)
{
NS_ENSURE_ARG_POINTER(aMaiIface);
MaiInterfaceType aMaiIfaceType = aMaiIface->GetType();
if ((aMaiIfaceType <= MAI_INTERFACE_INVALID) ||
(aMaiIfaceType >= MAI_INTERFACE_NUM))
return NS_ERROR_FAILURE;
// if same type of If has been added, release previous one
if (mInterfaces[aMaiIfaceType]) {
delete mInterfaces[aMaiIfaceType];
}
mInterfaces[aMaiIfaceType] = aMaiIface;
mInterfaceCount++;
return NS_OK;
}
MaiInterface *
nsAccessibleWrap::GetMaiInterface(PRInt16 aIfaceType)
{
NS_ENSURE_TRUE(aIfaceType > MAI_INTERFACE_INVALID, nsnull);
NS_ENSURE_TRUE(aIfaceType < MAI_INTERFACE_NUM, nsnull);
return mInterfaces[aIfaceType];
return interfacesBits;
}
static GType
GetMaiAtkType(const PRUint32 & interfaceCount, MaiInterface **interfaces)
GetMaiAtkType(PRUint16 interfacesBits)
{
GType type;
static const GTypeInfo tinfo = {
@ -418,16 +387,13 @@ GetMaiAtkType(const PRUint32 & interfaceCount, MaiInterface **interfaces)
NULL /* value table */
};
if (interfaceCount == 0)
return MAI_TYPE_ATK_OBJECT;
/*
* The members we used to register a GType are MaiInterface::GetAtkType()
* and MaiInterface::GetInterfaceInfo(), which is the same with different
* MaiInterface objects. So we can reuse the registered GType when having
* the same MaiInterface types.
*/
const char *atkTypeName = GetUniqueMaiAtkTypeName(interfaces);
const char *atkTypeName = GetUniqueMaiAtkTypeName(interfacesBits);
type = g_type_from_name(atkTypeName);
if (type) {
return type;
@ -447,30 +413,27 @@ GetMaiAtkType(const PRUint32 & interfaceCount, MaiInterface **interfaces)
return 0;
}
for (int index = 0; index < MAI_INTERFACE_NUM; index++) {
if (!interfaces[index])
continue;
for (PRUint32 index = 0; index < NS_ARRAY_LENGTH(AtkTypeForMai); index++) {
if (interfacesBits & (1 << index)) {
g_type_add_interface_static(type,
interfaces[index]->GetAtkType(),
interfaces[index]->GetInterfaceInfo());
AtkTypeForMai[index],
&atk_if_infos[index]);
}
}
return type;
}
static const char *
GetUniqueMaiAtkTypeName(MaiInterface **interfaces)
GetUniqueMaiAtkTypeName(PRUint16 interfacesBits)
{
#define MAI_ATK_TYPE_NAME_LEN (30) /* 10+sizeof(PRUint16)*8/4+1 < 30 */
PRUint16 atkTypeNameId = 0;
static gchar namePrefix[] = "MaiAtkType"; /* size = 10 */
static gchar name[MAI_ATK_TYPE_NAME_LEN + 1];
for (int index = 0; index < MAI_INTERFACE_NUM; index++) {
if (interfaces[index])
atkTypeNameId |= 1 << index;
}
PR_snprintf(name, MAI_ATK_TYPE_NAME_LEN, "%s%x", namePrefix, atkTypeNameId);
PR_snprintf(name, MAI_ATK_TYPE_NAME_LEN, "%s%x", namePrefix,
interfacesBits);
name[MAI_ATK_TYPE_NAME_LEN] = '\0';
MAI_LOG_DEBUG(("MaiWidget::LastedTypeName=%s\n", name));

Просмотреть файл

@ -51,9 +51,6 @@
#define MAI_LOGGING
#endif /* #ifdef PR_LOGGING */
class nsAccessibleWrap;
class MaiInterface;
struct _AtkObject;
typedef struct _AtkObject AtkObject;
@ -79,22 +76,24 @@ public:
NS_IMETHOD GetExtState(PRUint32 *aState);
AtkObject * GetAtkObject(void);
MaiInterface *GetMaiInterface(PRInt16 aIfaceType);
PRBool IsValidObject();
static void TranslateStates(PRUint32 aState,
PRUint32 aExtState,
void *aAtkStateSet);
static const char * ReturnString(nsAString &aString) {
static nsCString returnedString;
returnedString = NS_ConvertUTF16toUTF8(aString);
return returnedString.get();
}
protected:
AtkObject *mMaiAtkObject;
private:
nsresult CreateMaiInterfaces(void);
nsresult AddMaiInterface(MaiInterface *aMaiIface);
MaiInterface **mInterfaces;
PRUint32 mInterfaceCount;
PRUint16 CreateMaiInterfaces(void);
};
#endif /* __NS_ACCESSIBLE_WRAP_H__ */

Просмотреть файл

@ -123,9 +123,7 @@ mai_atk_hyperlink_get_type(void)
return type;
}
MaiHyperlink::MaiHyperlink(nsIAccessibleHyperLink *aAcc,
nsIDOMNode *aNode, nsIWeakReference* aShell):
nsAccessNodeWrap(aNode, aShell),
MaiHyperlink::MaiHyperlink(nsIAccessibleHyperLink *aAcc):
mHyperlink(aAcc),
mMaiAtkHyperlink(nsnull)
{

Просмотреть файл

@ -41,8 +41,6 @@
#ifndef __MAI_HYPERLINK_H__
#define __MAI_HYPERLINK_H__
#include "nsString.h"
#include "nsMai.h"
#include "nsIAccessibleHyperLink.h"
@ -53,11 +51,10 @@ typedef struct _AtkHyperlink AtkHyperlink;
* MaiHyperlink is a auxiliary class for MaiInterfaceHyperText.
*/
class MaiHyperlink : public nsAccessNodeWrap
class MaiHyperlink
{
public:
MaiHyperlink(nsIAccessibleHyperLink *aAcc,
nsIDOMNode *aNode, nsIWeakReference* aShell);
MaiHyperlink(nsIAccessibleHyperLink *aAcc);
~MaiHyperlink();
NS_IMETHOD GetUniqueID(void **aUniqueID);

Просмотреть файл

@ -39,52 +39,10 @@
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceAction.h"
#include "nsAccessibleWrap.h"
#include "nsString.h"
G_BEGIN_DECLS
static void interfaceInitCB(AtkActionIface *aIface);
/* action interface callbacks */
static gboolean doActionCB(AtkAction *aAction, gint aActionIndex);
static gint getActionCountCB(AtkAction *aAction);
static const gchar *getDescriptionCB(AtkAction *aAction, gint aActionIndex);
static const gchar *getNameCB(AtkAction *aAction, gint aActionIndex);
static const gchar *getKeyBindingCB(AtkAction *aAction, gint aActionIndex);
static gboolean setDescriptionCB(AtkAction *aAction, gint aActionIndex,
const gchar *aDesc);
G_END_DECLS
MaiInterfaceAction::MaiInterfaceAction(nsAccessibleWrap *aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceAction::~MaiInterfaceAction()
{
}
MaiInterfaceType
MaiInterfaceAction::GetType()
{
return MAI_INTERFACE_ACTION;
}
const GInterfaceInfo *
MaiInterfaceAction::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_action_info = {
(GInterfaceInitFunc)interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_action_info;
}
/* static functions */
void
interfaceInitCB(AtkActionIface *aIface)
actionInterfaceInitCB(AtkActionIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)
@ -92,10 +50,9 @@ interfaceInitCB(AtkActionIface *aIface)
aIface->do_action = doActionCB;
aIface->get_n_actions = getActionCountCB;
aIface->get_description = getDescriptionCB;
aIface->get_description = getActionDescriptionCB;
aIface->get_keybinding = getKeyBindingCB;
aIface->get_name = getNameCB;
aIface->set_description = setDescriptionCB;
aIface->get_name = getActionNameCB;
}
gboolean
@ -120,29 +77,22 @@ getActionCountCB(AtkAction *aAction)
}
const gchar *
getDescriptionCB(AtkAction *aAction, gint aActionIndex)
getActionDescriptionCB(AtkAction *aAction, gint aActionIndex)
{
// the interface in nsIAccessibleAction is empty
// use getName as default description
return getNameCB(aAction, aActionIndex);
// use getActionName as default description
return getActionNameCB(aAction, aActionIndex);
}
const gchar *
getNameCB(AtkAction *aAction, gint aActionIndex)
getActionNameCB(AtkAction *aAction, gint aActionIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
NS_ENSURE_TRUE(accWrap, nsnull);
MaiInterfaceAction *action =
NS_STATIC_CAST(MaiInterfaceAction *,
accWrap->GetMaiInterface(MAI_INTERFACE_ACTION));
NS_ENSURE_TRUE(action, nsnull);
nsAutoString autoStr;
nsresult rv = accWrap->GetActionName(aActionIndex, autoStr);
NS_ENSURE_SUCCESS(rv, nsnull);
action->SetName(autoStr);
return action->GetName();
return nsAccessibleWrap::ReturnString(autoStr);
}
const gchar *
@ -151,16 +101,7 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
NS_ENSURE_TRUE(accWrap, nsnull);
MaiInterfaceAction *action =
NS_STATIC_CAST(MaiInterfaceAction *,
accWrap->GetMaiInterface(MAI_INTERFACE_ACTION));
NS_ENSURE_TRUE(action, nsnull);
if (*action->GetKeyBinding())
return action->GetKeyBinding();
//return all KeyBindings including accesskey and shortcut
nsAutoString allKeyBinding;
//get accesskey
@ -245,17 +186,5 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
}
allKeyBinding += NS_LITERAL_STRING(";") + subShortcut;
action->SetKeyBinding(allKeyBinding);
return action->GetKeyBinding();
}
gboolean
setDescriptionCB(AtkAction *aAction, gint aActionIndex,
const gchar *aDesc)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
NS_ENSURE_TRUE(accWrap, nsnull);
/* this is not supported in nsIAccessible yet */
return FALSE;
return nsAccessibleWrap::ReturnString(allKeyBinding);
}

Просмотреть файл

@ -41,29 +41,18 @@
#ifndef __MAI_INTERFACE_ACTION_H__
#define __MAI_INTERFACE_ACTION_H__
#include "nsMaiInterface.h"
#include "nsMai.h"
class MaiInterfaceAction: public MaiInterface
{
public:
MaiInterfaceAction(nsAccessibleWrap*);
virtual ~MaiInterfaceAction();
G_BEGIN_DECLS
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
/* action interface callbacks */
void actionInterfaceInitCB(AtkActionIface *aIface);
gboolean doActionCB(AtkAction *aAction, gint aActionIndex);
gint getActionCountCB(AtkAction *aAction);
const gchar *getActionDescriptionCB(AtkAction *aAction, gint aActionIndex);
const gchar *getActionNameCB(AtkAction *aAction, gint aActionIndex);
const gchar *getKeyBindingCB(AtkAction *aAction, gint aActionIndex);
const char *GetName() {
return mName.get();
}
void SetName(nsAString &aString) { mName = NS_ConvertUTF16toUTF8(aString); }
const char *GetKeyBinding() {
return mKeyBinding.get();
}
void SetKeyBinding(nsAString &aString) { mKeyBinding = NS_ConvertUTF16toUTF8(aString); }
private:
nsCString mName;
nsCString mKeyBinding;
};
G_END_DECLS
#endif /* __MAI_INTERFACE_ACTION_H__ */

Просмотреть файл

@ -41,66 +41,8 @@
#include "nsMaiInterfaceComponent.h"
#include "nsAccessibleWrap.h"
G_BEGIN_DECLS
/* component interface callbacks */
static void interfaceInitCB(AtkComponentIface *aIface);
static AtkObject *refAccessibleAtPointCB(AtkComponent *aComponent,
gint aAccX, gint aAccY,
AtkCoordType aCoordType);
static void getExtentsCB(AtkComponent *aComponent,
gint *aAccX, gint *aAccY,
gint *aAccWidth, gint *aAccHeight,
AtkCoordType aCoordType);
/* the "contains", "get_position", "get_size" can take advantage of
* "get_extents", there is no need to implement them now.
*/
static gboolean grabFocusCB(AtkComponent *aComponent);
/* what are missing now for atk component */
/* ==================================================
* add_focus_handler
* remove_focus_handler
* set_extents
* set_position
* set_size
* get_layer
* get_mdi_zorder
* ==================================================
*/
G_END_DECLS
MaiInterfaceComponent::MaiInterfaceComponent(nsAccessibleWrap *aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceComponent::~MaiInterfaceComponent()
{
}
MaiInterfaceType
MaiInterfaceComponent::GetType()
{
return MAI_INTERFACE_COMPONENT;
}
const GInterfaceInfo *
MaiInterfaceComponent::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_component_info = {
(GInterfaceInitFunc)interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_component_info;
}
/* static functions */
void
interfaceInitCB(AtkComponentIface *aIface)
componentInterfaceInitCB(AtkComponentIface *aIface)
{
NS_ASSERTION(aIface, "Invalid Interface");
if(!aIface)

Просмотреть файл

@ -41,15 +41,36 @@
#ifndef __MAI_INTERFACE_COMPONENT_H__
#define __MAI_INTERFACE_COMPONENT_H__
#include "nsMaiInterface.h"
class MaiInterfaceComponent: public MaiInterface
{
public:
MaiInterfaceComponent(nsAccessibleWrap* aAccWrap);
virtual ~MaiInterfaceComponent();
#include "nsMai.h"
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
};
G_BEGIN_DECLS
/* component interface callbacks */
void componentInterfaceInitCB(AtkComponentIface *aIface);
AtkObject *refAccessibleAtPointCB(AtkComponent *aComponent,
gint aAccX, gint aAccY,
AtkCoordType aCoordType);
void getExtentsCB(AtkComponent *aComponent,
gint *aAccX, gint *aAccY,
gint *aAccWidth, gint *aAccHeight,
AtkCoordType aCoordType);
/* the "contains", "get_position", "get_size" can take advantage of
* "get_extents", there is no need to implement them now.
*/
gboolean grabFocusCB(AtkComponent *aComponent);
/* what are missing now for atk component */
/* ==================================================
* add_focus_handler
* remove_focus_handler
* set_extents
* set_position
* set_size
* get_layer
* get_mdi_zorder
* ==================================================
*/
G_END_DECLS
#endif /* __MAI_INTERFACE_COMPONENT_H__ */

Просмотреть файл

@ -41,55 +41,8 @@
#include "nsString.h"
#include "nsMaiInterfaceEditableText.h"
G_BEGIN_DECLS
static void interfaceInitCB(AtkEditableTextIface *aIface);
/* editabletext interface callbacks */
static gboolean setRunAttributesCB(AtkEditableText *aText,
AtkAttributeSet *aAttribSet,
gint aStartOffset,
gint aEndOffset);
static void setTextContentsCB(AtkEditableText *aText, const gchar *aString);
static void insertTextCB(AtkEditableText *aText,
const gchar *aString, gint aLength, gint *aPosition);
static void copyTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);
static void cutTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);
static void deleteTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);
static void pasteTextCB(AtkEditableText *aText, gint aPosition);
G_END_DECLS
MaiInterfaceEditableText::MaiInterfaceEditableText(nsAccessibleWrap *aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceEditableText::~MaiInterfaceEditableText()
{
}
MaiInterfaceType
MaiInterfaceEditableText::GetType()
{
return MAI_INTERFACE_EDITABLE_TEXT;
}
const GInterfaceInfo *
MaiInterfaceEditableText::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_editabletext_info = {
(GInterfaceInitFunc)interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_editabletext_info;
}
/* statics */
void
interfaceInitCB(AtkEditableTextIface *aIface)
editableTextInterfaceInitCB(AtkEditableTextIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)

Просмотреть файл

@ -41,17 +41,26 @@
#ifndef __MAI_INTERFACE_EDITABLETEXT_H__
#define __MAI_INTERFACE_EDITABLETEXT_H__
#include "nsMaiInterface.h"
#include "nsMai.h"
#include "nsIAccessibleEditableText.h"
class MaiInterfaceEditableText: public MaiInterface
{
public:
MaiInterfaceEditableText(nsAccessibleWrap*);
virtual ~MaiInterfaceEditableText();
G_BEGIN_DECLS
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
};
void editableTextInterfaceInitCB(AtkEditableTextIface *aIface);
/* editabletext interface callbacks */
gboolean setRunAttributesCB(AtkEditableText *aText,
AtkAttributeSet *aAttribSet,
gint aStartOffset,
gint aEndOffset);
void setTextContentsCB(AtkEditableText *aText, const gchar *aString);
void insertTextCB(AtkEditableText *aText,
const gchar *aString, gint aLength, gint *aPosition);
void copyTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);
void cutTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);
void deleteTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);
void pasteTextCB(AtkEditableText *aText, gint aPosition);
G_END_DECLS
#endif /* __MAI_INTERFACE_EDITABLETEXT_H__ */

Просмотреть файл

@ -42,64 +42,8 @@
#include "nsIAccessibleDocument.h"
#include "nsPIAccessNode.h"
G_BEGIN_DECLS
static void interfaceInitCB(AtkHypertextIface *aIface);
/* hypertext interface callbacks */
static AtkHyperlink *getLinkCB(AtkHypertext *aText, gint aLinkIndex);
static gint getLinkCountCB(AtkHypertext *aText);
static gint getLinkIndexCB(AtkHypertext *aText, gint aCharIndex);
G_END_DECLS
MaiInterfaceHypertext::MaiInterfaceHypertext(nsAccessibleWrap *aAccWrap,
nsIWeakReference* aShell):
MaiInterface(aAccWrap),
mWeakShell(aShell)
{
}
MaiInterfaceHypertext::~MaiInterfaceHypertext()
{
mWeakShell = nsnull;
}
MaiInterfaceType
MaiInterfaceHypertext::GetType()
{
return MAI_INTERFACE_HYPERTEXT;
}
nsresult
MaiInterfaceHypertext::GetWeakShell(nsIWeakReference **aWeakShell)
{
nsresult rv = NS_ERROR_FAILURE;
if (mWeakShell) {
*aWeakShell = mWeakShell;
NS_IF_ADDREF(*aWeakShell);
rv = NS_OK;
}
else
*aWeakShell = nsnull;
return rv;
}
const GInterfaceInfo *
MaiInterfaceHypertext::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_hypertext_info = {
(GInterfaceInitFunc)interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_hypertext_info;
}
/* statics */
void
interfaceInitCB(AtkHypertextIface *aIface)
hypertextInterfaceInitCB(AtkHypertextIface *aIface)
{
g_return_if_fail(aIface != NULL);
@ -115,15 +59,6 @@ getLinkCB(AtkHypertext *aText, gint aLinkIndex)
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull);
MaiInterfaceHypertext *maiHypertext =
NS_STATIC_CAST(MaiInterfaceHypertext *,
accWrap->GetMaiInterface(MAI_INTERFACE_HYPERTEXT));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIWeakReference> weakShell;
rv = maiHypertext->GetWeakShell(getter_AddRefs(weakShell));
NS_ENSURE_SUCCESS(rv, nsnull);
nsCOMPtr<nsIAccessibleHyperText> accHyperlink;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleHyperText),
getter_AddRefs(accHyperlink));
@ -134,35 +69,7 @@ getLinkCB(AtkHypertext *aText, gint aLinkIndex)
if (NS_FAILED(rv) || !hyperLink)
return nsnull;
// The MaiHyperlink and its nsIAccessibleHyperlink are in the same cache.
// we take hyperlink->get() as Id for the MaiHyperlink.
// release our ref to the previous one
nsCOMPtr<nsIAccessibleDocument> accessibleDoc =
nsAccessNode::GetDocAccessibleFor(weakShell);
if (!accessibleDoc) {
NS_WARNING("No accessible document for this presshell");
return nsnull;
}
nsCOMPtr<nsIAccessNode> maiNode;
accessibleDoc->GetCachedAccessNode(NS_STATIC_CAST(void*, hyperLink.get()),
getter_AddRefs(maiNode));
// if the maiHyperlink is not in cache, create it.
if (!maiNode) {
maiNode = new MaiHyperlink(hyperLink, nsnull, weakShell);
if (!maiNode) {
NS_WARNING("OUT OF MEMORY");
return nsnull;
}
nsCOMPtr<nsPIAccessNode> pMaiNode = do_QueryInterface(maiNode);
pMaiNode->Init(); // add to cache.
}
// we can get AtkHyperlink from the MaiHyperlink
nsIAccessNode *tmpNode = maiNode;
MaiHyperlink *maiHyperlink = NS_STATIC_CAST(MaiHyperlink *, tmpNode);
/* we should not addref the atkhyperlink because we are "get" not "ref" */
MaiHyperlink *maiHyperlink = new MaiHyperlink(hyperLink);
return maiHyperlink->GetAtkHyperlink();
}

Просмотреть файл

@ -41,22 +41,19 @@
#ifndef __MAI_INTERFACE_HYPERTEXT_H__
#define __MAI_INTERFACE_HYPERTEXT_H__
#include "nsMaiInterface.h"
#include "nsMai.h"
#include "nsMaiHyperlink.h"
#include "nsIAccessibleHyperText.h"
class MaiInterfaceHypertext: public MaiInterface
{
public:
MaiInterfaceHypertext(nsAccessibleWrap *aAccWrap,
nsIWeakReference* aShell);
virtual ~MaiInterfaceHypertext();
G_BEGIN_DECLS
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
nsresult GetWeakShell(nsIWeakReference **aWeakShell);
private:
nsCOMPtr<nsIWeakReference> mWeakShell;
};
void hypertextInterfaceInitCB(AtkHypertextIface *aIface);
/* hypertext interface callbacks */
AtkHyperlink *getLinkCB(AtkHypertext *aText, gint aLinkIndex);
gint getLinkCountCB(AtkHypertext *aText);
gint getLinkIndexCB(AtkHypertext *aText, gint aCharIndex);
G_END_DECLS
#endif /* __MAI_INTERFACE_HYPERTEXT_H__ */

Просмотреть файл

@ -40,55 +40,8 @@
#include "nsMaiInterfaceSelection.h"
G_BEGIN_DECLS
/* selection interface callbacks */
static void interfaceInitCB(AtkSelectionIface *aIface);
static gboolean addSelectionCB(AtkSelection *aSelection,
gint i);
static gboolean clearSelectionCB(AtkSelection *aSelection);
static AtkObject *refSelectionCB(AtkSelection *aSelection,
gint i);
static gint getSelectionCountCB(AtkSelection *aSelection);
static gboolean isChildSelectedCB(AtkSelection *aSelection,
gint i);
static gboolean removeSelectionCB(AtkSelection *aSelection,
gint i);
static gboolean selectAllSelectionCB(AtkSelection *aSelection);
G_END_DECLS
MaiInterfaceSelection::MaiInterfaceSelection(nsAccessibleWrap* aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceSelection::~MaiInterfaceSelection()
{
}
MaiInterfaceType
MaiInterfaceSelection::GetType()
{
return MAI_INTERFACE_SELECTION;
}
const GInterfaceInfo *
MaiInterfaceSelection::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_selection_info = {
(GInterfaceInitFunc) interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_selection_info;
}
/* static functions */
void
interfaceInitCB(AtkSelectionIface *aIface)
selectionInterfaceInitCB(AtkSelectionIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)

Просмотреть файл

@ -41,17 +41,22 @@
#ifndef __MAI_INTERFACE_SELECTION_H__
#define __MAI_INTERFACE_SELECTION_H__
#include "nsMaiInterface.h"
#include "nsMai.h"
#include "nsIAccessibleSelectable.h"
class MaiInterfaceSelection: public MaiInterface
{
public:
MaiInterfaceSelection(nsAccessibleWrap*);
~MaiInterfaceSelection();
G_BEGIN_DECLS
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
};
/* selection interface callbacks */
void selectionInterfaceInitCB(AtkSelectionIface *aIface);
gboolean addSelectionCB(AtkSelection *aSelection, gint i);
gboolean clearSelectionCB(AtkSelection *aSelection);
AtkObject *refSelectionCB(AtkSelection *aSelection, gint i);
gint getSelectionCountCB(AtkSelection *aSelection);
gboolean isChildSelectedCB(AtkSelection *aSelection, gint i);
gboolean removeSelectionCB(AtkSelection *aSelection, gint i);
gboolean selectAllSelectionCB(AtkSelection *aSelection);
G_END_DECLS
#endif /* __MAI_INTERFACE_SELECTION_H__ */

Просмотреть файл

@ -40,111 +40,8 @@
#include "nsMaiInterfaceTable.h"
G_BEGIN_DECLS
/* table interface callbacks */
static void interfaceInitCB(AtkTableIface *aIface);
static AtkObject* refAtCB(AtkTable *aTable, gint aRow, gint aColumn);
static gint getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn);
static gint getColumnAtIndexCB(AtkTable *aTable, gint aIndex);
static gint getRowAtIndexCB(AtkTable *aTable, gint aIndex);
static gint getColumnCountCB(AtkTable *aTable);
static gint getRowCountCB(AtkTable *aTable);
static gint getColumnExtentAtCB(AtkTable *aTable, gint aRow, gint aColumn);
static gint getRowExtentAtCB(AtkTable *aTable, gint aRow, gint aColumn);
static AtkObject* getCaptionCB(AtkTable *aTable);
static const gchar* getColumnDescriptionCB(AtkTable *aTable, gint aColumn);
static AtkObject* getColumnHeaderCB(AtkTable *aTable, gint aColumn);
static const gchar* getRowDescriptionCB(AtkTable *aTable, gint aRow);
static AtkObject* getRowHeaderCB(AtkTable *aTable, gint aRow);
static AtkObject* getSummaryCB(AtkTable *aTable);
static gint getSelectedColumnsCB(AtkTable *aTable, gint **aSelected);
static gint getSelectedRowsCB(AtkTable *aTable, gint **aSelected);
static gboolean isColumnSelectedCB(AtkTable *aTable, gint aColumn);
static gboolean isRowSelectedCB(AtkTable *aTable, gint aRow);
static gboolean isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn);
/* what are missing now for atk table */
/* ==================================================
void (* set_caption) (AtkTable *aTable,
AtkObject *caption);
void (* set_column_description) (AtkTable *aTable,
gint aColumn,
const gchar *description);
void (* set_column_header) (AtkTable *aTable,
gint aColumn,
AtkObject *header);
void (* set_row_description) (AtkTable *aTable,
gint aRow,
const gchar *description);
void (* set_row_header) (AtkTable *aTable,
gint aRow,
AtkObject *header);
void (* set_summary) (AtkTable *aTable,
AtkObject *accessible);
gboolean (* add_row_selection) (AtkTable *aTable,
gint aRow);
gboolean (* remove_row_selection) (AtkTable *aTable,
gint aRow);
gboolean (* add_column_selection) (AtkTable *aTable,
gint aColumn);
gboolean (* remove_column_selection) (AtkTable *aTable,
gint aColumn);
////////////////////////////////////////
// signal handlers
//
void (* row_inserted) (AtkTable *aTable,
gint aRow,
gint num_inserted);
void (* column_inserted) (AtkTable *aTable,
gint aColumn,
gint num_inserted);
void (* row_deleted) (AtkTable *aTable,
gint aRow,
gint num_deleted);
void (* column_deleted) (AtkTable *aTable,
gint aColumn,
gint num_deleted);
void (* row_reordered) (AtkTable *aTable);
void (* column_reordered) (AtkTable *aTable);
void (* model_changed) (AtkTable *aTable);
* ==================================================
*/
G_END_DECLS
MaiInterfaceTable::MaiInterfaceTable(nsAccessibleWrap* aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceTable::~MaiInterfaceTable()
{
}
MaiInterfaceType
MaiInterfaceTable::GetType()
{
return MAI_INTERFACE_TABLE;
}
const GInterfaceInfo *
MaiInterfaceTable::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_table_info = {
(GInterfaceInitFunc)interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_table_info;
}
/* static functions */
void
interfaceInitCB(AtkTableIface *aIface)
tableInterfaceInitCB(AtkTableIface *aIface)
{
g_return_if_fail(aIface != NULL);
@ -358,21 +255,11 @@ getColumnDescriptionCB(AtkTable *aTable, gint aColumn)
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, nsnull);
MaiInterfaceTable *maiTable =
NS_STATIC_CAST(MaiInterfaceTable *,
accWrap->GetMaiInterface(MAI_INTERFACE_TABLE));
NS_ENSURE_TRUE(maiTable, nsnull);
nsAutoString autoStr;
nsresult rv = accTable->GetColumnDescription(aColumn, autoStr);
NS_ENSURE_SUCCESS(rv, nsnull);
const char *description = maiTable->GetColumnDescription();
if (!description) {
nsAutoString autoStr;
nsresult rv = accTable->GetColumnDescription(aColumn, autoStr);
NS_ENSURE_SUCCESS(rv, nsnull);
maiTable->SetColumnDescription(autoStr);
description = maiTable->GetColumnDescription();
}
return description;
return nsAccessibleWrap::ReturnString(autoStr);
}
AtkObject*
@ -422,17 +309,11 @@ getRowDescriptionCB(AtkTable *aTable, gint aRow)
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, nsnull);
MaiInterfaceTable *maiTable =
NS_STATIC_CAST(MaiInterfaceTable *,
accWrap->GetMaiInterface(MAI_INTERFACE_TABLE));
NS_ENSURE_TRUE(maiTable, nsnull);
nsAutoString autoStr;
nsresult rv = accTable->GetRowDescription(aRow, autoStr);
NS_ENSURE_SUCCESS(rv, nsnull);
maiTable->SetRowDescription(autoStr);
return maiTable->GetRowDescription();
return nsAccessibleWrap::ReturnString(autoStr);
}
AtkObject*

Просмотреть файл

@ -41,35 +41,82 @@
#ifndef __MAI_INTERFACE_TABLE_H__
#define __MAI_INTERFACE_TABLE_H__
#include "nsMaiInterface.h"
#include "nsMai.h"
#include "nsIAccessibleTable.h"
class MaiInterfaceTable: public MaiInterface
{
public:
MaiInterfaceTable(nsAccessibleWrap*);
virtual ~MaiInterfaceTable();
G_BEGIN_DECLS
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
/* table interface callbacks */
void tableInterfaceInitCB(AtkTableIface *aIface);
AtkObject* refAtCB(AtkTable *aTable, gint aRow, gint aColumn);
gint getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn);
gint getColumnAtIndexCB(AtkTable *aTable, gint aIndex);
gint getRowAtIndexCB(AtkTable *aTable, gint aIndex);
gint getColumnCountCB(AtkTable *aTable);
gint getRowCountCB(AtkTable *aTable);
gint getColumnExtentAtCB(AtkTable *aTable, gint aRow, gint aColumn);
gint getRowExtentAtCB(AtkTable *aTable, gint aRow, gint aColumn);
AtkObject* getCaptionCB(AtkTable *aTable);
const gchar* getColumnDescriptionCB(AtkTable *aTable, gint aColumn);
AtkObject* getColumnHeaderCB(AtkTable *aTable, gint aColumn);
const gchar* getRowDescriptionCB(AtkTable *aTable, gint aRow);
AtkObject* getRowHeaderCB(AtkTable *aTable, gint aRow);
AtkObject* getSummaryCB(AtkTable *aTable);
gint getSelectedColumnsCB(AtkTable *aTable, gint **aSelected);
gint getSelectedRowsCB(AtkTable *aTable, gint **aSelected);
gboolean isColumnSelectedCB(AtkTable *aTable, gint aColumn);
gboolean isRowSelectedCB(AtkTable *aTable, gint aRow);
gboolean isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn);
const char *GetColumnDescription() {
return mColumnDescription.get();
}
void SetColumnDescription(nsAString &aString) {
CopyUTF16toUTF8(aString, mColumnDescription);
}
/* what are missing now for atk table */
const char *GetRowDescription() {
return mRowDescription.get();
}
void SetRowDescription(nsAString &aString) {
CopyUTF16toUTF8(aString, mRowDescription);
}
/* ==================================================
void (* set_caption) (AtkTable *aTable,
AtkObject *caption);
void (* set_column_description) (AtkTable *aTable,
gint aColumn,
const gchar *description);
void (* set_column_header) (AtkTable *aTable,
gint aColumn,
AtkObject *header);
void (* set_row_description) (AtkTable *aTable,
gint aRow,
const gchar *description);
void (* set_row_header) (AtkTable *aTable,
gint aRow,
AtkObject *header);
void (* set_summary) (AtkTable *aTable,
AtkObject *accessible);
gboolean (* add_row_selection) (AtkTable *aTable,
gint aRow);
gboolean (* remove_row_selection) (AtkTable *aTable,
gint aRow);
gboolean (* add_column_selection) (AtkTable *aTable,
gint aColumn);
gboolean (* remove_column_selection) (AtkTable *aTable,
gint aColumn);
private:
nsCString mColumnDescription;
nsCString mRowDescription;
};
////////////////////////////////////////
// signal handlers
//
void (* row_inserted) (AtkTable *aTable,
gint aRow,
gint num_inserted);
void (* column_inserted) (AtkTable *aTable,
gint aColumn,
gint num_inserted);
void (* row_deleted) (AtkTable *aTable,
gint aRow,
gint num_deleted);
void (* column_deleted) (AtkTable *aTable,
gint aColumn,
gint num_deleted);
void (* row_reordered) (AtkTable *aTable);
void (* column_reordered) (AtkTable *aTable);
void (* model_changed) (AtkTable *aTable);
* ==================================================
*/
G_END_DECLS
#endif /* __MAI_INTERFACE_TABLE_H__ */

Просмотреть файл

@ -42,89 +42,8 @@
#include "nsMaiInterfaceText.h"
#include "nsString.h"
G_BEGIN_DECLS
static void interfaceInitCB(AtkTextIface *aIface);
/* text interface callbacks */
static gchar *getTextCB(AtkText *aText,
gint aStartOffset, gint aEndOffset);
static gchar *getTextAfterOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset);
static gchar *getTextAtOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset);
static gunichar getCharacterAtOffsetCB(AtkText *aText, gint aOffset);
static gchar *getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset);
static gint getCaretOffsetCB(AtkText *aText);
static AtkAttributeSet *getRunAttributesCB(AtkText *aText, gint aOffset,
gint *aStartOffset,
gint *aEndOffset);
static AtkAttributeSet* getDefaultAttributesCB(AtkText *aText);
static void getCharacterExtentsCB(AtkText *aText, gint aOffset,
gint *aX, gint *aY,
gint *aWidth, gint *aHeight,
AtkCoordType aCoords);
static gint getCharacterCountCB(AtkText *aText);
static gint getOffsetAtPointCB(AtkText *aText,
gint aX, gint aY,
AtkCoordType aCoords);
static gint getSelectionCountCB(AtkText *aText);
static gchar *getSelectionCB(AtkText *aText, gint aSelectionNum,
gint *aStartOffset, gint *aEndOffset);
// set methods
static gboolean addSelectionCB(AtkText *aText,
gint aStartOffset,
gint aEndOffset);
static gboolean removeSelectionCB(AtkText *aText,
gint aSelectionNum);
static gboolean setSelectionCB(AtkText *aText, gint aSelectionNum,
gint aStartOffset, gint aEndOffset);
static gboolean setCaretOffsetCB(AtkText *aText, gint aOffset);
/*************************************************
// signal handlers
//
static void TextChangedCB(AtkText *aText, gint aPosition, gint aLength);
static void TextCaretMovedCB(AtkText *aText, gint aLocation);
static void TextSelectionChangedCB(AtkText *aText);
*/
G_END_DECLS
MaiInterfaceText::MaiInterfaceText(nsAccessibleWrap *aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceText::~MaiInterfaceText()
{
}
MaiInterfaceType
MaiInterfaceText::GetType()
{
return MAI_INTERFACE_TEXT;
}
const GInterfaceInfo *
MaiInterfaceText::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_text_info = {
(GInterfaceInitFunc)interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_text_info;
}
/* statics */
void
interfaceInitCB(AtkTextIface *aIface)
textInterfaceInitCB(AtkTextIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)
@ -141,13 +60,13 @@ interfaceInitCB(AtkTextIface *aIface)
aIface->get_character_extents = getCharacterExtentsCB;
aIface->get_character_count = getCharacterCountCB;
aIface->get_offset_at_point = getOffsetAtPointCB;
aIface->get_n_selections = getSelectionCountCB;
aIface->get_selection = getSelectionCB;
aIface->get_n_selections = getTextSelectionCountCB;
aIface->get_selection = getTextSelectionCB;
// set methods
aIface->add_selection = addSelectionCB;
aIface->remove_selection = removeSelectionCB;
aIface->set_selection = setSelectionCB;
aIface->add_selection = addTextSelectionCB;
aIface->remove_selection = removeTextSelectionCB;
aIface->set_selection = setTextSelectionCB;
aIface->set_caret_offset = setCaretOffsetCB;
}
@ -409,7 +328,7 @@ getOffsetAtPointCB(AtkText *aText,
}
gint
getSelectionCountCB(AtkText *aText)
getTextSelectionCountCB(AtkText *aText)
{
/* no implemetation in nsIAccessibleText??? */
@ -420,8 +339,8 @@ getSelectionCountCB(AtkText *aText)
}
gchar *
getSelectionCB(AtkText *aText, gint aSelectionNum,
gint *aStartOffset, gint *aEndOffset)
getTextSelectionCB(AtkText *aText, gint aSelectionNum,
gint *aStartOffset, gint *aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull);
@ -445,9 +364,9 @@ getSelectionCB(AtkText *aText, gint aSelectionNum,
// set methods
gboolean
addSelectionCB(AtkText *aText,
gint aStartOffset,
gint aEndOffset)
addTextSelectionCB(AtkText *aText,
gint aStartOffset,
gint aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, FALSE);
@ -463,8 +382,8 @@ addSelectionCB(AtkText *aText,
}
gboolean
removeSelectionCB(AtkText *aText,
gint aSelectionNum)
removeTextSelectionCB(AtkText *aText,
gint aSelectionNum)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, FALSE);
@ -480,8 +399,8 @@ removeSelectionCB(AtkText *aText,
}
gboolean
setSelectionCB(AtkText *aText, gint aSelectionNum,
gint aStartOffset, gint aEndOffset)
setTextSelectionCB(AtkText *aText, gint aSelectionNum,
gint aStartOffset, gint aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, FALSE);

Просмотреть файл

@ -41,17 +41,60 @@
#ifndef __MAI_INTERFACE_TEXT_H__
#define __MAI_INTERFACE_TEXT_H__
#include "nsMaiInterface.h"
#include "nsMai.h"
#include "nsIAccessibleText.h"
class MaiInterfaceText: public MaiInterface
{
public:
MaiInterfaceText(nsAccessibleWrap*);
virtual ~MaiInterfaceText();
G_BEGIN_DECLS
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
};
void textInterfaceInitCB(AtkTextIface *aIface);
/* text interface callbacks */
gchar *getTextCB(AtkText *aText,
gint aStartOffset, gint aEndOffset);
gchar *getTextAfterOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset);
gchar *getTextAtOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset);
gunichar getCharacterAtOffsetCB(AtkText *aText, gint aOffset);
gchar *getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset);
gint getCaretOffsetCB(AtkText *aText);
AtkAttributeSet *getRunAttributesCB(AtkText *aText, gint aOffset,
gint *aStartOffset,
gint *aEndOffset);
AtkAttributeSet* getDefaultAttributesCB(AtkText *aText);
void getCharacterExtentsCB(AtkText *aText, gint aOffset,
gint *aX, gint *aY,
gint *aWidth, gint *aHeight,
AtkCoordType aCoords);
gint getCharacterCountCB(AtkText *aText);
gint getOffsetAtPointCB(AtkText *aText,
gint aX, gint aY,
AtkCoordType aCoords);
gint getTextSelectionCountCB(AtkText *aText);
gchar *getTextSelectionCB(AtkText *aText, gint aSelectionNum,
gint *aStartOffset, gint *aEndOffset);
// set methods
gboolean addTextSelectionCB(AtkText *aText,
gint aStartOffset,
gint aEndOffset);
gboolean removeTextSelectionCB(AtkText *aText,
gint aSelectionNum);
gboolean setTextSelectionCB(AtkText *aText, gint aSelectionNum,
gint aStartOffset, gint aEndOffset);
gboolean setCaretOffsetCB(AtkText *aText, gint aOffset);
/*************************************************
// signal handlers
//
void TextChangedCB(AtkText *aText, gint aPosition, gint aLength);
void TextCaretMovedCB(AtkText *aText, gint aLocation);
void TextSelectionChangedCB(AtkText *aText);
*/
G_END_DECLS
#endif /* __MAI_INTERFACE_TEXT_H__ */

Просмотреть файл

@ -40,51 +40,8 @@
#include "nsMaiInterfaceValue.h"
G_BEGIN_DECLS
/*value interface callbacks*/
static void interfaceInitCB(AtkValueIface *aIface);
static void getCurrentValueCB(AtkValue *obj,
GValue *value);
static void getMaximumValueCB(AtkValue *obj,
GValue *value);
static void getMinimumValueCB(AtkValue *obj,
GValue *value);
static gboolean setCurrentValueCB(AtkValue *obj,
const GValue *value);
G_END_DECLS
MaiInterfaceValue::MaiInterfaceValue(nsAccessibleWrap *aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceValue::~MaiInterfaceValue()
{
}
MaiInterfaceType
MaiInterfaceValue::GetType()
{
return MAI_INTERFACE_VALUE;
}
const GInterfaceInfo *
MaiInterfaceValue::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_value_info = {
(GInterfaceInitFunc) interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_value_info;
}
/* static functions */
void
interfaceInitCB(AtkValueIface *aIface)
valueInterfaceInitCB(AtkValueIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)

Просмотреть файл

@ -41,17 +41,18 @@
#ifndef __MAI_INTERFACE_VALUE_H__
#define __MAI_INTERFACE_VALUE_H__
#include "nsMaiInterface.h"
#include "nsMai.h"
#include "nsIAccessibleValue.h"
class MaiInterfaceValue: public MaiInterface
{
public:
MaiInterfaceValue(nsAccessibleWrap*);
~MaiInterfaceValue();
G_BEGIN_DECLS
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
};
/*value interface callbacks*/
void valueInterfaceInitCB(AtkValueIface *aIface);
void getCurrentValueCB(AtkValue *obj, GValue *value);
void getMaximumValueCB(AtkValue *obj, GValue *value);
void getMinimumValueCB(AtkValue *obj, GValue *value);
gboolean setCurrentValueCB(AtkValue *obj, const GValue *value);
G_END_DECLS
#endif /* __MAI_INTERFACE_VALUE_H__ */